rdblue commented on a change in pull request #1348:
URL: https://github.com/apache/iceberg/pull/1348#discussion_r482589889
##########
File path: flink/src/main/java/org/apache/iceberg/flink/sink/FlinkSink.java
##########
@@ -155,16 +158,29 @@ public Builder tableSchema(TableSchema newTableSchema) {
return this;
}
+ public Builder overwrite(boolean newOverwrite) {
+ this.overwrite = newOverwrite;
+ return this;
+ }
+
@SuppressWarnings("unchecked")
public DataStreamSink<RowData> build() {
Preconditions.checkArgument(rowDataInput != null,
"Please use forRowData() to initialize the input DataStream.");
- Preconditions.checkNotNull(table, "Table shouldn't be null");
Preconditions.checkNotNull(tableLoader, "Table loader shouldn't be
null");
Preconditions.checkNotNull(hadoopConf, "Hadoop configuration shouldn't
be null");
+ if (table == null) {
+ tableLoader.open(hadoopConf);
+ try (TableLoader loader = tableLoader) {
+ this.table = loader.loadTable();
+ } catch (IOException e) {
+ throw new UncheckedIOException("Failed to load iceberg table.", e);
Review comment:
Minor: it would be nice to have more context here. Maybe the table
loader should define a `toString` that could be used in the error message here.
----------------------------------------------------------------
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]