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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new efcc66b1e4 [fix](Nereids) parse string literal failed (#25351)
efcc66b1e4 is described below

commit efcc66b1e4f232e68101e75e0ed39599542b2313
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Thu Oct 12 15:28:40 2023 +0800

    [fix](Nereids) parse string literal failed (#25351)
    
    caused by PR #25091
---
 .../src/main/antlr4/org/apache/doris/nereids/DorisParser.g4       | 6 +++---
 .../java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java  | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index 6b1f5f742e..cd07467e1c 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -59,7 +59,7 @@ statement
 
 identifierOrText
     : errorCapturingIdentifier
-    | STRING
+    | STRING_LITERAL
     ;
 
 userIdentify
@@ -435,10 +435,10 @@ specifiedPartition
 constant
     : NULL                                                                     
                #nullLiteral
     | interval                                                                 
                #intervalLiteral
-    | type=(DATE | DATEV2 | TIMESTAMP) STRING                                  
                #typeConstructor
+    | type=(DATE | DATEV2 | TIMESTAMP) STRING_LITERAL                          
                #typeConstructor
     | number                                                                   
                #numericLiteral
     | booleanValue                                                             
                #booleanLiteral
-    | STRING                                                                   
                #stringLiteral
+    | STRING_LITERAL                                                           
                #stringLiteral
     ;
 
 comparisonOperator
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index f6e0cd117d..595d7e8023 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -460,8 +460,8 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
 
     @Override
     public String visitIdentifierOrText(IdentifierOrTextContext ctx) {
-        if (ctx.STRING() != null) {
-            return ctx.STRING().getText().substring(1, 
ctx.STRING().getText().length() - 1);
+        if (ctx.STRING_LITERAL() != null) {
+            return ctx.STRING_LITERAL().getText().substring(1, 
ctx.STRING_LITERAL().getText().length() - 1);
         } else {
             return ctx.errorCapturingIdentifier().getText();
         }
@@ -1276,7 +1276,7 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
 
     @Override
     public Expression visitTypeConstructor(TypeConstructorContext ctx) {
-        String value = ctx.STRING().getText();
+        String value = ctx.STRING_LITERAL().getText();
         value = value.substring(1, value.length() - 1);
         String type = ctx.type.getText().toUpperCase();
         switch (type) {
@@ -1346,7 +1346,7 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
     @Override
     public Literal visitStringLiteral(StringLiteralContext ctx) {
         // TODO: add unescapeSQLString.
-        String txt = ctx.STRING().getText();
+        String txt = ctx.STRING_LITERAL().getText();
         String s = escapeBackSlash(txt.substring(1, txt.length() - 1));
         return new VarcharLiteral(s);
     }


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

Reply via email to