pvary commented on code in PR #15328:
URL: https://github.com/apache/iceberg/pull/15328#discussion_r2816719209


##########
spark/v4.1/spark/src/jmh/java/org/apache/iceberg/spark/data/parquet/SparkParquetWritersNestedDataBenchmark.java:
##########
@@ -121,10 +126,28 @@ public void writeUsingSparkWriter() throws IOException {
             .set("spark.sql.parquet.outputTimestampType", "TIMESTAMP_MICROS")
             .set("spark.sql.caseSensitive", "false")
             .set("spark.sql.parquet.fieldId.write.enabled", "false")
+            .set("spark.sql.parquet.variant.annotateLogicalType.enabled", 
"false")
             .schema(SCHEMA)
             .build()) {
 
       writer.addAll(rows);
     }
   }
+
+  @Benchmark
+  @Threads(1)
+  public void writeUsingRegistryWriter() throws IOException {
+    try (DataWriter<InternalRow> writer =
+        FormatModelRegistry.dataWriteBuilder(
+                FileFormat.PARQUET,
+                InternalRow.class,
+                
EncryptedFiles.plainAsEncryptedOutput(Files.localOutput(dataFile)))
+            .schema(SCHEMA)
+            .engineSchema(SparkSchemaUtil.convert(SCHEMA))

Review Comment:
   Probably we could create a new builderWriter method to avoid the need to set 
the engine schema for Spark when it is not needed, like this:
   ```
     public static <T> ParquetValueWriter<T> buildWriter(
         Schema icebergSchema, StructType dfSchema, MessageType type) {
       return (ParquetValueWriter<T>)
           ParquetWithSparkSchemaVisitor.visit(
               dfSchema != null ? dfSchema : 
SparkSchemaUtil.convert(icebergSchema),
               type,
               new WriteBuilder(type));
     }
   ```



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