mihaibudiu commented on code in PR #4139: URL: https://github.com/apache/calcite/pull/4139#discussion_r1917351595
########## core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java: ########## @@ -410,6 +410,31 @@ private RelDataType copyRecordType( return canonize(newType); } + @Override public RelDataType enforceTypeWithNullability( + final RelDataType type, + final boolean nullable) { + requireNonNull(type, "type"); + RelDataType newType; + if (type.isNullable() == nullable) { + newType = type; + } else if (type instanceof RelRecordType) { + return createStructType(type.getStructKind(), + new AbstractList<RelDataType>() { + @Override public RelDataType get(int index) { + return type.getFieldList().get(index).getType(); + } + + @Override public int size() { + return type.getFieldCount(); + } + }, + type.getFieldNames(), nullable); + } else { Review Comment: I will add this to history.md in the section on breaking changes: ``` *RelDataTypeFactory interface*. The fix for [<a href="https://issues.apache.org/jira/browse/CALCITE-6764">CALCITE-6764</a>] introduces a new method `RelDataTypeFactory#enforceTypeWithNullability` in the existing `RelDataTypeFactory` interface. The behavior of the new function is similar to the existing API `createTypeWithNullability`; however, the existing implementations of the `createTypeWithNullability` API cannot create nullable record (`ROW`) types. Nullable record types are legitimate in several SQL dialects. ``` -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org