ahmedabu98 commented on code in PR #40229:
URL: https://github.com/apache/beam/pull/40229#discussion_r4086480335


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergWriteSchemaTransformProvider.java:
##########
@@ -230,6 +348,121 @@ public IcebergCatalogConfig getIcebergCatalog() {
           .setConfigProperties(getConfigProperties())
           .build();
     }
+
+    enum Mode {
+      APPEND,
+      CDC
+    }
+
+    /** The write mode this configuration selects. */
+    Mode mode() {
+      return getCdc() == null ? Mode.APPEND : Mode.CDC;
+    }
+
+    /**
+     * Options that only one mode supports today; everything else applies to 
both. Once an option
+     * becomes available to the other mode, just remove it from here.
+     */
+    private static final ImmutableMap<String, Mode> SUPPORTED_MODES =
+        ImmutableMap.<String, Mode>builder()
+            .put("equality_columns", Mode.CDC)
+            .put("num_shards", Mode.CDC)
+            .put("shards_per_partition", Mode.CDC)
+            .put("allowed_lateness_seconds", Mode.CDC)
+            .put("sink_id", Mode.CDC)
+            .put("token_heartbeat_seconds", Mode.CDC)
+            .put("snapshot_properties", Mode.CDC)
+            .put("error_handling", Mode.CDC)
+            .put("sorter_memory_mb", Mode.CDC)
+            .put("direct_write_byte_limit", Mode.APPEND)
+            .put("distribution_mode", Mode.APPEND)
+            .put("autosharding", Mode.APPEND)
+            .put("write_properties", Mode.APPEND)
+            .put("using_side_input_table_cache", Mode.APPEND)
+            .put("table_refresh_interval_seconds", Mode.APPEND)
+            .put("maximum_cache_size", Mode.APPEND)
+            .put("polling_buckets", Mode.APPEND)
+            .build();
+
+    /** Rejects every set option that the selected mode does not support. */
+    void validateModeOptions() {
+      Mode mode = mode();
+      Map<String, @Nullable Object> values = new LinkedHashMap<>();

Review Comment:
   These options are only a subset of `Configuration`. They represent the 
options that apply to only one of CDC or Append mode. Options that apply to 
both (e.g. `table` or `catalog_properties`) are not mentioned here
   
   Will try to think of something better though



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