nssalian commented on code in PR #14297:
URL: https://github.com/apache/iceberg/pull/14297#discussion_r2985139682


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkFileWriterFactory.java:
##########
@@ -229,6 +251,71 @@ public PositionDeleteWriter<InternalRow> 
newPositionDeleteWriter(
     }
   }
 
+  @Override
+  public DataWriter<InternalRow> newDataWriter(
+      EncryptedOutputFile file, PartitionSpec spec, StructLike partition) {
+    if (!shouldUseVariantShredding()) {
+      return super.newDataWriter(file, spec, partition);
+    }
+
+    int bufferSize =
+        Integer.parseInt(
+            writeProperties.getOrDefault(
+                SparkSQLProperties.VARIANT_INFERENCE_BUFFER_SIZE,
+                
String.valueOf(SparkSQLProperties.VARIANT_INFERENCE_BUFFER_SIZE_DEFAULT)));
+
+    Map<String, String> tableProperties = table != null ? table.properties() : 
ImmutableMap.of();
+    MetricsConfig metricsConfig =
+        table != null ? MetricsConfig.forTable(table) : 
MetricsConfig.getDefault();
+
+    Function<List<InternalRow>, FileAppender<InternalRow>> appenderFactory =
+        bufferedRows -> {
+          Preconditions.checkNotNull(bufferedRows, "bufferedRows must not be 
null");
+          MessageType originalSchema = ParquetSchemaUtil.convert(dataSchema, 
"table");

Review Comment:
   I'll work on the refactor based on the comments



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to