You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/06/04 14:55:41 UTC

[GitHub] [calcite] tledkov-gridgain opened a new pull request #2427: Reproduce the issue related to rule AggregateExpandDistinctAggregatesRule and override SUM type (RelDataTypeSystem#deriveSumType)

tledkov-gridgain opened a new pull request #2427:
URL: https://github.com/apache/calcite/pull/2427


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] tledkov-gridgain closed pull request #2427: Reproduce the issue related to rule AggregateExpandDistinctAggregatesRule and override SUM type (RelDataTypeSystem#deriveSumType)

Posted by GitBox <gi...@apache.org>.
tledkov-gridgain closed pull request #2427:
URL: https://github.com/apache/calcite/pull/2427


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] tledkov-gridgain closed pull request #2427: Reproduce the issue related to rule AggregateExpandDistinctAggregatesRule and override SUM type (RelDataTypeSystem#deriveSumType)

Posted by GitBox <gi...@apache.org>.
tledkov-gridgain closed pull request #2427:
URL: https://github.com/apache/calcite/pull/2427


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] alex-plekhanov commented on a change in pull request #2427: Reproduce the issue related to rule AggregateExpandDistinctAggregatesRule and override SUM type (RelDataTypeSystem#deriveSumType)

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #2427:
URL: https://github.com/apache/calcite/pull/2427#discussion_r648947036



##########
File path: core/src/main/java/org/apache/calcite/rel/rules/AggregateExpandDistinctAggregatesRule.java
##########
@@ -366,12 +370,17 @@ 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:
       ```suggestion
             needTopCast |= !sumType.equals(aggCall.getType());
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] tledkov-gridgain commented on a change in pull request #2427: Reproduce the issue related to rule AggregateExpandDistinctAggregatesRule and override SUM type (RelDataTypeSystem#deriveSumType)

Posted by GitBox <gi...@apache.org>.
tledkov-gridgain commented on a change in pull request #2427:
URL: https://github.com/apache/calcite/pull/2427#discussion_r649040303



##########
File path: core/src/main/java/org/apache/calcite/rel/rules/AggregateExpandDistinctAggregatesRule.java
##########
@@ -366,12 +370,17 @@ 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:
       Oh, thanks for comment. Fixed.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org