vlsi commented on a change in pull request #2413:
URL: https://github.com/apache/calcite/pull/2413#discussion_r631838455



##########
File path: 
core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
##########
@@ -257,6 +260,35 @@ private RelDataType createStructType(
     return createTypeWithNullability(builder.build(), isNullable);
   }
 
+  protected @Nullable RelDataType leastRestrictiveCollectionType(
+      final List<RelDataType> types, SqlTypeName sqlTypeName) {
+    assert sqlTypeName == SqlTypeName.ARRAY
+        || sqlTypeName == SqlTypeName.MULTISET || sqlTypeName == 
SqlTypeName.MAP;
+    boolean isNullable = false;
+    for (RelDataType type : types) {
+      isNullable |= type.isNullable();
+    }
+    if (sqlTypeName == SqlTypeName.MAP) {
+      RelDataType keyType = leastRestrictive(
+          Util.transform(types, t -> Objects.requireNonNull(t.getKeyType())));

Review comment:
       That is up to you :)
   
   A minor note on the current issue: what do you think of splitting 
`leastRestrictiveCollectionType` into `leastRestrictiveMapType` and 
`leastRestrictiveArrayType` ?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to