openinx commented on a change in pull request #2042:
URL: https://github.com/apache/iceberg/pull/2042#discussion_r608291439
##########
File path:
flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
##########
@@ -120,7 +123,10 @@ public void initializeState(StateInitializationContext
context) throws Exception
// Open the table loader and load the table.
this.tableLoader.open();
this.table = tableLoader.loadTable();
-
+ final Map<String, String> properties = table.properties();
+ maxContinuousEmptyCommits = PropertyUtil.propertyAsInt(properties,
MAX_CONTINUOUS_EMPTY_COMMITS, 10);
Review comment:
We'd like to make this `maxContinuousEmptyCommits`'s assignment &
validations into a separate block, that makes the code more clear.
```diff
diff --git
a/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
b/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
index 2fe6ab9e..56d25197 100644
---
a/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
+++
b/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
@@ -123,10 +123,11 @@ class IcebergFilesCommitter extends
AbstractStreamOperator<Void>
// Open the table loader and load the table.
this.tableLoader.open();
this.table = tableLoader.loadTable();
- final Map<String, String> properties = table.properties();
- maxContinuousEmptyCommits = PropertyUtil.propertyAsInt(properties,
MAX_CONTINUOUS_EMPTY_COMMITS, 10);
- Preconditions.checkArgument(maxContinuousEmptyCommits > 0,
MAX_CONTINUOUS_EMPTY_COMMITS + " must not be " +
- "negative");
+
+ this.maxContinuousEmptyCommits =
PropertyUtil.propertyAsInt(table.properties(), MAX_CONTINUOUS_EMPTY_COMMITS,
10);
+ Preconditions.checkArgument(maxContinuousEmptyCommits > 0,
+ MAX_CONTINUOUS_EMPTY_COMMITS + " must not be negative");
+
int subTaskId = getRuntimeContext().getIndexOfThisSubtask();
int attemptId = getRuntimeContext().getAttemptNumber();
this.manifestOutputFileFactory =
FlinkManifestUtil.createOutputFileFactory(table, flinkJobId, subTaskId,
attemptId);
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]