morningman commented on code in PR #13363:
URL: https://github.com/apache/doris/pull/13363#discussion_r997623662


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/RefreshDbStmt.java:
##########
@@ -34,16 +34,26 @@
 public class RefreshDbStmt extends DdlStmt {
     private static final Logger LOG = 
LogManager.getLogger(RefreshDbStmt.class);
 
+    private String catalogName;

Review Comment:
   fill the `catalogName` field in `analyze()` method.
   To avoid return null from `getCatalogName()`



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalDatabase.java:
##########
@@ -66,14 +66,32 @@ private synchronized void makeSureInitialized() {
     private void init() {
         List<String> tableNames = extCatalog.listTableNames(null, name);
         if (tableNames != null) {
+            Map<String, Long> tmpTableNameToId = Maps.newConcurrentMap();
+            Map<Long, HMSExternalTable> tmpIdToTbl = Maps.newHashMap();
             for (String tableName : tableNames) {
-                long tblId = Env.getCurrentEnv().getNextId();
-                tableNameToId.put(tableName, tblId);
-                idToTbl.put(tblId, new HMSExternalTable(tblId, tableName, 
name, (HMSExternalCatalog) extCatalog));
+                long tblId;
+                if (tableNameToId != null && 
tableNameToId.containsKey(tableName)) {

Review Comment:
   `tableNameToId != null` is always true?



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/HMSExternalCatalog.java:
##########
@@ -84,10 +83,21 @@ private void init() {
             return;
         }
         for (String dbName : allDatabases) {
-            long dbId = Env.getCurrentEnv().getNextId();
-            dbNameToId.put(dbName, dbId);
-            idToDb.put(dbId, new HMSExternalDatabase(this, dbId, dbName));
+            long dbId;
+            if (dbNameToId != null && dbNameToId.containsKey(dbName)) {

Review Comment:
   `dbNameToId != null` is always true?



-- 
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...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to