You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2021/07/03 09:12:44 UTC

[iotdb] branch nowBug updated (d3615e7 -> aabbaf2)

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

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


 discard d3615e7  fix now() bug
    omit 366cde1  Fix format
    omit 5bb1d10  Merge branch 'master' of https://github.com/apache/iotdb into session-manager
    omit 1c57569  Change timeout
    omit df6fc89  Change timeout
    omit f57aa88  Bug fix
    omit 14fcfbc  Merge branch 'master' of https://github.com/apache/iotdb into session-manager
    omit 2fb73b3  Add session timeout
    omit 5f997cf  Use helper pattern
    omit ee97e5c  Fix bug
    omit c983be1  Fix diff
    omit 598c560  Merge branch 'master' of https://github.com/apache/iotdb  # Conflicts: # server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java # server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java # server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
    omit 0f25ac4  Merge branch 'master' of https://github.com/apache/iotdb  # Conflicts: # server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java # server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java # server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
    omit 467fdf9  Merge branch 'master' of https://github.com/apache/iotdb into session-manager
    omit dfb2bd3  Extract out SessionManager
    omit 68508e5  Fix bug
     add 6b5ba69  fix monitor bug (#3459)
     add c83e70b  [ISSUE 3458]fix load configuration(#3487)
     add 8202644  Correct typos in iotdb-env.sh (#3494)
     add 5ed33ac  Fix release note url in Chinese doc (#3495)
     add 81e8949  Vis tool for master (#3473)
     add a3f1358  [IOTDB-1462] fix cross space compaction recover use wrong storage group name bug (#3496)
     new aabbaf2  Fix now() bug

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d3615e7)
            \
             N -- N -- N   refs/heads/nowBug (aabbaf2)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 docs/SystemDesign/TsFile/Format.md                 | 228 ++++++++++++++--
 docs/zh/Download/README.md                         |   4 +-
 docs/zh/SystemDesign/TsFile/Format.md              | 228 ++++++++++++++--
 server/src/assembly/resources/conf/iotdb-env.sh    |   2 +-
 .../print-tsfile-visdata.bat}                      |   4 +-
 ...nt-tsfile-sketch.sh => print-tsfile-visdata.sh} |   2 +-
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java |  11 -
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  |  35 +--
 .../iotdb/db/cost/statistic/Measurement.java       |   4 +-
 .../engine/storagegroup/StorageGroupProcessor.java |   2 +-
 .../org/apache/iotdb/db/monitor/StatMonitor.java   |   4 +-
 .../iotdb/db/query/control/QueryTimeManager.java   |   3 -
 .../iotdb/db/query/control/SessionManager.java     |  14 -
 .../db/query/control/SessionTimeoutManager.java    | 127 ---------
 .../org/apache/iotdb/db/service/TSServiceImpl.java |   6 -
 .../iotdb/db/tools/vis/TsFileExtractVisdata.java   | 170 ++++++++++++
 .../main/java/org/apache/iotdb/db/tools/vis/vis.m  | 290 +++++++++++++++++++++
 .../iotdb/db/integration/IoTDBGroupByMonthIT.java  |   8 +
 18 files changed, 902 insertions(+), 240 deletions(-)
 copy server/src/assembly/resources/tools/{mlog/mLogParser.bat => tsfileToolSet/print-tsfile-visdata.bat} (95%)
 copy server/src/assembly/resources/tools/tsfileToolSet/{print-tsfile-sketch.sh => print-tsfile-visdata.sh} (95%)
 mode change 100755 => 100644
 delete mode 100644 server/src/main/java/org/apache/iotdb/db/query/control/SessionTimeoutManager.java
 create mode 100644 server/src/main/java/org/apache/iotdb/db/tools/vis/TsFileExtractVisdata.java
 create mode 100644 server/src/main/java/org/apache/iotdb/db/tools/vis/vis.m

[iotdb] 01/01: Fix now() bug

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

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

commit aabbaf2b08292207b422b5cf12ff7f7eff6eb9fb
Author: Alima777 <wx...@gmail.com>
AuthorDate: Sat Jul 3 17:12:11 2021 +0800

    Fix now() bug
---
 .../apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java    | 41 +++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
index cd2dfe3..737423b 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
@@ -1832,19 +1832,20 @@ public class IoTDBSqlVisitor extends SqlBaseBaseVisitor<Operator> {
       TimeIntervalContext timeInterval, GroupByClauseComponent groupByClauseComponent) {
     long startTime;
     long endTime;
+    long currentTime = DatetimeUtils.currentTime();
     if (timeInterval.timeValue(0).INT() != null) {
       startTime = Long.parseLong(timeInterval.timeValue(0).INT().getText());
     } else if (timeInterval.timeValue(0).dateExpression() != null) {
-      startTime = parseDateExpression(timeInterval.timeValue(0).dateExpression());
+      startTime = parseDateExpression(timeInterval.timeValue(0).dateExpression(), currentTime);
     } else {
-      startTime = parseTimeFormat(timeInterval.timeValue(0).dateFormat().getText());
+      startTime = parseTimeFormat(timeInterval.timeValue(0).dateFormat().getText(), currentTime);
     }
     if (timeInterval.timeValue(1).INT() != null) {
       endTime = Long.parseLong(timeInterval.timeValue(1).INT().getText());
     } else if (timeInterval.timeValue(1).dateExpression() != null) {
-      endTime = parseDateExpression(timeInterval.timeValue(1).dateExpression());
+      endTime = parseDateExpression(timeInterval.timeValue(1).dateExpression(), currentTime);
     } else {
-      endTime = parseTimeFormat(timeInterval.timeValue(1).dateFormat().getText());
+      endTime = parseTimeFormat(timeInterval.timeValue(1).dateFormat().getText(), currentTime);
     }
 
     groupByClauseComponent.setStartTime(startTime);
@@ -2071,6 +2072,19 @@ public class IoTDBSqlVisitor extends SqlBaseBaseVisitor<Operator> {
     return time;
   }
 
+  private Long parseDateExpression(DateExpressionContext ctx, long currentTime) {
+    long time;
+    time = parseTimeFormat(ctx.getChild(0).getText(), currentTime);
+    for (int i = 1; i < ctx.getChildCount(); i = i + 2) {
+      if (ctx.getChild(i).getText().equals("+")) {
+        time += DatetimeUtils.convertDurationStrToLong(time, ctx.getChild(i + 1).getText());
+      } else {
+        time -= DatetimeUtils.convertDurationStrToLong(time, ctx.getChild(i + 1).getText());
+      }
+    }
+    return time;
+  }
+
   /**
    * parse time unit or sliding step in group by query.
    *
@@ -2322,4 +2336,23 @@ public class IoTDBSqlVisitor extends SqlBaseBaseVisitor<Operator> {
               timestampStr));
     }
   }
+
+  public long parseTimeFormat(String timestampStr, long currentTime) throws SQLParserException {
+    if (timestampStr == null || timestampStr.trim().equals("")) {
+      throw new SQLParserException("input timestamp cannot be empty");
+    }
+    if (timestampStr.equalsIgnoreCase(SQLConstant.NOW_FUNC)) {
+      return currentTime;
+    }
+    try {
+      return DatetimeUtils.convertDatetimeStrToLong(timestampStr, zoneId);
+    } catch (Exception e) {
+      throw new SQLParserException(
+          String.format(
+              "Input time format %s error. "
+                  + "Input like yyyy-MM-dd HH:mm:ss, yyyy-MM-ddTHH:mm:ss or "
+                  + "refer to user document for more info.",
+              timestampStr));
+    }
+  }
 }