rdblue commented on code in PR #12298:
URL: https://github.com/apache/iceberg/pull/12298#discussion_r2162586644


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkFileWriterFactory.java:
##########
@@ -68,119 +54,34 @@ class SparkFileWriterFactory extends 
BaseFileWriterFactory<InternalRow> {
     super(
         table,
         dataFileFormat,
+        SparkObjectModels.SPARK_OBJECT_MODEL,
         dataSchema,
         dataSortOrder,
         deleteFileFormat,
         equalityFieldIds,
         equalityDeleteRowSchema,
         equalityDeleteSortOrder,
-        positionDeleteRowSchema);
-
-    this.dataSparkType = dataSparkType;
-    this.equalityDeleteSparkType = equalityDeleteSparkType;
-    this.positionDeleteSparkType = positionDeleteSparkType;
-    this.writeProperties = writeProperties != null ? writeProperties : 
ImmutableMap.of();
+        positionDeleteRowSchema,
+        writeProperties,
+        dataSparkType == null
+            ? dataSchema == null ? null : SparkSchemaUtil.convert(dataSchema)
+            : dataSparkType,
+        equalityDeleteSparkType == null
+            ? equalityDeleteRowSchema == null
+                ? null
+                : SparkSchemaUtil.convert(equalityDeleteRowSchema)
+            : equalityDeleteSparkType,
+        positionDeleteSparkType == null
+            ? positionDeleteRowSchema == null
+                ? null
+                : 
SparkSchemaUtil.convert(DeleteSchemaUtil.posDeleteSchema(positionDeleteRowSchema))
+            : positionDeleteSparkType);

Review Comment:
   This is very hard to read and maintain with so many nested ternary operators.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to