-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add RelSort
and comparator between PartiQLValue
#1343
Conversation
331e319
to
16931ad
Compare
return visitRex(node.root, ctx) | ||
} | ||
|
||
// REX | ||
|
||
override fun visitRex(node: Rex, ctx: Unit): Operator.Expr { | ||
return super.visitRexOp(node.op, ctx) as Operator.Expr | ||
override fun visitRex(node: Rex, ctx: StaticType?): Operator.Expr { |
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.
In the current plan, the rex node's type is only accessible on the Rex
and not the inner classes (e.g. Rex.Op.Collection
). Passing it along in the context allows the visitor for the inner classes to access the type, which is needed by some nodes like Rex.Op.Collection
.
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.
I would really like for our internal IRs to keep the types in the node by defining a type field as part of the PlanNode base class. This would require more codegen work which probably isn't worth the time at the moment. Please let me know if you have an additional ideas here
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.
Hmm I'd need to play around with the generated code a bit to see if there's a better way. Only concern I'd have is that the type
field for Rex
is a different type (i.e. StaticType
) than the type
field for Rel
(i.e. Rel.Type
which has schema and props). Probably that representation in the PlanNode
base class would be an enum that could be either of those type
definitions?
Anyways, perhaps we should tackle this in another issue/PR.
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 you check out PlanTyper, you'll see we use two different visitors since the type is parameterized. There are many ways around this, but really I wish we didn't have the union types. What would be better is for the code generator to support abstract fields.
The best situation however would be handwritten nodes with annotation based generation like Lombok. This would give us the most control.
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 you check out PlanTyper, you'll see we use two different visitors since the type is parameterized.
Oh I see. The separate visitors for Rel and Rex doesn't seem too cumbersome.
The best situation however would be handwritten nodes with annotation based generation like Lombok. This would give us the most control.
Agree w/ a mix of code-generated nodes and handwritten nodes would give us the most flexibility when it comes to these interfaces.
@@ -0,0 +1,429 @@ | |||
package org.partiql.eval.internal.util |
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.
Tests are taken from NaturalExprValueComparatorsTest.kt but creates and compares the PartiQLValue
s explictly rather than passing text strings and running the evaluator.
7fdfab7
to
50f1007
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## partiql-eval #1343 +/- ##
===============================================
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. |
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt
Outdated
Show resolved
Hide resolved
partiql-planner/src/test/kotlin/org/partiql/planner/util/PlanNodeEquivalentVisitor.kt
Outdated
Show resolved
Hide resolved
partiql-eval/src/main/kotlin/org/partiql/eval/internal/util/PartiQLValueComparator.kt
Outdated
Show resolved
Hide resolved
return visitRex(node.root, ctx) | ||
} | ||
|
||
// REX | ||
|
||
override fun visitRex(node: Rex, ctx: Unit): Operator.Expr { | ||
return super.visitRexOp(node.op, ctx) as Operator.Expr | ||
override fun visitRex(node: Rex, ctx: StaticType?): Operator.Expr { |
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.
I would really like for our internal IRs to keep the types in the node by defining a type field as part of the PlanNode base class. This would require more codegen work which probably isn't worth the time at the moment. Please let me know if you have an additional ideas here
partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelSort.kt
Outdated
Show resolved
Hide resolved
partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelSort.kt
Outdated
Show resolved
Hide resolved
partiql-types/src/main/kotlin/org/partiql/value/PartiQLValueComparator.kt
Outdated
Show resolved
Hide resolved
partiql-types/src/main/kotlin/org/partiql/value/PartiQLValue.kt
Outdated
Show resolved
Hide resolved
) : PlanBaseVisitor<Operator, Symbols>() { | ||
private val session: PartiQLEngine.Session, | ||
private val symbols: Symbols | ||
) : PlanBaseVisitor<Operator, StaticType?>() { |
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.
(Following rebase of partiql-eval) Change ctx
to have type StaticType?
. Initialize symbols
as part of Compiler
constructor since it is not scope sensitive.
@@ -203,6 +203,20 @@ class PartiQLEngineDefaultTest { | |||
) | |||
) | |||
), | |||
SuccessTestCase( |
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.
(Following rebase of partiql-eval) This test and the EXCLUDE
tests from L250-315 were inadvertently deleted in #1362.
Conformance comparison report-Cross Engine
Number failing in both: 435 Number passing in legacy engine but fail in eval engine: 3873 Number failing in legacy engine but pass in eval engine: 3 Click here to see
Conformance comparison report-Cross Commit-LEGACY
Number failing in both: 438 Number passing in Base (27081a7) but now fail: 0 Number failing in Base (27081a7) but now pass: 0 Conformance comparison report-Cross Commit-EVAL
Number failing in both: 4308 Number passing in Base (27081a7) but now fail: 0 Number failing in Base (27081a7) but now pass: 42 |
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.
Nice work
Description
RelSort
(ORDER BY) for new evaluatorComparator
betweenPartiQLValue
s to partiql-evalRex.Op.Select
to output a list when input relation has the ordered propertyRex.Op.Collection
to output the appropriate collection rather than always outputting a bagClobValue
to implementScalarValue
rather thanTextValue
Other Information
Updated Unreleased Section in CHANGELOG: [NO]
Any backward-incompatible changes? [YES]
ClobType
to implementScalarValue
rather thanTextValue
Any new external dependencies? [NO]
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES]
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.