From c2256e94434178378d91eb935e82c1c0258f7712 Mon Sep 17 00:00:00 2001 From: Jinqing Kuang Date: Tue, 3 Dec 2024 19:25:30 +0800 Subject: [PATCH] feat(query)[TS-5058]: support AUTO OFFSET in INTERVAL clause Add the AUTO keyword, which allows automatic determination of the INTERVAL OFFSET based on the WHERE condition. It simplifies usage by allowing users to rely on the system to infer the correct offset without manual specification. --- .../03-taos-sql/12-distinguished.md | 14 + .../03-taos-sql/12-distinguished.md | 14 + include/common/tmsg.h | 17 +- include/common/ttime.h | 4 + include/libs/executor/executor.h | 5 +- include/libs/nodes/plannodes.h | 2 + include/libs/nodes/querynodes.h | 13 +- include/util/taoserror.h | 1 + source/common/src/ttime.c | 47 +- source/libs/command/src/explain.c | 3 + source/libs/executor/src/executil.c | 34 +- .../src/streamintervalsliceoperator.c | 4 +- .../executor/src/streamtimewindowoperator.c | 6 +- source/libs/executor/src/timewindowoperator.c | 12 +- source/libs/nodes/src/nodesCloneFuncs.c | 3 + source/libs/nodes/src/nodesCodeFuncs.c | 42 + source/libs/nodes/src/nodesMsgFuncs.c | 7 +- source/libs/nodes/test/nodesCloneTest.cpp | 4 + source/libs/parser/inc/sql.y | 3 + source/libs/parser/src/parAstCreater.c | 1 + source/libs/parser/src/parTokenizer.c | 1 + source/libs/parser/src/parTranslater.c | 72 +- source/libs/planner/src/planLogicCreater.c | 1 + source/libs/planner/src/planOptimizer.c | 16 +- source/libs/planner/src/planPhysiCreater.c | 1 + source/util/src/terror.c | 1 + tests/army/frame/common.py | 3 +- tests/army/query/function/ans/interval.csv | 1428 +++++++++++++++++ .../query/function/ans/interval_diff_tz.csv | 1380 ++++++++++++++++ tests/army/query/function/in/interval.in | 160 ++ tests/army/query/function/interval.json | 67 + tests/army/query/function/test_interval.py | 79 + .../query/function/test_interval_diff_tz.py | 57 + tests/parallel_test/cases.task | 2 + 34 files changed, 3445 insertions(+), 59 deletions(-) create mode 100644 tests/army/query/function/ans/interval.csv create mode 100644 tests/army/query/function/ans/interval_diff_tz.csv create mode 100644 tests/army/query/function/in/interval.in create mode 100644 tests/army/query/function/interval.json create mode 100644 tests/army/query/function/test_interval.py create mode 100644 tests/army/query/function/test_interval_diff_tz.py diff --git a/docs/en/14-reference/03-taos-sql/12-distinguished.md b/docs/en/14-reference/03-taos-sql/12-distinguished.md index 73440d129a..4c09f140a1 100644 --- a/docs/en/14-reference/03-taos-sql/12-distinguished.md +++ b/docs/en/14-reference/03-taos-sql/12-distinguished.md @@ -130,11 +130,25 @@ The forward sliding time of SLIDING cannot exceed the time range of one window. SELECT COUNT(*) FROM temp_tb_1 INTERVAL(1m) SLIDING(2m); ``` +The INTERVAL clause allows the use of the AUTO keyword to specify the window offset. If the WHERE condition provides a clear applicable start time limit, the required offset will be automatically calculated, dividing the time window from that point; otherwise, it defaults to an offset of 0. Here are some simple examples: + +```sql +-- With a start time limit, divide the time window from '2018-10-03 14:38:05' +SELECT COUNT(*) FROM meters WHERE _rowts >= '2018-10-03 14:38:05' INTERVAL (1m, AUTO); + +-- Without a start time limit, defaults to an offset of 0 +SELECT COUNT(*) FROM meters WHERE _rowts < '2018-10-03 15:00:00' INTERVAL (1m, AUTO); + +-- Unclear start time limit, defaults to an offset of 0 +SELECT COUNT(*) FROM meters WHERE _rowts - voltage > 1000000; +``` + When using time windows, note: - The window width of the aggregation period is specified by the keyword INTERVAL, with the shortest interval being 10 milliseconds (10a); it also supports an offset (the offset must be less than the interval), which is the offset of the time window division compared to "UTC moment 0". The SLIDING statement is used to specify the forward increment of the aggregation period, i.e., the duration of each window slide forward. - When using the INTERVAL statement, unless in very special cases, it is required to configure the timezone parameter in the taos.cfg configuration files of both the client and server to the same value to avoid frequent cross-time zone conversions by time processing functions, which can cause severe performance impacts. - The returned results have a strictly monotonically increasing time-series. +- When using AUTO as the window offset, if the window width unit is d (day), n (month), w (week), y (year), such as: INTERVAL(1d, AUTO), INTERVAL(3w, AUTO), the TSMA optimization cannot take effect. If TSMA is manually created on the target table, the statement will report an error and exit; in this case, you can explicitly specify the Hint SKIP_TSMA or not use AUTO as the window offset. ### State Window diff --git a/docs/zh/14-reference/03-taos-sql/12-distinguished.md b/docs/zh/14-reference/03-taos-sql/12-distinguished.md index d7696b1859..4945e37779 100644 --- a/docs/zh/14-reference/03-taos-sql/12-distinguished.md +++ b/docs/zh/14-reference/03-taos-sql/12-distinguished.md @@ -120,11 +120,25 @@ SLIDING 的向前滑动的时间不能超过一个窗口的时间范围。以下 SELECT COUNT(*) FROM temp_tb_1 INTERVAL(1m) SLIDING(2m); ``` +INTERVAL 子句允许使用 AUTO 关键字来指定窗口偏移量,此时如果 WHERE 条件给定了明确可应用的起始时间限制,则会自动计算所需偏移量,使得从该时间点切分时间窗口;否则不生效,即:仍以 0 作为偏移量。以下是简单示例说明: + +```sql +-- 有起始时间限制,从 '2018-10-03 14:38:05' 切分时间窗口 +SELECT COUNT(*) FROM meters WHERE _rowts >= '2018-10-03 14:38:05' INTERVAL (1m, AUTO); + +-- 无起始时间限制,不生效,仍以 0 为偏移量 +SELECT COUNT(*) FROM meters WHERE _rowts < '2018-10-03 15:00:00' INTERVAL (1m, AUTO); + +-- 起始时间限制不明确,不生效,仍以 0 为偏移量 +SELECT COUNT(*) FROM meters WHERE _rowts - voltage > 1000000; +``` + 使用时间窗口需要注意: - 聚合时间段的窗口宽度由关键词 INTERVAL 指定,最短时间间隔 10 毫秒(10a);并且支持偏移 offset(偏移必须小于间隔),也即时间窗口划分与“UTC 时刻 0”相比的偏移量。SLIDING 语句用于指定聚合时间段的前向增量,也即每次窗口向前滑动的时长。 - 使用 INTERVAL 语句时,除非极特殊的情况,都要求把客户端和服务端的 taos.cfg 配置文件中的 timezone 参数配置为相同的取值,以避免时间处理函数频繁进行跨时区转换而导致的严重性能影响。 - 返回的结果中时间序列严格单调递增。 +- 使用 AUTO 作为窗口偏移量时,如果窗口宽度的单位是 d (天), n (月), w (周), y (年),比如: INTERVAL(1d, AUTO), INTERVAL(3w, AUTO),此时 TSMA 优化无法生效。如果目标表上手动创建了TSMA,语句会报错退出;这种情况下,可以显式指定 Hint SKIP_TSMA 或者不使用 AUTO 作为窗口偏移量。 ### 状态窗口 diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 32973f47af..4db4f1600a 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1242,14 +1242,15 @@ typedef struct { } STsBufInfo; typedef struct { - int32_t tz; // query client timezone - char intervalUnit; - char slidingUnit; - char offsetUnit; - int8_t precision; - int64_t interval; - int64_t sliding; - int64_t offset; + int32_t tz; // query client timezone + char intervalUnit; + char slidingUnit; + char offsetUnit; + int8_t precision; + int64_t interval; + int64_t sliding; + int64_t offset; + STimeWindow timeRange; } SInterval; typedef struct STbVerInfo { diff --git a/include/common/ttime.h b/include/common/ttime.h index 1ffcc29eca..a54f8b2490 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -36,6 +36,9 @@ extern "C" { #define TIME_UNIT_MONTH 'n' #define TIME_UNIT_YEAR 'y' +#define AUTO_DURATION_LITERAL "auto" +#define AUTO_DURATION_VALUE -1 + /* * @return timestamp decided by global conf variable, tsTimePrecision * if precision == TSDB_TIME_PRECISION_MICRO, it returns timestamp in microsecond. @@ -78,6 +81,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision); int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval); int64_t taosTimeGetIntervalEnd(int64_t ts, const SInterval* pInterval); int32_t taosTimeCountIntervalForFill(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision, int32_t order); +void calcIntervalAutoOffset(SInterval* interval); int32_t parseAbsoluteDuration(const char* token, int32_t tokenlen, int64_t* ts, char* unit, int32_t timePrecision); int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision, bool negativeAllow); diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 82cb899cb6..99bf81b08d 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -192,8 +192,9 @@ void qProcessRspMsg(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet); int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, SArray* pExecInfoList); -void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t order); -void getInitialStartTimeWindow(SInterval* pInterval, TSKEY ts, STimeWindow* w, bool ascQuery); +TSKEY getNextTimeWindowStart(const SInterval* pInterval, TSKEY start, int32_t order); +void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t order); +void getInitialStartTimeWindow(SInterval* pInterval, TSKEY ts, STimeWindow* w, bool ascQuery); STimeWindow getAlignQueryTimeWindow(const SInterval* pInterval, int64_t key); SArray* qGetQueriedTableListInfo(qTaskInfo_t tinfo); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 6715e97a21..ad9ac26121 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -319,6 +319,7 @@ typedef struct SWindowLogicNode { int64_t sliding; int8_t intervalUnit; int8_t slidingUnit; + STimeWindow timeRange; int64_t sessionGap; SNode* pTspk; SNode* pTsEnd; @@ -682,6 +683,7 @@ typedef struct SIntervalPhysiNode { int64_t sliding; int8_t intervalUnit; int8_t slidingUnit; + STimeWindow timeRange; } SIntervalPhysiNode; typedef SIntervalPhysiNode SMergeIntervalPhysiNode; diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index d07ac394ea..667d610eab 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -325,12 +325,13 @@ typedef struct SSessionWindowNode { } SSessionWindowNode; typedef struct SIntervalWindowNode { - ENodeType type; // QUERY_NODE_INTERVAL_WINDOW - SNode* pCol; // timestamp primary key - SNode* pInterval; // SValueNode - SNode* pOffset; // SValueNode - SNode* pSliding; // SValueNode - SNode* pFill; + ENodeType type; // QUERY_NODE_INTERVAL_WINDOW + SNode* pCol; // timestamp primary key + SNode* pInterval; // SValueNode + SNode* pOffset; // SValueNode + SNode* pSliding; // SValueNode + SNode* pFill; + STimeWindow timeRange; } SIntervalWindowNode; typedef struct SEventWindowNode { diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 42d4ccf535..5f0d32193e 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -968,6 +968,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_TSMA_MUST_BE_DROPPED TAOS_DEF_ERROR_CODE(0, 0x3110) #define TSDB_CODE_TSMA_NAME_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x3111) #define TSDB_CODE_TSMA_INVALID_RECURSIVE_INTERVAL TAOS_DEF_ERROR_CODE(0, 0x3112) +#define TSDB_CODE_TSMA_INVALID_AUTO_OFFSET TAOS_DEF_ERROR_CODE(0, 0x3113) //rsma #define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150) diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index ecdb3de9a2..b24ded5c0c 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -809,6 +809,7 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) { news += (int64_t)(timezone * TSDB_TICK_PER_SECOND(precision)); } + start = news; if (news <= ts) { int64_t prev = news; int64_t newe = taosTimeAdd(news, pInterval->interval, pInterval->intervalUnit, precision) - 1; @@ -828,7 +829,7 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) { } } - return prev; + start = prev; } } else { int64_t delta = ts - pInterval->interval; @@ -881,8 +882,8 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) { while (newe >= ts) { start = slidingStart; slidingStart = taosTimeAdd(slidingStart, -pInterval->sliding, pInterval->slidingUnit, precision); - int64_t slidingEnd = taosTimeAdd(slidingStart, pInterval->interval, pInterval->intervalUnit, precision) - 1; - newe = taosTimeAdd(slidingEnd, pInterval->offset, pInterval->offsetUnit, precision); + int64_t news = taosTimeAdd(slidingStart, pInterval->offset, pInterval->offsetUnit, precision); + newe = taosTimeAdd(news, pInterval->interval, pInterval->intervalUnit, precision) - 1; } start = taosTimeAdd(start, pInterval->offset, pInterval->offsetUnit, precision); } @@ -892,17 +893,37 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) { // used together with taosTimeTruncate. when offset is great than zero, slide-start/slide-end is the anchor point int64_t taosTimeGetIntervalEnd(int64_t intervalStart, const SInterval* pInterval) { - if (pInterval->offset > 0) { - int64_t slideStart = - taosTimeAdd(intervalStart, -1 * pInterval->offset, pInterval->offsetUnit, pInterval->precision); - int64_t slideEnd = taosTimeAdd(slideStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; - int64_t result = taosTimeAdd(slideEnd, pInterval->offset, pInterval->offsetUnit, pInterval->precision); - return result; - } else { - int64_t result = taosTimeAdd(intervalStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; - return result; - } + return taosTimeAdd(intervalStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; } + +void calcIntervalAutoOffset(SInterval* interval) { + if (!interval || interval->offset != AUTO_DURATION_VALUE) { + return; + } + + interval->offset = 0; + + if (interval->timeRange.skey == INT64_MIN) { + return; + } + + TSKEY skey = interval->timeRange.skey; + TSKEY start = taosTimeTruncate(skey, interval); + TSKEY news = start; + while (news <= skey) { + start = news; + news = taosTimeAdd(start, interval->sliding, interval->slidingUnit, interval->precision); + if (news < start) { + // overflow happens + uError("%s failed and skip, skey [%" PRId64 "], inter[%" PRId64 "(%c)], slid[%" PRId64 "(%c)], precision[%d]", + __func__, skey, interval->interval, interval->intervalUnit, interval->sliding, interval->slidingUnit, + interval->precision); + return; + } + } + interval->offset = skey - start; +} + // internal function, when program is paused in debugger, // one can call this function from debugger to print a // timestamp as human readable string, for example (gdb): diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 13b75f8233..60944d8a02 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -990,6 +990,9 @@ static int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx EXPLAIN_ROW_APPEND_SLIMIT(pIntNode->window.node.pSlimit); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TIMERANGE_FORMAT, pIntNode->timeRange.skey, pIntNode->timeRange.ekey); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); uint8_t precision = qExplainGetIntervalPrecision(pIntNode); int64_t time1 = -1; int64_t time2 = -1; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 732e69ae09..d8ef097ce7 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2289,7 +2289,9 @@ SInterval extractIntervalInfo(const STableScanPhysiNode* pTableScanNode) { .slidingUnit = pTableScanNode->slidingUnit, .offset = pTableScanNode->offset, .precision = pTableScanNode->scan.node.pOutputDataBlockDesc->precision, + .timeRange = pTableScanNode->scanRange, }; + calcIntervalAutoOffset(&interval); return interval; } @@ -2409,13 +2411,14 @@ void getInitialStartTimeWindow(SInterval* pInterval, TSKEY ts, STimeWindow* w, b int64_t key = w->skey; while (key < ts) { // moving towards end - key = taosTimeAdd(key, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); + key = getNextTimeWindowStart(pInterval, key, TSDB_ORDER_ASC); if (key > ts) { break; } w->skey = key; } + w->ekey = taosTimeAdd(w->skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; } } @@ -2428,14 +2431,12 @@ static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) { } STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInterval* pInterval, int32_t order) { - int32_t factor = (order == TSDB_ORDER_ASC) ? -1 : 1; - STimeWindow win = *pWindow; STimeWindow save = win; while (win.skey <= ts && win.ekey >= ts) { save = win; - win.skey = taosTimeAdd(win.skey, factor * pInterval->sliding, pInterval->slidingUnit, pInterval->precision); - win.ekey = taosTimeAdd(win.ekey, factor * pInterval->sliding, pInterval->slidingUnit, pInterval->precision); + // get previous time window + getNextTimeWindow(pInterval, &win, order == TSDB_ORDER_ASC ? TSDB_ORDER_DESC : TSDB_ORDER_ASC); } return save; @@ -2448,7 +2449,6 @@ STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowI STimeWindow w = {0}; if (pResultRowInfo->cur.pageId == -1) { // the first window, from the previous stored value getInitialStartTimeWindow(pInterval, ts, &w, (order == TSDB_ORDER_ASC)); - w.ekey = taosTimeGetIntervalEnd(w.skey, pInterval); return w; } @@ -2471,19 +2471,17 @@ STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowI return w; } -void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t order) { - int64_t slidingStart = 0; - if (pInterval->offset > 0) { - slidingStart = taosTimeAdd(tw->skey, -1 * pInterval->offset, pInterval->offsetUnit, pInterval->precision); - } else { - slidingStart = tw->skey; - } +TSKEY getNextTimeWindowStart(const SInterval* pInterval, TSKEY start, int32_t order) { int32_t factor = GET_FORWARD_DIRECTION_FACTOR(order); - slidingStart = taosTimeAdd(slidingStart, factor * pInterval->sliding, pInterval->slidingUnit, pInterval->precision); - tw->skey = taosTimeAdd(slidingStart, pInterval->offset, pInterval->offsetUnit, pInterval->precision); - int64_t slidingEnd = - taosTimeAdd(slidingStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; - tw->ekey = taosTimeAdd(slidingEnd, pInterval->offset, pInterval->offsetUnit, pInterval->precision); + TSKEY nextStart = taosTimeAdd(start, -1 * pInterval->offset, pInterval->offsetUnit, pInterval->precision); + nextStart = taosTimeAdd(nextStart, factor * pInterval->sliding, pInterval->slidingUnit, pInterval->precision); + nextStart = taosTimeAdd(nextStart, pInterval->offset, pInterval->offsetUnit, pInterval->precision); + return nextStart; +} + +void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t order) { + tw->skey = getNextTimeWindowStart(pInterval, tw->skey, order); + tw->ekey = taosTimeAdd(tw->skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; } bool hasLimitOffsetInfo(SLimitInfo* pLimitInfo) { diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index e7a9c58710..cd02f07143 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -578,7 +578,9 @@ int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiN .intervalUnit = pIntervalPhyNode->intervalUnit, .slidingUnit = pIntervalPhyNode->slidingUnit, .offset = pIntervalPhyNode->offset, - .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision}; + .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision, + .timeRange = pIntervalPhyNode->timeRange}; + calcIntervalAutoOffset(&pInfo->interval); pInfo->twAggSup = (STimeWindowAggSupp){.waterMark = pIntervalPhyNode->window.watermark, diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index c9e3d0c8ac..039baca54c 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -1932,7 +1932,9 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN .intervalUnit = pIntervalPhyNode->intervalUnit, .slidingUnit = pIntervalPhyNode->slidingUnit, .offset = pIntervalPhyNode->offset, - .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision}; + .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision, + .timeRange = pIntervalPhyNode->timeRange}; + calcIntervalAutoOffset(&pInfo->interval); pInfo->twAggSup = (STimeWindowAggSupp){ .waterMark = pIntervalPhyNode->window.watermark, .calTrigger = pIntervalPhyNode->window.triggerType, @@ -5342,7 +5344,9 @@ static int32_t createStreamSingleIntervalOperatorInfo(SOperatorInfo* downstream, .slidingUnit = pIntervalPhyNode->slidingUnit, .offset = pIntervalPhyNode->offset, .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision, + .timeRange = pIntervalPhyNode->timeRange, }; + calcIntervalAutoOffset(&pInfo->interval); pInfo->twAggSup = (STimeWindowAggSupp){.waterMark = pIntervalPhyNode->window.watermark, diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index e4e1ef9eaa..00c0e9e61f 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1401,7 +1401,9 @@ int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode .intervalUnit = pPhyNode->intervalUnit, .slidingUnit = pPhyNode->slidingUnit, .offset = pPhyNode->offset, - .precision = ((SColumnNode*)pPhyNode->window.pTspk)->node.resType.precision}; + .precision = ((SColumnNode*)pPhyNode->window.pTspk)->node.resType.precision, + .timeRange = pPhyNode->timeRange}; + calcIntervalAutoOffset(&interval); STimeWindowAggSupp as = { .waterMark = pPhyNode->window.watermark, @@ -2122,7 +2124,9 @@ int32_t createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMerge .intervalUnit = pNode->intervalUnit, .slidingUnit = pNode->slidingUnit, .offset = pNode->offset, - .precision = ((SColumnNode*)pNode->window.pTspk)->node.resType.precision}; + .precision = ((SColumnNode*)pNode->window.pTspk)->node.resType.precision, + .timeRange = pNode->timeRange}; + calcIntervalAutoOffset(&interval); SIntervalAggOperatorInfo* iaInfo = miaInfo->intervalAggOperatorInfo; SExprSupp* pSup = &pOperator->exprSupp; @@ -2462,7 +2466,9 @@ int32_t createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeInterva .intervalUnit = pIntervalPhyNode->intervalUnit, .slidingUnit = pIntervalPhyNode->slidingUnit, .offset = pIntervalPhyNode->offset, - .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision}; + .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision, + .timeRange = pIntervalPhyNode->timeRange}; + calcIntervalAutoOffset(&interval); pMergeIntervalInfo->groupIntervals = tdListNew(sizeof(SGroupTimeWindow)); diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index c2deec9c68..6ead98df0f 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -387,6 +387,7 @@ static int32_t intervalWindowNodeCopy(const SIntervalWindowNode* pSrc, SInterval CLONE_NODE_FIELD(pOffset); CLONE_NODE_FIELD(pSliding); CLONE_NODE_FIELD(pFill); + COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); return TSDB_CODE_SUCCESS; } @@ -615,6 +616,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p COPY_SCALAR_FIELD(sliding); COPY_SCALAR_FIELD(intervalUnit); COPY_SCALAR_FIELD(slidingUnit); + COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); COPY_SCALAR_FIELD(sessionGap); CLONE_NODE_FIELD(pTspk); CLONE_NODE_FIELD(pTsEnd); @@ -805,6 +807,7 @@ static int32_t physiIntervalCopy(const SIntervalPhysiNode* pSrc, SIntervalPhysiN COPY_SCALAR_FIELD(sliding); COPY_SCALAR_FIELD(intervalUnit); COPY_SCALAR_FIELD(slidingUnit); + COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 69651bc4e4..88f920b47f 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1014,6 +1014,8 @@ static const char* jkWindowLogicPlanOffset = "Offset"; static const char* jkWindowLogicPlanSliding = "Sliding"; static const char* jkWindowLogicPlanIntervalUnit = "IntervalUnit"; static const char* jkWindowLogicPlanSlidingUnit = "SlidingUnit"; +static const char* jkWindowLogicPlanStartTime = "StartTime"; +static const char* jkWindowLogicPlanEndTime = "EndTime"; static const char* jkWindowLogicPlanSessionGap = "SessionGap"; static const char* jkWindowLogicPlanTspk = "Tspk"; static const char* jkWindowLogicPlanStateExpr = "StateExpr"; @@ -1046,6 +1048,12 @@ static int32_t logicWindowNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkWindowLogicPlanSlidingUnit, pNode->slidingUnit); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkWindowLogicPlanStartTime, pNode->timeRange.skey); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkWindowLogicPlanEndTime, pNode->timeRange.ekey); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkWindowLogicPlanSessionGap, pNode->sessionGap); } @@ -1093,6 +1101,12 @@ static int32_t jsonToLogicWindowNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetTinyIntValue(pJson, jkWindowLogicPlanSlidingUnit, &pNode->slidingUnit); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkWindowLogicPlanStartTime, &pNode->timeRange.skey); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkWindowLogicPlanEndTime, &pNode->timeRange.ekey); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkWindowLogicPlanSessionGap, &pNode->sessionGap); } @@ -2944,6 +2958,8 @@ static const char* jkIntervalPhysiPlanOffset = "Offset"; static const char* jkIntervalPhysiPlanSliding = "Sliding"; static const char* jkIntervalPhysiPlanIntervalUnit = "intervalUnit"; static const char* jkIntervalPhysiPlanSlidingUnit = "slidingUnit"; +static const char* jkIntervalPhysiPlanStartTime = "StartTime"; +static const char* jkIntervalPhysiPlanEndTime = "EndTime"; static int32_t physiIntervalNodeToJson(const void* pObj, SJson* pJson) { const SIntervalPhysiNode* pNode = (const SIntervalPhysiNode*)pObj; @@ -2964,6 +2980,12 @@ static int32_t physiIntervalNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkIntervalPhysiPlanSlidingUnit, pNode->slidingUnit); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkIntervalPhysiPlanStartTime, pNode->timeRange.skey); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkIntervalPhysiPlanEndTime, pNode->timeRange.ekey); + } return code; } @@ -2987,6 +3009,12 @@ static int32_t jsonToPhysiIntervalNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetTinyIntValue(pJson, jkIntervalPhysiPlanSlidingUnit, &pNode->slidingUnit); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkIntervalPhysiPlanStartTime, &pNode->timeRange.skey); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkIntervalPhysiPlanEndTime, &pNode->timeRange.ekey); + } return code; } @@ -5058,6 +5086,8 @@ static const char* jkIntervalWindowOffset = "Offset"; static const char* jkIntervalWindowSliding = "Sliding"; static const char* jkIntervalWindowFill = "Fill"; static const char* jkIntervalWindowTsPk = "TsPk"; +static const char* jkIntervalStartTime = "StartTime"; +static const char* jkIntervalEndTime = "EndTime"; static int32_t intervalWindowNodeToJson(const void* pObj, SJson* pJson) { const SIntervalWindowNode* pNode = (const SIntervalWindowNode*)pObj; @@ -5075,6 +5105,12 @@ static int32_t intervalWindowNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkIntervalWindowTsPk, nodeToJson, pNode->pCol); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkIntervalStartTime, pNode->timeRange.skey); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkIntervalEndTime, pNode->timeRange.ekey); + } return code; } @@ -5095,6 +5131,12 @@ static int32_t jsonToIntervalWindowNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeObject(pJson, jkIntervalWindowTsPk, &pNode->pCol); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkIntervalStartTime, &pNode->timeRange.skey); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkIntervalEndTime, &pNode->timeRange.ekey); + } return code; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index fe95322577..4992c2a06b 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -3250,7 +3250,7 @@ static int32_t msgToPhysiWindowNode(STlvDecoder* pDecoder, void* pObj) { return code; } -enum { PHY_INTERVAL_CODE_WINDOW = 1, PHY_INTERVAL_CODE_INLINE_ATTRS }; +enum { PHY_INTERVAL_CODE_WINDOW = 1, PHY_INTERVAL_CODE_INLINE_ATTRS, PHY_INTERVAL_CODE_TIME_RANGE }; static int32_t physiIntervalNodeInlineToMsg(const void* pObj, STlvEncoder* pEncoder) { const SIntervalPhysiNode* pNode = (const SIntervalPhysiNode*)pObj; @@ -3279,6 +3279,9 @@ static int32_t physiIntervalNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeObj(pEncoder, PHY_INTERVAL_CODE_INLINE_ATTRS, physiIntervalNodeInlineToMsg, pNode); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, PHY_INTERVAL_CODE_TIME_RANGE, timeWindowToMsg, &pNode->timeRange); + } return code; } @@ -3316,6 +3319,8 @@ static int32_t msgToPhysiIntervalNode(STlvDecoder* pDecoder, void* pObj) { case PHY_INTERVAL_CODE_INLINE_ATTRS: code = tlvDecodeObjFromTlv(pTlv, msgToPhysiIntervalNodeInline, pNode); break; + case PHY_INTERVAL_CODE_TIME_RANGE: + code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, &pNode->timeRange); default: break; } diff --git a/source/libs/nodes/test/nodesCloneTest.cpp b/source/libs/nodes/test/nodesCloneTest.cpp index 75a4f6c66f..ea0201f2ef 100644 --- a/source/libs/nodes/test/nodesCloneTest.cpp +++ b/source/libs/nodes/test/nodesCloneTest.cpp @@ -143,6 +143,8 @@ TEST_F(NodesCloneTest, intervalWindow) { if (NULL != pSrcNode->pFill) { ASSERT_EQ(nodeType(pSrcNode->pFill), nodeType(pDstNode->pFill)); } + ASSERT_EQ(pSrcNode->timeRange.skey, pDstNode->timeRange.skey); + ASSERT_EQ(pSrcNode->timeRange.ekey, pDstNode->timeRange.ekey); }); std::unique_ptr srcNode(nullptr, nodesDestroyNode); @@ -156,6 +158,8 @@ TEST_F(NodesCloneTest, intervalWindow) { code = nodesMakeNode(QUERY_NODE_VALUE, &pNode->pOffset); code = nodesMakeNode(QUERY_NODE_VALUE, &pNode->pSliding); code = nodesMakeNode(QUERY_NODE_FILL, &pNode->pFill); + pNode->timeRange.skey = 1666756692907; + pNode->timeRange.ekey = 1666756699907; return srcNode.get(); }()); } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b39e25beb3..9e45c5f75e 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -1523,6 +1523,9 @@ twindow_clause_opt(A) ::= INTERVAL NK_LP interval_sliding_duration_literal(B) NK_COMMA interval_sliding_duration_literal(C) NK_RP sliding_opt(D) fill_opt(E). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), D, E); } +twindow_clause_opt(A) ::= + INTERVAL NK_LP interval_sliding_duration_literal(B) NK_COMMA + AUTO(C) NK_RP sliding_opt(D) fill_opt(E). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), createDurationValueNode(pCxt, &C), D, E); } twindow_clause_opt(A) ::= EVENT_WINDOW START WITH search_condition(B) END WITH search_condition(C). { A = createEventWindowNode(pCxt, B, C); } twindow_clause_opt(A) ::= diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 8554c67433..a06f173718 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1399,6 +1399,7 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode interval->pOffset = pOffset; interval->pSliding = pSliding; interval->pFill = pFill; + interval->timeRange = TSWINDOW_INITIALIZER; return (SNode*)interval; _err: nodesDestroyNode((SNode*)interval); diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 56f5d82ef4..b38e2f05f0 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -351,6 +351,7 @@ static SKeyword keywordTable[] = { {"IS_IMPORT", TK_IS_IMPORT}, {"FORCE_WINDOW_CLOSE", TK_FORCE_WINDOW_CLOSE}, {"DISK_INFO", TK_DISK_INFO}, + {"AUTO", TK_AUTO}, }; // clang-format on diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 21144ed1b3..f2a9099624 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1994,8 +1994,11 @@ static int32_t parseBoolFromValueNode(STranslateContext* pCxt, SValueNode* pVal) } static EDealRes translateDurationValue(STranslateContext* pCxt, SValueNode* pVal) { - if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, - pVal->node.resType.precision, false) != TSDB_CODE_SUCCESS) { + if (strncmp(pVal->literal, AUTO_DURATION_LITERAL, strlen(AUTO_DURATION_LITERAL) + 1) == 0) { + pVal->datum.i = AUTO_DURATION_VALUE; + pVal->unit = getPrecisionUnit(pVal->node.resType.precision); + } else if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, + pVal->node.resType.precision, false) != TSDB_CODE_SUCCESS) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } *(int64_t*)&pVal->typeData = pVal->datum.i; @@ -5840,7 +5843,13 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* if (NULL != pInterval->pOffset) { SValueNode* pOffset = (SValueNode*)pInterval->pOffset; - if (pOffset->datum.i <= 0) { + if (pOffset->datum.i == AUTO_DURATION_VALUE) { + if (pOffset->unit != getPrecisionUnit(precision)) { + parserError("invalid offset unit %d for auto offset with precision %u", pOffset->unit, precision); + return TSDB_CODE_INVALID_PARA; + } + } + else if (pOffset->datum.i < 0) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_OFFSET_NEGATIVE); } if (pInter->unit == 'n' && pOffset->unit == 'y') { @@ -5904,9 +5913,52 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* return TSDB_CODE_SUCCESS; } +void tryCalcIntervalAutoOffset(SIntervalWindowNode *pInterval) { + SValueNode* pOffset = (SValueNode*)pInterval->pOffset; + uint8_t precision = ((SColumnNode*)pInterval->pCol)->node.resType.precision; + SValueNode* pInter = (SValueNode*)pInterval->pInterval; + SValueNode* pSliding = (SValueNode*)pInterval->pSliding; + + if (pOffset == NULL || pOffset->datum.i != AUTO_DURATION_VALUE) { + return; + } + + // ignore auto offset if not applicable + if (pInterval->timeRange.skey == INT64_MIN) { + pOffset->datum.i = 0; + return; + } + + SInterval interval = {.interval = pInter->datum.i, + .sliding = (pSliding != NULL) ? pSliding->datum.i : pInter->datum.i, + .intervalUnit = pInter->unit, + .slidingUnit = (pSliding != NULL) ? pSliding->unit : pInter->unit, + .offset = pOffset->datum.i, + .precision = precision, + .timeRange = pInterval->timeRange}; + + /** + * Considering that the client and server may be in different time zones, + * these situations need to be deferred to the server for calculation. + */ + if (IS_CALENDAR_TIME_DURATION(interval.intervalUnit) || interval.intervalUnit == 'd' || + interval.intervalUnit == 'w' || IS_CALENDAR_TIME_DURATION(interval.slidingUnit) || interval.slidingUnit == 'd' || + interval.slidingUnit == 'w') { + return; + } + + calcIntervalAutoOffset(&interval); + pOffset->datum.i = interval.offset; +} + static int32_t translateIntervalWindow(STranslateContext* pCxt, SSelectStmt* pSelect) { SIntervalWindowNode* pInterval = (SIntervalWindowNode*)pSelect->pWindow; - int32_t code = checkIntervalWindow(pCxt, pInterval); + int32_t code = TSDB_CODE_SUCCESS; + + pInterval->timeRange = pSelect->timeRange; + tryCalcIntervalAutoOffset(pInterval); + + code = checkIntervalWindow(pCxt, pInterval); if (TSDB_CODE_SUCCESS == code) { code = translateFill(pCxt, pSelect, pInterval); } @@ -9047,6 +9099,13 @@ static int32_t buildIntervalForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) TSWAP(pInterval->pInterval, pInfo->pInterval); TSWAP(pInterval->pOffset, pInfo->pOffset); TSWAP(pInterval->pSliding, pInfo->pSliding); + + SValueNode* pOffset = (SValueNode*)pInterval->pOffset; + if (pOffset && pOffset->datum.i < 0) { + parserError("%s failed for invalid interval offset %" PRId64, __func__, pOffset->datum.i); + return TSDB_CODE_INVALID_PARA; + } + pInterval->pCol = NULL; code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pInterval->pCol); if (NULL == pInterval->pCol) { @@ -10058,6 +10117,10 @@ int32_t createIntervalFromCreateSmaIndexStmt(SCreateIndexStmt* pStmt, SInterval* pInterval->slidingUnit = NULL != pStmt->pOptions->pSliding ? ((SValueNode*)pStmt->pOptions->pSliding)->unit : pInterval->intervalUnit; pInterval->precision = pStmt->pOptions->tsPrecision; + if (pInterval->offset < 0) { + parserError("%s failed for invalid interval offset %" PRId64, __func__, pInterval->offset); + return TSDB_CODE_INVALID_PARA; + } return TSDB_CODE_SUCCESS; } @@ -11909,6 +11972,7 @@ static int32_t buildIntervalForCreateStream(SCreateStreamStmt* pStmt, SInterval* pInterval->slidingUnit = (NULL != pWindow->pSliding ? ((SValueNode*)pWindow->pSliding)->unit : pInterval->intervalUnit); pInterval->precision = ((SColumnNode*)pWindow->pCol)->node.resType.precision; + pInterval->timeRange = pWindow->timeRange; return code; } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index c0093fff96..a9c3beb025 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1186,6 +1186,7 @@ static int32_t createWindowLogicNodeByInterval(SLogicPlanContext* pCxt, SInterva return code; } pWindow->isPartTb = pSelect->pPartitionByList ? keysHasTbname(pSelect->pPartitionByList) : 0; + pWindow->timeRange = pInterval->timeRange; return createWindowLogicNodeFinalize(pCxt, pSelect, pWindow, pLogicNode); } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index bac40653eb..aa89ee4fbd 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -6728,6 +6728,20 @@ static bool tsmaOptMayBeOptimized(SLogicNode* pNode, void* pCtx) { } } + if (nodeType(pParent) == QUERY_NODE_LOGIC_PLAN_WINDOW) { + SWindowLogicNode* pWindow = (SWindowLogicNode*)pParent; + if (pWindow->winType == WINDOW_TYPE_INTERVAL && pWindow->offset == AUTO_DURATION_VALUE) { + SLogicNode* pRootNode = getLogicNodeRootNode(pParent); + // When using interval auto offset, tsma optimization cannot take effect. + // Unless the user explicitly specifies not to use tsma, an error should be reported. + if (!getOptHint(pRootNode->pHint, HINT_SKIP_TSMA)) { + planError("%s failed since tsma optimization cannot be applied with interval auto offset", __func__); + *(int32_t*)pCtx = TSDB_CODE_TSMA_INVALID_AUTO_OFFSET; + return false; + } + } + } + return true; } return false; @@ -7502,7 +7516,7 @@ static bool tsmaOptIsUsingTsmas(STSMAOptCtx* pCtx) { static int32_t tsmaOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { int32_t code = 0; STSMAOptCtx tsmaOptCtx = {0}; - SScanLogicNode* pScan = (SScanLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, tsmaOptMayBeOptimized, NULL); + SScanLogicNode* pScan = (SScanLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, tsmaOptMayBeOptimized, &code); if (!pScan) return code; SLogicNode* pRootNode = getLogicNodeRootNode((SLogicNode*)pScan); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 5268602c53..b2e36aeda6 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -2260,6 +2260,7 @@ static int32_t createIntervalPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChil pInterval->sliding = pWindowLogicNode->sliding; pInterval->intervalUnit = pWindowLogicNode->intervalUnit; pInterval->slidingUnit = pWindowLogicNode->slidingUnit; + pInterval->timeRange = pWindowLogicNode->timeRange; int32_t code = createWindowPhysiNodeFinalize(pCxt, pChildren, &pInterval->window, pWindowLogicNode); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 6220a18572..d2be62f56a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -812,6 +812,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_UNSUPPORTED_FUNC, "Tsma func not suppo TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_MUST_BE_DROPPED, "Tsma must be dropped first") TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NAME_TOO_LONG, "Tsma name too long") TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_RECURSIVE_INTERVAL,"Invalid recursive tsma interval") +TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_AUTO_OFFSET, "TSMA optimization cannot be applied with INTERVAL AUTO offset. Use SKIP_TSMA hint to skip TSMA optimization or specify a manual offset.") //rsma TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env") diff --git a/tests/army/frame/common.py b/tests/army/frame/common.py index a82bf4c94f..21dc568713 100644 --- a/tests/army/frame/common.py +++ b/tests/army/frame/common.py @@ -1839,7 +1839,8 @@ class TDCom: tdLog.exit(f"Input file '{inputfile}' does not exist.") else: self.query_result_file = f"./temp_{test_case}.result" - os.system(f"taos -f {inputfile} | grep -v 'Query OK'|grep -v 'Copyright'| grep -v 'Welcome to the TDengine Command' > {self.query_result_file} ") + cfgPath = self.getClientCfgPath() + os.system(f"taos -c {cfgPath} -f {inputfile} | grep -v 'Query OK'|grep -v 'Copyright'| grep -v 'Welcome to the TDengine Command' > {self.query_result_file} ") return self.query_result_file def compare_result_files(self, file1, file2): diff --git a/tests/army/query/function/ans/interval.csv b/tests/army/query/function/ans/interval.csv new file mode 100644 index 0000000000..56bc9d4840 --- /dev/null +++ b/tests/army/query/function/ans/interval.csv @@ -0,0 +1,1428 @@ + +taos> select _wstart, _wend, _wduration, count(*) from test.st interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 00:01:00.000 | 60000 | 1 | + 2020-10-01 00:01:00.000 | 2020-10-01 00:02:00.000 | 60000 | 1 | + 2020-10-01 00:02:00.000 | 2020-10-01 00:03:00.000 | 60000 | 1 | + 2020-10-01 00:03:00.000 | 2020-10-01 00:04:00.000 | 60000 | 1 | + 2020-10-01 00:04:00.000 | 2020-10-01 00:05:00.000 | 60000 | 1 | + 2020-10-01 00:05:00.000 | 2020-10-01 00:06:00.000 | 60000 | 1 | + 2020-10-01 00:06:00.000 | 2020-10-01 00:07:00.000 | 60000 | 1 | + 2020-10-01 00:07:00.000 | 2020-10-01 00:08:00.000 | 60000 | 1 | + 2020-10-01 00:08:00.000 | 2020-10-01 00:09:00.000 | 60000 | 1 | + 2020-10-01 00:09:00.000 | 2020-10-01 00:10:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts < '2020-10-01 00:07:19' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 00:01:00.000 | 60000 | 1 | + 2020-10-01 00:01:00.000 | 2020-10-01 00:02:00.000 | 60000 | 1 | + 2020-10-01 00:02:00.000 | 2020-10-01 00:03:00.000 | 60000 | 1 | + 2020-10-01 00:03:00.000 | 2020-10-01 00:04:00.000 | 60000 | 1 | + 2020-10-01 00:04:00.000 | 2020-10-01 00:05:00.000 | 60000 | 1 | + 2020-10-01 00:05:00.000 | 2020-10-01 00:06:00.000 | 60000 | 1 | + 2020-10-01 00:06:00.000 | 2020-10-01 00:07:00.000 | 60000 | 1 | + 2020-10-01 00:07:00.000 | 2020-10-01 00:08:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts <= '2020-09-30 23:59:59' interval(1h, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-12-01 23:45:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-01 23:45:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-12-01 23:45:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:59.300 | 2020-10-01 23:45:00.300 | 1000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:23.000 | 2020-10-01 23:45:23.000 | 60000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 22:51:00.000 | 2020-11-01 23:51:00.000 | 3600000 | 1 | + 2020-11-01 23:18:00.000 | 2020-11-02 00:18:00.000 | 3600000 | 1 | + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-12-01 23:45:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 06:45:00.000 | 2020-12-02 06:45:00.000 | 86400000 | 1 | + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:59.300 | 2020-10-01 23:45:00.300 | 1000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:23.000 | 2020-10-01 23:45:23.000 | 60000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-01 23:45:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 22:51:00.000 | 2020-11-01 23:51:00.000 | 3600000 | 1 | + 2020-11-01 23:18:00.000 | 2020-11-02 00:18:00.000 | 3600000 | 1 | + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-12-01 23:45:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 06:45:00.000 | 2020-12-02 06:45:00.000 | 86400000 | 1 | + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:43' interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:43') interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:43' interval(1n, auto) sliding(9d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-16 23:32:00.000 | 2020-11-16 23:32:00.000 | 2678400000 | 1 | + 2020-10-25 23:32:00.000 | 2020-11-25 23:32:00.000 | 2678400000 | 1 | + 2020-11-03 23:32:00.000 | 2020-12-03 23:32:00.000 | 2592000000 | 1 | + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:43') interval(1n, auto) sliding(13d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-17 23:32:00.000 | 2020-11-17 23:32:00.000 | 2678400000 | 1 | + 2020-10-30 23:32:00.000 | 2020-11-30 23:32:00.000 | 2678400000 | 1 | + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.001 | 2020-10-09 01:24:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:25:59.001 | 2020-10-09 01:26:00.001 | 1000 | 1 | + 2020-10-09 01:26:59.001 | 2020-10-09 01:27:00.001 | 1000 | 1 | + 2020-10-09 01:27:59.001 | 2020-10-09 01:28:00.001 | 1000 | 1 | + 2020-10-09 01:28:59.001 | 2020-10-09 01:29:00.001 | 1000 | 1 | + 2020-10-09 01:29:59.001 | 2020-10-09 01:30:00.001 | 1000 | 1 | + 2020-10-09 01:30:59.001 | 2020-10-09 01:31:00.001 | 1000 | 1 | + 2020-10-09 01:31:59.001 | 2020-10-09 01:32:00.001 | 1000 | 1 | + 2020-10-09 01:32:59.001 | 2020-10-09 01:33:00.001 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:24:00.001 | 2020-10-09 01:25:00.001 | 60000 | 1 | + 2020-10-09 01:25:00.001 | 2020-10-09 01:26:00.001 | 60000 | 1 | + 2020-10-09 01:26:00.001 | 2020-10-09 01:27:00.001 | 60000 | 1 | + 2020-10-09 01:27:00.001 | 2020-10-09 01:28:00.001 | 60000 | 1 | + 2020-10-09 01:28:00.001 | 2020-10-09 01:29:00.001 | 60000 | 1 | + 2020-10-09 01:29:00.001 | 2020-10-09 01:30:00.001 | 60000 | 1 | + 2020-10-09 01:30:00.001 | 2020-10-09 01:31:00.001 | 60000 | 1 | + 2020-10-09 01:31:00.001 | 2020-10-09 01:32:00.001 | 60000 | 1 | + 2020-10-09 01:32:00.001 | 2020-10-09 01:33:00.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 02:23:00.001 | 2020-11-09 03:23:00.001 | 3600000 | 60 | + 2020-11-09 03:23:00.001 | 2020-11-09 04:23:00.001 | 3600000 | 60 | + 2020-11-09 04:23:00.001 | 2020-11-09 05:23:00.001 | 3600000 | 60 | + 2020-11-09 05:23:00.001 | 2020-11-09 06:23:00.001 | 3600000 | 60 | + 2020-11-09 06:23:00.001 | 2020-11-09 07:23:00.001 | 3600000 | 60 | + 2020-11-09 07:23:00.001 | 2020-11-09 08:23:00.001 | 3600000 | 60 | + 2020-11-09 08:23:00.001 | 2020-11-09 09:23:00.001 | 3600000 | 60 | + 2020-11-09 09:23:00.001 | 2020-11-09 10:23:00.001 | 3600000 | 60 | + 2020-11-09 10:23:00.001 | 2020-11-09 11:23:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:24:01.000 | 1000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:25:01.000 | 1000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:26:01.000 | 1000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:27:01.000 | 1000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:28:01.000 | 1000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:29:01.000 | 1000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:30:01.000 | 1000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:31:01.000 | 1000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:32:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:25:00.000 | 60000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:26:00.000 | 60000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:27:00.000 | 60000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:28:00.000 | 60000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:29:00.000 | 60000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:30:00.000 | 60000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:31:00.000 | 60000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:32:00.000 | 60000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:33:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 02:23:00.000 | 2020-11-09 03:23:00.000 | 3600000 | 60 | + 2020-11-09 03:23:00.000 | 2020-11-09 04:23:00.000 | 3600000 | 60 | + 2020-11-09 04:23:00.000 | 2020-11-09 05:23:00.000 | 3600000 | 60 | + 2020-11-09 05:23:00.000 | 2020-11-09 06:23:00.000 | 3600000 | 60 | + 2020-11-09 06:23:00.000 | 2020-11-09 07:23:00.000 | 3600000 | 60 | + 2020-11-09 07:23:00.000 | 2020-11-09 08:23:00.000 | 3600000 | 60 | + 2020-11-09 08:23:00.000 | 2020-11-09 09:23:00.000 | 3600000 | 60 | + 2020-11-09 09:23:00.000 | 2020-11-09 10:23:00.000 | 3600000 | 60 | + 2020-11-09 10:23:00.000 | 2020-11-09 11:23:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-09 01:23:01.000 | 1000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-09 01:23:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-09 01:24:00.000 | 60000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-09 01:24:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-09 02:23:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-10 01:23:00.000 | 86400000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.501 | 2020-10-09 01:24:00.501 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.701 | 2020-10-09 01:25:00.701 | 1000 | 1 | + 2020-10-09 01:25:59.201 | 2020-10-09 01:26:00.201 | 1000 | 1 | + 2020-10-09 01:25:59.901 | 2020-10-09 01:26:00.901 | 1000 | 1 | + 2020-10-09 01:26:59.401 | 2020-10-09 01:27:00.401 | 1000 | 1 | + 2020-10-09 01:27:59.601 | 2020-10-09 01:28:00.601 | 1000 | 1 | + 2020-10-09 01:28:59.101 | 2020-10-09 01:29:00.101 | 1000 | 1 | + 2020-10-09 01:28:59.801 | 2020-10-09 01:29:00.801 | 1000 | 1 | + 2020-10-09 01:29:59.301 | 2020-10-09 01:30:00.301 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:23:37.001 | 2020-10-09 01:24:37.001 | 60000 | 1 | + 2020-10-09 01:24:14.001 | 2020-10-09 01:25:14.001 | 60000 | 1 | + 2020-10-09 01:24:51.001 | 2020-10-09 01:25:51.001 | 60000 | 1 | + 2020-10-09 01:25:28.001 | 2020-10-09 01:26:28.001 | 60000 | 1 | + 2020-10-09 01:26:05.001 | 2020-10-09 01:27:05.001 | 60000 | 1 | + 2020-10-09 01:26:42.001 | 2020-10-09 01:27:42.001 | 60000 | 1 | + 2020-10-09 01:27:19.001 | 2020-10-09 01:28:19.001 | 60000 | 1 | + 2020-10-09 01:27:56.001 | 2020-10-09 01:28:56.001 | 60000 | 1 | + 2020-10-09 01:28:33.001 | 2020-10-09 01:29:33.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.001 | 2020-11-09 01:29:00.001 | 3600000 | 6 | + 2020-11-09 00:56:00.001 | 2020-11-09 01:56:00.001 | 3600000 | 33 | + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 01:50:00.001 | 2020-11-09 02:50:00.001 | 3600000 | 60 | + 2020-11-09 02:17:00.001 | 2020-11-09 03:17:00.001 | 3600000 | 60 | + 2020-11-09 02:44:00.001 | 2020-11-09 03:44:00.001 | 3600000 | 60 | + 2020-11-09 03:11:00.001 | 2020-11-09 04:11:00.001 | 3600000 | 60 | + 2020-11-09 03:38:00.001 | 2020-11-09 04:38:00.001 | 3600000 | 60 | + 2020-11-09 04:05:00.001 | 2020-11-09 05:05:00.001 | 3600000 | 60 | + 2020-11-09 04:32:00.001 | 2020-11-09 05:32:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.001 | 2020-12-09 08:23:00.001 | 86400000 | 420 | + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:23:59.500 | 2020-10-09 01:24:00.500 | 1000 | 1 | + 2020-10-09 01:24:59.700 | 2020-10-09 01:25:00.700 | 1000 | 1 | + 2020-10-09 01:25:59.200 | 2020-10-09 01:26:00.200 | 1000 | 1 | + 2020-10-09 01:25:59.900 | 2020-10-09 01:26:00.900 | 1000 | 1 | + 2020-10-09 01:26:59.400 | 2020-10-09 01:27:00.400 | 1000 | 1 | + 2020-10-09 01:27:59.600 | 2020-10-09 01:28:00.600 | 1000 | 1 | + 2020-10-09 01:28:59.100 | 2020-10-09 01:29:00.100 | 1000 | 1 | + 2020-10-09 01:28:59.800 | 2020-10-09 01:29:00.800 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:23:37.000 | 2020-10-09 01:24:37.000 | 60000 | 1 | + 2020-10-09 01:24:14.000 | 2020-10-09 01:25:14.000 | 60000 | 1 | + 2020-10-09 01:24:51.000 | 2020-10-09 01:25:51.000 | 60000 | 1 | + 2020-10-09 01:25:28.000 | 2020-10-09 01:26:28.000 | 60000 | 1 | + 2020-10-09 01:26:05.000 | 2020-10-09 01:27:05.000 | 60000 | 1 | + 2020-10-09 01:26:42.000 | 2020-10-09 01:27:42.000 | 60000 | 1 | + 2020-10-09 01:27:19.000 | 2020-10-09 01:28:19.000 | 60000 | 1 | + 2020-10-09 01:27:56.000 | 2020-10-09 01:28:56.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.000 | 2020-11-09 01:29:00.000 | 3600000 | 6 | + 2020-11-09 00:56:00.000 | 2020-11-09 01:56:00.000 | 3600000 | 33 | + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 01:50:00.000 | 2020-11-09 02:50:00.000 | 3600000 | 60 | + 2020-11-09 02:17:00.000 | 2020-11-09 03:17:00.000 | 3600000 | 60 | + 2020-11-09 02:44:00.000 | 2020-11-09 03:44:00.000 | 3600000 | 60 | + 2020-11-09 03:11:00.000 | 2020-11-09 04:11:00.000 | 3600000 | 60 | + 2020-11-09 03:38:00.000 | 2020-11-09 04:38:00.000 | 3600000 | 60 | + 2020-11-09 04:05:00.000 | 2020-11-09 05:05:00.000 | 3600000 | 60 | + 2020-11-09 04:32:00.000 | 2020-11-09 05:32:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.000 | 2020-12-09 08:23:00.000 | 86400000 | 420 | + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-09 01:22:59.500 | 2020-11-09 01:23:00.500 | 1000 | 1 | + 2020-12-09 01:22:59.400 | 2020-12-09 01:23:00.400 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-09 01:22:16.000 | 2020-11-09 01:23:16.000 | 60000 | 1 | + 2020-11-09 01:22:53.000 | 2020-11-09 01:23:53.000 | 60000 | 1 | + 2020-12-09 01:22:14.000 | 2020-12-09 01:23:14.000 | 60000 | 1 | + 2020-12-09 01:22:51.000 | 2020-12-09 01:23:51.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 00:29:00.000 | 2020-10-09 01:29:00.000 | 3600000 | 1 | + 2020-10-09 00:56:00.000 | 2020-10-09 01:56:00.000 | 3600000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-09 00:47:00.000 | 2020-11-09 01:47:00.000 | 3600000 | 1 | + 2020-11-09 01:14:00.000 | 2020-11-09 02:14:00.000 | 3600000 | 1 | + 2020-12-09 00:47:00.000 | 2020-12-09 01:47:00.000 | 3600000 | 1 | + 2020-12-09 01:14:00.000 | 2020-12-09 02:14:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-08 08:23:00.000 | 2020-10-09 08:23:00.000 | 86400000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-08 12:23:00.000 | 2020-11-09 12:23:00.000 | 86400000 | 1 | + 2020-12-08 06:23:00.000 | 2020-12-09 06:23:00.000 | 86400000 | 1 | + 2020-12-08 23:23:00.000 | 2020-12-09 23:23:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-19 01:23:00' interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-19 01:23:00' interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 1 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.001 | 2020-10-12 01:23:00.001 | 2592000000 | 4320 | + 2020-09-21 01:23:00.001 | 2020-10-21 01:23:00.001 | 2592000000 | 17280 | + 2020-09-30 01:23:00.001 | 2020-10-30 01:23:00.001 | 2592000000 | 30240 | + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-10-18 01:23:00.001 | 2020-11-18 01:23:00.001 | 2678400000 | 44640 | + 2020-10-27 01:23:00.001 | 2020-11-27 01:23:00.001 | 2678400000 | 44640 | + 2020-11-05 01:23:00.001 | 2020-12-05 01:23:00.001 | 2592000000 | 43200 | + 2020-11-14 01:23:00.001 | 2020-12-14 01:23:00.001 | 2592000000 | 36556 | + 2020-11-23 01:23:00.001 | 2020-12-23 01:23:00.001 | 2592000000 | 23596 | + 2020-12-02 01:23:00.001 | 2021-01-02 01:23:00.001 | 2678400000 | 10636 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-13 01:23:00.001 | 2020-11-13 01:23:00.001 | 2678400000 | 5760 | + 2020-10-22 01:23:00.001 | 2020-11-22 01:23:00.001 | 2678400000 | 18720 | + 2020-10-31 01:23:00.001 | 2020-11-30 01:23:00.001 | 2592000000 | 30240 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-11-18 01:23:00.001 | 2020-12-18 01:23:00.001 | 2592000000 | 30796 | + 2020-11-27 01:23:00.001 | 2020-12-27 01:23:00.001 | 2592000000 | 17836 | + 2020-12-06 01:23:00.001 | 2021-01-06 01:23:00.001 | 2678400000 | 4876 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 01:23:00.001 | 2020-12-12 01:23:00.001 | 2592000000 | 556 | + 2020-11-21 01:23:00.001 | 2020-12-21 01:23:00.001 | 2592000000 | 556 | + 2020-11-30 01:23:00.001 | 2020-12-30 01:23:00.001 | 2592000000 | 556 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-19 01:23:00' interval(1n, auto) sliding(9d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 5760 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 24480 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 44640 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 43200 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 32237 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 13517 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-14 01:23:00.000 | 2020-11-14 01:23:00.000 | 2678400000 | 7200 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 25920 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-11-22 01:23:00.000 | 2020-12-22 01:23:00.000 | 2592000000 | 25037 | + 2020-12-05 01:23:00.000 | 2021-01-05 01:23:00.000 | 2678400000 | 6317 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-13 01:23:00.000 | 2020-12-13 01:23:00.000 | 2592000000 | 557 | + 2020-11-26 01:23:00.000 | 2020-12-26 01:23:00.000 | 2592000000 | 557 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-19 01:23:00' interval(1n, auto) sliding(13d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.000 | 2020-10-12 01:23:00.000 | 2592000000 | 1 | + 2020-09-21 01:23:00.000 | 2020-10-21 01:23:00.000 | 2592000000 | 1 | + 2020-09-30 01:23:00.000 | 2020-10-30 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-18 01:23:00.000 | 2020-11-18 01:23:00.000 | 2678400000 | 1 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 1 | + 2020-11-05 01:23:00.000 | 2020-12-05 01:23:00.000 | 2592000000 | 1 | + 2020-11-14 01:23:00.000 | 2020-12-14 01:23:00.000 | 2592000000 | 1 | + 2020-11-23 01:23:00.000 | 2020-12-23 01:23:00.000 | 2592000000 | 1 | + 2020-12-02 01:23:00.000 | 2021-01-02 01:23:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 1 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 1 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 1 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 1 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-01 23:45:00' as timestamp) + 1d interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-02 23:45:00.000 | 2020-11-03 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-12-01 23:45:00' as timestamp) + 1d interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-02 23:45:00.000 | 2020-12-03 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:59.300 | 2020-10-02 23:45:00.300 | 1000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:23.000 | 2020-10-02 23:45:23.000 | 60000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-01 23:45:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-02 22:51:00.000 | 2020-11-02 23:51:00.000 | 3600000 | 1 | + 2020-11-02 23:18:00.000 | 2020-11-03 00:18:00.000 | 3600000 | 1 | + 2020-11-02 23:45:00.000 | 2020-11-03 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-12-01 23:45:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-02 06:45:00.000 | 2020-12-03 06:45:00.000 | 86400000 | 1 | + 2020-12-02 23:45:00.000 | 2020-12-03 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:43' as timestamp) + 1d interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-13 23:32:00.000 | 2020-12-13 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-17 23:32:00.000 | 2020-11-17 23:32:00.000 | 2678400000 | 1 | + 2020-10-26 23:32:00.000 | 2020-11-26 23:32:00.000 | 2678400000 | 1 | + 2020-11-04 23:32:00.000 | 2020-12-04 23:32:00.000 | 2592000000 | 1 | + 2020-11-13 23:32:00.000 | 2020-12-13 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-18 23:32:00.000 | 2020-11-18 23:32:00.000 | 2678400000 | 1 | + 2020-10-31 23:32:00.000 | 2020-11-30 23:32:00.000 | 2592000000 | 1 | + 2020-11-13 23:32:00.000 | 2020-12-13 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.001 | 2020-10-09 01:24:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:25:59.001 | 2020-10-09 01:26:00.001 | 1000 | 1 | + 2020-10-09 01:26:59.001 | 2020-10-09 01:27:00.001 | 1000 | 1 | + 2020-10-09 01:27:59.001 | 2020-10-09 01:28:00.001 | 1000 | 1 | + 2020-10-09 01:28:59.001 | 2020-10-09 01:29:00.001 | 1000 | 1 | + 2020-10-09 01:29:59.001 | 2020-10-09 01:30:00.001 | 1000 | 1 | + 2020-10-09 01:30:59.001 | 2020-10-09 01:31:00.001 | 1000 | 1 | + 2020-10-09 01:31:59.001 | 2020-10-09 01:32:00.001 | 1000 | 1 | + 2020-10-09 01:32:59.001 | 2020-10-09 01:33:00.001 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:24:00.001 | 2020-10-09 01:25:00.001 | 60000 | 1 | + 2020-10-09 01:25:00.001 | 2020-10-09 01:26:00.001 | 60000 | 1 | + 2020-10-09 01:26:00.001 | 2020-10-09 01:27:00.001 | 60000 | 1 | + 2020-10-09 01:27:00.001 | 2020-10-09 01:28:00.001 | 60000 | 1 | + 2020-10-09 01:28:00.001 | 2020-10-09 01:29:00.001 | 60000 | 1 | + 2020-10-09 01:29:00.001 | 2020-10-09 01:30:00.001 | 60000 | 1 | + 2020-10-09 01:30:00.001 | 2020-10-09 01:31:00.001 | 60000 | 1 | + 2020-10-09 01:31:00.001 | 2020-10-09 01:32:00.001 | 60000 | 1 | + 2020-10-09 01:32:00.001 | 2020-10-09 01:33:00.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 02:23:00.001 | 2020-11-09 03:23:00.001 | 3600000 | 60 | + 2020-11-09 03:23:00.001 | 2020-11-09 04:23:00.001 | 3600000 | 60 | + 2020-11-09 04:23:00.001 | 2020-11-09 05:23:00.001 | 3600000 | 60 | + 2020-11-09 05:23:00.001 | 2020-11-09 06:23:00.001 | 3600000 | 60 | + 2020-11-09 06:23:00.001 | 2020-11-09 07:23:00.001 | 3600000 | 60 | + 2020-11-09 07:23:00.001 | 2020-11-09 08:23:00.001 | 3600000 | 60 | + 2020-11-09 08:23:00.001 | 2020-11-09 09:23:00.001 | 3600000 | 60 | + 2020-11-09 09:23:00.001 | 2020-11-09 10:23:00.001 | 3600000 | 60 | + 2020-11-09 10:23:00.001 | 2020-11-09 11:23:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:24:01.000 | 1000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:25:01.000 | 1000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:26:01.000 | 1000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:27:01.000 | 1000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:28:01.000 | 1000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:29:01.000 | 1000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:30:01.000 | 1000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:31:01.000 | 1000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:32:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:25:00.000 | 60000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:26:00.000 | 60000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:27:00.000 | 60000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:28:00.000 | 60000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:29:00.000 | 60000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:30:00.000 | 60000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:31:00.000 | 60000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:32:00.000 | 60000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:33:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 02:23:00.000 | 2020-11-09 03:23:00.000 | 3600000 | 60 | + 2020-11-09 03:23:00.000 | 2020-11-09 04:23:00.000 | 3600000 | 60 | + 2020-11-09 04:23:00.000 | 2020-11-09 05:23:00.000 | 3600000 | 60 | + 2020-11-09 05:23:00.000 | 2020-11-09 06:23:00.000 | 3600000 | 60 | + 2020-11-09 06:23:00.000 | 2020-11-09 07:23:00.000 | 3600000 | 60 | + 2020-11-09 07:23:00.000 | 2020-11-09 08:23:00.000 | 3600000 | 60 | + 2020-11-09 08:23:00.000 | 2020-11-09 09:23:00.000 | 3600000 | 60 | + 2020-11-09 09:23:00.000 | 2020-11-09 10:23:00.000 | 3600000 | 60 | + 2020-11-09 10:23:00.000 | 2020-11-09 11:23:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.501 | 2020-10-09 01:24:00.501 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.701 | 2020-10-09 01:25:00.701 | 1000 | 1 | + 2020-10-09 01:25:59.201 | 2020-10-09 01:26:00.201 | 1000 | 1 | + 2020-10-09 01:25:59.901 | 2020-10-09 01:26:00.901 | 1000 | 1 | + 2020-10-09 01:26:59.401 | 2020-10-09 01:27:00.401 | 1000 | 1 | + 2020-10-09 01:27:59.601 | 2020-10-09 01:28:00.601 | 1000 | 1 | + 2020-10-09 01:28:59.101 | 2020-10-09 01:29:00.101 | 1000 | 1 | + 2020-10-09 01:28:59.801 | 2020-10-09 01:29:00.801 | 1000 | 1 | + 2020-10-09 01:29:59.301 | 2020-10-09 01:30:00.301 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:23:37.001 | 2020-10-09 01:24:37.001 | 60000 | 1 | + 2020-10-09 01:24:14.001 | 2020-10-09 01:25:14.001 | 60000 | 1 | + 2020-10-09 01:24:51.001 | 2020-10-09 01:25:51.001 | 60000 | 1 | + 2020-10-09 01:25:28.001 | 2020-10-09 01:26:28.001 | 60000 | 1 | + 2020-10-09 01:26:05.001 | 2020-10-09 01:27:05.001 | 60000 | 1 | + 2020-10-09 01:26:42.001 | 2020-10-09 01:27:42.001 | 60000 | 1 | + 2020-10-09 01:27:19.001 | 2020-10-09 01:28:19.001 | 60000 | 1 | + 2020-10-09 01:27:56.001 | 2020-10-09 01:28:56.001 | 60000 | 1 | + 2020-10-09 01:28:33.001 | 2020-10-09 01:29:33.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.001 | 2020-11-09 01:29:00.001 | 3600000 | 6 | + 2020-11-09 00:56:00.001 | 2020-11-09 01:56:00.001 | 3600000 | 33 | + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 01:50:00.001 | 2020-11-09 02:50:00.001 | 3600000 | 60 | + 2020-11-09 02:17:00.001 | 2020-11-09 03:17:00.001 | 3600000 | 60 | + 2020-11-09 02:44:00.001 | 2020-11-09 03:44:00.001 | 3600000 | 60 | + 2020-11-09 03:11:00.001 | 2020-11-09 04:11:00.001 | 3600000 | 60 | + 2020-11-09 03:38:00.001 | 2020-11-09 04:38:00.001 | 3600000 | 60 | + 2020-11-09 04:05:00.001 | 2020-11-09 05:05:00.001 | 3600000 | 60 | + 2020-11-09 04:32:00.001 | 2020-11-09 05:32:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.001 | 2020-12-09 08:23:00.001 | 86400000 | 420 | + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:23:59.500 | 2020-10-09 01:24:00.500 | 1000 | 1 | + 2020-10-09 01:24:59.700 | 2020-10-09 01:25:00.700 | 1000 | 1 | + 2020-10-09 01:25:59.200 | 2020-10-09 01:26:00.200 | 1000 | 1 | + 2020-10-09 01:25:59.900 | 2020-10-09 01:26:00.900 | 1000 | 1 | + 2020-10-09 01:26:59.400 | 2020-10-09 01:27:00.400 | 1000 | 1 | + 2020-10-09 01:27:59.600 | 2020-10-09 01:28:00.600 | 1000 | 1 | + 2020-10-09 01:28:59.100 | 2020-10-09 01:29:00.100 | 1000 | 1 | + 2020-10-09 01:28:59.800 | 2020-10-09 01:29:00.800 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:23:37.000 | 2020-10-09 01:24:37.000 | 60000 | 1 | + 2020-10-09 01:24:14.000 | 2020-10-09 01:25:14.000 | 60000 | 1 | + 2020-10-09 01:24:51.000 | 2020-10-09 01:25:51.000 | 60000 | 1 | + 2020-10-09 01:25:28.000 | 2020-10-09 01:26:28.000 | 60000 | 1 | + 2020-10-09 01:26:05.000 | 2020-10-09 01:27:05.000 | 60000 | 1 | + 2020-10-09 01:26:42.000 | 2020-10-09 01:27:42.000 | 60000 | 1 | + 2020-10-09 01:27:19.000 | 2020-10-09 01:28:19.000 | 60000 | 1 | + 2020-10-09 01:27:56.000 | 2020-10-09 01:28:56.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.000 | 2020-11-09 01:29:00.000 | 3600000 | 6 | + 2020-11-09 00:56:00.000 | 2020-11-09 01:56:00.000 | 3600000 | 33 | + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 01:50:00.000 | 2020-11-09 02:50:00.000 | 3600000 | 60 | + 2020-11-09 02:17:00.000 | 2020-11-09 03:17:00.000 | 3600000 | 60 | + 2020-11-09 02:44:00.000 | 2020-11-09 03:44:00.000 | 3600000 | 60 | + 2020-11-09 03:11:00.000 | 2020-11-09 04:11:00.000 | 3600000 | 60 | + 2020-11-09 03:38:00.000 | 2020-11-09 04:38:00.000 | 3600000 | 60 | + 2020-11-09 04:05:00.000 | 2020-11-09 05:05:00.000 | 3600000 | 60 | + 2020-11-09 04:32:00.000 | 2020-11-09 05:32:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.000 | 2020-12-09 08:23:00.000 | 86400000 | 420 | + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.001 | 2020-10-12 01:23:00.001 | 2592000000 | 4320 | + 2020-09-21 01:23:00.001 | 2020-10-21 01:23:00.001 | 2592000000 | 17280 | + 2020-09-30 01:23:00.001 | 2020-10-30 01:23:00.001 | 2592000000 | 30240 | + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-10-18 01:23:00.001 | 2020-11-18 01:23:00.001 | 2678400000 | 44640 | + 2020-10-27 01:23:00.001 | 2020-11-27 01:23:00.001 | 2678400000 | 44640 | + 2020-11-05 01:23:00.001 | 2020-12-05 01:23:00.001 | 2592000000 | 43200 | + 2020-11-14 01:23:00.001 | 2020-12-14 01:23:00.001 | 2592000000 | 36556 | + 2020-11-23 01:23:00.001 | 2020-12-23 01:23:00.001 | 2592000000 | 23596 | + 2020-12-02 01:23:00.001 | 2021-01-02 01:23:00.001 | 2678400000 | 10636 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-13 01:23:00.001 | 2020-11-13 01:23:00.001 | 2678400000 | 5760 | + 2020-10-22 01:23:00.001 | 2020-11-22 01:23:00.001 | 2678400000 | 18720 | + 2020-10-31 01:23:00.001 | 2020-11-30 01:23:00.001 | 2592000000 | 30240 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-11-18 01:23:00.001 | 2020-12-18 01:23:00.001 | 2592000000 | 30796 | + 2020-11-27 01:23:00.001 | 2020-12-27 01:23:00.001 | 2592000000 | 17836 | + 2020-12-06 01:23:00.001 | 2021-01-06 01:23:00.001 | 2678400000 | 4876 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 01:23:00.001 | 2020-12-12 01:23:00.001 | 2592000000 | 556 | + 2020-11-21 01:23:00.001 | 2020-12-21 01:23:00.001 | 2592000000 | 556 | + 2020-11-30 01:23:00.001 | 2020-12-30 01:23:00.001 | 2592000000 | 556 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 5760 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 24480 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 44640 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 43200 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 32237 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 13517 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-14 01:23:00.000 | 2020-11-14 01:23:00.000 | 2678400000 | 7200 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 25920 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-11-22 01:23:00.000 | 2020-12-22 01:23:00.000 | 2592000000 | 25037 | + 2020-12-05 01:23:00.000 | 2021-01-05 01:23:00.000 | 2678400000 | 6317 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-13 01:23:00.000 | 2020-12-13 01:23:00.000 | 2592000000 | 557 | + 2020-11-26 01:23:00.000 | 2020-12-26 01:23:00.000 | 2592000000 | 557 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > i1 interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 01:00:00.000 | 3600000 | 60 | + 2020-10-01 01:00:00.000 | 2020-10-01 02:00:00.000 | 3600000 | 60 | + 2020-10-01 02:00:00.000 | 2020-10-01 03:00:00.000 | 3600000 | 60 | + 2020-10-01 03:00:00.000 | 2020-10-01 04:00:00.000 | 3600000 | 60 | + 2020-10-01 04:00:00.000 | 2020-10-01 05:00:00.000 | 3600000 | 60 | + 2020-10-01 05:00:00.000 | 2020-10-01 06:00:00.000 | 3600000 | 60 | + 2020-10-01 06:00:00.000 | 2020-10-01 07:00:00.000 | 3600000 | 60 | + 2020-10-01 07:00:00.000 | 2020-10-01 08:00:00.000 | 3600000 | 60 | + 2020-10-01 08:00:00.000 | 2020-10-01 09:00:00.000 | 3600000 | 60 | + 2020-10-01 09:00:00.000 | 2020-10-01 10:00:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > i1 and ts <= bi2 interval(1d, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= i1 or ts < bi2 interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-11-01 00:00:00.000 | 2678400000 | 44640 | + 2020-11-01 00:00:00.000 | 2020-12-01 00:00:00.000 | 2592000000 | 43200 | + 2020-12-01 00:00:00.000 | 2021-01-01 00:00:00.000 | 2678400000 | 12160 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d = '2020-11-11 23:32:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 23:00:00.000 | 2020-11-13 00:00:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d in ('2020-10-08 01:23:00', '2020-11-08 01:23:00', '2020-12-08 01:23:00', '2020-12-18 01:23:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 00:00:00.000 | 2020-10-10 00:00:00.000 | 86400000 | 1 | + 2020-11-09 00:00:00.000 | 2020-11-10 00:00:00.000 | 86400000 | 1 | + 2020-12-09 00:00:00.000 | 2020-12-10 00:00:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d >= '2020-11-08 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 00:00:00.000 | 2020-12-01 00:00:00.000 | 2592000000 | 31597 | + 2020-12-01 00:00:00.000 | 2021-01-01 00:00:00.000 | 2678400000 | 12160 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-19 11:22:00.000 | 2020-11-19 11:22:01.000 | 1000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 11:23:01.000 | 1000 | 1 | + 2020-11-19 11:24:00.000 | 2020-11-19 11:24:01.000 | 1000 | 1 | + 2020-11-19 11:25:00.000 | 2020-11-19 11:25:01.000 | 1000 | 1 | + 2020-11-19 11:26:00.000 | 2020-11-19 11:26:01.000 | 1000 | 1 | + 2020-11-19 11:27:00.000 | 2020-11-19 11:27:01.000 | 1000 | 1 | + 2020-11-19 11:28:00.000 | 2020-11-19 11:28:01.000 | 1000 | 1 | + 2020-11-19 11:29:00.000 | 2020-11-19 11:29:01.000 | 1000 | 1 | + 2020-11-19 11:30:00.000 | 2020-11-19 11:30:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:46:01.000 | 1000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:47:01.000 | 1000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:48:01.000 | 1000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:49:01.000 | 1000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:50:01.000 | 1000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:51:01.000 | 1000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:52:01.000 | 1000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:53:01.000 | 1000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:54:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:46:01.000 | 1000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:47:01.000 | 1000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:48:01.000 | 1000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:49:01.000 | 1000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:50:01.000 | 1000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:51:01.000 | 1000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:52:01.000 | 1000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:53:01.000 | 1000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:54:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-19 11:22:00.000 | 2020-11-19 11:23:00.000 | 60000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 11:24:00.000 | 60000 | 1 | + 2020-11-19 11:24:00.000 | 2020-11-19 11:25:00.000 | 60000 | 1 | + 2020-11-19 11:25:00.000 | 2020-11-19 11:26:00.000 | 60000 | 1 | + 2020-11-19 11:26:00.000 | 2020-11-19 11:27:00.000 | 60000 | 1 | + 2020-11-19 11:27:00.000 | 2020-11-19 11:28:00.000 | 60000 | 1 | + 2020-11-19 11:28:00.000 | 2020-11-19 11:29:00.000 | 60000 | 1 | + 2020-11-19 11:29:00.000 | 2020-11-19 11:30:00.000 | 60000 | 1 | + 2020-11-19 11:30:00.000 | 2020-11-19 11:31:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:47:00.000 | 60000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:48:00.000 | 60000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:49:00.000 | 60000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:50:00.000 | 60000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:51:00.000 | 60000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:52:00.000 | 60000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:53:00.000 | 60000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:54:00.000 | 60000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:55:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:47:00.000 | 60000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:48:00.000 | 60000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:49:00.000 | 60000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:50:00.000 | 60000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:51:00.000 | 60000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:52:00.000 | 60000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:53:00.000 | 60000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:54:00.000 | 60000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:55:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-19 10:23:00.000 | 2020-11-19 11:23:00.000 | 3600000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 12:23:00.000 | 3600000 | 60 | + 2020-11-19 12:23:00.000 | 2020-11-19 13:23:00.000 | 3600000 | 60 | + 2020-11-19 13:23:00.000 | 2020-11-19 14:23:00.000 | 3600000 | 60 | + 2020-11-19 14:23:00.000 | 2020-11-19 15:23:00.000 | 3600000 | 60 | + 2020-11-19 15:23:00.000 | 2020-11-19 16:23:00.000 | 3600000 | 60 | + 2020-11-19 16:23:00.000 | 2020-11-19 17:23:00.000 | 3600000 | 60 | + 2020-11-19 17:23:00.000 | 2020-11-19 18:23:00.000 | 3600000 | 60 | + 2020-11-19 18:23:00.000 | 2020-11-19 19:23:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-03 00:45:00.000 | 3600000 | 60 | + 2020-10-03 00:45:00.000 | 2020-10-03 01:45:00.000 | 3600000 | 60 | + 2020-10-03 01:45:00.000 | 2020-10-03 02:45:00.000 | 3600000 | 60 | + 2020-10-03 02:45:00.000 | 2020-10-03 03:45:00.000 | 3600000 | 60 | + 2020-10-03 03:45:00.000 | 2020-10-03 04:45:00.000 | 3600000 | 60 | + 2020-10-03 04:45:00.000 | 2020-10-03 05:45:00.000 | 3600000 | 60 | + 2020-10-03 05:45:00.000 | 2020-10-03 06:45:00.000 | 3600000 | 60 | + 2020-10-03 06:45:00.000 | 2020-10-03 07:45:00.000 | 3600000 | 60 | + 2020-10-03 07:45:00.000 | 2020-10-03 08:45:00.000 | 3600000 | 60 | + 2020-10-03 08:45:00.000 | 2020-10-03 09:45:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:00:00.000 | 2020-10-03 00:00:00.000 | 3600000 | 15 | + 2020-10-03 00:00:00.000 | 2020-10-03 01:00:00.000 | 3600000 | 60 | + 2020-10-03 01:00:00.000 | 2020-10-03 02:00:00.000 | 3600000 | 60 | + 2020-10-03 02:00:00.000 | 2020-10-03 03:00:00.000 | 3600000 | 60 | + 2020-10-03 03:00:00.000 | 2020-10-03 04:00:00.000 | 3600000 | 60 | + 2020-10-03 04:00:00.000 | 2020-10-03 05:00:00.000 | 3600000 | 60 | + 2020-10-03 05:00:00.000 | 2020-10-03 06:00:00.000 | 3600000 | 60 | + 2020-10-03 06:00:00.000 | 2020-10-03 07:00:00.000 | 3600000 | 60 | + 2020-10-03 07:00:00.000 | 2020-10-03 08:00:00.000 | 3600000 | 60 | + 2020-10-03 08:00:00.000 | 2020-10-03 09:00:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-19 01:23:00.000 | 2020-11-20 01:23:00.000 | 86400000 | 841 | + 2020-11-20 01:23:00.000 | 2020-11-21 01:23:00.000 | 86400000 | 1440 | + 2020-11-21 01:23:00.000 | 2020-11-22 01:23:00.000 | 86400000 | 1440 | + 2020-11-22 01:23:00.000 | 2020-11-23 01:23:00.000 | 86400000 | 1440 | + 2020-11-23 01:23:00.000 | 2020-11-24 01:23:00.000 | 86400000 | 1440 | + 2020-11-24 01:23:00.000 | 2020-11-25 01:23:00.000 | 86400000 | 1440 | + 2020-11-25 01:23:00.000 | 2020-11-26 01:23:00.000 | 86400000 | 1440 | + 2020-11-26 01:23:00.000 | 2020-11-27 01:23:00.000 | 86400000 | 1440 | + 2020-11-27 01:23:00.000 | 2020-11-28 01:23:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-03 23:45:00.000 | 86400000 | 1440 | + 2020-10-03 23:45:00.000 | 2020-10-04 23:45:00.000 | 86400000 | 1440 | + 2020-10-04 23:45:00.000 | 2020-10-05 23:45:00.000 | 86400000 | 1440 | + 2020-10-05 23:45:00.000 | 2020-10-06 23:45:00.000 | 86400000 | 1440 | + 2020-10-06 23:45:00.000 | 2020-10-07 23:45:00.000 | 86400000 | 1440 | + 2020-10-07 23:45:00.000 | 2020-10-08 23:45:00.000 | 86400000 | 1440 | + 2020-10-08 23:45:00.000 | 2020-10-09 23:45:00.000 | 86400000 | 1440 | + 2020-10-09 23:45:00.000 | 2020-10-10 23:45:00.000 | 86400000 | 1440 | + 2020-10-10 23:45:00.000 | 2020-10-11 23:45:00.000 | 86400000 | 1440 | + 2020-10-11 23:45:00.000 | 2020-10-12 23:45:00.000 | 86400000 | 1427 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 00:00:00.000 | 2020-10-03 00:00:00.000 | 86400000 | 15 | + 2020-10-03 00:00:00.000 | 2020-10-04 00:00:00.000 | 86400000 | 1440 | + 2020-10-04 00:00:00.000 | 2020-10-05 00:00:00.000 | 86400000 | 1440 | + 2020-10-05 00:00:00.000 | 2020-10-06 00:00:00.000 | 86400000 | 1440 | + 2020-10-06 00:00:00.000 | 2020-10-07 00:00:00.000 | 86400000 | 1440 | + 2020-10-07 00:00:00.000 | 2020-10-08 00:00:00.000 | 86400000 | 1440 | + 2020-10-08 00:00:00.000 | 2020-10-09 00:00:00.000 | 86400000 | 1440 | + 2020-10-09 00:00:00.000 | 2020-10-10 00:00:00.000 | 86400000 | 1440 | + 2020-10-10 00:00:00.000 | 2020-10-11 00:00:00.000 | 86400000 | 1440 | + 2020-10-11 00:00:00.000 | 2020-10-12 00:00:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-19 11:21:59.100 | 2020-11-19 11:22:00.100 | 1000 | 1 | + 2020-11-19 11:21:59.800 | 2020-11-19 11:22:00.800 | 1000 | 1 | + 2020-11-19 11:22:59.300 | 2020-11-19 11:23:00.300 | 1000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 11:23:01.000 | 1000 | 1 | + 2020-11-19 11:23:59.500 | 2020-11-19 11:24:00.500 | 1000 | 1 | + 2020-11-19 11:24:59.700 | 2020-11-19 11:25:00.700 | 1000 | 1 | + 2020-11-19 11:25:59.200 | 2020-11-19 11:26:00.200 | 1000 | 1 | + 2020-11-19 11:25:59.900 | 2020-11-19 11:26:00.900 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:59.300 | 2020-10-02 23:45:00.300 | 1000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + 2020-10-02 23:45:59.500 | 2020-10-02 23:46:00.500 | 1000 | 1 | + 2020-10-02 23:46:59.700 | 2020-10-02 23:47:00.700 | 1000 | 1 | + 2020-10-02 23:47:59.200 | 2020-10-02 23:48:00.200 | 1000 | 1 | + 2020-10-02 23:47:59.900 | 2020-10-02 23:48:00.900 | 1000 | 1 | + 2020-10-02 23:48:59.400 | 2020-10-02 23:49:00.400 | 1000 | 1 | + 2020-10-02 23:49:59.600 | 2020-10-02 23:50:00.600 | 1000 | 1 | + 2020-10-02 23:50:59.100 | 2020-10-02 23:51:00.100 | 1000 | 1 | + 2020-10-02 23:50:59.800 | 2020-10-02 23:51:00.800 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:59.600 | 2020-10-02 23:45:00.600 | 1000 | 1 | + 2020-10-02 23:45:59.100 | 2020-10-02 23:46:00.100 | 1000 | 1 | + 2020-10-02 23:45:59.800 | 2020-10-02 23:46:00.800 | 1000 | 1 | + 2020-10-02 23:46:59.300 | 2020-10-02 23:47:00.300 | 1000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:47:01.000 | 1000 | 1 | + 2020-10-02 23:47:59.500 | 2020-10-02 23:48:00.500 | 1000 | 1 | + 2020-10-02 23:48:59.700 | 2020-10-02 23:49:00.700 | 1000 | 1 | + 2020-10-02 23:49:59.200 | 2020-10-02 23:50:00.200 | 1000 | 1 | + 2020-10-02 23:49:59.900 | 2020-10-02 23:50:00.900 | 1000 | 1 | + 2020-10-02 23:50:59.400 | 2020-10-02 23:51:00.400 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-19 11:21:27.000 | 2020-11-19 11:22:27.000 | 60000 | 1 | + 2020-11-19 11:22:04.000 | 2020-11-19 11:23:04.000 | 60000 | 1 | + 2020-11-19 11:22:41.000 | 2020-11-19 11:23:41.000 | 60000 | 1 | + 2020-11-19 11:23:18.000 | 2020-11-19 11:24:18.000 | 60000 | 1 | + 2020-11-19 11:23:55.000 | 2020-11-19 11:24:55.000 | 60000 | 1 | + 2020-11-19 11:24:32.000 | 2020-11-19 11:25:32.000 | 60000 | 1 | + 2020-11-19 11:25:09.000 | 2020-11-19 11:26:09.000 | 60000 | 1 | + 2020-11-19 11:25:46.000 | 2020-11-19 11:26:46.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:23.000 | 2020-10-02 23:45:23.000 | 60000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + 2020-10-02 23:45:37.000 | 2020-10-02 23:46:37.000 | 60000 | 1 | + 2020-10-02 23:46:14.000 | 2020-10-02 23:47:14.000 | 60000 | 1 | + 2020-10-02 23:46:51.000 | 2020-10-02 23:47:51.000 | 60000 | 1 | + 2020-10-02 23:47:28.000 | 2020-10-02 23:48:28.000 | 60000 | 1 | + 2020-10-02 23:48:05.000 | 2020-10-02 23:49:05.000 | 60000 | 1 | + 2020-10-02 23:48:42.000 | 2020-10-02 23:49:42.000 | 60000 | 1 | + 2020-10-02 23:49:19.000 | 2020-10-02 23:50:19.000 | 60000 | 1 | + 2020-10-02 23:49:56.000 | 2020-10-02 23:50:56.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:07.000 | 2020-10-02 23:45:07.000 | 60000 | 1 | + 2020-10-02 23:44:44.000 | 2020-10-02 23:45:44.000 | 60000 | 1 | + 2020-10-02 23:45:21.000 | 2020-10-02 23:46:21.000 | 60000 | 1 | + 2020-10-02 23:45:58.000 | 2020-10-02 23:46:58.000 | 60000 | 1 | + 2020-10-02 23:46:35.000 | 2020-10-02 23:47:35.000 | 60000 | 1 | + 2020-10-02 23:47:12.000 | 2020-10-02 23:48:12.000 | 60000 | 1 | + 2020-10-02 23:47:49.000 | 2020-10-02 23:48:49.000 | 60000 | 1 | + 2020-10-02 23:48:26.000 | 2020-10-02 23:49:26.000 | 60000 | 1 | + 2020-10-02 23:49:03.000 | 2020-10-02 23:50:03.000 | 60000 | 1 | + 2020-10-02 23:49:40.000 | 2020-10-02 23:50:40.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 00:29:00.000 | 2020-10-09 01:29:00.000 | 3600000 | 1 | + 2020-10-09 00:56:00.000 | 2020-10-09 01:56:00.000 | 3600000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-19 10:32:00.000 | 2020-11-19 11:32:00.000 | 3600000 | 10 | + 2020-11-19 10:59:00.000 | 2020-11-19 11:59:00.000 | 3600000 | 37 | + 2020-11-19 11:26:00.000 | 2020-11-19 12:26:00.000 | 3600000 | 60 | + 2020-11-19 11:53:00.000 | 2020-11-19 12:53:00.000 | 3600000 | 60 | + 2020-11-19 12:20:00.000 | 2020-11-19 13:20:00.000 | 3600000 | 60 | + 2020-11-19 12:47:00.000 | 2020-11-19 13:47:00.000 | 3600000 | 60 | + 2020-11-19 13:14:00.000 | 2020-11-19 14:14:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 22:51:00.000 | 2020-10-02 23:51:00.000 | 3600000 | 6 | + 2020-10-02 23:18:00.000 | 2020-10-03 00:18:00.000 | 3600000 | 33 | + 2020-10-02 23:45:00.000 | 2020-10-03 00:45:00.000 | 3600000 | 60 | + 2020-10-03 00:12:00.000 | 2020-10-03 01:12:00.000 | 3600000 | 60 | + 2020-10-03 00:39:00.000 | 2020-10-03 01:39:00.000 | 3600000 | 60 | + 2020-10-03 01:06:00.000 | 2020-10-03 02:06:00.000 | 3600000 | 60 | + 2020-10-03 01:33:00.000 | 2020-10-03 02:33:00.000 | 3600000 | 60 | + 2020-10-03 02:00:00.000 | 2020-10-03 03:00:00.000 | 3600000 | 60 | + 2020-10-03 02:27:00.000 | 2020-10-03 03:27:00.000 | 3600000 | 60 | + 2020-10-03 02:54:00.000 | 2020-10-03 03:54:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 22:51:00.000 | 2020-10-02 23:51:00.000 | 3600000 | 6 | + 2020-10-02 23:18:00.000 | 2020-10-03 00:18:00.000 | 3600000 | 33 | + 2020-10-02 23:45:00.000 | 2020-10-03 00:45:00.000 | 3600000 | 60 | + 2020-10-03 00:12:00.000 | 2020-10-03 01:12:00.000 | 3600000 | 60 | + 2020-10-03 00:39:00.000 | 2020-10-03 01:39:00.000 | 3600000 | 60 | + 2020-10-03 01:06:00.000 | 2020-10-03 02:06:00.000 | 3600000 | 60 | + 2020-10-03 01:33:00.000 | 2020-10-03 02:33:00.000 | 3600000 | 60 | + 2020-10-03 02:00:00.000 | 2020-10-03 03:00:00.000 | 3600000 | 60 | + 2020-10-03 02:27:00.000 | 2020-10-03 03:27:00.000 | 3600000 | 60 | + 2020-10-03 02:54:00.000 | 2020-10-03 03:54:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-08 08:23:00.000 | 2020-10-09 08:23:00.000 | 86400000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-19 03:23:00.000 | 2020-11-20 03:23:00.000 | 86400000 | 961 | + 2020-11-19 20:23:00.000 | 2020-11-20 20:23:00.000 | 86400000 | 1440 | + 2020-11-20 13:23:00.000 | 2020-11-21 13:23:00.000 | 86400000 | 1440 | + 2020-11-21 06:23:00.000 | 2020-11-22 06:23:00.000 | 86400000 | 1440 | + 2020-11-21 23:23:00.000 | 2020-11-22 23:23:00.000 | 86400000 | 1440 | + 2020-11-22 16:23:00.000 | 2020-11-23 16:23:00.000 | 86400000 | 1440 | + 2020-11-23 09:23:00.000 | 2020-11-24 09:23:00.000 | 86400000 | 1440 | + 2020-11-24 02:23:00.000 | 2020-11-25 02:23:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 06:45:00.000 | 2020-10-03 06:45:00.000 | 86400000 | 420 | + 2020-10-02 23:45:00.000 | 2020-10-03 23:45:00.000 | 86400000 | 1440 | + 2020-10-03 16:45:00.000 | 2020-10-04 16:45:00.000 | 86400000 | 1440 | + 2020-10-04 09:45:00.000 | 2020-10-05 09:45:00.000 | 86400000 | 1440 | + 2020-10-05 02:45:00.000 | 2020-10-06 02:45:00.000 | 86400000 | 1440 | + 2020-10-05 19:45:00.000 | 2020-10-06 19:45:00.000 | 86400000 | 1440 | + 2020-10-06 12:45:00.000 | 2020-10-07 12:45:00.000 | 86400000 | 1440 | + 2020-10-07 05:45:00.000 | 2020-10-08 05:45:00.000 | 86400000 | 1440 | + 2020-10-07 22:45:00.000 | 2020-10-08 22:45:00.000 | 86400000 | 1440 | + 2020-10-08 15:45:00.000 | 2020-10-09 15:45:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 02:00:00.000 | 2020-10-03 02:00:00.000 | 86400000 | 135 | + 2020-10-02 19:00:00.000 | 2020-10-03 19:00:00.000 | 86400000 | 1155 | + 2020-10-03 12:00:00.000 | 2020-10-04 12:00:00.000 | 86400000 | 1440 | + 2020-10-04 05:00:00.000 | 2020-10-05 05:00:00.000 | 86400000 | 1440 | + 2020-10-04 22:00:00.000 | 2020-10-05 22:00:00.000 | 86400000 | 1440 | + 2020-10-05 15:00:00.000 | 2020-10-06 15:00:00.000 | 86400000 | 1440 | + 2020-10-06 08:00:00.000 | 2020-10-07 08:00:00.000 | 86400000 | 1440 | + 2020-10-07 01:00:00.000 | 2020-10-08 01:00:00.000 | 86400000 | 1440 | + 2020-10-07 18:00:00.000 | 2020-10-08 18:00:00.000 | 86400000 | 1440 | + 2020-10-08 11:00:00.000 | 2020-10-09 11:00:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 28201 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-11-02 23:45:00.000 | 2678400000 | 14387 | + 2020-12-02 23:45:00.000 | 2021-01-02 23:45:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-11-01 00:00:00.000 | 2678400000 | 14387 | + 2020-11-01 00:00:00.000 | 2020-12-01 00:00:00.000 | 2592000000 | 1 | + 2020-12-01 00:00:00.000 | 2021-01-01 00:00:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.000 | 2020-10-12 01:23:00.000 | 2592000000 | 1 | + 2020-09-21 01:23:00.000 | 2020-10-21 01:23:00.000 | 2592000000 | 1 | + 2020-09-30 01:23:00.000 | 2020-10-30 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 10921 | + 2020-11-05 01:23:00.000 | 2020-12-05 01:23:00.000 | 2592000000 | 22441 | + 2020-11-14 01:23:00.000 | 2020-12-14 01:23:00.000 | 2592000000 | 28758 | + 2020-11-23 01:23:00.000 | 2020-12-23 01:23:00.000 | 2592000000 | 23597 | + 2020-12-02 01:23:00.000 | 2021-01-02 01:23:00.000 | 2678400000 | 10637 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-05 23:45:00.000 | 2020-10-05 23:45:00.000 | 2592000000 | 4320 | + 2020-09-14 23:45:00.000 | 2020-10-14 23:45:00.000 | 2592000000 | 14387 | + 2020-09-23 23:45:00.000 | 2020-10-23 23:45:00.000 | 2592000000 | 14387 | + 2020-10-02 23:45:00.000 | 2020-11-02 23:45:00.000 | 2678400000 | 14387 | + 2020-10-11 23:45:00.000 | 2020-11-11 23:45:00.000 | 2678400000 | 1427 | + 2020-11-07 23:45:00.000 | 2020-12-07 23:45:00.000 | 2592000000 | 1 | + 2020-11-16 23:45:00.000 | 2020-12-16 23:45:00.000 | 2592000000 | 1 | + 2020-11-25 23:45:00.000 | 2020-12-25 23:45:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-08 00:00:00.000 | 2020-10-08 00:00:00.000 | 2592000000 | 7215 | + 2020-09-17 00:00:00.000 | 2020-10-17 00:00:00.000 | 2592000000 | 14387 | + 2020-09-26 00:00:00.000 | 2020-10-26 00:00:00.000 | 2592000000 | 14387 | + 2020-10-05 00:00:00.000 | 2020-11-05 00:00:00.000 | 2678400000 | 11492 | + 2020-10-14 00:00:00.000 | 2020-11-14 00:00:00.000 | 2678400000 | 1 | + 2020-10-23 00:00:00.000 | 2020-11-23 00:00:00.000 | 2678400000 | 1 | + 2020-11-01 00:00:00.000 | 2020-12-01 00:00:00.000 | 2592000000 | 1 | + 2020-11-10 00:00:00.000 | 2020-12-10 00:00:00.000 | 2592000000 | 1 | + 2020-11-19 00:00:00.000 | 2020-12-19 00:00:00.000 | 2592000000 | 1 | + 2020-11-28 00:00:00.000 | 2020-12-28 00:00:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 1 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 3721 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 21001 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 28758 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 13517 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-06 23:45:00.000 | 2020-10-06 23:45:00.000 | 2592000000 | 5760 | + 2020-09-19 23:45:00.000 | 2020-10-19 23:45:00.000 | 2592000000 | 14387 | + 2020-10-02 23:45:00.000 | 2020-11-02 23:45:00.000 | 2678400000 | 14387 | + 2020-11-10 23:45:00.000 | 2020-12-10 23:45:00.000 | 2592000000 | 1 | + 2020-11-23 23:45:00.000 | 2020-12-23 23:45:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-07 00:00:00.000 | 2020-10-07 00:00:00.000 | 2592000000 | 5775 | + 2020-09-20 00:00:00.000 | 2020-10-20 00:00:00.000 | 2592000000 | 14387 | + 2020-10-03 00:00:00.000 | 2020-11-03 00:00:00.000 | 2678400000 | 14372 | + 2020-10-16 00:00:00.000 | 2020-11-16 00:00:00.000 | 2678400000 | 1 | + 2020-10-29 00:00:00.000 | 2020-11-29 00:00:00.000 | 2678400000 | 1 | + 2020-11-11 00:00:00.000 | 2020-12-11 00:00:00.000 | 2592000000 | 1 | + 2020-11-24 00:00:00.000 | 2020-12-24 00:00:00.000 | 2592000000 | 1 | + 2020-12-07 00:00:00.000 | 2021-01-07 00:00:00.000 | 2678400000 | 1 | + +taos> select * from test.sta; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-10-01 00:00:00.000 | 2020-10-01 00:01:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:01:00.000 | 2020-10-01 00:02:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:02:00.000 | 2020-10-01 00:03:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:03:00.000 | 2020-10-01 00:04:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:04:00.000 | 2020-10-01 00:05:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:05:00.000 | 2020-10-01 00:06:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:06:00.000 | 2020-10-01 00:07:00.000 | 60000 | 1 | 0 | + 2020-10-01 00:07:00.000 | 2020-10-01 00:08:00.000 | 60000 | 1 | 0 | + +taos> select * from test.stb; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-11-01 22:51:00.000 | 2020-11-01 23:51:00.000 | 3600000 | 1 | 0 | + 2020-11-01 23:18:00.000 | 2020-11-02 00:18:00.000 | 3600000 | 1 | 0 | + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | 0 | + +taos> select * from test.stc; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-10-17 23:32:00.000 | 2020-11-17 23:32:00.000 | 2678400000 | 1 | 0 | + 2020-10-30 23:32:00.000 | 2020-11-30 23:32:00.000 | 2678400000 | 1 | 0 | + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | 0 | + +taos> select * from test.std; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | 0 | + 2020-11-09 01:23:00.000 | 2020-11-09 01:23:01.000 | 1000 | 1 | 0 | + 2020-12-09 01:23:00.000 | 2020-12-09 01:23:01.000 | 1000 | 1 | 0 | + +taos> select * from test.ste; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-12-08 08:23:00.001 | 2020-12-09 08:23:00.001 | 86400000 | 420 | 0 | + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | 0 | + +taos> select * from test.stf; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | 0 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | 0 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | 0 | + +taos> select * from test.stg; + _wstart | _wend | _wduration | count(*) | group_id | +============================================================================================================================ + 2020-10-14 01:23:00.000 | 2020-11-14 01:23:00.000 | 2678400000 | 7200 | 0 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 25920 | 0 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | 0 | + 2020-11-22 01:23:00.000 | 2020-12-22 01:23:00.000 | 2592000000 | 25037 | 0 | + 2020-12-05 01:23:00.000 | 2021-01-05 01:23:00.000 | 2678400000 | 6317 | 0 | + diff --git a/tests/army/query/function/ans/interval_diff_tz.csv b/tests/army/query/function/ans/interval_diff_tz.csv new file mode 100644 index 0000000000..ef6178ec4a --- /dev/null +++ b/tests/army/query/function/ans/interval_diff_tz.csv @@ -0,0 +1,1380 @@ + +taos> select _wstart, _wend, _wduration, count(*) from test.st interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 00:01:00.000 | 60000 | 1 | + 2020-10-01 00:01:00.000 | 2020-10-01 00:02:00.000 | 60000 | 1 | + 2020-10-01 00:02:00.000 | 2020-10-01 00:03:00.000 | 60000 | 1 | + 2020-10-01 00:03:00.000 | 2020-10-01 00:04:00.000 | 60000 | 1 | + 2020-10-01 00:04:00.000 | 2020-10-01 00:05:00.000 | 60000 | 1 | + 2020-10-01 00:05:00.000 | 2020-10-01 00:06:00.000 | 60000 | 1 | + 2020-10-01 00:06:00.000 | 2020-10-01 00:07:00.000 | 60000 | 1 | + 2020-10-01 00:07:00.000 | 2020-10-01 00:08:00.000 | 60000 | 1 | + 2020-10-01 00:08:00.000 | 2020-10-01 00:09:00.000 | 60000 | 1 | + 2020-10-01 00:09:00.000 | 2020-10-01 00:10:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts < '2020-10-01 00:07:19' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 00:01:00.000 | 60000 | 1 | + 2020-10-01 00:01:00.000 | 2020-10-01 00:02:00.000 | 60000 | 1 | + 2020-10-01 00:02:00.000 | 2020-10-01 00:03:00.000 | 60000 | 1 | + 2020-10-01 00:03:00.000 | 2020-10-01 00:04:00.000 | 60000 | 1 | + 2020-10-01 00:04:00.000 | 2020-10-01 00:05:00.000 | 60000 | 1 | + 2020-10-01 00:05:00.000 | 2020-10-01 00:06:00.000 | 60000 | 1 | + 2020-10-01 00:06:00.000 | 2020-10-01 00:07:00.000 | 60000 | 1 | + 2020-10-01 00:07:00.000 | 2020-10-01 00:08:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts <= '2020-09-30 23:59:59' interval(1h, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-12-01 23:45:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-01 23:45:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-12-01 23:45:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:59.300 | 2020-10-01 23:45:00.300 | 1000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:23.000 | 2020-10-01 23:45:23.000 | 60000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 22:51:00.000 | 2020-11-01 23:51:00.000 | 3600000 | 1 | + 2020-11-01 23:18:00.000 | 2020-11-02 00:18:00.000 | 3600000 | 1 | + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-12-01 23:45:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 06:45:00.000 | 2020-12-02 06:45:00.000 | 86400000 | 1 | + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:59.300 | 2020-10-01 23:45:00.300 | 1000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 23:44:23.000 | 2020-10-01 23:45:23.000 | 60000 | 1 | + 2020-10-01 23:45:00.000 | 2020-10-01 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-01 23:45:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-01 22:51:00.000 | 2020-11-01 23:51:00.000 | 3600000 | 1 | + 2020-11-01 23:18:00.000 | 2020-11-02 00:18:00.000 | 3600000 | 1 | + 2020-11-01 23:45:00.000 | 2020-11-02 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-12-01 23:45:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-01 06:45:00.000 | 2020-12-02 06:45:00.000 | 86400000 | 1 | + 2020-12-01 23:45:00.000 | 2020-12-02 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:43' interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:43') interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:43' interval(1n, auto) sliding(9d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-16 23:32:00.000 | 2020-11-16 23:32:00.000 | 2678400000 | 1 | + 2020-10-25 23:32:00.000 | 2020-11-25 23:32:00.000 | 2678400000 | 1 | + 2020-11-03 23:32:00.000 | 2020-12-03 23:32:00.000 | 2592000000 | 1 | + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:43') interval(1n, auto) sliding(13d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-17 23:32:00.000 | 2020-11-17 23:32:00.000 | 2678400000 | 1 | + 2020-10-30 23:32:00.000 | 2020-11-29 23:32:00.000 | 2592000000 | 1 | + 2020-11-12 23:32:00.000 | 2020-12-12 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.001 | 2020-10-09 01:24:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:25:59.001 | 2020-10-09 01:26:00.001 | 1000 | 1 | + 2020-10-09 01:26:59.001 | 2020-10-09 01:27:00.001 | 1000 | 1 | + 2020-10-09 01:27:59.001 | 2020-10-09 01:28:00.001 | 1000 | 1 | + 2020-10-09 01:28:59.001 | 2020-10-09 01:29:00.001 | 1000 | 1 | + 2020-10-09 01:29:59.001 | 2020-10-09 01:30:00.001 | 1000 | 1 | + 2020-10-09 01:30:59.001 | 2020-10-09 01:31:00.001 | 1000 | 1 | + 2020-10-09 01:31:59.001 | 2020-10-09 01:32:00.001 | 1000 | 1 | + 2020-10-09 01:32:59.001 | 2020-10-09 01:33:00.001 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:24:00.001 | 2020-10-09 01:25:00.001 | 60000 | 1 | + 2020-10-09 01:25:00.001 | 2020-10-09 01:26:00.001 | 60000 | 1 | + 2020-10-09 01:26:00.001 | 2020-10-09 01:27:00.001 | 60000 | 1 | + 2020-10-09 01:27:00.001 | 2020-10-09 01:28:00.001 | 60000 | 1 | + 2020-10-09 01:28:00.001 | 2020-10-09 01:29:00.001 | 60000 | 1 | + 2020-10-09 01:29:00.001 | 2020-10-09 01:30:00.001 | 60000 | 1 | + 2020-10-09 01:30:00.001 | 2020-10-09 01:31:00.001 | 60000 | 1 | + 2020-10-09 01:31:00.001 | 2020-10-09 01:32:00.001 | 60000 | 1 | + 2020-10-09 01:32:00.001 | 2020-10-09 01:33:00.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 02:23:00.001 | 2020-11-09 03:23:00.001 | 3600000 | 60 | + 2020-11-09 03:23:00.001 | 2020-11-09 04:23:00.001 | 3600000 | 60 | + 2020-11-09 04:23:00.001 | 2020-11-09 05:23:00.001 | 3600000 | 60 | + 2020-11-09 05:23:00.001 | 2020-11-09 06:23:00.001 | 3600000 | 60 | + 2020-11-09 06:23:00.001 | 2020-11-09 07:23:00.001 | 3600000 | 60 | + 2020-11-09 07:23:00.001 | 2020-11-09 08:23:00.001 | 3600000 | 60 | + 2020-11-09 08:23:00.001 | 2020-11-09 09:23:00.001 | 3600000 | 60 | + 2020-11-09 09:23:00.001 | 2020-11-09 10:23:00.001 | 3600000 | 60 | + 2020-11-09 10:23:00.001 | 2020-11-09 11:23:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:24:01.000 | 1000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:25:01.000 | 1000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:26:01.000 | 1000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:27:01.000 | 1000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:28:01.000 | 1000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:29:01.000 | 1000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:30:01.000 | 1000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:31:01.000 | 1000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:32:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:25:00.000 | 60000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:26:00.000 | 60000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:27:00.000 | 60000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:28:00.000 | 60000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:29:00.000 | 60000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:30:00.000 | 60000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:31:00.000 | 60000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:32:00.000 | 60000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:33:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 02:23:00.000 | 2020-11-09 03:23:00.000 | 3600000 | 60 | + 2020-11-09 03:23:00.000 | 2020-11-09 04:23:00.000 | 3600000 | 60 | + 2020-11-09 04:23:00.000 | 2020-11-09 05:23:00.000 | 3600000 | 60 | + 2020-11-09 05:23:00.000 | 2020-11-09 06:23:00.000 | 3600000 | 60 | + 2020-11-09 06:23:00.000 | 2020-11-09 07:23:00.000 | 3600000 | 60 | + 2020-11-09 07:23:00.000 | 2020-11-09 08:23:00.000 | 3600000 | 60 | + 2020-11-09 08:23:00.000 | 2020-11-09 09:23:00.000 | 3600000 | 60 | + 2020-11-09 09:23:00.000 | 2020-11-09 10:23:00.000 | 3600000 | 60 | + 2020-11-09 10:23:00.000 | 2020-11-09 11:23:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-09 01:23:01.000 | 1000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-09 01:23:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-09 01:24:00.000 | 60000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-09 01:24:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-09 02:23:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-09 01:23:00.000 | 2020-11-10 01:23:00.000 | 86400000 | 1 | + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.501 | 2020-10-09 01:24:00.501 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.701 | 2020-10-09 01:25:00.701 | 1000 | 1 | + 2020-10-09 01:25:59.201 | 2020-10-09 01:26:00.201 | 1000 | 1 | + 2020-10-09 01:25:59.901 | 2020-10-09 01:26:00.901 | 1000 | 1 | + 2020-10-09 01:26:59.401 | 2020-10-09 01:27:00.401 | 1000 | 1 | + 2020-10-09 01:27:59.601 | 2020-10-09 01:28:00.601 | 1000 | 1 | + 2020-10-09 01:28:59.101 | 2020-10-09 01:29:00.101 | 1000 | 1 | + 2020-10-09 01:28:59.801 | 2020-10-09 01:29:00.801 | 1000 | 1 | + 2020-10-09 01:29:59.301 | 2020-10-09 01:30:00.301 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:23:37.001 | 2020-10-09 01:24:37.001 | 60000 | 1 | + 2020-10-09 01:24:14.001 | 2020-10-09 01:25:14.001 | 60000 | 1 | + 2020-10-09 01:24:51.001 | 2020-10-09 01:25:51.001 | 60000 | 1 | + 2020-10-09 01:25:28.001 | 2020-10-09 01:26:28.001 | 60000 | 1 | + 2020-10-09 01:26:05.001 | 2020-10-09 01:27:05.001 | 60000 | 1 | + 2020-10-09 01:26:42.001 | 2020-10-09 01:27:42.001 | 60000 | 1 | + 2020-10-09 01:27:19.001 | 2020-10-09 01:28:19.001 | 60000 | 1 | + 2020-10-09 01:27:56.001 | 2020-10-09 01:28:56.001 | 60000 | 1 | + 2020-10-09 01:28:33.001 | 2020-10-09 01:29:33.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.001 | 2020-11-09 01:29:00.001 | 3600000 | 6 | + 2020-11-09 00:56:00.001 | 2020-11-09 01:56:00.001 | 3600000 | 33 | + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 01:50:00.001 | 2020-11-09 02:50:00.001 | 3600000 | 60 | + 2020-11-09 02:17:00.001 | 2020-11-09 03:17:00.001 | 3600000 | 60 | + 2020-11-09 02:44:00.001 | 2020-11-09 03:44:00.001 | 3600000 | 60 | + 2020-11-09 03:11:00.001 | 2020-11-09 04:11:00.001 | 3600000 | 60 | + 2020-11-09 03:38:00.001 | 2020-11-09 04:38:00.001 | 3600000 | 60 | + 2020-11-09 04:05:00.001 | 2020-11-09 05:05:00.001 | 3600000 | 60 | + 2020-11-09 04:32:00.001 | 2020-11-09 05:32:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.001 | 2020-12-09 08:23:00.001 | 86400000 | 420 | + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:23:59.500 | 2020-10-09 01:24:00.500 | 1000 | 1 | + 2020-10-09 01:24:59.700 | 2020-10-09 01:25:00.700 | 1000 | 1 | + 2020-10-09 01:25:59.200 | 2020-10-09 01:26:00.200 | 1000 | 1 | + 2020-10-09 01:25:59.900 | 2020-10-09 01:26:00.900 | 1000 | 1 | + 2020-10-09 01:26:59.400 | 2020-10-09 01:27:00.400 | 1000 | 1 | + 2020-10-09 01:27:59.600 | 2020-10-09 01:28:00.600 | 1000 | 1 | + 2020-10-09 01:28:59.100 | 2020-10-09 01:29:00.100 | 1000 | 1 | + 2020-10-09 01:28:59.800 | 2020-10-09 01:29:00.800 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:23:37.000 | 2020-10-09 01:24:37.000 | 60000 | 1 | + 2020-10-09 01:24:14.000 | 2020-10-09 01:25:14.000 | 60000 | 1 | + 2020-10-09 01:24:51.000 | 2020-10-09 01:25:51.000 | 60000 | 1 | + 2020-10-09 01:25:28.000 | 2020-10-09 01:26:28.000 | 60000 | 1 | + 2020-10-09 01:26:05.000 | 2020-10-09 01:27:05.000 | 60000 | 1 | + 2020-10-09 01:26:42.000 | 2020-10-09 01:27:42.000 | 60000 | 1 | + 2020-10-09 01:27:19.000 | 2020-10-09 01:28:19.000 | 60000 | 1 | + 2020-10-09 01:27:56.000 | 2020-10-09 01:28:56.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.000 | 2020-11-09 01:29:00.000 | 3600000 | 6 | + 2020-11-09 00:56:00.000 | 2020-11-09 01:56:00.000 | 3600000 | 33 | + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 01:50:00.000 | 2020-11-09 02:50:00.000 | 3600000 | 60 | + 2020-11-09 02:17:00.000 | 2020-11-09 03:17:00.000 | 3600000 | 60 | + 2020-11-09 02:44:00.000 | 2020-11-09 03:44:00.000 | 3600000 | 60 | + 2020-11-09 03:11:00.000 | 2020-11-09 04:11:00.000 | 3600000 | 60 | + 2020-11-09 03:38:00.000 | 2020-11-09 04:38:00.000 | 3600000 | 60 | + 2020-11-09 04:05:00.000 | 2020-11-09 05:05:00.000 | 3600000 | 60 | + 2020-11-09 04:32:00.000 | 2020-11-09 05:32:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.000 | 2020-12-09 08:23:00.000 | 86400000 | 420 | + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-09 01:22:59.500 | 2020-11-09 01:23:00.500 | 1000 | 1 | + 2020-12-09 01:22:59.400 | 2020-12-09 01:23:00.400 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-09 01:22:16.000 | 2020-11-09 01:23:16.000 | 60000 | 1 | + 2020-11-09 01:22:53.000 | 2020-11-09 01:23:53.000 | 60000 | 1 | + 2020-12-09 01:22:14.000 | 2020-12-09 01:23:14.000 | 60000 | 1 | + 2020-12-09 01:22:51.000 | 2020-12-09 01:23:51.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 00:29:00.000 | 2020-10-09 01:29:00.000 | 3600000 | 1 | + 2020-10-09 00:56:00.000 | 2020-10-09 01:56:00.000 | 3600000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-09 00:47:00.000 | 2020-11-09 01:47:00.000 | 3600000 | 1 | + 2020-11-09 01:14:00.000 | 2020-11-09 02:14:00.000 | 3600000 | 1 | + 2020-12-09 00:47:00.000 | 2020-12-09 01:47:00.000 | 3600000 | 1 | + 2020-12-09 01:14:00.000 | 2020-12-09 02:14:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-08 08:23:00.000 | 2020-10-09 08:23:00.000 | 86400000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-08 12:23:00.000 | 2020-11-09 12:23:00.000 | 86400000 | 1 | + 2020-12-08 06:23:00.000 | 2020-12-09 06:23:00.000 | 86400000 | 1 | + 2020-12-08 23:23:00.000 | 2020-12-09 23:23:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-19 01:23:00' interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-19 01:23:00' interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 1 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.001 | 2020-10-12 01:23:00.001 | 2592000000 | 4320 | + 2020-09-21 01:23:00.001 | 2020-10-21 01:23:00.001 | 2592000000 | 17280 | + 2020-09-30 01:23:00.001 | 2020-10-30 01:23:00.001 | 2592000000 | 30240 | + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-10-18 01:23:00.001 | 2020-11-18 01:23:00.001 | 2678400000 | 44640 | + 2020-10-27 01:23:00.001 | 2020-11-27 01:23:00.001 | 2678400000 | 44640 | + 2020-11-05 01:23:00.001 | 2020-12-05 01:23:00.001 | 2592000000 | 43200 | + 2020-11-14 01:23:00.001 | 2020-12-14 01:23:00.001 | 2592000000 | 36556 | + 2020-11-23 01:23:00.001 | 2020-12-23 01:23:00.001 | 2592000000 | 23596 | + 2020-12-02 01:23:00.001 | 2021-01-02 01:23:00.001 | 2678400000 | 10636 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-13 01:23:00.001 | 2020-11-13 01:23:00.001 | 2678400000 | 5760 | + 2020-10-22 01:23:00.001 | 2020-11-22 01:23:00.001 | 2678400000 | 18720 | + 2020-10-31 01:23:00.001 | 2020-11-30 01:23:00.001 | 2592000000 | 30240 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-11-18 01:23:00.001 | 2020-12-18 01:23:00.001 | 2592000000 | 30796 | + 2020-11-27 01:23:00.001 | 2020-12-27 01:23:00.001 | 2592000000 | 17836 | + 2020-12-06 01:23:00.001 | 2021-01-06 01:23:00.001 | 2678400000 | 4876 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 01:23:00.001 | 2020-12-12 01:23:00.001 | 2592000000 | 556 | + 2020-11-21 01:23:00.001 | 2020-12-21 01:23:00.001 | 2592000000 | 556 | + 2020-11-30 01:23:00.001 | 2020-12-30 01:23:00.001 | 2592000000 | 556 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-19 01:23:00' interval(1n, auto) sliding(9d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 5760 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 24480 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 44640 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 43200 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 32237 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 13517 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-14 01:23:00.000 | 2020-11-14 01:23:00.000 | 2678400000 | 7200 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 25920 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-11-22 01:23:00.000 | 2020-12-22 01:23:00.000 | 2592000000 | 25037 | + 2020-12-05 01:23:00.000 | 2021-01-05 01:23:00.000 | 2678400000 | 6317 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-13 01:23:00.000 | 2020-12-13 01:23:00.000 | 2592000000 | 557 | + 2020-11-26 01:23:00.000 | 2020-12-26 01:23:00.000 | 2592000000 | 557 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-19 01:23:00' interval(1n, auto) sliding(13d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.000 | 2020-10-12 01:23:00.000 | 2592000000 | 1 | + 2020-09-21 01:23:00.000 | 2020-10-21 01:23:00.000 | 2592000000 | 1 | + 2020-09-30 01:23:00.000 | 2020-10-30 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-18 01:23:00.000 | 2020-11-18 01:23:00.000 | 2678400000 | 1 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 1 | + 2020-11-05 01:23:00.000 | 2020-12-05 01:23:00.000 | 2592000000 | 1 | + 2020-11-14 01:23:00.000 | 2020-12-14 01:23:00.000 | 2592000000 | 1 | + 2020-11-23 01:23:00.000 | 2020-12-23 01:23:00.000 | 2592000000 | 1 | + 2020-12-02 01:23:00.000 | 2021-01-02 01:23:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 1 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 1 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 1 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 1 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-01 23:45:00' as timestamp) + 1d interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-02 23:45:00.000 | 2020-11-03 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-12-01 23:45:00' as timestamp) + 1d interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-02 23:45:00.000 | 2020-12-03 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:59.300 | 2020-10-02 23:45:00.300 | 1000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:23.000 | 2020-10-02 23:45:23.000 | 60000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-01 23:45:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-02 22:51:00.000 | 2020-11-02 23:51:00.000 | 3600000 | 1 | + 2020-11-02 23:18:00.000 | 2020-11-03 00:18:00.000 | 3600000 | 1 | + 2020-11-02 23:45:00.000 | 2020-11-03 00:45:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-12-01 23:45:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-02 06:45:00.000 | 2020-12-03 06:45:00.000 | 86400000 | 1 | + 2020-12-02 23:45:00.000 | 2020-12-03 23:45:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:43' as timestamp) + 1d interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-13 23:32:00.000 | 2020-12-13 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-17 23:32:00.000 | 2020-11-17 23:32:00.000 | 2678400000 | 1 | + 2020-10-26 23:32:00.000 | 2020-11-26 23:32:00.000 | 2678400000 | 1 | + 2020-11-04 23:32:00.000 | 2020-12-04 23:32:00.000 | 2592000000 | 1 | + 2020-11-13 23:32:00.000 | 2020-12-13 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-18 23:32:00.000 | 2020-11-18 23:32:00.000 | 2678400000 | 1 | + 2020-10-31 23:32:00.000 | 2020-11-30 23:32:00.000 | 2592000000 | 1 | + 2020-11-13 23:32:00.000 | 2020-12-13 23:32:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.001 | 2020-10-09 01:24:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:25:59.001 | 2020-10-09 01:26:00.001 | 1000 | 1 | + 2020-10-09 01:26:59.001 | 2020-10-09 01:27:00.001 | 1000 | 1 | + 2020-10-09 01:27:59.001 | 2020-10-09 01:28:00.001 | 1000 | 1 | + 2020-10-09 01:28:59.001 | 2020-10-09 01:29:00.001 | 1000 | 1 | + 2020-10-09 01:29:59.001 | 2020-10-09 01:30:00.001 | 1000 | 1 | + 2020-10-09 01:30:59.001 | 2020-10-09 01:31:00.001 | 1000 | 1 | + 2020-10-09 01:31:59.001 | 2020-10-09 01:32:00.001 | 1000 | 1 | + 2020-10-09 01:32:59.001 | 2020-10-09 01:33:00.001 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:24:00.001 | 2020-10-09 01:25:00.001 | 60000 | 1 | + 2020-10-09 01:25:00.001 | 2020-10-09 01:26:00.001 | 60000 | 1 | + 2020-10-09 01:26:00.001 | 2020-10-09 01:27:00.001 | 60000 | 1 | + 2020-10-09 01:27:00.001 | 2020-10-09 01:28:00.001 | 60000 | 1 | + 2020-10-09 01:28:00.001 | 2020-10-09 01:29:00.001 | 60000 | 1 | + 2020-10-09 01:29:00.001 | 2020-10-09 01:30:00.001 | 60000 | 1 | + 2020-10-09 01:30:00.001 | 2020-10-09 01:31:00.001 | 60000 | 1 | + 2020-10-09 01:31:00.001 | 2020-10-09 01:32:00.001 | 60000 | 1 | + 2020-10-09 01:32:00.001 | 2020-10-09 01:33:00.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 02:23:00.001 | 2020-11-09 03:23:00.001 | 3600000 | 60 | + 2020-11-09 03:23:00.001 | 2020-11-09 04:23:00.001 | 3600000 | 60 | + 2020-11-09 04:23:00.001 | 2020-11-09 05:23:00.001 | 3600000 | 60 | + 2020-11-09 05:23:00.001 | 2020-11-09 06:23:00.001 | 3600000 | 60 | + 2020-11-09 06:23:00.001 | 2020-11-09 07:23:00.001 | 3600000 | 60 | + 2020-11-09 07:23:00.001 | 2020-11-09 08:23:00.001 | 3600000 | 60 | + 2020-11-09 08:23:00.001 | 2020-11-09 09:23:00.001 | 3600000 | 60 | + 2020-11-09 09:23:00.001 | 2020-11-09 10:23:00.001 | 3600000 | 60 | + 2020-11-09 10:23:00.001 | 2020-11-09 11:23:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:24:01.000 | 1000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:25:01.000 | 1000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:26:01.000 | 1000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:27:01.000 | 1000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:28:01.000 | 1000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:29:01.000 | 1000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:30:01.000 | 1000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:31:01.000 | 1000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:32:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:24:00.000 | 2020-10-09 01:25:00.000 | 60000 | 1 | + 2020-10-09 01:25:00.000 | 2020-10-09 01:26:00.000 | 60000 | 1 | + 2020-10-09 01:26:00.000 | 2020-10-09 01:27:00.000 | 60000 | 1 | + 2020-10-09 01:27:00.000 | 2020-10-09 01:28:00.000 | 60000 | 1 | + 2020-10-09 01:28:00.000 | 2020-10-09 01:29:00.000 | 60000 | 1 | + 2020-10-09 01:29:00.000 | 2020-10-09 01:30:00.000 | 60000 | 1 | + 2020-10-09 01:30:00.000 | 2020-10-09 01:31:00.000 | 60000 | 1 | + 2020-10-09 01:31:00.000 | 2020-10-09 01:32:00.000 | 60000 | 1 | + 2020-10-09 01:32:00.000 | 2020-10-09 01:33:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 02:23:00.000 | 2020-11-09 03:23:00.000 | 3600000 | 60 | + 2020-11-09 03:23:00.000 | 2020-11-09 04:23:00.000 | 3600000 | 60 | + 2020-11-09 04:23:00.000 | 2020-11-09 05:23:00.000 | 3600000 | 60 | + 2020-11-09 05:23:00.000 | 2020-11-09 06:23:00.000 | 3600000 | 60 | + 2020-11-09 06:23:00.000 | 2020-11-09 07:23:00.000 | 3600000 | 60 | + 2020-11-09 07:23:00.000 | 2020-11-09 08:23:00.000 | 3600000 | 60 | + 2020-11-09 08:23:00.000 | 2020-11-09 09:23:00.000 | 3600000 | 60 | + 2020-11-09 09:23:00.000 | 2020-11-09 10:23:00.000 | 3600000 | 60 | + 2020-11-09 10:23:00.000 | 2020-11-09 11:23:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:59.501 | 2020-10-09 01:24:00.501 | 1000 | 1 | + 2020-10-09 01:24:59.001 | 2020-10-09 01:25:00.001 | 1000 | 1 | + 2020-10-09 01:24:59.701 | 2020-10-09 01:25:00.701 | 1000 | 1 | + 2020-10-09 01:25:59.201 | 2020-10-09 01:26:00.201 | 1000 | 1 | + 2020-10-09 01:25:59.901 | 2020-10-09 01:26:00.901 | 1000 | 1 | + 2020-10-09 01:26:59.401 | 2020-10-09 01:27:00.401 | 1000 | 1 | + 2020-10-09 01:27:59.601 | 2020-10-09 01:28:00.601 | 1000 | 1 | + 2020-10-09 01:28:59.101 | 2020-10-09 01:29:00.101 | 1000 | 1 | + 2020-10-09 01:28:59.801 | 2020-10-09 01:29:00.801 | 1000 | 1 | + 2020-10-09 01:29:59.301 | 2020-10-09 01:30:00.301 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-10-09 01:24:00.001 | 60000 | 1 | + 2020-10-09 01:23:37.001 | 2020-10-09 01:24:37.001 | 60000 | 1 | + 2020-10-09 01:24:14.001 | 2020-10-09 01:25:14.001 | 60000 | 1 | + 2020-10-09 01:24:51.001 | 2020-10-09 01:25:51.001 | 60000 | 1 | + 2020-10-09 01:25:28.001 | 2020-10-09 01:26:28.001 | 60000 | 1 | + 2020-10-09 01:26:05.001 | 2020-10-09 01:27:05.001 | 60000 | 1 | + 2020-10-09 01:26:42.001 | 2020-10-09 01:27:42.001 | 60000 | 1 | + 2020-10-09 01:27:19.001 | 2020-10-09 01:28:19.001 | 60000 | 1 | + 2020-10-09 01:27:56.001 | 2020-10-09 01:28:56.001 | 60000 | 1 | + 2020-10-09 01:28:33.001 | 2020-10-09 01:29:33.001 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.001 | 2020-11-09 01:29:00.001 | 3600000 | 6 | + 2020-11-09 00:56:00.001 | 2020-11-09 01:56:00.001 | 3600000 | 33 | + 2020-11-09 01:23:00.001 | 2020-11-09 02:23:00.001 | 3600000 | 60 | + 2020-11-09 01:50:00.001 | 2020-11-09 02:50:00.001 | 3600000 | 60 | + 2020-11-09 02:17:00.001 | 2020-11-09 03:17:00.001 | 3600000 | 60 | + 2020-11-09 02:44:00.001 | 2020-11-09 03:44:00.001 | 3600000 | 60 | + 2020-11-09 03:11:00.001 | 2020-11-09 04:11:00.001 | 3600000 | 60 | + 2020-11-09 03:38:00.001 | 2020-11-09 04:38:00.001 | 3600000 | 60 | + 2020-11-09 04:05:00.001 | 2020-11-09 05:05:00.001 | 3600000 | 60 | + 2020-11-09 04:32:00.001 | 2020-11-09 05:32:00.001 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.001 | 2020-12-09 08:23:00.001 | 86400000 | 420 | + 2020-12-09 01:23:00.001 | 2020-12-10 01:23:00.001 | 86400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-10-09 01:23:59.500 | 2020-10-09 01:24:00.500 | 1000 | 1 | + 2020-10-09 01:24:59.700 | 2020-10-09 01:25:00.700 | 1000 | 1 | + 2020-10-09 01:25:59.200 | 2020-10-09 01:26:00.200 | 1000 | 1 | + 2020-10-09 01:25:59.900 | 2020-10-09 01:26:00.900 | 1000 | 1 | + 2020-10-09 01:26:59.400 | 2020-10-09 01:27:00.400 | 1000 | 1 | + 2020-10-09 01:27:59.600 | 2020-10-09 01:28:00.600 | 1000 | 1 | + 2020-10-09 01:28:59.100 | 2020-10-09 01:29:00.100 | 1000 | 1 | + 2020-10-09 01:28:59.800 | 2020-10-09 01:29:00.800 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-10-09 01:23:37.000 | 2020-10-09 01:24:37.000 | 60000 | 1 | + 2020-10-09 01:24:14.000 | 2020-10-09 01:25:14.000 | 60000 | 1 | + 2020-10-09 01:24:51.000 | 2020-10-09 01:25:51.000 | 60000 | 1 | + 2020-10-09 01:25:28.000 | 2020-10-09 01:26:28.000 | 60000 | 1 | + 2020-10-09 01:26:05.000 | 2020-10-09 01:27:05.000 | 60000 | 1 | + 2020-10-09 01:26:42.000 | 2020-10-09 01:27:42.000 | 60000 | 1 | + 2020-10-09 01:27:19.000 | 2020-10-09 01:28:19.000 | 60000 | 1 | + 2020-10-09 01:27:56.000 | 2020-10-09 01:28:56.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 00:29:00.000 | 2020-11-09 01:29:00.000 | 3600000 | 6 | + 2020-11-09 00:56:00.000 | 2020-11-09 01:56:00.000 | 3600000 | 33 | + 2020-11-09 01:23:00.000 | 2020-11-09 02:23:00.000 | 3600000 | 60 | + 2020-11-09 01:50:00.000 | 2020-11-09 02:50:00.000 | 3600000 | 60 | + 2020-11-09 02:17:00.000 | 2020-11-09 03:17:00.000 | 3600000 | 60 | + 2020-11-09 02:44:00.000 | 2020-11-09 03:44:00.000 | 3600000 | 60 | + 2020-11-09 03:11:00.000 | 2020-11-09 04:11:00.000 | 3600000 | 60 | + 2020-11-09 03:38:00.000 | 2020-11-09 04:38:00.000 | 3600000 | 60 | + 2020-11-09 04:05:00.000 | 2020-11-09 05:05:00.000 | 3600000 | 60 | + 2020-11-09 04:32:00.000 | 2020-11-09 05:32:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-08 08:23:00.000 | 2020-12-09 08:23:00.000 | 86400000 | 420 | + 2020-12-09 01:23:00.000 | 2020-12-10 01:23:00.000 | 86400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.001 | 2020-10-12 01:23:00.001 | 2592000000 | 4320 | + 2020-09-21 01:23:00.001 | 2020-10-21 01:23:00.001 | 2592000000 | 17280 | + 2020-09-30 01:23:00.001 | 2020-10-30 01:23:00.001 | 2592000000 | 30240 | + 2020-10-09 01:23:00.001 | 2020-11-09 01:23:00.001 | 2678400000 | 44640 | + 2020-10-18 01:23:00.001 | 2020-11-18 01:23:00.001 | 2678400000 | 44640 | + 2020-10-27 01:23:00.001 | 2020-11-27 01:23:00.001 | 2678400000 | 44640 | + 2020-11-05 01:23:00.001 | 2020-12-05 01:23:00.001 | 2592000000 | 43200 | + 2020-11-14 01:23:00.001 | 2020-12-14 01:23:00.001 | 2592000000 | 36556 | + 2020-11-23 01:23:00.001 | 2020-12-23 01:23:00.001 | 2592000000 | 23596 | + 2020-12-02 01:23:00.001 | 2021-01-02 01:23:00.001 | 2678400000 | 10636 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-13 01:23:00.001 | 2020-11-13 01:23:00.001 | 2678400000 | 5760 | + 2020-10-22 01:23:00.001 | 2020-11-22 01:23:00.001 | 2678400000 | 18720 | + 2020-10-31 01:23:00.001 | 2020-11-30 01:23:00.001 | 2592000000 | 30240 | + 2020-11-09 01:23:00.001 | 2020-12-09 01:23:00.001 | 2592000000 | 43200 | + 2020-11-18 01:23:00.001 | 2020-12-18 01:23:00.001 | 2592000000 | 30796 | + 2020-11-27 01:23:00.001 | 2020-12-27 01:23:00.001 | 2592000000 | 17836 | + 2020-12-06 01:23:00.001 | 2021-01-06 01:23:00.001 | 2678400000 | 4876 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 01:23:00.001 | 2020-12-12 01:23:00.001 | 2592000000 | 556 | + 2020-11-21 01:23:00.001 | 2020-12-21 01:23:00.001 | 2592000000 | 556 | + 2020-11-30 01:23:00.001 | 2020-12-30 01:23:00.001 | 2592000000 | 556 | + 2020-12-09 01:23:00.001 | 2021-01-09 01:23:00.001 | 2678400000 | 556 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 5760 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 24480 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 44640 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 44640 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 43200 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 32237 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 13517 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-14 01:23:00.000 | 2020-11-14 01:23:00.000 | 2678400000 | 7200 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 25920 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 43200 | + 2020-11-22 01:23:00.000 | 2020-12-22 01:23:00.000 | 2592000000 | 25037 | + 2020-12-05 01:23:00.000 | 2021-01-05 01:23:00.000 | 2678400000 | 6317 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-13 01:23:00.000 | 2020-12-13 01:23:00.000 | 2592000000 | 557 | + 2020-11-26 01:23:00.000 | 2020-12-26 01:23:00.000 | 2592000000 | 557 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > i1 interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 01:00:00.000 | 3600000 | 60 | + 2020-10-01 01:00:00.000 | 2020-10-01 02:00:00.000 | 3600000 | 60 | + 2020-10-01 02:00:00.000 | 2020-10-01 03:00:00.000 | 3600000 | 60 | + 2020-10-01 03:00:00.000 | 2020-10-01 04:00:00.000 | 3600000 | 60 | + 2020-10-01 04:00:00.000 | 2020-10-01 05:00:00.000 | 3600000 | 60 | + 2020-10-01 05:00:00.000 | 2020-10-01 06:00:00.000 | 3600000 | 60 | + 2020-10-01 06:00:00.000 | 2020-10-01 07:00:00.000 | 3600000 | 60 | + 2020-10-01 07:00:00.000 | 2020-10-01 08:00:00.000 | 3600000 | 60 | + 2020-10-01 08:00:00.000 | 2020-10-01 09:00:00.000 | 3600000 | 60 | + 2020-10-01 09:00:00.000 | 2020-10-01 10:00:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts > i1 and ts <= bi2 interval(1d, auto) limit 10; + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts >= i1 or ts < bi2 interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-30 16:00:00.000 | 2020-10-31 16:00:00.000 | 2678400000 | 44160 | + 2020-10-31 16:00:00.000 | 2020-11-30 16:00:00.000 | 2592000000 | 43200 | + 2020-11-30 16:00:00.000 | 2020-12-31 16:00:00.000 | 2678400000 | 12640 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d = '2020-11-11 23:32:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-11-12 23:00:00.000 | 2020-11-13 00:00:00.000 | 3600000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d in ('2020-10-08 01:23:00', '2020-11-08 01:23:00', '2020-12-08 01:23:00', '2020-12-18 01:23:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-08 16:00:00.000 | 2020-10-09 16:00:00.000 | 86400000 | 1 | + 2020-11-08 16:00:00.000 | 2020-11-09 16:00:00.000 | 86400000 | 1 | + 2020-12-08 16:00:00.000 | 2020-12-09 16:00:00.000 | 86400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d >= '2020-11-08 01:23:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-31 16:00:00.000 | 2020-11-30 16:00:00.000 | 2592000000 | 31117 | + 2020-11-30 16:00:00.000 | 2020-12-31 16:00:00.000 | 2678400000 | 12640 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-19 11:22:00.000 | 2020-11-19 11:22:01.000 | 1000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 11:23:01.000 | 1000 | 1 | + 2020-11-19 11:24:00.000 | 2020-11-19 11:24:01.000 | 1000 | 1 | + 2020-11-19 11:25:00.000 | 2020-11-19 11:25:01.000 | 1000 | 1 | + 2020-11-19 11:26:00.000 | 2020-11-19 11:26:01.000 | 1000 | 1 | + 2020-11-19 11:27:00.000 | 2020-11-19 11:27:01.000 | 1000 | 1 | + 2020-11-19 11:28:00.000 | 2020-11-19 11:28:01.000 | 1000 | 1 | + 2020-11-19 11:29:00.000 | 2020-11-19 11:29:01.000 | 1000 | 1 | + 2020-11-19 11:30:00.000 | 2020-11-19 11:30:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:46:01.000 | 1000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:47:01.000 | 1000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:48:01.000 | 1000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:49:01.000 | 1000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:50:01.000 | 1000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:51:01.000 | 1000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:52:01.000 | 1000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:53:01.000 | 1000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:54:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:46:01.000 | 1000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:47:01.000 | 1000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:48:01.000 | 1000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:49:01.000 | 1000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:50:01.000 | 1000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:51:01.000 | 1000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:52:01.000 | 1000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:53:01.000 | 1000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:54:01.000 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-19 11:22:00.000 | 2020-11-19 11:23:00.000 | 60000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 11:24:00.000 | 60000 | 1 | + 2020-11-19 11:24:00.000 | 2020-11-19 11:25:00.000 | 60000 | 1 | + 2020-11-19 11:25:00.000 | 2020-11-19 11:26:00.000 | 60000 | 1 | + 2020-11-19 11:26:00.000 | 2020-11-19 11:27:00.000 | 60000 | 1 | + 2020-11-19 11:27:00.000 | 2020-11-19 11:28:00.000 | 60000 | 1 | + 2020-11-19 11:28:00.000 | 2020-11-19 11:29:00.000 | 60000 | 1 | + 2020-11-19 11:29:00.000 | 2020-11-19 11:30:00.000 | 60000 | 1 | + 2020-11-19 11:30:00.000 | 2020-11-19 11:31:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:47:00.000 | 60000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:48:00.000 | 60000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:49:00.000 | 60000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:50:00.000 | 60000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:51:00.000 | 60000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:52:00.000 | 60000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:53:00.000 | 60000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:54:00.000 | 60000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:55:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + 2020-10-02 23:46:00.000 | 2020-10-02 23:47:00.000 | 60000 | 1 | + 2020-10-02 23:47:00.000 | 2020-10-02 23:48:00.000 | 60000 | 1 | + 2020-10-02 23:48:00.000 | 2020-10-02 23:49:00.000 | 60000 | 1 | + 2020-10-02 23:49:00.000 | 2020-10-02 23:50:00.000 | 60000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:51:00.000 | 60000 | 1 | + 2020-10-02 23:51:00.000 | 2020-10-02 23:52:00.000 | 60000 | 1 | + 2020-10-02 23:52:00.000 | 2020-10-02 23:53:00.000 | 60000 | 1 | + 2020-10-02 23:53:00.000 | 2020-10-02 23:54:00.000 | 60000 | 1 | + 2020-10-02 23:54:00.000 | 2020-10-02 23:55:00.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-19 10:23:00.000 | 2020-11-19 11:23:00.000 | 3600000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 12:23:00.000 | 3600000 | 60 | + 2020-11-19 12:23:00.000 | 2020-11-19 13:23:00.000 | 3600000 | 60 | + 2020-11-19 13:23:00.000 | 2020-11-19 14:23:00.000 | 3600000 | 60 | + 2020-11-19 14:23:00.000 | 2020-11-19 15:23:00.000 | 3600000 | 60 | + 2020-11-19 15:23:00.000 | 2020-11-19 16:23:00.000 | 3600000 | 60 | + 2020-11-19 16:23:00.000 | 2020-11-19 17:23:00.000 | 3600000 | 60 | + 2020-11-19 17:23:00.000 | 2020-11-19 18:23:00.000 | 3600000 | 60 | + 2020-11-19 18:23:00.000 | 2020-11-19 19:23:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-03 00:45:00.000 | 3600000 | 60 | + 2020-10-03 00:45:00.000 | 2020-10-03 01:45:00.000 | 3600000 | 60 | + 2020-10-03 01:45:00.000 | 2020-10-03 02:45:00.000 | 3600000 | 60 | + 2020-10-03 02:45:00.000 | 2020-10-03 03:45:00.000 | 3600000 | 60 | + 2020-10-03 03:45:00.000 | 2020-10-03 04:45:00.000 | 3600000 | 60 | + 2020-10-03 04:45:00.000 | 2020-10-03 05:45:00.000 | 3600000 | 60 | + 2020-10-03 05:45:00.000 | 2020-10-03 06:45:00.000 | 3600000 | 60 | + 2020-10-03 06:45:00.000 | 2020-10-03 07:45:00.000 | 3600000 | 60 | + 2020-10-03 07:45:00.000 | 2020-10-03 08:45:00.000 | 3600000 | 60 | + 2020-10-03 08:45:00.000 | 2020-10-03 09:45:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:00:00.000 | 2020-10-03 00:00:00.000 | 3600000 | 15 | + 2020-10-03 00:00:00.000 | 2020-10-03 01:00:00.000 | 3600000 | 60 | + 2020-10-03 01:00:00.000 | 2020-10-03 02:00:00.000 | 3600000 | 60 | + 2020-10-03 02:00:00.000 | 2020-10-03 03:00:00.000 | 3600000 | 60 | + 2020-10-03 03:00:00.000 | 2020-10-03 04:00:00.000 | 3600000 | 60 | + 2020-10-03 04:00:00.000 | 2020-10-03 05:00:00.000 | 3600000 | 60 | + 2020-10-03 05:00:00.000 | 2020-10-03 06:00:00.000 | 3600000 | 60 | + 2020-10-03 06:00:00.000 | 2020-10-03 07:00:00.000 | 3600000 | 60 | + 2020-10-03 07:00:00.000 | 2020-10-03 08:00:00.000 | 3600000 | 60 | + 2020-10-03 08:00:00.000 | 2020-10-03 09:00:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-19 01:23:00.000 | 2020-11-20 01:23:00.000 | 86400000 | 841 | + 2020-11-20 01:23:00.000 | 2020-11-21 01:23:00.000 | 86400000 | 1440 | + 2020-11-21 01:23:00.000 | 2020-11-22 01:23:00.000 | 86400000 | 1440 | + 2020-11-22 01:23:00.000 | 2020-11-23 01:23:00.000 | 86400000 | 1440 | + 2020-11-23 01:23:00.000 | 2020-11-24 01:23:00.000 | 86400000 | 1440 | + 2020-11-24 01:23:00.000 | 2020-11-25 01:23:00.000 | 86400000 | 1440 | + 2020-11-25 01:23:00.000 | 2020-11-26 01:23:00.000 | 86400000 | 1440 | + 2020-11-26 01:23:00.000 | 2020-11-27 01:23:00.000 | 86400000 | 1440 | + 2020-11-27 01:23:00.000 | 2020-11-28 01:23:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-10-03 23:45:00.000 | 86400000 | 1440 | + 2020-10-03 23:45:00.000 | 2020-10-04 23:45:00.000 | 86400000 | 1440 | + 2020-10-04 23:45:00.000 | 2020-10-05 23:45:00.000 | 86400000 | 1440 | + 2020-10-05 23:45:00.000 | 2020-10-06 23:45:00.000 | 86400000 | 1440 | + 2020-10-06 23:45:00.000 | 2020-10-07 23:45:00.000 | 86400000 | 1440 | + 2020-10-07 23:45:00.000 | 2020-10-08 23:45:00.000 | 86400000 | 1440 | + 2020-10-08 23:45:00.000 | 2020-10-09 23:45:00.000 | 86400000 | 1440 | + 2020-10-09 23:45:00.000 | 2020-10-10 23:45:00.000 | 86400000 | 1440 | + 2020-10-10 23:45:00.000 | 2020-10-11 23:45:00.000 | 86400000 | 1440 | + 2020-10-11 23:45:00.000 | 2020-10-12 23:45:00.000 | 86400000 | 1427 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 16:00:00.000 | 2020-10-03 16:00:00.000 | 86400000 | 975 | + 2020-10-03 16:00:00.000 | 2020-10-04 16:00:00.000 | 86400000 | 1440 | + 2020-10-04 16:00:00.000 | 2020-10-05 16:00:00.000 | 86400000 | 1440 | + 2020-10-05 16:00:00.000 | 2020-10-06 16:00:00.000 | 86400000 | 1440 | + 2020-10-06 16:00:00.000 | 2020-10-07 16:00:00.000 | 86400000 | 1440 | + 2020-10-07 16:00:00.000 | 2020-10-08 16:00:00.000 | 86400000 | 1440 | + 2020-10-08 16:00:00.000 | 2020-10-09 16:00:00.000 | 86400000 | 1440 | + 2020-10-09 16:00:00.000 | 2020-10-10 16:00:00.000 | 86400000 | 1440 | + 2020-10-10 16:00:00.000 | 2020-10-11 16:00:00.000 | 86400000 | 1440 | + 2020-10-11 16:00:00.000 | 2020-10-12 16:00:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:59.300 | 2020-10-09 01:23:00.300 | 1000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:23:01.000 | 1000 | 1 | + 2020-11-19 11:21:59.100 | 2020-11-19 11:22:00.100 | 1000 | 1 | + 2020-11-19 11:21:59.800 | 2020-11-19 11:22:00.800 | 1000 | 1 | + 2020-11-19 11:22:59.300 | 2020-11-19 11:23:00.300 | 1000 | 1 | + 2020-11-19 11:23:00.000 | 2020-11-19 11:23:01.000 | 1000 | 1 | + 2020-11-19 11:23:59.500 | 2020-11-19 11:24:00.500 | 1000 | 1 | + 2020-11-19 11:24:59.700 | 2020-11-19 11:25:00.700 | 1000 | 1 | + 2020-11-19 11:25:59.200 | 2020-11-19 11:26:00.200 | 1000 | 1 | + 2020-11-19 11:25:59.900 | 2020-11-19 11:26:00.900 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:59.300 | 2020-10-02 23:45:00.300 | 1000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:45:01.000 | 1000 | 1 | + 2020-10-02 23:45:59.500 | 2020-10-02 23:46:00.500 | 1000 | 1 | + 2020-10-02 23:46:59.700 | 2020-10-02 23:47:00.700 | 1000 | 1 | + 2020-10-02 23:47:59.200 | 2020-10-02 23:48:00.200 | 1000 | 1 | + 2020-10-02 23:47:59.900 | 2020-10-02 23:48:00.900 | 1000 | 1 | + 2020-10-02 23:48:59.400 | 2020-10-02 23:49:00.400 | 1000 | 1 | + 2020-10-02 23:49:59.600 | 2020-10-02 23:50:00.600 | 1000 | 1 | + 2020-10-02 23:50:59.100 | 2020-10-02 23:51:00.100 | 1000 | 1 | + 2020-10-02 23:50:59.800 | 2020-10-02 23:51:00.800 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) sliding(700a) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:59.700 | 2020-10-02 23:45:00.700 | 1000 | 1 | + 2020-10-02 23:45:59.200 | 2020-10-02 23:46:00.200 | 1000 | 1 | + 2020-10-02 23:45:59.900 | 2020-10-02 23:46:00.900 | 1000 | 1 | + 2020-10-02 23:46:59.400 | 2020-10-02 23:47:00.400 | 1000 | 1 | + 2020-10-02 23:47:59.600 | 2020-10-02 23:48:00.600 | 1000 | 1 | + 2020-10-02 23:48:59.100 | 2020-10-02 23:49:00.100 | 1000 | 1 | + 2020-10-02 23:48:59.800 | 2020-10-02 23:49:00.800 | 1000 | 1 | + 2020-10-02 23:49:59.300 | 2020-10-02 23:50:00.300 | 1000 | 1 | + 2020-10-02 23:50:00.000 | 2020-10-02 23:50:01.000 | 1000 | 1 | + 2020-10-02 23:50:59.500 | 2020-10-02 23:51:00.500 | 1000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:22:23.000 | 2020-10-09 01:23:23.000 | 60000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 01:24:00.000 | 60000 | 1 | + 2020-11-19 11:21:27.000 | 2020-11-19 11:22:27.000 | 60000 | 1 | + 2020-11-19 11:22:04.000 | 2020-11-19 11:23:04.000 | 60000 | 1 | + 2020-11-19 11:22:41.000 | 2020-11-19 11:23:41.000 | 60000 | 1 | + 2020-11-19 11:23:18.000 | 2020-11-19 11:24:18.000 | 60000 | 1 | + 2020-11-19 11:23:55.000 | 2020-11-19 11:24:55.000 | 60000 | 1 | + 2020-11-19 11:24:32.000 | 2020-11-19 11:25:32.000 | 60000 | 1 | + 2020-11-19 11:25:09.000 | 2020-11-19 11:26:09.000 | 60000 | 1 | + 2020-11-19 11:25:46.000 | 2020-11-19 11:26:46.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:23.000 | 2020-10-02 23:45:23.000 | 60000 | 1 | + 2020-10-02 23:45:00.000 | 2020-10-02 23:46:00.000 | 60000 | 1 | + 2020-10-02 23:45:37.000 | 2020-10-02 23:46:37.000 | 60000 | 1 | + 2020-10-02 23:46:14.000 | 2020-10-02 23:47:14.000 | 60000 | 1 | + 2020-10-02 23:46:51.000 | 2020-10-02 23:47:51.000 | 60000 | 1 | + 2020-10-02 23:47:28.000 | 2020-10-02 23:48:28.000 | 60000 | 1 | + 2020-10-02 23:48:05.000 | 2020-10-02 23:49:05.000 | 60000 | 1 | + 2020-10-02 23:48:42.000 | 2020-10-02 23:49:42.000 | 60000 | 1 | + 2020-10-02 23:49:19.000 | 2020-10-02 23:50:19.000 | 60000 | 1 | + 2020-10-02 23:49:56.000 | 2020-10-02 23:50:56.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) sliding(37s) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:44:30.000 | 2020-10-02 23:45:30.000 | 60000 | 1 | + 2020-10-02 23:45:07.000 | 2020-10-02 23:46:07.000 | 60000 | 1 | + 2020-10-02 23:45:44.000 | 2020-10-02 23:46:44.000 | 60000 | 1 | + 2020-10-02 23:46:21.000 | 2020-10-02 23:47:21.000 | 60000 | 1 | + 2020-10-02 23:46:58.000 | 2020-10-02 23:47:58.000 | 60000 | 1 | + 2020-10-02 23:47:35.000 | 2020-10-02 23:48:35.000 | 60000 | 1 | + 2020-10-02 23:48:12.000 | 2020-10-02 23:49:12.000 | 60000 | 1 | + 2020-10-02 23:48:49.000 | 2020-10-02 23:49:49.000 | 60000 | 1 | + 2020-10-02 23:49:26.000 | 2020-10-02 23:50:26.000 | 60000 | 1 | + 2020-10-02 23:50:03.000 | 2020-10-02 23:51:03.000 | 60000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 00:29:00.000 | 2020-10-09 01:29:00.000 | 3600000 | 1 | + 2020-10-09 00:56:00.000 | 2020-10-09 01:56:00.000 | 3600000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-09 02:23:00.000 | 3600000 | 1 | + 2020-11-19 10:32:00.000 | 2020-11-19 11:32:00.000 | 3600000 | 10 | + 2020-11-19 10:59:00.000 | 2020-11-19 11:59:00.000 | 3600000 | 37 | + 2020-11-19 11:26:00.000 | 2020-11-19 12:26:00.000 | 3600000 | 60 | + 2020-11-19 11:53:00.000 | 2020-11-19 12:53:00.000 | 3600000 | 60 | + 2020-11-19 12:20:00.000 | 2020-11-19 13:20:00.000 | 3600000 | 60 | + 2020-11-19 12:47:00.000 | 2020-11-19 13:47:00.000 | 3600000 | 60 | + 2020-11-19 13:14:00.000 | 2020-11-19 14:14:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 22:51:00.000 | 2020-10-02 23:51:00.000 | 3600000 | 6 | + 2020-10-02 23:18:00.000 | 2020-10-03 00:18:00.000 | 3600000 | 33 | + 2020-10-02 23:45:00.000 | 2020-10-03 00:45:00.000 | 3600000 | 60 | + 2020-10-03 00:12:00.000 | 2020-10-03 01:12:00.000 | 3600000 | 60 | + 2020-10-03 00:39:00.000 | 2020-10-03 01:39:00.000 | 3600000 | 60 | + 2020-10-03 01:06:00.000 | 2020-10-03 02:06:00.000 | 3600000 | 60 | + 2020-10-03 01:33:00.000 | 2020-10-03 02:33:00.000 | 3600000 | 60 | + 2020-10-03 02:00:00.000 | 2020-10-03 03:00:00.000 | 3600000 | 60 | + 2020-10-03 02:27:00.000 | 2020-10-03 03:27:00.000 | 3600000 | 60 | + 2020-10-03 02:54:00.000 | 2020-10-03 03:54:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) sliding(27m) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 22:57:00.000 | 2020-10-02 23:57:00.000 | 3600000 | 12 | + 2020-10-02 23:24:00.000 | 2020-10-03 00:24:00.000 | 3600000 | 39 | + 2020-10-02 23:51:00.000 | 2020-10-03 00:51:00.000 | 3600000 | 60 | + 2020-10-03 00:18:00.000 | 2020-10-03 01:18:00.000 | 3600000 | 60 | + 2020-10-03 00:45:00.000 | 2020-10-03 01:45:00.000 | 3600000 | 60 | + 2020-10-03 01:12:00.000 | 2020-10-03 02:12:00.000 | 3600000 | 60 | + 2020-10-03 01:39:00.000 | 2020-10-03 02:39:00.000 | 3600000 | 60 | + 2020-10-03 02:06:00.000 | 2020-10-03 03:06:00.000 | 3600000 | 60 | + 2020-10-03 02:33:00.000 | 2020-10-03 03:33:00.000 | 3600000 | 60 | + 2020-10-03 03:00:00.000 | 2020-10-03 04:00:00.000 | 3600000 | 60 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-08 08:23:00.000 | 2020-10-09 08:23:00.000 | 86400000 | 1 | + 2020-10-09 01:23:00.000 | 2020-10-10 01:23:00.000 | 86400000 | 1 | + 2020-11-19 03:23:00.000 | 2020-11-20 03:23:00.000 | 86400000 | 961 | + 2020-11-19 20:23:00.000 | 2020-11-20 20:23:00.000 | 86400000 | 1440 | + 2020-11-20 13:23:00.000 | 2020-11-21 13:23:00.000 | 86400000 | 1440 | + 2020-11-21 06:23:00.000 | 2020-11-22 06:23:00.000 | 86400000 | 1440 | + 2020-11-21 23:23:00.000 | 2020-11-22 23:23:00.000 | 86400000 | 1440 | + 2020-11-22 16:23:00.000 | 2020-11-23 16:23:00.000 | 86400000 | 1440 | + 2020-11-23 09:23:00.000 | 2020-11-24 09:23:00.000 | 86400000 | 1440 | + 2020-11-24 02:23:00.000 | 2020-11-25 02:23:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 06:45:00.000 | 2020-10-03 06:45:00.000 | 86400000 | 420 | + 2020-10-02 23:45:00.000 | 2020-10-03 23:45:00.000 | 86400000 | 1440 | + 2020-10-03 16:45:00.000 | 2020-10-04 16:45:00.000 | 86400000 | 1440 | + 2020-10-04 09:45:00.000 | 2020-10-05 09:45:00.000 | 86400000 | 1440 | + 2020-10-05 02:45:00.000 | 2020-10-06 02:45:00.000 | 86400000 | 1440 | + 2020-10-05 19:45:00.000 | 2020-10-06 19:45:00.000 | 86400000 | 1440 | + 2020-10-06 12:45:00.000 | 2020-10-07 12:45:00.000 | 86400000 | 1440 | + 2020-10-07 05:45:00.000 | 2020-10-08 05:45:00.000 | 86400000 | 1440 | + 2020-10-07 22:45:00.000 | 2020-10-08 22:45:00.000 | 86400000 | 1440 | + 2020-10-08 15:45:00.000 | 2020-10-09 15:45:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) sliding(17h) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 11:00:00.000 | 2020-10-03 11:00:00.000 | 86400000 | 675 | + 2020-10-03 04:00:00.000 | 2020-10-04 04:00:00.000 | 86400000 | 1440 | + 2020-10-03 21:00:00.000 | 2020-10-04 21:00:00.000 | 86400000 | 1440 | + 2020-10-04 14:00:00.000 | 2020-10-05 14:00:00.000 | 86400000 | 1440 | + 2020-10-05 07:00:00.000 | 2020-10-06 07:00:00.000 | 86400000 | 1440 | + 2020-10-06 00:00:00.000 | 2020-10-07 00:00:00.000 | 86400000 | 1440 | + 2020-10-06 17:00:00.000 | 2020-10-07 17:00:00.000 | 86400000 | 1440 | + 2020-10-07 10:00:00.000 | 2020-10-08 10:00:00.000 | 86400000 | 1440 | + 2020-10-08 03:00:00.000 | 2020-10-09 03:00:00.000 | 86400000 | 1440 | + 2020-10-08 20:00:00.000 | 2020-10-09 20:00:00.000 | 86400000 | 1440 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-11-09 01:23:00.000 | 2020-12-09 01:23:00.000 | 2592000000 | 28201 | + 2020-12-09 01:23:00.000 | 2021-01-09 01:23:00.000 | 2678400000 | 557 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-10-02 23:45:00.000 | 2020-11-02 23:45:00.000 | 2678400000 | 14387 | + 2020-12-02 23:45:00.000 | 2021-01-02 23:45:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-30 16:00:00.000 | 2020-10-31 16:00:00.000 | 2678400000 | 14387 | + 2020-10-31 16:00:00.000 | 2020-11-30 16:00:00.000 | 2592000000 | 1 | + 2020-11-30 16:00:00.000 | 2020-12-31 16:00:00.000 | 2678400000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-12 01:23:00.000 | 2020-10-12 01:23:00.000 | 2592000000 | 1 | + 2020-09-21 01:23:00.000 | 2020-10-21 01:23:00.000 | 2592000000 | 1 | + 2020-09-30 01:23:00.000 | 2020-10-30 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-27 01:23:00.000 | 2020-11-27 01:23:00.000 | 2678400000 | 10921 | + 2020-11-05 01:23:00.000 | 2020-12-05 01:23:00.000 | 2592000000 | 22441 | + 2020-11-14 01:23:00.000 | 2020-12-14 01:23:00.000 | 2592000000 | 28758 | + 2020-11-23 01:23:00.000 | 2020-12-23 01:23:00.000 | 2592000000 | 23597 | + 2020-12-02 01:23:00.000 | 2021-01-02 01:23:00.000 | 2678400000 | 10637 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-05 23:45:00.000 | 2020-10-05 23:45:00.000 | 2592000000 | 4320 | + 2020-09-14 23:45:00.000 | 2020-10-14 23:45:00.000 | 2592000000 | 14387 | + 2020-09-23 23:45:00.000 | 2020-10-23 23:45:00.000 | 2592000000 | 14387 | + 2020-10-02 23:45:00.000 | 2020-11-02 23:45:00.000 | 2678400000 | 14387 | + 2020-10-11 23:45:00.000 | 2020-11-11 23:45:00.000 | 2678400000 | 1427 | + 2020-11-07 23:45:00.000 | 2020-12-07 23:45:00.000 | 2592000000 | 1 | + 2020-11-16 23:45:00.000 | 2020-12-16 23:45:00.000 | 2592000000 | 1 | + 2020-11-25 23:45:00.000 | 2020-12-25 23:45:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(9d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-07 16:00:00.000 | 2020-10-07 16:00:00.000 | 2592000000 | 6735 | + 2020-09-16 16:00:00.000 | 2020-10-16 16:00:00.000 | 2592000000 | 14387 | + 2020-09-25 16:00:00.000 | 2020-10-25 16:00:00.000 | 2592000000 | 14387 | + 2020-10-04 16:00:00.000 | 2020-11-04 16:00:00.000 | 2678400000 | 11972 | + 2020-10-13 16:00:00.000 | 2020-11-13 16:00:00.000 | 2678400000 | 1 | + 2020-10-22 16:00:00.000 | 2020-11-22 16:00:00.000 | 2678400000 | 1 | + 2020-10-31 16:00:00.000 | 2020-11-30 16:00:00.000 | 2592000000 | 1 | + 2020-11-09 16:00:00.000 | 2020-12-09 16:00:00.000 | 2592000000 | 1 | + 2020-11-18 16:00:00.000 | 2020-12-18 16:00:00.000 | 2592000000 | 1 | + 2020-11-27 16:00:00.000 | 2020-12-27 16:00:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-13 01:23:00.000 | 2020-10-13 01:23:00.000 | 2592000000 | 1 | + 2020-09-26 01:23:00.000 | 2020-10-26 01:23:00.000 | 2592000000 | 1 | + 2020-10-09 01:23:00.000 | 2020-11-09 01:23:00.000 | 2678400000 | 1 | + 2020-10-22 01:23:00.000 | 2020-11-22 01:23:00.000 | 2678400000 | 3721 | + 2020-11-04 01:23:00.000 | 2020-12-04 01:23:00.000 | 2592000000 | 21001 | + 2020-11-17 01:23:00.000 | 2020-12-17 01:23:00.000 | 2592000000 | 28758 | + 2020-11-30 01:23:00.000 | 2020-12-30 01:23:00.000 | 2592000000 | 13517 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-06 23:45:00.000 | 2020-10-06 23:45:00.000 | 2592000000 | 5760 | + 2020-09-19 23:45:00.000 | 2020-10-19 23:45:00.000 | 2592000000 | 14387 | + 2020-10-02 23:45:00.000 | 2020-11-02 23:45:00.000 | 2678400000 | 14387 | + 2020-11-10 23:45:00.000 | 2020-12-10 23:45:00.000 | 2592000000 | 1 | + 2020-11-23 23:45:00.000 | 2020-12-23 23:45:00.000 | 2592000000 | 1 | + +taos> select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(13d) limit 10; + _wstart | _wend | _wduration | count(*) | +==================================================================================================== + 2020-09-06 16:00:00.000 | 2020-10-06 16:00:00.000 | 2592000000 | 5295 | + 2020-09-19 16:00:00.000 | 2020-10-19 16:00:00.000 | 2592000000 | 14387 | + 2020-10-02 16:00:00.000 | 2020-11-02 16:00:00.000 | 2678400000 | 14387 | + 2020-10-15 16:00:00.000 | 2020-11-15 16:00:00.000 | 2678400000 | 1 | + 2020-10-28 16:00:00.000 | 2020-11-28 16:00:00.000 | 2678400000 | 1 | + 2020-11-10 16:00:00.000 | 2020-12-10 16:00:00.000 | 2592000000 | 1 | + 2020-11-23 16:00:00.000 | 2020-12-23 16:00:00.000 | 2592000000 | 1 | + 2020-12-06 16:00:00.000 | 2021-01-06 16:00:00.000 | 2678400000 | 1 | + +taos> select * from test.sta; +taos> select * from test.stb; +taos> select * from test.stc; +taos> select * from test.std; +taos> select * from test.ste; +taos> select * from test.stf; +taos> select * from test.stg; diff --git a/tests/army/query/function/in/interval.in b/tests/army/query/function/in/interval.in new file mode 100644 index 0000000000..92291d82c9 --- /dev/null +++ b/tests/army/query/function/in/interval.in @@ -0,0 +1,160 @@ +select _wstart, _wend, _wduration, count(*) from test.st interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts < '2020-10-01 00:07:19' interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts <= '2020-09-30 23:59:59' interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-12-01 23:45:00' interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-01 23:45:00') interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-12-01 23:45:00') interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-10-01 23:45:00' interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-12-01 23:45:00' interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-01 23:45:00') interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-01 23:45:00') interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-12-01 23:45:00') interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:43' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:43') interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:43' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-12 23:32:00' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:43') interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-19 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-19 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-10-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-11-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-19 01:23:00' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-09 01:23:00' interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-12-19 01:23:00' interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-01 23:45:00' as timestamp) + 1d interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-12-01 23:45:00' as timestamp) + 1d interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-01 23:45:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-01 23:45:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-12-01 23:45:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:43' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-11-12 23:32:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-10-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-11-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-08 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= cast('2020-12-18 01:23:00' as timestamp) + 1d interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > i1 interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts > i1 and ts <= bi2 interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts >= i1 or ts < bi2 interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d = '2020-11-11 23:32:00' interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d in ('2020-10-08 01:23:00', '2020-11-08 01:23:00', '2020-12-08 01:23:00', '2020-12-18 01:23:00') interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts - 1d >= '2020-11-08 01:23:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto) sliding(700a) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1m, auto) sliding(37s) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1h, auto) sliding(27m) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1d, auto) sliding(17h) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(9d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where ts = cast('2020-10-08 01:23:00' as timestamp) + 1d or ts >= '2020-11-19 11:22:00' interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or (ts > '2020-11-12 23:32:00' and ts = '2020-12-02 23:45:00') interval(1n, auto) sliding(13d) limit 10; +select _wstart, _wend, _wduration, count(*) from test.st where (ts >= '2020-10-02 23:45:00' and ts < '2020-10-12 23:32:00') or ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1n, auto) sliding(13d) limit 10; +select * from test.sta; +select * from test.stb; +select * from test.stc; +select * from test.std; +select * from test.ste; +select * from test.stf; +select * from test.stg; diff --git a/tests/army/query/function/interval.json b/tests/army/query/function/interval.json new file mode 100644 index 0000000000..fe939401fc --- /dev/null +++ b/tests/army/query/function/interval.json @@ -0,0 +1,67 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "thread_count": 4, + "create_table_thread_count": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 10000, + "prepared_rand": 10000, + "chinese": "no", + "escape_character": "yes", + "continue_if_fail": "no", + "databases": [ + { + "dbinfo": { + "name": "test", + "drop": "yes", + "vgroups": 4, + "precision": "ms", + "keep": "3650" + }, + "super_tables": [ + { + "name": "st", + "child_table_exists": "no", + "childtable_count": 1, + "childtable_prefix": "ct", + "auto_create_table": "no", + "batch_create_tbl_num": 5, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 100000, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "timestamp_step": 60000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + {"type": "INT", "name": "i1"}, + {"type": "BIGINT", "name": "bi2"}, + {"type": "FLOAT", "name": "f3"}, + {"type": "DOUBLE", "name": "d4"} + ], + "tags": [ + {"type": "TINYINT", "name": "groupid", "max": 10, "min": 1}, + {"name": "location","type": "binary", "len": 16, "values": + ["San Francisco", "Los Angles", "San Diego", "San Jose", "Palo Alto", "Campbell", "Mountain View","Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/query/function/test_interval.py b/tests/army/query/function/test_interval.py new file mode 100644 index 0000000000..cd532e7836 --- /dev/null +++ b/tests/army/query/function/test_interval.py @@ -0,0 +1,79 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +from frame import etool +from frame.etool import * +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame.common import * + +class TDTestCase(TBase): + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + + def insert_data(self): + tdLog.info("insert interval test data.") + # taosBenchmark run + json = etool.curFile(__file__, "interval.json") + etool.benchMark(json = json) + + def create_streams(self): + tdSql.execute("use test;") + streams = [ + "create stream stream1 fill_history 1 into sta as select _wstart, _wend, _wduration, count(*) from test.st where ts < '2020-10-01 00:07:19' interval(1m, auto);", + "create stream stream2 fill_history 1 into stb as select _wstart, _wend, _wduration, count(*) from test.st where ts = '2020-11-01 23:45:00' interval(1h, auto) sliding(27m);", + "create stream stream3 fill_history 1 into stc as select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-11-12 23:32:00') interval(1n, auto) sliding(13d);", + "create stream stream4 fill_history 1 into std as select _wstart, _wend, _wduration, count(*) from test.st where ts in ('2020-10-09 01:23:00', '2020-11-09 01:23:00', '2020-12-09 01:23:00') interval(1s, auto);", + "create stream stream5 fill_history 1 into ste as select _wstart, _wend, _wduration, count(*) from test.st where ts > '2020-12-09 01:23:00' interval(1d, auto) sliding(17h);", + "create stream stream6 fill_history 1 into stf as select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-10-09 01:23:00' interval(1n, auto);", + "create stream stream7 fill_history 1 into stg as select _wstart, _wend, _wduration, count(*) from test.st where ts >= '2020-11-09 01:23:00' interval(1n, auto) sliding(13d);", + ] + for sql in streams: + tdSql.execute(sql) + for i in range(50): + rows = tdSql.query("select * from information_schema.ins_stream_tasks where history_task_status is not null;") + if rows == 0: + break; + tdLog.info(f"i={i} wait for history data calculation finish ...") + time.sleep(1) + + def query_test(self): + # read sql from .sql file and execute + tdLog.info("test normal query.") + self.sqlFile = etool.curFile(__file__, f"in/interval.in") + self.ansFile = etool.curFile(__file__, f"ans/interval.csv") + + tdCom.compare_testcase_result(self.sqlFile, self.ansFile, "interval") + + def run(self): + self.insert_data() + self.create_streams() + self.query_test() + + def stop(self): + tdSql.execute("drop stream stream1;") + tdSql.execute("drop stream stream2;") + tdSql.execute("drop stream stream3;") + tdSql.execute("drop stream stream4;") + tdSql.execute("drop stream stream5;") + tdSql.execute("drop stream stream6;") + tdSql.execute("drop stream stream7;") + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/query/function/test_interval_diff_tz.py b/tests/army/query/function/test_interval_diff_tz.py new file mode 100644 index 0000000000..7d7c4e7df9 --- /dev/null +++ b/tests/army/query/function/test_interval_diff_tz.py @@ -0,0 +1,57 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +from frame import etool +from frame.etool import * +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame.common import * + +class TDTestCase(TBase): + clientCfgDict = { "timezone": "UTC" } + updatecfgDict = { + "timezone": "UTC-8", + "clientCfg": clientCfgDict, + } + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + + def insert_data(self): + tdLog.info("insert interval test data.") + # taosBenchmark run + json = etool.curFile(__file__, "interval.json") + etool.benchMark(json = json) + + def query_test(self): + # read sql from .sql file and execute + tdLog.info("test normal query.") + self.sqlFile = etool.curFile(__file__, f"in/interval.in") + self.ansFile = etool.curFile(__file__, f"ans/interval_diff_tz.csv") + + tdCom.compare_testcase_result(self.sqlFile, self.ansFile, "interval_diff_tz") + + def run(self): + self.insert_data() + self.query_test() + + def stop(self): + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 055bd7f9c6..0e553cfa49 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -18,6 +18,8 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_percentile.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_resinfo.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_interp.py +,,y,army,./pytest.sh python3 ./test.py -f query/function/test_interval.py +,,y,army,./pytest.sh python3 ./test.py -f query/function/test_interval_diff_tz.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/concat.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py