You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/04/23 14:24:56 UTC

(doris) branch selectdb-doris-2.0-ikas created (now 5ca337f5a5c)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a change to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git


      at 5ca337f5a5c spotfire bugfix

This branch includes the following new commits:

     new 1751b6bac07 [selectdb] add build release scripts (#2)
     new 255858e44ab ci: align build-for-release-selectdb.sh script (#10)
     new ebab48122d1 change x64 jdk from jdk-8u351-linux-x64.tar.gz to openjdk-8u352-b08-linux-x64.tar.gz
     new 6b6f972db68 [Improve](mysql proto) handle SQL end with '\x00'
     new 051aa6f3585 [Feature](PreparedStatement) implement general server side prepared
     new 4d70881dca7 potfire sql force limit
     new 021debc796e change version to selectdb-doris-2.0.8-ikas01
     new 5ca337f5a5c spotfire bugfix

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 07/08: change version to selectdb-doris-2.0.8-ikas01

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 021debc796e65ec322ac551a4c3902afcf605065
Author: Kang Xiao <kx...@gmail.com>
AuthorDate: Tue Apr 23 20:18:52 2024 +0800

    change version to selectdb-doris-2.0.8-ikas01
---
 gensrc/script/gen_build_version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gensrc/script/gen_build_version.sh b/gensrc/script/gen_build_version.sh
index 1f7edf83099..aa1300f3054 100755
--- a/gensrc/script/gen_build_version.sh
+++ b/gensrc/script/gen_build_version.sh
@@ -31,7 +31,7 @@ build_version_prefix="selectdb-doris"
 build_version_major=2
 build_version_minor=0
 build_version_patch=8
-build_version_rc_version=""
+build_version_rc_version="ikas01"
 
 if [[ -z "${build_version_rc_version}" ]]; then
     build_version="${build_version_prefix}-${build_version_major}.${build_version_minor}.${build_version_patch}"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 05/08: [Feature](PreparedStatement) implement general server side prepared

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 051aa6f358516ab407f17488d4ba42b4f5118643
Author: eldenmoon <15...@163.com>
AuthorDate: Mon Mar 13 14:11:27 2023 +0800

    [Feature](PreparedStatement) implement general server side prepared
    
    fix rebase
---
 be/src/runtime/runtime_state.h                     |   5 +
 be/src/service/point_query_executor.cpp            |   1 -
 be/src/util/mysql_row_buffer.cpp                   |  10 ++
 be/src/vec/sink/vresult_sink.cpp                   |  12 +-
 .../main/java/org/apache/doris/catalog/Type.java   |   4 +
 fe/fe-core/src/main/cup/sql_parser.cup             |   8 +-
 .../java/org/apache/doris/analysis/Analyzer.java   |  16 +--
 .../org/apache/doris/analysis/BinaryPredicate.java |   8 +-
 .../main/java/org/apache/doris/analysis/Expr.java  |   2 +-
 .../org/apache/doris/analysis/LiteralExpr.java     |  16 +--
 .../apache/doris/analysis/NativeInsertStmt.java    |  11 ++
 .../org/apache/doris/analysis/PlaceHolderExpr.java |   7 +-
 .../org/apache/doris/analysis/PrepareStmt.java     | 126 +++++++++-------
 .../org/apache/doris/analysis/StatementBase.java   |  14 +-
 .../org/apache/doris/analysis/StringLiteral.java   |   1 +
 .../java/org/apache/doris/catalog/OlapTable.java   |  11 +-
 .../java/org/apache/doris/mysql/MysqlChannel.java  |  10 ++
 .../java/org/apache/doris/mysql/MysqlProto.java    |   1 -
 .../org/apache/doris/planner/OlapScanNode.java     |  10 +-
 .../java/org/apache/doris/qe/ConnectProcessor.java |  53 +++----
 .../main/java/org/apache/doris/qe/Coordinator.java |   2 +
 .../java/org/apache/doris/qe/PointQueryExec.java   |   2 +-
 .../org/apache/doris/qe/PrepareStmtContext.java    |   3 +
 .../java/org/apache/doris/qe/StmtExecutor.java     |  16 ++-
 fe/fe-core/src/main/jflex/sql_scanner.flex         |   1 -
 .../data/point_query_p0/test_point_query.out       |  36 -----
 .../data/prepared_stmt_p0/prepared_stmt.out        |  49 +++++++
 .../org/apache/doris/regression/suite/Suite.groovy |   6 +
 .../apache/doris/regression/util/JdbcUtils.groovy  |   9 ++
 .../suites/point_query_p0/test_point_query.groovy  |  12 +-
 .../suites/prepared_stmt_p0/prepared_stmt.groovy   | 159 +++++++++++++++++++++
 31 files changed, 448 insertions(+), 173 deletions(-)

diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h
index 1e7375cbb97..8e57638dee6 100644
--- a/be/src/runtime/runtime_state.h
+++ b/be/src/runtime/runtime_state.h
@@ -142,6 +142,11 @@ public:
                _query_options.enable_common_expr_pushdown;
     }
 
+    bool mysql_row_binary_format() const {
+        return _query_options.__isset.mysql_row_binary_format &&
+               _query_options.mysql_row_binary_format;
+    }
+
     Status query_status() {
         std::lock_guard<std::mutex> l(_process_status_lock);
         return _process_status;
diff --git a/be/src/service/point_query_executor.cpp b/be/src/service/point_query_executor.cpp
index 20a111b2b38..d9a31b8c9d6 100644
--- a/be/src/service/point_query_executor.cpp
+++ b/be/src/service/point_query_executor.cpp
@@ -41,7 +41,6 @@
 #include "vec/exprs/vexpr.h"
 #include "vec/exprs/vexpr_context.h"
 #include "vec/jsonb/serialize.h"
-#include "vec/sink/vmysql_result_writer.cpp"
 #include "vec/sink/vmysql_result_writer.h"
 
 namespace doris {
diff --git a/be/src/util/mysql_row_buffer.cpp b/be/src/util/mysql_row_buffer.cpp
index e671ba2d012..59d655bdcf7 100644
--- a/be/src/util/mysql_row_buffer.cpp
+++ b/be/src/util/mysql_row_buffer.cpp
@@ -569,6 +569,16 @@ int MysqlRowBuffer<is_binary_format>::push_null() {
         return 0;
     }
 
+    if constexpr (is_binary_format) {
+        uint offset = (_field_pos + 2) / 8 + 1;
+        uint bit = (1 << ((_field_pos + 2) & 7));
+        /* Room for this as it's allocated start_binary_row*/
+        char* to = (char*)_buf + offset;
+        *to = (char)((uchar)*to | (uchar)bit);
+        _field_pos++;
+        return 0;
+    }
+
     int ret = reserve(1);
 
     if (0 != ret) {
diff --git a/be/src/vec/sink/vresult_sink.cpp b/be/src/vec/sink/vresult_sink.cpp
index 4c731199d06..e71176a2bfc 100644
--- a/be/src/vec/sink/vresult_sink.cpp
+++ b/be/src/vec/sink/vresult_sink.cpp
@@ -91,10 +91,16 @@ Status VResultSink::prepare(RuntimeState* state) {
 
     // create writer based on sink type
     switch (_sink_type) {
-    case TResultSinkType::MYSQL_PROTOCAL:
-        _writer.reset(new (std::nothrow)
-                              VMysqlResultWriter(_sender.get(), _output_vexpr_ctxs, _profile));
+    case TResultSinkType::MYSQL_PROTOCAL: {
+        if (state->mysql_row_binary_format()) {
+            _writer.reset(new (std::nothrow) VMysqlResultWriter<true>(
+                    _sender.get(), _output_vexpr_ctxs, _profile));
+        } else {
+            _writer.reset(new (std::nothrow) VMysqlResultWriter<false>(
+                    _sender.get(), _output_vexpr_ctxs, _profile));
+        }
         break;
+    }
     default:
         return Status::InternalError("Unknown result sink type");
     }
diff --git a/fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java b/fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java
index ea10972faa2..e5f14a58127 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java
@@ -354,6 +354,10 @@ public abstract class Type {
         return isScalarType(PrimitiveType.INVALID_TYPE);
     }
 
+    public boolean isUnsupported() {
+        return isScalarType(PrimitiveType.UNSUPPORTED);
+    }
+
     public boolean isValid() {
         return !isInvalid();
     }
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup
index 39170d5acb2..5e77f40f092 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1157,7 +1157,11 @@ stmt ::=
     | insert_overwrite_stmt : stmt
     {: RESULT = stmt; :}
     | update_stmt : stmt
-    {: RESULT = stmt; :}
+    {:
+        RESULT = stmt;
+        stmt.setPlaceHolders(parser.placeholder_expr_list);
+        parser.placeholder_expr_list.clear();
+    :}
     | backup_stmt : stmt
     {: RESULT = stmt; :}
     | restore_stmt : stmt
@@ -5328,7 +5332,7 @@ expr_or_default ::=
 prepare_stmt ::=
     KW_PREPARE variable_name:name KW_FROM select_stmt:s
     {:
-        RESULT = new PrepareStmt(s, name, false);
+        RESULT = new PrepareStmt(s, name);
         s.setPlaceHolders(parser.placeholder_expr_list);
         parser.placeholder_expr_list.clear();
     :}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index 2990e924698..ea6ed101242 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -593,6 +593,14 @@ public class Analyzer {
         return callDepth;
     }
 
+    public void setPrepareStmt(PrepareStmt stmt) {
+        prepareStmt = stmt;
+    }
+
+    public PrepareStmt getPrepareStmt() {
+        return prepareStmt;
+    }
+
     public void setInlineView(boolean inlineView) {
         isInlineView = inlineView;
     }
@@ -605,14 +613,6 @@ public class Analyzer {
         explicitViewAlias = alias;
     }
 
-    public void setPrepareStmt(PrepareStmt stmt) {
-        prepareStmt = stmt;
-    }
-
-    public PrepareStmt getPrepareStmt() {
-        return prepareStmt;
-    }
-
     public String getExplicitViewAlias() {
         return explicitViewAlias;
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
index 3a193213171..ba895061e07 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
@@ -483,11 +483,13 @@ public class BinaryPredicate extends Predicate implements Writable {
     public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
         super.analyzeImpl(analyzer);
         this.checkIncludeBitmap();
-        // Ignore placeholder
-        if (getChild(0) instanceof PlaceHolderExpr || getChild(1) instanceof PlaceHolderExpr) {
+        // Ignore placeholder, when it type is invalid.
+        // Invalid type could happen when analyze prepared point query select statement,
+        // since the value is occupied but not assigned
+        if ((getChild(0) instanceof PlaceHolderExpr && getChild(0).type == Type.UNSUPPORTED)
+                || (getChild(1) instanceof PlaceHolderExpr && getChild(1).type == Type.UNSUPPORTED)) {
             return;
         }
-
         for (Expr expr : children) {
             if (expr instanceof Subquery) {
                 Subquery subquery = (Subquery) expr;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
index f1c2d90270c..765d88148d1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
@@ -1513,7 +1513,7 @@ public abstract class Expr extends TreeNode<Expr> implements ParseNode, Cloneabl
      *                           failure to convert a string literal to a date literal
      */
     public final Expr castTo(Type targetType) throws AnalysisException {
-        if (this instanceof PlaceHolderExpr && this.type.isInvalid()) {
+        if (this instanceof PlaceHolderExpr && this.type.isUnsupported()) {
             return this;
         }
         // If the targetType is NULL_TYPE then ignore the cast because NULL_TYPE
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java
index 2be4ec3081c..287ee8bc4d2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java
@@ -318,14 +318,6 @@ public abstract class LiteralExpr extends Expr implements Comparable<LiteralExpr
         return getStringValue();
     }
 
-    // Parse from binary data, the format follows mysql binary protocal
-    // see https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_binary_resultset.html.
-    // Return next offset
-    public void setupParamFromBinary(ByteBuffer data) {
-        Preconditions.checkState(false,
-                "should implement this in derived class. " + this.type.toSql());
-    }
-
     public static LiteralExpr getLiteralByMysqlType(int mysqlType) throws AnalysisException {
         switch (mysqlType) {
             // MYSQL_TYPE_TINY
@@ -421,4 +413,12 @@ public abstract class LiteralExpr extends Expr implements Comparable<LiteralExpr
     public boolean matchExprs(List<Expr> exprs, SelectStmt stmt, boolean ignoreAlias, TupleDescriptor tuple) {
         return true;
     }
+
+    // Parse from binary data, the format follows mysql binary protocal
+    // see https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_binary_resultset.html.
+    // Return next offset
+    public void setupParamFromBinary(ByteBuffer data) {
+        Preconditions.checkState(false,
+                "should implement this in derived class. " + this.type.toSql());
+    }
 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java
index c016d7bd213..7f84dc54f6f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java
@@ -158,6 +158,17 @@ public class NativeInsertStmt extends InsertStmt {
         }
     }
 
+    public NativeInsertStmt(NativeInsertStmt other) {
+        super(other.label, null, null);
+        this.tblName = other.tblName;
+        this.targetPartitionNames = other.targetPartitionNames;
+        this.label = other.label;
+        this.queryStmt = other.queryStmt;
+        this.planHints = other.planHints;
+        this.targetColumnNames = other.targetColumnNames;
+        this.isValuesOrConstantSelect = other.isValuesOrConstantSelect;
+    }
+
     public NativeInsertStmt(InsertTarget target, String label, List<String> cols, InsertSource source,
             List<String> hints) {
         super(new LabelName(null, label), null, null);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/PlaceHolderExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/PlaceHolderExpr.java
index a15e567daaa..55cf1f1bba0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PlaceHolderExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PlaceHolderExpr.java
@@ -39,7 +39,7 @@ public class PlaceHolderExpr extends LiteralExpr {
     int mysqlTypeCode = -1;
 
     public PlaceHolderExpr() {
-
+        type = Type.UNSUPPORTED;
     }
 
     public void setTypeCode(int mysqlTypeCode) {
@@ -164,7 +164,10 @@ public class PlaceHolderExpr extends LiteralExpr {
 
     @Override
     public String toSqlImpl() {
-        return getStringValue();
+        if (this.lExpr == null) {
+            return "?";
+        }
+        return "_placeholder_(" + this.lExpr.toSqlImpl() + ")";
     }
 
     @Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/PrepareStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/PrepareStmt.java
index f9bb9e5e058..d822d79b3ed 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PrepareStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PrepareStmt.java
@@ -17,6 +17,7 @@
 
 package org.apache.doris.analysis;
 
+// import org.apache.doris.catalog.Column;
 import org.apache.doris.catalog.OlapTable;
 import org.apache.doris.common.UserException;
 import org.apache.doris.qe.ConnectContext;
@@ -39,41 +40,39 @@ import java.util.Map;
 import java.util.UUID;
 
 public class PrepareStmt extends StatementBase {
+    // We provide bellow types of prepared statement:
+    // NONE, which is not prepared
+    // FULL_PREPARED, which is real prepared, which will cache analyzed statement and planner
+    // STATEMENT, which only cache statement it self, but need to analyze each time executed.
+    public enum PreparedType {
+        NONE, FULL_PREPARED, STATEMENT
+    }
+
     private static final Logger LOG = LogManager.getLogger(PrepareStmt.class);
     private StatementBase inner;
     private String stmtName;
-
     // Cached for better CPU performance, since serialize DescriptorTable and
     // outputExprs are heavy work
     private ByteString serializedDescTable;
     private ByteString serializedOutputExpr;
-    private TDescriptorTable descTable;
+
 
     private UUID id;
-    // whether return binary protocol mysql row or not
-    private boolean binaryRowFormat;
-    int schemaVersion = -1;
-    OlapTable tbl;
-    ConnectContext context;
+    private int schemaVersion = -1;
+    private OlapTable tbl;
+    private ConnectContext context;
+    private PreparedType preparedType = PreparedType.STATEMENT;
+    boolean isPointQueryShortCircuit = false;
+
+    private TDescriptorTable descTable;
     // Serialized mysql Field, this could avoid serialize mysql field each time sendFields.
     // Since, serialize fields is too heavy when table is wide
     Map<String, byte[]> serializedFields =  Maps.newHashMap();
 
-    // We provide bellow types of prepared statement:
-    // NONE, which is not prepared
-    // FULL_PREPARED, which is really prepared, which will cache analyzed statement and planner
-    // STATEMENT, which only cache statement itself, but need to analyze each time executed
-    public enum PreparedType {
-        NONE, FULL_PREPARED, STATEMENT
-    }
-
-    private PreparedType preparedType = PreparedType.STATEMENT;
-
-    public PrepareStmt(StatementBase stmt, String name, boolean binaryRowFormat) {
+    public PrepareStmt(StatementBase stmt, String name) {
         this.inner = stmt;
         this.stmtName = name;
         this.id = UUID.randomUUID();
-        this.binaryRowFormat = binaryRowFormat;
     }
 
     public void setContext(ConnectContext ctx) {
@@ -81,7 +80,8 @@ public class PrepareStmt extends StatementBase {
     }
 
     public boolean needReAnalyze() {
-        if (preparedType == PreparedType.FULL_PREPARED && schemaVersion == tbl.getBaseSchemaVersion()) {
+        if (preparedType == PreparedType.FULL_PREPARED
+                    && schemaVersion == tbl.getBaseSchemaVersion()) {
             return false;
         }
         reset();
@@ -96,10 +96,6 @@ public class PrepareStmt extends StatementBase {
         return id;
     }
 
-    public boolean isBinaryProtocol() {
-        return binaryRowFormat;
-    }
-
     public byte[] getSerializedField(String colName) {
         return serializedFields.getOrDefault(colName, null);
     }
@@ -142,34 +138,47 @@ public class PrepareStmt extends StatementBase {
         return serializedOutputExpr;
     }
 
+    public boolean isPointQueryShortCircuit() {
+        return isPointQueryShortCircuit;
+    }
+
     @Override
     public void analyze(Analyzer analyzer) throws UserException {
+        // TODO support more Statement
+        if (!(inner instanceof SelectStmt) && !(inner instanceof NativeInsertStmt)) {
+            throw new UserException("Only support prepare SelectStmt or NativeInsertStmt");
+        }
+        analyzer.setPrepareStmt(this);
         if (inner instanceof SelectStmt) {
-            // Use tmpAnalyzer since selectStmt will be reAnalyzed
-            Analyzer tmpAnalyzer = new Analyzer(context.getEnv(), context);
+            // Try to use FULL_PREPARED to increase performance
             SelectStmt selectStmt = (SelectStmt) inner;
-            inner.analyze(tmpAnalyzer);
-            if (!selectStmt.checkAndSetPointQuery()) {
-                throw new UserException("Only support prepare SelectStmt point query now");
+            try {
+                // Use tmpAnalyzer since selectStmt will be reAnalyzed
+                Analyzer tmpAnalyzer = new Analyzer(context.getEnv(), context);
+                inner.analyze(tmpAnalyzer);
+                // Case 1 short circuit point query
+                if (selectStmt.checkAndSetPointQuery()) {
+                    tbl = (OlapTable) selectStmt.getTableRefs().get(0).getTable();
+                    schemaVersion = tbl.getBaseSchemaVersion();
+                    preparedType = PreparedType.FULL_PREPARED;
+                    isPointQueryShortCircuit = true;
+                    LOG.debug("using FULL_PREPARED prepared");
+                    return;
+                }
+            } catch (UserException e) {
+                LOG.debug("fallback to STATEMENT prepared, {}", e);
+            } finally {
+                // will be reanalyzed
+                selectStmt.reset();
             }
-            tbl = (OlapTable) selectStmt.getTableRefs().get(0).getTable();
-            schemaVersion = tbl.getBaseSchemaVersion();
-            // reset will be reAnalyzed
-            selectStmt.reset();
-            analyzer.setPrepareStmt(this);
-            // tmpAnalyzer.setPrepareStmt(this);
-            preparedType = PreparedType.FULL_PREPARED;
         } else if (inner instanceof NativeInsertStmt) {
             LabelName label = ((NativeInsertStmt) inner).getLoadLabel();
-            if (label == null || Strings.isNullOrEmpty(label.getLabelName())) {
-                analyzer.setPrepareStmt(this);
-                preparedType = PreparedType.STATEMENT;
-            } else {
+            if (label != null && !Strings.isNullOrEmpty(label.getLabelName())) {
                 throw new UserException("Only support prepare InsertStmt without label now");
             }
-        } else {
-            throw new UserException("Only support prepare SelectStmt or InsertStmt now");
         }
+        preparedType = PreparedType.STATEMENT;
+        LOG.debug("using STATEMENT prepared");
     }
 
     public String getName() {
@@ -181,10 +190,6 @@ public class PrepareStmt extends StatementBase {
         return RedirectStatus.NO_FORWARD;
     }
 
-    public StatementBase getInnerStmt() {
-        return inner;
-    }
-
     public List<PlaceHolderExpr> placeholders() {
         return inner.getPlaceHolders();
     }
@@ -193,6 +198,10 @@ public class PrepareStmt extends StatementBase {
         return inner.getPlaceHolders().size();
     }
 
+    public PreparedType getPreparedType() {
+        return preparedType;
+    }
+
     public List<Expr> getPlaceHolderExprList() {
         ArrayList<Expr> slots = new ArrayList<>();
         for (PlaceHolderExpr pexpr : inner.getPlaceHolders()) {
@@ -209,6 +218,27 @@ public class PrepareStmt extends StatementBase {
         return lables;
     }
 
+    public StatementBase getInnerStmt() {
+        if (preparedType == PreparedType.FULL_PREPARED) {
+            // For performance reason we could reuse the inner statement when FULL_PREPARED
+            return inner;
+        }
+        // Make a copy of Statement, since anlyze will modify the structure of Statement.
+        // But we should keep the original statement
+        if (inner instanceof SelectStmt) {
+            return new SelectStmt((SelectStmt) inner);
+        }
+        if (inner instanceof NativeInsertStmt) {
+            return new NativeInsertStmt((NativeInsertStmt) inner);
+        }
+        // Other statement could reuse the inner statement
+        return inner;
+    }
+
+    public int argsSize() {
+        return inner.getPlaceHolders().size();
+    }
+
     public void asignValues(List<LiteralExpr> values) throws UserException {
         if (values.size() != inner.getPlaceHolders().size()) {
             throw new UserException("Invalid arguments size "
@@ -222,10 +252,6 @@ public class PrepareStmt extends StatementBase {
         }
     }
 
-    public PreparedType getPreparedType() {
-        return preparedType;
-    }
-
     @Override
     public void reset() {
         serializedDescTable = null;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
index 198bf0b8972..26cacc2317c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
@@ -31,13 +31,15 @@ import org.apache.doris.thrift.TQueryOptions;
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
 public abstract class StatementBase implements ParseNode {
-
+    private static final Logger LOG = LogManager.getLogger(StatementBase.class);
     private String clusterName;
 
     // Set this variable if this QueryStmt is the top level query from an EXPLAIN <query>
@@ -57,7 +59,6 @@ public abstract class StatementBase implements ParseNode {
     private UserIdentity userInfo;
 
     private boolean isPrepared = false;
-
     // select * from tbl where a = ? and b = ?
     // `?` is the placeholder
     private ArrayList<PlaceHolderExpr> placeholders = new ArrayList<>();
@@ -105,14 +106,15 @@ public abstract class StatementBase implements ParseNode {
         this.explainOptions = options;
     }
 
-    public boolean isExplain() {
-        return this.explainOptions != null;
-    }
-
     public void setPlaceHolders(ArrayList<PlaceHolderExpr> placeholders) {
+        LOG.debug("setPlaceHolders {}", placeholders);
         this.placeholders = new ArrayList<PlaceHolderExpr>(placeholders);
     }
 
+    public boolean isExplain() {
+        return this.explainOptions != null;
+    }
+
     public ArrayList<PlaceHolderExpr> getPlaceHolders() {
         return this.placeholders;
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
index 66747e0002f..07997dd145b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
@@ -311,5 +311,6 @@ public class StringLiteral extends LiteralExpr {
         if (LOG.isDebugEnabled()) {
             LOG.debug("parsed value '{}'", value);
         }
+        type = Type.VARCHAR;
     }
 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
index 8bb31d32efc..19552e2da9f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
@@ -1912,6 +1912,12 @@ public class OlapTable extends Table {
         return false;
     }
 
+    public int getBaseSchemaVersion() {
+        MaterializedIndexMeta baseIndexMeta = indexIdToMeta.get(baseIndexId);
+        return baseIndexMeta.getSchemaVersion();
+    }
+
+
     public void setEnableSingleReplicaCompaction(boolean enableSingleReplicaCompaction) {
         if (tableProperty == null) {
             tableProperty = new TableProperty(new HashMap<>());
@@ -2054,11 +2060,6 @@ public class OlapTable extends Table {
         return null;
     }
 
-    public int getBaseSchemaVersion() {
-        MaterializedIndexMeta baseIndexMeta = indexIdToMeta.get(baseIndexId);
-        return baseIndexMeta.getSchemaVersion();
-    }
-
     public int getIndexSchemaVersion(long indexId) {
         MaterializedIndexMeta indexMeta = indexIdToMeta.get(indexId);
         return indexMeta.getSchemaVersion();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
index 4b10dc00656..f9888220d32 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
@@ -77,6 +77,8 @@ public class MysqlChannel implements BytesChannel {
 
     protected volatile MysqlSerializer serializer;
 
+    // mysql useServerPrepStmts
+    private boolean useServerPrepStmts;
     // mysql flag CLIENT_DEPRECATE_EOF
     private boolean clientDeprecatedEOF;
 
@@ -86,10 +88,18 @@ public class MysqlChannel implements BytesChannel {
         // For DummyMysqlChannel
     }
 
+    public void setUseServerPrepStmts() {
+        useServerPrepStmts = true;
+    }
+
     public void setClientDeprecatedEOF() {
         clientDeprecatedEOF = true;
     }
 
+    public boolean useServerPrepStmts() {
+        return useServerPrepStmts;
+    }
+
     public boolean clientDeprecatedEOF() {
         return clientDeprecatedEOF;
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlProto.java b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlProto.java
index c463e8f4264..dbc49b1e3bd 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlProto.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlProto.java
@@ -200,7 +200,6 @@ public class MysqlProto {
         }
 
         if (handshakeResponse == null) {
-            // receive response failed.
             return false;
         }
         if (capability.isDeprecatedEOF()) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
index 68be7541043..f7263980136 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
@@ -30,6 +30,7 @@ import org.apache.doris.analysis.InPredicate;
 import org.apache.doris.analysis.IntLiteral;
 import org.apache.doris.analysis.LiteralExpr;
 import org.apache.doris.analysis.PartitionNames;
+import org.apache.doris.analysis.PrepareStmt;
 import org.apache.doris.analysis.SlotDescriptor;
 import org.apache.doris.analysis.SlotId;
 import org.apache.doris.analysis.SlotRef;
@@ -204,6 +205,7 @@ public class OlapScanNode extends ScanNode {
     // only used in short circuit plan at present
     private final PartitionPruneV2ForShortCircuitPlan cachedPartitionPruner =
                         new PartitionPruneV2ForShortCircuitPlan();
+    PrepareStmt preparedStatment = null;
 
     // Constructs node to scan given data files of table 'tbl'.
     public OlapScanNode(PlanNodeId id, TupleDescriptor desc, String planNodeName) {
@@ -544,9 +546,9 @@ public class OlapScanNode extends ScanNode {
         super.init(analyzer);
 
         filterDeletedRows(analyzer);
-        // lazy evaluation, since stmt is a prepared statment
-        isFromPrepareStmt = analyzer.getPrepareStmt() != null;
-        if (!isFromPrepareStmt) {
+        // point query could do lazy evaluation, since stmt is a prepared statment
+        preparedStatment = analyzer.getPrepareStmt();
+        if (preparedStatment == null || !preparedStatment.isPointQueryShortCircuit()) {
             computeColumnsFilter();
             computePartitionInfo();
         }
@@ -606,7 +608,7 @@ public class OlapScanNode extends ScanNode {
         }
 
         // prepare stmt evaluate lazily in Coordinator execute
-        if (!isFromPrepareStmt) {
+        if (preparedStatment == null || !preparedStatment.isPointQueryShortCircuit()) {
             try {
                 createScanRangeLocations();
             } catch (AnalysisException e) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
index 378c054dcc7..5df2645ca58 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
@@ -219,44 +219,35 @@ public class ConnectProcessor {
         packetBuf.get();
         // iteration_count always 1,
         packetBuf.getInt();
-        LOG.debug("execute prepared statement {}", stmtId);
         PrepareStmtContext prepareCtx = ctx.getPreparedStmt(String.valueOf(stmtId));
-        if (prepareCtx == null) {
-            LOG.debug("No such statement in context, stmtId:{}", stmtId);
-            ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR,
-                    "msg: Not supported such prepared statement");
-            return;
-        }
-        ctx.setStartTime();
-        if (prepareCtx.stmt.getInnerStmt() instanceof QueryStmt) {
-            ctx.getState().setIsQuery(true);
-        }
-        prepareCtx.stmt.setIsPrepared();
         int paramCount = prepareCtx.stmt.getParmCount();
+        LOG.debug("execute prepared statement {}, paramCount {}", stmtId, paramCount);
         // null bitmap
-        byte[] nullbitmapData = new byte[(paramCount + 7) / 8];
-        packetBuf.get(nullbitmapData);
         String stmtStr = "";
         try {
-            // new_params_bind_flag
-            if ((int) packetBuf.get() != 0) {
-                // parse params's types
-                for (int i = 0; i < paramCount; ++i) {
-                    int typeCode = packetBuf.getChar();
-                    LOG.debug("code {}", typeCode);
-                    prepareCtx.stmt.placeholders().get(i).setTypeCode(typeCode);
-                }
-            }
             List<LiteralExpr> realValueExprs = new ArrayList<>();
-            // parse param data
-            for (int i = 0; i < paramCount; ++i) {
-                if (isNull(nullbitmapData, i)) {
-                    realValueExprs.add(new NullLiteral());
-                    continue;
+            if (paramCount > 0) {
+                byte[] nullbitmapData = new byte[(paramCount + 7) / 8];
+                packetBuf.get(nullbitmapData);
+                // new_params_bind_flag
+                if ((int) packetBuf.get() != 0) {
+                    // parse params's types
+                    for (int i = 0; i < paramCount; ++i) {
+                        int typeCode = packetBuf.getChar();
+                        LOG.debug("code {}", typeCode);
+                        prepareCtx.stmt.placeholders().get(i).setTypeCode(typeCode);
+                    }
+                }
+                // parse param data
+                for (int i = 0; i < paramCount; ++i) {
+                    if (isNull(nullbitmapData, i)) {
+                        realValueExprs.add(new NullLiteral());
+                        continue;
+                    }
+                    LiteralExpr l = prepareCtx.stmt.placeholders().get(i).createLiteralFromType();
+                    l.setupParamFromBinary(packetBuf);
+                    realValueExprs.add(l);
                 }
-                LiteralExpr l = prepareCtx.stmt.placeholders().get(i).createLiteralFromType();
-                l.setupParamFromBinary(packetBuf);
-                realValueExprs.add(l);
             }
             ExecuteStmt executeStmt = new ExecuteStmt(String.valueOf(stmtId), realValueExprs);
             // TODO set real origin statement
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
index 294bcaab444..54a45b75069 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
@@ -373,6 +373,8 @@ public class Coordinator implements CoordInterface {
         this.queryOptions.setQueryTimeout(context.getExecTimeout());
         this.queryOptions.setExecutionTimeout(context.getExecTimeout());
         this.queryOptions.setEnableScanNodeRunSerial(context.getSessionVariable().isEnableScanRunSerial());
+        this.queryOptions.setMysqlRowBinaryFormat(
+                    context.getMysqlChannel().useServerPrepStmts());
     }
 
     public long getJobId() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExec.java b/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExec.java
index f5712d3a92b..dd34bbd7504 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExec.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExec.java
@@ -113,7 +113,7 @@ public class PointQueryExec implements CoordInterface {
             this.cacheID = prepareStmt.getID();
             this.serializedDescTable = prepareStmt.getSerializedDescTable();
             this.serializedOutputExpr = prepareStmt.getSerializedOutputExprs();
-            this.isBinaryProtocol = prepareStmt.isBinaryProtocol();
+            this.isBinaryProtocol = prepareStmt.isPointQueryShortCircuit();
         } else {
             // TODO
             // planner.getDescTable().toThrift();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/PrepareStmtContext.java b/fe/fe-core/src/main/java/org/apache/doris/qe/PrepareStmtContext.java
index 3df2b277c29..400f5047b53 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/PrepareStmtContext.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/PrepareStmtContext.java
@@ -23,8 +23,11 @@ import org.apache.doris.planner.OriginalPlanner;
 import org.apache.doris.planner.Planner;
 
 import com.google.common.base.Preconditions;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 public class PrepareStmtContext {
+    private static final Logger LOG = LogManager.getLogger(PrepareStmtContext.class);
     public PrepareStmt stmt;
     public ConnectContext ctx;
     public Planner planner;
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 e7a72755a03..8f0a6b7b5a6 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
@@ -939,6 +939,7 @@ public class StmtExecutor {
             }
             // continue analyze
             preparedStmtReanalyzed = true;
+            preparedStmtCtx.stmt.reset();
             preparedStmtCtx.stmt.analyze(analyzer);
         }
 
@@ -954,7 +955,8 @@ public class StmtExecutor {
         if (parsedStmt instanceof PrepareStmt || context.getCommand() == MysqlCommand.COM_STMT_PREPARE) {
             if (context.getCommand() == MysqlCommand.COM_STMT_PREPARE) {
                 prepareStmt = new PrepareStmt(parsedStmt,
-                        String.valueOf(context.getEnv().getNextStmtId()), true /*binary protocol*/);
+                        String.valueOf(context.getEnv().getNextStmtId()));
+                context.getMysqlChannel().setUseServerPrepStmts();
             } else {
                 prepareStmt = (PrepareStmt) parsedStmt;
             }
@@ -1051,7 +1053,8 @@ public class StmtExecutor {
                 throw new AnalysisException("Unexpected exception: " + e.getMessage());
             }
         }
-        if (preparedStmtReanalyzed) {
+        if (preparedStmtReanalyzed
+                && preparedStmtCtx.stmt.getPreparedType() == PrepareStmt.PreparedType.FULL_PREPARED) {
             LOG.debug("update planner and analyzer after prepared statement reanalyzed");
             preparedStmtCtx.planner = planner;
             preparedStmtCtx.analyzer = analyzer;
@@ -1159,6 +1162,11 @@ public class StmtExecutor {
                         Lists.newArrayList(parsedStmt.getColLabels());
                 // Re-analyze the stmt with a new analyzer.
                 analyzer = new Analyzer(context.getEnv(), context);
+                if (prepareStmt != null) {
+                    // Re-analyze prepareStmt with a new analyzer
+                    prepareStmt.reset();
+                    prepareStmt.analyze(analyzer);
+                }
 
                 if (prepareStmt != null) {
                     // Re-analyze prepareStmt with a new analyzer
@@ -2007,11 +2015,11 @@ public class StmtExecutor {
     private void handlePrepareStmt() throws Exception {
         // register prepareStmt
         LOG.debug("add prepared statement {}, isBinaryProtocol {}",
-                        prepareStmt.getName(), prepareStmt.isBinaryProtocol());
+                        prepareStmt.getName(), context.getMysqlChannel().useServerPrepStmts());
         context.addPreparedStmt(prepareStmt.getName(),
                 new PrepareStmtContext(prepareStmt,
                             context, planner, analyzer, prepareStmt.getName()));
-        if (prepareStmt.isBinaryProtocol()) {
+        if (context.getMysqlChannel().useServerPrepStmts()) {
             sendStmtPrepareOK();
         }
     }
diff --git a/fe/fe-core/src/main/jflex/sql_scanner.flex b/fe/fe-core/src/main/jflex/sql_scanner.flex
index 97bbd7b49f1..7d036d9cd08 100644
--- a/fe/fe-core/src/main/jflex/sql_scanner.flex
+++ b/fe/fe-core/src/main/jflex/sql_scanner.flex
@@ -556,7 +556,6 @@ import org.apache.doris.qe.SqlModeHelper;
     tokenIdMap.put(new Integer(SqlParserSymbols.BITXOR), "^");
     tokenIdMap.put(new Integer(SqlParserSymbols.NUMERIC_OVERFLOW), "NUMERIC OVERFLOW");
     tokenIdMap.put(new Integer(SqlParserSymbols.PLACEHOLDER), "?");
-
   }
 
   public static boolean isKeyword(Integer tokenId) {
diff --git a/regression-test/data/point_query_p0/test_point_query.out b/regression-test/data/point_query_p0/test_point_query.out
index d23a62474c3..ff4b1932b3a 100644
--- a/regression-test/data/point_query_p0/test_point_query.out
+++ b/regression-test/data/point_query_p0/test_point_query.out
@@ -71,18 +71,6 @@
 -- !sql --
 6120202020646464	6C616F6F71	32.92200050354004
 
--- !sql --
-1231	119291.110000000	ddd	laooq	\N	2020-01-01T12:36:38	\N	1022-01-01	\N	1.111	[119181.111100000, 819019.119100000, null]	\N	0	0
-
--- !sql --
-1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01T12:36:38	22.822	7022-01-01	false	90696620686827832.374	[1.100000000, 2.200000000, 3.300000000, 4.400000000, 5.500000000]	[]	0	0
-
--- !sql --
-1231	119291.110000000	ddd	laooq	\N	2020-01-01T12:36:38	\N	1022-01-01	\N	1.111	[119181.111100000, 819019.119100000, null]	\N	0	0
-
--- !sql --
-1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01T12:36:38	22.822	7022-01-01	false	90696620686827832.374	[1.100000000, 2.200000000, 3.300000000, 4.400000000, 5.500000000]	[]	0	0
-
 -- !sql --
 0	1	2	3
 
@@ -158,18 +146,6 @@
 -- !sql --
 6120202020646464	6C616F6F71	32.92200050354004
 
--- !sql --
-1231	119291.110000000	ddd	laooq	\N	2020-01-01T12:36:38	\N	1022-01-01	\N	1.111	[119181.111100000, 819019.119100000, null]	\N	0	0
-
--- !sql --
-1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01T12:36:38	22.822	7022-01-01	false	90696620686827832.374	[1.100000000, 2.200000000, 3.300000000, 4.400000000, 5.500000000]	[]	0	0
-
--- !sql --
-1231	119291.110000000	ddd	laooq	\N	2020-01-01T12:36:38	\N	1022-01-01	\N	1.111	[119181.111100000, 819019.119100000, null]	\N	0	0
-
--- !sql --
-1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01T12:36:38	22.822	7022-01-01	false	90696620686827832.374	[1.100000000, 2.200000000, 3.300000000, 4.400000000, 5.500000000]	[]	0	0
-
 -- !sql --
 0	1	2	3
 
@@ -245,18 +221,6 @@
 -- !sql --
 6120202020646464	6C616F6F71	32.92200050354004
 
--- !sql --
-1231	119291.110000000	ddd	laooq	\N	2020-01-01T12:36:38	\N	1022-01-01	\N	1.111	[119181.111100000, 819019.119100000, null]	\N	0	0
-
--- !sql --
-1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01T12:36:38	22.822	7022-01-01	false	90696620686827832.374	[1.100000000, 2.200000000, 3.300000000, 4.400000000, 5.500000000]	[]	0	0
-
--- !sql --
-1231	119291.110000000	ddd	laooq	\N	2020-01-01T12:36:38	\N	1022-01-01	\N	1.111	[119181.111100000, 819019.119100000, null]	\N	0	0
-
--- !sql --
-1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01T12:36:38	22.822	7022-01-01	false	90696620686827832.374	[1.100000000, 2.200000000, 3.300000000, 4.400000000, 5.500000000]	[]	0	0
-
 -- !sql --
 0	1	2	3
 
diff --git a/regression-test/data/prepared_stmt_p0/prepared_stmt.out b/regression-test/data/prepared_stmt_p0/prepared_stmt.out
new file mode 100644
index 00000000000..f53b32f8806
--- /dev/null
+++ b/regression-test/data/prepared_stmt_p0/prepared_stmt.out
@@ -0,0 +1,49 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+1231	119291.110000000	ddd	laooq	\N	2020-01-01 12:36:38	\N	1022-01-01	["2022-01-01 11:30:38", "2022-01-01 11:30:38", "2022-01-01 11:30:38"]
+1232	12222.991211350	xxx	laooq	2023-01-02	2020-01-01 12:36:38	522.762	2022-01-01	["2023-01-01 11:30:38", "2023-01-01 11:30:38"]
+1233	1.392932911	yyy	laooq	2024-01-02	2020-01-01 12:36:38	52.862	3022-01-01	["2024-01-01 11:30:38", "2024-01-01 11:30:38", "2024-01-01 11:30:38"]
+1234	12919291.129191137	xxddd	laooq	2025-01-02	2020-01-01 12:36:38	552.872	4022-01-01	["2025-01-01 11:30:38", "2025-01-01 11:30:38", "2025-01-01 11:30:38"]
+1235	991129292901.111380000	dd	\N	2120-01-02	2020-01-01 12:36:38	652.692	5022-01-01	[]
+1236	100320.111390000	laa    ddd	laooq	2220-01-02	2020-01-01 12:36:38	2.7692	6022-01-01	[null]
+1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]
+
+-- !sql --
+1231	119291.110000000	ddd	laooq	\N	2020-01-01 12:36:38	\N	1022-01-01	["2022-01-01 11:30:38", "2022-01-01 11:30:38", "2022-01-01 11:30:38"]
+1232	12222.991211350	xxx	laooq	2023-01-02	2020-01-01 12:36:38	522.762	2022-01-01	["2023-01-01 11:30:38", "2023-01-01 11:30:38"]
+1233	1.392932911	yyy	laooq	2024-01-02	2020-01-01 12:36:38	52.862	3022-01-01	["2024-01-01 11:30:38", "2024-01-01 11:30:38", "2024-01-01 11:30:38"]
+1234	12919291.129191137	xxddd	laooq	2025-01-02	2020-01-01 12:36:38	552.872	4022-01-01	["2025-01-01 11:30:38", "2025-01-01 11:30:38", "2025-01-01 11:30:38"]
+1235	991129292901.111380000	dd	\N	2120-01-02	2020-01-01 12:36:38	652.692	5022-01-01	[]
+1236	100320.111390000	laa    ddd	laooq	2220-01-02	2020-01-01 12:36:38	2.7692	6022-01-01	[null]
+1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]
+
+-- !select0 --
+1231	119291.110000000	ddd	laooq	\N	2020-01-01 12:36:38	\N	1022-01-01	["2022-01-01 11:30:38", "2022-01-01 11:30:38", "2022-01-01 11:30:38"]
+
+-- !select0 --
+1232	12222.991211350	xxx	laooq	2023-01-02	2020-01-01 12:36:38	522.762	2022-01-01	["2023-01-01 11:30:38", "2023-01-01 11:30:38"]
+
+-- !select0 --
+1232	12222.991211350	xxx	laooq	2023-01-02	2020-01-01 12:36:38	522.762	2022-01-01	["2023-01-01 11:30:38", "2023-01-01 11:30:38"]
+
+-- !select1 --
+646464	xxxx---
+
+-- !select1 --
+787878	yyyy---
+
+-- !select1 --
+787878	yyyy---
+
+-- !select2 --
+1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]	1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]
+
+-- !select2 --
+1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]	1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]
+
+-- !select2 --
+1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]	1237	120939.111300000	a    ddd	laooq	2030-01-02	2020-01-01 12:36:38	22.822	7022-01-01	["2025-01-01 11:30:38"]
+
+-- !select3 --
+1	1	user1	30	1234	12345
+
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 4bc8beab809..3fb229ef01d 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -624,6 +624,12 @@ class Suite implements GroovyInterceptable {
         return result
     }
 
+    List<List<Object>> exec(Object stmt) {
+        logger.info("Execute sql: ${stmt}".toString())
+        def (result, meta )= JdbcUtils.executeToList(context.getConnection(),  (PreparedStatement) stmt)
+        return result
+    }
+
     void quickRunTest(String tag, Object arg, boolean isOrder = false) {
         if (context.config.generateOutputFile || context.config.forceGenerateOutputFile) {
             Tuple2<List<List<Object>>, ResultSetMetaData> tupleResult = null
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy
index 8791dd289b3..d52bea3c514 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy
@@ -41,6 +41,15 @@ class JdbcUtils {
         return conn.prepareStatement(sql);
     }
 
+    static Tuple2<List<List<Object>>, ResultSetMetaData> executeToList(Connection conn, PreparedStatement stmt) {
+        boolean hasResultSet = stmt.execute()
+        if (!hasResultSet) {
+            return [ImmutableList.of(ImmutableList.of(stmt.getUpdateCount())), null]
+        } else {
+            return toList(stmt.resultSet)
+        } 
+    }
+
     static Tuple2<List<List<Object>>, ResultSetMetaData> executeToStringList(Connection conn, PreparedStatement stmt) {
         return toStringList(stmt.executeQuery())
     }
diff --git a/regression-test/suites/point_query_p0/test_point_query.groovy b/regression-test/suites/point_query_p0/test_point_query.groovy
index 8c01c8cc208..5be89b840b1 100644
--- a/regression-test/suites/point_query_p0/test_point_query.groovy
+++ b/regression-test/suites/point_query_p0/test_point_query.groovy
@@ -227,13 +227,13 @@ suite("test_point_query") {
                 qt_sql """select /*+ SET_VAR(enable_nereids_planner=false) */ * from ${tableName} where k1 = 1237 and k2 = 120939.11130 and k3 = 'a    ddd'"""
                 qt_sql """select /*+ SET_VAR(enable_nereids_planner=false) */ hex(k3), hex(k4), k7 + 10.1 from ${tableName} where k1 = 1237 and k2 = 120939.11130 and k3 = 'a    ddd'"""
                 // prepared text
-                sql """ prepare stmt1 from  select * from ${tableName} where k1 = % and k2 = % and k3 = % """
-                qt_sql """execute stmt1 using (1231, 119291.11, 'ddd')"""
-                qt_sql """execute stmt1 using (1237, 120939.11130, 'a    ddd')"""
+                // sql """ prepare stmt1 from  select * from ${tableName} where k1 = % and k2 = % and k3 = % """
+                // qt_sql """execute stmt1 using (1231, 119291.11, 'ddd')"""
+                // qt_sql """execute stmt1 using (1237, 120939.11130, 'a    ddd')"""
 
-                sql """prepare stmt2 from  select * from ${tableName} where k1 = % and k2 = % and k3 = %"""
-                qt_sql """execute stmt2 using (1231, 119291.11, 'ddd')"""
-                qt_sql """execute stmt2 using (1237, 120939.11130, 'a    ddd')"""
+                // sql """prepare stmt2 from  select * from ${tableName} where k1 = % and k2 = % and k3 = %"""
+                // qt_sql """execute stmt2 using (1231, 119291.11, 'ddd')"""
+                // qt_sql """execute stmt2 using (1237, 120939.11130, 'a    ddd')"""
                 tableName = "test_query"
                 sql """DROP TABLE IF EXISTS ${tableName}"""
                 sql """CREATE TABLE ${tableName} (
diff --git a/regression-test/suites/prepared_stmt_p0/prepared_stmt.groovy b/regression-test/suites/prepared_stmt_p0/prepared_stmt.groovy
new file mode 100644
index 00000000000..7654fd9afdf
--- /dev/null
+++ b/regression-test/suites/prepared_stmt_p0/prepared_stmt.groovy
@@ -0,0 +1,159 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import java.math.BigDecimal;
+
+suite("test_prepared_stmt") {
+    def tableName = "tbl_prepared_stmt"
+    def user = context.config.jdbcUser
+    def password = context.config.jdbcPassword
+    def url = context.config.jdbcUrl + "&useServerPrepStmts=true"
+    // def url = context.config.jdbcUrl
+    def result1 = connect(user=user, password=password, url=url) {
+    def insert_prepared = { stmt, k1 , k2, k3, k4, k5, k6, k7, k8, k9 ->
+        java.text.SimpleDateFormat formater = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if (k1 == null) {
+            stmt.setNull(1, java.sql.Types.INTEGER);
+        } else {
+            stmt.setInt(1, k1)
+        }
+        if (k2 == null) {
+            stmt.setNull(2, java.sql.Types.DECIMAL);
+        } else {
+            stmt.setBigDecimal(2, k2)
+        }
+        if (k3 == null) {
+            stmt.setNull(3, java.sql.Types.VARCHAR);    
+        } else {
+            stmt.setString(3, k3)
+        }
+        if (k4 == null) {
+            stmt.setNull(4, java.sql.Types.VARCHAR);     
+        } else {
+            stmt.setString(4, k4)
+        }
+        if (k5 == null) {
+            stmt.setNull(5, java.sql.Types.DATE);     
+        } else {
+            stmt.setDate(5, java.sql.Date.valueOf(k5))
+        }
+        if (k6 == null) {
+            stmt.setNull(6, java.sql.Types.TIMESTAMP);     
+        } else {
+            stmt.setTimestamp(6, new java.sql.Timestamp(formater.parse(k6).getTime()))
+        }
+        if (k7 == null) {
+            stmt.setNull(7, java.sql.Types.FLOAT);
+        } else {
+            stmt.setFloat(7, k7)
+        }
+        if (k8 == null) {
+            stmt.setNull(8, java.sql.Types.DATE);
+        } else {
+            stmt.setTimestamp(8, new java.sql.Timestamp(formater.parse(k8).getTime()))
+        }
+        if (k9 == null) {
+            stmt.setNull(9, java.sql.Types.VARCHAR);
+        } else {
+            stmt.setString(9, k9)
+        }
+        exec stmt
+    }
+    sql """DROP TABLE IF EXISTS ${tableName} """
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tableName} (
+                `k1` int(11) NULL COMMENT "",
+                `k2` decimalv3(27, 9) NULL COMMENT "",
+                `k3` varchar(30) NULL COMMENT "",
+                `k4` varchar(30) NULL COMMENT "",
+                `k5` date NULL COMMENT "",
+                `k6` datetime NULL COMMENT "",
+                `k7` float NULL COMMENT "",
+                `k8` datev2 NULL COMMENT "",
+                `k9` array<datetime> NULL COMMENT ""
+              ) ENGINE=OLAP
+              DUPLICATE KEY(`k1`, `k2`, `k3`)
+              DISTRIBUTED BY HASH(`k1`, k2, k3) BUCKETS 1
+              PROPERTIES (
+              "replication_allocation" = "tag.location.default: 1",
+              "light_schema_change" = "true",
+              "storage_format" = "V2"
+              )
+          """
+      
+      def insert_stmt = prepareStatement """ INSERT INTO ${tableName} VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?) """
+      assertEquals(insert_stmt.class, com.mysql.cj.jdbc.ServerPreparedStatement);
+      insert_prepared insert_stmt, 1231, 119291.11, "ddd", "laooq", null, "2020-01-01 12:36:38", null, "1022-01-01 11:30:38", "[2022-01-01 11:30:38, 2022-01-01 11:30:38, 2022-01-01 11:30:38]"
+      insert_prepared insert_stmt, 1232, 12222.99121135, "xxx", "laooq", "2023-01-02", "2020-01-01 12:36:38", 522.762, "2022-01-01 11:30:38", "[2023-01-01 11:30:38, 2023-01-01 11:30:38]"
+      insert_prepared insert_stmt, 1233, 1.392932911136, "yyy", "laooq", "2024-01-02", "2020-01-01 12:36:38", 52.862, "3022-01-01 11:30:38", "[2024-01-01 11:30:38, 2024-01-01 11:30:38, 2024-01-01 11:30:38]"
+      insert_prepared insert_stmt, 1234, 12919291.129191137, "xxddd", "laooq", "2025-01-02", "2020-01-01 12:36:38", 552.872, "4022-01-01 11:30:38", "[2025-01-01 11:30:38, 2025-01-01 11:30:38, 2025-01-01 11:30:38]"
+      insert_prepared insert_stmt, 1235, 991129292901.11138, "dd", null, "2120-01-02", "2020-01-01 12:36:38", 652.692, "5022-01-01 11:30:38", "[]"
+      insert_prepared insert_stmt, 1236, 100320.11139, "laa    ddd", "laooq", "2220-01-02", "2020-01-01 12:36:38", 2.7692, "6022-01-01 11:30:38", "[null]"
+      insert_prepared insert_stmt, 1237, 120939.11130, "a    ddd", "laooq", "2030-01-02", "2020-01-01 12:36:38", 22.822, "7022-01-01 11:30:38", "[2025-01-01 11:30:38]"
+
+    qt_sql """select * from  ${tableName} order by 1, 2, 3"""
+    qt_sql """select * from  ${tableName} order by 1, 2, 3"""
+
+    def stmt_read = prepareStatement "select * from ${tableName} where k1 = ? order by k1"
+    assertEquals(stmt_read.class, com.mysql.cj.jdbc.ServerPreparedStatement);
+    stmt_read.setInt(1, 1231)
+    qe_select0 stmt_read
+    stmt_read.setInt(1, 1232)
+    qe_select0 stmt_read
+    qe_select0 stmt_read
+    def stmt_read1 = prepareStatement "select hex(k3), ? from ${tableName} where k1 = ? order by 1"
+    assertEquals(stmt_read1.class, com.mysql.cj.jdbc.ServerPreparedStatement);
+    stmt_read1.setString(1, "xxxx---")
+    stmt_read1.setInt(2, 1231)
+    qe_select1 stmt_read1
+    stmt_read1.setString(1, "yyyy---")
+    stmt_read1.setInt(2, 1232)
+    qe_select1 stmt_read1
+    qe_select1 stmt_read1
+      def stmt_read2 = prepareStatement "select * from ${tableName} as t1 join ${tableName} as t2 on t1.`k1` = t2.`k1` where t1.`k1` >= ? and t1.`k2` >= ? and size(t1.`k9`) > ? order by 1, 2, 3"
+      assertEquals(stmt_read2.class, com.mysql.cj.jdbc.ServerPreparedStatement);
+      stmt_read2.setInt(1, 1237)
+      stmt_read2.setBigDecimal(2, new BigDecimal("120939.11130"))
+      stmt_read2.setInt(3, 0)
+      qe_select2 stmt_read2
+      qe_select2 stmt_read2
+      qe_select2 stmt_read2
+
+      sql "DROP TABLE IF EXISTS mytable1"
+      sql """
+        CREATE TABLE mytable1
+        (
+            siteid INT DEFAULT '10',
+            citycode SMALLINT,
+            username VARCHAR(32) DEFAULT '',
+            pv BIGINT SUM DEFAULT '0'
+        )
+        AGGREGATE KEY(siteid, citycode, username)
+        DISTRIBUTED BY HASH(siteid) BUCKETS 10
+        PROPERTIES("replication_num" = "1");
+        """
+    
+     sql """insert into mytable1 values(1,1,'user1',10);"""
+     sql """insert into mytable1 values(1,1,'user1',10);"""
+     sql """insert into mytable1 values(1,1,'user1',10);"""
+     stmt_read = prepareStatement "SELECT *, ? FROM (select *, ? from mytable1 where citycode = ?) AS `SpotfireCustomQuery1` WHERE 1 = 1"
+     stmt_read.setInt(1, 12345)
+     stmt_read.setInt(2, 1234)
+     stmt_read.setInt(3, 1)
+     qe_select3 stmt_read
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 08/08: spotfire bugfix

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 5ca337f5a5c07d9de6fad5d524e140667a40b246
Author: yiguolei <yi...@gmail.com>
AuthorDate: Tue Apr 23 22:24:27 2024 +0800

    spotfire bugfix
---
 fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index 4af3fef704d..5cb7f3afc02 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -69,11 +69,8 @@ public class SessionVariable implements Serializable, Writable {
     public static final String EXEC_MEM_LIMIT = "exec_mem_limit";
     public static final String SCAN_QUEUE_MEM_LIMIT = "scan_queue_mem_limit";
     public static final String QUERY_TIMEOUT = "query_timeout";
-<<<<<<< HEAD
     public static final String ANALYZE_TIMEOUT = "analyze_timeout";
 
-=======
->>>>>>> 29b4448635 (Fixed spotfire sql force limit)
     public static final String MAX_EXECUTION_TIME = "max_execution_time";
     public static final String INSERT_TIMEOUT = "insert_timeout";
     public static final String ENABLE_REWRITE_LIMIT = "enable_rewrite_limit";


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 04/08: [Improve](mysql proto) handle SQL end with '\x00'

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 6b6f972db68115a6803eafe47d8e03ed88270af2
Author: eldenmoon <15...@163.com>
AuthorDate: Thu Apr 20 18:52:04 2023 +0800

    [Improve](mysql proto) handle SQL end with '\x00'
---
 .../java/org/apache/doris/qe/ConnectProcessor.java     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
index adda35bb5e4..378c054dcc7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
@@ -487,10 +487,28 @@ public class ConnectProcessor {
         auditAfterExec(origStmt, parsedStmt, statistics, true);
     }
 
+    private static boolean isInvisible(char c) {
+        return c < ' ' || c == '\u007F';
+    }
+
+    private void logInvisbleString(String str) {
+        StringBuilder output = new StringBuilder();
+        for (int i = 0; i < str.length(); i++) {
+            char c = str.charAt(i);
+            if (isInvisible(c)) {
+                output.append(String.format("\\x%02X", (int) c));
+            } else {
+                output.append(c);
+            }
+        }
+        LOG.debug("logInvisbleString {}", output.toString());
+    }
+
     // analyze the origin stmt and return multi-statements
     private List<StatementBase> parse(String originStmt) throws AnalysisException, DdlException {
         LOG.debug("the originStmts are: {}", originStmt);
         // Parse statement with parser generated by CUP&FLEX
+        originStmt = originStmt.replace("\u0000", "");
         SqlScanner input = new SqlScanner(new StringReader(originStmt), ctx.getSessionVariable().getSqlMode());
         SqlParser parser = new SqlParser(input);
         try {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 03/08: change x64 jdk from jdk-8u351-linux-x64.tar.gz to openjdk-8u352-b08-linux-x64.tar.gz

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit ebab48122d166bc0b094822e997b105a411dbc22
Author: Kang Xiao <kx...@gmail.com>
AuthorDate: Sat Feb 3 15:11:47 2024 +0800

    change x64 jdk from jdk-8u351-linux-x64.tar.gz to openjdk-8u352-b08-linux-x64.tar.gz
---
 build-for-release-selectdb.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build-for-release-selectdb.sh b/build-for-release-selectdb.sh
index 6c43df8d640..185d7af68e5 100755
--- a/build-for-release-selectdb.sh
+++ b/build-for-release-selectdb.sh
@@ -139,8 +139,8 @@ echo "Package Path: ${OUTPUT}"
 JAVA8_DOWNLOAD_LINK=
 JAVA8_DIR_NAME=
 if [[ "${ARCH}" == "x64" ]]; then
-    JAVA8_DOWNLOAD_LINK="https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/jdk-8u351-linux-x64.tar.gz"
-    JAVA8_DIR_NAME="jdk1.8.0_351"
+    JAVA8_DOWNLOAD_LINK="https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/openjdk-8u352-b08-linux-x64.tar.gz"
+    JAVA8_DIR_NAME="openjdk-8u352-b08-linux-x64"
 elif [[ "${ARCH}" == "arm64" ]]; then
     JAVA8_DOWNLOAD_LINK="https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/bisheng-jdk-8u352-linux-aarch64.tar.gz"
     JAVA8_DIR_NAME="bisheng-jdk1.8.0_352"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 06/08: potfire sql force limit

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 4d70881dca7c084f5c7cad3d68f7beec983039f3
Author: yuanyuan8983 <ly...@163.com>
AuthorDate: Fri May 19 14:18:47 2023 +0800

    potfire sql force limit
---
 .../doris/nereids/jobs/executor/Rewriter.java      |  2 +
 .../org/apache/doris/nereids/rules/RuleType.java   |  2 +
 .../nereids/rules/rewrite/ConvertPagingToFull.java | 55 ++++++++++++++++++++++
 .../java/org/apache/doris/qe/SessionVariable.java  | 15 ++++++
 .../java/org/apache/doris/qe/StmtExecutor.java     | 19 +++++++-
 5 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
index 56b313faf8c..c27671e7dbe 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
@@ -46,6 +46,7 @@ import org.apache.doris.nereids.rules.rewrite.CollectFilterAboveConsumer;
 import org.apache.doris.nereids.rules.rewrite.CollectProjectAboveConsumer;
 import org.apache.doris.nereids.rules.rewrite.ColumnPruning;
 import org.apache.doris.nereids.rules.rewrite.ConvertInnerOrCrossJoin;
+import org.apache.doris.nereids.rules.rewrite.ConvertPagingToFull;
 import org.apache.doris.nereids.rules.rewrite.CountDistinctRewrite;
 import org.apache.doris.nereids.rules.rewrite.CountLiteralToCountStar;
 import org.apache.doris.nereids.rules.rewrite.CreatePartitionTopNFromWindow;
@@ -217,6 +218,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
             ),
             topic("Eliminate optimization",
                     bottomUp(
+                            new ConvertPagingToFull(),
                             new EliminateLimit(),
                             new EliminateFilter(),
                             new EliminateAggregate(),
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
index 14a23aa13af..36361781c03 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
@@ -282,6 +282,8 @@ public enum RuleType {
     COLLECT_PROJECT_ABOVE_FILTER_CONSUMER(RuleTypeClass.REWRITE),
 
     LEADING_JOIN(RuleTypeClass.REWRITE),
+    CONVERT_PAGING_TO_FULL(RuleTypeClass.REWRITE),
+
     REWRITE_SENTINEL(RuleTypeClass.REWRITE),
 
     // topn opts
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ConvertPagingToFull.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ConvertPagingToFull.java
new file mode 100644
index 00000000000..017815a56ec
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ConvertPagingToFull.java
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.rules.rewrite;
+
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.trees.plans.algebra.Sort;
+import org.apache.doris.nereids.trees.plans.logical.LogicalEmptyRelation;
+import org.apache.doris.nereids.trees.plans.logical.LogicalLimit;
+import org.apache.doris.qe.ConnectContext;
+
+/**
+ * convert paging to full if enable rewrite limit
+ * If a statement has limit, but not have order by, then this statement is from spotfire
+ * spotfire will add select xxx (xxx) as xxx limit offset,length.
+ */
+public class ConvertPagingToFull extends OneRewriteRuleFactory {
+    @Override
+    public Rule build() {
+        return logicalResultSink(logicalLimit())
+                .thenApply(ctx -> {
+                    LogicalLimit<?> logicalLimit = ctx.root.child();
+                    if (!ctx.connectContext.getSessionVariable().getEnableRewriteLimit()
+                            || logicalLimit.child() instanceof Sort
+                            || ctx.connectContext.getSessionVariable().getMaxExecutionTimeMS() < 0) {
+                        return null;
+                    }
+                    if (logicalLimit.getOffset() == 0) {
+                        return ctx.root.withChildren(logicalLimit.child());
+                    } else {
+                        // The second package has a offset > 0, just return empty, because we already
+                        // return the full data in the first package.
+                        return ctx.root.withChildren(new LogicalEmptyRelation(
+                                ConnectContext.get().getStatementContext().getNextRelationId(),
+                                logicalLimit.getOutput()));
+                    }
+                })
+                .toRule(RuleType.CONVERT_PAGING_TO_FULL);
+    }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index efcfec7570e..4af3fef704d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -69,10 +69,14 @@ public class SessionVariable implements Serializable, Writable {
     public static final String EXEC_MEM_LIMIT = "exec_mem_limit";
     public static final String SCAN_QUEUE_MEM_LIMIT = "scan_queue_mem_limit";
     public static final String QUERY_TIMEOUT = "query_timeout";
+<<<<<<< HEAD
     public static final String ANALYZE_TIMEOUT = "analyze_timeout";
 
+=======
+>>>>>>> 29b4448635 (Fixed spotfire sql force limit)
     public static final String MAX_EXECUTION_TIME = "max_execution_time";
     public static final String INSERT_TIMEOUT = "insert_timeout";
+    public static final String ENABLE_REWRITE_LIMIT = "enable_rewrite_limit";
     public static final String ENABLE_PROFILE = "enable_profile";
     public static final String SQL_MODE = "sql_mode";
     public static final String WORKLOAD_VARIABLE = "workload_group";
@@ -519,6 +523,8 @@ public class SessionVariable implements Serializable, Writable {
     @VariableMgr.VarAttr(name = INSERT_TIMEOUT)
     public int insertTimeoutS = 14400;
 
+    @VariableMgr.VarAttr(name = ENABLE_REWRITE_LIMIT)
+    public boolean enableRewriteLimit = false;
     // if true, need report to coordinator when plan fragment execute successfully.
     @VariableMgr.VarAttr(name = ENABLE_PROFILE, needForward = true)
     public boolean enableProfile = false;
@@ -1560,10 +1566,15 @@ public class SessionVariable implements Serializable, Writable {
         return queryTimeoutS;
     }
 
+
     public int getAnalyzeTimeoutS() {
         return analyzeTimeoutS;
     }
 
+    public boolean getEnableRewriteLimit() {
+        return this.enableRewriteLimit;
+    }
+
     public void setEnableTwoPhaseReadOpt(boolean enable) {
         enableTwoPhaseReadOpt = enable;
     }
@@ -1785,6 +1796,10 @@ public class SessionVariable implements Serializable, Writable {
         this.workloadGroup = workloadGroup;
     }
 
+    public void setEnableRewriteLimit(boolean enableRewriteLimit) {
+        this.enableRewriteLimit = enableRewriteLimit;
+    }
+
     public String getResourceGroup() {
         return resourceGroup;
     }
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 8f0a6b7b5a6..6e1cf3c1459 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
@@ -687,7 +687,24 @@ public class StmtExecutor {
     // IOException: talk with client failed.
     public void executeByLegacy(TUniqueId queryId) throws Exception {
         context.setStartTime();
-
+        SessionVariable sessionVariable2 = context.getSessionVariable();
+        // If a statement has limit, but not have order by, then this statement is from spotfire
+        // spotfire will add select xxx (xxx) as xxx limit offset,length.
+        if (parsedStmt instanceof SelectStmt && sessionVariable2.getMaxExecutionTimeMS() > 0
+                && sessionVariable2.getEnableRewriteLimit()) {
+            SelectStmt selectStmt = (SelectStmt) parsedStmt;
+            // If has limit and not have order by, this is from BI spotfire because limit without order
+            // by clause is unstable, user should not write this query.
+            if (selectStmt.hasLimitClause() && selectStmt.getOrderByElements() == null) {
+                if (selectStmt.getOffset() == 0) {
+                    // This is the first batch, then we treat it as a total data, just remote limit clause
+                    selectStmt.removeLimitElement();
+                } else {
+                    // This is the second batch, then just treat it as empty, to indicate finished pull data
+                    selectStmt.setLimit(0);
+                }
+            }
+        }
         profile.getSummaryProfile().setQueryBeginTime();
         context.setStmtId(STMT_ID_GENERATOR.incrementAndGet());
         context.setQueryId(queryId);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 01/08: [selectdb] add build release scripts (#2)

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 1751b6bac074649a44a521d63a53fde661c9a6ec
Author: xxiao2018 <78...@users.noreply.github.com>
AuthorDate: Fri May 5 11:57:05 2023 +0800

    [selectdb] add build release scripts (#2)
---
 bin/start_be.sh                                    |   9 ++
 bin/start_fe.sh                                    |  11 ++
 build-for-release-selectdb.sh                      | 175 +++++++++++++++++++++
 conf/be.conf                                       |   3 +
 conf/fe.conf                                       |   3 +
 .../java/org/apache/doris/qe/GlobalVariable.java   |   4 +-
 fs_brokers/apache_hdfs_broker/bin/start_broker.sh  |   9 ++
 gensrc/script/gen_build_version.sh                 |   4 +-
 8 files changed, 214 insertions(+), 4 deletions(-)

diff --git a/bin/start_be.sh b/bin/start_be.sh
index eecafc2a73a..57fd31500e0 100755
--- a/bin/start_be.sh
+++ b/bin/start_be.sh
@@ -63,6 +63,15 @@ DORIS_HOME="$(
     pwd
 )"
 export DORIS_HOME
+if [[ -z "${JAVA_HOME}" ]]; then
+    java_home="$(
+       cd "${curdir}/../.."
+       pwd
+    )"
+    export JAVA_HOME=$java_home/java8
+    export PATH=$JAVA_HOME/bin:$PATH
+    echo "${JAVA_HOME}"
+fi
 
 if [[ "$(uname -s)" != 'Darwin' ]]; then
     MAX_MAP_COUNT="$(cat /proc/sys/vm/max_map_count)"
diff --git a/bin/start_fe.sh b/bin/start_fe.sh
index e473036fec8..258777495e5 100755
--- a/bin/start_fe.sh
+++ b/bin/start_fe.sh
@@ -89,6 +89,17 @@ DORIS_HOME="$(
 )"
 export DORIS_HOME
 
+if [[ -z "${JAVA_HOME}" ]]; then
+    java_home="$(
+       cd "${curdir}/../.."
+       pwd
+    )"
+    export JAVA_HOME=$java_home/java8
+    export PATH=$JAVA_HOME/bin:$PATH
+    echo "${JAVA_HOME}"
+fi
+
+
 # export env variables from fe.conf
 #
 # JAVA_OPTS
diff --git a/build-for-release-selectdb.sh b/build-for-release-selectdb.sh
new file mode 100755
index 00000000000..16c6a87c3a1
--- /dev/null
+++ b/build-for-release-selectdb.sh
@@ -0,0 +1,175 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##############################################################
+# This script is used to build for SelectDB Enterprise Core
+##############################################################
+
+set -eo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+
+export DORIS_HOME="${ROOT}"
+
+# Check args
+usage() {
+    echo "
+Usage: $0 --version version <options>
+  Optional options:
+     [no option]        build with avx2
+     --noavx2           build without avx2
+     --tar              pack the output
+
+  Eg.
+    $0 --version 1.2.0                      build with avx2
+    $0 --noavx2 --version 1.2.0             build without avx2
+    $0 --version 1.2.0 --tar                build with avx2 and pack the output
+  "
+    exit 1
+}
+
+if ! OPTS="$(getopt \
+    -n "$0" \
+    -o '' \
+    -l 'noavx2' \
+    -l 'tar' \
+    -l 'version:' \
+    -l 'help' \
+    -- "$@")"; then
+    usage
+fi
+
+eval set -- "${OPTS}"
+
+_USE_AVX2=1
+TAR=0
+VERSION=
+if [[ "$#" == 1 ]]; then
+    _USE_AVX2=1
+else
+    while true; do
+        case "$1" in
+        --noavx2)
+            _USE_AVX2=0
+            shift
+            ;;
+        --tar)
+            TAR=1
+            shift
+            ;;
+        --version)
+            VERSION="$2"
+            shift 2
+            ;;
+        --help)
+            HELP=1
+            shift
+            ;;
+        --)
+            shift
+            break
+            ;;
+        *)
+            echo "Internal error"
+            exit 1
+            ;;
+        esac
+    done
+fi
+
+if [[ "${HELP}" -eq 1 ]]; then
+    usage
+    exit
+fi
+
+if [[ -z ${VERSION} ]]; then
+    echo "Must specify version"
+    usage
+    exit 1
+fi
+
+echo "Get params:
+    VERSION         -- ${VERSION}
+    USE_AVX2        -- ${_USE_AVX2}
+    TAR             -- ${TAR}
+"
+
+ARCH="$(uname -m)"
+
+ORI_OUTPUT="${ROOT}/output"
+
+FE="fe"
+BE="be"
+BROKER="apache_hdfs_broker"
+AUDIT="audit_loader"
+
+PACKAGE_NAME="selectdb-doris-${VERSION}-bin-${ARCH}"
+if [[ "${_USE_AVX2}" == "0" && "${ARCH}" == "x86_64" ]]; then
+    PACKAGE_NAME="${PACKAGE_NAME}-noavx2"
+fi
+OUTPUT="${ORI_OUTPUT}/${PACKAGE_NAME}"
+
+rm -rf "${OUTPUT}" && mkdir -p "${OUTPUT}"
+echo "Package Path: ${OUTPUT}"
+
+# download and setup java
+JAVA8_DOWNLOAD_LINK=
+JAVA8_DIR_NAME=
+if [[ "${ARCH}" == "x86_64" ]]; then
+    JAVA8_DOWNLOAD_LINK="https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/jdk-8u351-linux-x64.tar.gz"
+    JAVA8_DIR_NAME="jdk1.8.0_351"
+elif [[ "${ARCH}" == "arm64" ]]; then
+    JAVA8_DOWNLOAD_LINK="https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/bisheng-jdk-8u352-linux-aarch64.tar.gz"
+    JAVA8_DIR_NAME="bisheng-jdk1.8.0_352"
+else
+    echo "Unknown arch: ${ARCH}"
+    exit 1
+fi
+
+OUTPUT_JAVA8="${OUTPUT}/java8"
+curl -# "${JAVA8_DOWNLOAD_LINK}" | tar xz -C "${OUTPUT}/" && mv "${OUTPUT}/${JAVA8_DIR_NAME}/" "${OUTPUT_JAVA8}"
+export JAVA_HOME="${OUTPUT_JAVA8}"
+export PATH="${JAVA_HOME}/bin:${PATH}"
+
+# build core
+#sh build.sh --clean &&
+USE_AVX2="${_USE_AVX2}" sh build.sh && USE_AVX2="${_USE_AVX2}" sh build.sh --be --meta-tool
+
+echo "Begin to install"
+cp -r "${ORI_OUTPUT}/fe" "${OUTPUT}/fe"
+cp -r "${ORI_OUTPUT}/be" "${OUTPUT}/be"
+cp -r "${ORI_OUTPUT}/apache_hdfs_broker" "${OUTPUT}/apache_hdfs_broker"
+cp -r "${ORI_OUTPUT}/audit_loader" "${OUTPUT}/audit_loader"
+
+JDBC_DRIVERS_DIR="${OUTPUT}/jdbc_drivers/"
+mkdir -p "${JDBC_DRIVERS_DIR}"
+wget https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/clickhouse-jdbc-0.3.2-patch11-all.jar -P "${JDBC_DRIVERS_DIR}/"
+wget https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/mssql-jdbc-11.2.0.jre8.jar -P "${JDBC_DRIVERS_DIR}/"
+wget https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/mysql-connector-java-8.0.25.jar -P "${JDBC_DRIVERS_DIR}/"
+wget https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/ojdbc6.jar -P "${JDBC_DRIVERS_DIR}/"
+wget https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/postgresql-42.5.0.jar -P "${JDBC_DRIVERS_DIR}/"
+
+if [[ "${TAR}" -eq 1 ]]; then
+    echo "Begin to compress"
+    cd "${ORI_OUTPUT}"
+    tar -cf - "${PACKAGE_NAME}" | xz -T0 -z - >"${PACKAGE_NAME}".tar.xz
+    cd -
+fi
+
+echo "Output dir: ${OUTPUT}"
+exit 0
diff --git a/conf/be.conf b/conf/be.conf
index c40af9b9e4b..d9c02f0d349 100644
--- a/conf/be.conf
+++ b/conf/be.conf
@@ -51,6 +51,9 @@ ssl_private_key_path = "$DORIS_HOME/conf/key.pem"
 # enable auth check
 enable_auth = false
 
+# jdbc driver path configuration
+jdbc_drivers_dir=${DORIS_HOME}/../jdbc_drivers/
+
 # Choose one if there are more than one ip except loopback address. 
 # Note that there should at most one ip match this list.
 # If no ip match this rule, will choose one randomly.
diff --git a/conf/fe.conf b/conf/fe.conf
index c46887af0ff..317d91c9e2e 100644
--- a/conf/fe.conf
+++ b/conf/fe.conf
@@ -53,6 +53,9 @@ rpc_port = 9020
 query_port = 9030
 edit_log_port = 9010
 
+# jdbc driver path configuration
+jdbc_drivers_dir=${DORIS_HOME}/../jdbc_drivers/
+
 # Choose one if there are more than one ip except loopback address. 
 # Note that there should at most one ip match this list.
 # If no ip match this rule, will choose one randomly.
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java
index 1e6fff13829..333ff2114b2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java
@@ -50,8 +50,8 @@ public final class GlobalVariable {
     public static final long VALIDATE_PASSWORD_POLICY_STRONG = 2;
 
     @VariableMgr.VarAttr(name = VERSION_COMMENT, flag = VariableMgr.READ_ONLY)
-    public static String versionComment = "Doris version "
-            + Version.DORIS_BUILD_VERSION + "-" + Version.DORIS_BUILD_SHORT_HASH;
+    public static String versionComment =
+            Version.DORIS_BUILD_VERSION + "-" + Version.DORIS_BUILD_SHORT_HASH;
 
     @VariableMgr.VarAttr(name = VERSION, flag = VariableMgr.READ_ONLY)
     public static String version = MysqlHandshakePacket.SERVER_VERSION;
diff --git a/fs_brokers/apache_hdfs_broker/bin/start_broker.sh b/fs_brokers/apache_hdfs_broker/bin/start_broker.sh
index c40c8f77f7f..a067ed6f849 100755
--- a/fs_brokers/apache_hdfs_broker/bin/start_broker.sh
+++ b/fs_brokers/apache_hdfs_broker/bin/start_broker.sh
@@ -56,6 +56,15 @@ BROKER_HOME="$(
     pwd
 )"
 export BROKER_HOME
+if [[ -z "${JAVA_HOME}" ]]; then
+    java_home="$(
+       cd "${curdir}/../.."
+       pwd
+    )"
+    export JAVA_HOME=$java_home/java8
+    export PATH=$JAVA_HOME/bin:$PATH
+    echo "${JAVA_HOME}"
+fi
 
 PID_DIR="$(
     cd "${curdir}"
diff --git a/gensrc/script/gen_build_version.sh b/gensrc/script/gen_build_version.sh
index 35250f66aa3..1f7edf83099 100755
--- a/gensrc/script/gen_build_version.sh
+++ b/gensrc/script/gen_build_version.sh
@@ -27,7 +27,7 @@
 
 set -eo pipefail
 
-build_version_prefix="doris"
+build_version_prefix="selectdb-doris"
 build_version_major=2
 build_version_minor=0
 build_version_patch=8
@@ -67,7 +67,7 @@ if [[ -d '.git' ]]; then
     short_revision="$(git log -1 --pretty=format:"%h")"
     url="git://${hostname}"
 else
-    revision="Unknown"
+    revision="tag"
     short_revision="${revision}"
     url="file://${hostname}"
 fi


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 02/08: ci: align build-for-release-selectdb.sh script (#10)

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch selectdb-doris-2.0-ikas
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 255858e44aba2571eafa2558e364d38b8278aab5
Author: py023 <13...@users.noreply.github.com>
AuthorDate: Thu Dec 7 21:45:27 2023 +0800

    ci: align build-for-release-selectdb.sh script (#10)
---
 build-for-release-selectdb.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/build-for-release-selectdb.sh b/build-for-release-selectdb.sh
index 16c6a87c3a1..6c43df8d640 100755
--- a/build-for-release-selectdb.sh
+++ b/build-for-release-selectdb.sh
@@ -110,6 +110,14 @@ echo "Get params:
 "
 
 ARCH="$(uname -m)"
+if [[ "${ARCH}" == "aarch64" ]]; then
+    ARCH="arm64"
+elif [[ "${ARCH}" == "x86_64" ]]; then
+    ARCH="x64"
+else
+    echo "Unknown arch: ${ARCH}"
+    exit 1
+fi
 
 ORI_OUTPUT="${ROOT}/output"
 
@@ -119,7 +127,7 @@ BROKER="apache_hdfs_broker"
 AUDIT="audit_loader"
 
 PACKAGE_NAME="selectdb-doris-${VERSION}-bin-${ARCH}"
-if [[ "${_USE_AVX2}" == "0" && "${ARCH}" == "x86_64" ]]; then
+if [[ "${_USE_AVX2}" == "0" && "${ARCH}" == "x64" ]]; then
     PACKAGE_NAME="${PACKAGE_NAME}-noavx2"
 fi
 OUTPUT="${ORI_OUTPUT}/${PACKAGE_NAME}"
@@ -130,7 +138,7 @@ echo "Package Path: ${OUTPUT}"
 # download and setup java
 JAVA8_DOWNLOAD_LINK=
 JAVA8_DIR_NAME=
-if [[ "${ARCH}" == "x86_64" ]]; then
+if [[ "${ARCH}" == "x64" ]]; then
     JAVA8_DOWNLOAD_LINK="https://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/jdk-8u351-linux-x64.tar.gz"
     JAVA8_DIR_NAME="jdk1.8.0_351"
 elif [[ "${ARCH}" == "arm64" ]]; then


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org