the-other-tim-brown commented on code in PR #13313:
URL: https://github.com/apache/hudi/pull/13313#discussion_r2100325591


##########
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:
   I'm adding cache for the row to avro converter and schema cache for avro to 
struct type currently, was there 1 more to add?



-- 
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]

Reply via email to