You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "FlyingZC (via GitHub)" <gi...@apache.org> on 2025/07/07 11:13:01 UTC

Re: [PR] for:Full support for xml methods [shardingsphere]

FlyingZC commented on code in PR #35911:
URL: https://github.com/apache/shardingsphere/pull/35911#discussion_r2188953150


##########
parser/sql/dialect/sqlserver/src/main/antlr4/imports/sqlserver/SQLServerKeyword.g4:
##########
@@ -1986,3 +1986,15 @@ LAST_VALUE
 GRAPH
     : G R A P H
     ;
+
+NODES
+    : N O D E S
+    ;
+
+VALUE
+    : V A L U E
+    ;
+
+EXIST
+    : E X I S T
+    ;

Review Comment:
   Please add a blank line at the end of the file.



##########
parser/sql/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/SQLServerStatementVisitor.java:
##########
@@ -709,7 +713,35 @@ public final ASTNode visitSpecialFunction(final SpecialFunctionContext ctx) {
         }
         return new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getChild(0).getChild(0).getText(), getOriginalText(ctx));
     }
-    
+
+    @Override
+    public ASTNode visitXmlMethodCall(final SQLServerStatementParser.XmlMethodCallContext ctx) {
+        String fullMethodName;
+        if (null != ctx.alias()) {

Review Comment:
   Please use null == xxx



##########
parser/sql/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/SQLServerStatementVisitor.java:
##########
@@ -709,7 +713,35 @@ public final ASTNode visitSpecialFunction(final SpecialFunctionContext ctx) {
         }
         return new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getChild(0).getChild(0).getText(), getOriginalText(ctx));
     }
-    
+
+    @Override
+    public ASTNode visitXmlMethodCall(final SQLServerStatementParser.XmlMethodCallContext ctx) {
+        String fullMethodName;
+        if (null != ctx.alias()) {
+            fullMethodName = ctx.alias().getText() + "." + ctx.columnName().getText() + "." + ctx.xmlMethodName().getText();
+        } else {
+            fullMethodName = ctx.columnName().getText() + "." + ctx.xmlMethodName().getText();
+        }
+        FunctionSegment result = new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(),
+                fullMethodName, getOriginalText(ctx));
+        if (null != ctx.alias()) {

Review Comment:
   Please use null == xxx



##########
test/it/parser/src/main/resources/case/dml/select.xml:
##########
@@ -9392,7 +9392,7 @@
             </join-table>
         </from>
         <where start-index="78" stop-index="142">
-            <expr>
+                <expr>

Review Comment:
   Use the correct number of spaces for indentation



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org