stankiewicz commented on code in PR #38149:
URL: https://github.com/apache/beam/pull/38149#discussion_r3079072449


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergCatalogConfig.java:
##########
@@ -75,29 +75,41 @@ public static Builder builder() {
 
   public abstract Builder toBuilder();
 
+  /**
+   * Returns a cached Catalog instance for driver-side operations (pipeline 
construction, schema
+   * inference, etc.). Not intended for use within DoFns — use {@link 
#newCatalog()} instead.
+   */
   public org.apache.iceberg.catalog.Catalog catalog() {
     if (cachedCatalog == null) {
-      String catalogName = getCatalogName();
-      if (catalogName == null) {
-        catalogName = "apache-beam-" + 
ReleaseInfo.getReleaseInfo().getVersion();
-      }
-      Map<String, String> catalogProps = getCatalogProperties();
-      if (catalogProps == null) {
-        catalogProps = Maps.newHashMap();
-      }
-      Map<String, String> confProps = getConfigProperties();
-      if (confProps == null) {
-        confProps = Maps.newHashMap();
-      }
-      Configuration config = new Configuration();
-      for (Map.Entry<String, String> prop : confProps.entrySet()) {
-        config.set(prop.getKey(), prop.getValue());
-      }
-      cachedCatalog = CatalogUtil.buildIcebergCatalog(catalogName, 
catalogProps, config);
+      cachedCatalog = newCatalog();
     }
     return cachedCatalog;
   }
 
+  /**
+   * Creates and returns a new Catalog instance. Use this in DoFn {@code 
@Setup} methods to ensure
+   * each DoFn owns its own catalog lifecycle independently of other 
transforms.
+   */
+  public org.apache.iceberg.catalog.Catalog newCatalog() {

Review Comment:
   import org.apache.iceberg.catalog.Catalog ?



-- 
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]

Reply via email to