feat: name incompatible aggregate functions in mixed-execution fallback reason#4750
Open
andygrove wants to merge 2 commits into
Open
feat: name incompatible aggregate functions in mixed-execution fallback reason#4750andygrove wants to merge 2 commits into
andygrove wants to merge 2 commits into
Conversation
…ck reason When a Spark Final aggregate cannot run because the partial aggregate ran natively (or would have) and the intermediate buffer formats are incompatible between Spark and Comet, the fallback reason now names the specific aggregate function(s) responsible instead of only stating that compatible buffers are required.
…helpers Sort the offending aggregate function names alphabetically so the fallback reason is deterministic regardless of expression order. Extract a shared supportsMixedExecution predicate so allAggsSupportMixedExecution keeps its forall short-circuit and aggsNotSupportingMixedExecution reuses the same lookup, and only compute the incompatible list when in Spark final mode.
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?
N/A
Rationale for this change
When a Spark Final
HashAggregatecannot be converted to Comet because the partial aggregate ran natively (or would have) and the intermediate buffer formats are incompatible between Spark and Comet, the fallback reason shown inEXPLAINoutput and the tpcds plan-stability golden files was:This did not tell the reader which aggregate function caused the incompatibility, making it harder to understand why an aggregate fell back to Spark.
What changes are included in this PR?
QueryPlanSerde.aggsNotSupportingMixedExecution(aggExprs), which returns the aggregate functions whosesupportsMixedPartialFinalisfalse(or that have no Comet serde). Both it andallAggsSupportMixedExecutionnow share a singlesupportsMixedExecutionpredicate, so the boolean check keeps itsforallshort-circuit.CometBaseAggregate.doConvertnow appends the offending function names to the fallback reason. The names are deduplicated and sorted alphabetically so the message is deterministic regardless of expression order, and the list is only computed when the aggregate is in Spark final mode. For example:How are these changes tested?
Covered by the existing
CometTPCDSV1_4_PlanStabilitySuite/CometTPCDSV2_7_PlanStabilitySuiteplan-stability tests, whose golden files embed this fallback reason and were regenerated and verified to pass.