xuefuz commented on a change in pull request #8390: [FLINK-12469][table] Clean 
up catalog API on default/current database
URL: https://github.com/apache/flink/pull/8390#discussion_r282685701
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalogBase.java
 ##########
 @@ -48,23 +48,26 @@
  */
 public abstract class HiveCatalogBase implements Catalog {
        private static final Logger LOG = 
LoggerFactory.getLogger(HiveCatalogBase.class);
-
-       public static final String DEFAULT_DB = "default";
+       private static final String DEFAULT_DB = "default";
 
        protected final String catalogName;
        protected final HiveConf hiveConf;
 
-       protected String currentDatabase = DEFAULT_DB;
+       private final String defaultDatabase;
        protected IMetaStoreClient client;
 
        public HiveCatalogBase(String catalogName, String hivemetastoreURI) {
-               this(catalogName, getHiveConf(hivemetastoreURI));
+               this(catalogName, DEFAULT_DB, getHiveConf(hivemetastoreURI));
        }
 
        public HiveCatalogBase(String catalogName, HiveConf hiveConf) {
+               this(catalogName, DEFAULT_DB, hiveConf);
+       }
+
+       public HiveCatalogBase(String catalogName, String defaultDatabase, 
HiveConf hiveConf) {
                checkArgument(!StringUtils.isNullOrWhitespaceOnly(catalogName), 
"catalogName cannot be null or empty");
                this.catalogName = catalogName;
-
+               this.defaultDatabase = checkNotNull(defaultDatabase, 
"defaultDatabase cannot be null");
 
 Review comment:
   I think it cannot be either null or empty string. I will add additional 
checks.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to