mxm commented on code in PR #15780:
URL: https://github.com/apache/iceberg/pull/15780#discussion_r3145553249
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicIcebergSink.java:
##########
@@ -446,7 +447,6 @@ private DynamicIcebergSink build(
.setParallelism(converted.getParallelism())
.uid(prefixIfNotNull(uidPrefix, "-forward-writer"));
- // Inject forward write results into sink — they'll be unioned in
addPreCommitTopology
Review Comment:
Let's keep this comment.
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/FlinkDynamicSinkConf.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.flink.sink.dynamic;
+
+import java.util.Map;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.iceberg.flink.FlinkConfParser;
+
+/**
+ * A class for common Dynamic Iceberg sink configs for Flink writes.
+ *
+ * <p>If a config is set at multiple levels, the following order of precedence
is used (top to
+ * bottom):
+ *
+ * <ol>
+ * <li>Write options
+ * <li>Flink ReadableConfig
+ * <li>Default values
+ * </ol>
+ *
+ * The most specific value is set in write options and takes precedence over
all other configs. If
+ * no write option is provided, this class checks the flink configuration for
any overrides. If no
+ * applicable value is found in the write options, this class uses the default
values.
+ */
+class FlinkDynamicSinkConf {
+
+ private final FlinkConfParser confParser;
+
+ FlinkDynamicSinkConf(Map<String, String> writeOptions, ReadableConfig
readableConfig) {
+ this.confParser = new FlinkConfParser(writeOptions, readableConfig);
+ }
+
+ public int cacheMaxSize() {
+ return confParser
+ .intConf()
+ .option(FlinkDynamicSinkOptions.CACHE_MAX_SIZE.key())
+ .flinkConfig(FlinkDynamicSinkOptions.CACHE_MAX_SIZE)
+ .defaultValue(FlinkDynamicSinkOptions.CACHE_MAX_SIZE.defaultValue())
+ .parse();
+ }
+
+ public boolean immediateTableUpdate() {
+ return confParser
+ .booleanConf()
+ .option(FlinkDynamicSinkOptions.IMMEDIATE_TABLE_UPDATE.key())
+ .flinkConfig(FlinkDynamicSinkOptions.IMMEDIATE_TABLE_UPDATE)
+
.defaultValue(FlinkDynamicSinkOptions.IMMEDIATE_TABLE_UPDATE.defaultValue())
+ .parse();
+ }
+
+ public boolean dropUnusedColumns() {
+ return confParser
+ .booleanConf()
+ .option(FlinkDynamicSinkOptions.DROP_UNUSED_COLUMNS.key())
+ .flinkConfig(FlinkDynamicSinkOptions.DROP_UNUSED_COLUMNS)
+
.defaultValue(FlinkDynamicSinkOptions.DROP_UNUSED_COLUMNS.defaultValue())
+ .parse();
+ }
+
+ public long cacheRefreshMs() {
+ return confParser
+ .longConf()
+ .option(FlinkDynamicSinkOptions.CACHE_REFRESH_MS.key())
+ .flinkConfig(FlinkDynamicSinkOptions.CACHE_REFRESH_MS)
+ .defaultValue(FlinkDynamicSinkOptions.CACHE_REFRESH_MS.defaultValue())
+ .parse();
+ }
+
+ public int inputSchemasPerTableCacheMaxSize() {
+ return confParser
+ .intConf()
+
.option(FlinkDynamicSinkOptions.INPUT_SCHEMAS_PER_TABLE_CACHE_MAX_SIZE.key())
+
.flinkConfig(FlinkDynamicSinkOptions.INPUT_SCHEMAS_PER_TABLE_CACHE_MAX_SIZE)
+
.defaultValue(FlinkDynamicSinkOptions.INPUT_SCHEMAS_PER_TABLE_CACHE_MAX_SIZE.defaultValue())
+ .parse();
+ }
+
+ public boolean caseSensitive() {
Review Comment:
NIT All those can be package-private as well (like the class itself).
--
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]