diff --git a/README-CN.md b/README-CN.md index 43d3c76a73..bea4bc9fe6 100644 --- a/README-CN.md +++ b/README-CN.md @@ -80,7 +80,7 @@ TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。 ### Ubuntu 18.04、20.04、22.04 ```bash -sudo apt-get udpate +sudo apt-get update sudo apt-get install -y gcc cmake build-essential git libjansson-dev \ libsnappy-dev liblzma-dev zlib1g-dev pkg-config ``` diff --git a/docs/en/14-reference/03-taos-sql/31-join.md b/docs/en/14-reference/03-taos-sql/31-join.md index caf2436bd5..1d206a954c 100644 --- a/docs/en/14-reference/03-taos-sql/31-join.md +++ b/docs/en/14-reference/03-taos-sql/31-join.md @@ -29,6 +29,17 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim ### Main Join Condition As a time-series database, all join queries in TDengine revolve around the primary key timestamp column. Therefore, all join queries (except ASOF/Window Join) must include an equality condition on the primary key column, and the first primary key column equality condition that appears in the join conditions will be considered the main join condition. ASOF Join's main join condition can include non-equality conditions, while Window Join's main join condition is specified through `WINDOW_OFFSET`. +Starting from version 3.3.6.0, TDengine supports constant timestamps in subqueries (including constant functions with return timestamps such as today (), now (), etc., constant timestamps and their addition and subtraction operations) as equivalent primary key columns that can appear in the main join condition. For example: + +```sql +SELECT * from d1001 a JOIN (SELECT today() as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` + +The above example SQL will perform join operation between all records in table d1001 today and a certain time record in table d1002. It should be noticed that the constant time string appears in SQL will not be treated as a timestamp by default. For example, "2025-03-19 10:00:00.000" will only be treated as a string instead of a timestamp. Therefore, when it needs to be treated as a constant timestamp, you can specify the constant string as a timestamp type by using the type prefix timestamp. For example: + +```sql +SELECT * from d1001 a JOIN (SELECT timestamp '2025-03-19 10:00:00.000' as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` Apart from Window Join, TDengine supports the `timetruncate` function operation in the main join condition, such as `ON timetruncate(a.ts, 1s) = timetruncate(b.ts, 1s)`, but does not support other functions and scalar operations. @@ -38,7 +49,7 @@ The characteristic ASOF/Window Join of time-series databases supports grouping t ### Primary Key Timeline -As a time-series database, TDengine requires each table (subtable) to have a primary key timestamp column, which will serve as the primary key timeline for many time-related operations. The result of a subquery or the result of a Join operation also needs to clearly identify which column will be considered the primary key timeline for subsequent time-related operations. In subqueries, the first appearing ordered primary key column (or its operation) or a pseudocolumn equivalent to the primary key column (`_wstart`/`_wend`) will be considered the primary key timeline of the output table. The selection of the primary key timeline in Join output results follows these rules: +As a time-series database, TDengine requires each table (subtable) to have a primary key timestamp column, which will serve as the primary key timeline for many time-related operations. The result of a subquery or the result of a Join operation also needs to clearly identify which column will be considered the primary key timeline for subsequent time-related operations. In subqueries, the first appearing ordered primary key column (or its operation) or a pseudocolumn equivalent to the primary key column (`_wstart`/`_wend`) will be considered the primary key timeline of the output table. In addition, starting with version 3.3.6.0, TDengine also supports constant timestamp columns in subquery results as the primary key timeline for the output table. The selection of the primary key timeline in Join output results follows these rules: - In the Left/Right Join series, the primary key column of the driving table (subquery) will be used as the primary key timeline for subsequent queries; additionally, within the Window Join window, since both tables are ordered, any table's primary key column can be used as the primary key timeline, with a preference for the primary key column of the same table. - Inner Join can use the primary key column of any table as the primary key timeline, but when there are grouping conditions similar to tag column equality conditions related by `AND` with the main join condition, it will not produce a primary key timeline. diff --git a/docs/en/14-reference/05-connector/10-cpp.md b/docs/en/14-reference/05-connector/10-cpp.md index edccd8ebd4..52c64e1209 100644 --- a/docs/en/14-reference/05-connector/10-cpp.md +++ b/docs/en/14-reference/05-connector/10-cpp.md @@ -1121,10 +1121,14 @@ In addition to using SQL or parameter binding APIs to insert data, you can also - conf: [Input] Pointer to a valid tmq_conf_t structure, representing a TMQ configuration object. - key: [Input] Configuration item key name. - value: [Input] Configuration item value. - - **Return Value**: Returns a tmq_conf_res_t enum value, indicating the result of the configuration setting. - - TMQ_CONF_OK: Successfully set the configuration item. - - TMQ_CONF_INVALID_KEY: Invalid key value. - - TMQ_CONF_UNKNOWN: Invalid key name. + - **Return Value**: Returns a tmq_conf_res_t enum value, indicating the result of the configuration setting. tmq_conf_res_t defined as follows: + ``` + typedef enum tmq_conf_res_t { + TMQ_CONF_UNKNOWN = -2, // invalid key + TMQ_CONF_INVALID = -1, // invalid value + TMQ_CONF_OK = 0, // success + } tmq_conf_res_t; + ``` - `void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param)` - **Interface Description**: Sets the auto-commit callback function in the TMQ configuration object. diff --git a/docs/en/14-reference/09-error-code.md b/docs/en/14-reference/09-error-code.md index e801580583..1aa62fbfce 100644 --- a/docs/en/14-reference/09-error-code.md +++ b/docs/en/14-reference/09-error-code.md @@ -559,9 +559,10 @@ This document details the server error codes that may be encountered when using ## virtual table -| Error Code | Description | Possible Error Scenarios or Reasons | Recommended Actions for Users | -|-------------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| -| 0x80006200 | Virtual table scan internal error | virtual table scan operator internal error, generally does not occur | Check error logs, contact development for handling | -| 0x80006201 | Virtual table scan invalid downstream operator type | The incorrect execution plan generated causes the downstream operator type of the virtual table scan operator to be incorrect. | Check error logs, contact development for handling | -| 0x80006202 | Virtual table prim timestamp column should not has ref | The timestamp primary key column of a virtual table should not have a data source. If it does, this error will occur during subsequent queries on the virtual table. | Check error logs, contact development for handling | -| 0x80006203 | Create virtual child table must use virtual super table | Create virtual child table using non-virtual super table | create virtual child table using virtual super table | +| Error Code | Description | Possible Error Scenarios or Reasons | Recommended Actions for Users | +|------------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------| +| 0x80006200 | Virtual table scan internal error | virtual table scan operator internal error, generally does not occur | Check error logs, contact development for handling | +| 0x80006201 | Virtual table scan invalid downstream operator type | The incorrect execution plan generated causes the downstream operator type of the virtual table scan operator to be incorrect. | Check error logs, contact development for handling | +| 0x80006202 | Virtual table prim timestamp column should not has ref | The timestamp primary key column of a virtual table should not have a data source. If it does, this error will occur during subsequent queries on the virtual table. | Check error logs, contact development for handling | +| 0x80006203 | Create virtual child table must use virtual super table | Create virtual child table using non-virtual super table | create virtual child table using virtual super table | +| 0x80006204 | Virtual table not support decimal type | Create virtual table using decimal type | create virtual table without using decimal type | diff --git a/docs/zh/14-reference/03-taos-sql/31-join.md b/docs/zh/14-reference/03-taos-sql/31-join.md index 9b66b6648a..60cf568949 100644 --- a/docs/zh/14-reference/03-taos-sql/31-join.md +++ b/docs/zh/14-reference/03-taos-sql/31-join.md @@ -30,6 +30,17 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim ### 主连接条件 作为一款时序数据库,TDengine 所有的关联查询都围绕主键时戳列进行,因此要求除 ASOF/Window Join 外的所有关联查询都必须含有主键列的等值连接条件,而按照顺序首次出现在连接条件中的主键列等值连接条件将会被作为主连接条件。ASOF Join 的主连接条件可以包含非等值的连接条件,而 Window Join 的主连接条件则是通过 `WINDOW_OFFSET` 来指定。 +从 3.3.6.0 版本开始,TDengine 支持子查询中的常量(包含返回时戳的常量函数如today()、now()等,常量时戳及其加减运算)作为等价主键列可以出现在主连接条件中。例如: + +```sql +SELECT * from d1001 a JOIN (SELECT today() as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` + +上面的示例语句可以实现表 d1001 今天的所有记录与表 d1002 中某一时刻的某条记录进行关联运算。需要注意的是,SQL 中出现的时间字符串常量默认不会被当作时戳,例如 `'2025-03-19 10:00:00.000'` 只会被当作字符串而不是时戳,因此当需要作为常量时戳处理时,可以通过类型前缀 timestamp 来指定字符串常量为时间戳类型,例如: + +```sql +SELECT * from d1001 a JOIN (SELECT timestamp '2025-03-19 10:00:00.000' as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` 除 Window Join 外,TDengine 支持在主连接条件中进行 `timetruncate` 函数操作,例如 `ON timetruncate(a.ts, 1s) = timetruncate(b.ts, 1s)`,除此之外,暂不支持其他函数及标量运算。 @@ -39,7 +50,7 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim ### 主键时间线 -TDengine 作为时序数据库要求每个表(子表)中必须有主键时间戳列,它将作为该表的主键时间线进行很多跟时间相关的运算,而子查询的结果或者 Join 运算的结果中也需要明确哪一列将被视作主键时间线参与后续的时间相关的运算。在子查询中,查询结果中存在的有序的第一个出现的主键列(或其运算)或等同主键列的伪列(`_wstart`/`_wend`)将被视作该输出表的主键时间线。Join 输出结果中主键时间线的选择遵从以下规则: +TDengine 作为时序数据库要求每个表(子表)中必须有主键时间戳列,它将作为该表的主键时间线进行很多跟时间相关的运算,而子查询的结果或者 Join 运算的结果中也需要明确哪一列将被视作主键时间线参与后续的时间相关的运算。在子查询中,查询结果中存在的有序的第一个出现的主键列(或其运算)或等同主键列的伪列(`_wstart`/`_wend`)将被视作该输出表的主键时间线。此外,从 3.3.6.0 版本开始,TDengine 也开始支持子查询结果中的常量时戳列作为输出表的主键时间线。Join 输出结果中主键时间线的选择遵从以下规则: - Left/Right Join 系列中驱动表(子查询)的主键列将被作为后续查询的主键时间线;此外,在 Window Join 窗口内,因为左右表同时有序所以在窗口内可以把任意一个表的主键列做作主键时间线,优先选择本表的主键列作为主键时间线。 - Inner Join 可以把任意一个表的主键列做作主键时间线,当存在类似分组条件(Tag 列的等值条件且与主连接条件 `AND` 关系)时将无法产生主键时间线。 - Full Join 因为无法产生任何一个有效的主键时间序列,因此没有主键时间线,这也就意味着 Full Join 中无法进行时间线相关的运算。 diff --git a/docs/zh/14-reference/05-connector/10-cpp.mdx b/docs/zh/14-reference/05-connector/10-cpp.mdx index 3f36fb9e91..2f8431cc46 100644 --- a/docs/zh/14-reference/05-connector/10-cpp.mdx +++ b/docs/zh/14-reference/05-connector/10-cpp.mdx @@ -1115,10 +1115,14 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 - conf:[入参] 指向一个有效的 tmq_conf_t 结构体指针,该结构体代表一个 TMQ 配置对象。 - key:[入参] 数配置项的键名。 - value:[入参] 配置项的值。 - - **返回值**:返回一个 tmq_conf_res_t 枚举值,表示配置设置的结果。 - - TMQ_CONF_OK:成功设置配置项。 - - TMQ_CONF_INVALID_KEY:键值无效。 - - TMQ_CONF_UNKNOWN:键名无效。 + - **返回值**:返回一个 tmq_conf_res_t 枚举值,表示配置设置的结果。tmq_conf_res_t 定义如下: + ``` + typedef enum tmq_conf_res_t { + TMQ_CONF_UNKNOWN = -2, // 键名无效 + TMQ_CONF_INVALID = -1, // 键值无效 + TMQ_CONF_OK = 0, // 成功设置配置项 + } tmq_conf_res_t; + ``` - `void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param)` - **接口说明**:设置 TMQ 配置对象中的自动提交回调函数。 diff --git a/docs/zh/14-reference/09-error-code.md b/docs/zh/14-reference/09-error-code.md index 9bf3ceb933..4cf853283e 100644 --- a/docs/zh/14-reference/09-error-code.md +++ b/docs/zh/14-reference/09-error-code.md @@ -578,10 +578,11 @@ description: TDengine 服务端的错误码列表和详细说明 ## virtual table -| 错误码 | 错误描述 | 可能的出错场景或者可能的原因 | 建议用户采取的措施 | -|------------|---------------------------------------------------------|------------------------------------------------|------------------------| -| 0x80006200 | Virtual table scan 算子内部错误 | virtual table scan 算子内部逻辑错误,一般不会出现 | 具体查看client端的错误日志提示 | -| 0x80006201 | Virtual table scan invalid downstream operator type | 由于生成的执行计划不对,导致 virtual table scan 算子的下游算子类型不正确 | 保留 explain 执行计划,联系开发处理 | -| 0x80006202 | Virtual table prim timestamp column should not has ref | 虚拟表的时间戳主键列不应该有数据源,如果有,后续查询虚拟表的时候就会出现该错误 | 检查错误日志,联系开发处理 | -| 0x80006203 | Create virtual child table must use virtual super table | 虚拟子表必须建在虚拟超级表下,否则就会出现该错误 | 创建虚拟子表的时候,USING 虚拟超级表 | +| 错误码 | 错误描述 | 可能的出错场景或者可能的原因 | 建议用户采取的措施 | +|------------|---------------------------------------------------------|------------------------------------------------|----------------------------| +| 0x80006200 | Virtual table scan 算子内部错误 | virtual table scan 算子内部逻辑错误,一般不会出现 | 具体查看client端的错误日志提示 | +| 0x80006201 | Virtual table scan invalid downstream operator type | 由于生成的执行计划不对,导致 virtual table scan 算子的下游算子类型不正确 | 保留 explain 执行计划,联系开发处理 | +| 0x80006202 | Virtual table prim timestamp column should not has ref | 虚拟表的时间戳主键列不应该有数据源,如果有,后续查询虚拟表的时候就会出现该错误 | 检查错误日志,联系开发处理 | +| 0x80006203 | Create virtual child table must use virtual super table | 虚拟子表必须建在虚拟超级表下,否则就会出现该错误 | 创建虚拟子表的时候,USING 虚拟超级表 | +| 0x80006204 | Virtual table not support decimal type | 虚拟表不支持 decimal 类型 | 创建虚拟表时不使用 decimal 类型的列/tag | diff --git a/include/common/tname.h b/include/common/tname.h index c7c34310b9..5bd889ae5f 100644 --- a/include/common/tname.h +++ b/include/common/tname.h @@ -54,6 +54,8 @@ const char* tNameGetDbNameP(const SName* name); int32_t tNameGetFullDbName(const SName* name, char* dst); +int32_t tNameGetFullTableName(const SName* name, char* dst); + bool tNameIsEmpty(const SName* name); void tNameAssign(SName* dst, const SName* src); diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 9665d522cd..4d35c8db7d 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -134,6 +134,8 @@ int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableI bool qIsDynamicExecTask(qTaskInfo_t tinfo); +void qDestroyOperatorParam(SOperatorParam* pParam); + void qUpdateOperatorParam(qTaskInfo_t tinfo, void* pParam); /** diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 28cb7d9010..7f49dfb633 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -1070,6 +1070,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_VTABLE_SCAN_INVALID_DOWNSTREAM TAOS_DEF_ERROR_CODE(0, 0x6201) #define TSDB_CODE_VTABLE_PRIMTS_HAS_REF TAOS_DEF_ERROR_CODE(0, 0x6202) #define TSDB_CODE_VTABLE_NOT_VIRTUAL_SUPER_TABLE TAOS_DEF_ERROR_CODE(0, 0x6203) +#define TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE TAOS_DEF_ERROR_CODE(0, 0x6204) #ifdef __cplusplus } #endif diff --git a/include/util/tcompare.h b/include/util/tcompare.h index 41bedc1a19..e6789347d7 100644 --- a/include/util/tcompare.h +++ b/include/util/tcompare.h @@ -36,6 +36,12 @@ extern "C" { #define FLT_GREATEREQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) > (_y))) #define FLT_LESSEQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) < (_y))) +#define DBL_EQUAL(_x, _y) fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * DBL_EPSILON) +#define DBL_GREATER(_x, _y) (!DBL_EQUAL((_x), (_y)) && ((_x) > (_y))) +#define DBL_LESS(_x, _y) (!DBL_EQUAL((_x), (_y)) && ((_x) < (_y))) +#define DBL_GREATEREQUAL(_x, _y) (DBL_EQUAL((_x), (_y)) || ((_x) > (_y))) +#define DBL_LESSEQUAL(_x, _y) (DBL_EQUAL((_x), (_y)) || ((_x) < (_y))) + #define PATTERN_COMPARE_INFO_INITIALIZER { '%', '_', L'%', L'_' } typedef struct SPatternCompareInfo { diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 1464c3580e..13269f5a1a 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -313,7 +313,7 @@ typedef struct SSyncQueryParam { void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); -void doSetOneRowPtr(SReqResultInfo* pResultInfo, bool isStmt); +void doSetOneRowPtr(SReqResultInfo* pResultInfo); void setResPrecision(SReqResultInfo* pResInfo, int32_t precision); int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4, bool isStmt); int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4, bool isStmt); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 7957736459..7e2454bf6f 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1941,12 +1941,12 @@ TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, cons // return taos_connect(ipStr, userStr, passStr, dbStr, port); // } -void doSetOneRowPtr(SReqResultInfo* pResultInfo, bool isStmt) { +void doSetOneRowPtr(SReqResultInfo* pResultInfo) { for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { SResultColumn* pCol = &pResultInfo->pCol[i]; int32_t type = pResultInfo->fields[i].type; - int32_t schemaBytes = calcSchemaBytesFromTypeBytes(type, pResultInfo->fields[i].bytes, isStmt); + int32_t schemaBytes = calcSchemaBytesFromTypeBytes(type, pResultInfo->userFields[i].bytes, false); if (IS_VAR_DATA_TYPE(type)) { if (!IS_VAR_NULL_TYPE(type, schemaBytes) && pCol->offset[pResultInfo->current] != -1) { @@ -2012,7 +2012,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) } if (setupOneRowPtr) { - doSetOneRowPtr(pResultInfo, pRequest->isStmtBind); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; } @@ -2059,7 +2059,7 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU return NULL; } else { if (setupOneRowPtr) { - doSetOneRowPtr(pResultInfo, pRequest->isStmtBind); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; } @@ -2135,8 +2135,9 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t* colLength, bo static int32_t convertDecimalType(SReqResultInfo* pResultInfo) { for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { - TAOS_FIELD_E* pField = pResultInfo->fields + i; - int32_t type = pField->type; + TAOS_FIELD_E* pFieldE = pResultInfo->fields + i; + TAOS_FIELD* pField = pResultInfo->userFields + i; + int32_t type = pFieldE->type; int32_t bufLen = 0; char* p = NULL; if (!IS_DECIMAL_TYPE(type) || !pResultInfo->pCol[i].pData) { @@ -2144,6 +2145,7 @@ static int32_t convertDecimalType(SReqResultInfo* pResultInfo) { } else { bufLen = 64; p = taosMemoryRealloc(pResultInfo->convertBuf[i], bufLen * pResultInfo->numOfRows); + pFieldE->bytes = bufLen; pField->bytes = bufLen; } if (!p) return terrno; @@ -2151,7 +2153,7 @@ static int32_t convertDecimalType(SReqResultInfo* pResultInfo) { for (int32_t j = 0; j < pResultInfo->numOfRows; ++j) { int32_t code = decimalToStr((DecimalWord*)(pResultInfo->pCol[i].pData + j * tDataTypes[type].bytes), type, - pField->precision, pField->scale, p, bufLen); + pFieldE->precision, pFieldE->scale, p, bufLen); p += bufLen; if (TSDB_CODE_SUCCESS != code) { return code; @@ -2395,6 +2397,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) { } int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4, bool isStmt) { + bool convertForDecimal = convertUcs4; if (pResultInfo == NULL || pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL) { tscError("setResultDataPtr paras error"); return TSDB_CODE_TSC_INTERNAL_ERROR; @@ -2507,7 +2510,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4, bool isS code = doConvertUCS4(pResultInfo, colLength, isStmt); } #endif - if (TSDB_CODE_SUCCESS == code && convertUcs4) { + if (TSDB_CODE_SUCCESS == code && convertForDecimal) { code = convertDecimalType(pResultInfo); } return code; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index eca1b286f6..50fadc9593 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -647,7 +647,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { } if (pResultInfo->current < pResultInfo->numOfRows) { - doSetOneRowPtr(pResultInfo, false); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; return pResultInfo->row; } else { @@ -655,7 +655,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { return NULL; } - doSetOneRowPtr(pResultInfo, false); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; return pResultInfo->row; } diff --git a/source/common/src/msg/tmsg.c b/source/common/src/msg/tmsg.c index f8a6da7378..e60da401d1 100644 --- a/source/common/src/msg/tmsg.c +++ b/source/common/src/msg/tmsg.c @@ -9486,10 +9486,11 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam) TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pOpParam->downstreamIdx)); switch (pOpParam->opType) { case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { - STableScanOperatorParam *pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam)); - if (NULL == pScan) { + pOpParam->value = taosMemoryMalloc(sizeof(STableScanOperatorParam)); + if (NULL == pOpParam->value) { TAOS_CHECK_RETURN(terrno); } + STableScanOperatorParam *pScan = pOpParam->value; TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&pScan->tableSeq)); int32_t uidNum = 0; int64_t uid = 0; @@ -9535,8 +9536,6 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam) } TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pScan->window.skey)); TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pScan->window.ekey)); - - pOpParam->value = pScan; break; } default: diff --git a/source/common/src/tname.c b/source/common/src/tname.c index b5070df5a2..2fb2e8f4d4 100644 --- a/source/common/src/tname.c +++ b/source/common/src/tname.c @@ -104,6 +104,14 @@ const char* tNameGetTableName(const SName* name) { return &name->tname[0]; } +int32_t tNameGetFullTableName(const SName* name, char* dst) { + if (name == NULL || dst == NULL) { + return TSDB_CODE_INVALID_PARA; + } + (void)snprintf(dst, TSDB_TABLE_FNAME_LEN, "%s.%s", name->dbname, name->tname); + return 0; +} + void tNameAssign(SName* dst, const SName* src) { memcpy(dst, src, sizeof(SName)); } int32_t tNameSetDbName(SName* dst, int32_t acct, const char* dbName, size_t nameLen) { @@ -230,7 +238,7 @@ static int compareKv(const void* p1, const void* p2) { } /* - * use stable name and tags to grearate child table name + * use stable name and tags to generate child table name */ int32_t buildChildTableName(RandTableName* rName) { taosArraySort(rName->tags, compareKv); diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index c527308598..b65db996cc 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -202,6 +202,7 @@ _return: int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta) { int32_t code = 0; + int32_t line = 0; STableMetaOutput* output = NULL; CTG_ERR_RET(ctgGetTbMetaFromCache(pCtg, ctx, pTableMeta)); @@ -224,7 +225,7 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx goto _return; } - if (CTG_IS_META_VBOTH(output->metaType) || CTG_IS_META_VCTABLE(output->metaType)) { + if (CTG_IS_META_VBOTH(output->metaType)) { int32_t colRefSize = output->vctbMeta->numOfColRefs * sizeof(SColRef); if (output->tbMeta) { int32_t metaSize = CTG_META_SIZE(output->tbMeta); @@ -246,17 +247,14 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx goto _return; } - if ((!CTG_IS_META_CTABLE(output->metaType)) || output->tbMeta) { + if ((!CTG_IS_META_CTABLE(output->metaType) && !CTG_IS_META_VCTABLE(output->metaType)) || output->tbMeta) { ctgError("invalid metaType:%d", output->metaType); taosMemoryFreeClear(output->vctbMeta); taosMemoryFreeClear(output->tbMeta); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } - // HANDLE ONLY CHILD TABLE META - - taosMemoryFreeClear(output->tbMeta); - taosMemoryFreeClear(output->vctbMeta); + // HANDLE ONLY (VIRTUAL) CHILD TABLE META SName stbName = *ctx->pName; TAOS_STRCPY(stbName.tname, output->tbName); @@ -269,8 +267,21 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx ctgDebug("tb:%s, stb no longer exist, db:%s", ctx->pName->tname, output->dbFName); continue; } + if (CTG_IS_META_CTABLE(output->metaType)) { + TAOS_MEMCPY(*pTableMeta, &output->ctbMeta, sizeof(output->ctbMeta)); + } else if (CTG_IS_META_VCTABLE(output->metaType)) { + int32_t colRefSize = output->vctbMeta->numOfColRefs * sizeof(SColRef); + int32_t metaSize = CTG_META_SIZE(*pTableMeta); + (*pTableMeta) = taosMemoryRealloc(*pTableMeta, metaSize + colRefSize); + QUERY_CHECK_NULL(*pTableMeta, code , line, _return, terrno); + TAOS_MEMCPY(*pTableMeta, output->vctbMeta, sizeof(SVCTableMeta)); + (*pTableMeta)->colRef = (SColRef *)((char *)(*pTableMeta) + metaSize); + TAOS_MEMCPY((*pTableMeta)->colRef, output->vctbMeta->colRef, colRefSize); + (*pTableMeta)->numOfColRefs = output->vctbMeta->numOfColRefs; + } - TAOS_MEMCPY(*pTableMeta, &output->ctbMeta, sizeof(output->ctbMeta)); + taosMemoryFreeClear(output->tbMeta); + taosMemoryFreeClear(output->vctbMeta); break; } diff --git a/source/libs/executor/inc/dynqueryctrl.h b/source/libs/executor/inc/dynqueryctrl.h index d9620b0279..feb2dca76f 100755 --- a/source/libs/executor/inc/dynqueryctrl.h +++ b/source/libs/executor/inc/dynqueryctrl.h @@ -75,20 +75,20 @@ typedef struct SStbJoinDynCtrlInfo { } SStbJoinDynCtrlInfo; typedef struct SVtbScanDynCtrlInfo { - int32_t acctId; - SUseDbRsp* pRsp; - SUseDbReq req; + bool scanAllCols; tsem_t ready; SEpSet epSet; + SUseDbRsp* pRsp; uint64_t suid; - SReadHandle readHandle; - SArray* childTableList; + int32_t acctId; + int32_t curTableIdx; int32_t lastTableIdx; - SOperatorParam* vtbScanParam; - int32_t readTableIdx; - SHashObj* dbVgInfoMap; SArray* readColList; - bool scanAllCols; + SArray* childTableList; + SHashObj* dbVgInfoMap; + SHashObj* orgTbVgColMap; + SReadHandle readHandle; + SOperatorParam* vtbScanParam; } SVtbScanDynCtrlInfo; typedef struct SDynQueryCtrlOperatorInfo { diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c index 562019a416..97d0cf4a0e 100644 --- a/source/libs/executor/src/dynqueryctrloperator.c +++ b/source/libs/executor/src/dynqueryctrloperator.c @@ -80,6 +80,13 @@ static void destroyStbJoinDynCtrlInfo(SStbJoinDynCtrlInfo* pStbJoin) { destroyStbJoinTableList(pStbJoin->ctx.prev.pListHead); } +void destroyOrgTbInfo(void *info) { + SOrgTbInfo *pOrgTbInfo = (SOrgTbInfo *)info; + if (pOrgTbInfo) { + taosArrayDestroy(pOrgTbInfo->colMap); + } +} + void freeUseDbOutput(void* pOutput) { SUseDbOutput *pOut = *(SUseDbOutput**)pOutput; if (NULL == pOutput) { @@ -103,6 +110,10 @@ static void destroyVtbScanDynCtrlInfo(SVtbScanDynCtrlInfo* pVtbScan) { taosHashSetFreeFp(pVtbScan->dbVgInfoMap, freeUseDbOutput); taosHashCleanup(pVtbScan->dbVgInfoMap); } + if (pVtbScan->orgTbVgColMap) { + taosHashSetFreeFp(pVtbScan->orgTbVgColMap, destroyOrgTbInfo); + taosHashCleanup(pVtbScan->orgTbVgColMap); + } if (pVtbScan->pRsp) { tFreeSUsedbRsp(pVtbScan->pRsp); taosMemoryFreeClear(pVtbScan->pRsp); @@ -1071,7 +1082,7 @@ _return: return code; } -static int32_t buildVtbScanOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SOperatorParam** ppRes) { +static int32_t buildVtbScanOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SOperatorParam** ppRes, uint64_t uid) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SVTableScanOperatorParam* pVScan = NULL; @@ -1085,6 +1096,7 @@ static int32_t buildVtbScanOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SOper QUERY_CHECK_NULL(pVScan, code, lino, _return, terrno); pVScan->pOpParamArray = taosArrayInit(1, POINTER_BYTES); QUERY_CHECK_NULL(pVScan->pOpParamArray, code, lino, _return, terrno); + pVScan->uid = uid; (*ppRes)->opType = QUERY_NODE_PHYSICAL_PLAN_VIRTUAL_TABLE_SCAN; (*ppRes)->downstreamIdx = 0; @@ -1283,11 +1295,32 @@ bool colNeedScan(SOperatorInfo* pOperator, col_id_t colId) { return false; } -void destroyOrgTbInfo(void *info) { - SOrgTbInfo *pOrgTbInfo = (SOrgTbInfo *)info; - if (pOrgTbInfo) { - taosArrayDestroy(pOrgTbInfo->colMap); +int32_t getDbVgInfo(SOperatorInfo* pOperator, SName *name, SDBVgInfo **dbVgInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t line = 0; + SDynQueryCtrlOperatorInfo* pInfo = pOperator->info; + SVtbScanDynCtrlInfo* pVtbScan = (SVtbScanDynCtrlInfo*)&pInfo->vtbScan; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SReadHandle* pHandle = &pVtbScan->readHandle; + SUseDbOutput* output = NULL; + SUseDbOutput** find = (SUseDbOutput**)taosHashGet(pInfo->vtbScan.dbVgInfoMap, name->dbname, strlen(name->dbname)); + + QRY_PARAM_CHECK(dbVgInfo); + + if (find == NULL) { + output = taosMemoryMalloc(sizeof(SUseDbOutput)); + QUERY_CHECK_CODE(buildDbVgInfoMap(pOperator, pHandle, name, pTaskInfo, output), line, _return); + QUERY_CHECK_CODE(taosHashPut(pInfo->vtbScan.dbVgInfoMap, name->dbname, strlen(name->dbname), &output, POINTER_BYTES), line, _return); + } else { + output = *find; } + + *dbVgInfo = output->dbVgroup; + return code; +_return: + qError("%s failed at line %d since %s", __func__, line, tstrerror(code)); + freeUseDbOutput(output); + return code; } int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) { @@ -1298,7 +1331,7 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) { SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SReadHandle* pHandle = &pVtbScan->readHandle; SMetaReader mr = {0}; - SHashObj* orgTbVgColMap = NULL; + SDBVgInfo* dbVgInfo = NULL; QRY_PARAM_CHECK(pRes); if (pOperator->status == OP_EXEC_DONE) { @@ -1312,51 +1345,40 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) { size_t num = taosArrayGetSize(pVtbScan->childTableList); + // no child table, return if (num == 0) { setOperatorCompleted(pOperator); return code; } - // TODO(smj) : proper hash size - orgTbVgColMap = taosHashInit(num * 64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); - QUERY_CHECK_NULL(orgTbVgColMap, code, line, _return, terrno); - taosHashSetFreeFp(orgTbVgColMap, destroyOrgTbInfo); + pVtbScan->orgTbVgColMap = taosHashInit(num * 64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); + QUERY_CHECK_NULL(pVtbScan->orgTbVgColMap, code, line, _return, terrno); + taosHashSetFreeFp(pVtbScan->orgTbVgColMap, destroyOrgTbInfo); while (true) { - if (pVtbScan->readTableIdx == pVtbScan->lastTableIdx) { + if (pVtbScan->curTableIdx == pVtbScan->lastTableIdx) { QUERY_CHECK_CODE(pOperator->pDownstream[0]->fpSet.getNextFn(pOperator->pDownstream[0], pRes), line, _return); } else { - uint64_t* id = taosArrayGet(pVtbScan->childTableList, pVtbScan->readTableIdx); + uint64_t* id = taosArrayGet(pVtbScan->childTableList, pVtbScan->curTableIdx); QUERY_CHECK_NULL(id, code, line, _return, terrno); pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pHandle->api.metaFn); QUERY_CHECK_CODE(pHandle->api.metaReaderFn.getTableEntryByUid(&mr, *id), line, _return); for (int32_t j = 0; j < mr.me.colRef.nCols; j++) { if (mr.me.colRef.pColRef[j].hasRef && colNeedScan(pOperator, mr.me.colRef.pColRef[j].id)) { - SName name = {0}; - toName(pInfo->vtbScan.acctId, mr.me.colRef.pColRef[j].refDbName, "", &name); - SUseDbOutput* output = NULL; - SUseDbOutput** find = (SUseDbOutput**)taosHashGet(pInfo->vtbScan.dbVgInfoMap, name.dbname, strlen(name.dbname)); - if (find == NULL) { - output = taosMemoryMalloc(sizeof(SUseDbOutput)); - QUERY_CHECK_CODE(buildDbVgInfoMap(pOperator, pHandle, &name, pTaskInfo, output), line, _return); - QUERY_CHECK_CODE(taosHashPut(pInfo->vtbScan.dbVgInfoMap, name.dbname, strlen(name.dbname), &output, sizeof(output)), line, _return); - } else { - output = *find; - } - int32_t vgId = 0; - char dbFname[TSDB_DB_FNAME_LEN] = {0}; - QUERY_CHECK_CODE(tNameGetFullDbName(&name, dbFname), line, _return); - QUERY_CHECK_CODE(getVgId(output->dbVgroup, dbFname, &vgId, mr.me.colRef.pColRef[j].refTableName), line, _return); - char orgTbFName[TSDB_TABLE_FNAME_LEN] = {0}; - TAOS_STRNCAT(orgTbFName, mr.me.colRef.pColRef[j].refDbName, TSDB_DB_NAME_LEN); - TAOS_STRNCAT(orgTbFName, ".", 2); - TAOS_STRNCAT(orgTbFName, mr.me.colRef.pColRef[j].refTableName, TSDB_TABLE_NAME_LEN); + SName name = {0}; + char dbFname[TSDB_DB_FNAME_LEN] = {0}; + char orgTbFName[TSDB_TABLE_FNAME_LEN] = {0}; - void *tbVgCol = taosHashGet(orgTbVgColMap, orgTbFName, sizeof(orgTbFName)); - if (!tbVgCol) { + toName(pInfo->vtbScan.acctId, mr.me.colRef.pColRef[j].refDbName, mr.me.colRef.pColRef[j].refTableName, &name); + QUERY_CHECK_CODE(getDbVgInfo(pOperator, &name, &dbVgInfo), line, _return); + QUERY_CHECK_CODE(tNameGetFullDbName(&name, dbFname), line, _return); + QUERY_CHECK_CODE(tNameGetFullTableName(&name, orgTbFName), line, _return); + + void *pVal = taosHashGet(pVtbScan->orgTbVgColMap, orgTbFName, sizeof(orgTbFName)); + if (!pVal) { SOrgTbInfo map = {0}; - map.vgId = vgId; + QUERY_CHECK_CODE(getVgId(dbVgInfo, dbFname, &map.vgId, name.tname), line, _return); tstrncpy(map.tbName, orgTbFName, sizeof(map.tbName)); map.colMap = taosArrayInit(10, sizeof(SColIdNameKV)); QUERY_CHECK_NULL(map.colMap, code, line, _return, terrno); @@ -1364,40 +1386,43 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) { colIdNameKV.colId = mr.me.colRef.pColRef[j].id; tstrncpy(colIdNameKV.colName, mr.me.colRef.pColRef[j].refColName, sizeof(colIdNameKV.colName)); QUERY_CHECK_NULL(taosArrayPush(map.colMap, &colIdNameKV), code, line, _return, terrno); - QUERY_CHECK_CODE(taosHashPut(orgTbVgColMap, orgTbFName, sizeof(orgTbFName), &map, sizeof(map)), line, _return); + QUERY_CHECK_CODE(taosHashPut(pVtbScan->orgTbVgColMap, orgTbFName, sizeof(orgTbFName), &map, sizeof(map)), line, _return); } else { - SOrgTbInfo *map = (SOrgTbInfo *)tbVgCol; + SOrgTbInfo *tbInfo = (SOrgTbInfo *)pVal; SColIdNameKV colIdNameKV = {0}; colIdNameKV.colId = mr.me.colRef.pColRef[j].id; tstrncpy(colIdNameKV.colName, mr.me.colRef.pColRef[j].refColName, sizeof(colIdNameKV.colName)); - QUERY_CHECK_NULL(taosArrayPush(map->colMap, &colIdNameKV), code, line, _return, terrno); + QUERY_CHECK_NULL(taosArrayPush(tbInfo->colMap, &colIdNameKV), code, line, _return, terrno); } } } pVtbScan->vtbScanParam = NULL; - QUERY_CHECK_CODE(buildVtbScanOperatorParam(pInfo, &pVtbScan->vtbScanParam), line, _return); - ((SVTableScanOperatorParam*)pVtbScan->vtbScanParam->value)->uid = *id; + QUERY_CHECK_CODE(buildVtbScanOperatorParam(pInfo, &pVtbScan->vtbScanParam, *id), line, _return); - void* pIter = taosHashIterate(orgTbVgColMap, NULL); + void* pIter = taosHashIterate(pVtbScan->orgTbVgColMap, NULL); while (pIter != NULL) { SOrgTbInfo* pMap = (SOrgTbInfo*)pIter; SOperatorParam* pExchangeParam = NULL; QUERY_CHECK_CODE(buildExchangeOperatorParamForVScan(&pExchangeParam, 0, pMap), line, _return); QUERY_CHECK_NULL(taosArrayPush(((SVTableScanOperatorParam*)pVtbScan->vtbScanParam->value)->pOpParamArray, &pExchangeParam), code, line, _return, terrno); - pIter = taosHashIterate(orgTbVgColMap, pIter); + pIter = taosHashIterate(pVtbScan->orgTbVgColMap, pIter); } pHandle->api.metaReaderFn.clearReader(&mr); + + // reset downstream operator's status pOperator->pDownstream[0]->status = OP_NOT_OPENED; QUERY_CHECK_CODE(pOperator->pDownstream[0]->fpSet.getNextExtFn(pOperator->pDownstream[0], pVtbScan->vtbScanParam, pRes), line, _return); } if (*pRes) { - pVtbScan->lastTableIdx = pVtbScan->readTableIdx; + // has result, still read data from this table. + pVtbScan->lastTableIdx = pVtbScan->curTableIdx; break; } else { - pVtbScan->readTableIdx++; - if (pVtbScan->readTableIdx >= taosArrayGetSize(pVtbScan->childTableList)) { + // no result, read next table. + pVtbScan->curTableIdx++; + if (pVtbScan->curTableIdx >= taosArrayGetSize(pVtbScan->childTableList)) { setOperatorCompleted(pOperator); break; } @@ -1405,7 +1430,8 @@ int32_t vtbScan(SOperatorInfo* pOperator, SSDataBlock** pRes) { } _return: - taosHashCleanup(orgTbVgColMap); + taosHashCleanup(pVtbScan->orgTbVgColMap); + pVtbScan->orgTbVgColMap = NULL; if (pOperator->cost.openCost == 0) { pOperator->cost.openCost = (double)(taosGetTimestampUs() - st) / 1000.0; } @@ -1459,7 +1485,7 @@ static int32_t initVtbScanInfo(SOperatorInfo* pOperator, SDynQueryCtrlOperatorIn pInfo->vtbScan.epSet = pPhyciNode->vtbScan.mgmtEpSet; pInfo->vtbScan.acctId = pPhyciNode->vtbScan.accountId; pInfo->vtbScan.readHandle = *pHandle; - pInfo->vtbScan.readTableIdx = 0; + pInfo->vtbScan.curTableIdx = 0; pInfo->vtbScan.lastTableIdx = -1; pInfo->vtbScan.readColList = taosArrayInit(LIST_LENGTH(pPhyciNode->vtbScan.pScanCols), sizeof(col_id_t)); @@ -1472,12 +1498,17 @@ static int32_t initVtbScanInfo(SOperatorInfo* pOperator, SDynQueryCtrlOperatorIn } pInfo->vtbScan.childTableList = taosArrayInit(10, sizeof(uint64_t)); + QUERY_CHECK_NULL(pInfo->vtbScan.childTableList, code, line, _return, terrno); QUERY_CHECK_CODE(pHandle->api.metaFn.getChildTableList(pHandle->vnode, pInfo->vtbScan.suid, pInfo->vtbScan.childTableList), line, _return); pInfo->vtbScan.dbVgInfoMap = taosHashInit(taosArrayGetSize(pInfo->vtbScan.childTableList), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); QUERY_CHECK_NULL(pInfo->vtbScan.dbVgInfoMap, code, line, _return, terrno); + return code; _return: + // no need to destroy array and hashmap allocated in this function, + // since the operator's destroy function will take care of it + qError("%s failed at line %d since %s", __func__, line, tstrerror(code)); return code; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 7caaf63bf7..3182f81e65 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -626,6 +626,13 @@ void destroyOperatorParam(SOperatorParam* pParam) { // TODO } +void qDestroyOperatorParam(SOperatorParam* pParam) { + if (NULL == pParam) { + return; + } + freeOperatorParam(pParam, OP_GET_PARAM); +} + void qUpdateOperatorParam(qTaskInfo_t tinfo, void* pParam) { destroyOperatorParam(((SExecTaskInfo*)tinfo)->pOpParam); ((SExecTaskInfo*)tinfo)->pOpParam = pParam; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index d3185f898e..204ac331c9 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -967,6 +967,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI } int64_t gid = pBlock->info.id.groupId; + bool hasResult = false; bool masterScan = true; int32_t numOfOutput = pOperator->exprSupp.numOfExprs; int32_t bytes = pStateColInfoData->info.bytes; @@ -988,6 +989,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI if (colDataIsNull(pStateColInfoData, pBlock->info.rows, j, pAgg)) { continue; } + hasResult = true; if (pStateColInfoData->pData == NULL) { qError("%s:%d state column data is null", __FILE__, __LINE__); pTaskInfo->code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; @@ -1043,6 +1045,9 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI } } + if (!hasResult) { + return; + } SResultRow* pResult = NULL; pRowSup->win.ekey = tsList[pBlock->info.rows - 1]; int32_t ret = setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &pRowSup->win, masterScan, &pResult, gid, diff --git a/source/libs/parser/inc/parTranslater.h b/source/libs/parser/inc/parTranslater.h index 4b38bce82c..2f3f05acdd 100644 --- a/source/libs/parser/inc/parTranslater.h +++ b/source/libs/parser/inc/parTranslater.h @@ -53,7 +53,7 @@ typedef struct STranslateContext { int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRet); int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect); -int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt); +int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SNodeList* pTags, SNodeList* pCols); int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput); int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta, bool couldBeView); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 319149716f..75e01d1356 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1992,10 +1992,10 @@ int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRe return TSDB_CODE_SUCCESS; } -int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt) { - if (pStmt->pTags) { +int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SNodeList* pTags, SNodeList* pCols) { + if (pTags) { SNode* pNode = NULL; - FOREACH(pNode, pStmt->pTags) { + FOREACH(pNode, pTags) { SColumnDefNode* pTag = (SColumnDefNode*)pNode; if (strcasecmp(pTag->colName, "tbname") == 0) { int32_t code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, @@ -2004,9 +2004,9 @@ int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* p } } } - if (pStmt->pCols) { + if (pCols) { SNode* pNode = NULL; - FOREACH(pNode, pStmt->pCols) { + FOREACH(pNode, pCols) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; if (strcasecmp(pCol->colName, "tbname") == 0) { int32_t code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, @@ -5387,24 +5387,6 @@ int32_t mergeInnerJoinConds(SNode** ppDst, SNode** ppSrc) { return code; } -bool isColumnExpr(SNode* pNode) { - SExprNode* pExpr = (SExprNode*)pNode; - if (QUERY_NODE_COLUMN != nodeType(pNode) && QUERY_NODE_FUNCTION != nodeType(pNode)) { - return false; - } - if (QUERY_NODE_FUNCTION == nodeType(pNode)) { - SFunctionNode* pFunc = (SFunctionNode*)pNode; - if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType && strcasecmp(((SFunctionNode*)pNode)->functionName, "timetruncate")) { - return false; - } - if (!nodesContainsColumn(nodesListGetNode(pFunc->pParameterList, 0))) { - return false; - } - } - - return true; -} - int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) { if (NULL == *ppSrc) { return TSDB_CODE_SUCCESS; @@ -5417,7 +5399,7 @@ int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) { if (OP_TYPE_EQUAL != pOp->opType) { break; } - if (isColumnExpr(pOp->pLeft) && isColumnExpr(pOp->pRight)) { + if (nodesContainsColumn(pOp->pLeft) && nodesContainsColumn(pOp->pRight)) { TSWAP(*ppSrc, *ppDst); } break; @@ -9691,7 +9673,7 @@ static int32_t translateS3MigrateDatabase(STranslateContext* pCxt, SS3MigrateDat return buildCmdMsg(pCxt, TDMT_MND_S3MIGRATE_DB, (FSerializeFunc)tSerializeSS3MigrateDbReq, &req); } -static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) { +static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes, bool virtualTable) { *pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SFieldWithOptions)); if (!pArray) return terrno; @@ -9699,6 +9681,10 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB SNode* pNode; FOREACH(pNode, pList) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; + if (virtualTable && IS_DECIMAL_TYPE(pCol->dataType.type)) { + code = TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE; + break; + } SFieldWithOptions field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; if (calBytes) { field.bytes = calcTypeBytes(pCol->dataType); @@ -9733,7 +9719,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB return code; } -static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) { +static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes, bool virtualTable) { *pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField)); if (!*pArray) return terrno; SNode* pNode; @@ -9742,6 +9728,11 @@ static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calByte SField field = { .type = pCol->dataType.type, }; + if (virtualTable && IS_DECIMAL_TYPE(pCol->dataType.type)) { + taosArrayDestroy(*pArray); + *pArray = NULL; + return TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE; + } if (calBytes) { field.bytes = calcTypeBytes(pCol->dataType); } else { @@ -10005,6 +9996,10 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt return checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, pStmt->pOptions->pRollupFuncs); } +static int32_t checkVTableSchema(STranslateContext* pCxt, SCreateVTableStmt* pStmt) { + return checkTableSchemaImpl(pCxt, NULL, pStmt->pCols, NULL); +} + static int32_t getTableDelayOrWatermarkOption(STranslateContext* pCxt, const char* pName, int64_t minVal, int64_t maxVal, SValueNode* pVal, int64_t* pMaxDelay) { int32_t code = (DEAL_RES_ERROR == translateValue(pCxt, pVal) ? pCxt->errCode : TSDB_CODE_SUCCESS); @@ -10165,7 +10160,7 @@ static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt } } if (pCxt->pParseCxt->biMode != 0 && TSDB_CODE_SUCCESS == code) { - code = biCheckCreateTableTbnameCol(pCxt, pStmt); + code = biCheckCreateTableTbnameCol(pCxt, pStmt->pTags, pStmt->pCols); } return code; } @@ -10564,8 +10559,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm pReq->source = TD_REQ_FROM_APP; // columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true); // columnDefNodeToField(pStmt->pTags, &pReq->pTags, true); - code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true); - if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true); + code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true, pStmt->pOptions->virtualStb); + if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true, pStmt->pOptions->virtualStb); if (TSDB_CODE_SUCCESS == code) { pReq->numOfColumns = LIST_LENGTH(pStmt->pCols); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); @@ -10794,6 +10789,10 @@ static SSchema* getTagSchema(const STableMeta* pTableMeta, const char* pTagName) static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTableStmt* pStmt, const STableMeta* pTableMeta) { + if (pTableMeta->virtualStb && IS_DECIMAL_TYPE(pStmt->dataType.type)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE); + } + SSchema* pTagsSchema = getTableTagSchema(pTableMeta); if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON && (pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG || @@ -13501,10 +13500,10 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pReq->igUpdate = pStmt->pOptions->ignoreUpdate; if (pReq->createStb) { pReq->numOfTags = LIST_LENGTH(pStmt->pTags); - code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true); + code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true, false); } if (TSDB_CODE_SUCCESS == code) { - code = columnDefNodeToField(pStmt->pCols, &pReq->pCols, false); + code = columnDefNodeToField(pStmt->pCols, &pReq->pCols, false, false); } pReq->recalculateInterval = 0; if (NULL != pStmt->pOptions->pRecInterval) { @@ -17712,6 +17711,12 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DUPLICATED_COLUMN); } + if (TSDB_VIRTUAL_CHILD_TABLE == pTableMeta->tableType || TSDB_VIRTUAL_NORMAL_TABLE == pTableMeta->tableType) { + if (IS_DECIMAL_TYPE(pStmt->dataType.type)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE); + } + } + if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { @@ -18192,15 +18197,40 @@ _return: return code; } +static int32_t checkCreateVirtualTable(STranslateContext* pCxt, SCreateVTableStmt* pStmt) { + if (NULL != strchr(pStmt->tableName, '.')) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, + "The table name cannot contain '.'"); + } + + if (IS_SYS_DBNAME(pStmt->dbName)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_TSC_INVALID_OPERATION, + "Cannot create table of system database: `%s`.`%s`", pStmt->dbName, + pStmt->tableName); + } + + PAR_ERR_RET(checkVTableSchema(pCxt, pStmt)); + + PAR_ERR_RET(checkColumnOptions(pStmt->pCols)); + + if (pCxt->pParseCxt->biMode != 0) { + PAR_ERR_RET(biCheckCreateTableTbnameCol(pCxt, NULL, pStmt->pCols)); + } + + return TSDB_CODE_SUCCESS; +} + static int32_t rewriteCreateVirtualTable(STranslateContext* pCxt, SQuery* pQuery) { SCreateVTableStmt* pStmt = (SCreateVTableStmt*)pQuery->pRoot; - int32_t code = TSDB_CODE_SUCCESS;// TODO(smj):checkCreateTable(pCxt, pStmt, false); + int32_t code = TSDB_CODE_SUCCESS; SVgroupInfo info = {0}; SName name = {0}; SArray* pBufArray = NULL; SNode* pNode = NULL; int32_t index = 0; + PAR_ERR_JRET(checkCreateVirtualTable(pCxt, pStmt)); + pBufArray = taosArrayInit(1, POINTER_BYTES); if (NULL == pBufArray) { PAR_ERR_JRET(terrno); @@ -18215,6 +18245,9 @@ static int32_t rewriteCreateVirtualTable(STranslateContext* pCxt, SQuery* pQuery if (index == 0) { PAR_ERR_JRET(generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_PRIMTS_HAS_REF)); } + if (IS_DECIMAL_TYPE(pColNode->dataType.type)) { + PAR_ERR_JRET(generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE)); + } PAR_ERR_JRET(checkColRef(pCxt, pColOptions->refDb, pColOptions->refTable, pColOptions->refColumn, (SDataType){.type = pColNode->dataType.type, .bytes = calcTypeBytes(pColNode->dataType)})); @@ -18235,7 +18268,7 @@ _return: } static int32_t rewriteCreateVirtualSubTable(STranslateContext* pCxt, SQuery* pQuery) { - int32_t code = TSDB_CODE_SUCCESS;// TODO(smj):checkCreateTable(pCxt, pStmt, false); + int32_t code = TSDB_CODE_SUCCESS; SCreateVSubTableStmt* pStmt = (SCreateVSubTableStmt*)pQuery->pRoot; SVgroupInfo info = {0}; SName name = {0}; diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 3933e13b7d..a5f32d7159 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -659,11 +659,11 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pJoin->node.groupAction = GROUP_ACTION_CLEAR; pJoin->hashJoinHint = getHashJoinOptHint(pSelect->pHint); pJoin->batchScanHint = getBatchScanOptionFromHint(pSelect->pHint); - pJoin->node.requireDataOrder = pJoin->hashJoinHint ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL; + pJoin->node.requireDataOrder = (pJoin->hashJoinHint || pJoinTable->leftNoOrderedSubQuery || pJoinTable->rightNoOrderedSubQuery) ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL; pJoin->node.resultDataOrder = DATA_ORDER_LEVEL_NONE; pJoin->isLowLevelJoin = pJoinTable->isLowLevelJoin; pJoin->leftNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery; - pJoin->rightNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery; + pJoin->rightNoOrderedSubQuery = pJoinTable->rightNoOrderedSubQuery; code = nodesCloneNode(pJoinTable->pWindowOffset, &pJoin->pWindowOffset); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index abdf8065cf..4901b916f3 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -869,6 +869,10 @@ static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond, bool con } } + if (constAsPrim && ((pJoin->leftNoOrderedSubQuery && !pJoin->leftConstPrimGot) || (pJoin->rightNoOrderedSubQuery && !pJoin->rightConstPrimGot))) { + res = false; + } + tSimpleHashCleanup(pLeftTables); tSimpleHashCleanup(pRightTables); @@ -926,20 +930,26 @@ static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppInpu } if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode(*ppInput); + *ppInput = NULL; + if (NULL != *ppPrimEqCond) { *ppOnCond = pTempOnCond; - nodesDestroyNode(*ppInput); - *ppInput = NULL; return TSDB_CODE_SUCCESS; } + nodesDestroyNode(pTempOnCond); - planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length); - return TSDB_CODE_PLAN_INTERNAL_ERROR; + if (!constAsPrim) { + planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length); + return TSDB_CODE_PLAN_INTERNAL_ERROR; + } } else { nodesDestroyList(pOnConds); nodesDestroyNode(pTempOnCond); return code; } + + return code; } static int32_t pdcJoinSplitPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) { @@ -1417,7 +1427,7 @@ static int32_t pdcJoinSplitConstPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNod if (TSDB_CODE_SUCCESS == code) { pJoin->pPrimKeyEqCond = pPrimKeyEqCond; *ppCond = pJoinOnCond; - if (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot) { + if (pJoin->pPrimKeyEqCond && (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot)) { code = scalarConvertOpValueNodeTs((SOperatorNode*)pJoin->pPrimKeyEqCond); } } else { @@ -1485,7 +1495,8 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin } } - return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL); + return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PAR_NOT_SUPPORT_JOIN, + "Join requires valid time series input and primary timestamp equal condition"); } if (IS_ASOF_JOIN(pJoin->subType)) { @@ -2643,22 +2654,39 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL EOrder targetOrder = 0; SSHashObj* pTables = NULL; - if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) && - ((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) { - pScan = (SScanLogicNode*)pLeft; - pChild = pRight; - pChildPos = &pJoin->node.pChildren->pTail->pNode; - targetOrder = pScan->node.outputTsOrder; - } else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) && - ((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) { - pScan = (SScanLogicNode*)pRight; - pChild = pLeft; - pChildPos = &pJoin->node.pChildren->pHead->pNode; - targetOrder = pScan->node.outputTsOrder; + if (pJoin->node.inputTsOrder) { + targetOrder = pJoin->node.inputTsOrder; + + if (pRight->outputTsOrder == pJoin->node.inputTsOrder) { + pChild = pLeft; + pChildPos = &pJoin->node.pChildren->pHead->pNode; + } else if (pLeft->outputTsOrder == pJoin->node.inputTsOrder) { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + } else { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pLeft->outputTsOrder; + } } else { - pChild = pRight; - pChildPos = &pJoin->node.pChildren->pTail->pNode; - targetOrder = pLeft->outputTsOrder; + if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) && + ((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) { + pScan = (SScanLogicNode*)pLeft; + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pScan->node.outputTsOrder; + } else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) && + ((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) { + pScan = (SScanLogicNode*)pRight; + pChild = pLeft; + pChildPos = &pJoin->node.pChildren->pHead->pNode; + targetOrder = pScan->node.outputTsOrder; + } else { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pLeft->outputTsOrder; + } + pJoin->node.inputTsOrder = targetOrder; } if (QUERY_NODE_OPERATOR != nodeType(pJoin->pPrimKeyEqCond)) { diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index f306360bb3..1690f96ae5 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -26,6 +26,8 @@ static char* getUsageErrFormat(int32_t errCode) { return "not support cross join"; case TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND: return "Not supported join conditions"; + case TSDB_CODE_PAR_NOT_SUPPORT_JOIN: + return "Not supported join since '%s'"; case TSDB_CODE_PLAN_SLOT_NOT_FOUND: return "not found slot id by slot key"; case TSDB_CODE_PLAN_INVALID_TABLE_TYPE: diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 0db1832e17..e9d7139bad 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -1018,6 +1018,7 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) { if (qwMsg->msg) { code = qwStartDynamicTaskNewExec(QW_FPARAMS(), ctx, qwMsg); + qwMsg->msg = NULL; goto _return; } @@ -1063,6 +1064,10 @@ _return: QW_UNLOCK(QW_WRITE, &ctx->lock); } + if (qwMsg->msg) { + qDestroyOperatorParam(qwMsg->msg); + } + input.code = code; code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_FETCH, &input, NULL); diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h index 457880c172..bd30c6b664 100644 --- a/source/libs/scalar/inc/sclInt.h +++ b/source/libs/scalar/inc/sclInt.h @@ -43,6 +43,9 @@ typedef struct SScalarCtx { #define SCL_DATA_TYPE_DUMMY_HASH 9000 #define SCL_DEFAULT_OP_NUM 10 +#define SCL_NEED_SRC_TABLE_FUNC(_type) ((_type) == FUNCTION_TYPE_TIMETRUNCATE) +#define SCL_NEED_SRC_TABLE_OP(_type) ((_type) == OP_TYPE_ADD || (_type) == OP_TYPE_SUB) + #define SCL_IS_NOTNULL_CONST_NODE(_node) ((QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type)) #define SCL_IS_CONST_NODE(_node) \ ((NULL == (_node)) || SCL_IS_NOTNULL_CONST_NODE(_node)) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index d78f8ad44c..05698f0d7b 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -335,7 +335,7 @@ void sclDowngradeValueType(SValueNode *valueNode) { } case TSDB_DATA_TYPE_DOUBLE: { float f = valueNode->datum.d; - if (FLT_EQUAL(f, valueNode->datum.d)) { + if (DBL_EQUAL(f, valueNode->datum.d)) { valueNode->node.resType.type = TSDB_DATA_TYPE_FLOAT; *(float *)&valueNode->typeData = f; break; @@ -1209,6 +1209,40 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } +void sclGetValueNodeSrcTable(SNode* pNode, char** ppSrcTable, bool* multiTable) { + if (*multiTable) { + return; + } + + if (QUERY_NODE_NODE_LIST == nodeType(pNode)) { + SNodeListNode* pList = (SNodeListNode*)pNode; + SNode* pTmp = NULL; + FOREACH(pTmp, pList->pNodeList) { + sclGetValueNodeSrcTable(pTmp, ppSrcTable, multiTable); + } + + return; + } + + if (QUERY_NODE_VALUE != nodeType(pNode)) { + return; + } + + SValueNode* pValue = (SValueNode*)pNode; + if (pValue->node.srcTable[0]) { + if (*ppSrcTable) { + if (strcmp(*ppSrcTable, pValue->node.srcTable)) { + *multiTable = true; + *ppSrcTable = NULL; + } + + return; + } + + *ppSrcTable = pValue->node.srcTable; + } +} + EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { SFunctionNode *node = (SFunctionNode *)*pNode; SNode *tnode = NULL; @@ -1217,10 +1251,16 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } + char* srcTable = NULL; + bool multiTable = false; FOREACH(tnode, node->pParameterList) { if (!SCL_IS_CONST_NODE(tnode)) { return DEAL_RES_CONTINUE; } + + if (SCL_NEED_SRC_TABLE_FUNC(node->funcType)) { + sclGetValueNodeSrcTable(tnode, &srcTable, &multiTable); + } } SScalarParam output = {0}; @@ -1241,6 +1281,9 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { res->translate = true; + if (srcTable) { + tstrncpy(res->node.srcTable, srcTable, TSDB_TABLE_NAME_LEN); + } tstrncpy(res->node.aliasName, node->node.aliasName, TSDB_COL_NAME_LEN); res->node.resType.type = output.columnData->info.type; res->node.resType.bytes = output.columnData->info.bytes; @@ -1393,8 +1436,18 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_ERROR; } + char* srcTable = NULL; + bool multiTable = false; + if (SCL_NEED_SRC_TABLE_OP(node->opType)) { + sclGetValueNodeSrcTable(node->pLeft, &srcTable, &multiTable); + sclGetValueNodeSrcTable(node->pRight, &srcTable, &multiTable); + } + res->translate = true; + if (srcTable) { + tstrncpy(res->node.srcTable, srcTable, TSDB_TABLE_NAME_LEN); + } tstrncpy(res->node.aliasName, node->node.aliasName, TSDB_COL_NAME_LEN); res->node.resType = node->node.resType; if (colDataIsNull_s(output.columnData, 0)) { diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 9dc667c41e..d65118b7f3 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -65,7 +65,8 @@ int32_t setChkInDecimalHash(const void* pLeft, const void* pRight) { } int32_t setChkNotInDecimalHash(const void* pLeft, const void* pRight) { - return NULL == taosHashGet((SHashObj *)pRight, pLeft, 16) ? 1 : 0; + const SDecimalCompareCtx *pCtxL = pLeft, *pCtxR = pRight; + return NULL == taosHashGet((SHashObj *)(pCtxR->pData), pCtxL->pData, tDataTypes[pCtxL->type].bytes) ? 1 : 0; } int32_t compareChkInString(const void *pLeft, const void *pRight) { @@ -187,7 +188,7 @@ int32_t compareDoubleVal(const void *pLeft, const void *pRight) { return 1; } - if (FLT_EQUAL(p1, p2)) { + if (DBL_EQUAL(p1, p2)) { return 0; } return FLT_GREATER(p1, p2) ? 1 : -1; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 57040fc95c..eb80708b86 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -908,6 +908,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_SCAN_INTERNAL_ERROR, "Virtual table scan TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_SCAN_INVALID_DOWNSTREAM, "Virtual table scan invalid downstream operator type") TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_PRIMTS_HAS_REF, "Virtual table prim timestamp column should not has ref column") TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_NOT_VIRTUAL_SUPER_TABLE, "Create virtual child table must use virtual super table") +TAOS_DEFINE_ERROR(TSDB_CODE_VTABLE_NOT_SUPPORT_DATA_TYPE, "Virtual table not support decimal type") #ifdef TAOS_ERROR_C }; #endif diff --git a/source/util/src/thashutil.c b/source/util/src/thashutil.c index bcfe35477e..bc04fccf04 100644 --- a/source/util/src/thashutil.c +++ b/source/util/src/thashutil.c @@ -170,12 +170,13 @@ uint32_t taosDoubleHash(const char *key, uint32_t UNUSED_PARAM(len)) { return 0x7fc00000; } - if (FLT_EQUAL(f, 0.0)) { + if (DBL_EQUAL(f, 0.0)) { return 0; } if (fabs(f) < DBL_MAX / BASE - DLT) { - int32_t t = (int32_t)(round(BASE * (f + DLT))); - return (uint32_t)t; + uint64_t bits; + memcpy(&bits, &f, sizeof(double)); + return (uint32_t)(bits ^ (bits >> 32)); } else { return 0x7fc00000; } diff --git a/tests/army/query/joinConst/full_outer.today.csv b/tests/army/query/joinConst/full_outer.today.csv index 74bb393871..2f031d8c1c 100644 --- a/tests/army/query/joinConst/full_outer.today.csv +++ b/tests/army/query/joinConst/full_outer.today.csv @@ -338,17 +338,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full joi __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -357,17 +346,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/full_outer.today.in b/tests/army/query/joinConst/full_outer.today.in index 3a151cbcf2..fc41aade21 100644 --- a/tests/army/query/joinConst/full_outer.today.in +++ b/tests/army/query/joinConst/full_outer.today.in @@ -32,9 +32,7 @@ select b.c from a1 a full join (select __today__ as ts1, ts, f, g, 'a' c from b1 select b.ts from a1 a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta full join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta full join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/full_outer.today_.csv b/tests/army/query/joinConst/full_outer.today_.csv index 35e15f4dbd..2045eae48a 100644 --- a/tests/army/query/joinConst/full_outer.today_.csv +++ b/tests/army/query/joinConst/full_outer.today_.csv @@ -338,17 +338,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a full j __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -357,17 +346,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/inner.constts.csv b/tests/army/query/joinConst/inner.constts.csv index 717f20b460..7c921fb688 100644 --- a/tests/army/query/joinConst/inner.constts.csv +++ b/tests/army/query/joinConst/inner.constts.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/inner.constts.in b/tests/army/query/joinConst/inner.constts.in index 008630a119..312957bc0d 100644 --- a/tests/army/query/joinConst/inner.constts.in +++ b/tests/army/query/joinConst/inner.constts.in @@ -32,9 +32,7 @@ select b.c from a1 a join (select timestamp __today__ as ts1, ts, f, g, 'a' c fr select b.ts from a1 a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -107,9 +105,7 @@ select b.c from a1 a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from select b.ts from a1 a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; diff --git a/tests/army/query/joinConst/inner.constts2.csv b/tests/army/query/joinConst/inner.constts2.csv index 36b3fa310e..f88936e871 100644 --- a/tests/army/query/joinConst/inner.constts2.csv +++ b/tests/army/query/joinConst/inner.constts2.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/inner.constts3.csv b/tests/army/query/joinConst/inner.constts3.csv index 7016d37580..bf8758cf87 100644 --- a/tests/army/query/joinConst/inner.constts3.csv +++ b/tests/army/query/joinConst/inner.constts3.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/inner.now.csv b/tests/army/query/joinConst/inner.now.csv index a682ed51ef..f056685e21 100644 --- a/tests/army/query/joinConst/inner.now.csv +++ b/tests/army/query/joinConst/inner.now.csv @@ -80,27 +80,7 @@ taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b o taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; @@ -267,25 +247,7 @@ taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b whe taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; diff --git a/tests/army/query/joinConst/inner.now.in b/tests/army/query/joinConst/inner.now.in index 6d1f72c4a4..27d3b2538d 100644 --- a/tests/army/query/joinConst/inner.now.in +++ b/tests/army/query/joinConst/inner.now.in @@ -26,11 +26,7 @@ select a.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.c from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -98,10 +94,7 @@ select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where select b.c from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; diff --git a/tests/army/query/joinConst/inner.now_.csv b/tests/army/query/joinConst/inner.now_.csv index b5c3aafdd3..c1901ea90d 100644 --- a/tests/army/query/joinConst/inner.now_.csv +++ b/tests/army/query/joinConst/inner.now_.csv @@ -80,27 +80,7 @@ taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; @@ -267,25 +247,7 @@ taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b w taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; diff --git a/tests/army/query/joinConst/inner.today.csv b/tests/army/query/joinConst/inner.today.csv index b836987997..f88d05d5a1 100644 --- a/tests/army/query/joinConst/inner.today.csv +++ b/tests/army/query/joinConst/inner.today.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (se __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,7 +241,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | @@ -703,11 +698,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (selec __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,7 +706,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | diff --git a/tests/army/query/joinConst/inner.today.in b/tests/army/query/joinConst/inner.today.in index fcd0bee97d..ca6606989b 100644 --- a/tests/army/query/joinConst/inner.today.in +++ b/tests/army/query/joinConst/inner.today.in @@ -32,9 +32,8 @@ select b.c from a1 a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b o select b.ts from a1 a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -107,9 +106,8 @@ select b.c from a1 a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b wher select b.ts from a1 a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; diff --git a/tests/army/query/joinConst/inner.today_.csv b/tests/army/query/joinConst/inner.today_.csv index 67f23560c8..a14d0f8631 100644 --- a/tests/army/query/joinConst/inner.today_.csv +++ b/tests/army/query/joinConst/inner.today_.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a join ( __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,7 +241,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | @@ -703,11 +698,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a , (sel __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,7 +706,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | diff --git a/tests/army/query/joinConst/inner.today_ts.csv b/tests/army/query/joinConst/inner.today_ts.csv deleted file mode 100644 index 097e398e17..0000000000 --- a/tests/army/query/joinConst/inner.today_ts.csv +++ /dev/null @@ -1,811 +0,0 @@ - -taos> use test; -Database changed. - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts; -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts; -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; -taos> select a.*, b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1; - ts | f | g | ts | -================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts; -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | ts1 | ts | f | g | c | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts1 | ts | f | g | c | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.ts1,a.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts; -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000"; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | -============================================================== - | 301 | 3011 | a | - | 302 | 3012 | a | - | 303 | 3013 | a | - | 304 | 3014 | a | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | -============================================================== - | 301 | 3011 | a | - | 302 | 3012 | a | - | 303 | 3013 | a | - | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - ts1 | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000"; - -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts; -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b where a.ts = b.ts1; -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts; -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts; -taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1; -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts; -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ; -taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | -============================================================== - | 301 | 3011 | a | - | 302 | 3012 | a | - | 303 | 3013 | a | - | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -============================ - | - | - | - | - -taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1; - ts1 | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - ts1 | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ; - diff --git a/tests/army/query/joinConst/inner.tomorrow_ts.csv b/tests/army/query/joinConst/inner.tomorrow_ts.csv deleted file mode 100644 index 8987ed2577..0000000000 --- a/tests/army/query/joinConst/inner.tomorrow_ts.csv +++ /dev/null @@ -1,969 +0,0 @@ - -taos> use test; -Database changed. - -taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | ts | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; - ts | f | g | ts1 | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; - ts1 | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1; - ts | f | g | ts | -================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 | - -taos> select b.c from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | ts1 | ts | f | g | c | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts1 | ts | f | g | c | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts; - ts1 | ts | -==================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 | - -taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today; - -taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | ts | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1; - ts | f | g | ts1 | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ; - -taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ; - diff --git a/tests/army/query/joinConst/left_anti.today.csv b/tests/army/query/joinConst/left_anti.today.csv index 25d63dba19..334758e018 100644 --- a/tests/army/query/joinConst/left_anti.today.csv +++ b/tests/army/query/joinConst/left_anti.today.csv @@ -188,22 +188,8 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left ant taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_anti.today.in b/tests/army/query/joinConst/left_anti.today.in index 5fa57a29db..cdce60a51e 100644 --- a/tests/army/query/joinConst/left_anti.today.in +++ b/tests/army/query/joinConst/left_anti.today.in @@ -32,9 +32,7 @@ select b.c from a1 a left anti join (select __today__ as ts1, ts, f, g, 'a' c fr select b.ts from a1 a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left anti join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left anti join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/left_anti.today_.csv b/tests/army/query/joinConst/left_anti.today_.csv index e8595eeb7f..60dee49163 100644 --- a/tests/army/query/joinConst/left_anti.today_.csv +++ b/tests/army/query/joinConst/left_anti.today_.csv @@ -188,22 +188,8 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left a taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_outer.now.csv b/tests/army/query/joinConst/left_outer.now.csv index de72e37014..4faf7d137a 100644 --- a/tests/army/query/joinConst/left_outer.now.csv +++ b/tests/army/query/joinConst/left_outer.now.csv @@ -226,38 +226,6 @@ taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join NULL | NULL | -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== @@ -474,17 +442,5 @@ taos> select tb.val,tb.tg2,ta.* from (select now ts, last(f) val, tg2 from stb w 403 | 2 | NULL | NULL | NULL | 404 | 2 | NULL | NULL | NULL | -taos> select tb.val,tb.tg2,ta.* from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val; - val | tg2 | ts | val | tg2 | -================================================================================== - 301 | 1 | NULL | NULL | NULL | - 302 | 1 | NULL | NULL | NULL | - 303 | 1 | NULL | NULL | NULL | - 304 | 1 | NULL | NULL | NULL | - 401 | 2 | NULL | NULL | NULL | - 402 | 2 | NULL | NULL | NULL | - 403 | 2 | NULL | NULL | NULL | - 404 | 2 | NULL | NULL | NULL | - taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now; diff --git a/tests/army/query/joinConst/left_outer.now.in b/tests/army/query/joinConst/left_outer.now.in index 38279c0403..2b72f9f1f1 100644 --- a/tests/army/query/joinConst/left_outer.now.in +++ b/tests/army/query/joinConst/left_outer.now.in @@ -27,10 +27,6 @@ select b.* from a1 a left join (select __const__ as ts1, ts, f, g, 'a' from b1) select b.c from a1 a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from a1 a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -61,7 +57,6 @@ select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from b1) b left join select tb.val,tb.tg1,ta.* from (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1; select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2; select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; -select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__const__ where tb.ts=__const__ order by tb.val; select * from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>__const__ where tb.ts>__const__; diff --git a/tests/army/query/joinConst/left_outer.now_.csv b/tests/army/query/joinConst/left_outer.now_.csv index 2d5115143b..a1217d2815 100644 --- a/tests/army/query/joinConst/left_outer.now_.csv +++ b/tests/army/query/joinConst/left_outer.now_.csv @@ -226,38 +226,6 @@ taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left joi NULL | NULL | -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== @@ -474,17 +442,5 @@ taos> select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb 403 | 2 | NULL | NULL | NULL | 404 | 2 | NULL | NULL | NULL | -taos> select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val; - val | tg2 | ts | val | tg2 | -================================================================================== - 301 | 1 | NULL | NULL | NULL | - 302 | 1 | NULL | NULL | NULL | - 303 | 1 | NULL | NULL | NULL | - 304 | 1 | NULL | NULL | NULL | - 401 | 2 | NULL | NULL | NULL | - 402 | 2 | NULL | NULL | NULL | - 403 | 2 | NULL | NULL | NULL | - 404 | 2 | NULL | NULL | NULL | - taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now(); diff --git a/tests/army/query/joinConst/left_outer.today.csv b/tests/army/query/joinConst/left_outer.today.csv index 998fef2b48..9c7757d9b2 100644 --- a/tests/army/query/joinConst/left_outer.today.csv +++ b/tests/army/query/joinConst/left_outer.today.csv @@ -305,14 +305,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left joi __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -321,14 +313,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_outer.today.in b/tests/army/query/joinConst/left_outer.today.in index 193b976a62..34ccc0a610 100644 --- a/tests/army/query/joinConst/left_outer.today.in +++ b/tests/army/query/joinConst/left_outer.today.in @@ -32,9 +32,7 @@ select b.c from a1 a left join (select __today__ as ts1, ts, f, g, 'a' c from b1 select b.ts from a1 a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/left_outer.today_.csv b/tests/army/query/joinConst/left_outer.today_.csv index 11319d4ca1..72aaeb3e81 100644 --- a/tests/army/query/joinConst/left_outer.today_.csv +++ b/tests/army/query/joinConst/left_outer.today_.csv @@ -305,14 +305,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left j __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -321,14 +313,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_semi.today.csv b/tests/army/query/joinConst/left_semi.today.csv index d11a8fe4df..3d5c77a694 100644 --- a/tests/army/query/joinConst/left_semi.today.csv +++ b/tests/army/query/joinConst/left_semi.today.csv @@ -194,11 +194,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left sem __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -207,11 +202,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -224,7 +214,7 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; +taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; ts | val | tg2 | ts | val | tg2 | ============================================================================================================ __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | diff --git a/tests/army/query/joinConst/left_semi.today.in b/tests/army/query/joinConst/left_semi.today.in index 72a4a7867c..749441d5b5 100644 --- a/tests/army/query/joinConst/left_semi.today.in +++ b/tests/army/query/joinConst/left_semi.today.in @@ -32,14 +32,12 @@ select b.c from a1 a left semi join (select __today__ as ts1, ts, f, g, 'a' c fr select b.ts from a1 a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.ts, ta.val, tb.val; -select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__today__ where tb.ts=__today__ order by tb.val; +select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__today__ where tb.ts=__today__ order by tb.val; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>__today__ where tb.ts>__today__; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left semi join (select __today__ + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/left_semi.today_.csv b/tests/army/query/joinConst/left_semi.today_.csv index 45c9e7c4db..60a91d1b81 100644 --- a/tests/army/query/joinConst/left_semi.today_.csv +++ b/tests/army/query/joinConst/left_semi.today_.csv @@ -194,11 +194,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left s __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -207,11 +202,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select today() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -224,7 +214,7 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val; +taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val; ts | val | tg2 | ts | val | tg2 | ============================================================================================================ __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | diff --git a/tests/army/query/joinConst/others.csv b/tests/army/query/joinConst/others.csv new file mode 100644 index 0000000000..89fa11a41f --- /dev/null +++ b/tests/army/query/joinConst/others.csv @@ -0,0 +1,880 @@ + +taos> use test; +Database changed. + +taos> select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1s, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from (select ts + 2s as ts,f from a1) a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | ts | f | g | 'a' | +==================================================================================================== + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts + 1d + 1s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1s, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from (select ts + 2s as ts,f from a1) a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | ts | f | g | 'a' | +==================================================================================================== + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts + 1d + 1s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts order by b.ts, b.f desc; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | + +taos> select count(*) from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts group by b.ts order by b.ts; + count(*) | +======================== + 4 | + +taos> select b.ts, count(*) from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts group by b.ts order by b.ts; + ts | count(*) | +================================================== + NULL | 3 | + __today__ 00:00:00.000 | 4 | + +taos> select * from (select * from a1 order by ts desc) a join (select today as ts1, * from b1 order by ts1 desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*table+subq*/ +taos> select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> /*table+const subq*/ +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*subq+subq*/ +taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts desc) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> /*subq+const subq*/ +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*const subq+const subq*/ +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> /*functions*/ +taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) + 1s as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*view*/ +taos> select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is null; + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is not null; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + diff --git a/tests/army/query/joinConst/others.in b/tests/army/query/joinConst/others.in new file mode 100644 index 0000000000..3c07a8ec8b --- /dev/null +++ b/tests/army/query/joinConst/others.in @@ -0,0 +1,129 @@ +use test; + +select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts, 1d); +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1s, 1d); +select * from (select ts + 2s as ts,f from a1) a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts + 1d + 1s; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + +select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts, 1d); +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1s, 1d); +select * from (select ts + 2s as ts,f from a1) a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts + 1d + 1s; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + +select * from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts order by b.ts, b.f desc; +select count(*) from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts group by b.ts order by b.ts; +select b.ts, count(*) from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts group by b.ts order by b.ts; +select * from (select * from a1 order by ts desc) a join (select today as ts1, * from b1 order by ts1 desc) b on a.ts = b.ts1; + +/*table+subq*/ +select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts; +select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; + +/*table+const subq*/ +select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + + +/*subq+subq*/ +select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts; +select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select * from a1 order by ts desc) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + +/*subq+const subq*/ +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + +/*const subq+const subq*/ +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + + +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + + +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + + +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + +/*functions*/ +select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1; +select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1; +select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) as ts1, * from b1) b on a.ts = b.ts1; +select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) + 1s as ts1, * from b1) b on a.ts = b.ts1; + +/*view*/ +select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts; +select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; +select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts; +select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is null; +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is not null; +select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1; diff --git a/tests/army/query/joinConst/right_outer.today.csv b/tests/army/query/joinConst/right_outer.today.csv index e44401dc75..041ad5bd70 100644 --- a/tests/army/query/joinConst/right_outer.today.csv +++ b/tests/army/query/joinConst/right_outer.today.csv @@ -266,14 +266,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a right jo __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -282,14 +274,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/right_outer.today.in b/tests/army/query/joinConst/right_outer.today.in index 62d2b80e53..dc02ea5a4d 100644 --- a/tests/army/query/joinConst/right_outer.today.in +++ b/tests/army/query/joinConst/right_outer.today.in @@ -32,9 +32,7 @@ select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b select b.ts from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta right join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta right join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/right_outer.today_.csv b/tests/army/query/joinConst/right_outer.today_.csv index 9dbbf595bc..b71ef19aaa 100644 --- a/tests/army/query/joinConst/right_outer.today_.csv +++ b/tests/army/query/joinConst/right_outer.today_.csv @@ -266,14 +266,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a right __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -282,14 +274,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/test_join_const.py b/tests/army/query/test_join_const.py index 2e0d698cc3..75ab74b7ac 100644 --- a/tests/army/query/test_join_const.py +++ b/tests/army/query/test_join_const.py @@ -63,6 +63,8 @@ class TDTestCase(TBase): tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}', 403, 4013);") tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}' + 3s, 404, 4014);") + tdSql.execute(f"create view view1 as select today() as ts1, * from a1;") + def replace_string(self, input_file, output_file, old_str, new_str): script_dir = os.path.dirname(os.path.abspath(__file__)) with open(f"{script_dir}/joinConst/{input_file}", 'r') as f_in, open(f"{script_dir}/joinConst/{output_file}", 'w') as f_out: @@ -148,22 +150,68 @@ class TDTestCase(TBase): tdLog.printNoPrefix(f"==========step:nocheck test") tdSql.execute("select * from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") tdSql.execute("select * from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") - tdSql.execute("select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") - tdSql.execute("select * from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") - tdSql.execute("select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") - tdSql.execute("select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") - tdSql.execute("select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") - tdSql.execute("select * from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") - tdSql.execute("select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") - tdSql.execute("select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") - tdSql.execute("select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") + tdSql.execute("select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") + tdSql.execute("select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") + tdSql.execute("select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") + tdSql.execute("select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") + tdSql.execute("select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") + tdSql.execute("select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") + tdSql.execute("select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") + tdSql.execute("select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") + tdSql.execute("select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") + tdSql.execute("select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;") + tdSql.execute("select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;") + tdSql.execute("select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;") + tdSql.execute("select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;") def test_abnormal_case(self): tdLog.printNoPrefix(f"==========step:abnormal case test") tdSql.error(f"select * from a1 a join (select '{self.today_ts}' as ts from b1) b on a.ts = b.ts;") tdSql.error(f"select * from a1 a join (select '{self.today_ts}' + 1s as ts from b1) b on a.ts = b.ts;") + tdSql.error(f"select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;") + tdSql.error(f"select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;") + tdSql.error(f"select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;") tdSql.error(f"select * from a1 a left asof join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") tdSql.error(f"select * from a1 a left window join (select now as ts1, ts, f, g, 'a' c from b1) b window_offset(-1s, 1s);") + tdSql.error(f"select * from a1 a join (select timestamp '{self.today_ts}' + 1d as ts, f, g, 'a' from b1) b on timetruncate(a.ts + 1s, 1d) = timetruncate(b.ts, 1d);") + tdSql.error(f"select * from a1 a join (select timestamp '{self.today_ts}' + 1d as ts, f, g, 'a' from b1) b on a.ts + 1s = timetruncate(b.ts, 1d);") + tdSql.error(f"select t1.* from sta t1, (select _wstart as ts, count(*) from sta partition by tbname interval(1d)) t2 where t1.ts = t2.ts;") + tdSql.error(f"select * from (select tg1, sum(f) s from sta group by tg1) t1, sta t2 where t1.tg1 = t2.tg1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f) a join (select today as ts1, * from b1 order by f desc) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today as ts1, * from b1 order by f) b on a.ts = b.ts1;") + tdSql.error(f"select * from a1 a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts) a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts desc) a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f) a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;") + + def test_others_case(self, testCase): + tdLog.printNoPrefix(f"==========step:{testCase} test") + self.replace_string(f'{testCase}.in', f'{testCase}.in.tmp1', '__today__', f'{self.today_date}') + self.replace_string(f'{testCase}.in.tmp1', f'{testCase}.in.tmp2', '__tomorrow__', f'{self.tomorrow_date}') + self.replace_string(f'{testCase}.csv', f'{testCase}.csv.tmp1', '__today__', f'{self.today_date}') + self.replace_string2(f'{testCase}.csv.tmp1', f'{testCase}.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}') + # read sql from .sql file and execute + self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.tmp2") + self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.csv.tmp2") + tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) def run(self): tdLog.debug(f"start to excute {__file__}") @@ -182,6 +230,9 @@ class TDTestCase(TBase): self.test_today_case("left_semi") self.test_today_case("left_anti") + self.test_others_case("others") + + self.test_nocheck_case() self.test_abnormal_case() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/army/vtable/ans/test_vstable_select_test_function.ans b/tests/army/vtable/ans/test_vstable_select_test_function.ans index f99e727473..13395ec394 100644 --- a/tests/army/vtable/ans/test_vstable_select_test_function.ans +++ b/tests/army/vtable/ans/test_vstable_select_test_function.ans @@ -3018,7 +3018,7 @@ taos> select stateduration(u_tinyint_col, "GT", 20, 1a) from test_vtable_select. taos> select twa(int_col) from test_vtable_select.vtb_virtual_stb limit 50; twa(int_col) | ============================ - -353350886.922845 | + -353350600.12852 | taos> select abs(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; abs(int_tag) | diff --git a/tests/army/vtable/ans/test_vstable_select_test_partition.ans b/tests/army/vtable/ans/test_vstable_select_test_partition.ans index 19e6594443..c1b38d390e 100644 --- a/tests/army/vtable/ans/test_vstable_select_test_partition.ans +++ b/tests/army/vtable/ans/test_vstable_select_test_partition.ans @@ -1,2748 +1,779 @@ -taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; - count(*) | -======================== - 123 | - 117 | - 120 | - 114 | - 102 | - 144 | - 129 | - 126 | - 117 | - 141 | - -taos> select u_tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; - u_tinyint_col | -================ - 147 | - 147 | - 147 | - 147 | - 147 | - 147 | - 147 | - 147 | - 147 | - 147 | - 74 | - 74 | - 74 | - 74 | - 74 | - 74 | - 74 | - 74 | - 74 | - 74 | - 131 | - 131 | - 131 | - 131 | - 131 | - 131 | - 131 | - 131 | - 131 | - 131 | - 32 | - 32 | - 32 | - 32 | - 32 | - 32 | - 32 | - 32 | - 32 | - 32 | - 38 | - 38 | - 38 | - 38 | - 38 | - 38 | - 38 | - 38 | - 38 | - 38 | - 107 | - 107 | - 107 | - 107 | - 107 | - 107 | - 107 | - 107 | - 107 | - 107 | - 99 | - 99 | - 99 | - 99 | - 99 | - 99 | - 99 | - 99 | - 99 | - 99 | - 27 | - 27 | - 27 | - 27 | - 27 | - 27 | - 27 | - 27 | - 27 | - 27 | - 236 | - 236 | - 236 | - 236 | - 236 | - 236 | - 236 | - 236 | - 236 | - 236 | - 28 | - 28 | - 28 | - 28 | - 28 | - 28 | - 28 | - 28 | - 28 | - 28 | - -taos> select u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; - u_tinyint_col | count(*) | -======================================== - 53 | 123 | - 200 | 117 | - 123 | 120 | - 40 | 114 | - 95 | 102 | - 199 | 144 | - 148 | 129 | - 246 | 126 | - 62 | 117 | - 73 | 141 | - -taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; - avg(u_int_col) | -============================ - 1028873224.42857 | - 888169202.428571 | - 1284831992.4 | - 1213219741.5 | - 1036655843.88889 | - 885581107.133333 | - 1210190929 | - 1242603651.25 | - 1064520777.50475 | - 1125175011.14286 | - -taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; - avg(u_tinyint_col) | avg(u_smallint_col) | avg(u_int_col) | avg(u_bigint_col) | avg(tinyint_col) | avg(smallint_col) | avg(int_col) | avg(bigint_col) | avg(float_col) | avg(double_col) | -======================================================================================================================================================================================================================================================================================== - 53 | 30425.5 | 1028873224.42857 | 860409305.04878 | 24.6428571428571 | -2702.14285714286 | -99490046.7804878 | -9.22337203685478e+18 | -21495.173828125 | -10876564.2760549 | - 200 | 33504.3636363636 | 888169202.428571 | 1105380030.89744 | -20.1818181818182 | -6111 | -6921473.48717949 | -9.22337203685478e+18 | 22663.0711495536 | -735864.115682693 | - 123 | 14792 | 1284831992.4 | 1094468696.275 | -31.5 | -9847.8 | -93953831.9 | -9.22337203685478e+18 | 6084.466796875 | 7485514.31069892 | - 40 | 31921.3 | 1213219741.5 | 944097612.947368 | -24.4 | -12463.75 | -81547448.0263158 | -9.22337203685478e+18 | -22996.3908691406 | -14579498.9412049 | - 95 | 37216.8181818182 | 1036655843.88889 | 1051868190.52941 | -4 | 9757.66666666667 | 88249851.8823529 | -9.22337203685478e+18 | 14119.2298719618 | -10294910.3421566 | - 199 | 27066.1333333333 | 885581107.133333 | 1020446067.9375 | 11 | -5719.26666666667 | -159480467.708333 | -9.22337203685478e+18 | -17224.8049479167 | -6478565.20549075 | - 148 | 26848.5555555556 | 1210190929 | 1190211958.23256 | 31.3888888888889 | 7762.6 | 63416765.5348837 | -9.22337203685478e+18 | -27510.260546875 | 7675938.01362484 | - 246 | 35478.3333333333 | 1242603651.25 | 1133174619.30952 | 18.8888888888889 | -8153.25 | -65575556.7380952 | -9.22337203685478e+18 | 8742.40209960938 | -8027519.33521655 | - NULL | 33219.3126312631 | 1064520777.50475 | NULL | -1.8027302730273 | 282.548125 | NULL | -9.22337203685478e+18 | -316.811431817502 | NULL | - 62 | 37324.5454545455 | 1125175011.14286 | 1122699832.97436 | 16.3636363636364 | -8076.42857142857 | -33417070.5128205 | -9.22337203685478e+18 | -7440.70228794643 | 2900867.48596513 | - -taos> select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; - ts | u_tinyint_col | u_smallint_col | u_int_col | u_bigint_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | bool_col | binary_16_col | binary_32_col | nchar_16_col | nchar_32_col | int_tag | bool_tag | float_tag | double_tag | nchar_32_tag | binary_32_tag | -======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== - 2020-10-01 00:00:00.232 | 147 | NULL | NULL | NULL | NULL | NULL | -460447109 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.602 | 147 | 27457 | NULL | NULL | NULL | NULL | -410652337 | -9223372036854775808 | NULL | NULL | NULL | NULL | Tianjin - Mountain View | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.726 | 147 | NULL | NULL | NULL | NULL | NULL | -571286863 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.068 | 147 | NULL | NULL | NULL | NULL | NULL | -743496295 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.088 | 147 | 49614 | NULL | NULL | NULL | NULL | -920561986 | -9223372036854775808 | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | 四。San Jose | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.584 | 147 | NULL | NULL | NULL | NULL | NULL | -729368262 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.772 | 147 | 61827 | NULL | NULL | NULL | NULL | -802060251 | -9223372036854775808 | NULL | NULL | NULL | NULL | Harbin - Campbell | 一。San Franc | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.082 | 147 | NULL | NULL | NULL | NULL | NULL | -587762352 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.258 | 147 | NULL | NULL | NULL | NULL | NULL | -922068456 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.008 | 147 | NULL | NULL | NULL | NULL | NULL | -901636173 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | NULL | NULL | NULL | -439167365 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.348 | 74 | 29449 | NULL | NULL | NULL | NULL | 757512603 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.928 | 74 | NULL | NULL | NULL | NULL | NULL | 189362212 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.964 | 74 | 48960 | NULL | NULL | NULL | NULL | 971707439 | -9223372036854775808 | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | 二。Los Angle | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.072 | 74 | NULL | NULL | NULL | NULL | NULL | -668036251 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.202 | 74 | NULL | NULL | NULL | NULL | NULL | 964074821 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.330 | 74 | NULL | 1284919093 | NULL | NULL | NULL | -919492632 | NULL | -31536.1 | NULL | NULL | NULL | Xian - Sunnyvale | NULL | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:07.958 | 74 | NULL | NULL | NULL | NULL | NULL | -457045598 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:08.246 | 74 | NULL | NULL | NULL | NULL | NULL | -1009560953 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:08.278 | 74 | NULL | NULL | NULL | NULL | NULL | -149903175 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.558 | 131 | NULL | NULL | NULL | NULL | NULL | -1048576778 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.852 | 131 | NULL | NULL | NULL | NULL | NULL | 673661835 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.898 | 131 | 32579 | NULL | NULL | NULL | NULL | 75056466 | -9223372036854775808 | NULL | NULL | NULL | NULL | Xian - Sunnyvale | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.674 | 131 | NULL | NULL | NULL | NULL | NULL | -536304660 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.588 | 131 | NULL | NULL | NULL | NULL | NULL | -463612190 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.734 | 131 | NULL | NULL | NULL | NULL | NULL | 61740199 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.872 | 131 | NULL | NULL | NULL | NULL | NULL | -241208953 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:06.278 | 131 | NULL | NULL | NULL | NULL | NULL | 963383459 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:07.036 | 131 | NULL | NULL | NULL | NULL | NULL | 818840337 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:07.734 | 131 | 34000 | NULL | NULL | NULL | NULL | -159422538 | -9223372036854775808 | NULL | NULL | NULL | NULL | Tianjin - Mountain View | 九。Santa Cla | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.452 | 32 | NULL | NULL | NULL | NULL | NULL | 82187879 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.668 | 32 | NULL | NULL | NULL | NULL | NULL | -484307836 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.144 | 32 | NULL | NULL | NULL | NULL | NULL | -450973254 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.554 | 32 | 30671 | NULL | NULL | NULL | NULL | -249002287 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.936 | 32 | NULL | NULL | NULL | NULL | NULL | 279804462 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.412 | 32 | 33249 | NULL | NULL | NULL | NULL | 941668452 | -9223372036854775808 | NULL | NULL | NULL | NULL | Harbin - Campbell | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.210 | 32 | 64223 | 2098425019 | NULL | NULL | NULL | -45171051 | -9223372036854775808 | -31629.2 | NULL | NULL | NULL | Shanghai - Los Angles | 六。Campbell | 洛杉矶 - Los Angles | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.516 | 32 | 38427 | NULL | NULL | NULL | NULL | 1056582881 | -9223372036854775808 | NULL | NULL | NULL | NULL | Chengdu - San Jose | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.524 | 32 | NULL | NULL | NULL | NULL | NULL | -153486560 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.760 | 32 | NULL | 538499383 | NULL | NULL | NULL | 655460616 | NULL | -65565.6 | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | 山景城 - Mountain View | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.082 | 38 | NULL | NULL | NULL | NULL | NULL | 595381597 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.260 | 38 | NULL | 1492999959 | NULL | NULL | NULL | 881279464 | NULL | -28384 | NULL | NULL | NULL | Hangzhou - San Diego | NULL | 坎贝尔 - Campbell | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.276 | 38 | 52138 | NULL | NULL | NULL | NULL | 183482115 | -9223372036854775808 | NULL | NULL | NULL | NULL | Beijing - San Francisco | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.284 | 38 | NULL | NULL | NULL | NULL | NULL | -199053968 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.700 | 38 | NULL | 1706614877 | NULL | NULL | NULL | -678744674 | NULL | -54043.4 | NULL | NULL | NULL | Chengdu - San Jose | NULL | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.916 | 38 | NULL | NULL | NULL | NULL | NULL | 1073241722 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.690 | 38 | NULL | 767222390 | NULL | NULL | NULL | 1007148068 | NULL | -72249.1 | NULL | NULL | NULL | Tianjin - Mountain View | NULL | 洛杉矶 - Los Angles | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.082 | 38 | NULL | NULL | NULL | NULL | NULL | 140477558 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.352 | 38 | NULL | NULL | NULL | NULL | NULL | -854437881 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.444 | 38 | 32286 | NULL | NULL | NULL | NULL | 45124452 | -9223372036854775808 | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | 九。Santa Cla | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.584 | 107 | NULL | NULL | NULL | NULL | NULL | 414314371 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.792 | 107 | 11524 | NULL | NULL | NULL | NULL | 513579401 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 九。Santa Cla | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.408 | 107 | NULL | NULL | NULL | NULL | NULL | -593725598 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.552 | 107 | NULL | NULL | NULL | NULL | NULL | -1062786552 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.856 | 107 | NULL | NULL | NULL | NULL | NULL | 811642255 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.300 | 107 | NULL | 2790824 | NULL | NULL | NULL | 123027512 | NULL | -6043.31 | NULL | NULL | NULL | Harbin - Campbell | NULL | 旧金山 - San Francisco | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.364 | 107 | 34329 | NULL | NULL | NULL | NULL | -122612157 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.522 | 107 | 48695 | NULL | NULL | NULL | NULL | 636997161 | -9223372036854775808 | NULL | NULL | NULL | NULL | Beijing - San Francisco | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.548 | 107 | NULL | NULL | NULL | NULL | NULL | -440811714 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.496 | 107 | NULL | NULL | NULL | NULL | NULL | 648246838 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.360 | 99 | 13928 | 1671130288 | NULL | NULL | NULL | -929805245 | -9223372036854775808 | -52879.2 | NULL | NULL | NULL | Tianjin - Mountain View | 二。Los Angle | 库比蒂诺 - Cupertino | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.438 | 99 | NULL | NULL | NULL | NULL | NULL | 321171903 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.530 | 99 | NULL | 300207263 | NULL | NULL | NULL | -147180244 | NULL | -25749.3 | NULL | NULL | NULL | Shanghai - Los Angles | NULL | 旧金山 - San Francisco | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.858 | 99 | NULL | NULL | NULL | NULL | NULL | 997371612 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.416 | 99 | NULL | NULL | NULL | NULL | NULL | -602216735 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.784 | 99 | NULL | NULL | NULL | NULL | NULL | 887388117 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.378 | 99 | NULL | NULL | NULL | NULL | NULL | -486490449 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.126 | 99 | NULL | NULL | NULL | NULL | NULL | -436459382 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:06.150 | 99 | 30104 | 1509919549 | NULL | NULL | NULL | 526036876 | -9223372036854775808 | 32843.2 | NULL | NULL | NULL | Shanghai - Los Angles | 九。Santa Cla | 圣何塞 - San Jose | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:06.506 | 99 | NULL | NULL | NULL | NULL | NULL | -699238997 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.468 | 27 | 537 | NULL | NULL | NULL | NULL | -217181232 | -9223372036854775808 | NULL | NULL | NULL | NULL | Xian - Sunnyvale | 九。Santa Cla | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.616 | 27 | NULL | NULL | NULL | NULL | NULL | -433988779 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.938 | 27 | NULL | NULL | NULL | NULL | NULL | 374102112 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.978 | 27 | 7354 | NULL | NULL | NULL | NULL | -765858623 | -9223372036854775808 | NULL | NULL | NULL | NULL | Chengdu - San Jose | 一。San Franc | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.990 | 27 | 48370 | 1127922142 | NULL | NULL | NULL | 535179865 | -9223372036854775808 | -64733.4 | NULL | NULL | NULL | Hangzhou - San Diego | 八。Sunnyvale | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.098 | 27 | 45874 | NULL | NULL | NULL | NULL | -332537809 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.172 | 27 | NULL | NULL | NULL | NULL | NULL | -684057325 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.442 | 27 | NULL | NULL | NULL | NULL | NULL | -875590914 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.768 | 27 | NULL | NULL | NULL | NULL | NULL | -1009505558 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.478 | 27 | 7959 | NULL | NULL | NULL | NULL | 466059974 | -9223372036854775808 | NULL | NULL | NULL | NULL | Tianjin - Mountain View | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.794 | 236 | NULL | NULL | NULL | NULL | NULL | 687912758 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.788 | 236 | 59952 | NULL | NULL | NULL | NULL | 826152215 | -9223372036854775808 | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.216 | 236 | NULL | NULL | NULL | NULL | NULL | -1030945741 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.296 | 236 | NULL | NULL | NULL | NULL | NULL | 741619714 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.484 | 236 | NULL | NULL | NULL | NULL | NULL | -700980217 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.268 | 236 | NULL | NULL | NULL | NULL | NULL | 776268561 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.858 | 236 | NULL | NULL | NULL | NULL | NULL | 502800702 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.832 | 236 | 14111 | NULL | NULL | NULL | NULL | -738906050 | -9223372036854775808 | NULL | NULL | NULL | NULL | Beijing - San Francisco | 十。Cupertino | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:06.482 | 236 | NULL | NULL | NULL | NULL | NULL | -535355173 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:06.518 | 236 | NULL | NULL | NULL | NULL | NULL | 724893827 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.244 | 28 | NULL | NULL | NULL | NULL | NULL | 407051179 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.940 | 28 | NULL | 57045486 | NULL | NULL | NULL | -611558633 | NULL | 39641.1 | NULL | NULL | NULL | Beijing - San Francisco | NULL | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.980 | 28 | NULL | 624308946 | NULL | NULL | NULL | -971241563 | NULL | 44146.6 | NULL | NULL | NULL | Xian - Sunnyvale | NULL | 圣何塞 - San Jose | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.284 | 28 | 40277 | NULL | NULL | NULL | NULL | -924988902 | -9223372036854775808 | NULL | NULL | NULL | NULL | Harbin - Campbell | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.426 | 28 | NULL | NULL | NULL | NULL | NULL | 134957013 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.888 | 28 | NULL | NULL | NULL | NULL | NULL | 920829832 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.742 | 28 | NULL | NULL | NULL | NULL | NULL | -729056319 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.376 | 28 | NULL | NULL | NULL | NULL | NULL | 643833679 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.412 | 28 | 59042 | NULL | NULL | NULL | NULL | -623575102 | -9223372036854775808 | NULL | NULL | NULL | NULL | Xian - Sunnyvale | 四。San Jose | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.940 | 28 | 28034 | 1654703185 | NULL | NULL | NULL | -228564557 | -9223372036854775808 | 8759.87 | NULL | NULL | NULL | Chengdu - San Jose | 一。San Franc | 圣何塞 - San Jose | 1 | false | 1 | 1 | child1 | child1 | - -taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; count(*) | ======================== 57 | - 138 | - 132 | - 102 | - 117 | - 123 | - 111 | - 120 | - 111 | - 93 | + 66 | + 75 | + 78 | + 81 | + 81 | + 84 | + 84 | + 84 | + 87 | -taos> select u_tinyint_col + 1 from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +taos> select u_tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; + u_tinyint_col | +================ + 0 | + 0 | + 0 | + 0 | + 0 | + 0 | + 0 | + 0 | + 0 | + 0 | + +taos> select u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; + u_tinyint_col | count(*) | +======================================== + 0 | 138 | + 1 | 132 | + 2 | 102 | + 3 | 117 | + 4 | 123 | + 5 | 102 | + 6 | 117 | + 7 | 117 | + 8 | 114 | + 9 | 162 | + +taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; + avg(u_int_col) | +============================ + 355960882.333333 | + 495880456 | + 545948462.6 | + 575820982.8 | + 583128162.6 | + 597333081.666667 | + 611144244.1 | + 616492895 | + 628372837.5 | + 650681226.888889 | + +taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; + avg(u_tinyint_col) | avg(u_smallint_col) | avg(u_int_col) | avg(u_bigint_col) | avg(tinyint_col) | avg(smallint_col) | avg(int_col) | avg(bigint_col) | avg(float_col) | avg(double_col) | +======================================================================================================================================================================================================================================================================================== + NULL | 33219.3126312631 | 1064520777.50475 | NULL | -1.8027302730273 | 282.548125 | NULL | -9.22337203685478e+18 | -316.811431817502 | NULL | + 0 | 32553.2307692308 | 1001479108.5 | 1180661432.41304 | -17.4615384615385 | 2934.5 | -3803401.56521739 | -9.22337203685478e+18 | 13721.1726888021 | -4646513.48510622 | + 1 | 30707.2 | 737219949.111111 | 1108589656.68182 | -18.6 | -1146.77777777778 | -66257392.25 | -9.22337203685478e+18 | 4392.15321180556 | 535582.580240069 | + 2 | 35524.2142857143 | 1533345536.2 | 1012609326.14706 | -0.785714285714286 | 9207.8 | 50244262.2941176 | -9.22337203685478e+18 | 2357.97890625 | 6142083.2282555 | + 3 | 33242.6 | 1361502144.5 | 933709179.948718 | -11.6 | -3235.625 | 154885334.948718 | -9.22337203685478e+18 | 23445.6504211426 | 11218824.0760349 | + 4 | 29779.4375 | 1443245381.5 | 1176711614.95122 | 27.9375 | -1656.83333333333 | 14666685.2195122 | -9.22337203685478e+18 | 8945.05159505208 | -4764848.01668707 | + 5 | 32925.7272727273 | 865617643.5 | 1136101091.20588 | -42.5454545454545 | 2880.25 | 17021034.0588235 | -9.22337203685478e+18 | 21866.7925415039 | 2915765.137079 | + 6 | 26627.5 | 992573189.625 | 1063176194.41026 | 23.4166666666667 | -9844.125 | -128265778.820513 | -9.22337203685478e+18 | -21368.9774169922 | 7151907.29768379 | + 7 | 29818.5454545455 | 1007210883.25 | 1148559331.92308 | -22.5454545454545 | 9341.625 | -13430176.025641 | -9.22337203685478e+18 | 16469.6047363281 | -19931226.9753984 | + 8 | 30334.6666666667 | 1035784689 | 1229215272.31579 | -31.8888888888889 | -145.666666666667 | 36091812.7894737 | -9.22337203685478e+18 | 16991.1941731771 | -8697205.63416163 | + +taos> select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1, 2, int_tag slimit 10 limit 10; + ts | u_tinyint_col | u_smallint_col | u_int_col | u_bigint_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | bool_col | binary_16_col | binary_32_col | nchar_16_col | nchar_32_col | int_tag | bool_tag | float_tag | double_tag | nchar_32_tag | binary_32_tag | +======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | NULL | NULL | NULL | -77824226 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | + +taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; + count(*) | +======================== + 57 | + 66 | + 75 | + 78 | + 81 | + 81 | + 84 | + 84 | + 84 | + 87 | + +taos> select u_tinyint_col + 1 from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; u_tinyint_col + 1 | ============================ - 36 | - 36 | - 36 | - 36 | - 36 | - 36 | - 36 | - 36 | - 36 | - 36 | - 188 | - 188 | - 188 | - 188 | - 188 | - 188 | - 188 | - 188 | - 188 | - 188 | - 232 | - 232 | - 232 | - 232 | - 232 | - 232 | - 232 | - 232 | - 232 | - 232 | - 210 | - 210 | - 210 | - 210 | - 210 | - 210 | - 210 | - 210 | - 210 | - 210 | - 45 | - 45 | - 45 | - 45 | - 45 | - 45 | - 45 | - 45 | - 45 | - 45 | - 55 | - 55 | - 55 | - 55 | - 55 | - 55 | - 55 | - 55 | - 55 | - 55 | - 239 | - 239 | - 239 | - 239 | - 239 | - 239 | - 239 | - 239 | - 239 | - 239 | - 126 | - 126 | - 126 | - 126 | - 126 | - 126 | - 126 | - 126 | - 126 | - 126 | - 61 | - 61 | - 61 | - 61 | - 61 | - 61 | - 61 | - 61 | - 61 | - 61 | - 30 | - 30 | - 30 | - 30 | - 30 | - 30 | - 30 | - 30 | - 30 | - 30 | + 1 | + 1 | + 1 | + 1 | + 1 | + 1 | + 1 | + 1 | + 1 | + 1 | -taos> select u_tinyint_col + 1, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +taos> select u_tinyint_col + 1, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; u_tinyint_col + 1 | count(*) | ==================================================== - 51 | 57 | - 163 | 138 | - 127 | 132 | - 117 | 102 | - 93 | 117 | - 171 | 123 | - 59 | 111 | - 62 | 120 | - 138 | 111 | - 53 | 93 | + 1 | 138 | + 2 | 132 | + 3 | 102 | + 4 | 117 | + 5 | 123 | + 6 | 102 | + 7 | 117 | + 8 | 117 | + 9 | 114 | + 10 | 162 | -taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; avg(u_int_col) | ============================ - 1156850594.16667 | - 1147037435.54545 | - 901849629.533333 | - 729674734.333333 | - 788392019.2 | - 772541525.5 | - 1486377937.375 | - 1048132211.2 | - 1064520777.50475 | - 1190343214.71429 | + 355960882.333333 | + 495880456 | + 545948462.6 | + 575820982.8 | + 583128162.6 | + 597333081.666667 | + 611144244.1 | + 616492895 | + 628372837.5 | + 650681226.888889 | -taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; avg(u_tinyint_col) | avg(u_smallint_col) | avg(u_int_col) | avg(u_bigint_col) | avg(tinyint_col) | avg(smallint_col) | avg(int_col) | avg(bigint_col) | avg(float_col) | avg(double_col) | ======================================================================================================================================================================================================================================================================================== - 50 | 23105 | 1156850594.16667 | 1031966508.94737 | -39.3333333333333 | 833 | -139525498.526316 | -9.22337203685478e+18 | 22431.2509765625 | -9672404.91357958 | - 162 | 27422.6666666667 | 1147037435.54545 | 1196660330.65217 | 1.46666666666667 | 6581.45454545455 | -36379314.4782609 | -9.22337203685478e+18 | -19514.0027521307 | 3408191.85054522 | - 126 | 27568.6875 | 901849629.533333 | 1035889388.31818 | -10.6875 | -404.066666666667 | -57721963.0454545 | -9.22337203685478e+18 | -3641.29222005208 | -8153571.56634373 | - 116 | 36569.5555555556 | 729674734.333333 | 1228840288.29412 | -15.4444444444444 | 3754 | -80070468.0294118 | -9.22337203685478e+18 | -5320.31998697917 | -2801712.72194927 | - 92 | 28450.5 | 788392019.2 | 967004704.538462 | 37.8 | -4215.3 | 35185059.4871795 | -9.22337203685478e+18 | -14478.566015625 | -6559591.44702367 | - 170 | 36197.2941176471 | 772541525.5 | 1062102284 | 11.7647058823529 | -6261.33333333333 | -92083676.8536585 | -9.22337203685478e+18 | -7206.72159830729 | 15868031.5666725 | - 58 | 28989.5833333333 | 1486377937.375 | 968838306.162162 | -7.91666666666667 | 3150.625 | -37471900.7297297 | -9.22337203685478e+18 | -8461.26239013672 | -5075391.34656124 | - 61 | 27718.5 | 1048132211.2 | 970961443.75 | -7.21428571428571 | 5722.4 | 93787872.75 | -9.22337203685478e+18 | 18598.4788085938 | -20976207.8561072 | NULL | 33219.3126312631 | 1064520777.50475 | NULL | -1.8027302730273 | 282.548125 | NULL | -9.22337203685478e+18 | -316.811431817502 | NULL | - 137 | 23912.7142857143 | 1190343214.71429 | 1016128313.37838 | 4.07142857142857 | 12990.8571428571 | -86751629.1081081 | -9.22337203685478e+18 | 3789.93579101562 | -10319134.4559422 | + 0 | 32553.2307692308 | 1001479108.5 | 1180661432.41304 | -17.4615384615385 | 2934.5 | -3803401.56521739 | -9.22337203685478e+18 | 13721.1726888021 | -4646513.48510622 | + 1 | 30707.2 | 737219949.111111 | 1108589656.68182 | -18.6 | -1146.77777777778 | -66257392.25 | -9.22337203685478e+18 | 4392.15321180556 | 535582.580240069 | + 2 | 35524.2142857143 | 1533345536.2 | 1012609326.14706 | -0.785714285714286 | 9207.8 | 50244262.2941176 | -9.22337203685478e+18 | 2357.97890625 | 6142083.2282555 | + 3 | 33242.6 | 1361502144.5 | 933709179.948718 | -11.6 | -3235.625 | 154885334.948718 | -9.22337203685478e+18 | 23445.6504211426 | 11218824.0760349 | + 4 | 29779.4375 | 1443245381.5 | 1176711614.95122 | 27.9375 | -1656.83333333333 | 14666685.2195122 | -9.22337203685478e+18 | 8945.05159505208 | -4764848.01668707 | + 5 | 32925.7272727273 | 865617643.5 | 1136101091.20588 | -42.5454545454545 | 2880.25 | 17021034.0588235 | -9.22337203685478e+18 | 21866.7925415039 | 2915765.137079 | + 6 | 26627.5 | 992573189.625 | 1063176194.41026 | 23.4166666666667 | -9844.125 | -128265778.820513 | -9.22337203685478e+18 | -21368.9774169922 | 7151907.29768379 | + 7 | 29818.5454545455 | 1007210883.25 | 1148559331.92308 | -22.5454545454545 | 9341.625 | -13430176.025641 | -9.22337203685478e+18 | 16469.6047363281 | -19931226.9753984 | + 8 | 30334.6666666667 | 1035784689 | 1229215272.31579 | -31.8888888888889 | -145.666666666667 | 36091812.7894737 | -9.22337203685478e+18 | 16991.1941731771 | -8697205.63416163 | -taos> select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +taos> select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1, 2, int_tag slimit 10 limit 10; ts | u_tinyint_col | u_smallint_col | u_int_col | u_bigint_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | bool_col | binary_16_col | binary_32_col | nchar_16_col | nchar_32_col | int_tag | bool_tag | float_tag | double_tag | nchar_32_tag | binary_32_tag | ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== - 2020-10-01 00:00:00.212 | 35 | NULL | NULL | NULL | NULL | NULL | -598326349 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.702 | 35 | 19029 | NULL | NULL | NULL | NULL | -1035425985 | -9223372036854775808 | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.680 | 35 | 19415 | 30174170 | NULL | NULL | NULL | -600658805 | -9223372036854775808 | 59823.3 | NULL | NULL | NULL | Shanghai - Los Angles | 十。Cupertino | 圣地亚哥 - San Diego | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.734 | 35 | 9112 | NULL | NULL | NULL | NULL | -928425014 | -9223372036854775808 | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | 一。San Franc | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.790 | 35 | NULL | 694571471 | NULL | NULL | NULL | -180979708 | NULL | 14924.6 | NULL | NULL | NULL | Beijing - San Francisco | NULL | 坎贝尔 - Campbell | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.966 | 35 | NULL | NULL | NULL | NULL | NULL | 364715926 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.104 | 35 | NULL | NULL | NULL | NULL | NULL | 843992872 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.154 | 35 | NULL | NULL | NULL | NULL | NULL | -674945652 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.654 | 35 | NULL | NULL | NULL | NULL | NULL | -810233157 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.806 | 35 | 2900 | NULL | NULL | NULL | NULL | -1026037266 | -9223372036854775808 | NULL | NULL | NULL | NULL | Tianjin - Mountain View | 一。San Franc | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.026 | 187 | NULL | NULL | NULL | NULL | NULL | -134543023 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.092 | 187 | 36787 | NULL | NULL | NULL | NULL | 488495331 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 四。San Jose | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.016 | 187 | 48114 | NULL | NULL | NULL | NULL | -850262864 | -9223372036854775808 | NULL | NULL | NULL | NULL | Hangzhou - San Diego | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.276 | 187 | NULL | NULL | NULL | NULL | NULL | 202552841 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.908 | 187 | 14780 | NULL | NULL | NULL | NULL | -524770411 | -9223372036854775808 | NULL | NULL | NULL | NULL | Hangzhou - San Diego | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:08.240 | 187 | NULL | 1345167648 | NULL | NULL | NULL | -713720847 | NULL | 31245.4 | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:08.406 | 187 | 23677 | NULL | NULL | NULL | NULL | 530023197 | -9223372036854775808 | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | 九。Santa Cla | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:08.442 | 187 | 33000 | NULL | NULL | NULL | NULL | 679084052 | -9223372036854775808 | NULL | NULL | NULL | NULL | Chengdu - San Jose | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:08.706 | 187 | 15627 | NULL | NULL | NULL | NULL | 638574520 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:09.106 | 187 | NULL | NULL | NULL | NULL | NULL | 849285646 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.016 | 231 | NULL | NULL | NULL | NULL | NULL | 570761697 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.648 | 231 | NULL | NULL | NULL | NULL | NULL | -742825681 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.332 | 231 | NULL | NULL | NULL | NULL | NULL | -28493779 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.414 | 231 | NULL | NULL | NULL | NULL | NULL | 492193594 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.556 | 231 | 13308 | NULL | NULL | NULL | NULL | -1008409835 | -9223372036854775808 | NULL | NULL | NULL | NULL | Xian - Sunnyvale | 二。Los Angle | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.574 | 231 | 9183 | NULL | NULL | NULL | NULL | -841456384 | -9223372036854775808 | NULL | NULL | NULL | NULL | Tianjin - Mountain View | 一。San Franc | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.662 | 231 | NULL | NULL | NULL | NULL | NULL | 650776465 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.666 | 231 | 2350 | NULL | NULL | NULL | NULL | 901686686 | -9223372036854775808 | NULL | NULL | NULL | NULL | Xian - Sunnyvale | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.406 | 231 | NULL | NULL | NULL | NULL | NULL | -727841103 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.608 | 231 | 11959 | NULL | NULL | NULL | NULL | -304278743 | -9223372036854775808 | NULL | NULL | NULL | NULL | Harbin - Campbell | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.826 | 209 | NULL | NULL | NULL | NULL | NULL | 58418834 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.062 | 209 | NULL | NULL | NULL | NULL | NULL | 778139338 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.246 | 209 | NULL | NULL | NULL | NULL | NULL | -570775291 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.230 | 209 | NULL | 1423166880 | NULL | NULL | NULL | 515256660 | NULL | 21446.4 | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | 山景城 - Mountain View | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.830 | 209 | 43110 | 165773765 | NULL | NULL | NULL | -799998431 | -9223372036854775808 | 70944.5 | NULL | NULL | NULL | Tianjin - Mountain View | 五。Palo Alto | 帕洛阿托 - Palo Alto | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.302 | 209 | NULL | NULL | NULL | NULL | NULL | 622981334 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.392 | 209 | NULL | NULL | NULL | NULL | NULL | 151425563 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.548 | 209 | NULL | NULL | NULL | NULL | NULL | 173333536 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.878 | 209 | NULL | NULL | NULL | NULL | NULL | -504076712 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:06.420 | 209 | 30922 | 1530189885 | NULL | NULL | NULL | 45545924 | -9223372036854775808 | -60683.7 | NULL | NULL | NULL | Chengdu - San Jose | 九。Santa Cla | 库比蒂诺 - Cupertino | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.898 | 44 | NULL | NULL | NULL | NULL | NULL | -967752189 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.040 | 44 | 51621 | 1131620745 | NULL | NULL | NULL | 879055685 | -9223372036854775808 | 50861.3 | NULL | NULL | NULL | Harbin - Campbell | 三。San Diego | 洛杉矶 - Los Angles | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.270 | 44 | NULL | 1720059419 | NULL | NULL | NULL | 429112658 | NULL | 82898.8 | NULL | NULL | NULL | Shanghai - Los Angles | NULL | 旧金山 - San Francisco | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.702 | 44 | NULL | NULL | NULL | NULL | NULL | 931966317 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.922 | 44 | 14389 | NULL | NULL | NULL | NULL | -607434308 | -9223372036854775808 | NULL | NULL | NULL | NULL | Xian - Sunnyvale | 一。San Franc | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.250 | 44 | NULL | 1975448690 | NULL | NULL | NULL | -970438678 | NULL | -23458.2 | NULL | NULL | NULL | Beijing - San Francisco | NULL | 旧金山 - San Francisco | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.260 | 44 | NULL | 913276213 | NULL | NULL | NULL | -327293231 | NULL | -84815.1 | NULL | NULL | NULL | Hangzhou - San Diego | NULL | 帕洛阿托 - Palo Alto | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.030 | 44 | NULL | 1095111510 | NULL | NULL | NULL | 859657581 | NULL | -51354.3 | NULL | NULL | NULL | Tianjin - Mountain View | NULL | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.076 | 44 | NULL | NULL | NULL | NULL | NULL | 393991702 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.340 | 44 | NULL | 1939023658 | NULL | NULL | NULL | 346573125 | NULL | 10802.9 | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | 山景城 - Mountain View | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.226 | 54 | NULL | NULL | NULL | NULL | NULL | -922902157 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.390 | 54 | 15337 | 1676779094 | NULL | NULL | NULL | 665407592 | -9223372036854775808 | 27226.2 | NULL | NULL | NULL | Harbin - Campbell | 三。San Diego | 帕洛阿托 - Palo Alto | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.844 | 54 | NULL | NULL | NULL | NULL | NULL | 507636032 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.282 | 54 | NULL | NULL | NULL | NULL | NULL | -981259883 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.066 | 54 | NULL | NULL | NULL | NULL | NULL | 539524378 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.120 | 54 | NULL | 1609185869 | NULL | NULL | NULL | -824876704 | NULL | 11252.2 | NULL | NULL | NULL | Tianjin - Mountain View | NULL | 洛杉矶 - Los Angles | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.176 | 54 | NULL | NULL | NULL | NULL | NULL | -731457099 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.594 | 54 | NULL | NULL | NULL | NULL | NULL | 194869882 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.770 | 54 | NULL | 2024919208 | NULL | NULL | NULL | -542713972 | NULL | 60262.2 | NULL | NULL | NULL | Shanghai - Los Angles | NULL | 山景城 - Mountain View | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.722 | 54 | NULL | NULL | NULL | NULL | NULL | 697693645 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.056 | 238 | NULL | NULL | NULL | NULL | NULL | 557125048 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.236 | 238 | NULL | NULL | NULL | NULL | NULL | -301750730 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.300 | 238 | 61439 | 920096275 | NULL | NULL | NULL | -91068889 | -9223372036854775808 | -65756.1 | NULL | NULL | NULL | Shanghai - Los Angles | 九。Santa Cla | 旧金山 - San Francisco | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.374 | 238 | NULL | NULL | NULL | NULL | NULL | -1042980148 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.592 | 238 | NULL | NULL | NULL | NULL | NULL | -588637633 | NULL | NULL | NULL | NULL | NULL | Hong Kong - Palo Alto | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.824 | 238 | NULL | NULL | NULL | NULL | NULL | -465308612 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.832 | 238 | NULL | NULL | NULL | NULL | NULL | 161553083 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.162 | 238 | NULL | NULL | NULL | NULL | NULL | 495209704 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.158 | 238 | NULL | NULL | NULL | NULL | NULL | -993140909 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.194 | 238 | NULL | NULL | NULL | NULL | NULL | 349248864 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.394 | 125 | NULL | NULL | NULL | NULL | NULL | -541315025 | NULL | NULL | NULL | NULL | NULL | Harbin - Campbell | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.564 | 125 | 60102 | NULL | NULL | NULL | NULL | 950549181 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | 四。San Jose | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.566 | 125 | NULL | NULL | NULL | NULL | NULL | 59490465 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.658 | 125 | NULL | NULL | NULL | NULL | NULL | 27765208 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.862 | 125 | NULL | NULL | NULL | NULL | NULL | 488470127 | NULL | NULL | NULL | NULL | NULL | Shijiazhuang - Cupertino | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.652 | 125 | 10289 | NULL | NULL | NULL | NULL | -846581893 | -9223372036854775808 | NULL | NULL | NULL | NULL | Chengdu - San Jose | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.860 | 125 | NULL | 1204766373 | NULL | NULL | NULL | -527525960 | NULL | -3151.93 | NULL | NULL | NULL | Harbin - Campbell | NULL | 帕洛阿托 - Palo Alto | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.940 | 125 | 8237 | 757239556 | NULL | NULL | NULL | 1031479285 | -9223372036854775808 | -4146 | NULL | NULL | NULL | Xian - Sunnyvale | 三。San Diego | 库比蒂诺 - Cupertino | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.686 | 125 | NULL | NULL | NULL | NULL | NULL | -977514013 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.746 | 125 | 15973 | NULL | NULL | NULL | NULL | 214692481 | -9223372036854775808 | NULL | NULL | NULL | NULL | Tianjin - Mountain View | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.598 | 60 | NULL | NULL | NULL | NULL | NULL | -298810349 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.768 | 60 | 46285 | NULL | NULL | NULL | NULL | 472476951 | -9223372036854775808 | NULL | NULL | NULL | NULL | Hangzhou - San Diego | 五。Palo Alto | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.848 | 60 | NULL | NULL | NULL | NULL | NULL | 806663952 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.624 | 60 | NULL | NULL | NULL | NULL | NULL | 444294442 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.258 | 60 | NULL | NULL | NULL | NULL | NULL | -865926691 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.722 | 60 | NULL | NULL | NULL | NULL | NULL | -309602228 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.912 | 60 | NULL | NULL | NULL | NULL | NULL | -1001258507 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.944 | 60 | NULL | NULL | NULL | NULL | NULL | -776714499 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.692 | 60 | NULL | NULL | NULL | NULL | NULL | 754757876 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.838 | 60 | NULL | NULL | NULL | NULL | NULL | 517636603 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 0 | false | 0 | 0 | child0 | child0 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.028 | 29 | NULL | NULL | NULL | NULL | NULL | 143030544 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.142 | 29 | NULL | NULL | NULL | NULL | NULL | -608238402 | NULL | NULL | NULL | NULL | NULL | Hangzhou - San Diego | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:01.962 | 29 | 14496 | NULL | NULL | NULL | NULL | -792862517 | -9223372036854775808 | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:02.708 | 29 | NULL | NULL | NULL | NULL | NULL | -528813988 | NULL | NULL | NULL | NULL | NULL | Beijing - San Francisco | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.604 | 29 | NULL | NULL | NULL | NULL | NULL | -177766789 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:03.870 | 29 | 59351 | 1937720573 | NULL | NULL | NULL | -1067024716 | -9223372036854775808 | 49663.7 | NULL | NULL | NULL | Hong Kong - Palo Alto | 二。Los Angle | 圣何塞 - San Jose | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.472 | 29 | NULL | NULL | NULL | NULL | NULL | 974432048 | NULL | NULL | NULL | NULL | NULL | Chengdu - San Jose | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:04.518 | 29 | 13407 | NULL | NULL | NULL | NULL | -919883064 | -9223372036854775808 | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:05.236 | 29 | NULL | NULL | NULL | NULL | NULL | 217199133 | NULL | NULL | NULL | NULL | NULL | Tianjin - Mountain View | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | NULL | NULL | NULL | -77824226 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | -taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; count(*) | ======================== 2 | 2 | 2 | - 40 | 2 | - 48 | 2 | - 4 | + 2 | + 2 | + 2 | 2 | 2 | -taos> select u_tinyint_col, tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +taos> select u_tinyint_col, tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; u_tinyint_col | tinyint_col | ============================== - 39 | -22 | - 39 | -22 | - 6 | 105 | - 6 | 105 | - 117 | 47 | - 117 | 47 | - 240 | 8 | - 240 | 8 | - 176 | 47 | - 176 | 47 | - 171 | 114 | - 171 | 114 | - 144 | -80 | - 144 | -80 | - 158 | -77 | - 158 | -77 | - 159 | 115 | - 159 | 115 | - 15 | 124 | - 15 | 124 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | + NULL | -10 | -taos> select u_tinyint_col, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +taos> select u_tinyint_col, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; u_tinyint_col | tinyint_col | count(*) | ====================================================== - 223 | -74 | 2 | - 122 | -27 | 2 | - 180 | -128 | 2 | + NULL | 33 | 92 | + NULL | 10 | 58 | + NULL | 85 | 32 | NULL | -98 | 40 | - 209 | -11 | 2 | + NULL | 126 | 58 | NULL | 15 | 48 | - 89 | -80 | 2 | - 141 | 113 | 4 | - 239 | -51 | 2 | - 254 | -71 | 2 | + NULL | 98 | 50 | + NULL | 14 | 60 | + NULL | 9 | 44 | + NULL | 50 | 54 | -taos> select avg(u_int_col), avg(tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +taos> select avg(u_int_col), avg(tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; avg(u_int_col) | avg(tinyint_col) | ======================================================== - NULL | -74 | - NULL | -27 | - 1335404897 | -128 | - 1426172362 | -98 | - NULL | -11 | - 946085747.5 | 15 | - NULL | -80 | - NULL | 113 | - NULL | -51 | NULL | -71 | + NULL | -11 | + NULL | 113 | + NULL | -74 | + NULL | -80 | + NULL | -27 | + NULL | -97 | + NULL | -51 | + NULL | 35 | + NULL | 52 | -taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; avg(u_tinyint_col) | avg(u_smallint_col) | avg(u_int_col) | avg(u_bigint_col) | avg(tinyint_col) | avg(smallint_col) | avg(int_col) | avg(bigint_col) | avg(float_col) | avg(double_col) | ======================================================================================================================================================================================================================================================================================== - 223 | 2252 | NULL | 258445752 | -74 | NULL | 450751778 | -9.22337203685478e+18 | NULL | -38067118.452938 | - 122 | 60037 | NULL | 631322561 | -27 | NULL | -830220359 | -9.22337203685478e+18 | NULL | -33432384.003759 | - 180 | 50112 | 1335404897 | 1448513250 | -128 | 12464 | 1009370387 | -9.22337203685478e+18 | 9641.2978515625 | 92538397.847061 | + NULL | 33831.6739130435 | 1318789309.125 | NULL | 33 | -12190.75 | NULL | -9.22337203685478e+18 | 23283.1239624023 | NULL | + NULL | 31745.4827586207 | 1544854152.2 | NULL | 10 | 6087 | NULL | -9.22337203685478e+18 | 31152.176171875 | NULL | + NULL | 39667.5625 | 855601557.5 | NULL | 85 | -16325.5 | NULL | -9.22337203685478e+18 | -3223.10552978516 | NULL | NULL | 33434.95 | 1426172362 | NULL | -98 | 16431.3333333333 | NULL | -9.22337203685478e+18 | 19849.3048502604 | NULL | - 209 | 58173 | NULL | 108924939 | -11 | NULL | 275241563 | -9.22337203685478e+18 | NULL | -56795340.811717 | + NULL | 39750.1379310345 | 812243601.428571 | NULL | 126 | 4213.42857142857 | NULL | -9.22337203685478e+18 | -6953.95842633929 | NULL | NULL | 35937.0416666667 | 946085747.5 | NULL | 15 | -4618.375 | NULL | -9.22337203685478e+18 | -18934.5077819824 | NULL | - 89 | 7242 | NULL | 913351744 | -80 | NULL | 649647103 | -9.22337203685478e+18 | NULL | 69752282.021601 | - 141 | 29124 | NULL | 1908889524 | 113 | NULL | -393540095.5 | -9.22337203685478e+18 | NULL | -13658944.5757665 | - 239 | 21507 | NULL | 1810262734 | -51 | NULL | -253979173 | -9.22337203685478e+18 | NULL | -79335108.456754 | - 254 | 61337 | NULL | 148966060 | -71 | NULL | 563552648 | -9.22337203685478e+18 | NULL | -38685356.853214 | + NULL | 36542.48 | 1162378206.6 | NULL | 98 | -328.4 | NULL | -9.22337203685478e+18 | -487.43056640625 | NULL | + NULL | 33767.8333333333 | 1290059129.66667 | NULL | 14 | -417.5 | NULL | -9.22337203685478e+18 | -9614.62768554688 | NULL | + NULL | 30469.7272727273 | 1286046366.4 | NULL | 9 | -6929 | NULL | -9.22337203685478e+18 | 9618.0123046875 | NULL | + NULL | 37029.3703703704 | 1008539760.5 | NULL | 50 | 8137.6 | NULL | -9.22337203685478e+18 | 6700.13325805664 | NULL | -taos> select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +taos> select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1, 2, int_tag slimit 10 limit 10; ts | u_tinyint_col | u_smallint_col | u_int_col | u_bigint_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | bool_col | binary_16_col | binary_32_col | nchar_16_col | nchar_32_col | int_tag | bool_tag | float_tag | double_tag | nchar_32_tag | binary_32_tag | ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== - 2020-10-01 00:00:10.014 | 39 | 37788 | NULL | 1600044099 | -22 | NULL | 968851512 | -9223372036854775808 | NULL | -89445763.027226 | false | NULL | Taiyuan - Santa Clara | 七。Mountain | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:10.014 | 39 | 37788 | NULL | 1600044099 | -22 | NULL | 968851512 | -9223372036854775808 | NULL | -89445763.027226 | false | NULL | Taiyuan - Santa Clara | 七。Mountain | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:15.432 | 6 | 11090 | NULL | 617356184 | 105 | NULL | -385653237 | -9223372036854775808 | NULL | 97555348.695395 | false | NULL | Xian - Sunnyvale | 五。Palo Alto | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:15.432 | 6 | 11090 | NULL | 617356184 | 105 | NULL | -385653237 | -9223372036854775808 | NULL | 97555348.695395 | false | NULL | Xian - Sunnyvale | 五。Palo Alto | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:19.884 | 117 | 16744 | NULL | 383342191 | 47 | NULL | 518627967 | -9223372036854775808 | NULL | 46352562.918609 | true | NULL | Taiyuan - Santa Clara | 九。Santa Cla | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:19.884 | 117 | 16744 | NULL | 383342191 | 47 | NULL | 518627967 | -9223372036854775808 | NULL | 46352562.918609 | true | NULL | Taiyuan - Santa Clara | 九。Santa Cla | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:17.058 | 240 | 60740 | NULL | 545615850 | 8 | NULL | -786050053 | -9223372036854775808 | NULL | 66486064.270497 | false | NULL | Chengdu - San Jose | 二。Los Angle | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:17.058 | 240 | 60740 | NULL | 545615850 | 8 | NULL | -786050053 | -9223372036854775808 | NULL | 66486064.270497 | false | NULL | Chengdu - San Jose | 二。Los Angle | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:01.896 | 176 | 8527 | NULL | 878674910 | 47 | NULL | -53167779 | -9223372036854775808 | NULL | 71922859.850709 | false | NULL | Shijiazhuang - Cupertino | 一。San Franc | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:01.896 | 176 | 8527 | NULL | 878674910 | 47 | NULL | -53167779 | -9223372036854775808 | NULL | 71922859.850709 | false | NULL | Shijiazhuang - Cupertino | 一。San Franc | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:04.086 | 171 | 1169 | NULL | 1377921642 | 114 | NULL | -509127079 | -9223372036854775808 | NULL | 64210530.663581 | false | NULL | Tianjin - Mountain View | 二。Los Angle | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:04.086 | 171 | 1169 | NULL | 1377921642 | 114 | NULL | -509127079 | -9223372036854775808 | NULL | 64210530.663581 | false | NULL | Tianjin - Mountain View | 二。Los Angle | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:09.870 | 144 | 17230 | 1223829379 | 432089801 | -80 | 27125 | -425646741 | -9223372036854775808 | 65894 | -56946461.311162 | false | Sunnyvale | Taiyuan - Santa Clara | 十。Cupertino | 旧金山 - San Francisco | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:09.870 | 144 | 17230 | 1223829379 | 432089801 | -80 | 27125 | -425646741 | -9223372036854775808 | 65894 | -56946461.311162 | false | Sunnyvale | Taiyuan - Santa Clara | 十。Cupertino | 旧金山 - San Francisco | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:03.078 | 158 | 52964 | NULL | 1542959965 | -77 | NULL | -26065745 | -9223372036854775808 | NULL | -67330512.375843 | false | NULL | Tianjin - Mountain View | 六。Campbell | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:03.078 | 158 | 52964 | NULL | 1542959965 | -77 | NULL | -26065745 | -9223372036854775808 | NULL | -67330512.375843 | false | NULL | Tianjin - Mountain View | 六。Campbell | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:18.558 | 159 | 24721 | NULL | 1642444156 | 115 | NULL | 390260950 | -9223372036854775808 | NULL | -11044773.177774 | true | NULL | Harbin - Campbell | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:18.558 | 159 | 24721 | NULL | 1642444156 | 115 | NULL | 390260950 | -9223372036854775808 | NULL | -11044773.177774 | true | NULL | Harbin - Campbell | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:06.216 | 15 | 7661 | NULL | 448404487 | 124 | NULL | 801727776 | -9223372036854775808 | NULL | 46986576.662291 | true | NULL | Tianjin - Mountain View | 五。Palo Alto | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:06.216 | 15 | 7661 | NULL | 448404487 | 124 | NULL | 801727776 | -9223372036854775808 | NULL | 46986576.662291 | true | NULL | Tianjin - Mountain View | 五。Palo Alto | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | NULL | NULL | NULL | -77824226 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(10s) slimit 10 limit 10; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(10s) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 147 | 48 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 147 | 84 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 74 | 33 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 74 | 63 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 131 | 42 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 131 | 45 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 32 | 51 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 32 | 45 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 38 | 63 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 38 | 75 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 107 | 60 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 107 | 54 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 99 | 54 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 99 | 81 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 27 | 69 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 27 | 66 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 236 | 42 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 236 | 45 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 28 | 54 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 28 | 36 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 0 | 69 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 1 | 75 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 2 | 51 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 3 | 57 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 4 | 69 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 5 | 45 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 6 | 42 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 7 | 42 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 8 | 72 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 9 | 96 | -taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col interval(10s) slimit 10 limit 10; +taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col interval(10s) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | tinyint_col | count(*) | ========================================================================================== - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -1 | 22 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | -1 | 24 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | -1 | 22 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -109 | 18 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | -109 | 40 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | -109 | 38 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 74 | 40 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 74 | 26 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | 74 | 26 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -128 | 30 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -127 | 16 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -126 | 22 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -125 | 30 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | -125 | 28 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | -125 | 22 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 32 | 28 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 32 | 26 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | 32 | 36 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 38 | 30 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 38 | 16 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | 38 | 28 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 107 | 18 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 107 | 44 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | 107 | 10 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 99 | 34 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 99 | 14 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | 99 | 28 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | 27 | 22 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | 27 | 18 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | 27 | 22 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -20 | 28 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | -20 | 26 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | -20 | 22 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -124 | 24 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -123 | 20 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -122 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -121 | 24 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -120 | 26 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | -119 | 14 | -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(10s) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(10s) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | ======================================================================================= - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | true | 3300 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | true | 3426 | - 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | true | 3336 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | false | 3368 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:10.000 | true | 3300 | 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | false | 3240 | + 2020-10-01 00:00:10.000 | 2020-10-01 00:00:20.000 | true | 3426 | 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | false | 3330 | + 2020-10-01 00:00:20.000 | 2020-10-01 00:00:30.000 | true | 3336 | -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | ======================================================================================= - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | =============================================================================================================================================================== - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 1996 | 3362 | 10062 | - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | 2004 | 3306 | 9938 | 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | NULL | 49999 | 26000 | 23332 | 10000 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | 2004 | 3306 | 9938 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 1996 | 3362 | 10062 | -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | count(u_int_col) | count(u_tinyint_col) | ======================================================================================================================================= - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 1996 | 3362 | - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | 2004 | 3306 | 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | NULL | 44666 | 26000 | 23332 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | 2004 | 3306 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 1996 | 3362 | -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | count(u_int_col) | =============================================================================================================== - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 1996 | - 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | 2004 | 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | NULL | 26000 | 26000 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | false | 9938 | 2004 | + 2020-10-01 00:00:00.000 | 2020-10-02 00:00:00.000 | true | 10062 | 1996 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:01.602 | 2020-10-01 00:00:02.088 | 147 | 2 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:02.772 | 147 | 2 | - 2020-10-01 00:00:07.086 | 2020-10-01 00:00:07.086 | 147 | 2 | - 2020-10-01 00:00:09.570 | 2020-10-01 00:00:09.570 | 147 | 2 | - 2020-10-01 00:00:09.912 | 2020-10-01 00:00:09.930 | 147 | 4 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:14.436 | 147 | 8 | - 2020-10-01 00:00:18.774 | 2020-10-01 00:00:19.788 | 147 | 6 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.348 | 74 | 2 | - 2020-10-01 00:00:02.964 | 2020-10-01 00:00:02.964 | 74 | 2 | - 2020-10-01 00:00:08.454 | 2020-10-01 00:00:08.454 | 74 | 2 | - 2020-10-01 00:00:10.626 | 2020-10-01 00:00:10.626 | 74 | 2 | - 2020-10-01 00:00:10.890 | 2020-10-01 00:00:13.494 | 74 | 6 | - 2020-10-01 00:00:16.116 | 2020-10-01 00:00:19.962 | 74 | 4 | - 2020-10-01 00:00:02.898 | 2020-10-01 00:00:02.898 | 131 | 1 | - 2020-10-01 00:00:07.734 | 2020-10-01 00:00:11.856 | 131 | 10 | - 2020-10-01 00:00:15.036 | 2020-10-01 00:00:16.806 | 131 | 4 | - 2020-10-01 00:00:17.724 | 2020-10-01 00:00:17.724 | 131 | 2 | - 2020-10-01 00:00:19.374 | 2020-10-01 00:00:19.374 | 131 | 3 | - 2020-10-01 00:00:01.554 | 2020-10-01 00:00:03.516 | 32 | 8 | - 2020-10-01 00:00:06.606 | 2020-10-01 00:00:19.120 | 32 | 10 | - 2020-10-01 00:00:00.276 | 2020-10-01 00:00:00.276 | 38 | 2 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:11.784 | 38 | 12 | - 2020-10-01 00:00:12.054 | 2020-10-01 00:00:18.252 | 38 | 10 | - 2020-10-01 00:00:18.264 | 2020-10-01 00:00:19.868 | 38 | 6 | - 2020-10-01 00:00:00.792 | 2020-10-01 00:00:00.792 | 107 | 2 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:02.364 | 107 | 2 | - 2020-10-01 00:00:03.522 | 2020-10-01 00:00:03.522 | 107 | 2 | - 2020-10-01 00:00:06.744 | 2020-10-01 00:00:07.266 | 107 | 4 | - 2020-10-01 00:00:07.344 | 2020-10-01 00:00:13.854 | 107 | 12 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:17.742 | 107 | 4 | - 2020-10-01 00:00:18.210 | 2020-10-01 00:00:18.210 | 107 | 2 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 107 | 2 | - 2020-10-01 00:00:00.360 | 2020-10-01 00:00:06.150 | 99 | 2 | - 2020-10-01 00:00:06.666 | 2020-10-01 00:00:08.430 | 99 | 10 | - 2020-10-01 00:00:08.808 | 2020-10-01 00:00:11.034 | 99 | 4 | - 2020-10-01 00:00:11.046 | 2020-10-01 00:00:12.270 | 99 | 6 | - 2020-10-01 00:00:12.576 | 2020-10-01 00:00:12.942 | 99 | 4 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:13.224 | 99 | 2 | - 2020-10-01 00:00:14.256 | 2020-10-01 00:00:16.182 | 99 | 8 | - 2020-10-01 00:00:16.872 | 2020-10-01 00:00:18.462 | 99 | 4 | - 2020-10-01 00:00:19.572 | 2020-10-01 00:00:19.918 | 99 | 4 | - 2020-10-01 00:00:00.468 | 2020-10-01 00:00:00.468 | 27 | 1 | - 2020-10-01 00:00:00.978 | 2020-10-01 00:00:00.978 | 27 | 2 | - 2020-10-01 00:00:00.990 | 2020-10-01 00:00:00.990 | 27 | 2 | - 2020-10-01 00:00:01.098 | 2020-10-01 00:00:02.478 | 27 | 4 | - 2020-10-01 00:00:04.542 | 2020-10-01 00:00:04.542 | 27 | 2 | - 2020-10-01 00:00:04.692 | 2020-10-01 00:00:05.994 | 27 | 4 | - 2020-10-01 00:00:06.600 | 2020-10-01 00:00:06.600 | 27 | 2 | - 2020-10-01 00:00:09.936 | 2020-10-01 00:00:17.004 | 27 | 8 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:18.546 | 27 | 2 | - 2020-10-01 00:00:19.038 | 2020-10-01 00:00:19.038 | 27 | 2 | - 2020-10-01 00:00:01.788 | 2020-10-01 00:00:01.788 | 236 | 2 | - 2020-10-01 00:00:05.832 | 2020-10-01 00:00:10.422 | 236 | 6 | - 2020-10-01 00:00:10.446 | 2020-10-01 00:00:10.446 | 236 | 2 | - 2020-10-01 00:00:11.424 | 2020-10-01 00:00:11.424 | 236 | 2 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:16.968 | 236 | 8 | - 2020-10-01 00:00:17.958 | 2020-10-01 00:00:18.764 | 236 | 4 | - 2020-10-01 00:00:01.284 | 2020-10-01 00:00:05.940 | 28 | 6 | - 2020-10-01 00:00:06.810 | 2020-10-01 00:00:07.896 | 28 | 4 | - 2020-10-01 00:00:09.534 | 2020-10-01 00:00:10.728 | 28 | 6 | - 2020-10-01 00:00:13.368 | 2020-10-01 00:00:18.746 | 28 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.962 | 29 | 2 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | NULL | 2 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.864 | 49 | 6 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.015 | NULL | 4 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 77 | 1 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.018 | 195 | 1 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | NULL | 2 | + 2020-10-01 00:00:00.024 | 2020-10-01 00:00:00.024 | 198 | 1 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.027 | NULL | 2 | + 2020-10-01 00:00:00.030 | 2020-10-01 00:00:02.202 | 162 | 4 | -taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | tinyint_col | count(*) | ========================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | -1 | 1 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:07.200 | -1 | 10 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:08.721 | -1 | 6 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.396 | -1 | 4 | - 2020-10-01 00:00:10.773 | 2020-10-01 00:00:10.773 | -1 | 2 | - 2020-10-01 00:00:12.483 | 2020-10-01 00:00:12.483 | -1 | 2 | - 2020-10-01 00:00:12.822 | 2020-10-01 00:00:14.319 | -1 | 6 | - 2020-10-01 00:00:14.652 | 2020-10-01 00:00:14.652 | -1 | 2 | - 2020-10-01 00:00:14.994 | 2020-10-01 00:00:14.994 | -1 | 2 | - 2020-10-01 00:00:16.260 | 2020-10-01 00:00:17.808 | -1 | 8 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:01.488 | -109 | 2 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.710 | -109 | 4 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | -109 | 2 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:08.313 | -109 | 4 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | -109 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | -109 | 2 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | -109 | 2 | - 2020-10-01 00:00:11.559 | 2020-10-01 00:00:12.408 | -109 | 4 | - 2020-10-01 00:00:12.786 | 2020-10-01 00:00:12.906 | -109 | 6 | - 2020-10-01 00:00:14.310 | 2020-10-01 00:00:15.405 | -109 | 4 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:01.023 | 74 | 4 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | 74 | 2 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.871 | 74 | 4 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | 74 | 2 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:05.766 | 74 | 8 | - 2020-10-01 00:00:05.778 | 2020-10-01 00:00:05.778 | 74 | 2 | - 2020-10-01 00:00:06.222 | 2020-10-01 00:00:06.222 | 74 | 2 | - 2020-10-01 00:00:06.648 | 2020-10-01 00:00:06.648 | 74 | 2 | - 2020-10-01 00:00:07.428 | 2020-10-01 00:00:07.428 | 74 | 2 | - 2020-10-01 00:00:07.890 | 2020-10-01 00:00:08.430 | 74 | 6 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:01.092 | -125 | 6 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | -125 | 2 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:04.548 | -125 | 6 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:05.553 | -125 | 6 | - 2020-10-01 00:00:06.423 | 2020-10-01 00:00:09.084 | -125 | 6 | - 2020-10-01 00:00:09.204 | 2020-10-01 00:00:09.204 | -125 | 2 | - 2020-10-01 00:00:09.909 | 2020-10-01 00:00:10.323 | -125 | 4 | - 2020-10-01 00:00:10.386 | 2020-10-01 00:00:12.099 | -125 | 6 | - 2020-10-01 00:00:13.563 | 2020-10-01 00:00:13.563 | -125 | 2 | - 2020-10-01 00:00:14.427 | 2020-10-01 00:00:14.427 | -125 | 2 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.653 | 32 | 6 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:03.330 | 32 | 8 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.858 | 32 | 4 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.346 | 32 | 4 | - 2020-10-01 00:00:05.661 | 2020-10-01 00:00:05.661 | 32 | 2 | - 2020-10-01 00:00:06.846 | 2020-10-01 00:00:06.846 | 32 | 2 | - 2020-10-01 00:00:09.501 | 2020-10-01 00:00:12.699 | 32 | 10 | - 2020-10-01 00:00:13.881 | 2020-10-01 00:00:13.881 | 32 | 2 | - 2020-10-01 00:00:14.907 | 2020-10-01 00:00:16.638 | 32 | 10 | - 2020-10-01 00:00:18.294 | 2020-10-01 00:00:18.309 | 32 | 4 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:01.203 | 38 | 4 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | 38 | 2 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | 38 | 2 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.955 | 38 | 2 | - 2020-10-01 00:00:02.958 | 2020-10-01 00:00:02.958 | 38 | 2 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.429 | 38 | 4 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | 38 | 2 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | 38 | 2 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | 38 | 2 | - 2020-10-01 00:00:08.715 | 2020-10-01 00:00:09.507 | 38 | 6 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.386 | 107 | 2 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | 107 | 2 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | 107 | 2 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | 107 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:07.389 | 107 | 6 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:11.793 | 107 | 6 | - 2020-10-01 00:00:11.925 | 2020-10-01 00:00:11.949 | 107 | 4 | - 2020-10-01 00:00:13.164 | 2020-10-01 00:00:13.569 | 107 | 4 | - 2020-10-01 00:00:13.965 | 2020-10-01 00:00:13.965 | 107 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | 99 | 2 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.365 | 99 | 4 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:02.367 | 99 | 6 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:04.332 | 99 | 8 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | 99 | 2 | - 2020-10-01 00:00:07.041 | 2020-10-01 00:00:07.842 | 99 | 4 | - 2020-10-01 00:00:07.905 | 2020-10-01 00:00:08.016 | 99 | 4 | - 2020-10-01 00:00:08.892 | 2020-10-01 00:00:14.040 | 99 | 10 | - 2020-10-01 00:00:15.882 | 2020-10-01 00:00:15.882 | 99 | 2 | - 2020-10-01 00:00:16.182 | 2020-10-01 00:00:16.644 | 99 | 4 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | 27 | 1 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | 27 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | 27 | 2 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | 27 | 2 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | 27 | 2 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | 27 | 2 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | 27 | 2 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:07.281 | 27 | 4 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | 27 | 2 | - 2020-10-01 00:00:09.852 | 2020-10-01 00:00:09.852 | 27 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:01.770 | -20 | 3 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:03.567 | -20 | 12 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | -20 | 2 | - 2020-10-01 00:00:06.093 | 2020-10-01 00:00:06.093 | -20 | 2 | - 2020-10-01 00:00:06.252 | 2020-10-01 00:00:06.939 | -20 | 4 | - 2020-10-01 00:00:09.489 | 2020-10-01 00:00:16.764 | -20 | 16 | - 2020-10-01 00:00:17.430 | 2020-10-01 00:00:17.430 | -20 | 2 | - 2020-10-01 00:00:18.966 | 2020-10-01 00:00:18.966 | -20 | 2 | - 2020-10-01 00:00:19.056 | 2020-10-01 00:00:19.056 | -20 | 2 | - 2020-10-01 00:00:19.119 | 2020-10-01 00:00:19.119 | -20 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 2 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 44 | 1 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:01.779 | -91 | 4 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:01.731 | 25 | 3 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 70 | 1 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:02.829 | -106 | 3 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:02.922 | -113 | 6 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 2 | + 2020-10-01 00:00:00.024 | 2020-10-01 00:00:00.024 | -9 | 2 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:01.662 | -102 | 4 | -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | ======================================================================================= 2020-10-01 00:00:00.000 | 2020-10-01 00:00:29.997 | true | 10062 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:29.988 | false | 9938 | -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | ======================================================================================= 2020-10-01 00:00:00.000 | 2020-10-01 00:00:29.997 | true | 10062 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:29.988 | false | 9938 | -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | =============================================================================================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | true | 1 | 1 | 0 | 1 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:07.200 | false | 10 | 6 | 6 | 10 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:08.721 | true | 6 | 0 | 2 | 6 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.396 | false | 4 | 0 | 4 | 4 | - 2020-10-01 00:00:10.773 | 2020-10-01 00:00:10.773 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:12.483 | 2020-10-01 00:00:12.483 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:12.822 | 2020-10-01 00:00:14.319 | true | 6 | 2 | 4 | 6 | - 2020-10-01 00:00:14.652 | 2020-10-01 00:00:14.652 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:14.994 | 2020-10-01 00:00:14.994 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:16.260 | 2020-10-01 00:00:17.808 | false | 8 | 4 | 6 | 8 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:01.488 | false | 2 | 0 | 1 | 2 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.710 | true | 4 | 2 | 4 | 4 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:08.313 | true | 4 | 2 | 0 | 4 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | false | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:11.559 | 2020-10-01 00:00:12.408 | true | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:12.786 | 2020-10-01 00:00:12.906 | false | 6 | 0 | 4 | 6 | - 2020-10-01 00:00:14.310 | 2020-10-01 00:00:15.405 | true | 4 | 4 | 2 | 4 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:01.023 | true | 4 | 0 | 0 | 4 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.871 | true | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:05.766 | true | 8 | 4 | 2 | 8 | - 2020-10-01 00:00:05.778 | 2020-10-01 00:00:05.778 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.222 | 2020-10-01 00:00:06.222 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.648 | 2020-10-01 00:00:06.648 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:07.428 | 2020-10-01 00:00:07.428 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:07.890 | 2020-10-01 00:00:08.430 | false | 6 | 4 | 6 | 6 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:01.092 | true | 6 | 0 | 2 | 6 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:04.548 | true | 6 | 0 | 4 | 6 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:05.553 | false | 6 | 2 | 0 | 6 | - 2020-10-01 00:00:06.423 | 2020-10-01 00:00:09.084 | true | 6 | 2 | 4 | 6 | - 2020-10-01 00:00:09.204 | 2020-10-01 00:00:09.204 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:09.909 | 2020-10-01 00:00:10.323 | true | 4 | 0 | 0 | 4 | - 2020-10-01 00:00:10.386 | 2020-10-01 00:00:12.099 | false | 6 | 0 | 2 | 6 | - 2020-10-01 00:00:13.563 | 2020-10-01 00:00:13.563 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:14.427 | 2020-10-01 00:00:14.427 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.653 | true | 6 | 0 | 2 | 6 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:03.330 | false | 8 | 2 | 6 | 8 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.858 | true | 4 | 2 | 2 | 4 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.346 | false | 4 | 2 | 2 | 4 | - 2020-10-01 00:00:05.661 | 2020-10-01 00:00:05.661 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:06.846 | 2020-10-01 00:00:06.846 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:09.501 | 2020-10-01 00:00:12.699 | true | 10 | 0 | 2 | 10 | - 2020-10-01 00:00:13.881 | 2020-10-01 00:00:13.881 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:14.907 | 2020-10-01 00:00:16.638 | true | 10 | 0 | 4 | 10 | - 2020-10-01 00:00:18.294 | 2020-10-01 00:00:18.309 | false | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:01.203 | true | 4 | 2 | 2 | 4 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.955 | false | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:02.958 | 2020-10-01 00:00:02.958 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.429 | false | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:08.715 | 2020-10-01 00:00:09.507 | false | 6 | 2 | 0 | 6 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.386 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | false | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | true | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:07.389 | false | 6 | 0 | 2 | 6 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | true | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:11.793 | false | 6 | 0 | 2 | 6 | - 2020-10-01 00:00:11.925 | 2020-10-01 00:00:11.949 | true | 4 | 2 | 0 | 4 | - 2020-10-01 00:00:13.164 | 2020-10-01 00:00:13.569 | false | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:13.965 | 2020-10-01 00:00:13.965 | true | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.365 | true | 4 | 2 | 0 | 4 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:02.367 | false | 6 | 0 | 4 | 6 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:04.332 | true | 8 | 0 | 4 | 8 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:07.041 | 2020-10-01 00:00:07.842 | true | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:07.905 | 2020-10-01 00:00:08.016 | false | 4 | 2 | 2 | 4 | - 2020-10-01 00:00:08.892 | 2020-10-01 00:00:14.040 | true | 10 | 2 | 8 | 10 | - 2020-10-01 00:00:15.882 | 2020-10-01 00:00:15.882 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:16.182 | 2020-10-01 00:00:16.644 | true | 4 | 0 | 4 | 4 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | true | 1 | 0 | 1 | 1 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | false | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | false | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:07.281 | false | 4 | 2 | 0 | 4 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | true | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:09.852 | 2020-10-01 00:00:09.852 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:01.770 | false | 3 | 2 | 2 | 3 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:03.567 | true | 12 | 2 | 6 | 12 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.093 | 2020-10-01 00:00:06.093 | true | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:06.252 | 2020-10-01 00:00:06.939 | false | 4 | 0 | 2 | 4 | - 2020-10-01 00:00:09.489 | 2020-10-01 00:00:16.764 | true | 16 | 2 | 10 | 16 | - 2020-10-01 00:00:17.430 | 2020-10-01 00:00:17.430 | false | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:18.966 | 2020-10-01 00:00:18.966 | true | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:19.056 | 2020-10-01 00:00:19.056 | false | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:19.119 | 2020-10-01 00:00:19.119 | true | 2 | 0 | 0 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 2 | 2 | 2 | 2 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | 1 | 0 | 0 | 1 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:01.779 | true | 4 | 0 | 2 | 4 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:01.731 | true | 3 | 1 | 0 | 3 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | false | 1 | 0 | 1 | 1 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:02.829 | true | 3 | 1 | 1 | 3 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:02.922 | true | 6 | 0 | 6 | 6 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | false | 2 | 0 | 0 | 2 | + 2020-10-01 00:00:00.024 | 2020-10-01 00:00:00.024 | false | 2 | 0 | 2 | 2 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:01.662 | true | 4 | 0 | 2 | 4 | -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | count(u_int_col) | count(u_tinyint_col) | ======================================================================================================================================= - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | true | 1 | 1 | 0 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:07.200 | false | 10 | 6 | 6 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:08.721 | true | 6 | 0 | 2 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.396 | false | 4 | 0 | 4 | - 2020-10-01 00:00:10.773 | 2020-10-01 00:00:10.773 | true | 2 | 0 | 0 | - 2020-10-01 00:00:12.483 | 2020-10-01 00:00:12.483 | false | 2 | 0 | 0 | - 2020-10-01 00:00:12.822 | 2020-10-01 00:00:14.319 | true | 6 | 2 | 4 | - 2020-10-01 00:00:14.652 | 2020-10-01 00:00:14.652 | false | 2 | 0 | 2 | - 2020-10-01 00:00:14.994 | 2020-10-01 00:00:14.994 | true | 2 | 0 | 2 | - 2020-10-01 00:00:16.260 | 2020-10-01 00:00:17.808 | false | 8 | 4 | 6 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:01.488 | false | 2 | 0 | 1 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.710 | true | 4 | 2 | 4 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | false | 2 | 0 | 0 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:08.313 | true | 4 | 2 | 0 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | false | 2 | 2 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | true | 2 | 0 | 0 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | false | 2 | 0 | 2 | - 2020-10-01 00:00:11.559 | 2020-10-01 00:00:12.408 | true | 4 | 0 | 2 | - 2020-10-01 00:00:12.786 | 2020-10-01 00:00:12.906 | false | 6 | 0 | 4 | - 2020-10-01 00:00:14.310 | 2020-10-01 00:00:15.405 | true | 4 | 4 | 2 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:01.023 | true | 4 | 0 | 0 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | false | 2 | 0 | 2 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.871 | true | 4 | 0 | 2 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | false | 2 | 0 | 0 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:05.766 | true | 8 | 4 | 2 | - 2020-10-01 00:00:05.778 | 2020-10-01 00:00:05.778 | false | 2 | 0 | 2 | - 2020-10-01 00:00:06.222 | 2020-10-01 00:00:06.222 | true | 2 | 0 | 2 | - 2020-10-01 00:00:06.648 | 2020-10-01 00:00:06.648 | false | 2 | 0 | 2 | - 2020-10-01 00:00:07.428 | 2020-10-01 00:00:07.428 | true | 2 | 0 | 2 | - 2020-10-01 00:00:07.890 | 2020-10-01 00:00:08.430 | false | 6 | 4 | 6 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:01.092 | true | 6 | 0 | 2 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | false | 2 | 0 | 0 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:04.548 | true | 6 | 0 | 4 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:05.553 | false | 6 | 2 | 0 | - 2020-10-01 00:00:06.423 | 2020-10-01 00:00:09.084 | true | 6 | 2 | 4 | - 2020-10-01 00:00:09.204 | 2020-10-01 00:00:09.204 | false | 2 | 0 | 2 | - 2020-10-01 00:00:09.909 | 2020-10-01 00:00:10.323 | true | 4 | 0 | 0 | - 2020-10-01 00:00:10.386 | 2020-10-01 00:00:12.099 | false | 6 | 0 | 2 | - 2020-10-01 00:00:13.563 | 2020-10-01 00:00:13.563 | true | 2 | 0 | 0 | - 2020-10-01 00:00:14.427 | 2020-10-01 00:00:14.427 | false | 2 | 0 | 0 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.653 | true | 6 | 0 | 2 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:03.330 | false | 8 | 2 | 6 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.858 | true | 4 | 2 | 2 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.346 | false | 4 | 2 | 2 | - 2020-10-01 00:00:05.661 | 2020-10-01 00:00:05.661 | true | 2 | 0 | 0 | - 2020-10-01 00:00:06.846 | 2020-10-01 00:00:06.846 | false | 2 | 0 | 2 | - 2020-10-01 00:00:09.501 | 2020-10-01 00:00:12.699 | true | 10 | 0 | 2 | - 2020-10-01 00:00:13.881 | 2020-10-01 00:00:13.881 | false | 2 | 0 | 0 | - 2020-10-01 00:00:14.907 | 2020-10-01 00:00:16.638 | true | 10 | 0 | 4 | - 2020-10-01 00:00:18.294 | 2020-10-01 00:00:18.309 | false | 4 | 0 | 2 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:01.203 | true | 4 | 2 | 2 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | false | 2 | 0 | 2 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | true | 2 | 0 | 0 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.955 | false | 2 | 2 | 0 | - 2020-10-01 00:00:02.958 | 2020-10-01 00:00:02.958 | true | 2 | 0 | 2 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.429 | false | 4 | 0 | 2 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | true | 2 | 0 | 2 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | false | 2 | 0 | 2 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | true | 2 | 0 | 0 | - 2020-10-01 00:00:08.715 | 2020-10-01 00:00:09.507 | false | 6 | 2 | 0 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.386 | false | 2 | 0 | 2 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | true | 2 | 0 | 0 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | false | 2 | 2 | 0 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | true | 2 | 2 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:07.389 | false | 6 | 0 | 2 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | true | 2 | 2 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:11.793 | false | 6 | 0 | 2 | - 2020-10-01 00:00:11.925 | 2020-10-01 00:00:11.949 | true | 4 | 2 | 0 | - 2020-10-01 00:00:13.164 | 2020-10-01 00:00:13.569 | false | 4 | 0 | 2 | - 2020-10-01 00:00:13.965 | 2020-10-01 00:00:13.965 | true | 2 | 2 | 0 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | false | 2 | 0 | 0 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.365 | true | 4 | 2 | 0 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:02.367 | false | 6 | 0 | 4 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:04.332 | true | 8 | 0 | 4 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | false | 2 | 0 | 0 | - 2020-10-01 00:00:07.041 | 2020-10-01 00:00:07.842 | true | 4 | 0 | 2 | - 2020-10-01 00:00:07.905 | 2020-10-01 00:00:08.016 | false | 4 | 2 | 2 | - 2020-10-01 00:00:08.892 | 2020-10-01 00:00:14.040 | true | 10 | 2 | 8 | - 2020-10-01 00:00:15.882 | 2020-10-01 00:00:15.882 | false | 2 | 0 | 2 | - 2020-10-01 00:00:16.182 | 2020-10-01 00:00:16.644 | true | 4 | 0 | 4 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | true | 1 | 0 | 1 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | false | 2 | 2 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | true | 2 | 0 | 2 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | false | 2 | 0 | 2 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | true | 2 | 0 | 0 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | false | 2 | 0 | 0 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | true | 2 | 0 | 2 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:07.281 | false | 4 | 2 | 0 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | true | 2 | 2 | 0 | - 2020-10-01 00:00:09.852 | 2020-10-01 00:00:09.852 | false | 2 | 0 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:01.770 | false | 3 | 2 | 2 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:03.567 | true | 12 | 2 | 6 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | false | 2 | 0 | 2 | - 2020-10-01 00:00:06.093 | 2020-10-01 00:00:06.093 | true | 2 | 0 | 0 | - 2020-10-01 00:00:06.252 | 2020-10-01 00:00:06.939 | false | 4 | 0 | 2 | - 2020-10-01 00:00:09.489 | 2020-10-01 00:00:16.764 | true | 16 | 2 | 10 | - 2020-10-01 00:00:17.430 | 2020-10-01 00:00:17.430 | false | 2 | 2 | 2 | - 2020-10-01 00:00:18.966 | 2020-10-01 00:00:18.966 | true | 2 | 0 | 2 | - 2020-10-01 00:00:19.056 | 2020-10-01 00:00:19.056 | false | 2 | 0 | 2 | - 2020-10-01 00:00:19.119 | 2020-10-01 00:00:19.119 | true | 2 | 0 | 0 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 2 | 2 | 2 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | 1 | 0 | 0 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:01.779 | true | 4 | 0 | 2 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:01.731 | true | 3 | 1 | 0 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | false | 1 | 0 | 1 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:02.829 | true | 3 | 1 | 1 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:02.922 | true | 6 | 0 | 6 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | false | 2 | 0 | 0 | + 2020-10-01 00:00:00.024 | 2020-10-01 00:00:00.024 | false | 2 | 0 | 2 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:01.662 | true | 4 | 0 | 2 | -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | count(u_int_col) | =============================================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | true | 1 | 1 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:07.200 | false | 10 | 6 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:08.721 | true | 6 | 0 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.396 | false | 4 | 0 | - 2020-10-01 00:00:10.773 | 2020-10-01 00:00:10.773 | true | 2 | 0 | - 2020-10-01 00:00:12.483 | 2020-10-01 00:00:12.483 | false | 2 | 0 | - 2020-10-01 00:00:12.822 | 2020-10-01 00:00:14.319 | true | 6 | 2 | - 2020-10-01 00:00:14.652 | 2020-10-01 00:00:14.652 | false | 2 | 0 | - 2020-10-01 00:00:14.994 | 2020-10-01 00:00:14.994 | true | 2 | 0 | - 2020-10-01 00:00:16.260 | 2020-10-01 00:00:17.808 | false | 8 | 4 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:01.488 | false | 2 | 0 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.710 | true | 4 | 2 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | false | 2 | 0 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:08.313 | true | 4 | 2 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | false | 2 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | true | 2 | 0 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | false | 2 | 0 | - 2020-10-01 00:00:11.559 | 2020-10-01 00:00:12.408 | true | 4 | 0 | - 2020-10-01 00:00:12.786 | 2020-10-01 00:00:12.906 | false | 6 | 0 | - 2020-10-01 00:00:14.310 | 2020-10-01 00:00:15.405 | true | 4 | 4 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:01.023 | true | 4 | 0 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | false | 2 | 0 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.871 | true | 4 | 0 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | false | 2 | 0 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:05.766 | true | 8 | 4 | - 2020-10-01 00:00:05.778 | 2020-10-01 00:00:05.778 | false | 2 | 0 | - 2020-10-01 00:00:06.222 | 2020-10-01 00:00:06.222 | true | 2 | 0 | - 2020-10-01 00:00:06.648 | 2020-10-01 00:00:06.648 | false | 2 | 0 | - 2020-10-01 00:00:07.428 | 2020-10-01 00:00:07.428 | true | 2 | 0 | - 2020-10-01 00:00:07.890 | 2020-10-01 00:00:08.430 | false | 6 | 4 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:01.092 | true | 6 | 0 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | false | 2 | 0 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:04.548 | true | 6 | 0 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:05.553 | false | 6 | 2 | - 2020-10-01 00:00:06.423 | 2020-10-01 00:00:09.084 | true | 6 | 2 | - 2020-10-01 00:00:09.204 | 2020-10-01 00:00:09.204 | false | 2 | 0 | - 2020-10-01 00:00:09.909 | 2020-10-01 00:00:10.323 | true | 4 | 0 | - 2020-10-01 00:00:10.386 | 2020-10-01 00:00:12.099 | false | 6 | 0 | - 2020-10-01 00:00:13.563 | 2020-10-01 00:00:13.563 | true | 2 | 0 | - 2020-10-01 00:00:14.427 | 2020-10-01 00:00:14.427 | false | 2 | 0 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.653 | true | 6 | 0 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:03.330 | false | 8 | 2 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.858 | true | 4 | 2 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.346 | false | 4 | 2 | - 2020-10-01 00:00:05.661 | 2020-10-01 00:00:05.661 | true | 2 | 0 | - 2020-10-01 00:00:06.846 | 2020-10-01 00:00:06.846 | false | 2 | 0 | - 2020-10-01 00:00:09.501 | 2020-10-01 00:00:12.699 | true | 10 | 0 | - 2020-10-01 00:00:13.881 | 2020-10-01 00:00:13.881 | false | 2 | 0 | - 2020-10-01 00:00:14.907 | 2020-10-01 00:00:16.638 | true | 10 | 0 | - 2020-10-01 00:00:18.294 | 2020-10-01 00:00:18.309 | false | 4 | 0 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:01.203 | true | 4 | 2 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | false | 2 | 0 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | true | 2 | 0 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.955 | false | 2 | 2 | - 2020-10-01 00:00:02.958 | 2020-10-01 00:00:02.958 | true | 2 | 0 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.429 | false | 4 | 0 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | true | 2 | 0 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | false | 2 | 0 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | true | 2 | 0 | - 2020-10-01 00:00:08.715 | 2020-10-01 00:00:09.507 | false | 6 | 2 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.386 | false | 2 | 0 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | true | 2 | 0 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | false | 2 | 2 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | true | 2 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:07.389 | false | 6 | 0 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | true | 2 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:11.793 | false | 6 | 0 | - 2020-10-01 00:00:11.925 | 2020-10-01 00:00:11.949 | true | 4 | 2 | - 2020-10-01 00:00:13.164 | 2020-10-01 00:00:13.569 | false | 4 | 0 | - 2020-10-01 00:00:13.965 | 2020-10-01 00:00:13.965 | true | 2 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | false | 2 | 0 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.365 | true | 4 | 2 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:02.367 | false | 6 | 0 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:04.332 | true | 8 | 0 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | false | 2 | 0 | - 2020-10-01 00:00:07.041 | 2020-10-01 00:00:07.842 | true | 4 | 0 | - 2020-10-01 00:00:07.905 | 2020-10-01 00:00:08.016 | false | 4 | 2 | - 2020-10-01 00:00:08.892 | 2020-10-01 00:00:14.040 | true | 10 | 2 | - 2020-10-01 00:00:15.882 | 2020-10-01 00:00:15.882 | false | 2 | 0 | - 2020-10-01 00:00:16.182 | 2020-10-01 00:00:16.644 | true | 4 | 0 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | true | 1 | 0 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | false | 2 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | true | 2 | 0 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | false | 2 | 0 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | true | 2 | 0 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | false | 2 | 0 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | true | 2 | 0 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:07.281 | false | 4 | 2 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | true | 2 | 2 | - 2020-10-01 00:00:09.852 | 2020-10-01 00:00:09.852 | false | 2 | 0 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:01.770 | false | 3 | 2 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:03.567 | true | 12 | 2 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | false | 2 | 0 | - 2020-10-01 00:00:06.093 | 2020-10-01 00:00:06.093 | true | 2 | 0 | - 2020-10-01 00:00:06.252 | 2020-10-01 00:00:06.939 | false | 4 | 0 | - 2020-10-01 00:00:09.489 | 2020-10-01 00:00:16.764 | true | 16 | 2 | - 2020-10-01 00:00:17.430 | 2020-10-01 00:00:17.430 | false | 2 | 2 | - 2020-10-01 00:00:18.966 | 2020-10-01 00:00:18.966 | true | 2 | 0 | - 2020-10-01 00:00:19.056 | 2020-10-01 00:00:19.056 | false | 2 | 0 | - 2020-10-01 00:00:19.119 | 2020-10-01 00:00:19.119 | true | 2 | 0 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 2 | 2 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | 1 | 0 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:01.779 | true | 4 | 0 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:01.731 | true | 3 | 1 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | false | 1 | 0 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:02.829 | true | 3 | 1 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:02.922 | true | 6 | 0 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | false | 2 | 0 | + 2020-10-01 00:00:00.024 | 2020-10-01 00:00:00.024 | false | 2 | 0 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:01.662 | true | 4 | 0 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.232 | 2020-10-01 00:00:00.232 | 147 | 3 | - 2020-10-01 00:00:01.602 | 2020-10-01 00:00:01.602 | 147 | 3 | - 2020-10-01 00:00:01.726 | 2020-10-01 00:00:01.726 | 147 | 3 | - 2020-10-01 00:00:02.068 | 2020-10-01 00:00:02.068 | 147 | 3 | - 2020-10-01 00:00:02.088 | 2020-10-01 00:00:02.088 | 147 | 3 | - 2020-10-01 00:00:02.584 | 2020-10-01 00:00:02.584 | 147 | 3 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:02.772 | 147 | 3 | - 2020-10-01 00:00:04.082 | 2020-10-01 00:00:04.082 | 147 | 3 | - 2020-10-01 00:00:04.258 | 2020-10-01 00:00:04.258 | 147 | 3 | - 2020-10-01 00:00:05.008 | 2020-10-01 00:00:05.008 | 147 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 29 | 3 | + 2020-10-01 00:00:00.002 | 2020-10-01 00:00:00.002 | 158 | 3 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.004 | 1 | 3 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.006 | 49 | 3 | 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.008 | 74 | 3 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.348 | 74 | 3 | - 2020-10-01 00:00:01.928 | 2020-10-01 00:00:01.928 | 74 | 3 | - 2020-10-01 00:00:02.964 | 2020-10-01 00:00:02.964 | 74 | 3 | - 2020-10-01 00:00:04.072 | 2020-10-01 00:00:04.072 | 74 | 3 | - 2020-10-01 00:00:04.202 | 2020-10-01 00:00:04.202 | 74 | 3 | - 2020-10-01 00:00:04.330 | 2020-10-01 00:00:04.330 | 74 | 3 | - 2020-10-01 00:00:07.958 | 2020-10-01 00:00:07.958 | 74 | 3 | - 2020-10-01 00:00:08.246 | 2020-10-01 00:00:08.246 | 74 | 3 | - 2020-10-01 00:00:08.278 | 2020-10-01 00:00:08.278 | 74 | 3 | - 2020-10-01 00:00:01.558 | 2020-10-01 00:00:01.558 | 131 | 3 | - 2020-10-01 00:00:01.852 | 2020-10-01 00:00:01.852 | 131 | 3 | - 2020-10-01 00:00:02.898 | 2020-10-01 00:00:02.898 | 131 | 3 | - 2020-10-01 00:00:03.674 | 2020-10-01 00:00:03.674 | 131 | 3 | - 2020-10-01 00:00:05.588 | 2020-10-01 00:00:05.588 | 131 | 3 | - 2020-10-01 00:00:05.734 | 2020-10-01 00:00:05.734 | 131 | 3 | - 2020-10-01 00:00:05.872 | 2020-10-01 00:00:05.872 | 131 | 3 | - 2020-10-01 00:00:06.278 | 2020-10-01 00:00:06.278 | 131 | 3 | - 2020-10-01 00:00:07.036 | 2020-10-01 00:00:07.036 | 131 | 3 | - 2020-10-01 00:00:07.734 | 2020-10-01 00:00:07.740 | 131 | 6 | - 2020-10-01 00:00:00.452 | 2020-10-01 00:00:00.452 | 32 | 3 | - 2020-10-01 00:00:00.668 | 2020-10-01 00:00:00.668 | 32 | 3 | - 2020-10-01 00:00:01.144 | 2020-10-01 00:00:01.144 | 32 | 3 | - 2020-10-01 00:00:01.554 | 2020-10-01 00:00:01.554 | 32 | 3 | - 2020-10-01 00:00:01.936 | 2020-10-01 00:00:01.936 | 32 | 3 | - 2020-10-01 00:00:02.412 | 2020-10-01 00:00:02.412 | 32 | 3 | - 2020-10-01 00:00:03.210 | 2020-10-01 00:00:03.210 | 32 | 3 | - 2020-10-01 00:00:03.516 | 2020-10-01 00:00:03.524 | 32 | 6 | - 2020-10-01 00:00:04.760 | 2020-10-01 00:00:04.760 | 32 | 3 | - 2020-10-01 00:00:05.600 | 2020-10-01 00:00:05.600 | 32 | 3 | - 2020-10-01 00:00:00.082 | 2020-10-01 00:00:00.082 | 38 | 3 | - 2020-10-01 00:00:00.260 | 2020-10-01 00:00:00.260 | 38 | 3 | - 2020-10-01 00:00:00.276 | 2020-10-01 00:00:00.284 | 38 | 6 | - 2020-10-01 00:00:01.700 | 2020-10-01 00:00:01.700 | 38 | 3 | - 2020-10-01 00:00:01.916 | 2020-10-01 00:00:01.916 | 38 | 3 | - 2020-10-01 00:00:02.690 | 2020-10-01 00:00:02.690 | 38 | 3 | - 2020-10-01 00:00:03.082 | 2020-10-01 00:00:03.082 | 38 | 3 | - 2020-10-01 00:00:03.352 | 2020-10-01 00:00:03.352 | 38 | 3 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:03.444 | 38 | 3 | - 2020-10-01 00:00:03.654 | 2020-10-01 00:00:03.654 | 38 | 3 | - 2020-10-01 00:00:00.584 | 2020-10-01 00:00:00.584 | 107 | 3 | - 2020-10-01 00:00:00.792 | 2020-10-01 00:00:00.792 | 107 | 3 | - 2020-10-01 00:00:01.408 | 2020-10-01 00:00:01.408 | 107 | 3 | - 2020-10-01 00:00:01.552 | 2020-10-01 00:00:01.552 | 107 | 3 | - 2020-10-01 00:00:01.856 | 2020-10-01 00:00:01.856 | 107 | 3 | - 2020-10-01 00:00:02.300 | 2020-10-01 00:00:02.300 | 107 | 3 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:02.364 | 107 | 3 | - 2020-10-01 00:00:03.522 | 2020-10-01 00:00:03.522 | 107 | 3 | - 2020-10-01 00:00:03.548 | 2020-10-01 00:00:03.548 | 107 | 3 | - 2020-10-01 00:00:04.496 | 2020-10-01 00:00:04.496 | 107 | 3 | - 2020-10-01 00:00:00.360 | 2020-10-01 00:00:00.360 | 99 | 3 | - 2020-10-01 00:00:02.438 | 2020-10-01 00:00:02.438 | 99 | 3 | - 2020-10-01 00:00:02.530 | 2020-10-01 00:00:02.530 | 99 | 3 | - 2020-10-01 00:00:02.858 | 2020-10-01 00:00:02.858 | 99 | 3 | - 2020-10-01 00:00:03.416 | 2020-10-01 00:00:03.416 | 99 | 3 | - 2020-10-01 00:00:03.784 | 2020-10-01 00:00:03.784 | 99 | 3 | - 2020-10-01 00:00:04.378 | 2020-10-01 00:00:04.378 | 99 | 3 | - 2020-10-01 00:00:05.126 | 2020-10-01 00:00:05.126 | 99 | 3 | - 2020-10-01 00:00:06.150 | 2020-10-01 00:00:06.150 | 99 | 3 | - 2020-10-01 00:00:06.506 | 2020-10-01 00:00:06.506 | 99 | 3 | - 2020-10-01 00:00:00.468 | 2020-10-01 00:00:00.468 | 27 | 3 | - 2020-10-01 00:00:00.616 | 2020-10-01 00:00:00.616 | 27 | 3 | - 2020-10-01 00:00:00.938 | 2020-10-01 00:00:00.938 | 27 | 3 | - 2020-10-01 00:00:00.978 | 2020-10-01 00:00:00.978 | 27 | 3 | - 2020-10-01 00:00:00.990 | 2020-10-01 00:00:00.990 | 27 | 3 | - 2020-10-01 00:00:01.098 | 2020-10-01 00:00:01.098 | 27 | 3 | - 2020-10-01 00:00:01.172 | 2020-10-01 00:00:01.172 | 27 | 3 | - 2020-10-01 00:00:01.442 | 2020-10-01 00:00:01.442 | 27 | 3 | - 2020-10-01 00:00:01.768 | 2020-10-01 00:00:01.768 | 27 | 3 | - 2020-10-01 00:00:02.478 | 2020-10-01 00:00:02.478 | 27 | 3 | - 2020-10-01 00:00:00.794 | 2020-10-01 00:00:00.794 | 236 | 3 | - 2020-10-01 00:00:01.788 | 2020-10-01 00:00:01.788 | 236 | 3 | - 2020-10-01 00:00:02.216 | 2020-10-01 00:00:02.216 | 236 | 3 | - 2020-10-01 00:00:02.296 | 2020-10-01 00:00:02.296 | 236 | 3 | - 2020-10-01 00:00:03.484 | 2020-10-01 00:00:03.484 | 236 | 3 | - 2020-10-01 00:00:04.268 | 2020-10-01 00:00:04.268 | 236 | 3 | - 2020-10-01 00:00:04.858 | 2020-10-01 00:00:04.858 | 236 | 3 | - 2020-10-01 00:00:05.832 | 2020-10-01 00:00:05.832 | 236 | 3 | - 2020-10-01 00:00:06.482 | 2020-10-01 00:00:06.482 | 236 | 3 | - 2020-10-01 00:00:06.518 | 2020-10-01 00:00:06.518 | 236 | 3 | - 2020-10-01 00:00:00.244 | 2020-10-01 00:00:00.244 | 28 | 3 | - 2020-10-01 00:00:00.940 | 2020-10-01 00:00:00.940 | 28 | 3 | - 2020-10-01 00:00:00.980 | 2020-10-01 00:00:00.980 | 28 | 3 | - 2020-10-01 00:00:01.284 | 2020-10-01 00:00:01.284 | 28 | 3 | - 2020-10-01 00:00:02.426 | 2020-10-01 00:00:02.426 | 28 | 3 | - 2020-10-01 00:00:02.888 | 2020-10-01 00:00:02.888 | 28 | 3 | - 2020-10-01 00:00:03.742 | 2020-10-01 00:00:03.742 | 28 | 3 | - 2020-10-01 00:00:04.376 | 2020-10-01 00:00:04.376 | 28 | 3 | - 2020-10-01 00:00:05.412 | 2020-10-01 00:00:05.412 | 28 | 3 | - 2020-10-01 00:00:05.940 | 2020-10-01 00:00:05.940 | 28 | 3 | + 2020-10-01 00:00:00.010 | 2020-10-01 00:00:00.010 | 11 | 3 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 77 | 3 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.014 | 63 | 3 | + 2020-10-01 00:00:00.016 | 2020-10-01 00:00:00.016 | 229 | 3 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.018 | 195 | 3 | -taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | tinyint_col | count(*) | ========================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | -1 | 2 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:02.505 | -1 | 2 | - 2020-10-01 00:00:03.885 | 2020-10-01 00:00:03.885 | -1 | 2 | - 2020-10-01 00:00:05.226 | 2020-10-01 00:00:05.226 | -1 | 2 | - 2020-10-01 00:00:05.838 | 2020-10-01 00:00:05.838 | -1 | 2 | - 2020-10-01 00:00:07.200 | 2020-10-01 00:00:07.200 | -1 | 2 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:07.383 | -1 | 2 | - 2020-10-01 00:00:07.542 | 2020-10-01 00:00:07.542 | -1 | 2 | - 2020-10-01 00:00:08.721 | 2020-10-01 00:00:08.721 | -1 | 2 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.222 | -1 | 2 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:00.993 | -109 | 2 | - 2020-10-01 00:00:01.488 | 2020-10-01 00:00:01.488 | -109 | 2 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.584 | -109 | 2 | - 2020-10-01 00:00:01.710 | 2020-10-01 00:00:01.710 | -109 | 2 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | -109 | 2 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:07.965 | -109 | 2 | - 2020-10-01 00:00:08.313 | 2020-10-01 00:00:08.313 | -109 | 2 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | -109 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | -109 | 2 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | -109 | 2 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:00.561 | 74 | 2 | - 2020-10-01 00:00:01.023 | 2020-10-01 00:00:01.023 | 74 | 2 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | 74 | 2 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.382 | 74 | 2 | - 2020-10-01 00:00:02.871 | 2020-10-01 00:00:02.871 | 74 | 2 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | 74 | 2 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:03.417 | 74 | 2 | - 2020-10-01 00:00:04.035 | 2020-10-01 00:00:04.035 | 74 | 2 | - 2020-10-01 00:00:05.475 | 2020-10-01 00:00:05.475 | 74 | 2 | - 2020-10-01 00:00:05.766 | 2020-10-01 00:00:05.766 | 74 | 2 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:00.759 | -125 | 2 | - 2020-10-01 00:00:01.017 | 2020-10-01 00:00:01.017 | -125 | 2 | - 2020-10-01 00:00:01.092 | 2020-10-01 00:00:01.092 | -125 | 2 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | -125 | 2 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:02.211 | -125 | 2 | - 2020-10-01 00:00:02.406 | 2020-10-01 00:00:02.406 | -125 | 2 | - 2020-10-01 00:00:04.548 | 2020-10-01 00:00:04.548 | -125 | 2 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:04.755 | -125 | 2 | - 2020-10-01 00:00:05.037 | 2020-10-01 00:00:05.037 | -125 | 2 | - 2020-10-01 00:00:05.553 | 2020-10-01 00:00:05.553 | -125 | 2 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.134 | 32 | 2 | - 2020-10-01 00:00:01.563 | 2020-10-01 00:00:01.563 | 32 | 2 | - 2020-10-01 00:00:01.653 | 2020-10-01 00:00:01.653 | 32 | 2 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:02.439 | 32 | 2 | - 2020-10-01 00:00:02.832 | 2020-10-01 00:00:02.832 | 32 | 2 | - 2020-10-01 00:00:03.138 | 2020-10-01 00:00:03.138 | 32 | 2 | - 2020-10-01 00:00:03.330 | 2020-10-01 00:00:03.330 | 32 | 2 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.735 | 32 | 2 | - 2020-10-01 00:00:03.858 | 2020-10-01 00:00:03.858 | 32 | 2 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.115 | 32 | 2 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:00.900 | 38 | 2 | - 2020-10-01 00:00:01.203 | 2020-10-01 00:00:01.203 | 38 | 2 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | 38 | 2 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | 38 | 2 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.958 | 38 | 4 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.006 | 38 | 2 | - 2020-10-01 00:00:03.429 | 2020-10-01 00:00:03.429 | 38 | 2 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | 38 | 2 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | 38 | 2 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | 38 | 2 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.218 | 107 | 2 | - 2020-10-01 00:00:01.386 | 2020-10-01 00:00:01.386 | 107 | 2 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | 107 | 2 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | 107 | 2 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | 107 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:06.354 | 107 | 2 | - 2020-10-01 00:00:07.329 | 2020-10-01 00:00:07.329 | 107 | 2 | - 2020-10-01 00:00:07.389 | 2020-10-01 00:00:07.389 | 107 | 2 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:10.842 | 107 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | 99 | 2 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.167 | 99 | 2 | - 2020-10-01 00:00:01.365 | 2020-10-01 00:00:01.365 | 99 | 2 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:01.632 | 99 | 2 | - 2020-10-01 00:00:01.656 | 2020-10-01 00:00:01.656 | 99 | 2 | - 2020-10-01 00:00:02.367 | 2020-10-01 00:00:02.367 | 99 | 2 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:02.514 | 99 | 2 | - 2020-10-01 00:00:04.221 | 2020-10-01 00:00:04.227 | 99 | 4 | - 2020-10-01 00:00:04.332 | 2020-10-01 00:00:04.332 | 99 | 2 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | 99 | 2 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | 27 | 2 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | 27 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | 27 | 2 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | 27 | 2 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | 27 | 2 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | 27 | 2 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | 27 | 2 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:06.975 | 27 | 2 | - 2020-10-01 00:00:07.281 | 2020-10-01 00:00:07.281 | 27 | 2 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | 27 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:00.981 | -20 | 2 | - 2020-10-01 00:00:01.290 | 2020-10-01 00:00:01.290 | -20 | 2 | - 2020-10-01 00:00:01.770 | 2020-10-01 00:00:01.770 | -20 | 2 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:02.130 | -20 | 2 | - 2020-10-01 00:00:02.202 | 2020-10-01 00:00:02.202 | -20 | 2 | - 2020-10-01 00:00:02.724 | 2020-10-01 00:00:02.724 | -20 | 2 | - 2020-10-01 00:00:02.847 | 2020-10-01 00:00:02.847 | -20 | 2 | - 2020-10-01 00:00:03.039 | 2020-10-01 00:00:03.039 | -20 | 2 | - 2020-10-01 00:00:03.567 | 2020-10-01 00:00:03.567 | -20 | 2 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | -20 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 2 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 44 | 2 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.006 | -91 | 2 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.009 | 25 | 2 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 70 | 2 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:00.015 | -106 | 2 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.018 | -113 | 2 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 2 | + 2020-10-01 00:00:00.024 | 2020-10-01 00:00:00.024 | -9 | 2 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.027 | -102 | 2 | -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | ======================================================================================= 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.057 | true | 26 | - 2020-10-01 00:00:00.069 | 2020-10-01 00:00:00.096 | true | 14 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.120 | true | 8 | - 2020-10-01 00:00:00.132 | 2020-10-01 00:00:00.159 | true | 16 | - 2020-10-01 00:00:00.171 | 2020-10-01 00:00:00.195 | true | 12 | - 2020-10-01 00:00:00.228 | 2020-10-01 00:00:00.240 | true | 10 | - 2020-10-01 00:00:00.258 | 2020-10-01 00:00:00.321 | true | 30 | - 2020-10-01 00:00:00.336 | 2020-10-01 00:00:00.348 | true | 6 | - 2020-10-01 00:00:00.360 | 2020-10-01 00:00:00.390 | true | 14 | - 2020-10-01 00:00:00.402 | 2020-10-01 00:00:00.408 | true | 6 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.033 | false | 10 | 2020-10-01 00:00:00.045 | 2020-10-01 00:00:00.048 | false | 4 | 2020-10-01 00:00:00.060 | 2020-10-01 00:00:00.084 | false | 12 | + 2020-10-01 00:00:00.069 | 2020-10-01 00:00:00.096 | true | 14 | 2020-10-01 00:00:00.099 | 2020-10-01 00:00:00.141 | false | 18 | + 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.120 | true | 8 | + 2020-10-01 00:00:00.132 | 2020-10-01 00:00:00.159 | true | 16 | 2020-10-01 00:00:00.162 | 2020-10-01 00:00:00.168 | false | 6 | - 2020-10-01 00:00:00.180 | 2020-10-01 00:00:00.225 | false | 26 | - 2020-10-01 00:00:00.243 | 2020-10-01 00:00:00.261 | false | 12 | - 2020-10-01 00:00:00.273 | 2020-10-01 00:00:00.276 | false | 4 | - 2020-10-01 00:00:00.294 | 2020-10-01 00:00:00.303 | false | 4 | - 2020-10-01 00:00:00.315 | 2020-10-01 00:00:00.363 | false | 24 | + 2020-10-01 00:00:00.171 | 2020-10-01 00:00:00.195 | true | 12 | -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | bool_col | count(*) | ======================================================================================= 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.057 | true | 26 | - 2020-10-01 00:00:00.069 | 2020-10-01 00:00:00.096 | true | 14 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.120 | true | 8 | - 2020-10-01 00:00:00.132 | 2020-10-01 00:00:00.159 | true | 16 | - 2020-10-01 00:00:00.171 | 2020-10-01 00:00:00.195 | true | 12 | - 2020-10-01 00:00:00.228 | 2020-10-01 00:00:00.240 | true | 10 | - 2020-10-01 00:00:00.258 | 2020-10-01 00:00:00.321 | true | 30 | - 2020-10-01 00:00:00.336 | 2020-10-01 00:00:00.348 | true | 6 | - 2020-10-01 00:00:00.360 | 2020-10-01 00:00:00.390 | true | 14 | - 2020-10-01 00:00:00.402 | 2020-10-01 00:00:00.408 | true | 6 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.033 | false | 10 | 2020-10-01 00:00:00.045 | 2020-10-01 00:00:00.048 | false | 4 | 2020-10-01 00:00:00.060 | 2020-10-01 00:00:00.084 | false | 12 | + 2020-10-01 00:00:00.069 | 2020-10-01 00:00:00.096 | true | 14 | 2020-10-01 00:00:00.099 | 2020-10-01 00:00:00.141 | false | 18 | + 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.120 | true | 8 | + 2020-10-01 00:00:00.132 | 2020-10-01 00:00:00.159 | true | 16 | 2020-10-01 00:00:00.162 | 2020-10-01 00:00:00.168 | false | 6 | - 2020-10-01 00:00:00.180 | 2020-10-01 00:00:00.225 | false | 26 | - 2020-10-01 00:00:00.243 | 2020-10-01 00:00:00.261 | false | 12 | - 2020-10-01 00:00:00.273 | 2020-10-01 00:00:00.276 | false | 4 | - 2020-10-01 00:00:00.294 | 2020-10-01 00:00:00.303 | false | 4 | - 2020-10-01 00:00:00.315 | 2020-10-01 00:00:00.363 | false | 24 | + 2020-10-01 00:00:00.171 | 2020-10-01 00:00:00.195 | true | 12 | -taos> select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | tinyint_col | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | ================================================================================================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | -1 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:02.505 | -1 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:03.885 | 2020-10-01 00:00:03.885 | -1 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:05.226 | 2020-10-01 00:00:05.226 | -1 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.838 | 2020-10-01 00:00:05.838 | -1 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:07.200 | 2020-10-01 00:00:07.200 | -1 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:07.383 | -1 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:07.542 | 2020-10-01 00:00:07.542 | -1 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:08.721 | 2020-10-01 00:00:08.721 | -1 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.222 | -1 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:00.993 | -109 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.488 | 2020-10-01 00:00:01.488 | -109 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.584 | -109 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.710 | 2020-10-01 00:00:01.710 | -109 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | -109 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:07.965 | -109 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:08.313 | 2020-10-01 00:00:08.313 | -109 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | -109 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | -109 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | -109 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:00.561 | 74 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.023 | 2020-10-01 00:00:01.023 | 74 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | 74 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.382 | 74 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.871 | 2020-10-01 00:00:02.871 | 74 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | 74 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:03.417 | 74 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:04.035 | 2020-10-01 00:00:04.035 | 74 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:05.475 | 2020-10-01 00:00:05.475 | 74 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:05.766 | 2020-10-01 00:00:05.766 | 74 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:00.759 | -125 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.017 | 2020-10-01 00:00:01.017 | -125 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.092 | 2020-10-01 00:00:01.092 | -125 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | -125 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:02.211 | -125 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.406 | 2020-10-01 00:00:02.406 | -125 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:04.548 | 2020-10-01 00:00:04.548 | -125 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:04.755 | -125 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:05.037 | 2020-10-01 00:00:05.037 | -125 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:05.553 | 2020-10-01 00:00:05.553 | -125 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.134 | 32 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.563 | 2020-10-01 00:00:01.563 | 32 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.653 | 2020-10-01 00:00:01.653 | 32 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:02.439 | 32 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.832 | 2020-10-01 00:00:02.832 | 32 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:03.138 | 2020-10-01 00:00:03.138 | 32 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:03.330 | 2020-10-01 00:00:03.330 | 32 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.735 | 32 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:03.858 | 2020-10-01 00:00:03.858 | 32 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.115 | 32 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:00.900 | 38 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:01.203 | 2020-10-01 00:00:01.203 | 38 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | 38 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | 38 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.958 | 38 | 4 | 2 | 2 | 4 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.006 | 38 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:03.429 | 2020-10-01 00:00:03.429 | 38 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | 38 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | 38 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | 38 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.218 | 107 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.386 | 2020-10-01 00:00:01.386 | 107 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | 107 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | 107 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | 107 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:06.354 | 107 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:07.329 | 2020-10-01 00:00:07.329 | 107 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:07.389 | 2020-10-01 00:00:07.389 | 107 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:10.842 | 107 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | 99 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.167 | 99 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.365 | 2020-10-01 00:00:01.365 | 99 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:01.632 | 99 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.656 | 2020-10-01 00:00:01.656 | 99 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.367 | 2020-10-01 00:00:02.367 | 99 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:02.514 | 99 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:04.221 | 2020-10-01 00:00:04.227 | 99 | 4 | 0 | 0 | 4 | - 2020-10-01 00:00:04.332 | 2020-10-01 00:00:04.332 | 99 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | 99 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | 27 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | 27 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | 27 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | 27 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | 27 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | 27 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | 27 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:06.975 | 27 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:07.281 | 2020-10-01 00:00:07.281 | 27 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | 27 | 2 | 2 | 0 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:00.981 | -20 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:01.290 | 2020-10-01 00:00:01.290 | -20 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:01.770 | 2020-10-01 00:00:01.770 | -20 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:02.130 | -20 | 2 | 2 | 2 | 2 | - 2020-10-01 00:00:02.202 | 2020-10-01 00:00:02.202 | -20 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.724 | 2020-10-01 00:00:02.724 | -20 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:02.847 | 2020-10-01 00:00:02.847 | -20 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:03.039 | 2020-10-01 00:00:03.039 | -20 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:03.567 | 2020-10-01 00:00:03.567 | -20 | 2 | 0 | 0 | 2 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | -20 | 2 | 0 | 2 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 2 | 2 | 2 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:49.995 | NULL | 23333 | 10000 | 10000 | 10000 | + 2020-10-01 00:00:00.002 | 2020-10-01 00:00:49.995 | NULL | 26666 | 16000 | 13332 | 0 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 44 | 2 | 0 | 0 | 2 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.006 | -91 | 2 | 0 | 2 | 2 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.009 | 25 | 2 | 0 | 0 | 2 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 70 | 2 | 0 | 2 | 2 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:00.015 | -106 | 2 | 2 | 0 | 2 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.018 | -113 | 2 | 0 | 2 | 2 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 2 | 0 | 0 | 2 | -taos> select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | tinyint_col | count(*) | count(u_int_col) | count(u_tinyint_col) | ========================================================================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | -1 | 2 | 2 | 0 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:02.505 | -1 | 2 | 2 | 0 | - 2020-10-01 00:00:03.885 | 2020-10-01 00:00:03.885 | -1 | 2 | 2 | 0 | - 2020-10-01 00:00:05.226 | 2020-10-01 00:00:05.226 | -1 | 2 | 0 | 2 | - 2020-10-01 00:00:05.838 | 2020-10-01 00:00:05.838 | -1 | 2 | 0 | 2 | - 2020-10-01 00:00:07.200 | 2020-10-01 00:00:07.200 | -1 | 2 | 2 | 2 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:07.383 | -1 | 2 | 0 | 0 | - 2020-10-01 00:00:07.542 | 2020-10-01 00:00:07.542 | -1 | 2 | 0 | 2 | - 2020-10-01 00:00:08.721 | 2020-10-01 00:00:08.721 | -1 | 2 | 0 | 0 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.222 | -1 | 2 | 0 | 2 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:00.993 | -109 | 2 | 0 | 0 | - 2020-10-01 00:00:01.488 | 2020-10-01 00:00:01.488 | -109 | 2 | 0 | 2 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.584 | -109 | 2 | 0 | 2 | - 2020-10-01 00:00:01.710 | 2020-10-01 00:00:01.710 | -109 | 2 | 2 | 2 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | -109 | 2 | 0 | 0 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:07.965 | -109 | 2 | 2 | 0 | - 2020-10-01 00:00:08.313 | 2020-10-01 00:00:08.313 | -109 | 2 | 0 | 0 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | -109 | 2 | 2 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | -109 | 2 | 0 | 0 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | -109 | 2 | 0 | 2 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:00.561 | 74 | 2 | 0 | 0 | - 2020-10-01 00:00:01.023 | 2020-10-01 00:00:01.023 | 74 | 2 | 0 | 0 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | 74 | 2 | 0 | 2 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.382 | 74 | 2 | 0 | 2 | - 2020-10-01 00:00:02.871 | 2020-10-01 00:00:02.871 | 74 | 2 | 0 | 0 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | 74 | 2 | 0 | 0 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:03.417 | 74 | 2 | 0 | 0 | - 2020-10-01 00:00:04.035 | 2020-10-01 00:00:04.035 | 74 | 2 | 2 | 0 | - 2020-10-01 00:00:05.475 | 2020-10-01 00:00:05.475 | 74 | 2 | 2 | 0 | - 2020-10-01 00:00:05.766 | 2020-10-01 00:00:05.766 | 74 | 2 | 0 | 2 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:00.759 | -125 | 2 | 0 | 0 | - 2020-10-01 00:00:01.017 | 2020-10-01 00:00:01.017 | -125 | 2 | 0 | 0 | - 2020-10-01 00:00:01.092 | 2020-10-01 00:00:01.092 | -125 | 2 | 0 | 2 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | -125 | 2 | 0 | 0 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:02.211 | -125 | 2 | 0 | 0 | - 2020-10-01 00:00:02.406 | 2020-10-01 00:00:02.406 | -125 | 2 | 0 | 2 | - 2020-10-01 00:00:04.548 | 2020-10-01 00:00:04.548 | -125 | 2 | 0 | 2 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:04.755 | -125 | 2 | 2 | 0 | - 2020-10-01 00:00:05.037 | 2020-10-01 00:00:05.037 | -125 | 2 | 0 | 0 | - 2020-10-01 00:00:05.553 | 2020-10-01 00:00:05.553 | -125 | 2 | 0 | 0 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.134 | 32 | 2 | 0 | 2 | - 2020-10-01 00:00:01.563 | 2020-10-01 00:00:01.563 | 32 | 2 | 0 | 0 | - 2020-10-01 00:00:01.653 | 2020-10-01 00:00:01.653 | 32 | 2 | 0 | 0 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:02.439 | 32 | 2 | 0 | 0 | - 2020-10-01 00:00:02.832 | 2020-10-01 00:00:02.832 | 32 | 2 | 0 | 2 | - 2020-10-01 00:00:03.138 | 2020-10-01 00:00:03.138 | 32 | 2 | 0 | 2 | - 2020-10-01 00:00:03.330 | 2020-10-01 00:00:03.330 | 32 | 2 | 2 | 2 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.735 | 32 | 2 | 2 | 0 | - 2020-10-01 00:00:03.858 | 2020-10-01 00:00:03.858 | 32 | 2 | 0 | 2 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.115 | 32 | 2 | 2 | 0 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:00.900 | 38 | 2 | 2 | 2 | - 2020-10-01 00:00:01.203 | 2020-10-01 00:00:01.203 | 38 | 2 | 0 | 0 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | 38 | 2 | 0 | 2 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | 38 | 2 | 0 | 0 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.958 | 38 | 4 | 2 | 2 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.006 | 38 | 2 | 0 | 2 | - 2020-10-01 00:00:03.429 | 2020-10-01 00:00:03.429 | 38 | 2 | 0 | 0 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | 38 | 2 | 0 | 2 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | 38 | 2 | 0 | 2 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | 38 | 2 | 0 | 0 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.218 | 107 | 2 | 0 | 2 | - 2020-10-01 00:00:01.386 | 2020-10-01 00:00:01.386 | 107 | 2 | 0 | 2 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | 107 | 2 | 0 | 0 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | 107 | 2 | 2 | 0 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | 107 | 2 | 2 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:06.354 | 107 | 2 | 0 | 2 | - 2020-10-01 00:00:07.329 | 2020-10-01 00:00:07.329 | 107 | 2 | 0 | 0 | - 2020-10-01 00:00:07.389 | 2020-10-01 00:00:07.389 | 107 | 2 | 0 | 0 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 2 | 2 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:10.842 | 107 | 2 | 0 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | 99 | 2 | 0 | 0 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.167 | 99 | 2 | 0 | 0 | - 2020-10-01 00:00:01.365 | 2020-10-01 00:00:01.365 | 99 | 2 | 2 | 0 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:01.632 | 99 | 2 | 0 | 2 | - 2020-10-01 00:00:01.656 | 2020-10-01 00:00:01.656 | 99 | 2 | 0 | 2 | - 2020-10-01 00:00:02.367 | 2020-10-01 00:00:02.367 | 99 | 2 | 0 | 0 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:02.514 | 99 | 2 | 0 | 2 | - 2020-10-01 00:00:04.221 | 2020-10-01 00:00:04.227 | 99 | 4 | 0 | 0 | - 2020-10-01 00:00:04.332 | 2020-10-01 00:00:04.332 | 99 | 2 | 0 | 2 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | 99 | 2 | 0 | 0 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | 27 | 2 | 0 | 2 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | 27 | 2 | 2 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | 27 | 2 | 0 | 2 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | 27 | 2 | 0 | 2 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | 27 | 2 | 0 | 0 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | 27 | 2 | 0 | 0 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | 27 | 2 | 0 | 2 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:06.975 | 27 | 2 | 2 | 0 | - 2020-10-01 00:00:07.281 | 2020-10-01 00:00:07.281 | 27 | 2 | 0 | 0 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | 27 | 2 | 2 | 0 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:00.981 | -20 | 2 | 0 | 0 | - 2020-10-01 00:00:01.290 | 2020-10-01 00:00:01.290 | -20 | 2 | 2 | 2 | - 2020-10-01 00:00:01.770 | 2020-10-01 00:00:01.770 | -20 | 2 | 2 | 2 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:02.130 | -20 | 2 | 2 | 2 | - 2020-10-01 00:00:02.202 | 2020-10-01 00:00:02.202 | -20 | 2 | 0 | 2 | - 2020-10-01 00:00:02.724 | 2020-10-01 00:00:02.724 | -20 | 2 | 0 | 2 | - 2020-10-01 00:00:02.847 | 2020-10-01 00:00:02.847 | -20 | 2 | 0 | 0 | - 2020-10-01 00:00:03.039 | 2020-10-01 00:00:03.039 | -20 | 2 | 0 | 0 | - 2020-10-01 00:00:03.567 | 2020-10-01 00:00:03.567 | -20 | 2 | 0 | 0 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | -20 | 2 | 0 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 2 | 2 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:49.995 | NULL | 18000 | 10000 | 10000 | + 2020-10-01 00:00:00.002 | 2020-10-01 00:00:49.995 | NULL | 26666 | 16000 | 13332 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 44 | 2 | 0 | 0 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.006 | -91 | 2 | 0 | 2 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.009 | 25 | 2 | 0 | 0 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 70 | 2 | 0 | 2 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:00.015 | -106 | 2 | 2 | 0 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.018 | -113 | 2 | 0 | 2 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 2 | 0 | 0 | -taos> select _wstart, _wend, tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; +taos> select _wstart, _wend, tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | tinyint_col | count(*) | count(u_int_col) | ================================================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:01.515 | -1 | 2 | 2 | - 2020-10-01 00:00:02.505 | 2020-10-01 00:00:02.505 | -1 | 2 | 2 | - 2020-10-01 00:00:03.885 | 2020-10-01 00:00:03.885 | -1 | 2 | 2 | - 2020-10-01 00:00:05.226 | 2020-10-01 00:00:05.226 | -1 | 2 | 0 | - 2020-10-01 00:00:05.838 | 2020-10-01 00:00:05.838 | -1 | 2 | 0 | - 2020-10-01 00:00:07.200 | 2020-10-01 00:00:07.200 | -1 | 2 | 2 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:07.383 | -1 | 2 | 0 | - 2020-10-01 00:00:07.542 | 2020-10-01 00:00:07.542 | -1 | 2 | 0 | - 2020-10-01 00:00:08.721 | 2020-10-01 00:00:08.721 | -1 | 2 | 0 | - 2020-10-01 00:00:09.222 | 2020-10-01 00:00:09.222 | -1 | 2 | 0 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:00.993 | -109 | 2 | 0 | - 2020-10-01 00:00:01.488 | 2020-10-01 00:00:01.488 | -109 | 2 | 0 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:01.584 | -109 | 2 | 0 | - 2020-10-01 00:00:01.710 | 2020-10-01 00:00:01.710 | -109 | 2 | 2 | - 2020-10-01 00:00:03.717 | 2020-10-01 00:00:03.717 | -109 | 2 | 0 | - 2020-10-01 00:00:07.965 | 2020-10-01 00:00:07.965 | -109 | 2 | 2 | - 2020-10-01 00:00:08.313 | 2020-10-01 00:00:08.313 | -109 | 2 | 0 | - 2020-10-01 00:00:08.700 | 2020-10-01 00:00:08.700 | -109 | 2 | 2 | - 2020-10-01 00:00:08.841 | 2020-10-01 00:00:08.841 | -109 | 2 | 0 | - 2020-10-01 00:00:10.752 | 2020-10-01 00:00:10.752 | -109 | 2 | 0 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:00.561 | 74 | 2 | 0 | - 2020-10-01 00:00:01.023 | 2020-10-01 00:00:01.023 | 74 | 2 | 0 | - 2020-10-01 00:00:02.112 | 2020-10-01 00:00:02.112 | 74 | 2 | 0 | - 2020-10-01 00:00:02.382 | 2020-10-01 00:00:02.382 | 74 | 2 | 0 | - 2020-10-01 00:00:02.871 | 2020-10-01 00:00:02.871 | 74 | 2 | 0 | - 2020-10-01 00:00:03.339 | 2020-10-01 00:00:03.339 | 74 | 2 | 0 | - 2020-10-01 00:00:03.417 | 2020-10-01 00:00:03.417 | 74 | 2 | 0 | - 2020-10-01 00:00:04.035 | 2020-10-01 00:00:04.035 | 74 | 2 | 2 | - 2020-10-01 00:00:05.475 | 2020-10-01 00:00:05.475 | 74 | 2 | 2 | - 2020-10-01 00:00:05.766 | 2020-10-01 00:00:05.766 | 74 | 2 | 0 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:00.759 | -125 | 2 | 0 | - 2020-10-01 00:00:01.017 | 2020-10-01 00:00:01.017 | -125 | 2 | 0 | - 2020-10-01 00:00:01.092 | 2020-10-01 00:00:01.092 | -125 | 2 | 0 | - 2020-10-01 00:00:01.341 | 2020-10-01 00:00:01.341 | -125 | 2 | 0 | - 2020-10-01 00:00:02.211 | 2020-10-01 00:00:02.211 | -125 | 2 | 0 | - 2020-10-01 00:00:02.406 | 2020-10-01 00:00:02.406 | -125 | 2 | 0 | - 2020-10-01 00:00:04.548 | 2020-10-01 00:00:04.548 | -125 | 2 | 0 | - 2020-10-01 00:00:04.755 | 2020-10-01 00:00:04.755 | -125 | 2 | 2 | - 2020-10-01 00:00:05.037 | 2020-10-01 00:00:05.037 | -125 | 2 | 0 | - 2020-10-01 00:00:05.553 | 2020-10-01 00:00:05.553 | -125 | 2 | 0 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:01.134 | 32 | 2 | 0 | - 2020-10-01 00:00:01.563 | 2020-10-01 00:00:01.563 | 32 | 2 | 0 | - 2020-10-01 00:00:01.653 | 2020-10-01 00:00:01.653 | 32 | 2 | 0 | - 2020-10-01 00:00:02.439 | 2020-10-01 00:00:02.439 | 32 | 2 | 0 | - 2020-10-01 00:00:02.832 | 2020-10-01 00:00:02.832 | 32 | 2 | 0 | - 2020-10-01 00:00:03.138 | 2020-10-01 00:00:03.138 | 32 | 2 | 0 | - 2020-10-01 00:00:03.330 | 2020-10-01 00:00:03.330 | 32 | 2 | 2 | - 2020-10-01 00:00:03.735 | 2020-10-01 00:00:03.735 | 32 | 2 | 2 | - 2020-10-01 00:00:03.858 | 2020-10-01 00:00:03.858 | 32 | 2 | 0 | - 2020-10-01 00:00:05.115 | 2020-10-01 00:00:05.115 | 32 | 2 | 2 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:00.900 | 38 | 2 | 2 | - 2020-10-01 00:00:01.203 | 2020-10-01 00:00:01.203 | 38 | 2 | 0 | - 2020-10-01 00:00:02.166 | 2020-10-01 00:00:02.166 | 38 | 2 | 0 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:02.649 | 38 | 2 | 0 | - 2020-10-01 00:00:02.955 | 2020-10-01 00:00:02.958 | 38 | 4 | 2 | - 2020-10-01 00:00:03.006 | 2020-10-01 00:00:03.006 | 38 | 2 | 0 | - 2020-10-01 00:00:03.429 | 2020-10-01 00:00:03.429 | 38 | 2 | 0 | - 2020-10-01 00:00:05.232 | 2020-10-01 00:00:05.232 | 38 | 2 | 0 | - 2020-10-01 00:00:05.364 | 2020-10-01 00:00:05.364 | 38 | 2 | 0 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:06.447 | 38 | 2 | 0 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:01.218 | 107 | 2 | 0 | - 2020-10-01 00:00:01.386 | 2020-10-01 00:00:01.386 | 107 | 2 | 0 | - 2020-10-01 00:00:01.737 | 2020-10-01 00:00:01.737 | 107 | 2 | 0 | - 2020-10-01 00:00:04.185 | 2020-10-01 00:00:04.185 | 107 | 2 | 2 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:04.530 | 107 | 2 | 2 | - 2020-10-01 00:00:06.354 | 2020-10-01 00:00:06.354 | 107 | 2 | 0 | - 2020-10-01 00:00:07.329 | 2020-10-01 00:00:07.329 | 107 | 2 | 0 | - 2020-10-01 00:00:07.389 | 2020-10-01 00:00:07.389 | 107 | 2 | 0 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 2 | 2 | - 2020-10-01 00:00:10.842 | 2020-10-01 00:00:10.842 | 107 | 2 | 0 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:00.813 | 99 | 2 | 0 | - 2020-10-01 00:00:01.167 | 2020-10-01 00:00:01.167 | 99 | 2 | 0 | - 2020-10-01 00:00:01.365 | 2020-10-01 00:00:01.365 | 99 | 2 | 2 | - 2020-10-01 00:00:01.632 | 2020-10-01 00:00:01.632 | 99 | 2 | 0 | - 2020-10-01 00:00:01.656 | 2020-10-01 00:00:01.656 | 99 | 2 | 0 | - 2020-10-01 00:00:02.367 | 2020-10-01 00:00:02.367 | 99 | 2 | 0 | - 2020-10-01 00:00:02.514 | 2020-10-01 00:00:02.514 | 99 | 2 | 0 | - 2020-10-01 00:00:04.221 | 2020-10-01 00:00:04.227 | 99 | 4 | 0 | - 2020-10-01 00:00:04.332 | 2020-10-01 00:00:04.332 | 99 | 2 | 0 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:06.087 | 99 | 2 | 0 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:01.086 | 27 | 2 | 0 | - 2020-10-01 00:00:01.830 | 2020-10-01 00:00:01.830 | 27 | 2 | 2 | - 2020-10-01 00:00:03.174 | 2020-10-01 00:00:03.174 | 27 | 2 | 0 | - 2020-10-01 00:00:03.864 | 2020-10-01 00:00:03.864 | 27 | 2 | 0 | - 2020-10-01 00:00:05.967 | 2020-10-01 00:00:05.967 | 27 | 2 | 0 | - 2020-10-01 00:00:06.669 | 2020-10-01 00:00:06.669 | 27 | 2 | 0 | - 2020-10-01 00:00:06.822 | 2020-10-01 00:00:06.822 | 27 | 2 | 0 | - 2020-10-01 00:00:06.975 | 2020-10-01 00:00:06.975 | 27 | 2 | 2 | - 2020-10-01 00:00:07.281 | 2020-10-01 00:00:07.281 | 27 | 2 | 0 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:08.295 | 27 | 2 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:00.981 | -20 | 2 | 0 | - 2020-10-01 00:00:01.290 | 2020-10-01 00:00:01.290 | -20 | 2 | 2 | - 2020-10-01 00:00:01.770 | 2020-10-01 00:00:01.770 | -20 | 2 | 2 | - 2020-10-01 00:00:02.130 | 2020-10-01 00:00:02.130 | -20 | 2 | 2 | - 2020-10-01 00:00:02.202 | 2020-10-01 00:00:02.202 | -20 | 2 | 0 | - 2020-10-01 00:00:02.724 | 2020-10-01 00:00:02.724 | -20 | 2 | 0 | - 2020-10-01 00:00:02.847 | 2020-10-01 00:00:02.847 | -20 | 2 | 0 | - 2020-10-01 00:00:03.039 | 2020-10-01 00:00:03.039 | -20 | 2 | 0 | - 2020-10-01 00:00:03.567 | 2020-10-01 00:00:03.567 | -20 | 2 | 0 | - 2020-10-01 00:00:04.446 | 2020-10-01 00:00:04.446 | -20 | 2 | 0 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 2 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:49.995 | NULL | 10000 | 10000 | + 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 44 | 2 | 0 | + 2020-10-01 00:00:00.005 | 2020-10-01 00:00:49.995 | NULL | 16000 | 16000 | + 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.006 | -91 | 2 | 0 | + 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.009 | 25 | 2 | 0 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.012 | 70 | 2 | 0 | + 2020-10-01 00:00:00.015 | 2020-10-01 00:00:00.015 | -106 | 2 | 2 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.018 | -113 | 2 | 0 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 2 | 0 | -taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(tinyint_col) | u_tinyint_col | count(*) | ===================================================================================================================================== - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:09.234 | 81 | 120 | 131 | 4 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 107 | 32 | 1 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:05.958 | 87 | 102 | 38 | 4 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:08.502 | 71 | 114 | 107 | 12 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:13.224 | 88 | 110 | 99 | 16 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 109 | NULL | 1 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 8 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 8 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:00.726 | 67 | 122 | 92 | 3 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 22 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 22 | -taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(tinyint_col) | u_tinyint_col | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | ============================================================================================================================================================================================================= - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | 4 | 22 | 7 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | 4 | 22 | 7 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | 4 | 24 | 7 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | 4 | 24 | 7 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:09.234 | 81 | 120 | 131 | 4 | 1 | 4 | 2 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | 1 | 8 | 3 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | 1 | 8 | 3 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 107 | 32 | 1 | 1 | 1 | 1 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:05.958 | 87 | 102 | 38 | 4 | 0 | 4 | 3 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | 0 | 1 | 1 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | 0 | 1 | 1 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:08.502 | 71 | 114 | 107 | 12 | 0 | 12 | 7 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | 0 | 1 | 1 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | 0 | 1 | 1 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:13.224 | 88 | 110 | 99 | 16 | 6 | 16 | 11 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | 1 | 2 | 2 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | 1 | 2 | 2 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | 0 | 2 | 2 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | 3 | 8 | 5 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | 3 | 8 | 5 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | 4 | 32 | 16 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | 4 | 32 | 16 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 109 | NULL | 1 | 0 | 0 | 1 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 11 | 5 | 0 | 8 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 11 | 5 | 0 | 8 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | 0 | 1 | 1 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | 0 | 1 | 1 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:00.726 | 67 | 122 | 92 | 3 | 0 | 3 | 2 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | 5 | 30 | 9 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | 5 | 30 | 9 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 31 | 13 | 0 | 22 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 31 | 13 | 0 | 22 | -taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(tinyint_col) | u_tinyint_col | count(*) | count(u_int_col) | count(u_tinyint_col) | ===================================================================================================================================================================================== - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | 4 | 22 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | 4 | 22 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | 4 | 24 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | 4 | 24 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:09.234 | 81 | 120 | 131 | 4 | 1 | 4 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | 1 | 8 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | 1 | 8 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 107 | 32 | 1 | 1 | 1 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:05.958 | 87 | 102 | 38 | 4 | 0 | 4 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | 0 | 1 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | 0 | 1 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:08.502 | 71 | 114 | 107 | 12 | 0 | 12 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | 0 | 1 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | 0 | 1 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:13.224 | 88 | 110 | 99 | 16 | 6 | 16 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | 1 | 2 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | 0 | 2 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | 1 | 2 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | 0 | 2 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | 3 | 8 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | 3 | 8 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | 4 | 32 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | 4 | 32 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 109 | NULL | 1 | 0 | 0 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 11 | 5 | 0 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 11 | 5 | 0 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | 0 | 1 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | 0 | 1 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:00.726 | 67 | 122 | 92 | 3 | 0 | 3 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | 5 | 30 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | 5 | 30 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 31 | 13 | 0 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 31 | 13 | 0 | -taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(tinyint_col) | u_tinyint_col | count(*) | count(u_int_col) | ============================================================================================================================================================= - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | 4 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:13.746 | 55 | 123 | 147 | 22 | 4 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | 4 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:13.494 | 63 | 102 | 74 | 24 | 4 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:09.234 | 81 | 120 | 131 | 4 | 1 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | 1 | - 2020-10-01 00:00:10.470 | 2020-10-01 00:00:15.036 | 97 | 123 | 131 | 8 | 1 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 107 | 32 | 1 | 1 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:05.958 | 87 | 102 | 38 | 4 | 0 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | 0 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:11.784 | 120 | 120 | 38 | 1 | 0 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:08.502 | 71 | 114 | 107 | 12 | 0 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | 0 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:16.926 | 116 | 116 | 107 | 1 | 0 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:13.224 | 88 | 110 | 99 | 16 | 6 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | 1 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | 0 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:06.600 | 90 | 111 | 27 | 2 | 1 | - 2020-10-01 00:00:18.546 | 2020-10-01 00:00:19.038 | 65 | 121 | 27 | 2 | 0 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | 3 | - 2020-10-01 00:00:11.838 | 2020-10-01 00:00:17.958 | 76 | 110 | 236 | 8 | 3 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | 4 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:19.854 | 52 | 116 | 155 | 32 | 4 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.021 | 109 | 109 | NULL | 1 | 0 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 11 | 5 | + 2020-10-01 00:00:00.033 | 2020-10-01 00:00:00.075 | 89 | 102 | NULL | 11 | 5 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | 0 | + 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.054 | 126 | 126 | 205 | 1 | 0 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:00.726 | 67 | 122 | 92 | 3 | 0 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | 5 | + 2020-10-01 00:00:00.090 | 2020-10-01 00:00:15.366 | 78 | 118 | 197 | 30 | 5 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 31 | 13 | + 2020-10-01 00:00:00.111 | 2020-10-01 00:00:00.237 | 52 | 122 | NULL | 31 | 13 | -taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(smallint_col) | u_tinyint_col | count(*) | ====================================================================================================================================== - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:07.740 | 81 | 27479 | 131 | 1 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:07.670 | 90 | 26596 | 27 | 3 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:10.640 | 52 | 25550 | 155 | 17 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 32519 | 29 | 1 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.900 | 70 | 26112 | 77 | 3 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.870 | 126 | 16650 | 205 | 4 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:03.890 | 67 | 2505 | 92 | 8 | -taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(smallint_col) | u_tinyint_col | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | ============================================================================================================================================================================================================== - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | 1 | 7 | 3 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | 1 | 2 | 1 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | 2 | 8 | 3 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | 1 | 7 | 3 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | 1 | 2 | 1 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | 2 | 8 | 3 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:07.740 | 81 | 27479 | 131 | 1 | 1 | 1 | 1 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | 2 | 11 | 5 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | 2 | 11 | 5 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | 1 | 1 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | 1 | 4 | 1 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | 1 | 1 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | 1 | 4 | 1 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | 3 | 24 | 8 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | 3 | 24 | 8 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | 2 | 17 | 8 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | 2 | 7 | 2 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | 1 | 2 | 1 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | 2 | 17 | 8 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | 2 | 7 | 2 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | 1 | 2 | 1 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | 3 | 10 | 7 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | 1 | 11 | 6 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | 3 | 10 | 7 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | 1 | 11 | 6 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:07.670 | 90 | 26596 | 27 | 3 | 2 | 3 | 2 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:10.640 | 52 | 25550 | 155 | 17 | 2 | 17 | 9 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | 1 | 4 | 2 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | 1 | 4 | 2 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | 1 | 1 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | 2 | 5 | 2 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | 1 | 4 | 2 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | 1 | 4 | 2 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | 1 | 1 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | 2 | 5 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 32519 | 29 | 1 | 1 | 1 | 1 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.900 | 70 | 26112 | 77 | 3 | 1 | 3 | 3 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | 2 | 0 | 3 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | 2 | 0 | 3 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 1 | 0 | 1 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 1 | 0 | 1 | 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.870 | 126 | 16650 | 205 | 4 | 2 | 4 | 3 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | 2 | 16 | 4 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | 1 | 2 | 1 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | 2 | 16 | 4 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | 1 | 2 | 1 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | 1 | 0 | 1 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | 1 | 0 | 1 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:03.890 | 67 | 2505 | 92 | 8 | 1 | 8 | 2 | -taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(smallint_col) | u_tinyint_col | count(*) | count(u_int_col) | count(u_tinyint_col) | ====================================================================================================================================================================================== - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | 1 | 7 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | 1 | 2 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | 2 | 8 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | 1 | 7 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | 1 | 2 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | 2 | 8 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:07.740 | 81 | 27479 | 131 | 1 | 1 | 1 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | 2 | 11 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | 2 | 11 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | 1 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | 1 | 4 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | 1 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | 1 | 4 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | 3 | 24 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | 3 | 24 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | 2 | 17 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | 2 | 7 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | 1 | 2 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | 2 | 17 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | 2 | 7 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | 1 | 2 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | 3 | 10 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | 1 | 11 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | 3 | 10 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | 1 | 11 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:07.670 | 90 | 26596 | 27 | 3 | 2 | 3 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:10.640 | 52 | 25550 | 155 | 17 | 2 | 17 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | 1 | 4 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | 1 | 4 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | 1 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | 2 | 5 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | 1 | 4 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | 1 | 4 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | 1 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | 2 | 5 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 32519 | 29 | 1 | 1 | 1 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.900 | 70 | 26112 | 77 | 3 | 1 | 3 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | 2 | 0 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | 2 | 0 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 1 | 0 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 1 | 0 | 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.870 | 126 | 16650 | 205 | 4 | 2 | 4 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | 2 | 16 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | 1 | 2 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | 2 | 16 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | 1 | 2 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | 1 | 0 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | 1 | 0 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:03.890 | 67 | 2505 | 92 | 8 | 1 | 8 | -taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; +taos> select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | first(tinyint_col) | last(smallint_col) | u_tinyint_col | count(*) | count(u_int_col) | ============================================================================================================================================================== - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | 1 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | 1 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | 2 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.570 | 55 | 5639 | 147 | 7 | 1 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:10.960 | 62 | 6459 | 147 | 2 | 1 | - 2020-10-01 00:00:13.746 | 2020-10-01 00:00:15.370 | 123 | 21469 | 147 | 8 | 2 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:07.740 | 81 | 27479 | 131 | 1 | 1 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | 2 | - 2020-10-01 00:00:09.234 | 2020-10-01 00:00:17.330 | 120 | 24450 | 131 | 11 | 2 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | 1 | - 2020-10-01 00:00:07.620 | 2020-10-01 00:00:07.620 | 107 | 6511 | 32 | 1 | 1 | - 2020-10-01 00:00:10.848 | 2020-10-01 00:00:12.260 | 93 | 5151 | 32 | 4 | 1 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | 3 | - 2020-10-01 00:00:03.444 | 2020-10-01 00:00:15.340 | 87 | 11121 | 38 | 24 | 3 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | 2 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | 2 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | 1 | - 2020-10-01 00:00:02.364 | 2020-10-01 00:00:11.740 | 71 | 26950 | 107 | 17 | 2 | - 2020-10-01 00:00:16.926 | 2020-10-01 00:00:18.170 | 116 | 32395 | 107 | 7 | 2 | - 2020-10-01 00:00:19.104 | 2020-10-01 00:00:19.520 | 52 | 6720 | 107 | 2 | 1 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | 3 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | 1 | - 2020-10-01 00:00:07.812 | 2020-10-01 00:00:12.150 | 88 | 16871 | 99 | 10 | 3 | - 2020-10-01 00:00:13.224 | 2020-10-01 00:00:18.380 | 110 | 19942 | 99 | 11 | 1 | - 2020-10-01 00:00:05.994 | 2020-10-01 00:00:07.670 | 90 | 26596 | 27 | 3 | 2 | - 2020-10-01 00:00:01.698 | 2020-10-01 00:00:10.640 | 52 | 25550 | 155 | 17 | 2 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | 1 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | 1 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | 2 | - 2020-10-01 00:00:02.664 | 2020-10-01 00:00:05.480 | 80 | 24136 | 233 | 4 | 1 | - 2020-10-01 00:00:05.982 | 2020-10-01 00:00:06.660 | 60 | 4626 | 233 | 4 | 1 | - 2020-10-01 00:00:09.690 | 2020-10-01 00:00:09.690 | 61 | 21514 | 233 | 1 | 1 | - 2020-10-01 00:00:10.824 | 2020-10-01 00:00:12.670 | 114 | 29983 | 233 | 5 | 2 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 80 | 32519 | 29 | 1 | 1 | + 2020-10-01 00:00:00.012 | 2020-10-01 00:00:00.900 | 70 | 26112 | 77 | 3 | 1 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | 2 | + 2020-10-01 00:00:00.021 | 2020-10-01 00:00:00.035 | 109 | 3783 | NULL | 5 | 2 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 1 | + 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.055 | 97 | 1901 | NULL | 2 | 1 | 2020-10-01 00:00:00.054 | 2020-10-01 00:00:00.870 | 126 | 16650 | 205 | 4 | 2 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | 2 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | 1 | - 2020-10-01 00:00:01.782 | 2020-10-01 00:00:08.740 | 113 | 4121 | 205 | 16 | 2 | - 2020-10-01 00:00:13.986 | 2020-10-01 00:00:14.230 | 82 | 21682 | 205 | 2 | 1 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | 1 | + 2020-10-01 00:00:00.075 | 2020-10-01 00:00:00.075 | 102 | 3277 | NULL | 1 | 1 | + 2020-10-01 00:00:00.084 | 2020-10-01 00:00:03.890 | 67 | 2505 | 92 | 8 | 1 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col count_window(10) slimit 10 limit 10; +taos> select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1) count_window(10) order by 1,2,3 limit 10; + _wstart | _wend | count(*) | +============================================================================ + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | + +taos> select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by tinyint_col order by 1) count_window(10) order by 1,2,3 limit 10; + _wstart | _wend | count(*) | +============================================================================ + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | + +taos> select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3 limit 10; + _wstart | _wend | count(*) | +============================================================================ + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | + +taos> select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3 limit 10; + _wstart | _wend | count(*) | +============================================================================ + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | + +taos> select _wstart, _wend, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10; + _wstart | _wend | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | +==================================================================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | 3 | 7 | 6 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | 3 | 7 | 3 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | 3 | 7 | 6 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | 3 | 7 | 4 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | 3 | 7 | 5 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | 3 | 7 | 3 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | 3 | 7 | 6 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | 2 | 5 | 3 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | 1 | 6 | 6 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | 4 | 9 | 4 | + +taos> select _wstart, _wend, count(*), count(u_int_col),count(u_tinyint_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10; + _wstart | _wend | count(*) | count(u_int_col) | count(u_tinyint_col) | +============================================================================================================================ + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | 3 | 7 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | 3 | 7 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | 3 | 7 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | 3 | 7 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | 3 | 7 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | 3 | 7 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | 3 | 7 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | 2 | 5 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | 1 | 6 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | 4 | 9 | + +taos> select _wstart, _wend, count(*), count(u_int_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10; + _wstart | _wend | count(*) | count(u_int_col) | +==================================================================================================== + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.004 | 10 | 3 | + 2020-10-01 00:00:00.004 | 2020-10-01 00:00:00.008 | 10 | 3 | + 2020-10-01 00:00:00.008 | 2020-10-01 00:00:00.012 | 10 | 3 | + 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.018 | 10 | 3 | + 2020-10-01 00:00:00.018 | 2020-10-01 00:00:00.022 | 10 | 3 | + 2020-10-01 00:00:00.022 | 2020-10-01 00:00:00.026 | 10 | 3 | + 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.032 | 10 | 3 | + 2020-10-01 00:00:00.032 | 2020-10-01 00:00:00.035 | 10 | 2 | + 2020-10-01 00:00:00.035 | 2020-10-01 00:00:00.039 | 10 | 1 | + 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.045 | 10 | 4 | + +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 10 limit 10; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.232 | 2020-10-01 00:00:05.008 | 147 | 10 | - 2020-10-01 00:00:05.356 | 2020-10-01 00:00:11.266 | 147 | 10 | - 2020-10-01 00:00:11.432 | 2020-10-01 00:00:13.980 | 147 | 10 | - 2020-10-01 00:00:14.198 | 2020-10-01 00:00:18.632 | 147 | 10 | - 2020-10-01 00:00:18.774 | 2020-10-01 00:00:02.584 | 147 | 10 | - 2020-10-01 00:00:02.772 | 2020-10-01 00:00:09.930 | 147 | 10 | - 2020-10-01 00:00:10.776 | 2020-10-01 00:00:12.524 | 147 | 10 | - 2020-10-01 00:00:13.532 | 2020-10-01 00:00:15.818 | 147 | 10 | - 2020-10-01 00:00:16.082 | 2020-10-01 00:00:01.602 | 147 | 10 | - 2020-10-01 00:00:01.726 | 2020-10-01 00:00:07.086 | 147 | 10 | - 2020-10-01 00:00:00.008 | 2020-10-01 00:00:08.278 | 74 | 10 | - 2020-10-01 00:00:08.454 | 2020-10-01 00:00:11.846 | 74 | 10 | - 2020-10-01 00:00:11.882 | 2020-10-01 00:00:16.526 | 74 | 10 | - 2020-10-01 00:00:18.266 | 2020-10-01 00:00:07.958 | 74 | 10 | - 2020-10-01 00:00:08.246 | 2020-10-01 00:00:10.890 | 74 | 10 | - 2020-10-01 00:00:11.726 | 2020-10-01 00:00:16.116 | 74 | 10 | - 2020-10-01 00:00:16.214 | 2020-10-01 00:00:04.202 | 74 | 10 | - 2020-10-01 00:00:04.330 | 2020-10-01 00:00:10.626 | 74 | 10 | - 2020-10-01 00:00:10.670 | 2020-10-01 00:00:14.764 | 74 | 10 | - 2020-10-01 00:00:15.074 | 2020-10-01 00:00:19.962 | 74 | 6 | - 2020-10-01 00:00:01.558 | 2020-10-01 00:00:07.734 | 131 | 10 | - 2020-10-01 00:00:07.740 | 2020-10-01 00:00:14.128 | 131 | 10 | - 2020-10-01 00:00:14.474 | 2020-10-01 00:00:01.558 | 131 | 10 | - 2020-10-01 00:00:01.852 | 2020-10-01 00:00:07.740 | 131 | 10 | - 2020-10-01 00:00:07.982 | 2020-10-01 00:00:14.474 | 131 | 10 | - 2020-10-01 00:00:15.036 | 2020-10-01 00:00:01.852 | 131 | 10 | - 2020-10-01 00:00:02.898 | 2020-10-01 00:00:07.982 | 131 | 10 | - 2020-10-01 00:00:09.028 | 2020-10-01 00:00:15.036 | 131 | 10 | - 2020-10-01 00:00:16.806 | 2020-10-01 00:00:19.374 | 131 | 7 | - 2020-10-01 00:00:00.452 | 2020-10-01 00:00:04.760 | 32 | 10 | - 2020-10-01 00:00:05.600 | 2020-10-01 00:00:12.148 | 32 | 10 | - 2020-10-01 00:00:12.260 | 2020-10-01 00:00:18.436 | 32 | 10 | - 2020-10-01 00:00:18.888 | 2020-10-01 00:00:03.516 | 32 | 10 | - 2020-10-01 00:00:03.524 | 2020-10-01 00:00:10.848 | 32 | 10 | - 2020-10-01 00:00:12.136 | 2020-10-01 00:00:17.756 | 32 | 10 | - 2020-10-01 00:00:17.776 | 2020-10-01 00:00:02.412 | 32 | 10 | - 2020-10-01 00:00:03.210 | 2020-10-01 00:00:07.978 | 32 | 10 | - 2020-10-01 00:00:08.196 | 2020-10-01 00:00:15.242 | 32 | 10 | - 2020-10-01 00:00:16.990 | 2020-10-01 00:00:19.120 | 32 | 6 | - 2020-10-01 00:00:00.082 | 2020-10-01 00:00:03.444 | 38 | 10 | - 2020-10-01 00:00:03.654 | 2020-10-01 00:00:09.584 | 38 | 10 | - 2020-10-01 00:00:09.794 | 2020-10-01 00:00:14.410 | 38 | 10 | - 2020-10-01 00:00:14.662 | 2020-10-01 00:00:17.750 | 38 | 10 | - 2020-10-01 00:00:18.068 | 2020-10-01 00:00:00.284 | 38 | 10 | - 2020-10-01 00:00:01.700 | 2020-10-01 00:00:06.262 | 38 | 10 | - 2020-10-01 00:00:07.116 | 2020-10-01 00:00:11.436 | 38 | 10 | - 2020-10-01 00:00:11.784 | 2020-10-01 00:00:15.392 | 38 | 10 | - 2020-10-01 00:00:15.544 | 2020-10-01 00:00:18.642 | 38 | 10 | - 2020-10-01 00:00:19.068 | 2020-10-01 00:00:03.082 | 38 | 10 | - 2020-10-01 00:00:00.584 | 2020-10-01 00:00:04.496 | 107 | 10 | - 2020-10-01 00:00:06.744 | 2020-10-01 00:00:09.960 | 107 | 10 | - 2020-10-01 00:00:10.784 | 2020-10-01 00:00:17.306 | 107 | 10 | - 2020-10-01 00:00:17.338 | 2020-10-01 00:00:00.792 | 107 | 10 | - 2020-10-01 00:00:01.408 | 2020-10-01 00:00:07.266 | 107 | 10 | - 2020-10-01 00:00:07.344 | 2020-10-01 00:00:10.876 | 107 | 10 | - 2020-10-01 00:00:11.740 | 2020-10-01 00:00:17.510 | 107 | 10 | - 2020-10-01 00:00:17.742 | 2020-10-01 00:00:01.552 | 107 | 10 | - 2020-10-01 00:00:01.856 | 2020-10-01 00:00:07.446 | 107 | 10 | - 2020-10-01 00:00:08.002 | 2020-10-01 00:00:12.574 | 107 | 10 | - 2020-10-01 00:00:00.360 | 2020-10-01 00:00:06.506 | 99 | 10 | - 2020-10-01 00:00:06.666 | 2020-10-01 00:00:11.034 | 99 | 10 | - 2020-10-01 00:00:11.046 | 2020-10-01 00:00:13.224 | 99 | 10 | - 2020-10-01 00:00:14.098 | 2020-10-01 00:00:18.380 | 99 | 10 | - 2020-10-01 00:00:18.462 | 2020-10-01 00:00:03.416 | 99 | 10 | - 2020-10-01 00:00:03.784 | 2020-10-01 00:00:07.812 | 99 | 10 | - 2020-10-01 00:00:08.262 | 2020-10-01 00:00:12.270 | 99 | 10 | - 2020-10-01 00:00:12.576 | 2020-10-01 00:00:16.182 | 99 | 10 | - 2020-10-01 00:00:16.532 | 2020-10-01 00:00:19.918 | 99 | 10 | - 2020-10-01 00:00:00.360 | 2020-10-01 00:00:06.506 | 99 | 10 | - 2020-10-01 00:00:00.468 | 2020-10-01 00:00:02.478 | 27 | 10 | - 2020-10-01 00:00:03.812 | 2020-10-01 00:00:08.116 | 27 | 10 | - 2020-10-01 00:00:09.142 | 2020-10-01 00:00:14.842 | 27 | 10 | - 2020-10-01 00:00:15.454 | 2020-10-01 00:00:17.924 | 27 | 10 | - 2020-10-01 00:00:17.960 | 2020-10-01 00:00:00.990 | 27 | 10 | - 2020-10-01 00:00:01.098 | 2020-10-01 00:00:04.624 | 27 | 10 | - 2020-10-01 00:00:04.692 | 2020-10-01 00:00:11.542 | 27 | 10 | - 2020-10-01 00:00:11.764 | 2020-10-01 00:00:16.268 | 27 | 10 | - 2020-10-01 00:00:16.586 | 2020-10-01 00:00:19.992 | 27 | 10 | - 2020-10-01 00:00:00.468 | 2020-10-01 00:00:02.478 | 27 | 10 | - 2020-10-01 00:00:00.794 | 2020-10-01 00:00:06.518 | 236 | 10 | - 2020-10-01 00:00:08.436 | 2020-10-01 00:00:11.838 | 236 | 10 | - 2020-10-01 00:00:12.700 | 2020-10-01 00:00:00.794 | 236 | 10 | - 2020-10-01 00:00:01.788 | 2020-10-01 00:00:08.436 | 236 | 10 | - 2020-10-01 00:00:08.954 | 2020-10-01 00:00:12.700 | 236 | 10 | - 2020-10-01 00:00:12.730 | 2020-10-01 00:00:01.788 | 236 | 10 | - 2020-10-01 00:00:02.216 | 2020-10-01 00:00:08.954 | 236 | 10 | - 2020-10-01 00:00:09.506 | 2020-10-01 00:00:12.730 | 236 | 10 | - 2020-10-01 00:00:14.262 | 2020-10-01 00:00:18.764 | 236 | 7 | - 2020-10-01 00:00:00.244 | 2020-10-01 00:00:05.940 | 28 | 10 | - 2020-10-01 00:00:06.810 | 2020-10-01 00:00:10.728 | 28 | 10 | - 2020-10-01 00:00:10.748 | 2020-10-01 00:00:18.746 | 28 | 10 | - 2020-10-01 00:00:00.244 | 2020-10-01 00:00:05.940 | 28 | 10 | - 2020-10-01 00:00:06.810 | 2020-10-01 00:00:10.728 | 28 | 10 | - 2020-10-01 00:00:10.748 | 2020-10-01 00:00:18.746 | 28 | 10 | - 2020-10-01 00:00:00.244 | 2020-10-01 00:00:05.940 | 28 | 10 | - 2020-10-01 00:00:06.810 | 2020-10-01 00:00:10.728 | 28 | 10 | - 2020-10-01 00:00:10.748 | 2020-10-01 00:00:18.746 | 28 | 10 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 1 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 2 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 4 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 5 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 6 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 7 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 8 | 9 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 9 | 9 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 11 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 12 | 12 | -taos> select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col count_window(10) slimit 10 limit 10; - _wstart | _wend | tinyint_col | count(*) | -========================================================================================== - 2020-10-01 00:00:01.515 | 2020-10-01 00:00:09.222 | -1 | 10 | - 2020-10-01 00:00:09.396 | 2020-10-01 00:00:17.385 | -1 | 10 | - 2020-10-01 00:00:17.568 | 2020-10-01 00:00:25.878 | -1 | 10 | - 2020-10-01 00:00:25.932 | 2020-10-01 00:00:07.200 | -1 | 10 | - 2020-10-01 00:00:07.383 | 2020-10-01 00:00:14.319 | -1 | 10 | - 2020-10-01 00:00:14.652 | 2020-10-01 00:00:22.719 | -1 | 10 | - 2020-10-01 00:00:22.962 | 2020-10-01 00:00:29.937 | -1 | 8 | - 2020-10-01 00:00:00.993 | 2020-10-01 00:00:10.752 | -109 | 10 | - 2020-10-01 00:00:11.559 | 2020-10-01 00:00:16.995 | -109 | 10 | - 2020-10-01 00:00:17.157 | 2020-10-01 00:00:20.766 | -109 | 10 | - 2020-10-01 00:00:21.012 | 2020-10-01 00:00:23.424 | -109 | 10 | - 2020-10-01 00:00:23.616 | 2020-10-01 00:00:01.488 | -109 | 10 | - 2020-10-01 00:00:01.584 | 2020-10-01 00:00:12.408 | -109 | 10 | - 2020-10-01 00:00:12.786 | 2020-10-01 00:00:17.388 | -109 | 10 | - 2020-10-01 00:00:17.886 | 2020-10-01 00:00:21.495 | -109 | 10 | - 2020-10-01 00:00:22.137 | 2020-10-01 00:00:23.910 | -109 | 10 | - 2020-10-01 00:00:27.147 | 2020-10-01 00:00:29.976 | -109 | 6 | - 2020-10-01 00:00:00.561 | 2020-10-01 00:00:05.766 | 74 | 10 | - 2020-10-01 00:00:05.778 | 2020-10-01 00:00:09.543 | 74 | 10 | - 2020-10-01 00:00:10.815 | 2020-10-01 00:00:16.020 | 74 | 10 | - 2020-10-01 00:00:16.461 | 2020-10-01 00:00:24.798 | 74 | 10 | - 2020-10-01 00:00:24.918 | 2020-10-01 00:00:02.382 | 74 | 10 | - 2020-10-01 00:00:02.871 | 2020-10-01 00:00:07.428 | 74 | 10 | - 2020-10-01 00:00:07.890 | 2020-10-01 00:00:12.951 | 74 | 10 | - 2020-10-01 00:00:13.185 | 2020-10-01 00:00:20.472 | 74 | 10 | - 2020-10-01 00:00:21.150 | 2020-10-01 00:00:27.648 | 74 | 10 | - 2020-10-01 00:00:27.930 | 2020-10-01 00:00:28.944 | 74 | 2 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:05.553 | -125 | 10 | - 2020-10-01 00:00:06.423 | 2020-10-01 00:00:13.563 | -125 | 10 | - 2020-10-01 00:00:14.427 | 2020-10-01 00:00:23.880 | -125 | 10 | - 2020-10-01 00:00:24.309 | 2020-10-01 00:00:28.800 | -125 | 10 | - 2020-10-01 00:00:00.759 | 2020-10-01 00:00:05.553 | -125 | 10 | - 2020-10-01 00:00:06.423 | 2020-10-01 00:00:13.563 | -125 | 10 | - 2020-10-01 00:00:14.427 | 2020-10-01 00:00:23.880 | -125 | 10 | - 2020-10-01 00:00:24.309 | 2020-10-01 00:00:28.800 | -125 | 10 | - 2020-10-01 00:00:01.134 | 2020-10-01 00:00:05.115 | 32 | 10 | - 2020-10-01 00:00:05.346 | 2020-10-01 00:00:14.907 | 32 | 10 | - 2020-10-01 00:00:14.916 | 2020-10-01 00:00:20.646 | 32 | 10 | - 2020-10-01 00:00:20.838 | 2020-10-01 00:00:25.854 | 32 | 10 | - 2020-10-01 00:00:26.439 | 2020-10-01 00:00:02.832 | 32 | 10 | - 2020-10-01 00:00:03.138 | 2020-10-01 00:00:11.217 | 32 | 10 | - 2020-10-01 00:00:11.937 | 2020-10-01 00:00:18.294 | 32 | 10 | - 2020-10-01 00:00:18.309 | 2020-10-01 00:00:23.517 | 32 | 10 | - 2020-10-01 00:00:23.877 | 2020-10-01 00:00:28.158 | 32 | 10 | - 2020-10-01 00:00:00.900 | 2020-10-01 00:00:05.364 | 38 | 10 | - 2020-10-01 00:00:06.447 | 2020-10-01 00:00:15.972 | 38 | 10 | - 2020-10-01 00:00:16.248 | 2020-10-01 00:00:26.589 | 38 | 10 | - 2020-10-01 00:00:26.595 | 2020-10-01 00:00:02.166 | 38 | 10 | - 2020-10-01 00:00:02.649 | 2020-10-01 00:00:09.213 | 38 | 10 | - 2020-10-01 00:00:09.507 | 2020-10-01 00:00:16.866 | 38 | 10 | - 2020-10-01 00:00:21.543 | 2020-10-01 00:00:27.351 | 38 | 10 | - 2020-10-01 00:00:27.564 | 2020-10-01 00:00:28.884 | 38 | 4 | - 2020-10-01 00:00:01.218 | 2020-10-01 00:00:10.842 | 107 | 10 | - 2020-10-01 00:00:10.941 | 2020-10-01 00:00:15.390 | 107 | 10 | - 2020-10-01 00:00:15.891 | 2020-10-01 00:00:19.365 | 107 | 10 | - 2020-10-01 00:00:19.428 | 2020-10-01 00:00:04.185 | 107 | 10 | - 2020-10-01 00:00:04.530 | 2020-10-01 00:00:11.949 | 107 | 10 | - 2020-10-01 00:00:13.164 | 2020-10-01 00:00:17.046 | 107 | 10 | - 2020-10-01 00:00:17.262 | 2020-10-01 00:00:24.276 | 107 | 10 | - 2020-10-01 00:00:27.105 | 2020-10-01 00:00:27.963 | 107 | 2 | - 2020-10-01 00:00:00.813 | 2020-10-01 00:00:04.332 | 99 | 10 | - 2020-10-01 00:00:06.087 | 2020-10-01 00:00:14.040 | 99 | 10 | - 2020-10-01 00:00:15.882 | 2020-10-01 00:00:24.264 | 99 | 10 | - 2020-10-01 00:00:24.747 | 2020-10-01 00:00:01.167 | 99 | 10 | - 2020-10-01 00:00:01.365 | 2020-10-01 00:00:07.041 | 99 | 10 | - 2020-10-01 00:00:07.842 | 2020-10-01 00:00:16.182 | 99 | 10 | - 2020-10-01 00:00:16.644 | 2020-10-01 00:00:24.840 | 99 | 10 | - 2020-10-01 00:00:25.326 | 2020-10-01 00:00:29.445 | 99 | 6 | - 2020-10-01 00:00:01.086 | 2020-10-01 00:00:08.295 | 27 | 10 | - 2020-10-01 00:00:09.852 | 2020-10-01 00:00:16.335 | 27 | 10 | - 2020-10-01 00:00:21.465 | 2020-10-01 00:00:28.923 | 27 | 10 | - 2020-10-01 00:00:29.742 | 2020-10-01 00:00:07.281 | 27 | 10 | - 2020-10-01 00:00:08.295 | 2020-10-01 00:00:13.158 | 27 | 10 | - 2020-10-01 00:00:16.335 | 2020-10-01 00:00:28.140 | 27 | 10 | - 2020-10-01 00:00:28.923 | 2020-10-01 00:00:29.742 | 27 | 2 | - 2020-10-01 00:00:00.981 | 2020-10-01 00:00:04.446 | -20 | 10 | - 2020-10-01 00:00:06.093 | 2020-10-01 00:00:15.672 | -20 | 10 | - 2020-10-01 00:00:16.764 | 2020-10-01 00:00:21.795 | -20 | 10 | - 2020-10-01 00:00:22.455 | 2020-10-01 00:00:01.290 | -20 | 10 | - 2020-10-01 00:00:01.770 | 2020-10-01 00:00:06.252 | -20 | 10 | - 2020-10-01 00:00:06.939 | 2020-10-01 00:00:17.430 | -20 | 10 | - 2020-10-01 00:00:18.966 | 2020-10-01 00:00:22.809 | -20 | 10 | - 2020-10-01 00:00:24.147 | 2020-10-01 00:00:29.979 | -20 | 6 | - -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; - _wstart | _wend | bool_col | count(*) | -======================================================================================= - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.042 | true | 10 | - 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.096 | true | 10 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.153 | true | 10 | - 2020-10-01 00:00:00.156 | 2020-10-01 00:00:00.231 | true | 10 | - 2020-10-01 00:00:00.234 | 2020-10-01 00:00:00.285 | true | 10 | - 2020-10-01 00:00:00.288 | 2020-10-01 00:00:00.342 | true | 10 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.405 | true | 10 | - 2020-10-01 00:00:00.408 | 2020-10-01 00:00:00.459 | true | 10 | - 2020-10-01 00:00:00.465 | 2020-10-01 00:00:00.522 | true | 10 | - 2020-10-01 00:00:00.537 | 2020-10-01 00:00:00.606 | true | 10 | - 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.066 | false | 10 | - 2020-10-01 00:00:00.072 | 2020-10-01 00:00:00.129 | false | 10 | - 2020-10-01 00:00:00.135 | 2020-10-01 00:00:00.201 | false | 10 | - 2020-10-01 00:00:00.204 | 2020-10-01 00:00:00.246 | false | 10 | - 2020-10-01 00:00:00.249 | 2020-10-01 00:00:00.318 | false | 10 | - 2020-10-01 00:00:00.324 | 2020-10-01 00:00:00.363 | false | 10 | - 2020-10-01 00:00:00.375 | 2020-10-01 00:00:00.432 | false | 10 | - 2020-10-01 00:00:00.435 | 2020-10-01 00:00:00.489 | false | 10 | - 2020-10-01 00:00:00.492 | 2020-10-01 00:00:00.543 | false | 10 | - 2020-10-01 00:00:00.546 | 2020-10-01 00:00:00.588 | false | 10 | - -taos> select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; - _wstart | _wend | bool_col | count(*) | -======================================================================================= - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.042 | true | 10 | - 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.096 | true | 10 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.153 | true | 10 | - 2020-10-01 00:00:00.156 | 2020-10-01 00:00:00.231 | true | 10 | - 2020-10-01 00:00:00.234 | 2020-10-01 00:00:00.285 | true | 10 | - 2020-10-01 00:00:00.288 | 2020-10-01 00:00:00.342 | true | 10 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.405 | true | 10 | - 2020-10-01 00:00:00.408 | 2020-10-01 00:00:00.459 | true | 10 | - 2020-10-01 00:00:00.465 | 2020-10-01 00:00:00.522 | true | 10 | - 2020-10-01 00:00:00.537 | 2020-10-01 00:00:00.606 | true | 10 | - 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.066 | false | 10 | - 2020-10-01 00:00:00.072 | 2020-10-01 00:00:00.129 | false | 10 | - 2020-10-01 00:00:00.135 | 2020-10-01 00:00:00.201 | false | 10 | - 2020-10-01 00:00:00.204 | 2020-10-01 00:00:00.246 | false | 10 | - 2020-10-01 00:00:00.249 | 2020-10-01 00:00:00.318 | false | 10 | - 2020-10-01 00:00:00.324 | 2020-10-01 00:00:00.363 | false | 10 | - 2020-10-01 00:00:00.375 | 2020-10-01 00:00:00.432 | false | 10 | - 2020-10-01 00:00:00.435 | 2020-10-01 00:00:00.489 | false | 10 | - 2020-10-01 00:00:00.492 | 2020-10-01 00:00:00.543 | false | 10 | - 2020-10-01 00:00:00.546 | 2020-10-01 00:00:00.588 | false | 10 | - -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; - _wstart | _wend | bool_col | count(*) | count(u_int_col) | count(u_tinyint_col) | count(u_smallint_col) | -=============================================================================================================================================================== - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.042 | true | 10 | 3 | 6 | 10 | - 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.096 | true | 10 | 1 | 4 | 10 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.153 | true | 10 | 2 | 6 | 10 | - 2020-10-01 00:00:00.156 | 2020-10-01 00:00:00.231 | true | 10 | 1 | 4 | 10 | - 2020-10-01 00:00:00.234 | 2020-10-01 00:00:00.285 | true | 10 | 3 | 6 | 10 | - 2020-10-01 00:00:00.288 | 2020-10-01 00:00:00.342 | true | 10 | 1 | 6 | 10 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.405 | true | 10 | 3 | 7 | 10 | - 2020-10-01 00:00:00.408 | 2020-10-01 00:00:00.459 | true | 10 | 1 | 5 | 10 | - 2020-10-01 00:00:00.465 | 2020-10-01 00:00:00.522 | true | 10 | 1 | 4 | 10 | - 2020-10-01 00:00:00.537 | 2020-10-01 00:00:00.606 | true | 10 | 2 | 6 | 10 | - 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.066 | false | 10 | 2 | 5 | 10 | - 2020-10-01 00:00:00.072 | 2020-10-01 00:00:00.129 | false | 10 | 2 | 5 | 10 | - 2020-10-01 00:00:00.135 | 2020-10-01 00:00:00.201 | false | 10 | 3 | 5 | 10 | - 2020-10-01 00:00:00.204 | 2020-10-01 00:00:00.246 | false | 10 | 2 | 5 | 10 | - 2020-10-01 00:00:00.249 | 2020-10-01 00:00:00.318 | false | 10 | 2 | 4 | 10 | - 2020-10-01 00:00:00.324 | 2020-10-01 00:00:00.363 | false | 10 | 2 | 3 | 10 | - 2020-10-01 00:00:00.375 | 2020-10-01 00:00:00.432 | false | 10 | 1 | 4 | 10 | - 2020-10-01 00:00:00.435 | 2020-10-01 00:00:00.489 | false | 10 | 3 | 6 | 10 | - 2020-10-01 00:00:00.492 | 2020-10-01 00:00:00.543 | false | 10 | 3 | 5 | 10 | - 2020-10-01 00:00:00.546 | 2020-10-01 00:00:00.588 | false | 10 | 3 | 6 | 10 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.012 | NULL | 10 | 3 | 7 | 5 | - 2020-10-01 00:00:00.014 | 2020-10-01 00:00:00.026 | NULL | 10 | 3 | 7 | 4 | - 2020-10-01 00:00:00.027 | 2020-10-01 00:00:00.039 | NULL | 10 | 2 | 6 | 5 | - 2020-10-01 00:00:00.040 | 2020-10-01 00:00:00.054 | NULL | 10 | 3 | 8 | 5 | - 2020-10-01 00:00:00.055 | 2020-10-01 00:00:00.066 | NULL | 10 | 3 | 6 | 4 | - 2020-10-01 00:00:00.068 | 2020-10-01 00:00:00.081 | NULL | 10 | 3 | 7 | 5 | - 2020-10-01 00:00:00.082 | 2020-10-01 00:00:00.094 | NULL | 10 | 2 | 7 | 4 | - 2020-10-01 00:00:00.095 | 2020-10-01 00:00:00.108 | NULL | 10 | 3 | 7 | 5 | - 2020-10-01 00:00:00.110 | 2020-10-01 00:00:00.122 | NULL | 10 | 3 | 7 | 4 | - 2020-10-01 00:00:00.123 | 2020-10-01 00:00:00.135 | NULL | 10 | 3 | 6 | 5 | - -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; - _wstart | _wend | bool_col | count(*) | count(u_int_col) | count(u_tinyint_col) | -======================================================================================================================================= - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.042 | true | 10 | 3 | 6 | - 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.096 | true | 10 | 1 | 4 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.153 | true | 10 | 2 | 6 | - 2020-10-01 00:00:00.156 | 2020-10-01 00:00:00.231 | true | 10 | 1 | 4 | - 2020-10-01 00:00:00.234 | 2020-10-01 00:00:00.285 | true | 10 | 3 | 6 | - 2020-10-01 00:00:00.288 | 2020-10-01 00:00:00.342 | true | 10 | 1 | 6 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.405 | true | 10 | 3 | 7 | - 2020-10-01 00:00:00.408 | 2020-10-01 00:00:00.459 | true | 10 | 1 | 5 | - 2020-10-01 00:00:00.465 | 2020-10-01 00:00:00.522 | true | 10 | 1 | 4 | - 2020-10-01 00:00:00.537 | 2020-10-01 00:00:00.606 | true | 10 | 2 | 6 | - 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.066 | false | 10 | 2 | 5 | - 2020-10-01 00:00:00.072 | 2020-10-01 00:00:00.129 | false | 10 | 2 | 5 | - 2020-10-01 00:00:00.135 | 2020-10-01 00:00:00.201 | false | 10 | 3 | 5 | - 2020-10-01 00:00:00.204 | 2020-10-01 00:00:00.246 | false | 10 | 2 | 5 | - 2020-10-01 00:00:00.249 | 2020-10-01 00:00:00.318 | false | 10 | 2 | 4 | - 2020-10-01 00:00:00.324 | 2020-10-01 00:00:00.363 | false | 10 | 2 | 3 | - 2020-10-01 00:00:00.375 | 2020-10-01 00:00:00.432 | false | 10 | 1 | 4 | - 2020-10-01 00:00:00.435 | 2020-10-01 00:00:00.489 | false | 10 | 3 | 6 | - 2020-10-01 00:00:00.492 | 2020-10-01 00:00:00.543 | false | 10 | 3 | 5 | - 2020-10-01 00:00:00.546 | 2020-10-01 00:00:00.588 | false | 10 | 3 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.015 | NULL | 10 | 4 | 8 | - 2020-10-01 00:00:00.016 | 2020-10-01 00:00:00.032 | NULL | 10 | 3 | 9 | - 2020-10-01 00:00:00.034 | 2020-10-01 00:00:00.048 | NULL | 10 | 3 | 8 | - 2020-10-01 00:00:00.050 | 2020-10-01 00:00:00.065 | NULL | 10 | 4 | 8 | - 2020-10-01 00:00:00.066 | 2020-10-01 00:00:00.082 | NULL | 10 | 3 | 9 | - 2020-10-01 00:00:00.084 | 2020-10-01 00:00:00.098 | NULL | 10 | 3 | 8 | - 2020-10-01 00:00:00.100 | 2020-10-01 00:00:00.115 | NULL | 10 | 4 | 8 | - 2020-10-01 00:00:00.116 | 2020-10-01 00:00:00.132 | NULL | 10 | 3 | 9 | - 2020-10-01 00:00:00.134 | 2020-10-01 00:00:00.148 | NULL | 10 | 3 | 8 | - 2020-10-01 00:00:00.150 | 2020-10-01 00:00:00.165 | NULL | 10 | 4 | 8 | - -taos> select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; - _wstart | _wend | bool_col | count(*) | count(u_int_col) | -=============================================================================================================== - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.042 | true | 10 | 3 | - 2020-10-01 00:00:00.051 | 2020-10-01 00:00:00.096 | true | 10 | 1 | - 2020-10-01 00:00:00.108 | 2020-10-01 00:00:00.153 | true | 10 | 2 | - 2020-10-01 00:00:00.156 | 2020-10-01 00:00:00.231 | true | 10 | 1 | - 2020-10-01 00:00:00.234 | 2020-10-01 00:00:00.285 | true | 10 | 3 | - 2020-10-01 00:00:00.288 | 2020-10-01 00:00:00.342 | true | 10 | 1 | - 2020-10-01 00:00:00.348 | 2020-10-01 00:00:00.405 | true | 10 | 3 | - 2020-10-01 00:00:00.408 | 2020-10-01 00:00:00.459 | true | 10 | 1 | - 2020-10-01 00:00:00.465 | 2020-10-01 00:00:00.522 | true | 10 | 1 | - 2020-10-01 00:00:00.537 | 2020-10-01 00:00:00.606 | true | 10 | 2 | - 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.066 | false | 10 | 2 | - 2020-10-01 00:00:00.072 | 2020-10-01 00:00:00.129 | false | 10 | 2 | - 2020-10-01 00:00:00.135 | 2020-10-01 00:00:00.201 | false | 10 | 3 | - 2020-10-01 00:00:00.204 | 2020-10-01 00:00:00.246 | false | 10 | 2 | - 2020-10-01 00:00:00.249 | 2020-10-01 00:00:00.318 | false | 10 | 2 | - 2020-10-01 00:00:00.324 | 2020-10-01 00:00:00.363 | false | 10 | 2 | - 2020-10-01 00:00:00.375 | 2020-10-01 00:00:00.432 | false | 10 | 1 | - 2020-10-01 00:00:00.435 | 2020-10-01 00:00:00.489 | false | 10 | 3 | - 2020-10-01 00:00:00.492 | 2020-10-01 00:00:00.543 | false | 10 | 3 | - 2020-10-01 00:00:00.546 | 2020-10-01 00:00:00.588 | false | 10 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.045 | NULL | 10 | 10 | - 2020-10-01 00:00:00.050 | 2020-10-01 00:00:00.095 | NULL | 10 | 10 | - 2020-10-01 00:00:00.100 | 2020-10-01 00:00:00.145 | NULL | 10 | 10 | - 2020-10-01 00:00:00.150 | 2020-10-01 00:00:00.195 | NULL | 10 | 10 | - 2020-10-01 00:00:00.200 | 2020-10-01 00:00:00.245 | NULL | 10 | 10 | - 2020-10-01 00:00:00.250 | 2020-10-01 00:00:00.295 | NULL | 10 | 10 | - 2020-10-01 00:00:00.300 | 2020-10-01 00:00:00.345 | NULL | 10 | 10 | - 2020-10-01 00:00:00.350 | 2020-10-01 00:00:00.395 | NULL | 10 | 10 | - 2020-10-01 00:00:00.400 | 2020-10-01 00:00:00.445 | NULL | 10 | 10 | - 2020-10-01 00:00:00.450 | 2020-10-01 00:00:00.495 | NULL | 10 | 10 | - -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 10 limit 10; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 2 limit 10; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 147 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 147 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 147 | 12 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 147 | 6 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 147 | 6 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 147 | 3 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 147 | 12 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 147 | 9 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 147 | 12 | - 2020-10-01 00:00:12.000 | 2020-10-01 00:00:13.000 | 147 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 74 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 74 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 74 | 9 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 74 | 3 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 74 | 9 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 74 | 21 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 74 | 9 | - 2020-10-01 00:00:12.000 | 2020-10-01 00:00:13.000 | 74 | 6 | - 2020-10-01 00:00:13.000 | 2020-10-01 00:00:14.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 131 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 131 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 131 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 131 | 9 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 131 | 3 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 131 | 12 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 131 | 6 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 131 | 6 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 131 | 6 | - 2020-10-01 00:00:12.000 | 2020-10-01 00:00:13.000 | 131 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 32 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 32 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 32 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 32 | 9 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 32 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 32 | 6 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 32 | 6 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 32 | 6 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 32 | 3 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 32 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 38 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 38 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 38 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 38 | 12 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 38 | 6 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 38 | 3 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 38 | 12 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 38 | 9 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 38 | 6 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 38 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 107 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 107 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 107 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 107 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 107 | 3 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 107 | 3 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 107 | 9 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 107 | 15 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 107 | 3 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 107 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 99 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 99 | 9 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 99 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 99 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 99 | 3 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 99 | 12 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 99 | 9 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 99 | 9 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 99 | 3 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 99 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 27 | 15 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 27 | 12 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 27 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 27 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 27 | 12 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 27 | 3 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 27 | 3 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 27 | 3 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 27 | 3 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 27 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 236 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 236 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 236 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 236 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 236 | 6 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 236 | 3 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 236 | 6 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 236 | 6 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 236 | 6 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 236 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 28 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 28 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 28 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 28 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 28 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 28 | 6 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 28 | 3 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 28 | 6 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 28 | 6 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 28 | 9 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 1 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 2 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 4 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 5 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 6 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 7 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 8 | 9 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 9 | 9 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 11 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 12 | 12 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 2 limit 10; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 2 limit 5; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 147 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 147 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 147 | 12 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 147 | 6 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 147 | 6 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 147 | 3 | - 2020-10-01 00:00:09.000 | 2020-10-01 00:00:10.000 | 147 | 12 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 147 | 9 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 147 | 12 | - 2020-10-01 00:00:12.000 | 2020-10-01 00:00:13.000 | 147 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 74 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 74 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 74 | 9 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 74 | 3 | - 2020-10-01 00:00:08.000 | 2020-10-01 00:00:09.000 | 74 | 9 | - 2020-10-01 00:00:10.000 | 2020-10-01 00:00:11.000 | 74 | 21 | - 2020-10-01 00:00:11.000 | 2020-10-01 00:00:12.000 | 74 | 9 | - 2020-10-01 00:00:12.000 | 2020-10-01 00:00:13.000 | 74 | 6 | - 2020-10-01 00:00:13.000 | 2020-10-01 00:00:14.000 | 74 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 1 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 2 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 4 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 5 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 6 | 6 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 2 limit 5; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 20 limit 2; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 147 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 147 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 147 | 12 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 147 | 6 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 147 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 74 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 74 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 74 | 9 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 74 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 1 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 2 | 12 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 20 limit 2; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 20 limit 5; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 147 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 147 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 74 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 131 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 131 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 32 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 32 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 38 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 38 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 107 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 107 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 99 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 99 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 27 | 15 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 27 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 236 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 236 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 28 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 28 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 155 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 155 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 233 | 15 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 233 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 205 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 205 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 57 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 57 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 181 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 181 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 34 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 34 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 176 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 176 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 204 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 204 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 247 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 247 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 22 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 22 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 1 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 2 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 4 | 3 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 5 | 12 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 6 | 6 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 20 limit 5; +taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 10 limit 2; _wstart | _wend | u_tinyint_col | count(*) | ============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 147 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 147 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 147 | 12 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 147 | 6 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 147 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 74 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 74 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 74 | 9 | - 2020-10-01 00:00:07.000 | 2020-10-01 00:00:08.000 | 74 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 131 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 131 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 131 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 131 | 9 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 131 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 32 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 32 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 32 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 32 | 9 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 32 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 38 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 38 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 38 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 38 | 12 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 38 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 107 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 107 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 107 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 107 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 107 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 99 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 99 | 9 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 99 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 99 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 99 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 27 | 15 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 27 | 12 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 27 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 27 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 27 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 236 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 236 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 236 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 236 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 236 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 28 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 28 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 28 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 28 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 28 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 155 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 155 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 155 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 155 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 155 | 15 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 233 | 15 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 233 | 12 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 233 | 3 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 233 | 9 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 233 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 205 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 205 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 205 | 15 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 205 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 205 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 57 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 57 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 57 | 6 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 57 | 9 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 57 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 181 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 181 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 181 | 18 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 181 | 6 | - 2020-10-01 00:00:05.000 | 2020-10-01 00:00:06.000 | 181 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 34 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 34 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 34 | 15 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 34 | 12 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 34 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 176 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 176 | 9 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 176 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 176 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 176 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 204 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 204 | 12 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 204 | 9 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 204 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 204 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 247 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 247 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 247 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 247 | 3 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 247 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 22 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 22 | 3 | - 2020-10-01 00:00:03.000 | 2020-10-01 00:00:04.000 | 22 | 6 | - 2020-10-01 00:00:04.000 | 2020-10-01 00:00:05.000 | 22 | 15 | - 2020-10-01 00:00:06.000 | 2020-10-01 00:00:07.000 | 22 | 9 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 1 | 6 | + 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 2 | 12 | -taos> select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 10 limit 2; - _wstart | _wend | u_tinyint_col | count(*) | -============================================================================================ - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 147 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 147 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 74 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 74 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 131 | 6 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 131 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 32 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 32 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 38 | 12 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 38 | 6 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 107 | 6 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 107 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 99 | 3 | - 2020-10-01 00:00:02.000 | 2020-10-01 00:00:03.000 | 99 | 9 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 27 | 15 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 27 | 12 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 236 | 3 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 236 | 3 | - 2020-10-01 00:00:00.000 | 2020-10-01 00:00:01.000 | 28 | 9 | - 2020-10-01 00:00:01.000 | 2020-10-01 00:00:02.000 | 28 | 3 | - -taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; count(*) | ======================== 23333 | 23333 | 23333 | -taos> select int_tag from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +taos> select int_tag from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; int_tag | ============== - 3 | - 3 | - 3 | - 3 | - 3 | - 3 | - 3 | - 3 | - 3 | - 3 | 0 | 0 | 0 | @@ -2753,92 +784,52 @@ taos> select int_tag from test_vtable_select.vtb_virtual_stb partition by int_ta 0 | 0 | 0 | - 1 | - 1 | - 1 | - 1 | - 1 | - 1 | - 1 | - 1 | - 1 | - 1 | -taos> select int_tag, count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +taos> select int_tag, count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; int_tag | count(*) | ====================================== - 1 | 23333 | 0 | 23333 | + 1 | 23333 | 3 | 23333 | -taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; avg(u_int_col) | ============================ 1064174999.6801 | 1064174999.6801 | 1064174999.6801 | -taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; avg(u_tinyint_col) | avg(u_smallint_col) | avg(u_int_col) | avg(u_bigint_col) | avg(tinyint_col) | avg(smallint_col) | avg(int_col) | avg(bigint_col) | avg(float_col) | avg(double_col) | ======================================================================================================================================================================================================================================================================================== + 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | + 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | 127.1223 | 33072.8972 | 1064174999.6801 | NULL | NULL | NULL | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | NULL | - 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | - 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | -taos> select * from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +taos> select * from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1, 2, int_tag slimit 10 limit 10; ts | u_tinyint_col | u_smallint_col | u_int_col | u_bigint_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | bool_col | binary_16_col | binary_32_col | nchar_16_col | nchar_32_col | int_tag | bool_tag | float_tag | double_tag | nchar_32_tag | binary_32_tag | ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== - 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.005 | NULL | NULL | 1273134528 | NULL | NULL | -2199 | NULL | NULL | -31883.6 | NULL | NULL | Santa Clara | NULL | NULL | 森尼韦尔 - Sunnyvale | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | 654411 | -91 | NULL | -140653792 | -9223372036854775808 | NULL | 4540042.841226 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | 1158746468 | NULL | NULL | -439167365 | NULL | NULL | -16761361.20062 | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.009 | NULL | 4884 | NULL | NULL | 25 | NULL | NULL | -9223372036854775808 | NULL | NULL | true | NULL | NULL | 八。Sunnyvale | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.010 | 11 | NULL | 675749918 | 643987270 | NULL | 18263 | 296030311 | NULL | 70852.8 | -29472170.793985 | NULL | Los Angles | Harbin - Campbell | NULL | 山景城 - Mountain View | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.012 | 77 | 36105 | NULL | 1318736917 | 70 | NULL | -944313433 | -9223372036854775808 | NULL | 18127464.490065 | false | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 3 | false | 3 | 3 | child3 | child3 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.005 | NULL | NULL | 1273134528 | NULL | NULL | -2199 | NULL | NULL | -31883.6 | NULL | NULL | Santa Clara | NULL | NULL | 森尼韦尔 - Sunnyvale | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | 654411 | -91 | NULL | -140653792 | -9223372036854775808 | NULL | 4540042.841226 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | 1158746468 | NULL | NULL | -439167365 | NULL | NULL | -16761361.20062 | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.009 | NULL | 4884 | NULL | NULL | 25 | NULL | NULL | -9223372036854775808 | NULL | NULL | true | NULL | NULL | 八。Sunnyvale | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.010 | 11 | NULL | 675749918 | 643987270 | NULL | 18263 | 296030311 | NULL | 70852.8 | -29472170.793985 | NULL | Los Angles | Harbin - Campbell | NULL | 山景城 - Mountain View | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.012 | 77 | 36105 | NULL | 1318736917 | 70 | NULL | -944313433 | -9223372036854775808 | NULL | 18127464.490065 | false | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 0 | false | 0 | 0 | child0 | child0 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | 2020-10-01 00:00:00.002 | 158 | NULL | NULL | NULL | NULL | NULL | -77824226 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.004 | 1 | NULL | NULL | NULL | NULL | NULL | 683409189 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.005 | NULL | NULL | 1273134528 | NULL | NULL | NULL | NULL | NULL | -31883.6 | NULL | NULL | NULL | NULL | NULL | 森尼韦尔 - Sunnyvale | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | NULL | NULL | NULL | -140653792 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | NULL | NULL | NULL | -439167365 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.009 | NULL | 4884 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.010 | 11 | NULL | 675749918 | NULL | NULL | NULL | 296030311 | NULL | 70852.8 | NULL | NULL | NULL | Harbin - Campbell | NULL | 山景城 - Mountain View | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.012 | 77 | 36105 | NULL | NULL | NULL | NULL | -944313433 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | -taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; +taos> select count(*) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; count(*) | ======================== 23333 | 23333 | 23333 | -taos> select tbname from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; +taos> select tbname from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; tbname | ================================= - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | - vtb_virtual_ctb_half_full | vtb_virtual_ctb_full | vtb_virtual_ctb_full | vtb_virtual_ctb_full | @@ -2849,69 +840,39 @@ taos> select tbname from test_vtable_select.vtb_virtual_stb partition by tbname vtb_virtual_ctb_full | vtb_virtual_ctb_full | vtb_virtual_ctb_full | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | - vtb_virtual_ctb_mix | -taos> select tbname, count(*) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; +taos> select tbname, count(*) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; tbname | count(*) | ========================================================= + vtb_virtual_ctb_full | 23333 | vtb_virtual_ctb_half_full | 23333 | vtb_virtual_ctb_mix | 23333 | - vtb_virtual_ctb_full | 23333 | -taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; +taos> select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; avg(u_int_col) | ============================ 1064174999.6801 | 1064174999.6801 | 1064174999.6801 | -taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; +taos> select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; avg(u_tinyint_col) | avg(u_smallint_col) | avg(u_int_col) | avg(u_bigint_col) | avg(tinyint_col) | avg(smallint_col) | avg(int_col) | avg(bigint_col) | avg(float_col) | avg(double_col) | ======================================================================================================================================================================================================================================================================================== + 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | + 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | 127.1223 | 33072.8972 | 1064174999.6801 | NULL | NULL | NULL | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | NULL | - 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | - 127.1223 | 33072.8972 | 1064174999.6801 | 1070761472.7482 | -0.1846 | 169.9224 | -146132.5514 | -9.22337203685478e+18 | 17.6425190647364 | -1822137.86790735 | -taos> select * from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10 +taos> select * from test_vtable_select.vtb_virtual_stb partition by tbname order by 1, 2, int_tag slimit 10 limit 10 ts | u_tinyint_col | u_smallint_col | u_int_col | u_bigint_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | bool_col | binary_16_col | binary_32_col | nchar_16_col | nchar_32_col | int_tag | bool_tag | float_tag | double_tag | nchar_32_tag | binary_32_tag | ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== - 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.002 | 158 | NULL | NULL | NULL | NULL | NULL | -77824226 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.004 | 1 | NULL | NULL | NULL | NULL | NULL | 683409189 | NULL | NULL | NULL | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.005 | NULL | NULL | 1273134528 | NULL | NULL | NULL | NULL | NULL | -31883.6 | NULL | NULL | NULL | NULL | NULL | 森尼韦尔 - Sunnyvale | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | NULL | NULL | NULL | -140653792 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | NULL | NULL | NULL | -439167365 | NULL | NULL | NULL | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.009 | NULL | 4884 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 八。Sunnyvale | NULL | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.010 | 11 | NULL | 675749918 | NULL | NULL | NULL | 296030311 | NULL | 70852.8 | NULL | NULL | NULL | Harbin - Campbell | NULL | 山景城 - Mountain View | 1 | false | 1 | 1 | child1 | child1 | - 2020-10-01 00:00:00.012 | 77 | 36105 | NULL | NULL | NULL | NULL | -944313433 | -9223372036854775808 | NULL | NULL | NULL | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 1 | false | 1 | 1 | child1 | child1 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.005 | NULL | NULL | 1273134528 | NULL | NULL | -2199 | NULL | NULL | -31883.6 | NULL | NULL | Santa Clara | NULL | NULL | 森尼韦尔 - Sunnyvale | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | 654411 | -91 | NULL | -140653792 | -9223372036854775808 | NULL | 4540042.841226 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | 1158746468 | NULL | NULL | -439167365 | NULL | NULL | -16761361.20062 | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.009 | NULL | 4884 | NULL | NULL | 25 | NULL | NULL | -9223372036854775808 | NULL | NULL | true | NULL | NULL | 八。Sunnyvale | NULL | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.010 | 11 | NULL | 675749918 | 643987270 | NULL | 18263 | 296030311 | NULL | 70852.8 | -29472170.793985 | NULL | Los Angles | Harbin - Campbell | NULL | 山景城 - Mountain View | 0 | false | 0 | 0 | child0 | child0 | - 2020-10-01 00:00:00.012 | 77 | 36105 | NULL | 1318736917 | 70 | NULL | -944313433 | -9223372036854775808 | NULL | 18127464.490065 | false | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | false | 1 | 1 | child1 | child1 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.002 | 158 | NULL | NULL | NULL | NULL | NULL | -77824226 | NULL | NULL | NULL | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 1 | false | 1 | 1 | child1 | child1 | 2020-10-01 00:00:00.002 | 158 | NULL | NULL | 722563855 | NULL | NULL | -77824226 | NULL | NULL | 34582987.167108 | NULL | NULL | Xian - Sunnyvale | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 0 | false | 0 | 0 | child0 | child0 | + 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | NULL | NULL | NULL | -9223372036854775808 | NULL | NULL | NULL | NULL | NULL | 三。San Diego | NULL | 1 | false | 1 | 1 | child1 | child1 | 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.005 | NULL | NULL | 1273134528 | NULL | NULL | -2199 | NULL | NULL | -31883.6 | NULL | NULL | Santa Clara | NULL | NULL | 森尼韦尔 - Sunnyvale | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | 654411 | -91 | NULL | -140653792 | -9223372036854775808 | NULL | 4540042.841226 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.008 | 74 | NULL | NULL | 1158746468 | NULL | NULL | -439167365 | NULL | NULL | -16761361.20062 | NULL | NULL | Shanghai - Los Angles | NULL | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.009 | NULL | 4884 | NULL | NULL | 25 | NULL | NULL | -9223372036854775808 | NULL | NULL | true | NULL | NULL | 八。Sunnyvale | NULL | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.010 | 11 | NULL | 675749918 | 643987270 | NULL | 18263 | 296030311 | NULL | 70852.8 | -29472170.793985 | NULL | Los Angles | Harbin - Campbell | NULL | 山景城 - Mountain View | 3 | false | 3 | 3 | child3 | child3 | - 2020-10-01 00:00:00.012 | 77 | 36105 | NULL | 1318736917 | 70 | NULL | -944313433 | -9223372036854775808 | NULL | 18127464.490065 | false | NULL | Shanghai - Los Angles | 七。Mountain | NULL | 3 | false | 3 | 3 | child3 | child3 | + 2020-10-01 00:00:00.004 | 1 | NULL | NULL | 514811543 | NULL | NULL | 683409189 | NULL | NULL | 94762575.40613 | NULL | NULL | Taiyuan - Santa Clara | NULL | NULL | 0 | false | 0 | 0 | child0 | child0 | diff --git a/tests/army/vtable/ans/test_vstable_select_test_state.ans b/tests/army/vtable/ans/test_vstable_select_test_state.ans index 5a7b95e51b..b68e4158c4 100644 --- a/tests/army/vtable/ans/test_vstable_select_test_state.ans +++ b/tests/army/vtable/ans/test_vstable_select_test_state.ans @@ -2,7 +2,6 @@ taos> select _wstart, _wend, first(*), last(*), count(*) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100 ; _wstart | _wend | first(ts) | first(u_tinyint_col) | first(u_smallint_col) | first(u_int_col) | first(u_bigint_col) | first(tinyint_col) | first(smallint_col) | first(int_col) | first(bigint_col) | first(float_col) | first(double_col) | first(bool_col) | first(binary_16_col) | first(binary_32_col) | first(nchar_16_col) | first(nchar_32_col) | last(ts) | last(u_tinyint_col) | last(u_smallint_col) | last(u_int_col) | last(u_bigint_col) | last(tinyint_col) | last(smallint_col) | last(int_col) | last(bigint_col) | last(float_col) | last(double_col) | last(bool_col) | last(binary_16_col) | last(binary_32_col) | last(nchar_16_col) | last(nchar_32_col) | count(*) | ================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== - 1970-01-01 08:00:00.000 | 2020-10-01 00:00:49.995 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | NULL | NULL | NULL | -650873068 | -9223372036854775808 | 99528.7 | NULL | NULL | NULL | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 2020-10-01 00:00:45.975 | 183 | 26437 | 1670071451 | NULL | NULL | NULL | -785713543 | -9223372036854775808 | 24230.5 | NULL | NULL | NULL | Taiyuan - Santa Clara | 四。San Jose | 帕洛阿托 - Palo Alto | 0 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 2020-10-01 00:00:00.000 | 29 | 13238 | 432633471 | 1825145387 | 80 | 32519 | -650873068 | -9223372036854775808 | 99528.7 | 73495720.958304 | true | San Diego | Shanghai - Los Angles | 一。San Franc | 圣克拉拉 - Santa Clara | 1 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 2020-10-01 00:00:00.003 | NULL | 30154 | NULL | NULL | 44 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 三。San Diego | NULL | 2 | 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.009 | 2020-10-01 00:00:00.006 | 49 | 51523 | NULL | 654411 | -91 | NULL | -140653792 | -9223372036854775808 | NULL | 4540042.841226 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 2020-10-01 00:00:00.008 | 74 | 51523 | NULL | 1158746468 | -91 | NULL | -439167365 | -9223372036854775808 | NULL | -16761361.20062 | true | NULL | Shanghai - Los Angles | 六。Campbell | NULL | 4 | @@ -102,6 +101,7 @@ taos> select _wstart, _wend, first(*), last(*), count(*) from test_vtable_select 2020-10-01 00:00:00.639 | 2020-10-01 00:00:00.642 | 2020-10-01 00:00:00.639 | 71 | 23769 | 1047447204 | 902724244 | 79 | -15245 | -556439232 | -9223372036854775808 | -14500.9 | 2431931.650446 | true | Palo Alto | Tianjin - Mountain View | 一。San Franc | 圣克拉拉 - Santa Clara | 2020-10-01 00:00:00.640 | 71 | 23769 | 1047447204 | 902724244 | 79 | -15245 | -556439232 | -9223372036854775808 | -14500.9 | 2431931.650446 | true | Palo Alto | Tianjin - Mountain View | 一。San Franc | 圣克拉拉 - Santa Clara | 4 | 2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | NULL | 50372 | 1756705093 | NULL | 4 | 11012 | NULL | -9223372036854775808 | -28602.3 | NULL | false | Mountain View | NULL | 二。Los Angle | 圣地亚哥 - San Diego | 2020-10-01 00:00:00.645 | NULL | 50372 | 1756705093 | NULL | 4 | 11012 | NULL | -9223372036854775808 | -28602.3 | NULL | false | Mountain View | NULL | 二。Los Angle | 圣地亚哥 - San Diego | 2 | 2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | 36 | 40209 | NULL | 2011281951 | 87 | NULL | 237103738 | -9223372036854775808 | NULL | -60794244.376766 | true | NULL | Taiyuan - Santa Clara | 一。San Franc | NULL | 2020-10-01 00:00:00.648 | 36 | 40209 | NULL | 2011281951 | 87 | NULL | 237103738 | -9223372036854775808 | NULL | -60794244.376766 | true | NULL | Taiyuan - Santa Clara | 一。San Franc | NULL | 2 | + 2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | NULL | 24193 | NULL | NULL | -86 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 七。Mountain | NULL | 2020-10-01 00:00:00.651 | NULL | 24193 | NULL | NULL | -86 | NULL | NULL | -9223372036854775808 | NULL | NULL | false | NULL | NULL | 七。Mountain | NULL | 2 | taos> select _wstart, _wend, first(bool_col), last(bool_col), count(bool_col) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100 ; _wstart | _wend | first(bool_col) | last(bool_col) | count(bool_col) | @@ -210,7 +210,6 @@ taos> select _wstart, _wend, first(bool_col), last(bool_col), count(bool_col) fr taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), last(bool_col), last(u_tinyint_col), count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100; _wstart | _wend | first(bool_col) | first(u_tinyint_col) | last(bool_col) | last(u_tinyint_col) | count(u_tinyint_col) | ============================================================================================================================================================ - 1970-01-01 08:00:00.000 | 2020-10-01 00:00:19.998 | NULL | 29 | NULL | 137 | 0 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 29 | true | 29 | 1 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | NULL | false | NULL | 0 | 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.009 | true | 49 | true | 74 | 4 | @@ -310,11 +309,11 @@ taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), last(bool_co 2020-10-01 00:00:00.639 | 2020-10-01 00:00:00.642 | true | 71 | true | 71 | 2 | 2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | false | NULL | false | NULL | 0 | 2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | true | 36 | true | 36 | 2 | + 2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | false | NULL | false | NULL | 0 | taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), first(u_smallint_col), last(bool_col), last(u_tinyint_col), last(u_smallint_col), count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb state_window(bool_col) order by _wstart limit 100 ; _wstart | _wend | first(bool_col) | first(u_tinyint_col) | first(u_smallint_col) | last(bool_col) | last(u_tinyint_col) | last(u_smallint_col) | count(u_tinyint_col) | =========================================================================================================================================================================================================== - 1970-01-01 08:00:00.000 | 2020-10-01 00:00:29.997 | NULL | 29 | 13238 | NULL | 72 | 28494 | 0 | 2020-10-01 00:00:00.000 | 2020-10-01 00:00:00.000 | true | 29 | 13238 | true | 29 | 13238 | 1 | 2020-10-01 00:00:00.003 | 2020-10-01 00:00:00.003 | false | NULL | 30154 | false | NULL | 30154 | 0 | 2020-10-01 00:00:00.006 | 2020-10-01 00:00:00.009 | true | 49 | 51523 | true | 74 | 51523 | 4 | @@ -414,4 +413,5 @@ taos> select _wstart, _wend, first(bool_col), first(u_tinyint_col), first(u_smal 2020-10-01 00:00:00.639 | 2020-10-01 00:00:00.642 | true | 71 | 23769 | true | 71 | 23769 | 2 | 2020-10-01 00:00:00.645 | 2020-10-01 00:00:00.645 | false | NULL | 50372 | false | NULL | 50372 | 0 | 2020-10-01 00:00:00.648 | 2020-10-01 00:00:00.648 | true | 36 | 40209 | true | 36 | 40209 | 2 | + 2020-10-01 00:00:00.651 | 2020-10-01 00:00:00.651 | false | NULL | 24193 | false | NULL | 24193 | 0 | diff --git a/tests/army/vtable/in/test_vstable_select_test_function.in b/tests/army/vtable/in/test_vstable_select_test_function.in index 4794ce5897..87f2513f0e 100644 --- a/tests/army/vtable/in/test_vstable_select_test_function.in +++ b/tests/army/vtable/in/test_vstable_select_test_function.in @@ -129,7 +129,6 @@ select avg(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select count(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select count(*) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select elapsed(ts) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; -select leastsquares(int_tag, 0, 1) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select spread(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select stddev(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select sum(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; @@ -150,11 +149,8 @@ select min(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select mode(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select tail(int_tag, 20) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select unique(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; -select csum(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select derivative(int_tag, 5a, 1) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; -select diff(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select irate(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; -select mavg(int_tag, 100) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select statecount(int_tag, "GT", 20) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select stateduration(int_tag, "GT", 20, 1a) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; select twa(int_tag) from test_vtable_select.vtb_virtual_stb order by 1 limit 5; \ No newline at end of file diff --git a/tests/army/vtable/in/test_vstable_select_test_partition.in b/tests/army/vtable/in/test_vstable_select_test_partition.in index cbdf59437e..bfa2484c91 100644 --- a/tests/army/vtable/in/test_vstable_select_test_partition.in +++ b/tests/army/vtable/in/test_vstable_select_test_partition.in @@ -1,83 +1,83 @@ -select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; -select u_tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; -select u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; -select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; -select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; -select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col slimit 10 limit 10; +select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; +select u_tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; +select u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; +select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; +select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1 slimit 10 limit 10; +select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1, 2, int_tag slimit 10 limit 10; -select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; -select u_tinyint_col + 1 from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; -select u_tinyint_col + 1, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; -select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; -select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; -select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 slimit 10 limit 10; +select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; +select u_tinyint_col + 1 from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; +select u_tinyint_col + 1, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; +select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; +select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1 slimit 10 limit 10; +select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col + 1 order by 1, 2, int_tag slimit 10 limit 10; -select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; -select u_tinyint_col, tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; -select u_tinyint_col, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; -select avg(u_int_col), avg(tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; -select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; -select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col slimit 10 limit 10; +select count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; +select u_tinyint_col, tinyint_col from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; +select u_tinyint_col, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; +select avg(u_int_col), avg(tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; +select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1 slimit 10 limit 10; +select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col, tinyint_col order by 1, 2, int_tag slimit 10 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(10s) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col interval(10s) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(10s) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) slimit 10 limit 10; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(10s) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col interval(10s) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(10s) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col interval(1d) order by 1,2,3,4 slimit 10 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col state_window(bool_col) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) slimit 10 limit 10; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col state_window(bool_col) order by 1,2,3,4 slimit 10 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col session(ts, 10a) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) slimit 10 limit 10; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tinyint_col session(ts, 10a) order by 1,2,3,4 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(tinyint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with tinyint_col > 100 order by 1,2,3,4 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; -select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, first(tinyint_col), last(smallint_col), u_tinyint_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col event_window start with tinyint_col > 50 end with smallint_col > 1000 order by 1,2,3,4 slimit 10 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col count_window(10) slimit 10 limit 10; -select _wstart, _wend, tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by tinyint_col count_window(10) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col),count(u_tinyint_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; -select _wstart, _wend, bool_col, count(*), count(u_int_col) from test_vtable_select.vtb_virtual_stb partition by bool_col count_window(10) slimit 10 limit 10; +select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col order by 1) count_window(10) order by 1,2,3 limit 10; +select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by tinyint_col order by 1) count_window(10) order by 1,2,3 limit 10; +select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3 limit 10; +select _wstart, _wend, count(*) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3 limit 10; +select _wstart, _wend, count(*), count(u_int_col),count(u_tinyint_col), count(u_smallint_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10; +select _wstart, _wend, count(*), count(u_int_col),count(u_tinyint_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10; +select _wstart, _wend, count(*), count(u_int_col) from (select * from test_vtable_select.vtb_virtual_stb partition by bool_col order by 1) count_window(10) order by 1,2,3,4 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 10 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 2 limit 10; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 2 limit 5; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 20 limit 2; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 20 limit 5; -select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) slimit 10 limit 2; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 10 limit 10; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 2 limit 10; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 2 limit 5; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 20 limit 2; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 20 limit 5; +select _wstart, _wend, u_tinyint_col, count(*) from test_vtable_select.vtb_virtual_stb partition by u_tinyint_col interval(1s) order by 1,2,3,4 slimit 10 limit 2; -select count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; -select int_tag from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; -select int_tag, count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; -select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; -select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; -select * from test_vtable_select.vtb_virtual_stb partition by int_tag slimit 10 limit 10; +select count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; +select int_tag from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; +select int_tag, count(*) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; +select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; +select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1 slimit 10 limit 10; +select * from test_vtable_select.vtb_virtual_stb partition by int_tag order by 1, 2, int_tag slimit 10 limit 10; -select count(*) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; -select tbname from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; -select tbname, count(*) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; -select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; -select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; -select * from test_vtable_select.vtb_virtual_stb partition by tbname slimit 10 limit 10; \ No newline at end of file +select count(*) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; +select tbname from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; +select tbname, count(*) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; +select avg(u_int_col) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; +select avg(u_tinyint_col), avg(u_smallint_col), avg(u_int_col), avg(u_bigint_col), avg(tinyint_col), avg(smallint_col), avg(int_col), avg(bigint_col), avg(float_col), avg(double_col) from test_vtable_select.vtb_virtual_stb partition by tbname order by 1 slimit 10 limit 10; +select * from test_vtable_select.vtb_virtual_stb partition by tbname order by 1, 2, int_tag slimit 10 limit 10; \ No newline at end of file diff --git a/tests/army/vtable/test_vtable_alter.py b/tests/army/vtable/test_vtable_alter.py index 3a8c2c9fa0..79df00ae17 100644 --- a/tests/army/vtable/test_vtable_alter.py +++ b/tests/army/vtable/test_vtable_alter.py @@ -328,6 +328,9 @@ class TDTestCase(TBase): # 1.6. change column length when column reference exists tdSql.error("alter vtable vtb_virtual_ntb0 modify column nchar_16_col nchar(32);") + # 1.7. add column with decimal type + tdSql.error("alter vtable vtb_virtual_ntb0 add column extra_decimal decimal(38,38)") + # 2. child table # 2.1. change column reference with wrong type tdSql.error("alter vtable vtb_virtual_ctb0 alter column int_col set vtb_org_child_19.tinyint_col") @@ -343,6 +346,12 @@ class TDTestCase(TBase): tdSql.execute("alter stable vtb_virtual_stb modify column nchar_16_col nchar(32);") tdSql.error("select nchar_16_col from vtb_virtual_ctb0;") + # 3.3. add column with decimal type + tdSql.error("alter stable vtb_virtual_stb add column extra_decimal decimal(38,38)") + + # 3.4. add tag with decimal type + tdSql.error("alter stable vtb_virtual_stb add tag extra_decimal_tag decimal(38,38)") + def run(self): tdLog.debug(f"start to excute {__file__}") diff --git a/tests/army/vtable/test_vtable_auth_alter_drop_child.py b/tests/army/vtable/test_vtable_auth_alter_drop_child.py index 8c2a9089d1..263aadd38a 100644 --- a/tests/army/vtable/test_vtable_auth_alter_drop_child.py +++ b/tests/army/vtable/test_vtable_auth_alter_drop_child.py @@ -58,9 +58,9 @@ class TDTestCase(TBase): if (priv_orgtb != "none"): tdSql.execute(f"grant {priv_orgtb} on test_vctable_auth_alter.test_vtable_auth_org_table_2 to test_vct_user_alter;") - sleep(1) + sleep(2) - tdLog.info(f"priv_db: {priv_db}, priv_tb1: {priv_vtb}, priv_tb2: {priv_orgtb}") + tdLog.info(f"priv_db: {priv_db}, priv_stb: {priv_vtb}, priv_ctb: {priv_orgtb}") testSql.execute("use test_vctable_auth_alter;") if (priv_db == "read"): if (priv_vtb == "write" or priv_vtb == "all"): diff --git a/tests/army/vtable/test_vtable_create.py b/tests/army/vtable/test_vtable_create.py index b3e102e3c5..e2a0bddb82 100644 --- a/tests/army/vtable/test_vtable_create.py +++ b/tests/army/vtable/test_vtable_create.py @@ -702,6 +702,77 @@ class TDTestCase(TBase): "geo_32_col FROM vtb_org_child_18.geo_32_col)" "USING vtb_virtual_stb TAGS (13, false, 13, 13, 'vchild13', 'vchild13')") + # 11. create virtual table using decimal + # 11.1 super table + # 11.1.1 decimal column + tdSql.error(f"CREATE STABLE `vtb_virtual_stb_error` (" + "ts timestamp, " + "u_tinyint_col tinyint unsigned, " + "u_smallint_col smallint unsigned, " + "u_int_col int unsigned, " + "u_bigint_col bigint unsigned, " + "tinyint_col tinyint, " + "smallint_col smallint, " + "int_col int, " + "bigint_col bigint, " + "float_col float, " + "double_col double, " + "bool_col bool, " + "binary_16_col binary(16)," + "binary_32_col binary(32)," + "nchar_16_col nchar(16)," + "nchar_32_col nchar(32)," + "varbinary_16_col varbinary(16)," + "varbinary_32_col varbinary(32)," + "geo_16_col geometry(16)," + "geo_32_col geometry(32)," + "decimal_col decimal(38,38)" + ") TAGS (" + "int_tag int," + "bool_tag bool," + "float_tag float," + "double_tag double," + "nchar_32_tag nchar(32)," + "binary_32_tag binary(32))" + "VIRTUAL 1") + # 11.1.2 decimal tag + tdSql.error(f"CREATE STABLE `vtb_virtual_stb_error` (" + "ts timestamp, " + "u_tinyint_col tinyint unsigned, " + "u_smallint_col smallint unsigned, " + "u_int_col int unsigned, " + "u_bigint_col bigint unsigned, " + "tinyint_col tinyint, " + "smallint_col smallint, " + "int_col int, " + "bigint_col bigint, " + "float_col float, " + "double_col double, " + "bool_col bool, " + "binary_16_col binary(16)," + "binary_32_col binary(32)," + "nchar_16_col nchar(16)," + "nchar_32_col nchar(32)," + "varbinary_16_col varbinary(16)," + "varbinary_32_col varbinary(32)," + "geo_16_col geometry(16)," + "geo_32_col geometry(32)" + ") TAGS (" + "int_tag int," + "bool_tag bool," + "float_tag float," + "double_tag double," + "nchar_32_tag nchar(32)," + "binary_32_tag binary(32))," + "decimal_tag decimal(38,38)" + "VIRTUAL 1") + + # 11.2 virtual normal table + tdSql.error("CREATE VTABLE `error_vtb_virtual_ntb8` (" + "ts timestamp FROM vtb_org_normal_0.ts, " + "u_tinyint_col tinyint unsigned from vtb_org_normal_0.u_tinyint_col, " + "u_smallint_col smallint unsigned from vtb_org_normal_1.u_smallint_col, " + "decimal_col decimal(38,38))") def run(self): tdLog.debug(f"start to excute {__file__}") diff --git a/tests/army/vtable/test_vtable_query.py b/tests/army/vtable/test_vtable_query.py index eb5f781460..678e274347 100644 --- a/tests/army/vtable/test_vtable_query.py +++ b/tests/army/vtable/test_vtable_query.py @@ -257,12 +257,12 @@ class TDTestCase(TBase): #self.test_normal_query("test_vstable_select_test_function") self.test_normal_query("test_vstable_select_test_interval") - #self.test_normal_query("test_vstable_select_test_state") + self.test_normal_query("test_vstable_select_test_state") self.test_normal_query("test_vstable_select_test_session") - #self.test_normal_query("test_vstable_select_test_event") + self.test_normal_query("test_vstable_select_test_event") self.test_normal_query("test_vstable_select_test_count") - #self.test_normal_query("test_vstable_select_test_partition") + self.test_normal_query("test_vstable_select_test_partition") self.test_normal_query("test_vstable_select_test_group") self.test_normal_query("test_vstable_select_test_orderby") diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f0c547c3cf..8569a3cb6d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -46,6 +46,7 @@ ,,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 +,,y,army,./pytest.sh python3 ./test.py -f query/test_join_const.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_compare.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_case_when.py ,,y,army,./pytest.sh python3 ./test.py -f insert/test_column_tag_boundary.py @@ -342,6 +343,11 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal2.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal2.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal2.py -Q 1 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/decimal3.py -Q 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbnameIn.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbnameIn.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbnameIn.py -Q 2 diff --git a/tests/system-test/2-query/decimal.py b/tests/system-test/2-query/decimal.py index eb03207041..d27606c70b 100644 --- a/tests/system-test/2-query/decimal.py +++ b/tests/system-test/2-query/decimal.py @@ -28,11 +28,14 @@ class AtomicCounter: getcontext().prec = 40 -def get_decimal(val, scale: int) -> Decimal: +def get_decimal(val, scale: int): if val == 'NULL': return None getcontext().prec = 100 - return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP) + try: + return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP) + except: + tdLog.exit(f"faield to convert to decimal for v: {val} scale: {scale}") syntax_error = -2147473920 invalid_column = -2147473918 @@ -52,6 +55,7 @@ unary_op_test = True binary_op_in_where_test = True test_decimal_funcs = False cast_func_test_round = 10 +in_op_test_round = 10 class DecimalTypeGeneratorConfig: def __init__(self): @@ -308,8 +312,8 @@ class DecimalColumnExpr: calc_res = float(v_from_calc_in_py) failed = not math.isclose(query_res, calc_res, abs_tol=1e-7) else: - query_res = Decimal(v_from_query) - calc_res = Decimal(v_from_calc_in_py) + query_res = get_decimal(v_from_query, self.res_type_.scale()) + calc_res = get_decimal(v_from_calc_in_py, self.res_type_.scale()) failed = query_res != calc_res if failed: tdLog.exit( @@ -438,13 +442,13 @@ class DataType: if self.type == TypeEnum.BIGINT: return str(secrets.randbelow(9223372036854775808) - 4611686018427387904) if self.type == TypeEnum.FLOAT or self.type == TypeEnum.DOUBLE: - return str(random.random()) + return str(random.uniform(-1e10, 1e10)) if ( self.type == TypeEnum.VARCHAR or self.type == TypeEnum.NCHAR or self.type == TypeEnum.VARBINARY ): - return f"'{str(random.random())[0:self.length]}'" + return f"'{str(random.uniform(-1e20, 1e20))[0:self.length]}'" if self.type == TypeEnum.TIMESTAMP: return str(secrets.randbelow(9223372036854775808)) if self.type == TypeEnum.UTINYINT: @@ -461,6 +465,29 @@ class DataType: return "'POINT(1.0 1.0)'" raise Exception(f"unsupport type {self.type}") + def generate_sized_val(self, prec: int, scale: int) -> str: + weight = prec - scale + if self.type == TypeEnum.BOOL: + return ['true', 'false'][secrets.randbelow(2)] + if self.type == TypeEnum.TINYINT or self.type == TypeEnum.SMALLINT or self.type == TypeEnum.INT or self.type == TypeEnum.BIGINT or self.type == TypeEnum.TIMESTAMP: + return str(secrets.randbelow(10 * weight * 2) - 10 * weight) + if self.type == TypeEnum.FLOAT or self.type == TypeEnum.DOUBLE: + return str(random.uniform(-10 * weight, 10 * weight)) + if ( + self.type == TypeEnum.VARCHAR + or self.type == TypeEnum.NCHAR + or self.type == TypeEnum.VARBINARY + ): + return f"'{str(random.uniform(-(10 * weight + 1), 10 * weight - 1))}'" + if self.type == TypeEnum.UTINYINT or self.type == TypeEnum.USMALLINT or self.type == TypeEnum.UINT or self.type == TypeEnum.UBIGINT: + return str(secrets.randbelow(10 * weight * 2)) + if self.type == TypeEnum.JSON: + return f'{{"key": "{secrets.token_urlsafe(10)}"}}' + if self.type == TypeEnum.GEOMETRY: + return "'POINT(1.0 1.0)'" + raise Exception(f"unsupport type {self.type}") + + def check(self, values, offset: int): return True @@ -481,6 +508,8 @@ class DataType: return get_decimal(val, self.scale()) elif isinstance(val, str): val = val.strip("'") + if len(val) == 0: + return 0 return val def get_typed_val(self, val): @@ -513,6 +542,19 @@ class DataType: TypeEnum.DECIMAL, TypeEnum.DECIMAL64, ] + + @staticmethod + def generate_random_type_for(dt: int): + if dt == TypeEnum.DECIMAL: + prec = random.randint(1, DecimalType.DECIMAL_MAX_PRECISION) + return DecimalType(dt, prec, random.randint(0, prec)) + elif dt == TypeEnum.DECIMAL64: + prec = random.randint(1, DecimalType.DECIMAL64_MAX_PRECISION) + return DecimalType(dt, prec, random.randint(0, prec)) + elif dt == TypeEnum.BINARY or dt == TypeEnum.VARCHAR: + return DataType(dt, random.randint(16, 255), 0) + else: + return DataType(dt, 0, 0) class DecimalType(DataType): DECIMAL_MAX_PRECISION = 38 @@ -668,6 +710,25 @@ class Column: else: return len(self.saved_vals[tbname]) + def seq_scan_col(self, tbname: str, idx: int): + if self.is_constant_col(): + return self.get_constant_val_for_execute(), False + elif len(self.saved_vals) > 1: + keys = list(self.saved_vals.keys()) + for i, key in enumerate(keys): + l = len(self.saved_vals[key]) + if idx < l: + return self.get_typed_val_for_execute(self.saved_vals[key][idx]), True + else: + idx -= l + + return 1, False + else: + if idx > len(self.saved_vals[tbname]) - 1: + return 1, False + v = self.get_typed_val_for_execute(self.saved_vals[tbname][idx]) + return v, True + @staticmethod def comp_key(key1, key2): if key1 is None: @@ -921,23 +982,11 @@ class DecimalCastTypeGenerator: else: return DataType.get_decimal_op_types() - def do_generate_type(self, dt: int) ->DataType: - if dt == TypeEnum.DECIMAL: - prec = random.randint(1, DecimalType.DECIMAL_MAX_PRECISION) - return DecimalType(dt, prec, random.randint(0, prec)) - elif dt == TypeEnum.DECIMAL64: - prec = random.randint(1, DecimalType.DECIMAL64_MAX_PRECISION) - return DecimalType(dt, prec, random.randint(0, prec)) - elif dt == TypeEnum.BINARY or dt == TypeEnum.VARCHAR: - return DataType(dt, random.randint(16, 255), 0) - else: - return DataType(dt, 0, 0) - def generate(self, num: int) -> List[DataType]: res: list[DataType] = [] for _ in range(num): dt = random.choice(self.get_possible_output_types()) - dt = self.do_generate_type(dt) + dt = DataType.generate_random_type_for(dt) res.append(dt) res = list(set(res)) return res @@ -1303,10 +1352,12 @@ class DecimalBinaryOperator(DecimalColumnExpr): return super().generate(format_params) def should_skip_for_decimal(self, cols: list): - left_col = cols[0] - right_col = cols[1] + left_col: Column = cols[0] + right_col: Column = cols[1] if not left_col.type_.is_decimal_type() and not right_col.type_.is_decimal_type(): return True + if not right_col.is_constant_col() and (self.op_ == '%' or self.op_ == '/'): + return True if self.op_ != "%": return False ## TODO wjm why skip decimal % float/double? it's wrong now. @@ -1556,21 +1607,104 @@ class DecimalUnaryOperator(DecimalColumnExpr): def generate_res_type(self): self.res_type_ = self.col_type_ = self.params_[0].type_ - def execute_minus(self, params) -> Decimal: + def execute_minus(self, params): if params[0] is None: return 'NULL' return -Decimal(params[0]) class DecimalBinaryOperatorIn(DecimalBinaryOperator): def __init__(self, op: str): - super().__init__(op) + self.op_ = op + super().__init__("{0} " + self.op_ + " ({1})", self.execute_op, op) - def execute(self, left, right): - if self.op_.lower()() == "in": - return left in right - if self.op_.lower() == "not in": - return left not in right + def generate_res_type(self): + self.query_col = self.params_[0] + self.res_type_ = DataType(TypeEnum.BOOL) + + def execute_op(self, params): + list_exprs: DecimalListExpr = self.params_[1] + v, vs = list_exprs.get_converted_vs(params) + if v is None: + return False + b = False + if self.op_.lower() == 'in': + b = v in vs + #if b: + #tdLog.debug(f"eval {v} in {list_exprs} got: {b}") + else: + b = v not in vs + #if not b: + #tdLog.debug(f"eval {v} not in {list_exprs} got: {b}") + return b + def check(self, res, tbname: str): + idx = 0 + v, has_next = self.query_col.seq_scan_col(tbname, idx) + calc_res = [] + while has_next: + keep: bool = self.execute_op(v) + if keep: + calc_res.append(v) + idx += 1 + v, has_next = self.query_col.seq_scan_col(tbname, idx) + calc_res = sorted(calc_res) + res = [get_decimal(e, self.query_col.type_.scale()) for e in res] + res = sorted(res) + for v, calc_v in zip(res, calc_res): + if v != calc_v: + tdLog.exit(f"check failed for {self}, query got: {v}, expect: {calc_v}, len_query: {len(res)}, len_calc: {len(calc_res)}") + return True + +class DecimalListExpr: + def __init__(self, num: int, col: Column): + self.elements_ = [] + self.num_ = num + self.types_ = [] + self.converted_vs_ = None + self.output_float_ = False + self.col_in_: Column = col + + @staticmethod + def get_all_possible_types(): + types = DataType.get_decimal_op_types() + types.remove(TypeEnum.DECIMAL) + types.remove(TypeEnum.DECIMAL64) + return types + + def has_output_double_type(self) -> bool: + for t in self.types_: + if t.is_real_type() or t.is_varchar_type(): + return True + return False + + def get_converted_vs(self, v): + if self.converted_vs_ is None: + vs = [] + for t, saved_v in zip(self.types_, self.elements_): + vs.append(t.get_typed_val_for_execute(saved_v, True)) + if self.has_output_double_type(): + self.converted_vs_ = [float(e) for e in vs] + self.output_float_= True + else: + self.converted_vs_ = [Decimal(e) for e in vs] + if v is None: + return None, self.converted_vs_ + if self.output_float_: + return float(v), self.converted_vs_ + else: + return Decimal(v), self.converted_vs_ + + def generate(self): + types = self.get_all_possible_types() + for _ in range(self.num_): + type = random.choice(types) + dt = DataType.generate_random_type_for(type) + self.types_.append(dt) + v = dt.generate_sized_val(self.col_in_.type_.prec(), self.col_in_.type_.scale()) + self.elements_.append(v) + + def __str__(self): + return f"{','.join([e for e in self.elements_])}" class TDTestCase: updatecfgDict = { @@ -2152,44 +2286,64 @@ class TDTestCase: if tdSql.errno != invalid_operation and tdSql.errno != scalar_convert_err: tdLog.exit(f"expected err not occured for sql: {sql}, expect: {invalid_operation} or {scalar_convert_err}, but got {tdSql.errno}") + def check_decimal_in_op(self, tbname: str, tb_cols: list): + for i in range(in_op_test_round): + inOp: DecimalBinaryOperatorIn = DecimalBinaryOperatorIn('in') + notInOp: DecimalBinaryOperatorIn = DecimalBinaryOperatorIn('not in') + for col in tb_cols: + if not col.type_.is_decimal_type(): + continue + list_expr: DecimalListExpr = DecimalListExpr(random.randint(1, 10), col) + list_expr.generate() + expr = inOp.generate((col, list_expr)) + sql = f'select {col} from {self.db_name}.{tbname} where {expr}' + res = TaosShell().query(sql) + if len(res) > 0: + res = res[0] + inOp.check(res, tbname) + + expr = notInOp.generate((col, list_expr)) + sql = f'select {col} from {self.db_name}.{tbname} where {expr}' + res = TaosShell().query(sql) + if len(res) > 0: + res = res[0] + notInOp.check(res, tbname) + def test_decimal_operators(self): tdLog.debug("start to test decimal operators") - self.test_decimal_unsupported_types() - ## tables: meters, nt - ## columns: c1, c2, c3, c4, c5, c7, c8, c9, c10, c99, c100 - binary_operators = DecimalBinaryOperator.get_all_binary_ops() + if True: + self.test_decimal_unsupported_types() + ## tables: meters, nt + ## columns: c1, c2, c3, c4, c5, c7, c8, c9, c10, c99, c100 + binary_operators = DecimalBinaryOperator.get_all_binary_ops() - ## decimal operator with constants of all other types - self.run_in_thread( - operator_test_round, - self.check_decimal_binary_expr_with_const_col_results, - ( + ## decimal operator with constants of all other types + self.run_in_thread( + operator_test_round, + self.check_decimal_binary_expr_with_const_col_results, + ( + self.db_name, + self.norm_table_name, + self.norm_tb_columns, + Column.get_decimal_oper_const_cols, + DecimalBinaryOperator.get_all_binary_ops, + ), + ) + + ## test decimal column op decimal column + for _ in range(operator_test_round): + self.check_decimal_binary_expr_with_col_results( + self.db_name, self.norm_table_name, self.norm_tb_columns, binary_operators) + + unary_operators = DecimalUnaryOperator.get_all_unary_ops() + self.check_decimal_unary_expr_results( self.db_name, self.norm_table_name, self.norm_tb_columns, - Column.get_decimal_oper_const_cols, - DecimalBinaryOperator.get_all_binary_ops, - ), - ) + unary_operators,) - ## test decimal column op decimal column - for i in range(operator_test_round): - self.check_decimal_binary_expr_with_col_results( - self.db_name, self.norm_table_name, self.norm_tb_columns, binary_operators) - - unary_operators = DecimalUnaryOperator.get_all_unary_ops() - self.check_decimal_unary_expr_results( - self.db_name, - self.norm_table_name, - self.norm_tb_columns, - unary_operators,) - - - def test_decimal_last_first_func(self): - pass - - def test_query_decimal_with_sma(self): - pass + self.check_decimal_in_op(self.norm_table_name, self.norm_tb_columns) + self.check_decimal_in_op(self.stable_name, self.stb_columns) def check_decimal_where_with_binary_expr_with_const_col_results( self, diff --git a/tests/system-test/2-query/decimal2.py b/tests/system-test/2-query/decimal2.py index f3ee5b3c75..556f67fefe 100644 --- a/tests/system-test/2-query/decimal2.py +++ b/tests/system-test/2-query/decimal2.py @@ -32,7 +32,10 @@ def get_decimal(val, scale: int) -> Decimal: if val == 'NULL': return None getcontext().prec = 100 - return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP) + try: + return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP) + except Exception as e: + tdLog.exit(f"failed to convert {val} to decimal, {e}") syntax_error = -2147473920 invalid_column = -2147473918 @@ -46,6 +49,7 @@ decimal_test_query = True decimal_insert_validator_test = False operator_test_round = 1 tb_insert_rows = 1000 +ctb_num = 10 binary_op_with_const_test = False binary_op_with_col_test = False unary_op_test = False @@ -160,6 +164,23 @@ class DecimalColumnAggregator: self.none_num: int = 0 self.first = None self.last = None + self.firsts = [] + self.lasts = [] + for i in range(ctb_num): + self.firsts.append(None) + self.lasts.append(None) + def is_stb(self): + return self.firsts[1] is not None + + def get_last(self): + if self.is_stb(): + return self.lasts + return self.last + + def get_first(self): + if self.is_stb(): + return self.firsts + return self.first def add_value(self, value: str, scale: int): self.count += 1 @@ -171,7 +192,10 @@ class DecimalColumnAggregator: v: Decimal = get_decimal(value, scale) if self.first is None: self.first = v + if self.firsts[int((self.count - 1) / tb_insert_rows)] is None: + self.firsts[int((self.count - 1) / tb_insert_rows)] = v self.last = v + self.lasts[int((self.count - 1) / tb_insert_rows)] = v self.sum += v if v > self.max: self.max = v @@ -275,7 +299,7 @@ class DecimalColumnExpr: continue else: break - dec_from_query = Decimal(v_from_query) + dec_from_query = get_decimal(v_from_query, self.query_col.type_.scale()) dec_from_calc = self.get_query_col_val(tbname, j) if dec_from_query != dec_from_calc: tdLog.exit(f"filter with {self} failed, query got: {dec_from_query}, expect {dec_from_calc}, param: {params}") @@ -994,7 +1018,7 @@ class DecimalFunction(DecimalColumnExpr): def check_results(self, query_col_res: List) -> bool: return False - def check_for_agg_func(self, query_col_res: List, tbname: str, func): + def check_for_agg_func(self, query_col_res: List, tbname: str, func, is_stb: bool = False): col_expr = self.query_col for i in range(col_expr.get_cardinality(tbname)): col_val = col_expr.get_val_for_execute(tbname, i) @@ -1122,18 +1146,30 @@ class DecimalAggFunction(DecimalFunction): else: return self.get_func_res() == Decimal(query_col_res[0]) -class DecimalLastRowFunction(DecimalAggFunction): - def __init__(self): - super().__init__("last_row({0})", DecimalLastRowFunction.execute_last_row, "last_row") - self.res_ = None - def get_func_res(self): - decimal_type:DecimalType = self.query_col.type_ - return decimal_type.aggregator.last +class DecimalFirstLastFunction(DecimalAggFunction): + def __init__(self, format: str, func, name): + super().__init__(format, func, name) def generate_res_type(self): self.res_type_ = self.query_col.type_ + def check_results(self, query_col_res): + if len(query_col_res) == 0: + tdLog.exit(f"query got no output: {self}, py calc: {self.get_func_res()}") + else: + v = Decimal(query_col_res[0]) + decimal_type: DecimalType = self.query_col.type_ + if decimal_type.aggregator.is_stb(): + return v in self.get_func_res() + else: + return self.get_func_res() == v + +class DecimalLastRowFunction(DecimalFirstLastFunction): + def __init__(self): + super().__init__("last_row({0})", DecimalLastRowFunction.execute_last_row, "last_row") + def get_func_res(self): + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.get_last() def execute_last_row(self, params): - if params[0] is not None: - self.res_ = Decimal(params[0]) + pass class DecimalCacheLastRowFunction(DecimalAggFunction): def __init__(self): @@ -1148,27 +1184,22 @@ class DecimalCacheLastRowFunction(DecimalAggFunction): class DecimalCacheLastFunction(DecimalAggFunction): pass -class DecimalFirstFunction(DecimalAggFunction): +class DecimalFirstFunction(DecimalFirstLastFunction): def __init__(self): super().__init__("first({0})", DecimalFirstFunction.execute_first, "first") - self.res_ = None def get_func_res(self): decimal_type: DecimalType = self.query_col.type_ - return decimal_type.aggregator.first - def generate_res_type(self): - self.res_type_ = self.query_col.type_ + return decimal_type.aggregator.get_first() def execute_first(self, params): pass -class DecimalLastFunction(DecimalAggFunction): +class DecimalLastFunction(DecimalFirstLastFunction): def __init__(self): super().__init__("last({0})", DecimalLastFunction.execute_last, "last") self.res_ = None def get_func_res(self): decimal_type:DecimalType = self.query_col.type_ - return decimal_type.aggregator.last - def generate_res_type(self): - self.res_type_ = self.query_col.type_ + return decimal_type.aggregator.get_last() def execute_last(self, params): pass @@ -1207,19 +1238,12 @@ class DecimalMinFunction(DecimalAggFunction): def get_func_res(self) -> Decimal: decimal_type: DecimalType = self.query_col.type_ return decimal_type.aggregator.min - return self.min_ def generate_res_type(self) -> DataType: self.res_type_ = self.query_col.type_ def execute_min(self, params): - if params[0] is None: - return - if self.min_ is None: - self.min_ = Decimal(params[0]) - else: - self.min_ = min(self.min_, Decimal(params[0])) - return self.min_ + pass class DecimalMaxFunction(DecimalAggFunction): def __init__(self): @@ -1234,13 +1258,7 @@ class DecimalMaxFunction(DecimalAggFunction): self.res_type_ = self.query_col.type_ def execute_max(self, params): - if params[0] is None: - return - if self.max_ is None: - self.max_ = Decimal(params[0]) - else: - self.max_ = max(self.max_, Decimal(params[0])) - return self.max_ + pass class DecimalSumFunction(DecimalAggFunction): def __init__(self): @@ -1249,24 +1267,15 @@ class DecimalSumFunction(DecimalAggFunction): def get_func_res(self) -> Decimal: decimal_type: DecimalType = self.query_col.type_ return decimal_type.aggregator.sum - return self.sum_ def generate_res_type(self) -> DataType: self.res_type_ = self.query_col.type_ self.res_type_.set_prec(DecimalType.DECIMAL_MAX_PRECISION) def execute_sum(self, params): - if params[0] is None: - return - if self.sum_ is None: - self.sum_ = Decimal(params[0]) - else: - self.sum_ += Decimal(params[0]) - return self.sum_ + pass class DecimalAvgFunction(DecimalAggFunction): def __init__(self): super().__init__("avg({0})", DecimalAvgFunction.execute_avg, "avg") - self.count_: Decimal = 0 - self.sum_: Decimal = None def get_func_res(self) -> Decimal: decimal_type: DecimalType = self.query_col.type_ return get_decimal( @@ -1280,14 +1289,7 @@ class DecimalAvgFunction(DecimalAggFunction): count_type = DataType(TypeEnum.BIGINT, 8, 0) self.res_type_ = DecimalBinaryOperator.calc_decimal_prec_scale(sum_type, count_type, "/") def execute_avg(self, params): - if params[0] is None: - return - if self.sum_ is None: - self.sum_ = Decimal(params[0]) - else: - self.sum_ += Decimal(params[0]) - self.count_ += 1 - return self.get_func_res() + pass class DecimalBinaryOperator(DecimalColumnExpr): def __init__(self, format, executor, op: str): @@ -1594,7 +1596,7 @@ class TDTestCase: self.c_table_prefix = "t" self.tag_name_prefix = "t" self.db_name = "test" - self.c_table_num = 10 + self.c_table_num = ctb_num self.no_decimal_col_tb_name = "tt" self.stb_columns = [] self.stream_name = "stream1" @@ -1975,9 +1977,9 @@ class TDTestCase: #self.no_decimal_table_test() self.test_insert_decimal_values() self.test_query_decimal() - self.test_decimal_and_tsma() - self.test_decimal_and_view() - self.test_decimal_and_stream() + #self.test_decimal_and_tsma() + #self.test_decimal_and_view() + #self.test_decimal_and_stream() def stop(self): tdSql.close() @@ -2396,7 +2398,7 @@ class TDTestCase: res = TaosShell().query(sql) if len(res) > 0: res = res[0] - func.check_for_agg_func(res, tbname, func) + func.check_for_agg_func(res, tbname, func, tbname == self.stable_name) def test_decimal_cast_func(self, dbname, tbname, tb_cols: List[Column]): for col in tb_cols: @@ -2416,13 +2418,8 @@ class TDTestCase: self.log_test("start to test decimal functions") if not test_decimal_funcs: return - self.test_decimal_agg_funcs( - self.db_name, - self.norm_table_name, - self.norm_tb_columns, - DecimalFunction.get_decimal_agg_funcs, - ) - ##self.test_decimal_agg_funcs( self.db_name, self.stable_name, self.stb_columns, DecimalFunction.get_decimal_agg_funcs) + self.test_decimal_agg_funcs( self.db_name, self.norm_table_name, self.norm_tb_columns, DecimalFunction.get_decimal_agg_funcs) + self.test_decimal_agg_funcs( self.db_name, self.stable_name, self.stb_columns, DecimalFunction.get_decimal_agg_funcs) self.test_decimal_cast_func(self.db_name, self.norm_table_name, self.norm_tb_columns) def test_query_decimal(self): @@ -2431,11 +2428,11 @@ class TDTestCase: return #self.test_decimal_operators() self.test_query_decimal_where_clause() - self.test_decimal_functions() - self.test_query_decimal_order_clause() - self.test_query_decimal_case_when() - self.test_query_decimal_group_by_clause() - self.test_query_decimal_having_clause() + #self.test_decimal_functions() + #self.test_query_decimal_order_clause() + #self.test_query_decimal_case_when() + #self.test_query_decimal_group_by_clause() + #self.test_query_decimal_having_clause() event = threading.Event() diff --git a/tests/system-test/2-query/decimal3.py b/tests/system-test/2-query/decimal3.py new file mode 100644 index 0000000000..c152ddfb8a --- /dev/null +++ b/tests/system-test/2-query/decimal3.py @@ -0,0 +1,2468 @@ +import math +from random import randrange +import random +import time +import threading +import secrets +import numpy + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from decimal import * +from multiprocessing import Value, Lock +from functools import cmp_to_key + +class AtomicCounter: + def __init__(self, initial_value=0): + self._value = Value('i', initial_value) + self._lock = Lock() + + def fetch_add(self, delta = 1): + with self._lock: + old_value = self._value.value + self._value.value += delta + return old_value + +getcontext().prec = 40 + +def get_decimal(val, scale: int) -> Decimal: + if val == 'NULL': + return None + getcontext().prec = 100 + return Decimal(val).quantize(Decimal("1." + "0" * scale), ROUND_HALF_UP) + +syntax_error = -2147473920 +invalid_column = -2147473918 +invalid_compress_level = -2147483084 +invalid_encode_param = -2147483087 +invalid_operation = -2147483136 +scalar_convert_err = -2147470768 + + +decimal_test_query = True +decimal_insert_validator_test = False +operator_test_round = 1 +tb_insert_rows = 1000 +ctb_num = 10 +binary_op_with_const_test = False +binary_op_with_col_test = False +unary_op_test = False +binary_op_in_where_test = True +test_decimal_funcs = True +cast_func_test_round = 10 + +class DecimalTypeGeneratorConfig: + def __init__(self): + self.enable_weight_overflow: bool = False + self.weightOverflowRatio: float = 0.001 + self.enable_scale_overflow: bool = True + self.scale_overflow_ratio = 0.1 + self.enable_positive_sign = False + self.with_corner_case = True + self.corner_case_ratio = 0.1 + self.positive_ratio = 0.7 + self.prec = 38 + self.scale = 10 + + +class DecimalStringRandomGenerator: + def __init__(self): + self.corner_cases = ["0", "NULL", "0.", ".0", "000.000000"] + self.ratio_base: int = 1000000 + + def possible(self, possibility: float) -> bool: + return random.randint(0, self.ratio_base) < possibility * self.ratio_base + + def generate_sign(self, positive_ratio: float) -> str: + if self.possible(positive_ratio): + return "+" + return "-" + + def generate_digit(self) -> str: + return str(random.randint(0, 9)) + + def current_should_generate_corner_case(self, corner_case_ratio: float) -> bool: + return self.possible(corner_case_ratio) + + def generate_corner_case(self, config: DecimalTypeGeneratorConfig) -> str: + if self.possible(0.8): + return random.choice(self.corner_cases) + else: + res = self.generate_digit() * (config.prec - config.scale) + if self.possible(0.8): + res += "." + if self.possible(0.8): + res += self.generate_digit() * config.scale + return res + + ## 写入大整数的例子, 如10000000000, scale解析时可能为负数 + ## Generate decimal with E/e + def generate(self, config: DecimalTypeGeneratorConfig) -> str: + ret: str = "" + sign = self.generate_sign(config.positive_ratio) + if config.with_corner_case and self.current_should_generate_corner_case( + config.corner_case_ratio + ): + ret += self.generate_corner_case(config) + else: + if config.enable_positive_sign or sign != "+": + ret += sign + weight = random.randint(1, config.prec - config.scale) + scale = random.randint(1, config.scale) + for i in range(weight): + ret += self.generate_digit() + + if config.enable_weight_overflow and self.possible( + config.weightOverflowRatio + ): + extra_weight = ( + config.prec + - weight + + 1 + + random.randint(1, self.get_max_prec(config.prec)) + ) + while extra_weight > 0: + ret += self.generate_digit() + extra_weight -= 1 + ret += "." + for i in range(scale): + ret += self.generate_digit() + if config.enable_scale_overflow and self.possible( + config.scale_overflow_ratio + ): + extra_scale = ( + config.scale + - scale + + 1 + + random.randint(1, self.get_max_prec(config.prec)) + ) + while extra_scale > 0: + ret += self.generate_digit() + extra_scale -= 1 + return ret + + def get_max_prec(self, prec): + if prec <= 18: + return 18 + else: + return 38 + + +class DecimalColumnAggregator: + def __init__(self): + self.max: Decimal = Decimal("0") + self.min: Decimal = Decimal("0") + self.count: int = 0 + self.sum: Decimal = Decimal("0") + self.null_num: int = 0 + self.none_num: int = 0 + self.first = None + self.last = None + self.firsts = [] + self.lasts = [] + self.last_row = None + self.last_rows = [] + for i in range(ctb_num): + self.firsts.append(None) + self.lasts.append(None) + self.last_rows.append(None) + def is_stb(self): + return self.firsts[1] is not None + + def get_last(self): + if self.is_stb(): + return self.lasts + return self.last + + def get_last_row(self): + if self.is_stb(): + return self.last_rows + return self.last_row + + def get_first(self): + if self.is_stb(): + return self.firsts + return self.first + + def add_value(self, value: str, scale: int): + self.count += 1 + if value == "NULL": + self.null_num += 1 + self.last_row = None + self.last_rows[int((self.count - 1) / tb_insert_rows)] = None + elif value == "None": + self.none_num += 1 + self.last_row = None + self.last_rows[int((self.count - 1) / tb_insert_rows)] = None + else: + v: Decimal = get_decimal(value, scale) + self.last_row = v + if self.first is None: + self.first = v + if self.firsts[int((self.count - 1) / tb_insert_rows)] is None: + self.firsts[int((self.count - 1) / tb_insert_rows)] = v + self.last = v + self.lasts[int((self.count - 1) / tb_insert_rows)] = v + self.last_rows[int((self.count - 1) / tb_insert_rows)] = v + self.sum += v + if v > self.max: + self.max = v + if v < self.min: + self.min = v + +atomic_counter = AtomicCounter(0) + +class TaosShell: + def __init__(self): + self.counter_ = atomic_counter.fetch_add() + self.queryResult = [] + self.tmp_file_path = "/tmp/taos_shell_result" + + def get_file_path(self): + return f"{self.tmp_file_path}_{self.counter_}" + + def read_result(self): + with open(self.get_file_path(), "r") as f: + lines = f.readlines() + lines = lines[1:] + for line in lines: + col = 0 + vals: list[str] = line.split(",") + if len(self.queryResult) == 0: + self.queryResult = [[] for i in range(len(vals))] + for val in vals: + self.queryResult[col].append(val.strip().strip('"')) + col += 1 + + def query(self, sql: str): + with open(self.get_file_path(), "a+") as f: + f.truncate(0) + self.queryResult = [] + try: + command = f'taos -s "{sql} >> {self.get_file_path()}"' + result = subprocess.run( + command, shell=True, check=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE + ) + self.read_result() + except Exception as e: + tdLog.exit(f"Command '{sql}' failed with error: {e.stderr.decode('utf-8')}") + return self.queryResult + +class DecimalColumnExpr: + def __init__(self, format: str, executor): + self.format_: str = format + self.executor_ = executor + self.params_ = () + self.res_type_: DataType = None + self.query_col: Column = None + + def __str__(self): + return f"({self.format_})".format(*self.params_) + + def execute(self, params): + return self.executor_(self, params) + + def get_query_col_val(self, tbname, i): + return self.query_col.get_val_for_execute(tbname, i) + + def get_val(self, tbname: str, idx: int): + params = () + for p in self.params_: + params = params + (p.get_val(tbname, idx),) + return self.execute(params) + + def convert_to_res_type(self, val: Decimal) -> Decimal: + if self.res_type_.is_decimal_type(): + return get_decimal(val, self.res_type_.scale()) + elif self.res_type_.type == TypeEnum.DOUBLE: + return float(val) + + def get_input_types(self) -> List: + pass + + def should_skip_for_decimal(self, cols: list)->bool: + return False + + def check_query_results(self, query_col_res: List, tbname: str): + query_len = len(query_col_res) + pass + + def check_for_filtering(self, query_col_res: List, tbname: str): + j: int = -1 + for i in range(len(query_col_res)): + j += 1 + v_from_query = query_col_res[i] + while True: + params = () + for p in self.params_: + if isinstance(p, Column) or isinstance(p, DecimalColumnExpr): + p = p.get_val_for_execute(tbname, j) + params = params + (p,) + v_from_calc_in_py = self.execute(params) + + if not v_from_calc_in_py: + j += 1 + continue + else: + break + dec_from_query = Decimal(v_from_query) + dec_from_calc = self.get_query_col_val(tbname, j) + if dec_from_query != dec_from_calc: + tdLog.exit(f"filter with {self} failed, query got: {dec_from_query}, expect {dec_from_calc}, param: {params}") + else: + pass + #tdLog.info(f"filter with {self} succ, query got: {dec_from_query}, expect {dec_from_calc}, param: {params}") + + def check(self, query_col_res: List, tbname: str): + for i in range(len(query_col_res)): + v_from_query = query_col_res[i] + params = () + for p in self.params_: + if isinstance(p, Column) or isinstance(p, DecimalColumnExpr): + p = p.get_val_for_execute(tbname, i) + params = params + (p,) + v_from_calc_in_py = self.execute(params) + + if v_from_calc_in_py == 'NULL' or v_from_query == 'NULL': + if v_from_calc_in_py != v_from_query: + tdLog.exit(f"query with expr: {self} calc in py got: {v_from_calc_in_py}, query got: {v_from_query}") + #tdLog.debug(f"query with expr: {self} calc got same result: NULL") + continue + failed = False + if self.res_type_.type == TypeEnum.BOOL: + query_res = bool(int(v_from_query)) + calc_res = bool(int(v_from_calc_in_py)) + failed = query_res != calc_res + elif isinstance(v_from_calc_in_py, float): + query_res = float(v_from_query) + calc_res = float(v_from_calc_in_py) + failed = not math.isclose(query_res, calc_res, abs_tol=1e-7) + else: + query_res = Decimal(v_from_query) + calc_res = Decimal(v_from_calc_in_py) + failed = query_res != calc_res + if failed: + tdLog.exit( + f"check decimal column failed for expr: {self}, input: {[t.__str__() for t in self.get_input_types()]}, res_type: {self.res_type_}, params: {params}, query: {v_from_query}, expect {calc_res}, but get {query_res}" + ) + else: + pass + #tdLog.info( f"op succ: {self}, in: {[t.__str__() for t in self.get_input_types()]}, res: {self.res_type_}, params: {params}, insert:{v_from_calc_in_py} query:{v_from_query}, py calc: {calc_res}") + + ## format_params are already been set + def generate_res_type(self): + pass + + def generate(self, format_params) -> str: + self.params_ = format_params + self.generate_res_type() + return self.__str__() + + +class TypeEnum: + BOOL = 1 + TINYINT = 2 + SMALLINT = 3 + INT = 4 + BIGINT = 5 + FLOAT = 6 + DOUBLE = 7 + VARCHAR = 8 + TIMESTAMP = 9 + NCHAR = 10 + UTINYINT = 11 + USMALLINT = 12 + UINT = 13 + UBIGINT = 14 + JSON = 15 + VARBINARY = 16 + DECIMAL = 17 + BINARY = 8 + GEOMETRY = 20 + DECIMAL64 = 21 + + @staticmethod + def get_type_prec(type: int): + type_prec = [0, 1, 3, 5, 10, 19, 38, 38, 0, 19, 10, 3, 5, 10, 20, 0, 0, 0, 0, 0, 0, 0] + return type_prec[type] + + @staticmethod + def get_type_str(type: int): + type_str = [ + "", + "BOOL", + "TINYINT", + "SMALLINT", + "INT", + "BIGINT", + "FLOAT", + "DOUBLE", + "VARCHAR", + "TIMESTAMP", + "NCHAR", + "TINYINT UNSIGNED", + "SMALLINT UNSIGNED", + "INT UNSIGNED", + "BIGINT UNSIGNED", + "JSON", + "VARBINARY", + "DECIMAL", + "", + "", + "GEOMETRY", + "DECIMAL", + ] + return type_str[type] + + +class DataType: + def __init__(self, type: int, length: int = 0, type_mod: int = 0): + self.type: int = type + self.length = length + self.type_mod = type_mod + + def __str__(self): + if self.type_mod != 0: + return f"{TypeEnum.get_type_str(self.type)}({self.prec()}, {self.scale()})" + if self.length: + return f"{TypeEnum.get_type_str(self.type)}({self.length})" + return TypeEnum.get_type_str(self.type) + + def __eq__(self, other): + return self.type == other.type and self.length == other.length and self.type_mod == other.type_mod + + def __ne__(self, other): + return not self.__eq__(other) + + def __hash__(self): + return hash((self.type, self.length)) + + def __repr__(self): + return f"DataType({self.type}, {self.length}, {self.type_mod})" + + def is_decimal_type(self): + return self.type == TypeEnum.DECIMAL or self.type == TypeEnum.DECIMAL64 + + def is_varchar_type(self): + return self.type == TypeEnum.VARCHAR or self.type == TypeEnum.NCHAR or self.type == TypeEnum.VARBINARY or self.type == TypeEnum.JSON or self.type == TypeEnum.BINARY + + def is_real_type(self): + return self.type == TypeEnum.FLOAT or self.type == TypeEnum.DOUBLE + + def prec(self): + return 0 + + def scale(self): + return 0 + + ## TODO generate NULL, None + def generate_value(self, has_null = False) -> str: + if self.type == TypeEnum.BOOL: + return ['true', 'false'][secrets.randbelow(2)] + if self.type == TypeEnum.TINYINT: + return str(secrets.randbelow(256) - 128) + if self.type == TypeEnum.SMALLINT: + return str(secrets.randbelow(65536) - 32768) + if self.type == TypeEnum.INT: + return str(secrets.randbelow(4294967296) - 2147483648) + if self.type == TypeEnum.BIGINT: + return str(secrets.randbelow(9223372036854775808) - 4611686018427387904) + if self.type == TypeEnum.FLOAT or self.type == TypeEnum.DOUBLE: + return str(random.random()) + if ( + self.type == TypeEnum.VARCHAR + or self.type == TypeEnum.NCHAR + or self.type == TypeEnum.VARBINARY + ): + return f"'{str(random.random())[0:self.length]}'" + if self.type == TypeEnum.TIMESTAMP: + return str(secrets.randbelow(9223372036854775808)) + if self.type == TypeEnum.UTINYINT: + return str(secrets.randbelow(256)) + if self.type == TypeEnum.USMALLINT: + return str(secrets.randbelow(65536)) + if self.type == TypeEnum.UINT: + return str(secrets.randbelow(4294967296)) + if self.type == TypeEnum.UBIGINT: + return str(secrets.randbelow(9223372036854775808)) + if self.type == TypeEnum.JSON: + return f'{{"key": "{secrets.token_urlsafe(10)}"}}' + if self.type == TypeEnum.GEOMETRY: + return "'POINT(1.0 1.0)'" + raise Exception(f"unsupport type {self.type}") + + def check(self, values, offset: int): + return True + + def get_typed_val_for_execute(self, val, const_col = False): + if self.type == TypeEnum.DOUBLE: + return float(val) + elif self.type == TypeEnum.BOOL: + if val == "true": + return 1 + else: + return 0 + elif self.type == TypeEnum.FLOAT: + if const_col: + val = float(str(numpy.float32(val))) + else: + val = float(numpy.float32(val)) + elif self.type == TypeEnum.DECIMAL or self.type == TypeEnum.DECIMAL64: + return get_decimal(val, self.scale()) + elif isinstance(val, str): + val = val.strip("'") + return val + + def get_typed_val(self, val): + if self.type == TypeEnum.FLOAT: + return float(str(numpy.float32(val))) + elif self.type == TypeEnum.DOUBLE: + return float(val) + return val + + @staticmethod + def get_decimal_types() -> list: + return [TypeEnum.DECIMAL64, TypeEnum.DECIMAL] + + @staticmethod + def get_decimal_op_types()-> list: + return [ + TypeEnum.BOOL, + TypeEnum.TINYINT, + TypeEnum.SMALLINT, + TypeEnum.INT, + TypeEnum.BIGINT, + TypeEnum.FLOAT, + TypeEnum.DOUBLE, + TypeEnum.VARCHAR, + TypeEnum.NCHAR, + TypeEnum.UTINYINT, + TypeEnum.USMALLINT, + TypeEnum.UINT, + TypeEnum.UBIGINT, + TypeEnum.DECIMAL, + TypeEnum.DECIMAL64, + ] + +class DecimalType(DataType): + DECIMAL_MAX_PRECISION = 38 + DECIMAL64_MAX_PRECISION = 18 + def __init__(self, type, precision: int, scale: int): + self.precision_ = precision + self.scale_ = scale + if type == TypeEnum.DECIMAL64: + bytes = 8 + else: + bytes = 16 + super().__init__(type, bytes, self.get_decimal_type_mod()) + self.decimal_generator: DecimalStringRandomGenerator = DecimalStringRandomGenerator() + self.generator_config: DecimalTypeGeneratorConfig = DecimalTypeGeneratorConfig() + #self.generator_config.with_corner_case = False + self.generator_config.prec = precision + self.generator_config.scale = scale + self.aggregator: DecimalColumnAggregator = DecimalColumnAggregator() + self.values: List[str] = [] + + def get_decimal_type_mod(self) -> int: + return self.precision_ * 100 + self.scale() + + def set_prec(self, prec: int): + self.precision_ = prec + self.type_mod = self.get_decimal_type_mod() + + def set_scale(self, scale: int): + self.scale_ = scale + self.type_mod = self.get_decimal_type_mod() + + def prec(self): + return self.precision_ + + def scale(self): + return self.scale_ + + def __str__(self): + return f"DECIMAL({self.precision_}, {self.scale()})" + + def __eq__(self, other: DataType): + return self.precision_ == other.prec() and self.scale() == other.scale() + + def __ne__(self, other): + return not self.__eq__(other) + + def __hash__(self): + return hash((self.precision_, self.scale())) + + def __repr__(self): + return f"DecimalType({self.precision_}, {self.scale()})" + + def generate_value(self, has_null = True) -> str: + tmp = self.generator_config.with_corner_case + self.generator_config.with_corner_case = has_null + val = self.decimal_generator.generate(self.generator_config) + self.aggregator.add_value(val, self.scale()) ## convert to Decimal first + self.generator_config.with_corner_case = tmp + # self.values.append(val) ## save it into files maybe + return val + + def get_typed_val(self, val): + if val == "NULL": + return None + return get_decimal(val, self.scale()) + + def get_typed_val_for_execute(self, val, const_col = False): + return self.get_typed_val(val) + + @staticmethod + def default_compression() -> str: + return "zstd" + + @staticmethod + def default_encode() -> str: + return "disabled" + + def check(self, values, offset: int): + val_from_query = values + val_insert = self.values[offset:] + for v_from_query, v_from_insert in zip(val_from_query, val_insert): + if v_from_insert == "NULL": + if v_from_query.strip() != "NULL": + tdLog.debug( + f"val_insert: {val_insert} val_from_query: {val_from_query}" + ) + tdLog.exit(f"insert NULL, query not NULL: {v_from_query}") + else: + continue + try: + dec_query: Decimal = Decimal(v_from_query) + dec_insert: Decimal = Decimal(v_from_insert) + dec_insert = get_decimal(dec_insert, self.scale()) + except Exception as e: + tdLog.exit(f"failed to convert {v_from_query} or {v_from_insert} to decimal, {e}") + return False + if dec_query != dec_insert: + tdLog.exit( + f"check decimal column failed for insert: {v_from_insert}, query: {v_from_query}, expect {dec_insert}, but get {dec_query}" + ) + return False + else: + tdLog.debug( + f"check decimal succ, insert:{v_from_insert} query:{v_from_query}, py dec: {dec_insert}" + ) + + + @staticmethod + def decimal_type_from_other_type(other: DataType): + prec = 0 + return DecimalType(other.type, other.length, other.type_mod) + +class Column: + def __init__(self, type: DataType): + self.type_: DataType = type + self.name_: str = "" + self.saved_vals:dict[str:[]] = {} + + def is_constant_col(self): + return '' in self.saved_vals.keys() + + def get_typed_val(self, val): + return self.type_.get_typed_val(val) + + def get_typed_val_for_execute(self, val, const_col = False): + return self.type_.get_typed_val_for_execute(val, const_col) + + def get_constant_val(self): + return self.get_typed_val(self.saved_vals[''][0]) + + def get_constant_val_for_execute(self): + return self.get_typed_val_for_execute(self.saved_vals[''][0], const_col=True) + + def __str__(self): + if self.is_constant_col(): + return str(self.get_constant_val()) + return self.name_ + + def get_val_for_execute(self, tbname: str, idx: int): + if self.is_constant_col(): + return self.get_constant_val_for_execute() + if len(self.saved_vals) > 1: + for key in self.saved_vals.keys(): + l = len(self.saved_vals[key]) + if idx < l: + return self.get_typed_val_for_execute(self.saved_vals[key][idx]) + else: + idx -= l + return self.get_typed_val_for_execute(self.saved_vals[tbname][idx]) + + def get_cardinality(self, tbname): + if self.is_constant_col(): + return 1 + elif len(self.saved_vals) > 1: + return len(self.saved_vals['t0']) + else: + return len(self.saved_vals[tbname]) + + @staticmethod + def comp_key(key1, key2): + if key1 is None: + return -1 + if key2 is None: + return 1 + return key1 - key2 + + def get_ordered_result(self, tbname: str, asc: bool) -> list: + if tbname in self.saved_vals: + return sorted( + [ + get_decimal(val, self.type_.scale()) + for val in self.saved_vals[tbname] + ], + reverse=not asc, + key=cmp_to_key(Column.comp_key) + ) + else: + res = [] + for val in self.saved_vals.values(): + res.extend(val) + return sorted( + [get_decimal(val, self.type_.scale()) for val in res], reverse=not asc, + key=cmp_to_key(Column.comp_key) + ) + + def get_group_num(self, tbname, ignore_null=False) -> int: + if tbname in self.saved_vals: + s = set(get_decimal(val, self.type_.scale()) for val in self.saved_vals[tbname]) + if ignore_null: + s.remove(None) + return len(s) + else: + res = set() + for vals in self.saved_vals.values(): + for v in vals: + res.add(get_decimal(v, self.type_.scale())) + if ignore_null: + res.remove(None) + return len(res) + + ## tbName: for normal table, pass the tbname, for child table, pass the child table name + def generate_value(self, tbName: str = '', save: bool = True, has_null = True): + val = self.type_.generate_value(has_null=has_null) + if save: + if tbName not in self.saved_vals: + self.saved_vals[tbName] = [] + ## for constant columns, always replace the last val + if self.is_constant_col(): + self.saved_vals[tbName] = [val] + else: + self.saved_vals[tbName].append(val) + return val + + def get_type_str(self) -> str: + return str(self.type_) + + def set_name(self, name: str): + self.name_ = name + + def check(self, values, offset: int): + return self.type_.check(values, offset) + + def construct_type_value(self, val: str): + if ( + self.type_.type == TypeEnum.BINARY + or self.type_.type == TypeEnum.VARCHAR + or self.type_.type == TypeEnum.NCHAR + or self.type_.type == TypeEnum.VARBINARY + or self.type_.type == TypeEnum.JSON + ): + return f"'{val}'" + else: + return val + + @staticmethod + def get_decimal_unsupported_types() -> list: + return [ + TypeEnum.JSON, + TypeEnum.GEOMETRY, + TypeEnum.VARBINARY, + ] + + @staticmethod + def get_decimal_oper_const_cols() -> list: + types_unable_to_be_const = [ + TypeEnum.TINYINT, + TypeEnum.SMALLINT, + TypeEnum.INT, + TypeEnum.UINT, + TypeEnum.USMALLINT, + TypeEnum.UTINYINT, + TypeEnum.UBIGINT, + ] + return Column.get_all_type_columns( + Column.get_decimal_unsupported_types() + + Column.get_decimal_types() + + types_unable_to_be_const + ) + + @staticmethod + def get_decimal_types() -> List: + return [TypeEnum.DECIMAL, TypeEnum.DECIMAL64] + + @staticmethod + def get_all_type_columns(types_to_exclude: List[TypeEnum] = []) -> List: + all_types = [ + Column(DataType(TypeEnum.BOOL)), + Column(DataType(TypeEnum.TINYINT)), + Column(DataType(TypeEnum.SMALLINT)), + Column(DataType(TypeEnum.INT)), + Column(DataType(TypeEnum.BIGINT)), + Column(DataType(TypeEnum.FLOAT)), + Column(DataType(TypeEnum.DOUBLE)), + Column(DataType(TypeEnum.VARCHAR, 255)), + Column(DataType(TypeEnum.TIMESTAMP)), + Column(DataType(TypeEnum.NCHAR, 255)), + Column(DataType(TypeEnum.UTINYINT)), + Column(DataType(TypeEnum.USMALLINT)), + Column(DataType(TypeEnum.UINT)), + Column(DataType(TypeEnum.UBIGINT)), + Column(DataType(TypeEnum.JSON)), + Column(DataType(TypeEnum.VARBINARY, 255)), + Column(DecimalType(TypeEnum.DECIMAL, 38, 10)), + Column(DataType(TypeEnum.BINARY, 255)), + Column(DataType(TypeEnum.GEOMETRY, 10240)), + Column(DecimalType(TypeEnum.DECIMAL64, 18, 4)), + ] + ret = [] + for c in all_types: + found = False + for type in types_to_exclude: + if c.type_.type == type: + found = True + break + if not found: + ret.append(c) + return ret + + +class DecimalColumnTableCreater: + def __init__( + self, + conn, + dbName: str, + tbName: str, + columns: List[Column], + tags_cols: List[Column] = [], + col_prefix: str = "c", + tag_prefix: str = "t", + ): + self.conn = conn + self.dbName = dbName + self.tbName = tbName + self.tags_cols = tags_cols + self.columns: List[Column] = columns + self.col_prefix = col_prefix + self.tag_prefix = tag_prefix + + def create(self): + if len(self.tags_cols) > 0: + table = "stable" + else: + table = "table" + sql = f"create {table} {self.dbName}.{self.tbName} (ts timestamp" + for i, column in enumerate(self.columns): + tbname = f"{self.col_prefix}{i+1}" + sql += f", {tbname} {column.get_type_str()}" + column.set_name(tbname) + if self.tags_cols: + sql += ") tags(" + for i, tag in enumerate(self.tags_cols): + tagname = f"{self.tag_prefix}{i+1}" + sql += f"{tagname} {tag.get_type_str()}" + tag.set_name(tagname) + if i != len(self.tags_cols) - 1: + sql += ", " + sql += ")" + self.conn.execute(sql, queryTimes=1) + + def create_child_table( + self, + ctbPrefix: str, + ctbNum: int, + tag_cols: List[Column], + tag_values: List[str], + ): + for i in range(ctbNum): + tbname = f"{ctbPrefix}{i}" + sql = f"create table {self.dbName}.{tbname} using {self.dbName}.{self.tbName} tags(" + for j, tag in enumerate(tag_cols): + sql += f"{tag.construct_type_value(tag_values[j])}" + if j != len(tag_cols) - 1: + sql += ", " + sql += ")" + self.conn.execute(sql, queryTimes=1) + + +class TableInserter: + def __init__( + self, + conn, + dbName: str, + tbName: str, + columns: List[Column], + tags_cols: List[Column] = [], + ): + self.conn: TDSql = conn + self.dbName = dbName + self.tbName = tbName + self.tag_cols = tags_cols + self.columns = columns + + def insert(self, rows: int, start_ts: int, step: int, flush_database: bool = False): + pre_insert = f"insert into {self.dbName}.{self.tbName} values" + sql = pre_insert + t = datetime.now() + for i in range(rows): + sql += f"({start_ts + i * step}" + for column in self.columns: + sql += f", {column.generate_value(self.tbName)}" + sql += ")" + if i != rows - 1: + sql += ", " + local_flush_database = i % 5000 == 0 + if len(sql) > 1000: + # tdLog.debug(f"insert into with sql{sql}") + if flush_database and local_flush_database: + self.conn.execute(f"flush database {self.dbName}", queryTimes=1) + self.conn.execute(sql, queryTimes=1) + t1 = datetime.now() + if (t1 - t).seconds > 1: + TaosShell().query(f"select last(c1), last(c2) from {self.dbName}.{self.tbName}") + t = t1 + sql = pre_insert + if len(sql) > len(pre_insert): + # tdLog.debug(f"insert into with sql{sql}") + if flush_database: + self.conn.execute(f"flush database {self.dbName}", queryTimes=1) + self.conn.execute(sql, queryTimes=1) + TaosShell().query(f"select last(c1), last(c2) from {self.dbName}.{self.tbName}") + +class DecimalCastTypeGenerator: + def __init__(self, input_type: DataType): + self.input_type_: DataType = input_type + + def get_possible_output_types(self) -> List[int]: + if not self.input_type_.is_decimal_type(): + return DataType.get_decimal_types() + else: + return DataType.get_decimal_op_types() + + def do_generate_type(self, dt: int) ->DataType: + if dt == TypeEnum.DECIMAL: + prec = random.randint(1, DecimalType.DECIMAL_MAX_PRECISION) + return DecimalType(dt, prec, random.randint(0, prec)) + elif dt == TypeEnum.DECIMAL64: + prec = random.randint(1, DecimalType.DECIMAL64_MAX_PRECISION) + return DecimalType(dt, prec, random.randint(0, prec)) + elif dt == TypeEnum.BINARY or dt == TypeEnum.VARCHAR: + return DataType(dt, random.randint(16, 255), 0) + else: + return DataType(dt, 0, 0) + + def generate(self, num: int) -> List[DataType]: + res: list[DataType] = [] + for _ in range(num): + dt = random.choice(self.get_possible_output_types()) + dt = self.do_generate_type(dt) + res.append(dt) + res = list(set(res)) + return res + +class TableDataValidator: + def __init__(self, columns: List[Column], tbName: str, dbName: str, tbIdx: int = 0): + self.columns = columns + self.tbName = tbName + self.dbName = dbName + self.tbIdx = tbIdx + + def validate(self): + if not decimal_insert_validator_test: + return + sql = f"select * from {self.dbName}.{self.tbName}" + res = TaosShell().query(sql) + row_num = len(res[1]) + colIdx = 1 + for col in self.columns: + if ( + col.type_.type == TypeEnum.DECIMAL + or col.type_.type == TypeEnum.DECIMAL64 + ): + col.check(res[colIdx], row_num * self.tbIdx) + colIdx += 1 + +class DecimalFunction(DecimalColumnExpr): + def __init__(self, format, executor, name: str): + super().__init__(format, executor) + self.func_name_ = name + + def is_agg_func(self, op: str) ->bool: + return False + + def get_func_res(self): + return None + + def get_input_types(self): + return [self.query_col] + + @staticmethod + def get_decimal_agg_funcs() -> List: + return [ + DecimalMinFunction(), + DecimalMaxFunction(), + DecimalSumFunction(), + DecimalAvgFunction(), + DecimalCountFunction(), + DecimalLastRowFunction(), + DecimalLastFunction(), + DecimalFirstFunction(), + ] + + def check_results(self, query_col_res: List) -> bool: + return False + + def check_for_agg_func(self, query_col_res: List, tbname: str, func, is_stb: bool = False): + col_expr = self.query_col + for i in range(col_expr.get_cardinality(tbname)): + col_val = col_expr.get_val_for_execute(tbname, i) + self.execute((col_val,)) + if not self.check_results(query_col_res): + tdLog.exit(f"check failed for {self}, query got: {query_col_res}, expect {self.get_func_res()}") + else: + tdLog.info(f"check expr: {func} with val: {col_val} got result: {query_col_res}, expect: {self.get_func_res()}") + +class DecimalCastFunction(DecimalFunction): + def __init__(self): + super().__init__("cast({0} as {1})", DecimalCastFunction.execute_cast, "cast") + + def should_skip_for_decimal(self, cols: list)->bool: + return False + + def check_results(self, query_col_res: List) -> bool: + return False + + def generate_res_type(self)->DataType: + self.query_col = self.params_[0] + self.res_type_ = self.params_[1] + return self.res_type_ + + def check(self, res: list, tbname: str): + calc_res = [] + params = [] + for i in range(self.query_col.get_cardinality(tbname)): + val = self.query_col.get_val_for_execute(tbname, i) + params.append(val) + try: + calc_val = self.execute(val) + except OverflowError as e: + tdLog.info(f"execute {self} overflow for param: {val}") + calc_res = [] + break + calc_res.append(calc_val) + if len(calc_res) != len(res): + tdLog.exit(f"check result for {self} failed len got: {len(res)}, expect: {len(calc_res)}") + if len(calc_res) == 0: + return True + for v, calc_v, p in zip(res, calc_res, params): + query_v = self.execute_cast(v) + if isinstance(calc_v, float): + eq = math.isclose(query_v, calc_v, rel_tol=1e-7) + elif isinstance(calc_v, numpy.float32): + eq = math.isclose(query_v, calc_v, abs_tol=1e-6, rel_tol=1e-6) + elif isinstance(p, float) or isinstance(p, str): + eq = math.isclose(query_v, calc_v, rel_tol=1e-7) + else: + eq = query_v == calc_v + if not eq: + tdLog.exit(f"check result for {self} failed with param: {p} query got: {v}, expect: {calc_v}") + return True + + def execute_cast(self, val): + if val is None or val == 'NULL': + return None + if self.res_type_.type == TypeEnum.BOOL: + return Decimal(val) != 0 + elif self.res_type_.type == TypeEnum.TINYINT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFF + elif self.res_type_.type == TypeEnum.SMALLINT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFFFF + elif self.res_type_.type == TypeEnum.INT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFFFFFFFF + elif self.res_type_.type == TypeEnum.BIGINT or self.res_type_.type == TypeEnum.TIMESTAMP: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFFFFFFFFFFFFFFFF + elif self.res_type_.type == TypeEnum.FLOAT: + return numpy.float32(val) + elif self.res_type_.type == TypeEnum.DOUBLE: + return float(val) + elif self.res_type_.type == TypeEnum.VARCHAR or self.res_type_.type == TypeEnum.NCHAR: + if Decimal(val) == 0: + return "0" + return str(val)[0:self.res_type_.length] + elif self.res_type_.type == TypeEnum.UTINYINT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFF + elif self.res_type_.type == TypeEnum.USMALLINT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFFFF + elif self.res_type_.type == TypeEnum.UINT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFFFFFFFF + elif self.res_type_.type == TypeEnum.UBIGINT: + dec = Decimal(val).quantize(Decimal("1"), ROUND_HALF_UP) + return int(dec) & 0xFFFFFFFFFFFFFFFF + elif self.res_type_.is_decimal_type(): + max: Decimal = Decimal( + "9" * (self.res_type_.prec() - self.res_type_.scale()) + + "." + + "9" * self.res_type_.scale() + ) + if max < get_decimal(val, self.res_type_.scale()): + raise OverflowError() + try: + return get_decimal(val, self.res_type_.scale()) + except Exception as e: + tdLog.exit(f"failed to cast {val} to {self.res_type_}, {e}") + else: + raise Exception(f"cast unsupported type {self.res_type_.type}") + +class DecimalAggFunction(DecimalFunction): + def __init__(self, format, executor, name: str): + super().__init__(format, executor, name) + + def is_agg_func(self, op: str)-> bool: + return True + + def should_skip_for_decimal(self, cols: list)-> bool: + col: Column = cols[0] + if col.type_.is_decimal_type(): + return False + return True + + def check_results(self, query_col_res): + if len(query_col_res) == 0: + tdLog.info(f"query got no output: {self}, py calc: {self.get_func_res()}") + return True + else: + return self.get_func_res() == Decimal(query_col_res[0]) + +class DecimalFirstLastFunction(DecimalAggFunction): + def __init__(self, format: str, func, name): + super().__init__(format, func, name) + def generate_res_type(self): + self.res_type_ = self.query_col.type_ + def check_results(self, query_col_res): + if len(query_col_res) == 0: + tdLog.exit(f"query got no output: {self}, py calc: {self.get_func_res()}") + else: + v = get_decimal(query_col_res[0], self.query_col.type_.scale()) + decimal_type: DecimalType = self.query_col.type_ + if decimal_type.aggregator.is_stb(): + return v in self.get_func_res() + else: + return self.get_func_res() == v + +class DecimalLastRowFunction(DecimalFirstLastFunction): + def __init__(self): + super().__init__("last_row({0})", DecimalLastRowFunction.execute_last_row, "last_row") + def get_func_res(self): + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.get_last_row() + def execute_last_row(self, params): + pass + +class DecimalCacheLastRowFunction(DecimalAggFunction): + def __init__(self): + super().__init__("_cache_last_row({0})", DecimalCacheLastRowFunction.execute_cache_last_row, "_cache_last_row") + def get_func_res(self): + return 1 + def generate_res_type(self): + self.res_type_ = self.query_col.type_ + def execute_cache_last_row(self, params): + return 1 + +class DecimalCacheLastFunction(DecimalAggFunction): + pass + +class DecimalFirstFunction(DecimalFirstLastFunction): + def __init__(self): + super().__init__("first({0})", DecimalFirstFunction.execute_first, "first") + def get_func_res(self): + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.get_first() + def execute_first(self, params): + pass + +class DecimalLastFunction(DecimalFirstLastFunction): + def __init__(self): + super().__init__("last({0})", DecimalLastFunction.execute_last, "last") + self.res_ = None + def get_func_res(self): + decimal_type:DecimalType = self.query_col.type_ + return decimal_type.aggregator.get_last() + def execute_last(self, params): + pass + +class DecimalHyperloglogFunction(DecimalAggFunction): + pass + +class DecimalSampleFunction(DecimalAggFunction): + pass + +class DecimalTailFunction(DecimalAggFunction): + pass + +class DecimalUniqueFunction(DecimalAggFunction): + pass + +class DecimalModeFunction(DecimalAggFunction): + pass + +class DecimalCountFunction(DecimalAggFunction): + def __init__(self): + super().__init__("count({0})", DecimalCountFunction.execute_count, "count") + def get_func_res(self): + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.count - decimal_type.aggregator.null_num + def generate_res_type(self): + self.res_type_ = DataType(TypeEnum.BIGINT, 8, 0) + + def execute_count(self, params): + return 1 + +class DecimalMinFunction(DecimalAggFunction): + def __init__(self): + super().__init__("min({0})", DecimalMinFunction.execute_min, "min") + self.min_: Decimal = None + + def get_func_res(self) -> Decimal: + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.min + + def generate_res_type(self) -> DataType: + self.res_type_ = self.query_col.type_ + + def execute_min(self, params): + pass + +class DecimalMaxFunction(DecimalAggFunction): + def __init__(self): + super().__init__("max({0})", DecimalMaxFunction.execute_max, "max") + self.max_: Decimal = None + + def get_func_res(self) -> Decimal: + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.max + + def generate_res_type(self) -> DataType: + self.res_type_ = self.query_col.type_ + + def execute_max(self, params): + pass + +class DecimalSumFunction(DecimalAggFunction): + def __init__(self): + super().__init__("sum({0})", DecimalSumFunction.execute_sum, "sum") + self.sum_:Decimal = None + def get_func_res(self) -> Decimal: + decimal_type: DecimalType = self.query_col.type_ + return decimal_type.aggregator.sum + def generate_res_type(self) -> DataType: + self.res_type_ = self.query_col.type_ + self.res_type_.set_prec(DecimalType.DECIMAL_MAX_PRECISION) + def execute_sum(self, params): + pass + +class DecimalAvgFunction(DecimalAggFunction): + def __init__(self): + super().__init__("avg({0})", DecimalAvgFunction.execute_avg, "avg") + def get_func_res(self) -> Decimal: + decimal_type: DecimalType = self.query_col.type_ + return get_decimal( + decimal_type.aggregator.sum + / (decimal_type.aggregator.count - decimal_type.aggregator.null_num), + self.res_type_.scale(), + ) + def generate_res_type(self) -> DataType: + sum_type = self.query_col.type_ + sum_type.set_prec(DecimalType.DECIMAL_MAX_PRECISION) + count_type = DataType(TypeEnum.BIGINT, 8, 0) + self.res_type_ = DecimalBinaryOperator.calc_decimal_prec_scale(sum_type, count_type, "/") + def execute_avg(self, params): + pass + +class DecimalBinaryOperator(DecimalColumnExpr): + def __init__(self, format, executor, op: str): + super().__init__(format, executor) + self.op_ = op + self.left_type_: DataType = None + self.right_type_: DataType = None + + def __str__(self): + return super().__str__() + + def generate(self, format_params) -> str: + return super().generate(format_params) + + def should_skip_for_decimal(self, cols: list): + left_col = cols[0] + right_col = cols[1] + if not left_col.type_.is_decimal_type() and not right_col.type_.is_decimal_type(): + return True + if self.op_ != "%": + return False + ## TODO wjm why skip decimal % float/double? it's wrong now. + left_is_real = left_col.type_.is_real_type() or left_col.type_.is_varchar_type() + right_is_real = right_col.type_.is_real_type() or right_col.type_.is_varchar_type() + if left_is_real or right_is_real: + return True + return False + + @staticmethod + def check_null(params): + if params[0] is None or params[1] is None: + return True + else: + return False + + @staticmethod + def is_compare_op(op: str)-> bool: + return op in ["==", "!=", ">", "<", ">=", "<="] + + @staticmethod + def calc_decimal_prec_scale(left: DataType, right: DataType, op: str) -> DecimalType: + left_prec = 0 + left_scale = 0 + right_prec = 0 + right_scale = 0 + if not left.is_decimal_type(): + left_prec = TypeEnum.get_type_prec(left.type) + else: + left_prec = left.prec() + left_scale = left.scale() + if not right.is_decimal_type(): + right_prec = TypeEnum.get_type_prec(right.type) + else: + right_prec = right.prec() + right_scale = right.scale() + + out_prec = 0 + out_scale = 0 + if op in ['+', '-']: + out_scale = max(left_scale, right_scale) + out_prec = max(left_prec - left_scale, right_prec - right_scale) + out_scale + 1 + elif op == '*': + out_scale = left_scale + right_scale + out_prec = left_prec + right_prec + 1 + elif op == '/': + out_scale = max(left_scale + right_prec + 1, 6) + out_prec = left_prec - left_scale + right_scale + out_scale + elif op == '%': + out_scale = max(left_scale, right_scale) + out_prec = min(left_prec - left_scale, right_prec - right_scale) + out_scale + else: + raise Exception(f"unknown op for binary operators: {op}") + + if out_prec > 38: + min_scale = min(6, out_scale) + delta = out_prec - 38 + out_prec = 38 + out_scale = max(min_scale, out_scale - delta) + return DecimalType(TypeEnum.DECIMAL, out_prec, out_scale) + + def generate_res_type(self): + left_type = self.params_[0].type_ + right_type = self.params_[1].type_ + self.left_type_ = left_type + self.right_type_ = right_type + if DecimalBinaryOperator.is_compare_op(self.op_): + self.res_type_ = DataType(TypeEnum.BOOL) + else: + ret_double_types = [TypeEnum.VARCHAR, TypeEnum.BINARY, TypeEnum.DOUBLE, TypeEnum.FLOAT, TypeEnum.NCHAR] + if left_type.type in ret_double_types or right_type.type in ret_double_types: + self.res_type_ = DataType(TypeEnum.DOUBLE) + else: + self.res_type_ = DecimalBinaryOperator.calc_decimal_prec_scale(left_type, right_type, self.op_) + + def get_input_types(self)-> list: + return [self.left_type_, self.right_type_] + + def get_convert_type(self, params): + ret_float = False + if isinstance(params[0], float) or isinstance(params[1], float): + ret_float = True + left = params[0] + right = params[1] + if isinstance(params[0], str): + ret_float = True + if isinstance(params[1], str): + ret_float = True + return (left, right), ret_float + + def execute_plus(self, params): + if DecimalBinaryOperator.check_null(params): + return 'NULL' + (left, right), ret_float = self.get_convert_type(params) + if self.res_type_.type == TypeEnum.DOUBLE: + return float(left) + float(right) + else: + return self.convert_to_res_type(Decimal(left) + Decimal(right)) + + def execute_minus(self, params): + if DecimalBinaryOperator.check_null(params): + return 'NULL' + (left, right), ret_float = self.get_convert_type(params) + if self.res_type_.type == TypeEnum.DOUBLE: + return float(left) - float(right) + else: + return self.convert_to_res_type(Decimal(left) - Decimal(right)) + + def execute_mul(self, params): + if DecimalBinaryOperator.check_null(params): + return 'NULL' + (left, right), ret_float = self.get_convert_type(params) + if self.res_type_.type == TypeEnum.DOUBLE: + return float(left) * float(right) + else: + return self.convert_to_res_type(Decimal(left) * Decimal(right)) + + def execute_div(self, params): + if DecimalBinaryOperator.check_null(params): + return 'NULL' + (left, right), _ = self.get_convert_type(params) + if self.res_type_.type == TypeEnum.DOUBLE: + if right == 0: + return 'NULL' + return float(left) / float(right) + else: + return self.convert_to_res_type(Decimal(left) / Decimal(right)) + + def execute_mod(self, params): + if DecimalBinaryOperator.check_null(params): + return 'NULL' + (left, right), _ = self.get_convert_type(params) + if self.res_type_.type == TypeEnum.DOUBLE: + return self.convert_to_res_type(Decimal(left) % Decimal(right)) + else: + return self.convert_to_res_type(Decimal(left) % Decimal(right)) + + def execute_eq(self, params): + if DecimalBinaryOperator.check_null(params): + return False + (left, right), convert_float = self.get_convert_type(params) + if convert_float: + return float(left) == float(right) + else: + return Decimal(left) == Decimal(right) + + def execute_eq_filtering(self, params): + if self.execute_eq(params): + return True + + def execute_ne(self, params): + if DecimalBinaryOperator.check_null(params): + return False + (left, right), convert_float = self.get_convert_type(params) + if convert_float: + return float(left) != float(right) + else: + return Decimal(left) != Decimal(right) + + def execute_gt(self, params): + if DecimalBinaryOperator.check_null(params): + return False + (left, right), convert_float = self.get_convert_type(params) + if convert_float: + return float(left) > float(right) + else: + return Decimal(left) > Decimal(right) + + def execute_lt(self, params): + if DecimalBinaryOperator.check_null(params): + return False + (left, right), convert_float = self.get_convert_type(params) + if convert_float: + return float(left) < float(right) + else: + return Decimal(left) < Decimal(right) + + def execute_ge(self, params): + if DecimalBinaryOperator.check_null(params): + return False + (left, right), convert_float = self.get_convert_type(params) + if convert_float: + return float(left) >= float(right) + else: + return Decimal(left) >= Decimal(right) + + def execute_le(self, params): + if DecimalBinaryOperator.check_null(params): + return False + (left, right), convert_float = self.get_convert_type(params) + if convert_float: + return float(left) <= float(right) + else: + return Decimal(left) <= Decimal(right) + + @staticmethod + def get_all_binary_ops() -> List[DecimalColumnExpr]: + return [ + DecimalBinaryOperator(" {0} + {1} ", DecimalBinaryOperator.execute_plus, "+"), + DecimalBinaryOperator(" {0} - {1} ", DecimalBinaryOperator.execute_minus, "-"), + DecimalBinaryOperator(" {0} * {1} ", DecimalBinaryOperator.execute_mul, "*"), + DecimalBinaryOperator(" {0} / {1} ", DecimalBinaryOperator.execute_div, "/"), + DecimalBinaryOperator(" {0} % {1} ", DecimalBinaryOperator.execute_mod, "%"), + DecimalBinaryOperator(" {0} == {1} ", DecimalBinaryOperator.execute_eq, "=="), + DecimalBinaryOperator(" {0} != {1} ", DecimalBinaryOperator.execute_ne, "!="), + DecimalBinaryOperator(" {0} > {1} ", DecimalBinaryOperator.execute_gt, ">"), + DecimalBinaryOperator(" {0} < {1} ", DecimalBinaryOperator.execute_lt, "<"), + DecimalBinaryOperator(" {0} >= {1} ", DecimalBinaryOperator.execute_ge, ">="), + DecimalBinaryOperator(" {0} <= {1} ", DecimalBinaryOperator.execute_le, "<="), + ] + + @staticmethod + def get_all_filtering_binary_compare_ops() -> List[DecimalColumnExpr]: + return [ + DecimalBinaryOperator(" {0} == {1} ", DecimalBinaryOperator.execute_eq, "=="), + DecimalBinaryOperator(" {0} != {1} ", DecimalBinaryOperator.execute_ne, "!="), + DecimalBinaryOperator(" {0} > {1} ", DecimalBinaryOperator.execute_gt, ">"), + DecimalBinaryOperator(" {0} < {1} ", DecimalBinaryOperator.execute_lt, "<"), + DecimalBinaryOperator(" {0} >= {1} ", DecimalBinaryOperator.execute_ge, ">="), + DecimalBinaryOperator(" {0} <= {1} ", DecimalBinaryOperator.execute_le, "<="), + ] + + def execute(self, params): + return super().execute(params) + +class DecimalUnaryOperator(DecimalColumnExpr): + def __init__(self, format, executor, op: str): + super().__init__(format, executor) + self.op_ = op + self.col_type_: DataType = None + + def should_skip_for_decimal(self, cols: list): + col:Column = cols[0] + if not col.type_.is_decimal_type(): + return True + return False + + @staticmethod + def get_all_unary_ops() -> List[DecimalColumnExpr]: + return [ + DecimalUnaryOperator(" -{0} ", DecimalUnaryOperator.execute_minus, "-"), + ] + + def get_input_types(self)-> list: + return [self.col_type_] + + def generate_res_type(self): + self.res_type_ = self.col_type_ = self.params_[0].type_ + + def execute_minus(self, params) -> Decimal: + if params[0] is None: + return 'NULL' + return -Decimal(params[0]) + +class DecimalBinaryOperatorIn(DecimalBinaryOperator): + def __init__(self, op: str): + super().__init__(op) + + def execute(self, left, right): + if self.op_.lower()() == "in": + return left in right + if self.op_.lower() == "not in": + return left not in right + + +class TDTestCase: + updatecfgDict = { + "asynclog": 0, + "ttlUnit": 1, + "ttlPushInterval": 5, + "ratioOfVnodeStreamThrea": 4, + "debugFlag": 143, + } + + def __init__(self): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + self.duraion = "1h" + self.norm_tb_columns = [] + self.tags = [] + self.stable_name = "meters" + self.norm_table_name = "nt" + self.col_prefix = "c" + self.c_table_prefix = "t" + self.tag_name_prefix = "t" + self.db_name = "test" + self.c_table_num = ctb_num + self.no_decimal_col_tb_name = "tt" + self.stb_columns = [] + self.stream_name = "stream1" + self.stream_out_stb = "stream_out_stb" + self.tsma_name = "tsma1" + self.query_test_round = 10000 + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def check_desc_for_one_ctb( + self, ctbPrefix: str, columns: List[Column], tags: List[Column] = [] + ): + ctb_idx = randrange(self.c_table_num) + return self.check_desc(f"{ctbPrefix}{ctb_idx}", columns, tags) + + def check_desc(self, tbname: str, columns: List[Column], tags: List[Column] = []): + sql = f"desc {self.db_name}.{tbname}" + tdSql.query(sql, queryTimes=1) + results = tdSql.queryResult + for i, col in enumerate(columns): + if col.type_.type == TypeEnum.DECIMAL: + if results[i + 1][1] != col.type_.__str__(): + tdLog.info(str(results)) + tdLog.exit( + f"check desc failed for table: {tbname} column {results[i+1][0]} type is {results[i+1][1]}, expect {col.type_}" + ) + if results[i + 1][4] != DecimalType.default_encode(): + tdLog.exit( + f"check desc failed for table: {tbname} column {results[i+1][0]} encode is {results[i+1][5]}, expect {DecimalType.default_encode()}" + ) + if results[i + 1][5] != DecimalType.default_compression(): + tdLog.exit( + f"check desc failed for table: {tbname} column {results[i+1][0]} compression is {results[i+1][4]}, expect {DecimalType.default_compression()}" + ) + if tbname == self.stable_name: + self.check_desc_for_one_ctb(self.c_table_prefix, columns, tags) + + def check_show_create_table( + self, tbname: str, cols: List[Column], tags: List[Column] = [] + ): + sql = f"show create table {self.db_name}.{tbname}" + tdSql.query(sql, queryTimes=1) + create_table_sql = tdSql.queryResult[0][1] + decimal_idx = 0 + results = re.findall(r"DECIMAL\((\d+),(\d+)\)", create_table_sql) + for i, col in enumerate(cols): + if ( + col.type_.type == TypeEnum.DECIMAL + or col.type_.type == TypeEnum.DECIMAL64 + ): + result_type = DecimalType( + col.type_.type, + int(results[decimal_idx][0]), + int(results[decimal_idx][1]), + ) + if result_type != col.type_: + tdLog.exit( + f"check show create table failed for: {tbname} column {i} type is {result_type}, expect {col.type}" + ) + decimal_idx += 1 + + def test_add_drop_columns_with_decimal(self, tbname: str, columns: List[Column]): + is_stb = tbname == self.stable_name + ## alter table add column + create_c99_sql = ( + f"alter table {self.db_name}.{tbname} add column c99 decimal(37, 19)" + ) + columns.append(Column(DecimalType(TypeEnum.DECIMAL, 37, 19))) + tdSql.execute(create_c99_sql, queryTimes=1, show=True) + self.check_desc(tbname, columns) + ## alter table add column with compression + create_c100_sql = f'ALTER TABLE {self.db_name}.{tbname} ADD COLUMN c100 decimal(36, 18) COMPRESS "zstd"' + tdSql.execute(create_c100_sql, queryTimes=1, show=True) + columns.append(Column(DecimalType(TypeEnum.DECIMAL, 36, 18))) + self.check_desc(tbname, columns) + + ## drop non decimal column + drop_c6_sql = f"alter table {self.db_name}.{tbname} drop column c6" + tdSql.execute(drop_c6_sql, queryTimes=1, show=True) + c6 = columns.pop(5) + self.check_desc(tbname, columns) + ## drop decimal column and not last column + drop_c99_sql = f"alter table {self.db_name}.{tbname} drop column c99" + tdSql.execute(drop_c99_sql, queryTimes=1, show=True) + c99 = columns.pop(len(columns) - 2) + self.check_desc(tbname, columns) + ## drop decimal column and last column + drop_c100_sql = f"alter table {self.db_name}.{tbname} drop column c100" + tdSql.execute(drop_c100_sql, queryTimes=1, show=True) + c100 = columns.pop(len(columns) - 1) + self.check_desc(tbname, columns) + + ## create decimal back + tdSql.execute(create_c99_sql, queryTimes=1, show=True) + tdSql.execute(create_c100_sql, queryTimes=1, show=True) + columns.append(c99) + columns.append(c100) + self.check_desc(tbname, columns) + + def test_decimal_column_ddl(self): + ## create decimal type table, normal/super table, decimal64/decimal128 + tdLog.printNoPrefix("-------- test create decimal column") + self.norm_tb_columns: List[Column] = [ + Column(DecimalType(TypeEnum.DECIMAL, 10, 2)), + Column(DecimalType(TypeEnum.DECIMAL, 20, 4)), + Column(DecimalType(TypeEnum.DECIMAL, 30, 8)), + Column(DecimalType(TypeEnum.DECIMAL, 38, 10)), + Column(DataType(TypeEnum.TINYINT)), + Column(DataType(TypeEnum.INT)), + Column(DataType(TypeEnum.BIGINT)), + Column(DataType(TypeEnum.DOUBLE)), + Column(DataType(TypeEnum.FLOAT)), + Column(DataType(TypeEnum.VARCHAR, 255)), + ] + self.tags: List[Column] = [ + Column(DataType(TypeEnum.INT)), + Column(DataType(TypeEnum.VARCHAR, 255)), + ] + self.stb_columns: List[Column] = [ + Column(DecimalType(TypeEnum.DECIMAL, 10, 2)), + Column(DecimalType(TypeEnum.DECIMAL, 20, 4)), + Column(DecimalType(TypeEnum.DECIMAL, 30, 8)), + Column(DecimalType(TypeEnum.DECIMAL, 38, 10)), + Column(DataType(TypeEnum.TINYINT)), + Column(DataType(TypeEnum.INT)), + Column(DataType(TypeEnum.BIGINT)), + Column(DataType(TypeEnum.DOUBLE)), + Column(DataType(TypeEnum.FLOAT)), + Column(DataType(TypeEnum.VARCHAR, 255)), + ] + DecimalColumnTableCreater( + tdSql, + self.db_name, + self.stable_name, + self.stb_columns, + self.tags, + col_prefix=self.col_prefix, + tag_prefix=self.tag_name_prefix, + ).create() + self.check_show_create_table("meters", self.stb_columns, self.tags) + + DecimalColumnTableCreater( + tdSql, self.db_name, self.norm_table_name, self.norm_tb_columns + ).create() + self.check_desc(self.norm_table_name, self.norm_tb_columns) + self.check_show_create_table(self.norm_table_name, self.norm_tb_columns) + + ## TODO add more values for all rows + tag_values = ["1", "t1"] + DecimalColumnTableCreater( + tdSql, self.db_name, self.stable_name, self.stb_columns + ).create_child_table( + self.c_table_prefix, self.c_table_num, self.tags, tag_values + ) + self.check_desc("meters", self.stb_columns, self.tags) + self.check_desc("t1", self.stb_columns, self.tags) + + ## invalid precision/scale + invalid_precision_scale = [ + ("decimal(-1, 2)", syntax_error), + ("decimal(39, 2)", invalid_column), + ("decimal(10, -1)", syntax_error), + ("decimal(10, 39)", invalid_column), + ("decimal(10, 2.5)", syntax_error), + ("decimal(10.5, 2)", syntax_error), + ("decimal(10.5, 2.5)", syntax_error), + ("decimal(0, 2)", invalid_column), + ("decimal(0)", invalid_column), + ("decimal", syntax_error), + ("decimal()", syntax_error), + ] + for i in invalid_precision_scale: + sql = f"create table {self.db_name}.invalid_decimal_precision_scale (ts timestamp, c1 {i[0]})" + tdSql.error(sql, i[1]) + + ## can't create decimal tag + sql = ( + "create stable %s.invalid_decimal_tag (ts timestamp) tags (t1 decimal(10, 2))" + % (self.db_name) + ) + tdSql.error(sql, invalid_column) + + ## alter table add/drop column + self.test_add_drop_columns_with_decimal( + self.norm_table_name, self.norm_tb_columns + ) + self.test_add_drop_columns_with_decimal(self.stable_name, self.stb_columns) + + ## drop index from stb + ### These ops will override the previous stbobjs and meta entries, so test it + + ## TODO test encode and compress for decimal type + sql = f'ALTER TABLE {self.db_name}.{self.norm_table_name} ADD COLUMN c101 decimal(37, 19) ENCODE "simple8b" COMPRESS "zstd"' + tdSql.error(sql, invalid_encode_param) + sql = f'ALTER TABLE {self.db_name}.{self.norm_table_name} ADD COLUMN c101 decimal(37, 19) ENCODE "delta-i" COMPRESS "zstd"' + tdSql.error(sql, invalid_encode_param) + sql = f'ALTER TABLE {self.db_name}.{self.norm_table_name} ADD COLUMN c101 decimal(37, 19) ENCODE "delta-d" COMPRESS "zstd"' + tdSql.error(sql, invalid_encode_param) + sql = f'ALTER TABLE {self.db_name}.{self.norm_table_name} ADD COLUMN c101 decimal(37, 19) ENCODE "bit-packing" COMPRESS "zstd"' + tdSql.error(sql, invalid_encode_param) + + def test_insert_decimal_values(self): + self.log_test("insert decimal values") + for i in range(self.c_table_num): + TableInserter( + tdSql, + self.db_name, + f"{self.c_table_prefix}{i}", + self.stb_columns, + self.tags, + ).insert(tb_insert_rows, 1537146000000, 500) + + for i in range(self.c_table_num): + TableDataValidator( + self.stb_columns, self.c_table_prefix + str(i), self.db_name, i + ).validate() + + TableInserter( + tdSql, self.db_name, self.norm_table_name, self.norm_tb_columns + ).insert(tb_insert_rows, 1537146000000, 500, flush_database=True) + TableDataValidator( + self.norm_tb_columns, self.norm_table_name, self.db_name + ).validate() + + tdSql.execute("flush database %s" % (self.db_name), queryTimes=1) + for i in range(self.c_table_num): + TableDataValidator( + self.stb_columns, self.c_table_prefix + str(i), self.db_name, i + ).validate() + TableDataValidator( + self.norm_tb_columns, self.norm_table_name, self.db_name + ).validate() + + ## insert null/None for decimal type + + ## insert with column format + + def no_decimal_table_test(self): + columns = [ + Column(DataType(TypeEnum.TINYINT)), + Column(DataType(TypeEnum.INT)), + Column(DataType(TypeEnum.BIGINT)), + Column(DataType(TypeEnum.DOUBLE)), + Column(DataType(TypeEnum.FLOAT)), + Column(DataType(TypeEnum.VARCHAR, 255)), + ] + DecimalColumnTableCreater( + tdSql, self.db_name, self.no_decimal_col_tb_name, columns, [] + ).create() + TableInserter(tdSql, self.db_name, self.no_decimal_col_tb_name, columns).insert( + 10000, 1537146000000, 500, flush_database=True + ) + ## TODO wjm test non support decimal version upgrade to decimal support version, and add decimal column + + ## Test metaentry compatibility problem for decimal type + ## How to test it? + ## Create table with no decimal type, the metaentries should not have extschma, and add decimal column, the metaentries should have extschema for all columns. + sql = f"ALTER TABLE {self.db_name}.{self.no_decimal_col_tb_name} ADD COLUMN c200 decimal(37, 19)" + tdSql.execute(sql, queryTimes=1) ## now meta entry has ext schemas + columns.append(Column(DecimalType(TypeEnum.DECIMAL, 37, 19))) + self.check_desc(self.no_decimal_col_tb_name, columns) + + ## After drop this only decimal column, the metaentries should not have extschema for all columns. + sql = ( + f"ALTER TABLE {self.db_name}.{self.no_decimal_col_tb_name} DROP COLUMN c200" + ) + tdSql.execute(sql, queryTimes=1) ## now meta entry has no ext schemas + columns.pop(len(columns) - 1) + self.check_desc(self.no_decimal_col_tb_name, columns) + sql = f"ALTER TABLE {self.db_name}.{self.no_decimal_col_tb_name} ADD COLUMN c200 int" + tdSql.execute(sql, queryTimes=1) ## meta entry has no ext schemas + columns.append(Column(DataType(TypeEnum.INT))) + self.check_desc(self.no_decimal_col_tb_name, columns) + + self.test_add_drop_columns_with_decimal(self.no_decimal_col_tb_name, columns) + + def test_decimal_ddl(self): + self.log_test("test_decimal_ddl") + tdSql.execute("create database test cachemodel 'both'", queryTimes=1) + self.test_decimal_column_ddl() + + def test_decimal_and_stream(self): + self.log_test("test_decimal_and_stream") + create_stream = f"CREATE STREAM {self.stream_name} FILL_HISTORY 1 INTO {self.db_name}.{self.stream_out_stb} AS SELECT _wstart, count(c1), avg(c2), sum(c3) FROM {self.db_name}.{self.stable_name} INTERVAL(10s)" + tdSql.execute(create_stream, queryTimes=1, show=True) + self.wait_query_result( + f"select count(*) from {self.db_name}.{self.stream_out_stb}", [(50,)], 30 + ) + ## test combine functions + create_stream = "CREATE STREAM stream2 trigger at_once watermark 100s INTO test.stream_out_stb_2 AS SELECT _wstart, count(*), min(c2), max(c2), last(c1), last(c3), avg(c2), sum(c3), min(c1), max(c1), avg(c1) FROM test.nt session(ts, 5s)" + tdSql.execute(create_stream, queryTimes=1, show=True) + cols_vals = [] + ts = datetime.now() + rows = [] + row = [] + for col in self.norm_tb_columns: + v = col.generate_value(self.norm_table_name, has_null=False) + cols_vals.append(v) + row.append(v) + rows.append(row) + row = [] + sql = f"insert into test.nt values('{ts}', {' ,'.join(cols_vals)})" + tdSql.execute(sql, queryTimes=1, show=True) + ts = ts + timedelta(seconds=6) + cols_vals = [] + for col in self.norm_tb_columns: + v = col.generate_value(self.norm_table_name, has_null=False) + cols_vals.append(v) + row.append(v) + rows.append(row) + row = [] + sql = f"insert into test.nt values('{ts}', {' ,'.join(cols_vals)})" + tdSql.execute(sql, queryTimes=1, show=True) + ts = ts - timedelta(seconds=4) + ## waiting for the last two windows been calculated + time.sleep(10) + cols_vals = [] + for col in self.norm_tb_columns: + v = col.generate_value(self.norm_table_name, has_null=False) + cols_vals.append(v) + row.append(v) + rows.append(row) + sql = f"insert into test.nt values('{ts}', {' ,'.join(cols_vals)})" + tdSql.execute(sql, queryTimes=1, show=True) + self.wait_query_result("select `count(*)` from test.stream_out_stb_2", [(3,)], 10) + res = TaosShell().query("select * from test.stream_out_stb_2") + if len(res) != 12: ## groupid + tdLog.exit(f"expect 12 columns but got: {len(res)}") + c1 = self.norm_tb_columns[0] + c2 = self.norm_tb_columns[1] + c3 = self.norm_tb_columns[2] + c1_vals = [get_decimal(v, c1.type_.scale()) for v in [row[0] for row in rows]] + c2_vals = [get_decimal(v, c2.type_.scale()) for v in [row[1] for row in rows]] + c3_vals = [get_decimal(v, c3.type_.scale()) for v in [row[2] for row in rows]] + min_c2 = Decimal(res[2][0]) + if min_c2 != min(c2_vals): + tdLog.exit(f"expect min(c2) = {min(c2_vals)} got: {min_c2}") + max_c2 = Decimal(res[3][0]) + if max_c2 != max(c2_vals): + tdLog.exit(f"expect max(c2) = {max(c2_vals)} got: {max_c2}") + + + def test_decimal_and_tsma(self): + self.log_test("test_decimal_and_tsma") + create_tsma = f"CREATE TSMA {self.tsma_name} ON {self.db_name}.{self.stable_name} FUNCTION(count(c1), min(c2), max(c3), avg(C3)) INTERVAL(1m)" + tdSql.execute(create_tsma, queryTimes=1, show=True) + self.wait_query_result( + f"select count(*) from {self.db_name}.{self.tsma_name}_tsma_res_stb_", + [(9 * self.c_table_num,)], + 30, + ) + + def test_decimal_and_view(self): + self.log_test("test_decimal_and_view") + c1 = self.norm_tb_columns[0] + create_view_sql = f'create view {self.db_name}.view1 as select {c1} as c1, cast({c1} as decimal(38, 10)) as c2 from {self.db_name}.{self.norm_table_name}' + tdSql.execute(create_view_sql) + res = TaosShell().query(f'select c1 from {self.db_name}.view1') + if len(res[0]) != c1.get_cardinality(self.norm_table_name): + tdLog.exit(f"query from view1 got rows: {len(res)} expect: {c1.get_cardinality(self.norm_table_name)}") + for i in range(len(res[0])): + v_query = res[0][i] + v_insert = c1.get_val_for_execute(self.norm_table_name, i) + if (v_insert is None and v_query == 'NULL') or Decimal(v_query) == v_insert: + continue + else: + tdLog.exit(f"query from view got different results: {v_query}, expect: {v_insert}") + #self.check_desc("view1", [c1, Column(DecimalType(TypeEnum.DECIMAL, 38, 10))]) + + def log_test(self, name: str): + tdLog.info(f"{datetime.now()} start to test {name}") + + def run(self): + self.test_decimal_ddl() + #self.no_decimal_table_test() + self.test_insert_decimal_values() + self.test_query_decimal() + self.test_decimal_and_tsma() + self.test_decimal_and_view() + self.test_decimal_and_stream() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + def wait_query_result(self, sql: str, expect_result, times): + for i in range(times): + tdLog.info(f"wait query result for {sql}, times: {i}") + tdSql.query(sql, queryTimes=1) + results = tdSql.queryResult + if results != expect_result: + time.sleep(1) + continue + return True + tdLog.exit( + f"wait query result timeout for {sql} failed after {times} time, expect {expect_result}, but got {results}" + ) + + def wait_query_at_least_rows(self, sql: str, rows, wait_times): + for i in range(wait_times): + tdLog.info(f"wait query rows at least for {sql}, times: {i}") + tdSql.query(sql, queryTimes=1, show=True) + results = tdSql.queryResult + if len(results) < rows: + time.sleep(1) + continue + return True + tdLog.exit( + f"wait query rows at least for {sql} failed after {wait_times} times, expect at least {rows} rows, but got {len(results)} rows" + ) + + def check_decimal_binary_expr_with_col_results( + self, dbname, tbname, tb_cols: List[Column], exprs: List[DecimalColumnExpr] + ): + if not binary_op_with_col_test: + return + for expr in exprs: + for col in tb_cols: + if col.name_ == '': + continue + for col2 in tb_cols: + if col2.name_ =='': + continue + if expr.should_skip_for_decimal([col, col2]): + continue + select_expr = expr.generate((col, col2)) + sql = f"select {select_expr} from {dbname}.{tbname}" + res = TaosShell().query(sql) + if len(res) > 0: + expr.check(res[0], tbname) + else: + tdLog.info(f"sql: {sql} got no output") + + def check_decimal_binary_expr_with_const_col_results_for_one_expr( + self, + dbname, + tbname, + tb_cols: List[Column], + expr: DecimalColumnExpr, + get_constant_cols_func, + ): + constant_cols = get_constant_cols_func() + for col in tb_cols: + if col.name_ == '': + continue + left_is_decimal = col.type_.is_decimal_type() + for const_col in constant_cols: + right_is_decimal = const_col.type_.is_decimal_type() + if expr.should_skip_for_decimal([col, const_col]): + continue + const_col.generate_value() + select_expr = expr.generate((const_col, col)) + sql = f"select {select_expr} from {dbname}.{tbname}" + shell = TaosShell() + res = shell.query(sql) + if len(res) > 0: + expr.check(res[0], tbname) + select_expr = expr.generate((col, const_col)) + sql = f"select {select_expr} from {dbname}.{tbname}" + res = shell.query(sql) + if len(res) > 0: + expr.check(res[0], tbname) + else: + tdLog.info(f"sql: {sql} got no output") + + def check_decimal_binary_expr_with_const_col_results( + self, + dbname, + tbname, + tb_cols: List[Column], + get_constant_cols_func, + get_exprs_func, + ): + exprs: List[DecimalColumnExpr] = get_exprs_func() + if not binary_op_with_const_test: + return + ts: list[threading.Thread] = [] + for expr in exprs: + t = self.run_in_thread2( + self.check_decimal_binary_expr_with_const_col_results_for_one_expr, + (dbname, tbname, tb_cols, expr, get_constant_cols_func), + ) + ts.append(t) + for t in ts: + t.join() + + def check_decimal_unary_expr_results(self, dbname, tbname, tb_cols: List[Column], exprs: List[DecimalColumnExpr]): + if not unary_op_test: + return + for expr in exprs: + for col in tb_cols: + if col.name_ == '': + continue + if expr.should_skip_for_decimal([col]): + continue + select_expr = expr.generate([col]) + sql = f"select {select_expr} from {dbname}.{tbname}" + res = TaosShell().query(sql) + if len(res) > 0: + expr.check(res[0], tbname) + else: + tdLog.info(f"sql: {sql} got no output") + + def run_in_thread(self, times, func, params) -> threading.Thread: + threads: List[threading.Thread] = [] + for i in range(times): + t = threading.Thread(target=func, args=params) + t.start() + threads.append(t) + for t in threads: + t.join() + + def run_in_thread2(self, func, params) -> threading.Thread: + t = threading.Thread(target=func, args=params) + t.start() + return t + + ## test others unsupported types operator with decimal + def test_decimal_unsupported_types(self): + unsupported_type = [ + TypeEnum.JSON, + TypeEnum.GEOMETRY, + TypeEnum.VARBINARY, + ] + all_type_columns: List[Column] = Column.get_all_type_columns([TypeEnum.JSON]) + tbname = "test_decimal_unsupported_types" + tag_cols = [Column(DataType(TypeEnum.JSON))] + tb_creater = DecimalColumnTableCreater( tdSql, self.db_name, tbname, all_type_columns, tag_cols) + tb_creater.create() + tb_creater.create_child_table(tbname, 10, tag_cols, ['{"k1": "v1"}']) + for i in range(10): + TableInserter(tdSql, self.db_name, f'{tbname}{i}', all_type_columns, tag_cols).insert(100, 1537146000000, 500, flush_database=True) + for col in all_type_columns: + ## only test decimal cols + if not col.type_.is_decimal_type(): + continue + for unsupported_col in all_type_columns: + ## only test unsupported cols + if not unsupported_col.type_.type in unsupported_type: + continue + for binary_op in DecimalBinaryOperator.get_all_binary_ops(): + select_expr = binary_op.generate((col, unsupported_col)) + sql = f"select {select_expr} from {self.db_name}.{tbname}" + select_expr_reverse = binary_op.generate((unsupported_col, col)) + sql_reverse = ( + f"select {select_expr_reverse} from {self.db_name}.{tbname}" + ) + tdLog.info( + f"select expr: {select_expr} with type: {col.type_} and {unsupported_col.type_} should err" + ) + err = tdSql.error(sql) + if tdSql.errno != invalid_operation and tdSql.errno != scalar_convert_err: + tdLog.exit(f"expected err not occured for sql: {sql}, expect: {invalid_operation} or {scalar_convert_err}, but got {tdSql.errno}") + + tdLog.info( + f"select expr: {select_expr} with type: {unsupported_col.type_} and {col.type_} should err" + ) + err = tdSql.error(sql_reverse) + if tdSql.errno != invalid_operation and tdSql.errno != scalar_convert_err: + tdLog.exit(f"expected err not occured for sql: {sql}, expect: {invalid_operation} or {scalar_convert_err}, but got {tdSql.errno}") + + def test_decimal_operators(self): + self.log_test("decimal operators") + self.test_decimal_unsupported_types() + ## tables: meters, nt + ## columns: c1, c2, c3, c4, c5, c7, c8, c9, c10, c99, c100 + binary_operators = DecimalBinaryOperator.get_all_binary_ops() + + ## decimal operator with constants of all other types + self.run_in_thread( + operator_test_round, + self.check_decimal_binary_expr_with_const_col_results, + ( + self.db_name, + self.norm_table_name, + self.norm_tb_columns, + Column.get_decimal_oper_const_cols, + DecimalBinaryOperator.get_all_binary_ops, + ), + ) + + ## test decimal column op decimal column + for i in range(operator_test_round): + self.check_decimal_binary_expr_with_col_results( + self.db_name, self.norm_table_name, self.norm_tb_columns, binary_operators) + + unary_operators = DecimalUnaryOperator.get_all_unary_ops() + self.check_decimal_unary_expr_results( + self.db_name, + self.norm_table_name, + self.norm_tb_columns, + unary_operators,) + + + def check_decimal_where_with_binary_expr_with_const_col_results( + self, + dbname, + tbname, + tb_cols: List[Column], + constant_cols: List[Column], + exprs: List[DecimalColumnExpr], + ): + if not binary_op_in_where_test: + return + for expr in exprs: + tdLog.info(f"start to test decimal where filtering with const cols for expr: {expr.format_}") + for col in tb_cols: + if col.name_ == '': + continue + for const_col in constant_cols: + if expr.should_skip_for_decimal([col, const_col]): + continue + const_col.generate_value() + select_expr = expr.generate((const_col, col)) + if const_col.type_.is_decimal_type(): + expr.query_col = col + else: + expr.query_col = col + sql = f"select {expr.query_col} from {dbname}.{tbname} where {select_expr}" + res = TaosShell().query(sql) + ##TODO wjm no need to check len(res) for filtering test, cause we need to check for every row in the table to check if the filtering is working + if len(res) > 0: + expr.check_for_filtering(res[0], tbname) + select_expr = expr.generate((col, const_col)) + sql = f"select {expr.query_col} from {dbname}.{tbname} where {select_expr}" + res = TaosShell().query(sql) + if len(res) > 0: + expr.check_for_filtering(res[0], tbname) + else: + tdLog.info(f"sql: {sql} got no output") + + def check_decimal_where_with_binary_expr_with_col_results( + self, dbname, tbname, tb_cols: List[Column], exprs: List[DecimalColumnExpr] + ): + if not binary_op_in_where_test: + return + for expr in exprs: + tdLog.info(f"start to test decimal where filtering with cols for expr{expr.format_}") + for col in tb_cols: + if col.name_ == '': + continue + for col2 in tb_cols: + if col2.name_ == '': + continue + if expr.should_skip_for_decimal([col, col2]): + continue + select_expr = expr.generate((col, col2)) + if col.type_.is_decimal_type(): + expr.query_col = col + else: + expr.query_col = col2 + sql = f"select {expr.query_col} from {dbname}.{tbname} where {select_expr}" + res = TaosShell().query(sql) + if len(res) > 0: + expr.check_for_filtering(res[0], tbname) + else: + tdLog.info(f"sql: {sql} got no output") + select_expr = expr.generate((col2, col)) + sql = f"select {expr.query_col} from {dbname}.{tbname} where {select_expr}" + res = TaosShell().query(sql) + if len(res) > 0: + expr.check_for_filtering(res[0], tbname) + else: + tdLog.info(f"sql: {sql} got no output") + + def test_query_decimal_where_clause(self): + tdLog.info("start to test decimal where filtering") + binary_compare_ops = DecimalBinaryOperator.get_all_filtering_binary_compare_ops() + const_cols = Column.get_decimal_oper_const_cols() + for i in range(operator_test_round): + self.check_decimal_where_with_binary_expr_with_const_col_results( + self.db_name, + self.norm_table_name, + self.norm_tb_columns, + const_cols, + binary_compare_ops, + ) + + for i in range(operator_test_round): + self.check_decimal_where_with_binary_expr_with_col_results( + self.db_name, + self.norm_table_name, + self.norm_tb_columns, + binary_compare_ops) + + ## TODO wjm + ## 3. (dec op const col) op const col + ## 4. (dec op dec) op const col + ## 5. (dec op const col) op dec + ## 6. (dec op dec) op dec + + def test_query_with_order_by_for_tb(self, tbname: str, cols: list): + for col in cols: + if col.type_.is_decimal_type() and col.name_ != '': + self.test_query_with_order_by(col, tbname) + + def test_query_with_order_by(self, order_col: Column, tbname): + sql = f"select {order_col} from {self.db_name}.{tbname} order by {order_col} asc" + query_res = TaosShell().query(sql)[0] + calculated_ordered_res = order_col.get_ordered_result(tbname, True) + for v_from_query, v_from_calc in zip(query_res, calculated_ordered_res): + if v_from_calc is None: + if v_from_query != 'NULL': + tdLog.exit(f"query result: {v_from_query} not equal to calculated result: NULL") + elif Decimal(v_from_query) != v_from_calc: + tdLog.exit(f"query result: {v_from_query} not equal to calculated result: {v_from_calc}") + + + def test_query_decimal_order_clause(self): + self.log_test("decimal order by") + self.test_query_with_order_by_for_tb(self.norm_table_name, self.norm_tb_columns) + self.test_query_with_order_by_for_tb(self.stable_name, self.stb_columns) + + def test_query_decimal_group_by_decimal(self, tbname: str, cols: list): + for col in cols: + if col.type_.is_decimal_type() and col.name_ != '': + sql = f"select count(*) from {self.db_name}.{tbname} group by {col}" + query_res = TaosShell().query(sql)[0] + calculated_grouped_res = col.get_group_num(tbname) + if len(query_res) != calculated_grouped_res: + tdLog.exit(f"query result: {len(query_res)} not equal to calculated result: {calculated_grouped_res}") + + def test_query_decimal_group_by_clause(self): + self.log_test("decimal group by") + self.test_query_decimal_group_by_decimal(self.norm_table_name, self.norm_tb_columns) + self.test_query_decimal_group_by_decimal(self.stable_name, self.stb_columns) + + def test_query_decimal_group_by_with_having(self, tbname, cols: list): + for col in cols: + if col.type_.is_decimal_type() and col.name_ != '': + sql = f"select count(*) from {self.db_name}.{tbname} group by {col} having {col} is not null" + query_res = TaosShell().query(sql)[0] + calculated_grouped_res = col.get_group_num(tbname, ignore_null=True) + if len(query_res) != calculated_grouped_res: + tdLog.exit(f"query result: {len(query_res)} not equal to calculated result: {calculated_grouped_res}") + + def test_query_decimal_having_clause(self): + self.log_test("decimal having") + self.test_query_decimal_group_by_with_having(self.norm_table_name, self.norm_tb_columns) + self.test_query_decimal_group_by_with_having(self.stable_name, self.stb_columns) + + def test_query_decimal_interval_fill(self): + self.test_query_decimal_interval_fill_for_tb(self.norm_table_name) + self.test_query_decimal_interval_fill_for_tb(self.stable_name) + + def test_query_decimal_interval_fill_for_tb(self, tbname): + sql = f"select _wstart, count(*), avg(c1),tbname from {self.db_name}.{tbname} where ts >= 1537146000000 and ts < 1537146005000 partition by tbname interval(200a) fill(value,0,1.234)" + tdLog.debug(sql) + res = TaosShell().query(sql) + wstart_col = res[0] + count_col = res[1] + avg_col = res[2] + for wstart, count, avg in zip(wstart_col, count_col, avg_col): + if int(count) == 0: + if Decimal(avg) != Decimal('1.234'): + tdLog.exit(f"sql: {sql} wstart: {wstart} count is 0, but avg is not 1.234") + + fill_prev_res = TaosShell().query(f"select _wstart, count(*), avg(c1),tbname from {self.db_name}.{tbname} where ts >= 1537146000000 and ts < 1537146005000 partition by tbname interval(200a) fill(prev)") + fill_prev_avg_col = fill_prev_res[2] + for i in range(len(wstart_col)): + if int(count_col[i]) == 0: + if i > 0 and fill_prev_avg_col[i] != fill_prev_avg_col[i-1]: + tdLog.exit(f"sql: {sql} count is 0, but avg is not same as previous row") + + def test_query_decimal_case_when(self): + self.log_test("decimal case when") + sql = "select case when cast(1 as decimal(10, 4)) >= 1 then cast(88888888.88 as decimal(10,2)) else cast(3.333 as decimal(10,3)) end" + res = TaosShell().query(sql)[0] + if res[0] != "88888888.88": + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 88888888.88") + sql = "select case when cast(1 as decimal(10, 4)) > 1 then cast(88888888.88 as decimal(10,2)) else cast(3.333 as decimal(10,3)) end" + res = TaosShell().query(sql)[0] + if res[0] != "3.33": + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 3.33") + + sql = "select case when cast(1 as decimal(10, 4)) > 1 then cast(88888888.88 as decimal(10,2)) else 1.23 end" + res = TaosShell().query(sql)[0] + if float(res[0]) != float(1.23): + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 1.23") + + sql = "select case when cast(1 as decimal(10, 4)) >= 1 then cast(88888888.88 as decimal(10,2)) else 1.23 end" + res = TaosShell().query(sql)[0] + if float(res[0]) != float(88888888.88): + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 88888888.88") + + sql = "select case when cast(1 as decimal(10, 4)) >= 1 then cast(88888888.88 as decimal(10,2)) else '1.23' end" + res = TaosShell().query(sql)[0] + if float(res[0]) != 88888888.88: + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 88888888.88") + + sql = "select case when cast(1 as decimal(10, 4)) > 1 then cast(88888888.88 as decimal(10,2)) else '1.23' end" + res = TaosShell().query(sql)[0] + if float(res[0]) != 1.23: + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 88888888.88") + + sql = "select case when cast(1 as decimal(10, 4)) > 1 then cast(88888888.88 as decimal(10,2)) else 'abcd' end" + res = TaosShell().query(sql)[0] + if float(res[0]) != 0: + tdLog.exit(f"query result for sql: {sql}: {res[0]} not equal to expected result: 0") + + def test_decimal_agg_funcs(self, dbname, tbname, tb_cols: List[Column], get_agg_funcs_func): + agg_funcs: List[DecimalFunction] = get_agg_funcs_func() + for func in agg_funcs: + for col in tb_cols: + if col.name_ == '' or func.should_skip_for_decimal([col]): + continue + func.query_col = col + select_expr = func.generate([col]) + sql = f"select {select_expr} from {dbname}.{tbname}" + res = TaosShell().query(sql) + if len(res) > 0: + res = res[0] + func.check_for_agg_func(res, tbname, func, tbname == self.stable_name) + + def test_decimal_cast_func(self, dbname, tbname, tb_cols: List[Column]): + for col in tb_cols: + if col.name_ == '': + continue + to_types: list[DataType] = DecimalCastTypeGenerator(col.type_).generate(cast_func_test_round) + for t in to_types: + cast_func = DecimalCastFunction() + expr = cast_func.generate([col, t]) + sql = f"select {expr} from {dbname}.{tbname}" + res = TaosShell().query(sql) + if len(res) > 0: + res = res[0] + cast_func.check(res, tbname) + + def test_decimal_functions(self): + self.log_test("decimal functions") + if not test_decimal_funcs: + return + self.test_decimal_agg_funcs( self.db_name, self.norm_table_name, self.norm_tb_columns, DecimalFunction.get_decimal_agg_funcs) + self.test_decimal_agg_funcs( self.db_name, self.stable_name, self.stb_columns, DecimalFunction.get_decimal_agg_funcs) + self.test_decimal_cast_func(self.db_name, self.norm_table_name, self.norm_tb_columns) + + def test_query_decimal(self): + self.log_test("decimal query") + if not decimal_test_query: + return + #self.test_decimal_operators() ## tested in decimal.py + #self.test_query_decimal_where_clause() ## tested in decimal2.py + self.test_decimal_functions() + self.test_query_decimal_order_clause() + self.test_query_decimal_case_when() + self.test_query_decimal_group_by_clause() + self.test_query_decimal_having_clause() + self.test_query_decimal_interval_fill() + + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/test.py b/tests/system-test/test.py index cd0e60160c..01a35df6aa 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -70,7 +70,6 @@ def get_local_classes_in_order(file_path): def dynamicLoadModule(fileName): moduleName = fileName.replace(".py", "").replace(os.sep, ".") return importlib.import_module(moduleName, package='..') - # # run case on previous cluster #