fhueske commented on code in PR #30220:
URL: https://github.com/apache/flink/pull/30220#discussion_r4771911840
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/Projection.java:
##########
@@ -273,14 +273,21 @@ public DataType project(DataType dataType) {
((RowType) dataType.getLogicalType())
.getFieldNames()
.get(indexPath[0]));
+ boolean nullable = false;
for (int index = 1; index < indexPath.length; index++) {
Preconditions.checkArgument(
fieldLogicalType.is(ROW), "Row data type
expected.");
+ nullable |= fieldLogicalType.isNullable();
RowType rowtype = ((RowType) fieldLogicalType);
builder.append("_").append(rowtype.getFieldNames().get(indexPath[index]));
fieldLogicalType =
rowtype.getFields().get(indexPath[index]).getType();
fieldType = fieldType.getChildren().get(indexPath[index]);
}
+ // a field read through a nullable ROW is nullable, even if
declared NOT NULL
+ if (nullable) {
+ fieldLogicalType = fieldLogicalType.copy(true);
+ fieldType = fieldType.nullable();
+ }
Review Comment:
Good point! Changing this as suggested.
--
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]