yingyuwang commented on code in PR #2803:
URL: https://github.com/apache/calcite/pull/2803#discussion_r877126272


##########
core/src/test/java/org/apache/calcite/test/TypeCoercionTest.java:
##########
@@ -216,7 +216,7 @@ private static ImmutableList<RelDataType> combine(
     sql("select '1' from (values(true)) union values 2")
         .type("RecordType(VARCHAR NOT NULL EXPR$0) NOT NULL");
     sql("select (select 1+2 from (values true)) tt from (values(true)) union 
values '2'")
-        .type("RecordType(VARCHAR NOT NULL TT) NOT NULL");
+        .type("RecordType(VARCHAR TT) NOT NULL");
     // union with star

Review Comment:
   What I found is Calcite seems to add `isNullable=true` when there is a sub 
query, for example we have:
   ```
       sql("select 1 from (values 1)")
           .type("RecordType(INTEGER NOT NULL EXPR$0) NOT NULL"); // 
isNullable=false for EXPR$0 when not query from subquery
       sql("select (select 1 from (values 1))")    
           .type("RecordType(INTEGER EXPR$0) NOT NULL"); // isNullable=true for 
EXPR$0 when query from subquery
   ```
   So before the change, `isNullable=true` is lost at `promoteToVarChar()` for 
this test.



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