[FLINK-20767][table planner] Support filter push down on nested fields#23313
Conversation
2583185 to
bc31ebd
Compare
|
@flinkbot run azure |
fe34258 to
74ccf82
Compare
|
@wuchong @swuferhong @JingsongLi @becketqin please review |
|
Also tagging @slinkydeveloper |
swuferhong
left a comment
There was a problem hiding this comment.
Hi, @venkata91 . Thanks for your contribution. The PR looks good in general. I left some comments.
| util.verifyRelPlan( | ||
| "SELECT id FROM NestedTable WHERE `deepNestedWith.`.nested.```name` = 'foo'"); |
There was a problem hiding this comment.
One small question, is this the standard way of adding "`"? I couldn't find the relevant documents.
There was a problem hiding this comment.
This tests the case where the column name has backtick () in it and should be escaped as the whole nested field expression name itself has to be wrapped inside backticks. File formats like ORC etc requires the entire nested field to be with in backticks ()
becketqin
left a comment
There was a problem hiding this comment.
@venkata91 Thanks for the patch. LGTM overall. I agree with @swuferhong that we need to add some IT cases for E2E test.
|
@becketqin @swuferhong Addressed review comments mainly adding ITCases. |
lsyldliu
left a comment
There was a problem hiding this comment.
@venkata91 Thanks for your contribution, please use git rebase instead of git merge. I can't get your all commits correctly when pull your pr to local.
@lsyldliu Do you want me to fix it? |
I used to use rebase before. But with |
- Implement nested fields filter push down 1. See if a new ResolvedExpression called NestedFieldReferenceExpression has to be implemented or not. If implemented, convert the NestedFieldReferenceExpression in to RexFieldAccess 2. Revisit ExpressionConverter to see if the FieldReferenceExpression has to be converted to a RexFieldAccess 3. Add more tests 4. Check other rules like PushFilterInCalcIntoTableSourceScanRule, PushPartitionIntoTableSourceScanRule
48b49b2 to
dbd3cdf
Compare
nvm, fixed it as requested. |
|
@swuferhong @becketqin @lsyldliu Gentle ping for reviews. |
becketqin
left a comment
There was a problem hiding this comment.
LGTM, just one minor comment regarding the usage of Optional.
Ping @swuferhong for a review as well.
dbd3cdf to
8924b93
Compare
|
Merged to master: 5be4688 |
What is the purpose of the change
Support filter push down on nested fields
For example:
SELECT * FROM users WHERE user.age > 18In the above SQL,
user.age > 18filter can be pushed to table source to avoid scanning records that don't match the predicate. This is especially useful in analytics with columnar formats as well as in JDBC datasources.Brief change log
ResolvedExpressioncalledNestedFieldReferenceExpressionto handle filters on nested fieldsRexNodeToExpressionConverterandExpressionConverterto convertRexFieldAccess<=>NestedFieldReferenceExpressionand vice versa.Verifying this change
Added unit tests in
PushFilterIntoTableSourceScanRuleTestDoes this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation