jt2594838 commented on a change in pull request #429: [IOTDB-205]Support 
storage-group-level data ttl
URL: https://github.com/apache/incubator-iotdb/pull/429#discussion_r338367962
 
 

 ##########
 File path: 
server/src/main/java/org/apache/iotdb/db/qp/executor/AbstractQueryProcessExecutor.java
 ##########
 @@ -57,11 +67,44 @@ public QueryDataSet processQuery(PhysicalPlan queryPlan, 
QueryContext context)
       return processDataQuery((QueryPlan) queryPlan, context);
     } else if (queryPlan instanceof AuthorPlan) {
       return processAuthorQuery((AuthorPlan) queryPlan, context);
+    } else if(queryPlan instanceof ShowTTLPlan) {
+      return processShowTTLQuery((ShowTTLPlan) queryPlan);
     } else {
       throw new ProcessorException(String.format("Unrecognized query plan %s", 
queryPlan));
     }
   }
 
+  private QueryDataSet processShowTTLQuery(ShowTTLPlan showTTLPlan) {
+    List<Path> paths = new ArrayList<>();
+    paths.add(new Path(STORAGE_GROUP));
+    paths.add(new Path(TTL));
+    List<TSDataType> dataTypes = new ArrayList<>();
+    dataTypes.add(TSDataType.TEXT);
+    dataTypes.add(TSDataType.INT64);
+    ListDataSet listDataSet = new ListDataSet(paths, dataTypes);
+
+    List<String> selectedSgs = showTTLPlan.getStorageGroups();
+
+    List<MNode> storageGroups = MManager.getInstance().getAllStorageGroups();
+    int i = 0;
+    for (MNode mNode : storageGroups) {
+      String sgName = mNode.getFullPath();
+      if (!selectedSgs.isEmpty() && !selectedSgs.contains(sgName)) {
+        continue;
+      }
 
 Review comment:
   I do not know if I got your point. If `selectedSgs.isEmpty()` holds, it 
means show all storage groups and I should only test the `sgName` when it is 
non-empty. If I move it outside, show all TTL will result in an empty result 
set.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to