kbuci commented on code in PR #18958:
URL: https://github.com/apache/hudi/pull/18958#discussion_r3406671874
##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/util/RowDataToAvroConverters.java:
##########
@@ -232,7 +232,10 @@ public Object convert(HoodieSchema schema, Object object) {
converter = createArrayConverter((ArrayType) type, utcTimezone);
break;
case ROW:
- converter = createRowConverter((RowType) type, utcTimezone);
+ RowType rowType = (RowType) type;
+ converter = HoodieSchemaConverter.isBlobStructure(rowType)
Review Comment:
Good point. When I first drafted this PR I used the enum approach (just to
fix the issue I saw when creating tests), but I initially thought it was a hack
so I switched to createBlobConverter. After re-reading your comment and
reviewing HoodieSchemaConverter and the row conversion logic again, I see I had
misunderstood. Unlike HoodieSchemaConverter's blob inference (which has to
produce the appropriate HoodieSchema from Flink types without any schema
context), the row conversion utilities have a different use case: they need to
create an Avro type given the Flink type and corresponding HoodieSchema type.
Updated the PR to go with your first suggestion. I considered the second
(checking isBlobField() at the ROW level), but it would have required
duplicating the field-iteration loop inside the convert() method. And I wasn't
sure if that would add too much code complexity
--
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]