fix: Native_datafusion reports correct files and bytes scanned#3798
Open
0lai0 wants to merge 1 commit intoapache:mainfrom
Open
fix: Native_datafusion reports correct files and bytes scanned#37980lai0 wants to merge 1 commit intoapache:mainfrom
0lai0 wants to merge 1 commit intoapache:mainfrom
Conversation
andygrove
approved these changes
Mar 26, 2026
mbutrovich
reviewed
Mar 26, 2026
Contributor
There was a problem hiding this comment.
So basically it's an artifact of wrapping CometNativeScan in CometScan, which we hopefully won't do in the future anyway.
Thanks for the fix in the meantime, @0lai0!
comphead
reviewed
Mar 27, 2026
comphead
reviewed
Mar 27, 2026
| spark.range(100).repartition(2).write.mode("overwrite").parquet(path) | ||
|
|
||
| withSQLConf( | ||
| CometConf.COMET_ENABLED.key -> "true", |
Contributor
There was a problem hiding this comment.
Please include --conf spark.comet.scan.impl=native_datafusion
Contributor
Author
|
Thank you all for the feedback. I’ll investigate this matter and fix it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #3791
Rationale for this change
In
CometScanExec, callinggetFilePartitions()unconditionally executessendDriverMetrics(). BecausegetFilePartitions()can be evaluated multiple times during planning (e.g., converting toCometNativeScanExec) and execution (e.g., fetching partitions), theSQLMetricaccumulators likenumFilesandfilesSizewere being duplicated. This led to incorrect double-counted values rendering in the Spark UI.What changes are included in this PR?
metrics(...).add()withmetrics(...).set()inCometScanExecto ensure idempotency when reporting metrics.lazy val. This prevents both double-counting during Catalyst transformations (makeCopy) and sending redundant UI events.How are these changes tested?
CometExecSuite.countandcollect) to force severe plan evaluations, and strictly asserts thatnumFilesis exactly2without any duplication.