danny0405 commented on code in PR #13313:
URL: https://github.com/apache/hudi/pull/13313#discussion_r2099449870
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/common/model/HoodieSparkRecord.java:
##########
@@ -307,7 +313,14 @@ public Option<Map<String, String>> getMetadata() {
@Override
public Option<HoodieAvroIndexedRecord> toIndexedRecord(Schema recordSchema,
Properties prop) {
- throw new UnsupportedOperationException();
+ if (data == null) {
+ return Option.empty();
+ }
+ GenericRecord convertedRecord =
AVRO_CONVERTER_CACHE.computeIfAbsent(Pair.of(schema, recordSchema), pair -> {
+ StructType structType = schema == null ?
AvroConversionUtils.convertAvroSchemaToStructType(recordSchema) : schema;
+ return data ->
AvroConversionUtils.createInternalRowToAvroConverter(structType, recordSchema,
false).apply(data);
Review Comment:
can we also cache the nested 2 converters, like what we do in
`HoodieInternalRowUtils`
--
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]