You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/11/27 08:50:10 UTC
[iotdb] 02/03: abs(extreme) && apply ns when executing select-into
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch xianyi
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2dafd3225977e644ce41081538843f914a004b51
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Sat Nov 27 16:44:20 2021 +0800
abs(extreme) && apply ns when executing select-into
---
.../db/query/aggregation/impl/ExtremeAggrResult.java | 20 +++++++++++++++++++-
.../org/apache/iotdb/db/service/TSServiceImpl.java | 4 ++--
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/query/aggregation/impl/ExtremeAggrResult.java b/server/src/main/java/org/apache/iotdb/db/query/aggregation/impl/ExtremeAggrResult.java
index 144fe00..de3a894 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/aggregation/impl/ExtremeAggrResult.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/aggregation/impl/ExtremeAggrResult.java
@@ -77,7 +77,25 @@ public class ExtremeAggrResult extends AggregateResult {
@Override
public Object getResult() {
- return hasCandidateResult() ? getValue() : null;
+ if (hasCandidateResult()) {
+ Object object = getValue();
+ switch (resultDataType) {
+ case BOOLEAN:
+ case TEXT:
+ return object;
+ case DOUBLE:
+ return Math.abs((Double) object);
+ case FLOAT:
+ return Math.abs((Float) object);
+ case INT32:
+ return Math.abs((Integer) object);
+ case INT64:
+ return Math.abs((Long) object);
+ default:
+ throw new UnSupportedDataTypeException(String.valueOf(resultDataType));
+ }
+ }
+ return null;
}
@Override
diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index acca49e..db1a882 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -1033,7 +1033,7 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
andFilter.setRight(filter);
}
- final long dayTimeDelta = 24 * 60 * 60 * 1000;
+ final long dayTimeDelta = 24L * 60 * 60 * 1000 * 1000 * 1000;
long left = 0, right = 0;
if (andFilter.getLeft() instanceof Gt) {
@@ -1098,7 +1098,7 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
andFilter.setRight(filter);
}
- final long dayTimeDelta = 24 * 60 * 60 * 1000;
+ final long dayTimeDelta = 24L * 60 * 60 * 1000 * 1000 * 1000;
if (andFilter.getLeft() instanceof Gt && andFilter.getRight() instanceof Lt) {
long left = (Long) ((Gt) andFilter.getLeft()).getValue();