This is an automated email from the ASF dual-hosted git repository.
jackietien 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 f52beecbde Add input location for TimeJoinNode (#5585)
f52beecbde is described below
commit f52beecbde687f4cd1d8b56cbd73b4be6eeee507
Author: Jackie Tien <[email protected]>
AuthorDate: Tue Apr 19 17:16:40 2022 +0800
Add input location for TimeJoinNode (#5585)
---
.../db/mpp/sql/planner/plan/InputLocation.java | 39 +++++++++++++++
.../db/mpp/sql/planner/plan/OutputColumn.java | 55 ++++++++++++++++++++++
.../planner/plan/node/process/TimeJoinNode.java | 10 ++++
3 files changed, 104 insertions(+)
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/InputLocation.java
b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/InputLocation.java
new file mode 100644
index 0000000000..705d8cbace
--- /dev/null
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/InputLocation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.mpp.sql.planner.plan;
+
+public class InputLocation {
+ // which input tsblock
+ private final int tsBlockIndex;
+ // which value column of that tsblock
+ private final int valueColumnIndex;
+
+ public InputLocation(int tsBlockIndex, int valueColumnIndex) {
+ this.tsBlockIndex = tsBlockIndex;
+ this.valueColumnIndex = valueColumnIndex;
+ }
+
+ public int getTsBlockIndex() {
+ return tsBlockIndex;
+ }
+
+ public int getValueColumnIndex() {
+ return valueColumnIndex;
+ }
+}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/OutputColumn.java
b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/OutputColumn.java
new file mode 100644
index 0000000000..2596619166
--- /dev/null
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/OutputColumn.java
@@ -0,0 +1,55 @@
+/*
+ * 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.mpp.sql.planner.plan;
+
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+public class OutputColumn {
+
+ // indicate this output column should use which value column of which input
TsBlock
+ // if overlapped is false, the order in sourceLocations should be in
ascending timestamp order
+ private final List<InputLocation> sourceLocations;
+
+ // if overlapped is true, it means that sourceLocations.size() > 1 and input
locations in
+ // sourceLocations are overlapped
+ // it will only happen when we do the load balance and more than one
DataRegion is assigned to one
+ // time partition
+ private final boolean overlapped;
+
+ /** used for case that this OutputColumn only has one input column */
+ public OutputColumn(InputLocation inputLocation) {
+ this.sourceLocations = ImmutableList.of(inputLocation);
+ this.overlapped = false;
+ }
+
+ public OutputColumn(List<InputLocation> sourceLocations, boolean overlapped)
{
+ this.sourceLocations = sourceLocations;
+ this.overlapped = overlapped;
+ }
+
+ public List<InputLocation> getSourceLocations() {
+ return sourceLocations;
+ }
+
+ public boolean isOverlapped() {
+ return overlapped;
+ }
+}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/process/TimeJoinNode.java
b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/process/TimeJoinNode.java
index fdda60a311..c4bf1ead41 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/process/TimeJoinNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/process/TimeJoinNode.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.db.mpp.sql.planner.plan.node.process;
import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.db.mpp.common.header.ColumnHeader;
import org.apache.iotdb.db.mpp.sql.planner.plan.IOutputPlanNode;
+import org.apache.iotdb.db.mpp.sql.planner.plan.OutputColumn;
import org.apache.iotdb.db.mpp.sql.planner.plan.node.PlanNode;
import org.apache.iotdb.db.mpp.sql.planner.plan.node.PlanNodeId;
import org.apache.iotdb.db.mpp.sql.planner.plan.node.PlanNodeType;
@@ -58,6 +59,11 @@ public class TimeJoinNode extends ProcessNode implements
IOutputPlanNode {
private List<ColumnHeader> columnHeaders = new ArrayList<>();
+ // indicate each output column should use which value column of which input
TsBlock and the
+ // overlapped situation
+ // size of outputColumns must be equal to the size of columnHeaders
+ private List<OutputColumn> outputColumns = new ArrayList<>();
+
public TimeJoinNode(PlanNodeId id, OrderBy mergeOrder) {
super(id);
this.mergeOrder = mergeOrder;
@@ -125,6 +131,10 @@ public class TimeJoinNode extends ProcessNode implements
IOutputPlanNode {
}
}
+ public List<OutputColumn> getOutputColumns() {
+ return outputColumns;
+ }
+
public static TimeJoinNode deserialize(ByteBuffer byteBuffer) {
OrderBy orderBy = OrderBy.values()[ReadWriteIOUtils.readInt(byteBuffer)];
FilterNullPolicy filterNullPolicy =