test: add CometExpressionCoverageSuite for runtime expression coverage audit#5031
Open
andygrove wants to merge 2 commits into
Open
test: add CometExpressionCoverageSuite for runtime expression coverage audit#5031andygrove wants to merge 2 commits into
andygrove wants to merge 2 commits into
Conversation
…e audit Add a runtime audit that probes every function in Spark's registry with its own documented example over a Comet-scanned table and classifies each by whether Comet accelerates it. Unlike source-level searches, this accounts for all of Comet's dispatch paths (serde maps, the StaticInvoke map, RuntimeReplaceable rewrites, and the Spark 4.x shims), so it does not produce the false positives that grepping does. The suite writes a per-version report (spark/target/expression-coverage-report-spark-<version>.md) and classifies each function as NATIVE, INCOMPATIBLE (opt-in), LITERAL_PROBE (supported; the all-literal example tripped a guard), GAP (genuine fallback), SKIP, or ERROR. Run it under each Spark profile to compare coverage across versions. The contributor guide documents how to run it.
Member
Author
|
Coverage report generated by Comet expression coverage report (Spark 4.1.2)Probed 524 registered functions using their documented examples. Rerun under each Maven Spark profile (
Scalar gaps (Project fallback) - 38Actionable candidates: scalar expressions Comet did not convert.
Non-scalar gaps (Generate / Aggregate / Window / etc.) - 4
|
Add tables for the INCOMPATIBLE (supported, opt-in) and LITERAL_PROBE (supported; all-literal example tripped a guard) categories to the coverage report so they are visible alongside the genuine gaps.
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?
There is no dedicated issue. This adds a developer utility for auditing expression coverage. Related to the expression coverage epic #240.
Rationale for this change
Finding Spark expressions that Comet does not accelerate is currently a manual, error-prone exercise. Searching the source is unreliable because Comet dispatches expressions through several mechanisms: the serde maps, the
StaticInvokemethod map,RuntimeReplaceablerewrites to other handled expressions, and the Spark 4.x expression shims. A grep-based audit misses all but the first and produces false positives (for example flaggingfrom_xml,aes_encrypt, orarray_prependas unsupported when they are handled via a shim or a rewrite).This adds a runtime audit that determines coverage by actually planning each function and inspecting the physical plan, which accounts for every dispatch path. It doubles as a per-Spark-version coverage report.
What changes are included in this PR?
CometExpressionCoverageSuite: for every function in Spark's registry it runs the function's own documented example (ExpressionInfo.getExamples) over a Comet-scanned table, then usesfindFirstNonCometOperatorandExtendedExplainInfo.getFallbackReasonsto classify the result. Categories:NATIVE,INCOMPATIBLE(supported but opt-in),LITERAL_PROBE(supported; the all-literal example tripped an all-constant guard that would not fire for column inputs),GAP(genuine fallback, with the fallback reason and probed query recorded),SKIP, andERROR. The report is written tospark/target/expression-coverage-report-spark-<version>.md.adding_a_new_expression.md) on how to run it and read the report, including running it under each Spark profile to compare versions.On Spark 4.1 it currently reports roughly 330 native, a handful incompatible/opt-in, and a
GAPlist dominated by families already documented as not-planned (variant, geospatial, sketches, reflection) plus a few genuine candidates.How are these changes tested?
The suite is itself a test and asserts that it probes a non-empty set of functions. It was run against the Spark 4.1 profile to produce the coverage report and validate the classification (including confirming that expressions handled via shims and rewrites are correctly reported as native).