github-actions[bot] commented on code in PR #63863:
URL: https://github.com/apache/doris/pull/63863#discussion_r3333485922


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -593,6 +593,32 @@ public boolean registerTable(TableIf tableIf) {
         return true;
     }
 
+    /**
+     * Register a newly created table into the meta cache after DDL execution.
+     * This method builds the table object and updates both the names cache 
and the meta object cache,
+     * so that the table is immediately visible (e.g., via SHOW CREATE TABLE) 
without requiring
+     * a manual REFRESH CATALOG.
+     */
+    public void registerTableFromCreate(String tblName) {
+        makeSureInitialized();
+        if (!isInitialized()) {
+            return;
+        }
+        String localName = extCatalog.fromRemoteTableName(this.remoteName, 
tblName);
+        long tblId = Util.genIdByName(extCatalog.getName(), name, localName);
+        T table = buildTableForInit(tblName, localName, tblId, extCatalog, 
this, false);

Review Comment:
   This registration path bypasses the same local-name normalization used by 
`listTableNames()`. In the existing cache loader, after 
`fromRemoteTableName()`, mode `lower_case_table_names = 1` stores the local 
name lower-cased, and mode `2` preserves the remote name for display. Here a 
mixed-case external create/rename such as `CREATE TABLE Db.Foo` registers 
`metaObjCache` under `Foo`; later `getTableNullable("Foo")` calls 
`getLocalTableName()`, lowercases to `foo` in mode 1, and misses the object 
cache, so the table is still not immediately visible. Please reuse/factor the 
mapping from `listTableNames()` here, and add coverage for 
lower_case_table_names 1/2 with mixed-case table names.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to