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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new dd17f310b5c [fix](group commit) Fix syntax error when insert into 
table which column names contain keyword (#33322)
dd17f310b5c is described below

commit dd17f310b5c21df485062f34f8729ee49a681792
Author: meiyi <myime...@gmail.com>
AuthorDate: Mon Apr 8 08:44:02 2024 +0800

    [fix](group commit) Fix syntax error when insert into table which column 
names contain keyword (#33322)
---
 .../apache/doris/planner/GroupCommitPlanner.java   |  2 +-
 .../data/insert_p0/insert_group_commit_into.out    |  8 +++++
 .../insert_p0/insert_group_commit_into.groovy      | 36 ++++++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java
index e3c4bf0ecec..40a444f5aac 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java
@@ -91,7 +91,7 @@ public class GroupCommitPlanner {
         }
         TStreamLoadPutRequest streamLoadPutRequest = new 
TStreamLoadPutRequest();
         if (targetColumnNames != null) {
-            streamLoadPutRequest.setColumns(String.join(",", 
targetColumnNames));
+            streamLoadPutRequest.setColumns("`" + String.join("`,`", 
targetColumnNames) + "`");
             if (targetColumnNames.stream().anyMatch(col -> 
col.equalsIgnoreCase(Column.SEQUENCE_COL))) {
                 streamLoadPutRequest.setSequenceCol(Column.SEQUENCE_COL);
             }
diff --git a/regression-test/data/insert_p0/insert_group_commit_into.out 
b/regression-test/data/insert_p0/insert_group_commit_into.out
index 71a1473e1e6..7c39453d473 100644
--- a/regression-test/data/insert_p0/insert_group_commit_into.out
+++ b/regression-test/data/insert_p0/insert_group_commit_into.out
@@ -103,6 +103,10 @@ q  50
 3      3       3
 4      4       4
 
+-- !sql --
+1      test
+2      or
+
 -- !sql --
 1      a       10
 2      b       -1
@@ -207,3 +211,7 @@ q   50
 3      3       3
 4      4       4
 
+-- !sql --
+1      test
+2      or
+
diff --git a/regression-test/suites/insert_p0/insert_group_commit_into.groovy 
b/regression-test/suites/insert_p0/insert_group_commit_into.groovy
index b7c6cc4e3c4..dc681feb3f2 100644
--- a/regression-test/suites/insert_p0/insert_group_commit_into.groovy
+++ b/regression-test/suites/insert_p0/insert_group_commit_into.groovy
@@ -444,5 +444,41 @@ suite("insert_group_commit_into") {
             }
         } finally {
         }
+
+        // column name contains keyword
+        tableName = "insert_group_commit_into_with_keyword"
+        table = dbName + "." + tableName
+        try {
+            // create table
+            sql """ drop table if exists ${table}; """
+            sql """
+                CREATE TABLE IF NOT EXISTS ${table}
+                (
+                    k1 INT,
+                    `or` varchar(50)
+                )
+                DUPLICATE KEY(`k1`)
+                DISTRIBUTED BY HASH(`k1`) 
+                BUCKETS 1 PROPERTIES (
+                    "replication_allocation" = "tag.location.default: 1"
+                ); 
+            """
+
+            connect(user = context.config.jdbcUser, password = 
context.config.jdbcPassword, url = context.config.jdbcUrl) {
+                sql """ set group_commit = async_mode; """
+                if (item == "nereids") {
+                    sql """ set enable_nereids_dml = true; """
+                    sql """ set enable_nereids_planner = true; """
+                    sql """ set enable_fallback_to_original_planner = false; 
"""
+                } else {
+                    sql """ set enable_nereids_dml = false; """
+                }
+                group_commit_insert """ insert into ${table} values(1, 
'test'); """, 1
+                group_commit_insert """ insert into ${table}(k1,`or`) values 
(2,"or"); """, 1
+                getRowCount(2)
+                qt_sql """ select * from ${table}; """
+            }
+        } finally {
+        }
     }
 }
\ No newline at end of file


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

Reply via email to