dssysolyatin commented on code in PR #4858:
URL: https://github.com/apache/calcite/pull/4858#discussion_r3068140074


##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -1322,13 +1322,20 @@ void testLikeAndSimilarFails() {
     expr("values 1.0 + ^NULL^")
         .withTypeCoercion(false)
         .fails("(?s).*Illegal use of .NULL.*");
+    // SELECT produces DECIMAL(3, 1) because inferUnknownTypes infers
+    // NULL as DECIMAL(2, 1) via FIRST_KNOWN, and DECIMAL(2,1) + DECIMAL(2,1)
+    // = DECIMAL(3, 1)
+    sql("select 1.0 + NULL from (values (0)) as t(x)")
+        .columnType("DECIMAL(3, 1)");
     expr("values 1.0 + NULL")
-        .columnType("DECIMAL(2, 1)");
+        .columnType("DECIMAL(3, 1)");

Review Comment:
   I explained above, in the `SELECT` section, why this happens. I'm not saying 
it's the correct behavior and I would expect that `1.0 + NULL = NULL` of type 
`1.0` in this case, but currently it works like that 



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