-
Notifications
You must be signed in to change notification settings - Fork 180
Support join with dynamic fields #4746
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: feature/permissive
Are you sure you want to change the base?
Support join with dynamic fields #4746
Conversation
de18e85 to
bd31d16
Compare
integ-test/src/test/java/org/opensearch/sql/calcite/standalone/CalciteDynamicFieldsJoinIT.java
Outdated
Show resolved
Hide resolved
56eb6f9 to
e2587bd
Compare
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
1bdfe53 to
ce40b23
Compare
Swiddis
left a comment
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.
Some design thoughts. I don't see any correctness issues but I'm a little concerned about maintainability. Especially this separate handling for left & right seems error-prone if we revisit this code later.
| boolean isInLeft; | ||
| boolean isInRight; |
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.
Is keeping this as two booleans a better choice than having a left/right enum?
Keeping two separate booleans introduces the trivial illegal state of having both of them be true or false, if a code path accidentally triggers it. Enum might be safer.
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.
Field with the same name could exist in both side at the same time, and that's why I ended up with this approach.
core/src/main/java/org/opensearch/sql/calcite/rel/QualifiedNameResolver.java
Outdated
Show resolved
Hide resolved
| context.relBuilder.literal(context.sysLimit.joinSubsearchLimit()))); | ||
| } | ||
| List<String> leftAllFields = context.fieldBuilder.getAllFieldNames(1); | ||
| List<String> rightAllFields = context.fieldBuilder.getAllFieldNames(0); |
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 the fault of this PR, but CalciteRelNodeVisitor is already a very large file, and I dislike that we're adding more complexity with this logic.
I'd like if we could move the bulk of this visit logic to a dedicated class and leverage that to simplify the method. I did similar refactoring for SPath via rewriteAsEval.
I also think the class would be a better place to encapsulate the left/right distinction, to make it easier to vet that we've applied any relevant logic to both halves.
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 totally agree with that.
Although, I don't want to do that in this series of PRs as it would make it difficult to merge back to main branch.
| public RexNode visitCall(RexCall call) { | ||
| if (call.getKind() == SqlKind.EQUALS) { | ||
| RexNode n0 = call.operands.get(0); | ||
| RexNode n1 = call.operands.get(1); | ||
| return super.visitCall((RexCall) equalsWithCastAsNeeded(n0, n1)); | ||
| } else { | ||
| return super.visitCall(call); | ||
| } | ||
| } |
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.
question (non-blocking): Can you explain this more? What's special about EQUALS 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.
Ah, forgot to add comment. I'll add comment.
It is a workaround for Calcite issue: https://issues.apache.org/jira/browse/CALCITE-7206
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
a093225 to
3cc00f7
Compare
|
This PR is stalled because it has been open for 2 weeks with no activity. |
This PR is for feature branch
feature/permissiveDescription
compare(Object, Object)issue in Calcite: https://issues.apache.org/jira/browse/CALCITE-7206Related Issues
Permissive mode RFC: #4349
Dynamic fields RFC: #4433
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.