Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,30 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
// Don't call super.equals() to avoid order-sensitive children comparison
FullOuterTimeJoinNode that = (FullOuterTimeJoinNode) o;
// For FullOuterTimeJoinNode, the order of children doesn't matter semantically
// since all children are merged based on timestamps. Compare children as sets.
if (mergeOrder != that.mergeOrder
|| !Objects.equals(this.getPlanNodeId(), that.getPlanNodeId())
|| this.children.size() != that.children.size()) {
return false;
}
FullOuterTimeJoinNode that = (FullOuterTimeJoinNode) o;
return mergeOrder == that.mergeOrder;
// Compare children in an order-independent way by checking if each child in this
// has a corresponding equal child in that
for (PlanNode child : this.children) {
boolean found = false;
for (PlanNode thatChild : that.children) {
if (Objects.equals(child, thatChild)) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -295,7 +294,7 @@ public void testPushDownAggregationSourceAlignByDevice() {

List<String> outputColumnNames = Arrays.asList("Device", "__endTime", "count(s1)");
List<String> devices = Arrays.asList("root.sg.d1", "root.sg.d2.a");
Map<String, List<Integer>> deviceToMeasurementIndexesMap = new HashMap<>();
Map<String, List<Integer>> deviceToMeasurementIndexesMap = new LinkedHashMap<>();
deviceToMeasurementIndexesMap.put("root.sg.d1", Arrays.asList(1, 2));
deviceToMeasurementIndexesMap.put("root.sg.d2.a", Arrays.asList(1, 2));

Expand Down Expand Up @@ -373,7 +372,7 @@ public void testPushDownSlidingWindowAlignByDevice() {

List<String> outputColumnNames = Arrays.asList("Device", "__endTime", "count(s1)");
List<String> devices = Arrays.asList("root.sg.d1", "root.sg.d2.a");
Map<String, List<Integer>> deviceToMeasurementIndexesMap = new HashMap<>();
Map<String, List<Integer>> deviceToMeasurementIndexesMap = new LinkedHashMap<>();
deviceToMeasurementIndexesMap.put("root.sg.d1", Arrays.asList(1, 2));
deviceToMeasurementIndexesMap.put("root.sg.d2.a", Arrays.asList(1, 2));

Expand Down Expand Up @@ -453,7 +452,7 @@ public void testPushDownRawDataAggregationAlignByDevice() {

List<String> outputColumnNames = Arrays.asList("Device", "__endTime", "count(s1)");
List<String> devices = Arrays.asList("root.sg.d1", "root.sg.d2.a");
Map<String, List<Integer>> deviceToMeasurementIndexesMap = new HashMap<>();
Map<String, List<Integer>> deviceToMeasurementIndexesMap = new LinkedHashMap<>();
deviceToMeasurementIndexesMap.put("root.sg.d1", Arrays.asList(1, 2));
deviceToMeasurementIndexesMap.put("root.sg.d2.a", Arrays.asList(1, 2));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -54,7 +54,7 @@ private OptimizationTestUtil() {
// util class
}

public static final Map<String, PartialPath> schemaMap = new HashMap<>();
public static final Map<String, PartialPath> schemaMap = new LinkedHashMap<>();

static {
try {
Expand Down Expand Up @@ -159,6 +159,6 @@ public static AggregationDescriptor getAggregationDescriptor(AggregationStep ste
TAggregationType.COUNT.name().toLowerCase(),
step,
Collections.singletonList(new TimeSeriesOperand(schemaMap.get(path))),
new HashMap<>());
new LinkedHashMap<>());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -353,7 +353,7 @@ public TestPlanBuilder fill(String id, String intValue) {

public TestPlanBuilder singleDeviceView(String id, String device, String measurement) {
IDeviceID deviceID = IDeviceID.Factory.DEFAULT_FACTORY.create(device);
Map<IDeviceID, List<Integer>> deviceToMeasurementIndexesMap = new HashMap<>();
Map<IDeviceID, List<Integer>> deviceToMeasurementIndexesMap = new LinkedHashMap<>();
deviceToMeasurementIndexesMap.put(deviceID, Collections.singletonList(1));
DeviceViewNode deviceViewNode =
new DeviceViewNode(
Expand Down Expand Up @@ -389,7 +389,7 @@ public TestPlanBuilder topK(
public TestPlanBuilder singleOrderedDeviceView(
String id, String device, OrderByParameter orderByParameter, String... measurement) {
IDeviceID deviceID = IDeviceID.Factory.DEFAULT_FACTORY.create(device);
Map<IDeviceID, List<Integer>> deviceToMeasurementIndexesMap = new HashMap<>();
Map<IDeviceID, List<Integer>> deviceToMeasurementIndexesMap = new LinkedHashMap<>();
deviceToMeasurementIndexesMap.put(
deviceID, measurement.length == 1 ? Collections.singletonList(1) : Arrays.asList(1, 2));
DeviceViewNode deviceViewNode =
Expand Down Expand Up @@ -456,7 +456,7 @@ public TestPlanBuilder deviceView(
List<String> devices,
Map<String, List<Integer>> deviceToMeasurementIndexesMap,
List<PlanNode> children) {
Map<IDeviceID, List<Integer>> map = new HashMap<>();
Map<IDeviceID, List<Integer>> map = new LinkedHashMap<>();
deviceToMeasurementIndexesMap.forEach(
(key, value) -> map.put(IDeviceID.Factory.DEFAULT_FACTORY.create(key), value));
DeviceViewNode deviceViewNode =
Expand Down