mihaibudiu commented on code in PR #4961:
URL: https://github.com/apache/calcite/pull/4961#discussion_r3293164331


##########
core/src/test/java/org/apache/calcite/test/AggregateReduceFunctionsOnGroupKeysRuleTest.java:
##########
@@ -106,6 +106,38 @@ private static RelOptFixture sql(String sql) {
     sql(sql).withRule(AGGREGATE_REDUCE_FUNCTIONS_ON_GROUP_KEYS).check();
   }
 
+  @Test void testAggregateFunctionOfGroupByKeysWithCast() {
+    // Test case where a cast is needed because the group key type differs
+    // from the aggregate result type. The rule should preserve the cast.
+    String sql = "select cast(sal as bigint) as sal_big, max(sal) as sal_max\n"

Review Comment:
   This points to a possible problem: what if the cast is to a narrower type, 
e.g. TINYINT, which could lose information?



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

Reply via email to