JackieTien97 commented on code in PR #12446:
URL: https://github.com/apache/iotdb/pull/12446#discussion_r1597324119
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/TimeseriesRegionScanNode.java:
##########
@@ -31,25 +33,37 @@
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanVisitor;
import com.google.common.collect.ImmutableList;
+import org.apache.tsfile.file.metadata.PlainDeviceID;
import org.apache.tsfile.utils.ReadWriteIOUtils;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
public class TimeseriesRegionScanNode extends RegionScanNode {
- private Map<PartialPath, TimeseriesSchemaInfo> timeseriesToSchemaInfo;
+ // DevicePath -> (MeasurementPath -> TimeseriesSchemaInfo), it will be
serialized to
+ // timeseriesToSchemaInfo in the end
+ Map<PartialPath, Map<PartialPath, List<TimeseriesSchemaInfo>>>
deviceToTimeseriesSchemaInfo;
Review Comment:
add private
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/TimeseriesRegionScanNode.java:
##########
@@ -101,28 +132,57 @@ public int allowedChildCount() {
public static PlanNode deserialize(ByteBuffer buffer) {
Review Comment:
Does this deserialize method match the serialize method??
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/TimeseriesRegionScanNode.java:
##########
@@ -31,25 +33,37 @@
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanVisitor;
import com.google.common.collect.ImmutableList;
+import org.apache.tsfile.file.metadata.PlainDeviceID;
import org.apache.tsfile.utils.ReadWriteIOUtils;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
public class TimeseriesRegionScanNode extends RegionScanNode {
- private Map<PartialPath, TimeseriesSchemaInfo> timeseriesToSchemaInfo;
+ // DevicePath -> (MeasurementPath -> TimeseriesSchemaInfo), it will be
serialized to
+ // timeseriesToSchemaInfo in the end
+ Map<PartialPath, Map<PartialPath, List<TimeseriesSchemaInfo>>>
deviceToTimeseriesSchemaInfo;
Review Comment:
what if we don't call serialize and deserialize method in which case that
DataRegion is in current node and we directly pass this object.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/TimeseriesRegionScanNode.java:
##########
@@ -101,28 +132,57 @@ public int allowedChildCount() {
public static PlanNode deserialize(ByteBuffer buffer) {
int size = ReadWriteIOUtils.readInt(buffer);
- Map<PartialPath, TimeseriesSchemaInfo> timeseriesToSchemaInfo = new
HashMap<>();
+ Map<PartialPath, List<TimeseriesSchemaInfo>> timeseriesToSchemaInfo = new
HashMap<>();
for (int i = 0; i < size; i++) {
PartialPath path = PartialPath.deserialize(buffer);
- TimeseriesSchemaInfo timeseriesSchemaInfo =
TimeseriesSchemaInfo.deserialize(buffer);
- timeseriesToSchemaInfo.put(path, timeseriesSchemaInfo);
+ List<TimeseriesSchemaInfo> timeseriesSchemaInfos = new ArrayList<>();
+ int schemaSize = ReadWriteIOUtils.readInt(buffer);
+ for (int j = 0; j < schemaSize; j++) {
+ timeseriesSchemaInfos.add(TimeseriesSchemaInfo.deserialize(buffer));
+ }
+ timeseriesToSchemaInfo.put(path, timeseriesSchemaInfos);
}
boolean outputCount = ReadWriteIOUtils.readBool(buffer);
return new TimeseriesRegionScanNode(null, timeseriesToSchemaInfo,
outputCount, null);
}
@TestOnly
- public List<PartialPath> getMeasurementPath() {
+ public List<PartialPath> getMeasurementPath() throws IllegalPathException {
+ if (deviceToTimeseriesSchemaInfo != null) {
+ List<PartialPath> partialPaths = new ArrayList<>();
+ for (PartialPath path :
+ deviceToTimeseriesSchemaInfo.values().stream()
+ .map(Map::keySet)
+ .flatMap(Set::stream)
+ .collect(Collectors.toList())) {
+ if (path instanceof AlignedPath) {
+ for (String measurementName : ((AlignedPath)
path).getMeasurementList()) {
+ partialPaths.add(new PartialPath(new
PlainDeviceID(path.getDevice()), measurementName));
+ }
+ } else {
+ partialPaths.add(path);
+ }
+ }
+ return partialPaths;
+ }
Review Comment:
What we really need about this function?
--
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]