Skip to content

Commit

Permalink
Optimize CTE in parser. (#31447)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamhucong authored May 30, 2024
1 parent 448a433 commit d44e4f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ public ASTNode visitWithClause(final WithClauseContext ctx) {
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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,6 +28,7 @@
/**
* With segment.
*/
@AllArgsConstructor
@RequiredArgsConstructor
@Getter
public final class WithSegment implements SQLSegment {
Expand All @@ -36,4 +38,6 @@ public final class WithSegment implements SQLSegment {
private final int stopIndex;

private final Collection<CommonTableExpressionSegment> commonTableExpressions;

private boolean recursive;
}

0 comments on commit d44e4f8

Please sign in to comment.