chore: surface DataFusion 54 PruningMetrics and Ratio in CometNativeScan metrics#4733
Open
mbutrovich wants to merge 5 commits into
Open
chore: surface DataFusion 54 PruningMetrics and Ratio in CometNativeScan metrics#4733mbutrovich wants to merge 5 commits into
mbutrovich wants to merge 5 commits into
Conversation
comphead
reviewed
Jun 25, 2026
| "scan_efficiency_ratio_total" -> | ||
| SQLMetrics.createSizeMetric( | ||
| sc, | ||
| "Total file size, denominator of scan_efficiency_ratio = bytes_scanned / total_file_size")) |
Contributor
There was a problem hiding this comment.
maybe we can rephrase it? unlike to other metrics this one sounds not very clear
Contributor
Author
There was a problem hiding this comment.
This is an awkward one anyway. It's a made up metric from DataFusion (it's a ratio) so the best I could come up with was explaining how to compute the math again.
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 #.
Rationale for this change
DataFusion 54.0 introduced two composite
MetricValuevariants (PruningMetricswith pruned/matched/fully_matched counters, andRatiowith part/total). Both intentionally return0fromas_usize()because the variants bundle multiple counters and aggregation is reserved forMetricsSet. Comet's metric bridge into_native_metric_nodecallsvalue.as_usize()blindly, so every metric of these types silently surfaces as0on the Spark side. Row-group pruning, page-index pruning, bloom-filter pruning, file-range pruning, limit pruning, and scan-efficiency stats all read as zero in the Spark UI even when the underlying counters are populated correctly inside DataFusion.The native Parquet scan also rendered "number of output rows" twice in the UI because
CometNativeScanExec.metricsexposed the underlyingSQLMetricunder bothoutput_rowsandnumOutputRows, and the description string of the metric appeared once per key. ThenumOutputRowsalias has no consumers outside the class.What changes are included in this PR?
to_native_metric_nodenow expandsPruningMetricsinto<name>(pruned count) ands/pruned/matched/<name>(matched count) entries, andRatiointo<name>_partand<name>_totalentries. OtherMetricValuevariants still flow throughas_usize()unchanged.CometMetricNode.nativeScanMetricsdeclares the previously-missing Scala-side metrics (files_ranges_*,limit_*,page_index_pages_*,predicate_cache_*,num_predicate_creation_errors,scan_efficiency_ratio_total). The Scala layer remains the source of truth for what's surfaced; unknown native names are silently dropped.CometNativeScanExecdrops thenumOutputRowsalias, and the still-deprecatedfilterKeyscall on the driver-metric subset is replaced withfilter."for for") and align thetime_elapsed_scanning_totaldescription with the DataFusion docstring.How are these changes tested?
CometNativeReaderSuite's row-group pruning regression test reads the now-bridgedrow_groups_pruned_statisticsandrow_groups_matched_statisticsdirectly, asserts their sum equals the row-group count reported byParquetFileReader, and asserts the pruned count is greater than zero. Before this PR both metrics read0; after, they report3pruned and5matched across the 8 row groups in the test file.