zstan commented on a change in pull request #2439:
URL: https://github.com/apache/calcite/pull/2439#discussion_r662016102
##########
File path:
core/src/main/java/org/apache/calcite/rel/rules/AggregateExpandDistinctAggregatesRule.java
##########
@@ -366,12 +370,18 @@ private static RelBuilder
convertSingletonDistinct(RelBuilder relBuilder,
final int arg = bottomGroups.size() + nonDistinctAggCallProcessedSoFar;
final List<Integer> newArgs = ImmutableList.of(arg);
if (aggCall.getAggregation().getKind() == SqlKind.COUNT) {
+ RelDataTypeFactory typeFactory =
aggregate.getCluster().getTypeFactory();
+ RelDataType sumType =
typeFactory.getTypeSystem().deriveSumType(typeFactory,
+ aggCall.getType());
+ needTopCast |= !sumType.equals(aggCall.getType());
Review comment:
running new test under debug, i found aggCall.getType() == BIGINT, while
sumType == DECIMAL(19, 0) all these representation are identical as i can see,
can you explain why we rise needTopCast flag in this case? Additionally i hope
we need integration test highliting the bug, ServerTest possibly correct place
for it. wdyt ?
--
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]