github-actions[bot] commented on code in PR #40848:
URL: https://github.com/apache/beam/pull/40848#discussion_r4392649588


##########
sdks/java/extensions/sql/iceberg/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/iceberg/IcebergTable.java:
##########
@@ -90,19 +120,70 @@ final class IcebergTable extends SchemaBaseBeamTable {
     }
 
     this.partitionFields = table.getPartitionFields();
+    this.writeOptions = ImmutableMap.of();
+  }
+
+  private IcebergTable(IcebergTable table, Schema schema, Map<String, Object> 
writeOptions) {
+    super(schema);
+    this.tableIdentifier = table.tableIdentifier;
+    this.catalogConfig = table.catalogConfig;
+    this.triggeringFrequency = table.triggeringFrequency;
+    this.partitionFields = table.partitionFields;
+    this.writeOptions = writeOptions;
+  }
+
+  /**
+   * Returns this table as the target of an INSERT with {@code WITH} options, 
which are options of
+   * the Managed Iceberg write. With {@code 'mode' = 'merge-on-read'}, the 
INSERT also supplies the
+   * change type column, if {@code change_type_column} names one, and the 
sequence number column.
+   */
+  @Override
+  public BeamSqlTable forWrite(Map<String, Object> options) {
+    Map<String, Object> checked =
+        ManagedOptions.check(options, WRITE_CONFIG_SCHEMA, 
WRITE_OWNED_OPTIONS, "an Iceberg write");

Review Comment:
   **🟢 Low**: `ManagedOptions.check` validates option names and types against 
`WRITE_CONFIG_SCHEMA`, but 
`IcebergWriteSchemaTransformProvider.Configuration#validateModeOptions()` 
(which checks that `mode` is valid and that mode-specific options like 
`equality_columns` or `autosharding` match the chosen mode) is only invoked 
later during `Managed.write` expansion in `buildIOWriter`. Consider validating 
mode compatibility in `forWrite` as well so invalid mode/option combinations 
fail fast during `parseQuery` like other invalid `WITH` options.



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

Reply via email to