xuzifu666 commented on code in PR #5164:
URL: https://github.com/apache/calcite/pull/5164#discussion_r3732862822


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -16159,6 +16159,9 @@ void testTimestampDiff(boolean coercionEnabled) {
     f.checkType("covar_pop(CAST(NULL AS INTEGER),CAST(NULL AS INTEGER))",
         "INTEGER");
     f.checkAggType("covar_pop(1.5, 2.5)", "DECIMAL(2, 1) NOT NULL");
+    // [CALCITE-7696] Result type is the least restrictive of the two
+    // argument types, not the type of the first argument
+    f.checkAggType("covar_pop(1, cast(2 as double))", "DOUBLE NOT NULL");

Review Comment:
   Right now only the INT + DOUBLE case is covered. It would be safer to add a 
few more edge cases:
   1. Mixed decimal/numeric combinations, e.g. DECIMAL + DOUBLE, DECIMAL + INT
   2. Nullable scenarios: both arguments NULL, or one of them NULL



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