fix: explain ObjectHashAggregate fallback when Comet shuffle is disabled - #5746
Open
0lai0 wants to merge 1 commit into
Open
fix: explain ObjectHashAggregate fallback when Comet shuffle is disabled#57460lai0 wants to merge 1 commit into
0lai0 wants to merge 1 commit into
Conversation
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 #5500.
Rationale for this change
CometObjectHashAggregateExecdeliberately declines when Comet shuffle is disabled, because converting would split the aggregate across a Comet partial and a Spark final. That decline was a barereturn Noneinsideconvert, with nowithFallbackReasoncall, so the reason never reached the user.Under
spark.comet.explain.fallback.strict.enabled=true, planning throws:Under the production default the generic catch-all stands in for the real cause, which is worse because it is wrong. Comet supports this operator fine, the user just turned shuffle off:
The check simply lived in the wrong place.
CometExecRule.isOperatorEnabledturns anUnsupported(Some(reason))fromgetSupportLevelinto awithFallbackReasoncall centrally, so a check placed there is explained for free.CometCollectLimitExecandCometTakeOrderedAndProjectExecgate on the same predicate and already do it that way.What changes are included in this PR?
convertintogetSupportLevel, returningUnsupported(Some(...)).convertbecomes the samedoConvertcallCometHashAggregateExec.convertalready is.CometExecRule.canAggregateBeConverted. The line above it already callsisOperatorEnabled, so the block was dead.ObjectHashAggregateExecrow ofoperators.md.The guard sits after the two test-knob checks so a test that disables partial or final aggregates still sees its own reason. The message names no config key, because
isCometShuffleEnabledis a conjunction ofspark.comet.shuffle.enabled, the shuffle manager, and the Celeborn check, and naming one would misdirect when another is the cause. That is also why this PR does not delegate toCometShuffleExchangeExec.isCometShuffleEnabledReason, which computes its Celeborn branch fromop.outputPartitioning.numPartitionsrather than the hardcoded1thatisCometShuffleEnableduses, and so could return no reason while the predicate is still false.Not visible in the diff
The Final aggregate now carries the reason too.
getSupportLevelruns for every stage, so the Final node gets it where previously it recorded nothing at all. I confirmed this with a probe rather than by reasoning about it. The message is worded stage-neutrally for that reason. Eligibility is unchanged:hasFallbackReasonis consulted only for shuffle exchanges andCometNativeScan, never for aggregates.operators.mdrows 74 and 75 are still blank.CollectLimitExecandTakeOrderedAndProjectExecgate on the same predicate and do not mention it, so the three rows now disagree. Changing user-facing text for two already-merged operators is out of scope here, but it is worth picking up separately.How are these changes tested?
Three new tests in
CometExecRuleSuite, all of which fail on unfixed code:ObjectHashAggregateExecrecords the shuffle reason, not the generic message, and the reason survives intoExtendedExplainInfo. Run with strict mode both enabled and disabled as the issue asks, with a fresh plan per iteration because fallback reasons accumulate on tags.getSupportLevelreturnsUnsupportedwith the reason when shuffle is off andCompatiblewhen it is on. Before the fix it returnedCompatible(None,None).