ggjh-159 commented on code in PR #13558:
URL: https://github.com/apache/gluten/pull/13558#discussion_r4651549958
##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/AggregateCallConverter.java:
##########
@@ -90,10 +96,6 @@ private static CallTypedExpr toCall(
}
private static CallTypedExpr convertAggregation(String name, List<TypedExpr>
args, Type outType) {
- if (name.equals("AVG")) {
- return new CallTypedExpr(new DoubleType(), args, name.toLowerCase());
- } else {
- return new CallTypedExpr(outType, args, name.toLowerCase());
- }
+ return new CallTypedExpr(outType, args, name.toLowerCase());
Review Comment:
Coverage lives at three levels across the companion PRs:
- function level (velox, bigo-sg/velox#86): AverageAggregationTest in
velox/functions/flinksql/tests/ pins the result types —
avgIntegralTruncatesTowardZero (AVG(BIGINT) → BIGINT, truncation toward zero as
Flink/Java), avgShortDecimal / avgLongDecimal (DECIMAL precision and scale per
Flink's division type rules), plus the sum-overflow wrap and the
overflow-fails-loud cases;
- operator level: GroupAggregatorTest#testDecimalAvgRescalesWithHalfUp —
avg(DECIMAL(10,2)) comes out as DECIMAL(38,6) with HALF_UP rescaling;
- integration level (velox4j, bigo-sg/velox4j#78):
AggregationFlinkTest#testGroupAggregationAvgBigintResolvesToFlinkSemantics
boots the FLINK preset (flinksql aggregates registered on top of the spark
baseline in velox4j's Init.cc), executes a plan in the exact shape gluten's
StreamExecGroupAggregate translation produces, and picks groups where flinksql
and sparksql disagree ({0,1} → 0 and {10,20,31} → 20), so resolving to the
wrong family fails the BIGINT assertions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]