-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(cubesql): Push down __user
meta filter further
#9711
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
fix(cubesql): Push down __user
meta filter further
#9711
Conversation
Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9711 +/- ##
===========================================
+ Coverage 0 84.19% +84.19%
===========================================
Files 0 230 +230
Lines 0 85318 +85318
===========================================
+ Hits 0 71837 +71837
- Misses 0 13481 +13481
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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. Left minor code change (optional)...
let predicates_iter = predicates.into_iter(); | ||
if reverse { | ||
predicates_iter.rev().reduce(|last, next| Expr::BinaryExpr { | ||
left: Box::new(last), | ||
op: Operator::And, | ||
right: Box::new(next), | ||
}) | ||
.ok_or_else(|| { | ||
DataFusionError::Internal( | ||
"Unable to optimize plan: can't concatenate predicates, vec is unexpectedly empty" | ||
.to_string(), | ||
) | ||
} else { | ||
predicates_iter.reduce(|last, next| Expr::BinaryExpr { | ||
left: Box::new(last), | ||
op: Operator::And, | ||
right: Box::new(next), | ||
}) | ||
} |
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.
Mb smth like:
let predicates_iter = predicates.into_iter();
let predicates_iter = if reverse { predicates_iter.rev() } else { predicates_iter };
predicates_iter.reduce(|last, next| Expr::BinaryExpr {
left: Box::new(last),
op: Operator::And,
right: Box::new(next),
})
No copy/paste...
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 wanted to do the same but they're different structures, so can't really be put in the same let
.
Check List
Description of Changes Made
This PR extends
FilterMetaSplit
optimizer to push down__user
filter as much as possible. This solves an issue with SQL push down queries with joins and multiple__user
filters being part of the generated SQL.Related test is included.