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

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


The following commit(s) were added to refs/heads/master by this push:
     new d44e4f8001c Optimize CTE in parser. (#31447)
d44e4f8001c is described below

commit d44e4f8001c3a19d06a285de34909753155e87b6
Author: Cong Hu <[email protected]>
AuthorDate: Thu May 30 17:31:21 2024 +0800

    Optimize CTE in parser. (#31447)
---
 .../sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java     | 2 +-
 .../sql/parser/sql/common/segment/generic/WithSegment.java            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
 
b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
index 606e739b61f..87037742473 100644
--- 
a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
+++ 
b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
@@ -745,7 +745,7 @@ public abstract class MySQLStatementVisitor extends 
MySQLStatementBaseVisitor<AS
         for (CteClauseContext each : ctx.cteClause()) {
             commonTableExpressions.add((CommonTableExpressionSegment) 
visit(each));
         }
-        return new WithSegment(ctx.start.getStartIndex(), 
ctx.stop.getStopIndex(), commonTableExpressions);
+        return new WithSegment(ctx.start.getStartIndex(), 
ctx.stop.getStopIndex(), commonTableExpressions, null != ctx.RECURSIVE());
     }
     
     @SuppressWarnings("unchecked")
diff --git 
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/WithSegment.java
 
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/WithSegment.java
index cadeea4f168..c2adaaf3c9b 100644
--- 
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/WithSegment.java
+++ 
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/WithSegment.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.sql.parser.sql.common.segment.generic;
 
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.SQLSegment;
@@ -27,6 +28,7 @@ import java.util.Collection;
 /**
  * With segment.
  */
+@AllArgsConstructor
 @RequiredArgsConstructor
 @Getter
 public final class WithSegment implements SQLSegment {
@@ -36,4 +38,6 @@ public final class WithSegment implements SQLSegment {
     private final int stopIndex;
     
     private final Collection<CommonTableExpressionSegment> 
commonTableExpressions;
+    
+    private boolean recursive;
 }

Reply via email to