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

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


The following commit(s) were added to refs/heads/master by this push:
     new 01370932799 Feature/show ainodes command (#13592)
01370932799 is described below

commit 0137093279915f59a83fd46354b1b44de27c74cf
Author: Christofer Dutz <[email protected]>
AuthorDate: Wed Sep 25 11:30:29 2024 +0200

    Feature/show ainodes command (#13592)
---
 iotdb-core/ainode/pyproject.toml                   |  2 +-
 .../iotdb/db/queryengine/plan/Coordinator.java     |  2 +
 .../execution/config/TableConfigTaskVisitor.java   | 14 +++-
 .../execution/config/TreeConfigTaskVisitor.java    | 14 ++--
 .../config/executor/ClusterConfigTaskExecutor.java | 88 +++++-----------------
 .../config/executor/IConfigTaskExecutor.java       | 14 +---
 .../metadata/{model => }/ShowAINodesTask.java      | 11 +--
 .../config/metadata/ShowDataNodesTask.java         |  2 +-
 ...ShowDataNodesTask.java => ShowAINodesTask.java} | 11 +--
 .../metadata/relational/ShowConfigNodesTask.java   |  9 +--
 .../metadata/relational/ShowDataNodesTask.java     |  9 +--
 .../plan/relational/sql/ast/AstVisitor.java        |  4 +
 .../plan/relational/sql/ast/ShowAINodes.java       | 66 ++++++++++++++++
 .../plan/relational/sql/parser/AstBuilder.java     |  6 ++
 .../db/relational/grammar/sql/RelationalSql.g4     |  6 ++
 15 files changed, 136 insertions(+), 122 deletions(-)

diff --git a/iotdb-core/ainode/pyproject.toml b/iotdb-core/ainode/pyproject.toml
index 6211d230136..c7f773b0590 100644
--- a/iotdb-core/ainode/pyproject.toml
+++ b/iotdb-core/ainode/pyproject.toml
@@ -21,7 +21,7 @@ build-backend = "poetry.core.masonry.api"
 
 [tool.poetry]
 name = "apache-iotdb-ainode"
-version = "1.4.0.dev"
+version = "2.0.0.dev"
 description = "Apache IoTDB AINode"
 readme = "README.md"
 authors = ["Apache Software Foundation <[email protected]>"]
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java
index c8358b4f740..3ac30f633a7 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java
@@ -57,6 +57,7 @@ import 
org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Flush;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.PipeStatement;
 import 
org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SetConfiguration;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SetProperties;
+import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowAINodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDB;
@@ -330,6 +331,7 @@ public class Coordinator {
         || statement instanceof ShowRegions
         || statement instanceof ShowDataNodes
         || statement instanceof ShowConfigNodes
+        || statement instanceof ShowAINodes
         || statement instanceof Flush
         || statement instanceof SetConfiguration
         || statement instanceof PipeStatement) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
index 39911fab191..7d20c47d74b 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
@@ -39,6 +39,7 @@ import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateTableTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.DescribeTableTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.DropDBTask;
+import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowAINodesTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowConfigNodesTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowDBTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowDataNodesTask;
@@ -78,6 +79,7 @@ import 
org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Property;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.QualifiedName;
 import 
org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SetConfiguration;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SetProperties;
+import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowAINodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDB;
@@ -253,13 +255,21 @@ public class TableConfigTaskVisitor extends 
AstVisitor<IConfigTask, MPPQueryCont
   protected IConfigTask visitShowDataNodes(
       final ShowDataNodes showDataNodesStatement, final MPPQueryContext 
context) {
     context.setQueryType(QueryType.READ);
-    return new ShowDataNodesTask(showDataNodesStatement);
+    return new ShowDataNodesTask();
   }
 
+  @Override
   protected IConfigTask visitShowConfigNodes(
       final ShowConfigNodes showConfigNodesStatement, final MPPQueryContext 
context) {
     context.setQueryType(QueryType.READ);
-    return new ShowConfigNodesTask(showConfigNodesStatement);
+    return new ShowConfigNodesTask();
+  }
+
+  @Override
+  protected IConfigTask visitShowAINodes(
+      final ShowAINodes showAINodesStatement, final MPPQueryContext context) {
+    context.setQueryType(QueryType.READ);
+    return new ShowAINodesTask();
   }
 
   @Override
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TreeConfigTaskVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TreeConfigTaskVisitor.java
index c39f6277fd3..9caf9da708e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TreeConfigTaskVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TreeConfigTaskVisitor.java
@@ -38,6 +38,7 @@ import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.GetSeriesS
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.GetTimeSlotListTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.MigrateRegionTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.SetTTLTask;
+import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowAINodesTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowClusterDetailsTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowClusterIdTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowClusterTask;
@@ -54,7 +55,6 @@ import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowVariab
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.UnSetTTLTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model.CreateModelTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model.DropModelTask;
-import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model.ShowAINodesTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model.ShowModelsTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.template.AlterSchemaTemplateTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.template.CreateSchemaTemplateTask;
@@ -441,6 +441,12 @@ public class TreeConfigTaskVisitor extends 
StatementVisitor<IConfigTask, MPPQuer
     return new ShowConfigNodesTask();
   }
 
+  @Override
+  public IConfigTask visitShowAINodes(
+      ShowAINodesStatement showAINodesStatement, MPPQueryContext context) {
+    return new ShowAINodesTask();
+  }
+
   @Override
   public IConfigTask visitShowPipes(
       ShowPipesStatement showPipesStatement, MPPQueryContext context) {
@@ -612,10 +618,4 @@ public class TreeConfigTaskVisitor extends 
StatementVisitor<IConfigTask, MPPQuer
       ShowModelsStatement showModelsStatement, MPPQueryContext context) {
     return new ShowModelsTask(showModelsStatement.getModelName());
   }
-
-  @Override
-  public IConfigTask visitShowAINodes(
-      ShowAINodesStatement showAINodesStatement, MPPQueryContext context) {
-    return new ShowAINodesTask(showAINodesStatement);
-  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
index e8919b7fb58..1cf129f46eb 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
@@ -153,6 +153,7 @@ import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.DatabaseSc
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.GetRegionIdTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.GetSeriesSlotListTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.GetTimeSlotListTask;
+import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowAINodesTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowClusterDetailsTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowClusterIdTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowClusterTask;
@@ -165,7 +166,6 @@ import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowRegion
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowTTLTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowTriggersTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.ShowVariablesTask;
-import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model.ShowAINodesTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model.ShowModelsTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.DescribeTableTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowDBTask;
@@ -184,9 +184,7 @@ import 
org.apache.iotdb.db.queryengine.plan.expression.visitor.TransformToViewEx
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.view.AlterLogicalViewNode;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DropDB;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDB;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDataNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowRegions;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Use;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.CountDatabaseStatement;
@@ -203,12 +201,10 @@ import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.GetTimeSlotListSt
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.MigrateRegionStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.metadata.SetTTLStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowClusterStatement;
-import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowDataNodesStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowDatabaseStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowRegionStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowTTLStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.model.CreateModelStatement;
-import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowAINodesStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.pipe.AlterPipeStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.pipe.CreatePipePluginStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.pipe.CreatePipeStatement;
@@ -1437,8 +1433,7 @@ public class ClusterConfigTaskExecutor implements 
IConfigTaskExecutor {
   }
 
   @Override
-  public SettableFuture<ConfigTaskResult> showDataNodes(
-      final ShowDataNodesStatement showDataNodesStatement) {
+  public SettableFuture<ConfigTaskResult> showDataNodes() {
     final SettableFuture<ConfigTaskResult> future = SettableFuture.create();
     TShowDataNodesResp showDataNodesResp = new TShowDataNodesResp();
     try (final ConfigNodeClient client =
@@ -1480,6 +1475,24 @@ public class ClusterConfigTaskExecutor implements 
IConfigTaskExecutor {
     return future;
   }
 
+  @Override
+  public SettableFuture<ConfigTaskResult> showAINodes() {
+    SettableFuture<ConfigTaskResult> future = SettableFuture.create();
+    TShowAINodesResp resp = new TShowAINodesResp();
+    try (ConfigNodeClient client =
+        
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
+      resp = client.showAINodes();
+      if (resp.getStatus().getCode() != 
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+        future.setException(new IoTDBException(resp.getStatus().message, 
resp.getStatus().code));
+        return future;
+      }
+    } catch (ClientManagerException | TException e) {
+      future.setException(e);
+    }
+    ShowAINodesTask.buildTsBlock(resp, future);
+    return future;
+  }
+
   @Override
   public SettableFuture<ConfigTaskResult> createSchemaTemplate(
       final CreateSchemaTemplateStatement createSchemaTemplateStatement) {
@@ -2765,24 +2778,6 @@ public class ClusterConfigTaskExecutor implements 
IConfigTaskExecutor {
     return future;
   }
 
-  @Override
-  public SettableFuture<ConfigTaskResult> showAINodes(ShowAINodesStatement 
showAINodesStatement) {
-    SettableFuture<ConfigTaskResult> future = SettableFuture.create();
-    TShowAINodesResp resp = new TShowAINodesResp();
-    try (ConfigNodeClient client =
-        
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
-      resp = client.showAINodes();
-      if (resp.getStatus().getCode() != 
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        future.setException(new IoTDBException(resp.getStatus().message, 
resp.getStatus().code));
-        return future;
-      }
-    } catch (ClientManagerException | TException e) {
-      future.setException(e);
-    }
-    ShowAINodesTask.buildTsBlock(resp, future);
-    return future;
-  }
-
   @Override
   public SettableFuture<ConfigTaskResult> setSpaceQuota(
       SetSpaceQuotaStatement setSpaceQuotaStatement) {
@@ -2970,49 +2965,6 @@ public class ClusterConfigTaskExecutor implements 
IConfigTaskExecutor {
     return showRegion(treeStatement);
   }
 
-  @Override
-  public SettableFuture<ConfigTaskResult> showDataNodes(ShowDataNodes 
showDataNodes) {
-    SettableFuture<ConfigTaskResult> future = SettableFuture.create();
-    TShowDataNodesResp showDataNodesResp = new TShowDataNodesResp();
-    try (ConfigNodeClient client =
-        
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
-      showDataNodesResp = client.showDataNodes();
-      if (showDataNodesResp.getStatus().getCode() != 
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        future.setException(
-            new IoTDBException(
-                showDataNodesResp.getStatus().message, 
showDataNodesResp.getStatus().code));
-        return future;
-      }
-    } catch (ClientManagerException | TException e) {
-      future.setException(e);
-    }
-    // build TSBlock
-    ShowDataNodesTask.buildTSBlock(showDataNodesResp, future);
-    return future;
-  }
-
-  @Override
-  public SettableFuture<ConfigTaskResult> showConfigNodes(ShowConfigNodes 
showConfigNodes) {
-    SettableFuture<ConfigTaskResult> future = SettableFuture.create();
-    TShowConfigNodesResp showConfigNodesResp = new TShowConfigNodesResp();
-    try (ConfigNodeClient client =
-        
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
-      showConfigNodesResp = client.showConfigNodes();
-      if (showConfigNodesResp.getStatus().getCode()
-          != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        future.setException(
-            new IoTDBException(
-                showConfigNodesResp.getStatus().message, 
showConfigNodesResp.getStatus().code));
-        return future;
-      }
-    } catch (ClientManagerException | TException e) {
-      future.setException(e);
-    }
-    // build TSBlock
-    ShowConfigNodesTask.buildTSBlock(showConfigNodesResp, future);
-    return future;
-  }
-
   @Override
   public SettableFuture<ConfigTaskResult> useDatabase(Use useDB, 
IClientSession clientSession) {
     SettableFuture<ConfigTaskResult> future = SettableFuture.create();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
index 9db45b66da2..8fbc546aa35 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
@@ -35,9 +35,7 @@ import 
org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.view.AlterLogicalViewNode;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DropDB;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDB;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDataNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowRegions;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Use;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.CountDatabaseStatement;
@@ -54,12 +52,10 @@ import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.GetTimeSlotListSt
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.MigrateRegionStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.metadata.SetTTLStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowClusterStatement;
-import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowDataNodesStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowDatabaseStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowRegionStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowTTLStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.model.CreateModelStatement;
-import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowAINodesStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.pipe.AlterPipeStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.pipe.CreatePipePluginStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.pipe.CreatePipeStatement;
@@ -160,10 +156,12 @@ public interface IConfigTaskExecutor {
 
   SettableFuture<ConfigTaskResult> showRegion(ShowRegionStatement 
showRegionStatement);
 
-  SettableFuture<ConfigTaskResult> showDataNodes(ShowDataNodesStatement 
showDataNodesStatement);
+  SettableFuture<ConfigTaskResult> showDataNodes();
 
   SettableFuture<ConfigTaskResult> showConfigNodes();
 
+  SettableFuture<ConfigTaskResult> showAINodes();
+
   SettableFuture<ConfigTaskResult> createSchemaTemplate(
       CreateSchemaTemplateStatement createSchemaTemplateStatement);
 
@@ -267,8 +265,6 @@ public interface IConfigTaskExecutor {
 
   SettableFuture<ConfigTaskResult> showModels(String modelName);
 
-  SettableFuture<ConfigTaskResult> showAINodes(ShowAINodesStatement 
showAINodesStatement);
-
   TPipeTransferResp handleTransferConfigPlan(String clientId, TPipeTransferReq 
req);
 
   void handlePipeConfigClientExit(String clientId);
@@ -281,10 +277,6 @@ public interface IConfigTaskExecutor {
 
   SettableFuture<ConfigTaskResult> showRegions(ShowRegions showRegions);
 
-  SettableFuture<ConfigTaskResult> showDataNodes(ShowDataNodes showDataNodes);
-
-  SettableFuture<ConfigTaskResult> showConfigNodes(ShowConfigNodes 
showConfigNodes);
-
   SettableFuture<ConfigTaskResult> useDatabase(final Use useDB, final 
IClientSession clientSession);
 
   SettableFuture<ConfigTaskResult> dropDatabase(final DropDB dropDB);
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/model/ShowAINodesTask.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowAINodesTask.java
similarity index 90%
rename from 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/model/ShowAINodesTask.java
rename to 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowAINodesTask.java
index f63a43aa1a3..e0bdffff149 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/model/ShowAINodesTask.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowAINodesTask.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.queryengine.plan.execution.config.metadata.model;
+package org.apache.iotdb.db.queryengine.plan.execution.config.metadata;
 
 import org.apache.iotdb.confignode.rpc.thrift.TAINodeInfo;
 import org.apache.iotdb.confignode.rpc.thrift.TShowAINodesResp;
@@ -28,7 +28,6 @@ import 
org.apache.iotdb.db.queryengine.common.header.DatasetHeaderFactory;
 import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
-import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowAINodesStatement;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -42,16 +41,14 @@ import java.util.stream.Collectors;
 
 public class ShowAINodesTask implements IConfigTask {
 
-  private final ShowAINodesStatement showAINodesStatement;
-
-  public ShowAINodesTask(ShowAINodesStatement showAINodesStatement) {
-    this.showAINodesStatement = showAINodesStatement;
+  public ShowAINodesTask() {
+    // do nothing
   }
 
   @Override
   public ListenableFuture<ConfigTaskResult> execute(IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    return configTaskExecutor.showAINodes(showAINodesStatement);
+    return configTaskExecutor.showAINodes();
   }
 
   public static void buildTsBlock(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowDataNodesTask.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowDataNodesTask.java
index 2fb899a8853..0c6b19238ca 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowDataNodesTask.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowDataNodesTask.java
@@ -53,7 +53,7 @@ public class ShowDataNodesTask implements IConfigTask {
   @Override
   public ListenableFuture<ConfigTaskResult> execute(IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    return configTaskExecutor.showDataNodes(showDataNodesStatement);
+    return configTaskExecutor.showDataNodes();
   }
 
   public static void buildTSBlock(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowAINodesTask.java
similarity index 91%
copy from 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
copy to 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowAINodesTask.java
index 1ea2533296f..20b88f8d1de 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowAINodesTask.java
@@ -28,7 +28,6 @@ import 
org.apache.iotdb.db.queryengine.common.header.DatasetHeaderFactory;
 import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDataNodes;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -40,18 +39,12 @@ import org.apache.tsfile.utils.BytesUtils;
 import java.util.List;
 import java.util.stream.Collectors;
 
-public class ShowDataNodesTask implements IConfigTask {
-
-  private final ShowDataNodes showDataNodes;
-
-  public ShowDataNodesTask(ShowDataNodes showDataNodes) {
-    this.showDataNodes = showDataNodes;
-  }
+public class ShowAINodesTask implements IConfigTask {
 
   @Override
   public ListenableFuture<ConfigTaskResult> execute(IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    return configTaskExecutor.showDataNodes(showDataNodes);
+    return configTaskExecutor.showAINodes();
   }
 
   public static void buildTSBlock(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowConfigNodesTask.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowConfigNodesTask.java
index 5b0ac00068d..dfd2180daa2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowConfigNodesTask.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowConfigNodesTask.java
@@ -28,7 +28,6 @@ import 
org.apache.iotdb.db.queryengine.common.header.DatasetHeaderFactory;
 import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -42,16 +41,10 @@ import java.util.stream.Collectors;
 
 public class ShowConfigNodesTask implements IConfigTask {
 
-  private final ShowConfigNodes showConfigNodes;
-
-  public ShowConfigNodesTask(ShowConfigNodes showConfigNodes) {
-    this.showConfigNodes = showConfigNodes;
-  }
-
   @Override
   public ListenableFuture<ConfigTaskResult> execute(IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    return configTaskExecutor.showConfigNodes(showConfigNodes);
+    return configTaskExecutor.showConfigNodes();
   }
 
   public static void buildTSBlock(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
index 1ea2533296f..744fe2018df 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/ShowDataNodesTask.java
@@ -28,7 +28,6 @@ import 
org.apache.iotdb.db.queryengine.common.header.DatasetHeaderFactory;
 import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDataNodes;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -42,16 +41,10 @@ import java.util.stream.Collectors;
 
 public class ShowDataNodesTask implements IConfigTask {
 
-  private final ShowDataNodes showDataNodes;
-
-  public ShowDataNodesTask(ShowDataNodes showDataNodes) {
-    this.showDataNodes = showDataNodes;
-  }
-
   @Override
   public ListenableFuture<ConfigTaskResult> execute(IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    return configTaskExecutor.showDataNodes(showDataNodes);
+    return configTaskExecutor.showDataNodes();
   }
 
   public static void buildTSBlock(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AstVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AstVisitor.java
index e8d94ccc6a2..a2cd774e26b 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AstVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AstVisitor.java
@@ -347,6 +347,10 @@ public abstract class AstVisitor<R, C> {
     return visitStatement(node, context);
   }
 
+  protected R visitShowAINodes(ShowAINodes node, C context) {
+    return visitStatement(node, context);
+  }
+
   protected R visitRenameTable(RenameTable node, C context) {
     return visitStatement(node, context);
   }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ShowAINodes.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ShowAINodes.java
new file mode 100644
index 00000000000..baaaa5eea5e
--- /dev/null
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ShowAINodes.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.queryengine.plan.relational.sql.ast;
+
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.Objects.requireNonNull;
+
+public class ShowAINodes extends Statement {
+
+  public ShowAINodes() {
+    super(null);
+  }
+
+  public ShowAINodes(NodeLocation location) {
+    super(requireNonNull(location, "location is null"));
+  }
+
+  @Override
+  public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
+    return visitor.visitShowAINodes(this, context);
+  }
+
+  @Override
+  public List<Node> getChildren() {
+    return ImmutableList.of();
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    return (obj != null) && (getClass() == obj.getClass());
+  }
+
+  @Override
+  public String toString() {
+    return toStringHelper(this).toString();
+  }
+}
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
index 7f84f6c696f..c2262423b4a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
@@ -115,6 +115,7 @@ import 
org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Select;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SelectItem;
 import 
org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SetConfiguration;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SetProperties;
+import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowAINodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
 import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowDB;
@@ -802,6 +803,11 @@ public class AstBuilder extends 
RelationalSqlBaseVisitor<Node> {
     return new ShowConfigNodes();
   }
 
+  @Override
+  public Node 
visitShowAINodesStatement(RelationalSqlParser.ShowAINodesStatementContext ctx) {
+    return new ShowAINodes();
+  }
+
   @Override
   public Node 
visitShowClusterIdStatement(RelationalSqlParser.ShowClusterIdStatementContext 
ctx) {
     return super.visitShowClusterIdStatement(ctx);
diff --git 
a/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4
 
b/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4
index 3ee12283737..804037da3d5 100644
--- 
a/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4
+++ 
b/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4
@@ -93,6 +93,7 @@ statement
     | showRegionsStatement
     | showDataNodesStatement
     | showConfigNodesStatement
+    | showAINodesStatement
     | showClusterIdStatement
     | showRegionIdStatement
     | showTimeSlotListStatement
@@ -380,6 +381,10 @@ showConfigNodesStatement
     : SHOW CONFIGNODES
     ;
 
+showAINodesStatement
+    : SHOW AINODES
+    ;
+
 showClusterIdStatement
     : SHOW CLUSTERID
     ;
@@ -857,6 +862,7 @@ ABSENT: 'ABSENT';
 ADD: 'ADD';
 ADMIN: 'ADMIN';
 AFTER: 'AFTER';
+AINODES: 'AINODES';
 ALL: 'ALL';
 ALTER: 'ALTER';
 ANALYZE: 'ANALYZE';


Reply via email to