[CH] Support skewness aggregate function#12294
Open
navaneethsujith09 wants to merge 1 commit into
Open
Conversation
|
Run Gluten Clickhouse CI on x86 |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR appears to add ClickHouse/native handling for Spark’s skewness aggregate and adjusts ClickHouse backend validation and tests accordingly.
Changes:
- Register
skewnessaggregate mapping to ClickHouseskewSampin the local engine parser. - Remove
SKEWNESSfrom the ClickHouse expression validator map (previously always-invalid). - Update an existing ClickHouse backend test to stop asserting an exception and instead compare results against vanilla Spark.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cpp-ch/local-engine/Parser/aggregate_function_parser/SimpleStatisticsFunctions.cpp | Registers skewness by mapping Spark name to ClickHouse aggregate function. |
| backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala | Removes the explicit validator entry that previously forced SKEWNESS to be unsupported. |
| backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickhouseCountDistinctSuite.scala | Changes test behavior from expecting failure to result comparison (allowing fallback). |
Comments suppressed due to low confidence (1)
backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala:1
- Removing
SKEWNESS -> DefaultValidator()flipsskewnessfrom explicitly unsupported (sinceDefaultValidatorreturnsfalse) to whatever the map’s default behavior is when an entry is missing. If the goal is to supportskewness, it’s more robust to add an explicit validator forSKEWNESS(e.g., numeric input types) rather than relying on implicit defaults, and pair it with a test that confirms the intended backend behavior.
/*
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+66
to
+73
| // for skewness | ||
| struct SkewnessNameStruct | ||
| { | ||
| static constexpr auto spark_name = "skewness"; | ||
| static constexpr auto ch_name = "skewSamp"; | ||
| }; | ||
|
|
||
| static const AggregateFunctionParserRegister<AggregateFunctionParserStddev<SkewnessNameStruct>> registerer_skewness; |
| assertThrows[UnsupportedOperationException] { | ||
| spark.sql(sql).show | ||
| } | ||
| compareResultsAgainstVanillaSpark(sql, true, { _ => }) |
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.
What changes are proposed in this pull request?
Support the
skewnessaggregate function in the ClickHouse backend:skewnessto ClickHouse'sskewSampskewnessfrom the unsupported function blacklist inCHExpressionUtil.scalaHow was this patch tested?
Updated
GlutenClickhouseCountDistinctSuiteWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.8