You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/06/22 15:05:36 UTC

[iotdb] branch QueryPerformace updated (a67982a11d -> 1acd200a77)

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

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


    from a67982a11d Extreme performace
     new 5760964351 remove from loop
     new 1acd200a77 fix descendingAggregations

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:
 .../apache/iotdb/db/mpp/aggregation/CountAccumulator.java   |  7 +++++--
 .../iotdb/db/mpp/plan/planner/LogicalPlanBuilder.java       |  2 +-
 .../iotdb/db/mpp/plan/statement/component/OrderBy.java      | 13 ++++++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)


[iotdb] 02/02: fix descendingAggregations

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

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

commit 1acd200a77d9aeefe3f2430358c8efdb67583ed2
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Wed Jun 22 22:44:18 2022 +0800

    fix descendingAggregations
---
 .../iotdb/db/mpp/plan/planner/LogicalPlanBuilder.java       |  2 +-
 .../iotdb/db/mpp/plan/statement/component/OrderBy.java      | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LogicalPlanBuilder.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LogicalPlanBuilder.java
index 3f0eed38de..5a9dbd4dac 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LogicalPlanBuilder.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LogicalPlanBuilder.java
@@ -325,7 +325,7 @@ public class LogicalPlanBuilder {
             createAggregationScanNode(
                 pathAggregationsEntry.getKey(),
                 pathAggregationsEntry.getValue(),
-                scanOrder,
+                scanOrder.reverse(),
                 null,
                 timeFilter));
       }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/OrderBy.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/OrderBy.java
index 87ccef0959..e72029b7d4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/OrderBy.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/OrderBy.java
@@ -24,5 +24,16 @@ public enum OrderBy {
   TIMESTAMP_ASC,
   TIMESTAMP_DESC,
   DEVICE_ASC,
-  DEVICE_DESC
+  DEVICE_DESC;
+
+  public OrderBy reverse() {
+    switch (this) {
+      case TIMESTAMP_ASC:
+        return TIMESTAMP_DESC;
+      case TIMESTAMP_DESC:
+        return TIMESTAMP_ASC;
+      default:
+        throw new UnsupportedOperationException();
+    }
+  }
 }


[iotdb] 01/02: remove from loop

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

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

commit 576096435181c590196ec92cc3fd14bf1bebf0e1
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Wed Jun 22 22:43:58 2022 +0800

    remove from loop
---
 .../java/org/apache/iotdb/db/mpp/aggregation/CountAccumulator.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/CountAccumulator.java b/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/CountAccumulator.java
index 3ca44f049a..0686cae449 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/CountAccumulator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/CountAccumulator.java
@@ -44,9 +44,12 @@ public class CountAccumulator implements Accumulator {
     if (!valueColumn.mayHaveNull() && timeRange.contains(minTime, maxTime)) {
       countValue += timeColumn.getPositionCount();
     } else {
-      for (int i = 0; i < timeColumn.getPositionCount(); i++) {
+      int curPositionCount = timeColumn.getPositionCount();
+      long curMinTime = timeRange.getMin();
+      long curMaxTime = timeRange.getMax();
+      for (int i = 0; i < curPositionCount; i++) {
         long curTime = timeColumn.getLong(i);
-        if (curTime > timeRange.getMax() || curTime < timeRange.getMin()) {
+        if (curTime > curMaxTime || curTime < curMinTime) {
           return i;
         }
         if (!valueColumn.isNull(i)) {