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


##########
data/src/main/java/org/apache/iceberg/data/GenericAppenderFactory.java:
##########
@@ -44,30 +45,56 @@
 
 /** Factory to create a new {@link FileAppender} to write {@link Record}s. */
 public class GenericAppenderFactory implements FileAppenderFactory<Record> {
-
+  private final Table table;
   private final Schema schema;
   private final PartitionSpec spec;
   private final int[] equalityFieldIds;
   private final Schema eqDeleteRowSchema;
   private final Schema posDeleteRowSchema;
   private final Map<String, String> config = Maps.newHashMap();
 
+  @Deprecated
   public GenericAppenderFactory(Schema schema) {
-    this(schema, PartitionSpec.unpartitioned(), null, null, null);
+    this(null, schema, PartitionSpec.unpartitioned(), null, null, null);
   }
 
+  @Deprecated
   public GenericAppenderFactory(Schema schema, PartitionSpec spec) {
-    this(schema, spec, null, null, null);
+    this(null, schema, spec, null, null, null);
+  }
+
+  @Deprecated
+  public GenericAppenderFactory(
+      Schema schema,
+      PartitionSpec spec,
+      int[] equalityFieldIds,
+      Schema eqDeleteRowSchema,
+      Schema posDeleteRowSchema) {
+    this(null, schema, spec, equalityFieldIds, eqDeleteRowSchema, 
posDeleteRowSchema);
+  }
+
+  public GenericAppenderFactory(Table table) {
+    this(table, null, null, null, null, null);
   }
 
   public GenericAppenderFactory(
+      Table table,
       Schema schema,
       PartitionSpec spec,
       int[] equalityFieldIds,
       Schema eqDeleteRowSchema,
       Schema posDeleteRowSchema) {
-    this.schema = schema;
-    this.spec = spec;
+    this.table = table;
+    if (table != null && schema == null) {
+      this.schema = table.schema();
+    } else {
+      this.schema = schema;
+    }

Review Comment:
   nit: newline after the block



##########
data/src/main/java/org/apache/iceberg/data/GenericAppenderFactory.java:
##########
@@ -44,30 +45,56 @@
 
 /** Factory to create a new {@link FileAppender} to write {@link Record}s. */
 public class GenericAppenderFactory implements FileAppenderFactory<Record> {
-
+  private final Table table;
   private final Schema schema;
   private final PartitionSpec spec;
   private final int[] equalityFieldIds;
   private final Schema eqDeleteRowSchema;
   private final Schema posDeleteRowSchema;
   private final Map<String, String> config = Maps.newHashMap();
 
+  @Deprecated
   public GenericAppenderFactory(Schema schema) {
-    this(schema, PartitionSpec.unpartitioned(), null, null, null);
+    this(null, schema, PartitionSpec.unpartitioned(), null, null, null);
   }
 
+  @Deprecated
   public GenericAppenderFactory(Schema schema, PartitionSpec spec) {
-    this(schema, spec, null, null, null);
+    this(null, schema, spec, null, null, null);
+  }
+
+  @Deprecated
+  public GenericAppenderFactory(
+      Schema schema,
+      PartitionSpec spec,
+      int[] equalityFieldIds,
+      Schema eqDeleteRowSchema,
+      Schema posDeleteRowSchema) {
+    this(null, schema, spec, equalityFieldIds, eqDeleteRowSchema, 
posDeleteRowSchema);
+  }
+
+  public GenericAppenderFactory(Table table) {
+    this(table, null, null, null, null, null);
   }
 
   public GenericAppenderFactory(
+      Table table,
       Schema schema,
       PartitionSpec spec,
       int[] equalityFieldIds,
       Schema eqDeleteRowSchema,
       Schema posDeleteRowSchema) {
-    this.schema = schema;
-    this.spec = spec;
+    this.table = table;
+    if (table != null && schema == null) {
+      this.schema = table.schema();
+    } else {
+      this.schema = schema;
+    }
+    if (table != null && spec == null) {
+      this.spec = table.spec();
+    } else {
+      this.spec = spec;
+    }

Review Comment:
   nit: newline after the block



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