You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/08/06 07:22:22 UTC

[iotdb] branch ty/FastLastQueryBug1.2 created (now d7e94004c8f)

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

jackietien pushed a change to branch ty/FastLastQueryBug1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at d7e94004c8f Stop generating FilterExpression if we don't specify the time filter in last query session api

This branch includes the following new commits:

     new d7e94004c8f Stop generating FilterExpression if we don't specify the time filter in last query session api

The 1 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.



[iotdb] 01/01: Stop generating FilterExpression if we don't specify the time filter in last query session api

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

jackietien pushed a commit to branch ty/FastLastQueryBug1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d7e94004c8f7233d27271d33fde7f42c2aa13e1e
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Sun Aug 6 15:08:26 2023 +0800

    Stop generating FilterExpression if we don't specify the time filter in last query session api
---
 .../protocol/thrift/impl/ClientRPCServiceImpl.java  |  2 +-
 .../queryengine/plan/parser/StatementGenerator.java | 21 ++++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
index a13f54c5d8f..06d2505dcac 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
@@ -952,7 +952,7 @@ public class ClientRPCServiceImpl implements IClientRPCServiceWithHandler {
       paths.add(req.deviceId + "." + sensor);
     }
     TSLastDataQueryReq tsLastDataQueryReq =
-        new TSLastDataQueryReq(req.sessionId, paths, 0, req.statementId);
+        new TSLastDataQueryReq(req.sessionId, paths, Long.MIN_VALUE, req.statementId);
     tsLastDataQueryReq.setFetchSize(req.fetchSize);
     tsLastDataQueryReq.setEnableRedirectQuery(req.enableRedirectQuery);
     tsLastDataQueryReq.setLegalPathNodes(req.legalPathNodes);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
index 8a2e98d3be2..74cb4fb8aa2 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
@@ -197,18 +197,21 @@ public class StatementGenerator {
         new ResultColumn(
             new TimeSeriesOperand(new PartialPath("", false)), ResultColumn.ColumnType.RAW));
 
-    // set query filter
-    WhereCondition whereCondition = new WhereCondition();
-    GreaterEqualExpression predicate =
-        new GreaterEqualExpression(
-            new TimestampOperand(),
-            new ConstantOperand(TSDataType.INT64, Long.toString(lastDataQueryReq.getTime())));
-    whereCondition.setPredicate(predicate);
-
     QueryStatement lastQueryStatement = new QueryStatement();
+
+    if (lastDataQueryReq.getTime() != Long.MIN_VALUE) {
+      // set query filter
+      WhereCondition whereCondition = new WhereCondition();
+      GreaterEqualExpression predicate =
+          new GreaterEqualExpression(
+              new TimestampOperand(),
+              new ConstantOperand(TSDataType.INT64, Long.toString(lastDataQueryReq.getTime())));
+      whereCondition.setPredicate(predicate);
+      lastQueryStatement.setWhereCondition(whereCondition);
+    }
+
     lastQueryStatement.setSelectComponent(selectComponent);
     lastQueryStatement.setFromComponent(fromComponent);
-    lastQueryStatement.setWhereCondition(whereCondition);
     PERFORMANCE_OVERVIEW_METRICS.recordParseCost(System.nanoTime() - startTime);
 
     return lastQueryStatement;