lirui-apache commented on a change in pull request #8786: 
[FLINK-12877][table][hive] Unify catalog database implementations
URL: https://github.com/apache/flink/pull/8786#discussion_r295193190
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
 ##########
 @@ -172,13 +179,23 @@ public void close() throws CatalogException {
        // ------ databases ------
 
        @Override
-       public CatalogDatabase getDatabase(String databaseName) throws 
DatabaseNotExistException, CatalogException {
+       public CatalogDatabase getDatabase(String databaseName)
+                       throws DatabaseNotExistException, CatalogException {
                Database hiveDatabase = getHiveDatabase(databaseName);
 
                Map<String, String> properties = hiveDatabase.getParameters();
-               boolean isGeneric = 
Boolean.valueOf(properties.get(FLINK_PROPERTY_IS_GENERIC));
-               return !isGeneric ? new HiveCatalogDatabase(properties, 
hiveDatabase.getLocationUri(), hiveDatabase.getDescription()) :
-                       new 
GenericCatalogDatabase(retrieveFlinkProperties(properties), 
hiveDatabase.getDescription());
+
+               // By default, isGeneric=false
+               boolean isGeneric = 
Boolean.valueOf(properties.remove(CatalogConfig.FLINK_IS_GENERIC));
+
+               if (isGeneric) {
+                       properties = retrieveFlinkProperties(properties);
+               }
+
+               properties.put(HiveDatabaseConfig.DATABASE_LOCATION_URI, 
hiveDatabase.getLocationUri());
+               properties.put(CatalogConfig.FLINK_IS_GENERIC, 
String.valueOf(isGeneric));
 
 Review comment:
   Why do we need to remove this property and then put it back?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to