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


##########
data/src/main/java/org/apache/iceberg/data/GenericFileWriterFactory.java:
##########
@@ -50,62 +65,166 @@ class GenericFileWriterFactory extends 
BaseFileWriterFactory<Record> {
     super(
         table,
         dataFileFormat,
+        Record.class,
         dataSchema,
         dataSortOrder,
         deleteFileFormat,
         equalityFieldIds,
         equalityDeleteRowSchema,
         equalityDeleteSortOrder,
-        positionDeleteRowSchema);
+        ImmutableMap.of(),
+        dataSchema,
+        equalityDeleteRowSchema);
+    this.table = table;
+    this.format = dataFileFormat;
+    this.positionDeleteRowSchema = positionDeleteRowSchema;
   }
 
   static Builder builderFor(Table table) {
     return new Builder(table);
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configureDataWrite(Avro.DataWriteBuilder builder) {
-    builder.createWriterFunc(DataWriter::create);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configureEqualityDelete(Avro.DeleteWriteBuilder builder) {
-    builder.createWriterFunc(DataWriter::create);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configurePositionDelete(Avro.DeleteWriteBuilder builder) {
-    builder.createWriterFunc(DataWriter::create);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configureDataWrite(Parquet.DataWriteBuilder builder) {
-    builder.createWriterFunc(GenericParquetWriter::create);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configureEqualityDelete(Parquet.DeleteWriteBuilder builder) {
-    builder.createWriterFunc(GenericParquetWriter::create);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configurePositionDelete(Parquet.DeleteWriteBuilder builder) {
-    builder.createWriterFunc(GenericParquetWriter::create);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configureDataWrite(ORC.DataWriteBuilder builder) {
-    builder.createWriterFunc(GenericOrcWriter::buildWriter);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configureEqualityDelete(ORC.DeleteWriteBuilder builder) {
-    builder.createWriterFunc(GenericOrcWriter::buildWriter);
+    throwUnsupportedOperationException();
   }
 
-  @Override
+  /**
+   * @deprecated Since 1.10.0, will be removed in 1.11.0. It won't be called 
starting 1.10.0 as the
+   *     configuration is done by the {@link FormatModelRegistry}.
+   */
+  @Deprecated
   protected void configurePositionDelete(ORC.DeleteWriteBuilder builder) {
-    builder.createWriterFunc(GenericOrcWriter::buildWriter);
+    throwUnsupportedOperationException();
+  }
+
+  private void throwUnsupportedOperationException() {
+    throw new UnsupportedOperationException(
+        "Method is deprecated and should not be called. "
+            + "Configuration is already done by the ObjectModelRegistry.");
+  }
+
+  @Override
+  public PositionDeleteWriter<Record> newPositionDeleteWriter(
+      EncryptedOutputFile file, PartitionSpec spec, StructLike partition) {
+    if (positionDeleteRowSchema == null) {
+      return super.newPositionDeleteWriter(file, spec, partition);
+    } else {
+      LOG.info(

Review Comment:
   Spark factory is internal, while the `GenericFileWriterFactory` is part of 
the API. Since we deprecate the PDWR in 1.11.0, and remove only in 1.12.0, we 
should keep this functionality.
   



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