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


##########
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:
   This `GenericFileWriterFactory` uses the new API for the 
DataWriter/EqualityDeleteWriters. Those are backwards compatible. For the 
PositionDeleteWriters we allow setting the `positionDeleteRowSchema`, but we 
need to use the old deprecated code to implement the same functionality that 
exists today. For that we need the deprecated constructors.
   
   I think we need to revisit this part of the code when we have the final 
decisions on the design. We might be better off (cleaner code), if we wait one 
more release and can remove the PDWR entirely before implementing the final 
parts of the File Format API.



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