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

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

commit 62db7094ea875554b1f58d4abae411ba66b18d16
Author: abmdocrt <yukang.lian2...@gmail.com>
AuthorDate: Fri Mar 8 18:09:23 2024 +0800

    Revert "Problem: When the old optimizer processes an INSERT INTO statement 
that contains two quotation marks, it results in only one quotation mark being 
written into the database. (#31890)" (#31986)
    
    This reverts commit 8c309652e04698f311b6c9158105352e8416c69a.
---
 fe/fe-core/src/main/jflex/sql_scanner.flex     |  2 +-
 regression-test/data/insert_p0/insert.out      |  3 ---
 regression-test/suites/insert_p0/insert.groovy | 16 ----------------
 3 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/fe/fe-core/src/main/jflex/sql_scanner.flex 
b/fe/fe-core/src/main/jflex/sql_scanner.flex
index 5cc4a881604..175744532c0 100644
--- a/fe/fe-core/src/main/jflex/sql_scanner.flex
+++ b/fe/fe-core/src/main/jflex/sql_scanner.flex
@@ -757,7 +757,7 @@ EndOfLineComment = "--" 
!({HintContent}|{ContainsLineTerminator}) {LineTerminato
 
 {SingleQuoteStringLiteral} {
   return newToken(SqlParserSymbols.STRING_LITERAL,
-      escapeBackSlash(yytext().substring(1, yytext().length()-1)));
+      escapeBackSlash(yytext().substring(1, 
yytext().length()-1)).replaceAll("''", "'"));
 }
 
 {DoubleQuoteStringLiteral} {
diff --git a/regression-test/data/insert_p0/insert.out 
b/regression-test/data/insert_p0/insert.out
index 38a2a818ab5..b582f45123d 100644
--- a/regression-test/data/insert_p0/insert.out
+++ b/regression-test/data/insert_p0/insert.out
@@ -202,6 +202,3 @@
 44980  113.8777        again   1987-04-09      2010-01-02T04:03:06     false   
-0.01   0E-10
 44980  113.8777        again   1987-04-09      2010-01-02T04:03:06     false   
-0.01   0E-10
 
--- !select --
-3      replace(cdate,'-','')
-
diff --git a/regression-test/suites/insert_p0/insert.groovy 
b/regression-test/suites/insert_p0/insert.groovy
index cd3ba176bc8..573d5d8366c 100644
--- a/regression-test/suites/insert_p0/insert.groovy
+++ b/regression-test/suites/insert_p0/insert.groovy
@@ -83,20 +83,4 @@ suite("insert") {
     sql "sync"
     qt_insert """ select * from mutable_datatype order by c_bigint, c_double, 
c_string, c_date, c_timestamp, c_boolean, c_short_decimal"""
 
-    def table = "insert_with_quote"
-    sql """ DROP TABLE IF EXISTS ${table} """
-    sql """
-        CREATE TABLE ${table} (
-            `id` int(11) NULL,
-            `dim1` string NULL
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-            "replication_allocation" = "tag.location.default: 1"
-        );
-    """
-    sql """insert into ${table}(id,dim1) 
values(3,\'replace(cdate,\\\'-\\\',\\\'\\\')\')"""
-    qt_select """ select * from ${table} """
-
 }


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

Reply via email to