You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2024/10/16 10:39:43 UTC

(iotdb) branch last_first_table_model updated (d1044b25ecc -> 97ccc28a359)

This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a change to branch last_first_table_model
in repository https://gitbox.apache.org/repos/asf/iotdb.git


    from d1044b25ecc support last
     new a35ee92323e tmp
     new 97ccc28a359 tmp

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../TableAggregationTableScanOperator.java         |  2 ++
 .../relational/aggregation/AccumulatorFactory.java |  1 +
 .../relational/aggregation/LastByAccumulator.java} | 40 ++++++++++++----------
 .../plan/planner/TableOperatorGenerator.java       |  4 +--
 4 files changed, 26 insertions(+), 21 deletions(-)
 copy iotdb-core/{consensus/src/test/java/org/apache/iotdb/consensus/EmptyStateMachine.java => datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/LastByAccumulator.java} (55%)


(iotdb) 01/02: tmp

Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a commit to branch last_first_table_model
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit a35ee92323eafb3b4f415a4998233c89fd5f061a
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Wed Oct 16 18:33:58 2024 +0800

    tmp
---
 .../TableAggregationTableScanOperator.java         |  2 +
 .../relational/aggregation/LastByAccumulator.java  | 60 ++++++++++++++++++++++
 .../plan/planner/TableOperatorGenerator.java       |  4 +-
 3 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java
index 96d1d10c37b..51d2272cef1 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java
@@ -430,6 +430,7 @@ public class TableAggregationTableScanOperator extends AbstractSeriesAggregation
 
       aggregator.processBlock(tsBlock);
     }
+
     int lastReadRowIndex = lastIndexToProcess + 1;
     if (lastReadRowIndex >= inputTsBlock.getPositionCount()) {
       return null;
@@ -463,6 +464,7 @@ public class TableAggregationTableScanOperator extends AbstractSeriesAggregation
       if (aggregator.hasFinalResult()) {
         continue;
       }
+
       aggregator.processStatistics(
           columnSchemas.get(layoutArray[i]).getColumnCategory() == TsTableColumnCategory.MEASUREMENT
               ? valueStatistics[columnsIndexArray[i]]
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/LastByAccumulator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/LastByAccumulator.java
new file mode 100644
index 00000000000..c594eca1c74
--- /dev/null
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/LastByAccumulator.java
@@ -0,0 +1,60 @@
+/*
+ * 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.queryengine.execution.operator.source.relational.aggregation;
+
+import org.apache.tsfile.block.column.Column;
+import org.apache.tsfile.block.column.ColumnBuilder;
+import org.apache.tsfile.file.metadata.statistics.Statistics;
+
+public class LastByAccumulator implements TableAccumulator {
+
+  @Override
+  public long getEstimatedSize() {
+    return 0;
+  }
+
+  @Override
+  public TableAccumulator copy() {
+    return null;
+  }
+
+  @Override
+  public void addInput(Column[] arguments) {}
+
+  @Override
+  public void addIntermediate(Column argument) {}
+
+  @Override
+  public void evaluateIntermediate(ColumnBuilder columnBuilder) {}
+
+  @Override
+  public void evaluateFinal(ColumnBuilder columnBuilder) {}
+
+  @Override
+  public boolean hasFinalResult() {
+    return false;
+  }
+
+  @Override
+  public void addStatistics(Statistics statistics) {}
+
+  @Override
+  public void reset() {}
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
index f3c5fac2138..86f89288fb0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
@@ -1402,8 +1402,8 @@ public class TableOperatorGenerator extends PlanVisitor<Operator, LocalExecution
     int[] columnsIndexArray = new int[aggregationsCount];
     List<String> measurementColumnNames = new ArrayList<>();
     List<IMeasurementSchema> measurementSchemas = new ArrayList<>();
+    // List<Integer>
 
-    // TODO test aggregation function which has more than one arguements
     for (Map.Entry<Symbol, AggregationNode.Aggregation> entry : node.getAggregations().entrySet()) {
       idx++;
       Symbol symbol = Symbol.from(entry.getValue().getArguments().get(0));
@@ -1441,7 +1441,7 @@ public class TableOperatorGenerator extends PlanVisitor<Operator, LocalExecution
           break;
         case TIME:
           if (columnLayout.containsKey(symbol)) {
-            columnsIndexArray[idx] = columnsIndexArray[columnLayout.get(symbol)];
+            columnsIndexArray[idx] = -1;
           } else {
             columnsIndexArray[idx] = -1;
             columnSchemas.add(schema);


(iotdb) 02/02: tmp

Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a commit to branch last_first_table_model
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 97ccc28a359193229aed3ba17efad6db794cc6a5
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Wed Oct 16 18:39:28 2024 +0800

    tmp
---
 .../operator/source/relational/aggregation/AccumulatorFactory.java       | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/AccumulatorFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/AccumulatorFactory.java
index 888c096e172..d8f295f9ecd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/AccumulatorFactory.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/AccumulatorFactory.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.Map;
 
 import static com.google.common.base.Preconditions.checkState;
+import static org.apache.iotdb.db.queryengine.plan.relational.metadata.TableBuiltinAggregationFunction.LAST;
 
 public class AccumulatorFactory {