zhztheplayer commented on a change in pull request #1187: [CALCITE-3029]
Java-oriented field type is wrongly forced to be NOT N…
URL: https://github.com/apache/calcite/pull/1187#discussion_r279602468
##########
File path: core/src/main/java/org/apache/calcite/jdbc/JavaTypeFactoryImpl.java
##########
@@ -245,21 +244,24 @@ public static RelDataType toSql(final RelDataTypeFactory
typeFactory,
private static RelDataType toSql(final RelDataTypeFactory typeFactory,
RelDataType type, boolean mustSetNullability) {
- RelDataType sqlType = type;
if (type instanceof RelRecordType) {
// We do not need to change the nullability of the nested fields,
// since it can be overridden by the existing implementation of
createTypeWithNullability
// when we treat the nullability of the root struct type.
- sqlType = typeFactory.createStructType(
- Lists.transform(type.getFieldList(),
- field -> toSql(typeFactory, field.getType(), false)),
- type.getFieldNames());
+ final RelDataType structured = typeFactory.createStructType(
+ type.getFieldList()
+ .stream()
+ .map(field -> toSql(typeFactory, field.getType(), false))
+ .collect(Collectors.toList()),
+ type.getFieldNames());
+ return mustSetNullability
+ ? typeFactory.createTypeWithNullability(structured,
type.isNullable())
Review comment:
Removed according to discussion in JIRA.
----------------------------------------------------------------
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]
With regards,
Apache Git Services