This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch dev-1.0.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 190a243349eacbd618adf33ba60f643352fcfcb6 Author: morningman <morning...@163.com> AuthorDate: Fri Jun 24 13:03:04 2022 +0800 [hotfix] change hive, broker, iceberg table query to non-vec engine --- .../java/org/apache/doris/analysis/FromClause.java | 37 +++++++++++++++++++++- .../apache/doris/common/util/VectorizedUtil.java | 18 +---------- .../java/org/apache/doris/qe/StmtExecutor.java | 4 +-- thirdparty/vars.sh | 2 +- 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FromClause.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FromClause.java index be71841967..0ff6c71b0a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FromClause.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FromClause.java @@ -20,11 +20,14 @@ package org.apache.doris.analysis; import org.apache.doris.catalog.Database; import org.apache.doris.catalog.Table; +import org.apache.doris.catalog.Table.TableType; import org.apache.doris.cluster.ClusterNamespace; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.ErrorCode; import org.apache.doris.common.ErrorReport; import org.apache.doris.common.UserException; +import org.apache.doris.common.VecNotImplException; +import org.apache.doris.common.util.VectorizedUtil; import com.google.common.base.Preconditions; import com.google.common.base.Strings; @@ -145,15 +148,47 @@ public class FromClause implements ParseNode, Iterable<TableRef> { leftTblRef = tblRef; } + checkExternalTable(analyzer); // TODO: remove when query from hive table is supported checkFromHiveTable(analyzer); analyzed_ = true; } + private void checkExternalTable(Analyzer analyzer) throws UserException { + for (TableRef tblRef : tableRefs_) { + if (!(tblRef instanceof BaseTableRef)) { + continue; + } + + TableName tableName = tblRef.getName(); + String dbName = tableName.getDb(); + if (Strings.isNullOrEmpty(dbName)) { + dbName = analyzer.getDefaultDb(); + } else { + dbName = ClusterNamespace.getFullName(analyzer.getClusterName(), tblRef.getName().getDb()); + } + if (Strings.isNullOrEmpty(dbName)) { + ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR); + } + + Database db = analyzer.getCatalog().getDbOrAnalysisException(dbName); + String tblName = tableName.getTbl(); + Table table = db.getTableOrAnalysisException(tblName); + if (VectorizedUtil.isVectorized()) { + if (table.getType() == TableType.BROKER && table.getType() == TableType.HIVE + && table.getType() == TableType.ICEBERG) { + throw new VecNotImplException("Not support table type " + table.getType() + " in vec engine"); + } + } + } + } + public FromClause clone() { ArrayList<TableRef> clone = Lists.newArrayList(); - for (TableRef tblRef: tableRefs_) clone.add(tblRef.clone()); + for (TableRef tblRef : tableRefs_) { + clone.add(tblRef.clone()); + } return new FromClause(clone); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/VectorizedUtil.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/VectorizedUtil.java index d8fc1f55f3..7e3a501ebd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/VectorizedUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/VectorizedUtil.java @@ -39,20 +39,6 @@ public class VectorizedUtil { return connectContext.getSessionVariable().enableVectorizedEngine(); } - /** - * The purpose of this function is to turn off the vectorization switch for the current query. - * When the vectorization engine cannot meet the requirements of the current query, - * it will convert the current query into a non-vectorized query. - * Note that this will only change the **vectorization switch for a single query**, - * and will not affect other queries in the same session. - * Therefore, even if the vectorization switch of the current query is turned off, - * the vectorization properties of subsequent queries will not be affected. - * - * Session: set enable_vectorized_engine=true; - * Query1: select * from table (vec) - * Query2: select * from t1 left join (select count(*) as count from t2) t3 on t1.k1=t3.count (switch to non-vec) - * Query3: select * from table (still vec) - */ public static void switchToQueryNonVec() { ConnectContext connectContext = ConnectContext.get(); if (connectContext == null) { @@ -61,9 +47,7 @@ public class VectorizedUtil { SessionVariable sessionVariable = connectContext.getSessionVariable(); sessionVariable.setIsSingleSetVar(true); try { - VariableMgr.setVar(sessionVariable, new SetVar( - "enable_vectorized_engine", - new StringLiteral("false"))); + VariableMgr.setVar(sessionVariable, new SetVar("enable_vectorized_engine", new StringLiteral("false"))); } catch (DdlException e) { // do nothing } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 2f1124234d..db4251206b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -120,7 +120,7 @@ import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; - +import com.google.protobuf.ByteString; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.thrift.TException; @@ -139,8 +139,6 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; -import com.google.protobuf.ByteString; - // Do one COM_QUERY process. // first: Parse receive byte array to statement struct. // second: Do handle function for statement. diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh index d0121cfc95..8d9ce00628 100755 --- a/thirdparty/vars.sh +++ b/thirdparty/vars.sh @@ -45,7 +45,7 @@ export TP_LIB_DIR=$TP_INSTALL_DIR/lib export TP_JAR_DIR=$TP_INSTALL_DIR/lib/jar # source of all dependencies, default unuse it -export REPOSITORY_URL=https://doris-thirdparty-hk-1308700295.cos.ap-hongkong.myqcloud.com/thirdparty +export REPOSITORY_URL= ##################################################### # Download url, filename and unpaced filename --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org