clesaec commented on code in PR #3031:
URL: https://github.com/apache/calcite/pull/3031#discussion_r1072284872


##########
core/src/main/java/org/apache/calcite/rel/rules/ProjectAggregateMergeRule.java:
##########
@@ -99,7 +100,8 @@ && kindCount(project.getProjects(), SqlKind.CASE) == 0) {
               && operands.get(1).getKind() == SqlKind.CAST
               && ((RexCall) operands.get(1)).operands.get(0).getKind()
               == SqlKind.INPUT_REF
-              && operands.get(2).getKind() == SqlKind.LITERAL) {
+              && operands.get(2).getKind() == SqlKind.LITERAL
+              && operands.get(2).getType().getFamily() == 
SqlTypeFamily.NUMERIC) {

Review Comment:
   I wonder where the code `literal.getValueAs(BigDecimal.class)` (line 111) 
could work as [getValueAs 
method](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L1029)
  has no case for "clazz == BigDecimal" ... May be not related to this specific 
case, but it seems there is also an issue on RexLiteral class.



-- 
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: commits-unsubscr...@calcite.apache.org

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

Reply via email to