-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16994][SQL] Whitelist operators for predicate pushdown #14713
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1208,17 +1208,27 @@ object PushDownPredicate extends Rule[LogicalPlan] with PredicateHelper { | |
| filter | ||
| } | ||
|
|
||
| // two filters should be combine together by other rules | ||
| case filter @ Filter(_, _: Filter) => filter | ||
| // should not push predicates through sample, or will generate different results. | ||
| case filter @ Filter(_, _: Sample) => filter | ||
|
|
||
| case filter @ Filter(condition, u: UnaryNode) if u.expressions.forall(_.deterministic) => | ||
| case filter @ Filter(condition, u: UnaryNode) | ||
| if canPushThrough(u) && u.expressions.forall(_.deterministic) => | ||
| pushDownPredicate(filter, u.child) { predicate => | ||
| u.withNewChildren(Seq(Filter(predicate, u.child))) | ||
| } | ||
| } | ||
|
|
||
| private def canPushThrough(p: UnaryNode): Boolean = p match { | ||
| case _: AppendColumns => true | ||
| case _: BroadcastHint => true | ||
| case _: Distinct => true | ||
| case _: Generate => true | ||
| case _: Pivot => true | ||
| case _: RedistributeData => true | ||
| case _: Repartition => true | ||
| case _: ScriptTransformation => true | ||
| case _: Sort => true | ||
| case _: With => true | ||
|
||
| case _ => false | ||
| } | ||
|
|
||
| private def pushDownPredicate( | ||
| filter: Filter, | ||
| grandchild: LogicalPlan)(insertFilter: Expression => LogicalPlan): LogicalPlan = { | ||
|
|
||
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.
how about
Project?Uh oh!
There was an error while loading. Please reload this page.
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.
Project, Aggregate, Window & Union are treated as special cases. (was wondering the same)
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 added some comment