FANNG1 commented on code in PR #6303: URL: https://github.com/apache/gravitino/pull/6303#discussion_r1927112224
########## flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/hive/HivePropertiesConverter.java: ########## @@ -34,46 +31,19 @@ public class HivePropertiesConverter implements PropertiesConverter { private HivePropertiesConverter() {} public static final HivePropertiesConverter INSTANCE = new HivePropertiesConverter(); - private static final Map<String, String> HIVE_CATALOG_CONFIG_TO_GRAVITINO = ImmutableMap.of(HiveConf.ConfVars.METASTOREURIS.varname, HiveConstants.METASTORE_URIS); private static final Map<String, String> GRAVITINO_CONFIG_TO_HIVE = ImmutableMap.of(HiveConstants.METASTORE_URIS, HiveConf.ConfVars.METASTOREURIS.varname); @Override - public Map<String, String> toGravitinoCatalogProperties(Configuration flinkConf) { - Map<String, String> gravitinoProperties = Maps.newHashMap(); - - for (Map.Entry<String, String> entry : flinkConf.toMap().entrySet()) { - String gravitinoKey = HIVE_CATALOG_CONFIG_TO_GRAVITINO.get(entry.getKey()); - if (gravitinoKey != null) { - gravitinoProperties.put(gravitinoKey, entry.getValue()); - } else if (!entry.getKey().startsWith(FLINK_PROPERTY_PREFIX)) { - gravitinoProperties.put(FLINK_PROPERTY_PREFIX + entry.getKey(), entry.getValue()); - } else { - gravitinoProperties.put(entry.getKey(), entry.getValue()); - } - } - - return gravitinoProperties; + public String transformPropertyToGravitinoCatalog(String configKey) { + return HIVE_CATALOG_CONFIG_TO_GRAVITINO.get(configKey); } @Override - public Map<String, String> toFlinkCatalogProperties(Map<String, String> gravitinoProperties) { - Map<String, String> flinkCatalogProperties = Maps.newHashMap(); - flinkCatalogProperties.put( - CommonCatalogOptions.CATALOG_TYPE.key(), GravitinoHiveCatalogFactoryOptions.IDENTIFIER); - - gravitinoProperties.forEach( - (key, value) -> { - String flinkConfigKey = key; - if (key.startsWith(PropertiesConverter.FLINK_PROPERTY_PREFIX)) { - flinkConfigKey = key.substring(PropertiesConverter.FLINK_PROPERTY_PREFIX.length()); - } - flinkCatalogProperties.put( - GRAVITINO_CONFIG_TO_HIVE.getOrDefault(flinkConfigKey, flinkConfigKey), value); - }); - return flinkCatalogProperties; + public String transformPropertyToFlinkCatalog(String configKey) { + return GRAVITINO_CONFIG_TO_HIVE.getOrDefault(configKey, configKey); Review Comment: `transformPropertyToFlinkCatalog` return null if the config key not in the map, WDYT? -- 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: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org