strongduanmu commented on code in PR #26038:
URL: https://github.com/apache/shardingsphere/pull/26038#discussion_r1225234363


##########
parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java:
##########
@@ -1016,9 +1018,22 @@ public ASTNode visitHavingClause(final 
HavingClauseContext ctx) {
     
     @Override
     public ASTNode visitWindowClause(final WindowClauseContext ctx) {
+        if (null != ctx.windowDefinitionList()) {
+            return new WindowSegment(ctx.getStart().getStartIndex(), 
ctx.getStop().getStopIndex(), 
getWindowItem(ctx.windowDefinitionList().windowDefinition()),
+                    
getWindowSpecification(ctx.windowDefinitionList().windowDefinition().windowSpecification()));
+        }
         return new WindowSegment(ctx.getStart().getStartIndex(), 
ctx.getStop().getStopIndex());
     }
     
+    private IdentifierValue getWindowItem(final WindowDefinitionContext ctx) {
+        return new IdentifierValue(ctx.colId().identifier().getText());
+    }
+    
+    private Collection<ExpressionSegment> getWindowSpecification(final 
WindowSpecificationContext ctx) {
+        Collection<ExpressionSegment> result = 
createInsertValuesSegments(ctx.partitionClause().exprList());

Review Comment:
   Hi @kanha-gupta, why call createInsertValuesSegments method in 
getWindowSpecification?



##########
parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/WindowSegment.java:
##########
@@ -31,4 +35,15 @@ public final class WindowSegment implements SQLSegment {
     private final int startIndex;
     
     private final int stopIndex;
+    
+    private IdentifierValue identifierValue;
+    
+    private Collection<ExpressionSegment> segments;
+    
+    public WindowSegment(final int startIndex, final int stopIndex, final 
IdentifierValue identifierValue, final Collection<ExpressionSegment> segments) {
+        this.startIndex = startIndex;
+        this.stopIndex = stopIndex;
+        this.identifierValue = identifierValue;
+        this.segments = segments;

Review Comment:
   Can you rename it to more meaningful name?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to