-
Notifications
You must be signed in to change notification settings - Fork 297
chore: fix native shuffle for batches with no columns and 0 row count #3858
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
base: main
Are you sure you want to change the base?
Changes from all commits
953919c
3a3b715
c2a8f27
dadbec0
5120fd9
dbe2bf6
88a3ece
5a04132
f64fe9e
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 |
|---|---|---|
|
|
@@ -474,4 +474,34 @@ class CometNativeShuffleSuite extends CometTestBase with AdaptiveSparkPlanHelper | |
| } | ||
| } | ||
| } | ||
|
|
||
| test("native datafusion scan - repartition count") { | ||
| withTempPath { dir => | ||
| withSQLConf(CometConf.COMET_ENABLED.key -> "false") { | ||
| spark | ||
| .range(1000) | ||
| .selectExpr("id", "concat('name_', id) as name") | ||
| .repartition(100) | ||
| .write | ||
| .parquet(dir.toString) | ||
| } | ||
| withSQLConf( | ||
| CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_DATAFUSION, | ||
| CometConf.COMET_EXEC_SHUFFLE_WITH_ROUND_ROBIN_PARTITIONING_ENABLED.key -> "true") { | ||
| val testDF = spark.read.parquet(dir.toString).repartition(10) | ||
| // Verify CometShuffleExchangeExec is in the plan | ||
| assert( | ||
| find(testDF.queryExecution.executedPlan) { | ||
| case _: CometShuffleExchangeExec => true | ||
| case _ => false | ||
| }.isDefined, | ||
| "Expected CometShuffleExchangeExec in the plan") | ||
| // Actual validation, no crash | ||
| val count = testDF.count() | ||
| assert(count == 1000) | ||
| // Ensure test df evaluated by Comet | ||
| checkSparkAnswerAndOperator(testDF) | ||
|
Member
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. There is no usage of val testDF = spark.read.parquet(dir.toString).repartition(10)
val countDF = testDF.selectExpr("count(*) as cnt")
val count = countDF.collect().head.getLong(0)
assert(count == 1000)
checkSparkAnswerAndOperator(countDF)
Contributor
Author
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. it is intentional, yes. Count returns just Long, I can't really inject in the middle to check native plan, so do it I check that at least everything before count is native which works for this case |
||
| } | ||
| } | ||
| } | ||
| } | ||
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.
Is the issue specific to this combination of scan and shuffle?
interleave_record_batchis used in other parts of the shuffle codebase so those may also need updating?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.
It looks like
native_datafusionis used here just to easily force native shuffle.I am confused by the comment
For zero-column batches (e.g. COUNT queries)when the test isn't using a count.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 was able to reproduce the crash with both
native_datafusionandnative_iceberg_compatin combination with native shuffle. the sample query for repro and test case isperhaps test can be slightly improved, if it confuses