-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-36647][SQL][TESTS] Push down Aggregate (Min/Max/Count) for Parquet if filter is on partition col #34248
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
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,7 +221,7 @@ abstract class ParquetAggregatePushDownSuite | |
| } | ||
| } | ||
|
|
||
| test("aggregate push down - query with filter not push down") { | ||
| test("aggregate push down - aggregate with data filter cannot be pushed down") { | ||
| val data = Seq((-2, "abc", 2), (3, "def", 4), (6, "ghi", 2), (0, null, 19), | ||
| (9, "mno", 7), (2, null, 7)) | ||
| withParquetTable(data, "t") { | ||
|
|
@@ -240,6 +240,30 @@ abstract class ParquetAggregatePushDownSuite | |
| } | ||
| } | ||
|
|
||
| test("aggregate push down - aggregate with partition filter can be pushed down") { | ||
| withTempPath { dir => | ||
| spark.range(10).selectExpr("id", "id % 3 as p") | ||
| .write.partitionBy("p").parquet(dir.getCanonicalPath) | ||
| withTempView("tmp") { | ||
| spark.read.parquet(dir.getCanonicalPath).createOrReplaceTempView("tmp"); | ||
| val enableVectorizedReader = Seq("false", "true") | ||
| for (testVectorizedReader <- enableVectorizedReader) { | ||
|
||
| withSQLConf(SQLConf.PARQUET_AGGREGATE_PUSHDOWN_ENABLED.key -> "true", | ||
| vectorizedReaderEnabledKey -> testVectorizedReader) { | ||
| val max = sql("SELECT max(id) FROM tmp WHERE p = 0") | ||
|
||
| max.queryExecution.optimizedPlan.collect { | ||
| case _: DataSourceV2ScanRelation => | ||
| val expected_plan_fragment = | ||
| "PushedAggregation: [MAX(id)]" | ||
| checkKeywordsExistsInExplain(max, expected_plan_fragment) | ||
| } | ||
| checkAnswer(max, Seq(Row(9))) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| test("aggregate push down - push down only if all the aggregates can be pushed down") { | ||
| val data = Seq((-2, "abc", 2), (3, "def", 4), (6, "ghi", 2), (0, null, 19), | ||
| (9, "mno", 7), (2, null, 7)) | ||
|
|
||
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.
So group by on partition column is not supported yet. Then this comment is not correct.