Repository navigation
Conversation
…egateBeConverted canAggregateBeConverted is meant to mirror CometBaseAggregate.doConvert, but the non-default collated grouping key guard added to doConvert was never added to it, so the tagging pass treated such an aggregate as convertible. Move the map-typed and collated grouping key checks into CometBaseAggregate.unsupportedGroupingReason and call it from both places. Closes apache#6906 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c7b481e1-4043-4a63-9e54-6d89b950f731
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 #6906.
Rationale for this change
CometExecRule.canAggregateBeConvertedis the check thattagUnsafePartialAggregatesuses to decide whether a buffer-producing aggregate needs theCOMET_UNSAFE_PARTIALtag, and its scaladoc says it has to mirror the predicate checks inCometBaseAggregate.doConvert. #4035 added a guard for non-default collated grouping keys todoConvertonly, socanAggregateBeConvertedreported an aggregate grouped on a collated string as convertible whiledoConvertrejects it. As the issue explains, this is latent today, but once reachable the tagging pass would replace the specific collation fallback reason with the generic "Partial aggregate disabled" one.What changes are included in this PR?
operators.scala: newCometBaseAggregate.unsupportedGroupingReason, which holds the map-typed and collated grouping key checks with their existing fallback reasons.doConvertcalls it, with the same check order and reasons as before.CometExecRule.scala:checkAggregateConversioncalls the same helper instead of repeating only the map-type check, and the scaladoc notes which checks are now shared.pr_build_linux.yml/pr_build_macos.yml: list the new suite.How are these changes tested?
New
spark/src/test/spark-4.x/org/apache/comet/rules/CometAggregateCollationSuite.scala(Spark 4.x only, since collated strings do not exist in Spark 3.x). End-to-end SQL cannot reach the gap, because Comet declines the sort that Spark places under a collated grouping key, so the suite plans the query with Comet disabled and callscanAggregateBeConvertedon the partial aggregate directly:UTF8_LCASEgrouping key is rejected. This fails without the fix, because a collated attribute serializes throughexprToProto.UTF8_BINARYgrouping key is still accepted, so the rejection comes from the collation guard.Locally,
make format(which compiles main and test sources for the default Spark 4.1 profile) succeeded, anddev/ci/check-suites.py,dev/ci/check-ci-config.py, anddev/ci/check-versioned-source-parity.pypassed. Fork CI passed, and both new tests ran in the Spark 4.1[exec]group: https://github.com/tlfua/datafusion-comet/actions/runs/42431970135