-
Notifications
You must be signed in to change notification settings - Fork 85
fix(isthmus): handle subqueries with outer field references #426
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
base: main
Are you sure you want to change the base?
Conversation
For the sake of reviewability could I ask you split this into 3-ish PRs. One for your initial cleanups/improvements, one for just the visitor changes, and one for subquery changes. |
Sure, I already thought that this might be necessary. |
First extracted PR for the visitor changes: #427 |
7b6ef99
to
764206a
Compare
I removed the cleanup from this PR and rebased it on #427 |
a2f0c8e
to
86545b6
Compare
updated to use the new |
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.
Did a very cursory first pass.
Something that I think would be helpful would be some tests based directly on Substrait plans, and not just the TPC based tests. This would help contributors, myself included, understand what exactly the structure of these subqueries looks like in Substrait, and how your processing is being applied on top of it.
return applyRemap(node, project.getRemap()); | ||
} | ||
|
||
@Override | ||
public RelNode visit(Cross cross, EmptyVisitationContext context) throws RuntimeException { | ||
public RelNode visit(Cross cross, Context context) throws RuntimeException { | ||
RelNode left = cross.getLeft().accept(this, context); | ||
RelNode right = cross.getRight().accept(this, context); | ||
// Calcite represents CROSS JOIN as the equivalent INNER JOIN with true condition |
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 we're going to handle subqueries, don't we need to propagate the parents through every relation type?
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.
not entirely sure how you mean that. we need to propagate the context through every relation type but we do not need to track every relation as a parent but only those relations that can contain subqueries in their expressions.
isthmus/src/main/java/io/substrait/isthmus/expression/ExpressionRexConverter.java
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/ExpressionRexConverter.java
Show resolved
Hide resolved
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.
Did a very cursory first pass.
Something that I think would be helpful would be some tests based directly on Substrait plans, and not just the TPC based tests. This would help contributors, myself included, understand what exactly the structure of these subqueries looks like in Substrait, and how your processing is being applied on top of it.
will spend some time on tests towards end of the week when I have some spare time |
f574de2
to
1e09ea6
Compare
protected final SubstraitToCalcite converter = new SubstraitToCalcite(extensions, typeFactory); | ||
|
||
@Test | ||
void testOuterFieldReferenceOneStep() { |
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.
@vbarua what do you think about this testing approach?
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 do have tests for scalar subqueries, in predicate and set predicate with various levels of depth. I guess the test coverage should be good enough. let me know if there's anything else I should add
6481a08
to
8d8efb8
Compare
fixes substrait-io#382 Signed-off-by: Niels Pardon <[email protected]>
changes
SubstraitRelNodeConverter
andExpressionRexConverter
to support handling subqueries with outer field referencesfixes #382
replaces #383