morningman commented on code in PR #39532: URL: https://github.com/apache/doris/pull/39532#discussion_r1734888630
########## fe/fe-core/src/main/java/org/apache/doris/analysis/ModifyTablePropertiesClause.java: ########## @@ -358,7 +371,8 @@ public void analyze(Analyzer analyzer) throws AnalysisException { private void analyzeForMTMV() throws AnalysisException { if (tableName != null) { - Table table = Env.getCurrentInternalCatalog().getDbOrAnalysisException(tableName.getDb()) + TableIf table = Env.getCurrentEnv().getCatalogMgr().getCatalog(tableName.getCtl()) Review Comment: getCatalog() may return null ########## fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java: ########## @@ -5356,6 +5365,35 @@ 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()); + DatabaseIf db = catalog.getDbNullable(info.getDbName()); + TableIf table = db.getTableNullable(info.getTableName()); + if (!(table instanceof HMSExternalTable)) { + LOG.warn("Only support HMSExternalTable set property."); + return; + } + value = value.equalsIgnoreCase(PropertyAnalyzer.USE_CATALOG_AUTO_ANALYZE_POLICY) ? null : value; + ((HMSExternalTable) table).setAutoAnalyzePolicy(value); Review Comment: can just call catalog's method. And I think we can not only support HMSTable, but all kind of catalogs. You can do the check when doing the analyze. -- 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