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


##########
fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java:
##########
@@ -467,31 +489,43 @@ private void processModifyEngineInternal(Database db, 
Table externalTable,
 
     public void processAlterTable(AlterTableStmt stmt) throws UserException {
         TableName dbTableName = stmt.getTbl();
+        String ctlName = dbTableName.getCtl();
         String dbName = dbTableName.getDb();
         String tableName = dbTableName.getTbl();
-        Database db = 
Env.getCurrentInternalCatalog().getDbOrDdlException(dbName);
-        Table table = db.getTableOrDdlException(tableName);
+        DatabaseIf dbIf = 
Env.getCurrentEnv().getCatalogMgr().getCatalog(ctlName).getDbOrDdlException(dbName);

Review Comment:
   Catalog may be null.
   Suggest to use `getCatalogOrException()`



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -5356,6 +5365,29 @@ public void replayModifyTableProperty(short opCode, 
ModifyTablePropertyOperation
         }
     }
 
+    private void setExternalTableAutoAnalyze(Map<String, String> properties, 
ModifyTablePropertyOperationLog info) {
+        if (properties.size() != 1) {
+            LOG.warn("External table property should contain exactly 1 
entry.");

Review Comment:
   Just print a log and continue?



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -5356,6 +5365,29 @@ public void replayModifyTableProperty(short opCode, 
ModifyTablePropertyOperation
         }
     }
 
+    private void setExternalTableAutoAnalyze(Map<String, String> properties, 
ModifyTablePropertyOperationLog info) {
+        if (properties.size() != 1) {
+            LOG.warn("External table property should contain exactly 1 
entry.");
+        }
+        if 
(!properties.containsKey(PropertyAnalyzer.PROPERTIES_AUTO_ANALYZE_POLICY)) {
+            LOG.warn("External table property should only contain 
auto_analyze_policy");
+        }
+        String value = 
properties.get(PropertyAnalyzer.PROPERTIES_AUTO_ANALYZE_POLICY);
+        if 
(!PropertyAnalyzer.ENABLE_AUTO_ANALYZE_POLICY.equalsIgnoreCase(value)
+                && 
!PropertyAnalyzer.DISABLE_AUTO_ANALYZE_POLICY.equalsIgnoreCase(value)
+                && 
!PropertyAnalyzer.USE_CATALOG_AUTO_ANALYZE_POLICY.equalsIgnoreCase(value)) {
+            LOG.warn("External table property should be 'enable', 'disable' or 
'base_on_catalog'");
+            return;
+        }
+        try {
+            CatalogIf catalog = 
Env.getCurrentEnv().getCatalogMgr().getCatalog(info.getCtlName());

Review Comment:
   Suggest to use `getCatalogOrException()`.
   But should consider that if this is a replay thread, should ignore this 
exception if catalog does not exist.
   Same suggest for other exception logic in this method.



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