jt2594838 commented on code in PR #17225:
URL: https://github.com/apache/iotdb/pull/17225#discussion_r2928481387


##########
example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java:
##########
@@ -149,11 +146,13 @@ private static void dataSubscription1() throws Exception {
           }
         }
         for (final SubscriptionMessage message : messages) {
-          for (final SubscriptionSessionDataSet dataSet : 
message.getSessionDataSetsHandler()) {
-            System.out.println(dataSet.getColumnNames());
-            System.out.println(dataSet.getColumnTypes());
-            while (dataSet.hasNext()) {
-              System.out.println(dataSet.next());
+          for (final ResultSet dataSet : message.getRecords()) {

Review Comment:
   getRecords -> getResultSets
   



##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/payload/SubscriptionRecordHandler.java:
##########
@@ -0,0 +1,392 @@
+/*
+ * 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.session.subscription.payload;
+
+import org.apache.iotdb.rpc.subscription.annotation.TableModel;
+
+import org.apache.thrift.annotation.Nullable;
+import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.read.common.Field;
+import org.apache.tsfile.read.common.RowRecord;
+import org.apache.tsfile.read.query.dataset.AbstractResultSet;
+import org.apache.tsfile.read.query.dataset.ResultSet;
+import org.apache.tsfile.utils.Binary;
+import org.apache.tsfile.utils.BitMap;
+import org.apache.tsfile.utils.DateUtils;
+import org.apache.tsfile.write.UnSupportedDataTypeException;
+import org.apache.tsfile.write.record.TSRecord;
+import org.apache.tsfile.write.record.Tablet;
+import org.apache.tsfile.write.schema.IMeasurementSchema;
+
+import java.io.IOException;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class SubscriptionRecordHandler implements Iterable<ResultSet>, 
SubscriptionMessageHandler {
+
+  private final List<ResultSet> records;
+
+  public SubscriptionRecordHandler(final Map<String, List<Tablet>> tablets) {
+    final List<ResultSet> records = new ArrayList<>();
+    for (final Map.Entry<String, List<Tablet>> entry : tablets.entrySet()) {
+      final String databaseName = entry.getKey();
+      final List<Tablet> tabletList = entry.getValue();
+      if (Objects.isNull(tabletList)) {
+        continue;
+      }
+      for (final Tablet tablet : tabletList) {
+        if (Objects.isNull(tablet)) {
+          continue;
+        }
+        records.add(new SubscriptionRecord(tablet, databaseName));
+      }
+    }
+    this.records = Collections.unmodifiableList(records);
+  }
+
+  public List<ResultSet> getRecords() {
+    return records;
+  }
+
+  @Override
+  public Iterator<ResultSet> iterator() {
+    return records.iterator();
+  }
+
+  public static class SubscriptionRecord extends AbstractResultSet {

Review Comment:
   SubscriptionRecord -> SubscriptionResultSet



##########
example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java:
##########
@@ -210,17 +209,8 @@ private static void dataSubscription2() throws Exception {
                       }
                     }
                     for (final SubscriptionMessage message : messages) {
-                      try (final TsFileReader reader = 
message.getTsFileHandler().openReader()) {
-                        final QueryDataSet dataSet =
-                            reader.query(
-                                QueryExpression.create(
-                                    Arrays.asList(
-                                        new Path("root.db.d2", "s2", true),
-                                        new Path("root.sg.d3", "s1", true)),
-                                    null));
-                        while (dataSet.hasNext()) {
-                          System.out.println(dataSet.next());
-                        }
+                      try (final ITsFileTreeReader reader = 
message.getTsFile().openReader()) {
+                        reader.getAllDeviceIds().forEach(System.out::println);
                       }

Review Comment:
   openReader -> openTreeReader, and also add openTableReader?



##########
integration-test/src/test/java/org/apache/iotdb/subscription/it/local/IoTDBSubscriptionBasicIT.java:
##########
@@ -470,7 +478,8 @@ public void testTsFileDeduplication() {
             .consumeListener(
                 message -> {
                   onReceiveCount.getAndIncrement();
-                  try (final TsFileReader tsFileReader = 
message.getTsFileHandler().openReader()) {
+                  try (final TsFileReader tsFileReader =
+                      (TsFileReader) message.getTsFile().openReader()) {

Review Comment:
   TsFileReader is an inner implementation, better not to use it.



##########
integration-test/src/test/java/org/apache/iotdb/subscription/it/cluster/IoTDBSubscriptionRestartIT.java:
##########
@@ -202,10 +202,17 @@ public void testSubscriptionAfterRestartCluster() throws 
Exception {
                     continue;
                   }
                   for (final SubscriptionMessage message : messages) {
-                    for (final SubscriptionSessionDataSet dataSet :
-                        message.getSessionDataSetsHandler()) {
-                      while (dataSet.hasNext()) {
-                        final long timestamp = dataSet.next().getTimestamp();
+                    for (final ResultSet dataSet : message.getRecords()) {
+                      while (((org.apache.iotdb.session.subscription.payload
+                                  
.SubscriptionRecordHandler.SubscriptionRecord)

Review Comment:
   Do not use the full name, check all places



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