FANNG1 commented on code in PR #6303:
URL: https://github.com/apache/gravitino/pull/6303#discussion_r1926280075


##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/iceberg/IcebergPropertiesConverter.java:
##########
@@ -38,38 +36,21 @@ private IcebergPropertiesConverter() {}
           IcebergConstants.CATALOG_BACKEND, 
IcebergPropertiesConstants.ICEBERG_CATALOG_TYPE);
 
   @Override
-  public Map<String, String> toFlinkCatalogProperties(Map<String, String> 
gravitinoProperties) {
-    Preconditions.checkArgument(
-        gravitinoProperties != null, "Iceberg Catalog properties should not be 
null.");
+  public String transformPropertyToGravitinoCatalog(String configKey) {
+    return 
IcebergPropertiesUtils.ICEBERG_CATALOG_CONFIG_TO_GRAVITINO.get(configKey);
+  }
 
-    Map<String, String> all = new HashMap<>();
-    if (gravitinoProperties != null) {
-      gravitinoProperties.forEach(
-          (k, v) -> {
-            if (k.startsWith(FLINK_PROPERTY_PREFIX)) {
-              String newKey = k.substring(FLINK_PROPERTY_PREFIX.length());
-              all.put(newKey, v);
-            }
-          });
-    }
-    Map<String, String> transformedProperties =
-        IcebergPropertiesUtils.toIcebergCatalogProperties(gravitinoProperties);
+  @Override
+  public String transformPropertyToFlinkCatalog(String configKey) {
 
-    if (transformedProperties != null) {
-      all.putAll(transformedProperties);
+    String icebergConfigKey = configKey;
+    if 
(IcebergPropertiesUtils.GRAVITINO_CONFIG_TO_ICEBERG.containsKey(configKey)) {
+      icebergConfigKey = 
IcebergPropertiesUtils.GRAVITINO_CONFIG_TO_ICEBERG.get(configKey);
     }
-    all.put(
-        CommonCatalogOptions.CATALOG_TYPE.key(), 
GravitinoIcebergCatalogFactoryOptions.IDENTIFIER);
-    // Map "catalog-backend" to "catalog-type".
-    // TODO If catalog backend is CUSTOM, we need special compatibility logic.
-    GRAVITINO_CONFIG_TO_FLINK_ICEBERG.forEach(
-        (key, value) -> {
-          if (all.containsKey(key)) {
-            String config = all.remove(key);
-            all.put(value, config);
-          }
-        });
-    return all;
+    if (GRAVITINO_CONFIG_TO_FLINK_ICEBERG.containsKey(configKey)) {
+      icebergConfigKey = GRAVITINO_CONFIG_TO_FLINK_ICEBERG.get(configKey);
+    }
+    return icebergConfigKey;

Review Comment:
   how about return null if neither of the maps contains the configKey?



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