pvary commented on code in PR #13963:
URL: https://github.com/apache/iceberg/pull/13963#discussion_r2343905479
##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicIcebergSink.java:
##########
@@ -374,32 +416,86 @@ public DataStreamSink<DynamicRecordInternal> append() {
immediateUpdate,
cacheMaximumSize,
cacheRefreshMs,
- inputSchemasPerTableCacheMaximumSize))
+ inputSchemasPerTableCacheMaximumSize,
+ errorStreamConsumer != null))
.uid(prefixIfNotNull(uidPrefix, "-generator"))
.name(operatorName("generator"))
- .returns(type);
+ .returns(dynamicRecordInternalType);
- DataStreamSink<DynamicRecordInternal> rowDataDataStreamSink =
+ SingleOutputStreamOperator<DynamicRecordInternal> updater =
converted
.getSideOutput(
new OutputTag<>(
DynamicRecordProcessor.DYNAMIC_TABLE_UPDATE_STREAM,
new DynamicRecordInternalType(catalogLoader, true,
cacheMaximumSize)))
.keyBy((KeySelector<DynamicRecordInternal, String>)
DynamicRecordInternal::tableName)
- .map(
+ .process(
new DynamicTableUpdateOperator(
catalogLoader,
cacheMaximumSize,
cacheRefreshMs,
- inputSchemasPerTableCacheMaximumSize))
+ inputSchemasPerTableCacheMaximumSize,
+ errorStreamConsumer != null))
.uid(prefixIfNotNull(uidPrefix, "-updater"))
.name(operatorName("Updater"))
- .returns(type)
- .union(converted)
- .sinkTo(sink)
- .uid(prefixIfNotNull(uidPrefix, "-sink"));
- if (sink.flinkWriteConf.writeParallelism() != null) {
-
rowDataDataStreamSink.setParallelism(sink.flinkWriteConf.writeParallelism());
+ .returns(dynamicRecordInternalType);
+
+ DataStreamSink<DynamicRecordInternal> rowDataDataStreamSink =
+ updater.union(converted).sinkTo(sink).uid(prefixIfNotNull(uidPrefix,
"-sink"));
+
+ FlinkWriteConf flinkWriteConf = new FlinkWriteConf(writeOptions,
readableConfig);
+ if (flinkWriteConf.writeParallelism() != null) {
+
rowDataDataStreamSink.setParallelism(flinkWriteConf.writeParallelism());
+ }
+
+ if (errorStreamConsumer != null) {
+ OutputTag<Tuple2<DynamicRecordInternal, Exception>>
errorStreamOutputTag =
+ new OutputTag<>(
+ DynamicRecordProcessor.ERROR_STREAM,
+ // Use an instance of DynamicRecordInternalType which writes
schema and spec. Schema
+ // and spec might not be known, especially if updating them
fails.
+ new TupleTypeInfo<>(
+ new DynamicRecordInternalType(catalogLoader, true,
cacheMaximumSize),
+ TypeInformation.of(Exception.class)));
+
+ SideOutputDataStream<Tuple2<DynamicRecordInternal, Exception>>
erroneousFromProcessor =
+ converted.getSideOutput(errorStreamOutputTag);
+ SideOutputDataStream<Tuple2<DynamicRecordInternal, Exception>>
erroneousFromUpdater =
+ updater.getSideOutput(errorStreamOutputTag);
Review Comment:
nit: Shall we just inline these? (optional)
--
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]