pvary commented on code in PR #15279:
URL: https://github.com/apache/iceberg/pull/15279#discussion_r2816331535
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkDynamicTableFactory.java:
##########
@@ -131,6 +140,46 @@ public String factoryIdentifier() {
return FACTORY_IDENTIFIER;
}
+ private IcebergTableSink getIcebergTableSinkWithDynamicSinkProps(
+ Context context, Configuration flinkConf, Map<String, String>
writeProps) {
+ String dynamicRecordGeneratorImpl =
+ flinkConf.get(FlinkCreateTableOptions.DYNAMIC_RECORD_GENERATOR_IMPL);
+ Preconditions.checkNotNull(
+ dynamicRecordGeneratorImpl,
+ "%s must be specified when use-dynamic-iceberg-sink is true",
+ FlinkCreateTableOptions.DYNAMIC_RECORD_GENERATOR_IMPL.key());
+
+ CatalogLoader catalogLoader;
+ if (catalog != null) {
+ catalogLoader = catalog.getCatalogLoader();
+ } else {
+ FlinkCatalog flinkCatalog =
+ createCatalogLoader(writeProps,
flinkConf.get(FlinkCreateTableOptions.CATALOG_NAME));
+ catalogLoader = flinkCatalog.getCatalogLoader();
+ }
+
+ ResolvedCatalogTable resolvedCatalogTable = context.getCatalogTable();
+
+ return new IcebergTableSink(
+ catalogLoader,
+ dynamicRecordGeneratorImpl,
+ resolvedCatalogTable.getResolvedSchema(),
+ context.getConfiguration(),
+ writeProps);
+ }
+
+ private static FlinkCatalog createCatalogLoader(
+ Map<String, String> tableProps, String catalogName) {
+ Preconditions.checkNotNull(
+ catalogName,
+ "Table property '%s' cannot be null",
+ FlinkCreateTableOptions.CATALOG_NAME.key());
+
+ org.apache.hadoop.conf.Configuration hadoopConf =
FlinkCatalogFactory.clusterHadoopConf();
+ FlinkCatalogFactory factory = new FlinkCatalogFactory();
+ return (FlinkCatalog) factory.createCatalog(catalogName, tableProps,
hadoopConf);
Review Comment:
nit: Just to get rid of the `org.apache.hadoop.conf.Configuration`
```suggestion
FlinkCatalogFactory factory = new FlinkCatalogFactory();
return (FlinkCatalog) factory.createCatalog(catalogName, tableProps,
FlinkCatalogFactory.clusterHadoopConf(););
```
--
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]