[fix](hive-ctas) support create hive table with full quolified name (#34984)
Before, when executing `create table hive.db.table as select` to create table in hive catalog, if current catalog is not hive catalog, the default engine name will be filled with `olap`, which is wrong. This PR will fill the default engine name base on specified catalog.
This commit is contained in:
@ -40,6 +40,7 @@ import org.apache.doris.common.util.AutoBucketUtils;
|
||||
import org.apache.doris.common.util.InternalDatabaseUtil;
|
||||
import org.apache.doris.common.util.ParseUtil;
|
||||
import org.apache.doris.common.util.PropertyAnalyzer;
|
||||
import org.apache.doris.datasource.CatalogIf;
|
||||
import org.apache.doris.datasource.InternalCatalog;
|
||||
import org.apache.doris.datasource.es.EsUtil;
|
||||
import org.apache.doris.datasource.hive.HMSExternalCatalog;
|
||||
@ -548,16 +549,21 @@ public class CreateTableInfo {
|
||||
}
|
||||
|
||||
private void paddingEngineName(String ctlName, ConnectContext ctx) {
|
||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(ctlName));
|
||||
if (Strings.isNullOrEmpty(engineName)) {
|
||||
if (InternalCatalog.INTERNAL_CATALOG_NAME.equals(ctlName)) {
|
||||
CatalogIf catalog = Env.getCurrentEnv().getCatalogMgr().getCatalog(ctlName);
|
||||
if (catalog == null) {
|
||||
throw new AnalysisException("Unknown catalog: " + ctlName);
|
||||
}
|
||||
|
||||
if (catalog instanceof InternalCatalog) {
|
||||
engineName = "olap";
|
||||
} else if (ctx.getCurrentCatalog() instanceof HMSExternalCatalog) {
|
||||
} else if (catalog instanceof HMSExternalCatalog) {
|
||||
engineName = "hive";
|
||||
} else if (ctx.getCurrentCatalog() instanceof IcebergExternalCatalog) {
|
||||
} else if (catalog instanceof IcebergExternalCatalog) {
|
||||
engineName = "iceberg";
|
||||
} else {
|
||||
// set to olap by default
|
||||
engineName = "olap";
|
||||
throw new AnalysisException("Current catalog does not support create table: " + ctlName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -782,3 +788,4 @@ public class CreateTableInfo {
|
||||
this.isExternal = isExternal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user