-
Notifications
You must be signed in to change notification settings - Fork 447
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
[VL] Make bloom_filter_agg fall back when might_contain is not transformable #3917
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,33 @@ class Spark34Shims extends SparkShims { | |
@transient locations: Array[String] = Array.empty): PartitionedFile = | ||
PartitionedFile(partitionValues, SparkPath.fromPathString(filePath), start, length, locations) | ||
|
||
override def handleBloomFilterFallback(plan: SparkPlan)(fun: SparkPlan => Unit): Unit = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method looks repeated. If so, maybe, we can just move this method into a common place. But just move the check for Spark 3.3/3.4:
Spark 3.2:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, thanks, |
||
def tagNotTransformableRecursive(p: SparkPlan): Unit = { | ||
p match { | ||
case agg: org.apache.spark.sql.execution.aggregate.ObjectHashAggregateExec | ||
if agg.aggregateExpressions.exists( | ||
expr => expr.aggregateFunction.isInstanceOf[BloomFilterAggregate]) => | ||
fun(agg) | ||
tagNotTransformableRecursive(agg.child) | ||
case a: org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec => | ||
tagNotTransformableRecursive(a.executedPlan) | ||
case _ => | ||
p.children.map(tagNotTransformableRecursive) | ||
} | ||
} | ||
|
||
plan.transformAllExpressions { | ||
case mc @ BloomFilterMightContain(sub: org.apache.spark.sql.execution.ScalarSubquery, _) => | ||
tagNotTransformableRecursive(sub.plan) | ||
mc | ||
case mc @ BloomFilterMightContain( | ||
g @ GetStructField(sub: org.apache.spark.sql.execution.ScalarSubquery, _, _), | ||
_) => | ||
tagNotTransformableRecursive(sub.plan) | ||
mc | ||
} | ||
} | ||
|
||
private def invalidBucketFile(path: String): Throwable = { | ||
new SparkException( | ||
errorClass = "INVALID_BUCKET_FILE", | ||
|
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.
Maybe, we can move this part into a dedicated rule after
AddTransformHintRule
(see link).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.
Thanks, moved to a separate rule.