You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2023/11/30 02:16:33 UTC

(doris) branch branch-1.2-lts updated: [fix](planner)fix bug of process sequence column in insert statement (#27483)

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

zhangchen pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 410c7d4a069 [fix](planner)fix bug of process sequence column in insert statement (#27483)
410c7d4a069 is described below

commit 410c7d4a0699fa9111cda6cb8a7fa5dbe93cb1eb
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Thu Nov 30 10:16:24 2023 +0800

    [fix](planner)fix bug of process sequence column in insert statement (#27483)
---
 .../java/org/apache/doris/analysis/InsertStmt.java |  1 +
 .../correctness_p0/test_insert_sequence_column.out |  4 ++
 .../test_insert_sequence_column.groovy             | 50 ++++++++++++++++++++++
 3 files changed, 55 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java
index 891fe3349b7..0cdde0d29e5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java
@@ -721,6 +721,7 @@ public class InsertStmt extends DdlStmt {
                         resultExprs.add(defaultValueExpr.checkTypeCompatibility(col.getType()));
                     }
                 }
+                exprByName.put(col.getName(), resultExprs.get(resultExprs.size() - 1));
             }
         }
     }
diff --git a/regression-test/data/correctness_p0/test_insert_sequence_column.out b/regression-test/data/correctness_p0/test_insert_sequence_column.out
new file mode 100644
index 00000000000..72d126351a3
--- /dev/null
+++ b/regression-test/data/correctness_p0/test_insert_sequence_column.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !select --
+1
+
diff --git a/regression-test/suites/correctness_p0/test_insert_sequence_column.groovy b/regression-test/suites/correctness_p0/test_insert_sequence_column.groovy
new file mode 100644
index 00000000000..9bec39f4541
--- /dev/null
+++ b/regression-test/suites/correctness_p0/test_insert_sequence_column.groovy
@@ -0,0 +1,50 @@
+// 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.
+
+suite("test_insert_sequence_column") {
+    sql """
+        drop table if exists dws_ncc_detail_xcb_total_5;
+    """
+    
+    sql """
+        CREATE TABLE `dws_ncc_detail_xcb_total_5` (
+        `code` varchar(50) NULL COMMENT '编码',
+        `value` int NULL,
+        `ct` datetime NULL DEFAULT CURRENT_TIMESTAMP
+        ) ENGINE=OLAP
+        UNIQUE KEY(`code`)
+        COMMENT 'OLAP'
+        DISTRIBUTED BY HASH(`code`) BUCKETS 8
+        PROPERTIES (
+        "replication_num" = "1",
+        "in_memory" = "false",
+        "storage_format" = "V2",
+        "function_column.sequence_col" = "ct",
+        "disable_auto_compaction" = "false"
+        );
+    """
+
+    sql """
+        insert into dws_ncc_detail_xcb_total_5 (code,value) values("a",1); 
+    """
+
+    qt_select """select count(*) from dws_ncc_detail_xcb_total_5 where code = 'a' and value = 1;"""
+
+    sql """
+        drop table if exists dws_ncc_detail_xcb_total_5;
+    """
+}


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