TheR1sing3un commented on code in PR #12949:
URL: https://github.com/apache/hudi/pull/12949#discussion_r1988896167


##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/BaseSparkInternalRowReaderContext.java:
##########
@@ -121,6 +122,10 @@ private Object getFieldValueFromInternalRow(InternalRow 
row, Schema recordSchema
 
   @Override
   public UnaryOperator<InternalRow> projectRecord(Schema from, Schema to, 
Map<String, String> renamedColumns) {
+
+    from = AvroSchemaCache.intern(from);

Review Comment:
   > why not cache the schema in the caller?
   
   updated.



##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieCreateRecordUtils.scala:
##########
@@ -157,9 +157,10 @@ object HoodieCreateRecordUtils {
         }).toJavaRDD()
 
       case HoodieRecord.HoodieRecordType.SPARK =>
-        val dataFileSchema = new Schema.Parser().parse(dataFileSchemaStr)
+        val dataFileSchema = AvroSchemaCache.intern(new 
Schema.Parser().parse(dataFileSchemaStr))
         val dataFileStructType = 
HoodieInternalRowUtils.getCachedSchema(dataFileSchema)
-        val writerStructType = 
HoodieInternalRowUtils.getCachedSchema(writerSchema)
+        val reusedWriterSchema = AvroSchemaCache.intern(writerSchema)
+        val writerStructType = 
HoodieInternalRowUtils.getCachedSchema(reusedWriterSchema)

Review Comment:
   > Can we inline `reusedWriterSchema`?
   
   done



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