ahmedabu98 commented on code in PR #40998:
URL: https://github.com/apache/beam/pull/40998#discussion_r4472799009
##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergUtils.java:
##########
@@ -684,24 +691,62 @@ private static void addIcebergValue(
field.getType().getRowSchema(),
"Corrupted schema: Row type did not have associated nested
schema.");
if (icebergValue instanceof Record) {
- rowBuilder.addValue(icebergRecordToBeamRow(nestedSchema, (Record)
icebergValue));
+ values.add(icebergRecordToBeamRow(nestedSchema, (Record)
icebergValue));
} else if (icebergValue instanceof StructLike) {
- rowBuilder.addValue(structToRow(nestedSchema, (StructLike)
icebergValue));
+ values.add(structToRow(nestedSchema, (StructLike) icebergValue));
} else {
throw new UnsupportedOperationException(
"Unsupported row type: " + icebergValue.getClass());
}
break;
case LOGICAL_TYPE:
- rowBuilder.addValue(getLogicalTypeValue(icebergValue,
field.getType()));
+ values.add(getLogicalTypeValue(icebergValue, field.getType()));
break;
default:
throw new UnsupportedOperationException(
"Unsupported Beam type: " + field.getType().getTypeName());
}
}
- private static DateTime getBeamDateTimeValue(Object icebergValue) {
+ /**
+ * Copies a list or map, or one of its elements, the way {@link
Row.Builder#build()} would. A null
+ * fails where the Beam type is not nullable, and {@code binary}, which
Iceberg reads as a {@link
Review Comment:
I think the review bot is hallucinating again.
This PR has no icebergRecordValueToBeamFieldValue...
DATETIME values come from getBeamDateTimeValue, which returns a joda Instant.
The ITERABLE branch accepts any Iterable (testIterableOfRecords also passes
with Iterables.unmodifiableIterable)
A null in a non-nullable field still throws, at the top level and inside
lists and maps (toBeamNestedValue).
--
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]