danny0405 commented on code in PR #18723:
URL: https://github.com/apache/hudi/pull/18723#discussion_r3308322550
##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/util/AvroToRowDataConverters.java:
##########
@@ -78,16 +81,27 @@ public interface AvroToRowDataConverter extends
Serializable {
//
-------------------------------------------------------------------------------------
// Runtime Converters
//
-------------------------------------------------------------------------------------
- public static AvroToRowDataConverter createRowConverter(RowType rowType) {
- return createRowConverter(rowType, true);
+ /**
+ * Creates a row converter using only the Flink row type.
+ *
+ * <p>This converter cannot recover Hoodie-specific logical type metadata
from {@link RowType}.
+ * Use {@link #createRowConverter(HoodieSchema, RowType, boolean)} when a
Hoodie schema is
+ * available, especially for VECTOR columns.
+ */
+ public static AvroToRowDataConverter createRowConverter(HoodieSchema
hoodieSchema) {
+ return createRowConverter(hoodieSchema, (RowType)
HoodieSchemaConverter.convertToDataType(hoodieSchema).getLogicalType(), true);
}
- public static AvroToRowDataConverter createRowConverter(RowType rowType,
boolean utcTimezone) {
- final AvroToRowDataConverter[] fieldConverters =
- rowType.getFields().stream()
- .map(RowType.RowField::getType)
- .map(type -> AvroToRowDataConverters.createNullableConverter(type,
utcTimezone))
- .toArray(AvroToRowDataConverter[]::new);
+ /**
+ * Creates a row converter using both Hoodie schema metadata and the target
Flink row type.
+ */
+ public static AvroToRowDataConverter createRowConverter(HoodieSchema schema,
RowType rowType, boolean utcTimezone) {
+ HoodieSchema recordSchema = schema.getNonNullType();
+ final List<HoodieSchemaField> fields = recordSchema.getFields();
+ final AvroToRowDataConverter[] fieldConverters = new
AvroToRowDataConverter[rowType.getFieldCount()];
Review Comment:
does the Java stream API still work here?
--
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]