-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partiql eval wildcard #1374
Partiql eval wildcard #1374
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## partiql-eval #1374 +/- ##
===============================================
Coverage ? 50.32%
Complexity ? 1045
===============================================
Files ? 165
Lines ? 13129
Branches ? 2452
===============================================
Hits ? 6607
Misses ? 5862
Partials ? 660
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Conformance comparison report-Cross Engine
Number failing in both: 267 Number passing in eval engine but fail in legacy engine: 169 Number failing in eval engine but pass in legacy engine: 976 Conformance comparison report-Cross Commit-EVAL
Number failing in both: 1243 Number passing in Base (f2369ba) but now fail: 0 Number failing in Base (f2369ba) but now pass: 46 Conformance comparison report-Cross Commit-LEGACY
Number failing in both: 436 Number passing in Base (f2369ba) but now fail: 0 Number failing in Base (f2369ba) but now pass: 0 |
397ed08
to
467a954
Compare
partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt
Outdated
Show resolved
Hide resolved
partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt
Outdated
Show resolved
Hide resolved
@@ -29,6 +29,7 @@ internal data class TypeEnv( | |||
internal fun getScope(depth: Int): TypeEnv { | |||
return when (depth) { | |||
0 -> this | |||
// TODO: Consider resolve the variable to the correct index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We calculate the correct index in Compiler
. There are a couple reasons that we can discuss.
partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt
Outdated
Show resolved
Hide resolved
30fe790
to
a9aca3a
Compare
@Test | ||
fun wildCard2() { | ||
val query = """ | ||
{'a':1, 'b':2}.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a query for <someTuple>.*.a
?
is Expr.Path.Step.Unpivot -> { | ||
// Unpivot produces two binding, in this context we want the value, | ||
// which always going to be the second binding | ||
val op = rexOpVarLocal(1, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it matter at all what values you put in here? Same goes for the Wildcard below.
If so, does this work when you have more than two path expressions with wildcards/unpivots? Can you add a test to PartiQLEngineDefaultTest
for an example like: <someList>[*].books[*].author[*].name[*].middle_initial
and maybe something similar for unpivots?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Specifically:
SELECT VALUE vn.pn
|_ this came from pathNavi, which is rexOpVarLocal(1,$last).pn
|_ we change the root node to rexOpVarLocal(0, $last_in_from_schema).pn
FROM
u1 e AS v1,
u2 @v1.p1 AS v2,
|_ this needs to be rexOpVarLocal(1,$last).
. . .,
un @vn−1.pn−1 AS vn,
|_ this needs to be rexOpVarLocal(1,$last)
Those tests you asking are included in the conformance test:
{
name:"pathDoubleWildCard",
statement:"stores[*].books[*].title",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
"A",
"B",
"C",
"D",
"A",
"E",
"F"
]
}
},
{
name:"pathDoubleUnpivotWildCard",
statement:"friends.*.likes.*.type",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
"dog",
"human",
"dog",
"cat"
]
}
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check the conformance report details here.
I think the conformance tests should be sufficient. But I can also port the tests to PartiQLEngineDefaultTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so, does this work when you have more than two path expressions with wildcards/unpivots?
This doesn't work when you have more than two path expressions. See this commit: e8e31d9.
The example above doesn't compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has to do with the 1, 1
and 1, 0
you've used for rexOpVarLocal
for unpivots and wildcards. Those only work for the test cases you've written. Since JOINs really concatenate the LHS schema with the RHS schema, you can't always assume that the item you'll be referencing will always be at some specific index. It needs to be calculated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see what you mean. You are right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comments.
a9aca3a
to
490c708
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Relevant Issues
Description
Other Information
Updated Unreleased Section in CHANGELOG: [YES/NO]
Any backward-incompatible changes? [YES/NO]
errors for users that are using our public APIs or the entities that have
public
visibility in our code-base. >Any new external dependencies? [YES/NO]
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES/NO]
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.