snuyanzin commented on a change in pull request #2413:
URL: https://github.com/apache/calcite/pull/2413#discussion_r631850102
##########
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:
yes, after moving of `isNullable |= type.isNullable();` into
key+value/component loop such splittiing becomes more logic
--
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]