You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/02/11 08:07:59 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15339: [DistSQL] Support `Unlabel instance` syntax.

RaigorJiang commented on a change in pull request #15339:
URL: https://github.com/apache/shardingsphere/pull/15339#discussion_r804426532



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
##########
@@ -195,6 +197,21 @@ public ASTNode visitLabelInstance(final LabelInstanceContext ctx) {
         return new LabelInstanceStatement(ctx.RELABEL() != null, ip, port, labels);
     }
     
+    @Override
+    public ASTNode visitUnlabelInstance(final UnlabelInstanceContext ctx) {
+        String ip;
+        String port;
+        if (null != ctx.instanceDefination()) {
+            ip = getIdentifierValue(ctx.instanceDefination().ip());
+            port = getIdentifierValue(ctx.instanceDefination().port());
+        } else {
+            ip = getIdentifierValue(ctx.instanceId().ip());
+            port = getIdentifierValue(ctx.instanceId().port());
+        }
+        LinkedList<String> labels = ctx.label().stream().map(this::getIdentifierValue).collect(Collectors.toCollection(LinkedList::new));

Review comment:
       Can `LinkedList<String>` be replaced by `Collection<String>` ?




-- 
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