提交 8dbac0b0 编写于 作者: G Ganlin Zhao

Merge branch '3.0' into fix/TD-17958

...@@ -443,7 +443,7 @@ pipeline { ...@@ -443,7 +443,7 @@ pipeline {
} }
} }
} }
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { /*catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 15, unit: 'MINUTES'){ timeout(time: 15, unit: 'MINUTES'){
script { script {
sh ''' sh '''
...@@ -455,7 +455,7 @@ pipeline { ...@@ -455,7 +455,7 @@ pipeline {
''' '''
} }
} }
} }*/
} }
} }
} }
......
...@@ -47,15 +47,21 @@ IF(${TD_WINDOWS}) ...@@ -47,15 +47,21 @@ IF(${TD_WINDOWS})
) )
option( option(
BUILD_TEST BUILD_TEST
"If build unit tests using googletest" "If build unit tests using googletest"
ON ON
) )
option( option(
TDENGINE_3 TDENGINE_3
"TDengine 3.x" "TDengine 3.x for taos-tools"
ON ON
)
option(
BUILD_CRASHDUMP
"If build crashdump on Windows"
ON
) )
ELSEIF (TD_DARWIN_64) ELSEIF (TD_DARWIN_64)
......
# crashdump
ExternalProject_Add(crashdump
GIT_REPOSITORY https://github.com/Arnavion/crashdump.git
GIT_TAG master
SOURCE_DIR "${TD_CONTRIB_DIR}/crashdump"
BINARY_DIR "${TD_CONTRIB_DIR}/crashdump"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
...@@ -120,6 +120,11 @@ if(${BUILD_WITH_NURAFT}) ...@@ -120,6 +120,11 @@ if(${BUILD_WITH_NURAFT})
cat("${TD_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) cat("${TD_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
endif(${BUILD_WITH_NURAFT}) endif(${BUILD_WITH_NURAFT})
# crashdump
if(${BUILD_CRASHDUMP})
cat("${TD_SUPPORT_DIR}/crashdump_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
endif(${BUILD_CRASHDUMP})
# addr2line # addr2line
if(${BUILD_ADDR2LINE}) if(${BUILD_ADDR2LINE})
if(NOT ${TD_WINDOWS}) if(NOT ${TD_WINDOWS})
...@@ -257,6 +262,16 @@ if(${BUILD_PTHREAD}) ...@@ -257,6 +262,16 @@ if(${BUILD_PTHREAD})
target_link_libraries(pthread INTERFACE libpthreadVC3) target_link_libraries(pthread INTERFACE libpthreadVC3)
endif() endif()
# crashdump
if(${BUILD_CRASHDUMP})
add_executable(dumper "crashdump/dumper/dumper.c")
target_link_libraries(dumper User32.lib dbghelp.lib)
file(READ "crashdump/crasher/crasher.c" CRASHDUMP_CONTENT)
string(REPLACE "main(" "main_crashdump(" CRASHDUMP_CONTENT "${CRASHDUMP_CONTENT}")
file(WRITE "crashdump/crasher/crasher.c" "${CRASHDUMP_CONTENT}")
add_library(crashdump STATIC "crashdump/crasher/crasher.c")
endif()
# iconv # iconv
if(${BUILD_WITH_ICONV}) if(${BUILD_WITH_ICONV})
add_library(iconv STATIC iconv/win_iconv.c) add_library(iconv STATIC iconv/win_iconv.c)
......
...@@ -23,7 +23,7 @@ A single line of text is used in OpenTSDB line protocol to represent one row of ...@@ -23,7 +23,7 @@ A single line of text is used in OpenTSDB line protocol to represent one row of
- `metric` will be used as the STable name. - `metric` will be used as the STable name.
- `timestamp` is the timestamp of current row of data. The time precision will be determined automatically based on the length of the timestamp. Second and millisecond time precision are supported. - `timestamp` is the timestamp of current row of data. The time precision will be determined automatically based on the length of the timestamp. Second and millisecond time precision are supported.
- `value` is a metric which must be a numeric value, the corresponding column name is "value". - `value` is a metric which must be a numeric value, the corresponding column name is "_value".
- The last part is the tag set separated by spaces, all tags will be converted to nchar type automatically. - The last part is the tag set separated by spaces, all tags will be converted to nchar type automatically.
For example: For example:
...@@ -74,7 +74,7 @@ taos> show STables; ...@@ -74,7 +74,7 @@ taos> show STables;
Query OK, 2 row(s) in set (0.002544s) Query OK, 2 row(s) in set (0.002544s)
taos> select tbname, * from `meters.current`; taos> select tbname, * from `meters.current`;
tbname | ts | value | groupid | location | tbname | _ts | _value | groupid | location |
================================================================================================================================== ==================================================================================================================================
t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.249 | 10.800000000 | 3 | California.LoSangeles | t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.249 | 10.800000000 | 3 | California.LoSangeles |
t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.250 | 11.300000000 | 3 | California.LoSangeles | t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.250 | 11.300000000 | 3 | California.LoSangeles |
......
...@@ -91,7 +91,7 @@ taos> show STables; ...@@ -91,7 +91,7 @@ taos> show STables;
Query OK, 2 row(s) in set (0.001954s) Query OK, 2 row(s) in set (0.001954s)
taos> select * from `meters.current`; taos> select * from `meters.current`;
ts | value | groupid | location | _ts | _value | groupid | location |
=================================================================================================================== ===================================================================================================================
2022-03-28 09:56:51.249 | 10.300000000 | 2.000000000 | California.SanFrancisco | 2022-03-28 09:56:51.249 | 10.300000000 | 2.000000000 | California.SanFrancisco |
2022-03-28 09:56:51.250 | 12.600000000 | 2.000000000 | California.SanFrancisco | 2022-03-28 09:56:51.250 | 12.600000000 | 2.000000000 | California.SanFrancisco |
......
...@@ -23,7 +23,7 @@ OpenTSDB 行协议同样采用一行字符串来表示一行数据。OpenTSDB ...@@ -23,7 +23,7 @@ OpenTSDB 行协议同样采用一行字符串来表示一行数据。OpenTSDB
- metric 将作为超级表名。 - metric 将作为超级表名。
- timestamp 本行数据对应的时间戳。根据时间戳的长度自动识别时间精度。支持秒和毫秒两种时间精度 - timestamp 本行数据对应的时间戳。根据时间戳的长度自动识别时间精度。支持秒和毫秒两种时间精度
- value 度量值,必须为一个数值。对应的列名也是 “value”。 - value 度量值,必须为一个数值。对应的列名是 “_value”。
- 最后一部分是标签集, 用空格分隔不同标签, 所有标签自动转化为 nchar 数据类型; - 最后一部分是标签集, 用空格分隔不同标签, 所有标签自动转化为 nchar 数据类型;
例如: 例如:
...@@ -74,7 +74,7 @@ taos> show stables; ...@@ -74,7 +74,7 @@ taos> show stables;
Query OK, 2 row(s) in set (0.002544s) Query OK, 2 row(s) in set (0.002544s)
taos> select tbname, * from `meters.current`; taos> select tbname, * from `meters.current`;
tbname | ts | value | groupid | location | tbname | _ts | _value | groupid | location |
================================================================================================================================== ==================================================================================================================================
t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.249 | 10.800000000 | 3 | California.LosAngeles | t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.249 | 10.800000000 | 3 | California.LosAngeles |
t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.250 | 11.300000000 | 3 | California.LosAngeles | t_0e7bcfa21a02331c06764f275... | 2022-03-28 09:56:51.250 | 11.300000000 | 3 | California.LosAngeles |
......
...@@ -91,7 +91,7 @@ taos> show stables; ...@@ -91,7 +91,7 @@ taos> show stables;
Query OK, 2 row(s) in set (0.001954s) Query OK, 2 row(s) in set (0.001954s)
taos> select * from `meters.current`; taos> select * from `meters.current`;
ts | value | groupid | location | _ts | _value | groupid | location |
=================================================================================================================== ===================================================================================================================
2022-03-28 09:56:51.249 | 10.300000000 | 2.000000000 | California.SanFrancisco | 2022-03-28 09:56:51.249 | 10.300000000 | 2.000000000 | California.SanFrancisco |
2022-03-28 09:56:51.250 | 12.600000000 | 2.000000000 | California.SanFrancisco | 2022-03-28 09:56:51.250 | 12.600000000 | 2.000000000 | California.SanFrancisco |
......
--- ---
title: 配置参数 title: 配置参数
description: 'TDengine 客户端和服务配置列表' description: "TDengine 客户端和服务配置列表"
--- ---
## 为服务端指定配置文件 ## 为服务端指定配置文件
...@@ -21,8 +21,6 @@ taosd -C ...@@ -21,8 +21,6 @@ taosd -C
TDengine 系统的前台交互客户端应用程序为 taos,以及应用驱动,它可以与 taosd 共享同一个配置文件 taos.cfg,也可以使用单独指定配置文件。运行 taos 时,使用参数-c 指定配置文件目录,如 taos -c /home/cfg,表示使用/home/cfg/目录下的 taos.cfg 配置文件中的参数,缺省目录是/etc/taos。更多 taos 的使用方法请见帮助信息 `taos --help` TDengine 系统的前台交互客户端应用程序为 taos,以及应用驱动,它可以与 taosd 共享同一个配置文件 taos.cfg,也可以使用单独指定配置文件。运行 taos 时,使用参数-c 指定配置文件目录,如 taos -c /home/cfg,表示使用/home/cfg/目录下的 taos.cfg 配置文件中的参数,缺省目录是/etc/taos。更多 taos 的使用方法请见帮助信息 `taos --help`
**2.0.10.0 之后版本支持命令行以下参数显示当前客户端参数的配置**
```bash ```bash
taos -C taos -C
``` ```
...@@ -47,19 +45,19 @@ taos --dump-config ...@@ -47,19 +45,19 @@ taos --dump-config
### firstEp ### firstEp
| 属性 | 说明 | | 属性 | 说明 |
| -------- | --------------------------------------------------------------- | | -------- | -------------------------------------------------------------- |
| 适用范围 | 服务端和客户端均适用 | | 适用范围 | 服务端和客户端均适用 |
| 含义 | taosd 或者 taos 启动时,主动连接的集群中首个 dnode 的 endpoint | | 含义 | taosd 或者 taos 启动时,主动连接的集群中首个 dnode 的 endpoint |
| 缺省值 | localhost:6030 | | 缺省值 | localhost:6030 |
### secondEp ### secondEp
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------------------------------------------------------------------------- | | -------- | ------------------------------------------------------------------------------------- |
| 适用范围 | 服务端和客户端均适用 | | 适用范围 | 服务端和客户端均适用 |
| 含义 | taosd 或者 taos 启动时,如果 firstEp 连接不上,尝试连接集群中第二个 dnode 的 endpoint | | 含义 | taosd 或者 taos 启动时,如果 firstEp 连接不上,尝试连接集群中第二个 dnode 的 endpoint |
| 缺省值 | 无 | | 缺省值 | 无 |
### fqdn ### fqdn
...@@ -77,7 +75,6 @@ taos --dump-config ...@@ -77,7 +75,6 @@ taos --dump-config
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | taosd 启动后,对外服务的端口号 | | 含义 | taosd 启动后,对外服务的端口号 |
| 缺省值 | 6030 | | 缺省值 | 6030 |
| 补充说明 | RESTful 服务在 2.4.0.0 之前(不含)由 taosd 提供,默认端口为 6041; 在 2.4.0.0 及后续版本由 taosAdapter,默认端口为 6041 |
:::note :::note
确保集群中所有主机在端口 6030 上的 TCP 协议能够互通。(详细的端口情况请参见下表) 确保集群中所有主机在端口 6030 上的 TCP 协议能够互通。(详细的端口情况请参见下表)
...@@ -87,8 +84,8 @@ taos --dump-config ...@@ -87,8 +84,8 @@ taos --dump-config
| TCP | 6030 | 客户端与服务端之间通讯,多节点集群的节点间通讯。 | 由配置文件设置 serverPort 决定。 | | TCP | 6030 | 客户端与服务端之间通讯,多节点集群的节点间通讯。 | 由配置文件设置 serverPort 决定。 |
| TCP | 6041 | 客户端与服务端之间的 RESTful 通讯。 | 随 serverPort 端口变化。注意 taosAdapter 配置或有不同,请参考相应[文档](/reference/taosadapter/)。 | | TCP | 6041 | 客户端与服务端之间的 RESTful 通讯。 | 随 serverPort 端口变化。注意 taosAdapter 配置或有不同,请参考相应[文档](/reference/taosadapter/)。 |
| TCP | 6043 | TaosKeeper 监控服务端口。 | 随 TaosKeeper 启动参数设置变化。 | | TCP | 6043 | TaosKeeper 监控服务端口。 | 随 TaosKeeper 启动参数设置变化。 |
| TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化(2.3.0.1+以上版本)。 | | TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化|
| UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化(2.3.0.1+以上版本)。 | | UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化 |
| TCP | 6060 | 企业版内 Monitor 服务的网络端口。 | | | TCP | 6060 | 企业版内 Monitor 服务的网络端口。 | |
### maxShellConns ### maxShellConns
...@@ -104,28 +101,28 @@ taos --dump-config ...@@ -104,28 +101,28 @@ taos --dump-config
### monitor ### monitor
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | 服务器内部的系统监控开关。监控主要负责收集物理节点的负载状况,包括 CPU、内存、硬盘、网络带宽的监控记录,监控信息将通过 HTTP 协议发送给由 `monitorFqdn``monitorProt` 指定的 TaosKeeper 监控服务 | | 含义 | 服务器内部的系统监控开关。监控主要负责收集物理节点的负载状况,包括 CPU、内存、硬盘、网络带宽的监控记录,监控信息将通过 HTTP 协议发送给由 `monitorFqdn``monitorProt` 指定的 TaosKeeper 监控服务 |
| 取值范围 | 0:关闭监控服务, 1:激活监控服务。 | | 取值范围 | 0:关闭监控服务, 1:激活监控服务。 |
| 缺省值 | 1 | | 缺省值 | 1 |
### monitorFqdn ### monitorFqdn
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------------------------------- | | -------- | -------------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | TaosKeeper 监控服务的 FQDN | | 含义 | TaosKeeper 监控服务的 FQDN |
| 缺省值 | 无 | | 缺省值 | 无 |
### monitorPort ### monitorPort
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------------------------------- | | -------- | --------------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | TaosKeeper 监控服务的端口号 | | 含义 | TaosKeeper 监控服务的端口号 |
| 缺省值 | 6043 | | 缺省值 | 6043 |
### monitorInterval ### monitorInterval
...@@ -134,10 +131,9 @@ taos --dump-config ...@@ -134,10 +131,9 @@ taos --dump-config
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | 监控数据库记录系统参数(CPU/内存)的时间间隔 | | 含义 | 监控数据库记录系统参数(CPU/内存)的时间间隔 |
| 单位 | 秒 | | 单位 | 秒 |
| 取值范围 | 1-200000 | | 取值范围 | 1-200000 |
| 缺省值 | 30 | | 缺省值 | 30 |
### telemetryReporting ### telemetryReporting
| 属性 | 说明 | | 属性 | 说明 |
...@@ -149,25 +145,43 @@ taos --dump-config ...@@ -149,25 +145,43 @@ taos --dump-config
## 查询相关 ## 查询相关
### queryBufferSize ### queryPolicy
| 属性 | 说明 |
| -------- | ----------------------------- |
| 适用范围 | 仅客户端适用 |
| 含义 | 查询语句的执行策略 |
| 单位 | 无 |
| 缺省值 | 1 |
| 补充说明 | 1: 只使用 vnode,不使用 qnode |
2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行
3: vnode 只运行扫描算子,其余算子均在 qnode 执行 |
### querySmaOptimize
| 属性 | 说明 |
| -------- | -------------------- |
| 适用范围 | 仅客户端适用 |
| 含义 | sma index 的优化策略 |
| 单位 | 无 |
| 缺省值 | 0 |
| 补充说明 |
0: 表示不使用 sma index,永远从原始数据进行查询
1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 |
| 属性 | 说明 |
| -------- | ------------------------------------------------------------------------------------------------------------------- |
| 适用范围 | 仅服务端适用 |
| 含义 | 为所有并发查询占用保留的内存大小。 |
| 单位 | MB |
| 缺省值 | 无 |
| 补充说明 | 计算规则可以根据实际应用可能的最大并发数和表的数字相乘,再乘 170 。<br/>(2.0.15 以前的版本中,此参数的单位是字节) |
### maxNumOfDistinctRes ### maxNumOfDistinctRes
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------------------- | | -------- | -------------------------------- | --- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | 允许返回的 distinct 结果最大行数 | | 含义 | 允许返回的 distinct 结果最大行数 |
| 取值范围 | 默认值为 10 万,最大值 1 亿 | | 取值范围 | 默认值为 10 万,最大值 1 亿 |
| 缺省值 | 10 万 | | 缺省值 | 10 万 |
| 补充说明 | 2.3 版本新增。 | |
## 区域相关 ## 区域相关
...@@ -306,12 +320,12 @@ charset 的有效值是 UTF-8。 ...@@ -306,12 +320,12 @@ charset 的有效值是 UTF-8。
### supportVnodes ### supportVnodes
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | -------- | --------------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | dnode 支持的最大 vnode 数目 | | 含义 | dnode 支持的最大 vnode 数目 |
| 取值范围 | 0-4096 | | 取值范围 | 0-4096 |
| 缺省值 | 256 | | 缺省值 | 256 |
## 时间相关 ## 时间相关
...@@ -366,7 +380,6 @@ charset 的有效值是 UTF-8。 ...@@ -366,7 +380,6 @@ charset 的有效值是 UTF-8。
| 单位 | bytes | | 单位 | bytes |
| 取值范围 | 0: 对所有查询结果均进行压缩 >0: 查询结果中任意列大小超过该值的消息才进行压缩 -1: 不压缩 | | 取值范围 | 0: 对所有查询结果均进行压缩 >0: 查询结果中任意列大小超过该值的消息才进行压缩 -1: 不压缩 |
| 缺省值 | -1 | | 缺省值 | -1 |
| 补充说明 | 2.3.0.0 版本新增。 |
## 日志相关 ## 日志相关
...@@ -464,7 +477,7 @@ charset 的有效值是 UTF-8。 ...@@ -464,7 +477,7 @@ charset 的有效值是 UTF-8。
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------- | | -------- | -------------------- |
| 适用范围 | 服务端和客户端均适用 | | 适用范围 | 服务端和客户端均适用 |
| 含义 | query 模块的日志开关 | | 含义 | query 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
...@@ -481,7 +494,7 @@ charset 的有效值是 UTF-8。 ...@@ -481,7 +494,7 @@ charset 的有效值是 UTF-8。
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------- | | -------- | -------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | dnode 模块的日志开关 | | 含义 | dnode 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | 135 | | 缺省值 | 135 |
...@@ -490,29 +503,29 @@ charset 的有效值是 UTF-8。 ...@@ -490,29 +503,29 @@ charset 的有效值是 UTF-8。
| 属性 | 说明 | | 属性 | 说明 |
| -------- | -------------------- | | -------- | -------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | vnode 模块的日志开关 | | 含义 | vnode 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
### mDebugFlag ### mDebugFlag
| 属性 | 说明 |
| -------- | -------------------- |
| 适用范围 | 仅服务端适用 |
| 含义 | mnode 模块的日志开关 |
| 取值范围 | 同上 |
| 缺省值 | 135 |
### wDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ------------------ | | -------- | ------------------ |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | mnode 模块的日志开关 | | 含义 | wal 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | 135 | | 缺省值 | 135 |
### wDebugFlag
| 属性 | 说明 |
| -------- | -------------------- |
| 适用范围 | 仅服务端适用 |
| 含义 | wal 模块的日志开关 |
| 取值范围 | 同上 |
| 缺省值 | 135 |
### sDebugFlag ### sDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
...@@ -533,57 +546,86 @@ charset 的有效值是 UTF-8。 ...@@ -533,57 +546,86 @@ charset 的有效值是 UTF-8。
### tqDebugFlag ### tqDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ------------------- | | -------- | ----------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | tq 模块的日志开关 | | 含义 | tq 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
### fsDebugFlag ### fsDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ------------------- | | -------- | ----------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | fs 模块的日志开关 | | 含义 | fs 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
### udfDebugFlag ### udfDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ---------------------- | | -------- | ------------------ |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | UDF 模块的日志开关 | | 含义 | UDF 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
### smaDebugFlag ### smaDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ---------------------- | | -------- | ------------------ |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | sma 模块的日志开关 | | 含义 | sma 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
### idxDebugFlag ### idxDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ---------------------- | | -------- | -------------------- |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | index 模块的日志开关 | | 含义 | index 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
### tdbDebugFlag ### tdbDebugFlag
| 属性 | 说明 | | 属性 | 说明 |
| -------- | ---------------------- | | -------- | ------------------ |
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | tdb 模块的日志开关 | | 含义 | tdb 模块的日志开关 |
| 取值范围 | 同上 | | 取值范围 | 同上 |
| 缺省值 | | | 缺省值 | |
## Schemaless 相关
### smlChildTableName
| 属性 | 说明 |
| -------- | ------------------------- |
| 适用范围 | 仅客户端适用 |
| 含义 | schemaless 自定义的子表名 |
| 类型 | 字符串 |
| 缺省值 | 无 |
### smlTagName
| 属性 | 说明 |
| -------- | ------------------------------------ |
| 适用范围 | 仅客户端适用 |
| 含义 | schemaless tag 为空时默认的 tag 名字 |
| 类型 | 字符串 |
| 缺省值 | _tag_null |
### smlDataFormat
| 属性 | 说明 |
| -------- | ----------------------------- |
| 适用范围 | 仅客户端适用 |
| 含义 | schemaless 列数据是否顺序一致 |
| 值域 | 0:不一致;1: 一致 |
| 缺省值 | 1 |
## 其他 ## 其他
...@@ -596,3 +638,12 @@ charset 的有效值是 UTF-8。 ...@@ -596,3 +638,12 @@ charset 的有效值是 UTF-8。
| 取值范围 | 0:否,1:是 | | 取值范围 | 0:否,1:是 |
| 缺省值 | 1 | | 缺省值 | 1 |
| 补充说明 | 不同的启动方式,生成 core 文件的目录如下:1、systemctl start taosd 启动:生成的 core 在根目录下 <br/> 2、手动启动,就在 taosd 执行目录下。 | | 补充说明 | 不同的启动方式,生成 core 文件的目录如下:1、systemctl start taosd 启动:生成的 core 在根目录下 <br/> 2、手动启动,就在 taosd 执行目录下。 |
### udf
| 属性 | 说明 |
| -------- | ------------------ |
| 适用范围 | 仅服务端适用 |
| 含义 | 是否启动 udf 服务 |
| 取值范围 | 0: 不启动;1:启动 |
| 缺省值 | 1 |
此差异已折叠。
...@@ -89,7 +89,6 @@ extern uint16_t tsTelemPort; ...@@ -89,7 +89,6 @@ extern uint16_t tsTelemPort;
// query buffer management // query buffer management
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing
extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in byte for each data node extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in byte for each data node
extern bool tsRetrieveBlockingModel; // retrieve threads will be blocked
// query client // query client
extern int32_t tsQueryPolicy; extern int32_t tsQueryPolicy;
......
...@@ -96,6 +96,7 @@ typedef struct SScanLogicNode { ...@@ -96,6 +96,7 @@ typedef struct SScanLogicNode {
bool groupSort; bool groupSort;
int8_t cacheLastMode; int8_t cacheLastMode;
bool hasNormalCols; // neither tag column nor primary key tag column bool hasNormalCols; // neither tag column nor primary key tag column
bool sortPrimaryKey;
} SScanLogicNode; } SScanLogicNode;
typedef struct SJoinLogicNode { typedef struct SJoinLogicNode {
...@@ -204,6 +205,7 @@ typedef struct SWindowLogicNode { ...@@ -204,6 +205,7 @@ typedef struct SWindowLogicNode {
int8_t igExpired; int8_t igExpired;
EWindowAlgorithm windowAlgo; EWindowAlgorithm windowAlgo;
EOrder inputTsOrder; EOrder inputTsOrder;
EOrder outputTsOrder;
} SWindowLogicNode; } SWindowLogicNode;
typedef struct SFillLogicNode { typedef struct SFillLogicNode {
...@@ -212,6 +214,7 @@ typedef struct SFillLogicNode { ...@@ -212,6 +214,7 @@ typedef struct SFillLogicNode {
SNode* pWStartTs; SNode* pWStartTs;
SNode* pValues; // SNodeListNode SNode* pValues; // SNodeListNode
STimeWindow timeRange; STimeWindow timeRange;
EOrder inputTsOrder;
} SFillLogicNode; } SFillLogicNode;
typedef struct SSortLogicNode { typedef struct SSortLogicNode {
...@@ -410,6 +413,8 @@ typedef struct SWinodwPhysiNode { ...@@ -410,6 +413,8 @@ typedef struct SWinodwPhysiNode {
int8_t triggerType; int8_t triggerType;
int64_t watermark; int64_t watermark;
int8_t igExpired; int8_t igExpired;
EOrder inputTsOrder;
EOrder outputTsOrder;
} SWinodwPhysiNode; } SWinodwPhysiNode;
typedef struct SIntervalPhysiNode { typedef struct SIntervalPhysiNode {
...@@ -434,6 +439,7 @@ typedef struct SFillPhysiNode { ...@@ -434,6 +439,7 @@ typedef struct SFillPhysiNode {
SNode* pValues; // SNodeListNode SNode* pValues; // SNodeListNode
SNodeList* pTargets; SNodeList* pTargets;
STimeWindow timeRange; STimeWindow timeRange;
EOrder inputTsOrder;
} SFillPhysiNode; } SFillPhysiNode;
typedef struct SMultiTableIntervalPhysiNode { typedef struct SMultiTableIntervalPhysiNode {
......
@echo off @echo off
goto %1 goto %1
:needAdmin :needAdmin
mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&goto :eof mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof
:hasAdmin :hasAdmin
cp -f C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 cp -f C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32
\ No newline at end of file sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
...@@ -20,11 +20,6 @@ target_link_libraries( ...@@ -20,11 +20,6 @@ target_link_libraries(
) )
if(TD_WINDOWS) if(TD_WINDOWS)
set_target_properties(taos
PROPERTIES
LINK_FLAGS
/DEF:${CMAKE_CURRENT_SOURCE_DIR}/src/taos.def
)
INCLUDE_DIRECTORIES(jni/windows) INCLUDE_DIRECTORIES(jni/windows)
INCLUDE_DIRECTORIES(jni/windows/win32) INCLUDE_DIRECTORIES(jni/windows/win32)
INCLUDE_DIRECTORIES(jni/windows/win32/bridge) INCLUDE_DIRECTORIES(jni/windows/win32/bridge)
......
taos_cleanup
taos_options
taos_set_config
taos_init
taos_connect
taos_connect_l
taos_connect_auth
taos_close
taos_data_type
taos_stmt_init
taos_stmt_prepare
taos_stmt_set_tbname_tags
taos_stmt_set_tbname
taos_stmt_set_sub_tbname
taos_stmt_is_insert
taos_stmt_num_params
taos_stmt_get_param
taos_stmt_bind_param
taos_stmt_bind_param_batch
taos_stmt_bind_single_param_batch
taos_stmt_add_batch
taos_stmt_execute
taos_stmt_use_result
taos_stmt_close
taos_stmt_errstr
taos_stmt_affected_rows
taos_stmt_affected_rows_once
taos_query
taos_query_l
taos_fetch_row
taos_result_precision
taos_free_result
taos_field_count
taos_num_fields
taos_affected_rows
taos_fetch_fields
taos_select_db
taos_print_row
taos_stop_query
taos_is_null
taos_is_update_query
taos_fetch_block
taos_fetch_block_s
taos_fetch_raw_block
taos_get_column_data_offset
taos_validate_sql
taos_reset_current_db
taos_fetch_lengths
taos_result_block
taos_get_server_info
taos_get_client_info
taos_errstr
taos_errno
taos_query_a
taos_fetch_rows_a
taos_subscribe
taos_consume
taos_unsubscribe
taos_load_table_info
taos_schemaless_insert
tmq_list_new
tmq_list_append
tmq_list_destroy
tmq_list_get_size
tmq_list_to_c_array
tmq_consumer_new
tmq_err2str
tmq_subscribe
tmq_unsubscribe
tmq_subscription
tmq_consumer_poll
tmq_consumer_close
tmq_commit
tmq_conf_new
tmq_conf_set
tmq_conf_destroy
tmq_conf_set_offset_commit_cb
tmq_get_topic_name
tmq_get_vgroup_id
tmq_create_stream
taos_check_server_status
\ No newline at end of file
...@@ -124,9 +124,6 @@ int32_t tsMinIntervalTime = 1; ...@@ -124,9 +124,6 @@ int32_t tsMinIntervalTime = 1;
int32_t tsQueryBufferSize = -1; int32_t tsQueryBufferSize = -1;
int64_t tsQueryBufferSizeBytes = -1; int64_t tsQueryBufferSizeBytes = -1;
// in retrieve blocking model, the retrieve threads will wait for the completion of the query processing.
bool tsRetrieveBlockingModel = false;
// tsdb config // tsdb config
// For backward compatibility // For backward compatibility
bool tsdbForceKeepFile = false; bool tsdbForceKeepFile = false;
...@@ -296,6 +293,7 @@ static int32_t taosAddServerLogCfg(SConfig *pCfg) { ...@@ -296,6 +293,7 @@ static int32_t taosAddServerLogCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "smaDebugFlag", smaDebugFlag, 0, 255, 0) != 0) return -1; if (cfgAddInt32(pCfg, "smaDebugFlag", smaDebugFlag, 0, 255, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "idxDebugFlag", idxDebugFlag, 0, 255, 0) != 0) return -1; if (cfgAddInt32(pCfg, "idxDebugFlag", idxDebugFlag, 0, 255, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "tdbDebugFlag", tdbDebugFlag, 0, 255, 0) != 0) return -1; if (cfgAddInt32(pCfg, "tdbDebugFlag", tdbDebugFlag, 0, 255, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "metaDebugFlag", metaDebugFlag, 0, 255, 0) != 0) return -1;
return 0; return 0;
} }
...@@ -362,7 +360,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { ...@@ -362,7 +360,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "maxNumOfDistinctRes", tsMaxNumOfDistinctResults, 10 * 10000, 10000 * 10000, 0) != 0) return -1; if (cfgAddInt32(pCfg, "maxNumOfDistinctRes", tsMaxNumOfDistinctResults, 10 * 10000, 10000 * 10000, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "countAlwaysReturnValue", tsCountAlwaysReturnValue, 0, 1, 0) != 0) return -1; if (cfgAddInt32(pCfg, "countAlwaysReturnValue", tsCountAlwaysReturnValue, 0, 1, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "queryBufferSize", tsQueryBufferSize, -1, 500000000000, 0) != 0) return -1; if (cfgAddInt32(pCfg, "queryBufferSize", tsQueryBufferSize, -1, 500000000000, 0) != 0) return -1;
if (cfgAddBool(pCfg, "retrieveBlockingModel", tsRetrieveBlockingModel, 0) != 0) return -1;
if (cfgAddBool(pCfg, "printAuth", tsPrintAuth, 0) != 0) return -1; if (cfgAddBool(pCfg, "printAuth", tsPrintAuth, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "multiProcess", tsMultiProcess, 0, 2, 0) != 0) return -1; if (cfgAddInt32(pCfg, "multiProcess", tsMultiProcess, 0, 2, 0) != 0) return -1;
...@@ -476,6 +473,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) { ...@@ -476,6 +473,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
smaDebugFlag = cfgGetItem(pCfg, "smaDebugFlag")->i32; smaDebugFlag = cfgGetItem(pCfg, "smaDebugFlag")->i32;
idxDebugFlag = cfgGetItem(pCfg, "idxDebugFlag")->i32; idxDebugFlag = cfgGetItem(pCfg, "idxDebugFlag")->i32;
tdbDebugFlag = cfgGetItem(pCfg, "tdbDebugFlag")->i32; tdbDebugFlag = cfgGetItem(pCfg, "tdbDebugFlag")->i32;
metaDebugFlag = cfgGetItem(pCfg, "metaDebugFlag")->i32;
} }
static int32_t taosSetClientCfg(SConfig *pCfg) { static int32_t taosSetClientCfg(SConfig *pCfg) {
...@@ -547,7 +545,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { ...@@ -547,7 +545,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMaxNumOfDistinctResults = cfgGetItem(pCfg, "maxNumOfDistinctRes")->i32; tsMaxNumOfDistinctResults = cfgGetItem(pCfg, "maxNumOfDistinctRes")->i32;
tsCountAlwaysReturnValue = cfgGetItem(pCfg, "countAlwaysReturnValue")->i32; tsCountAlwaysReturnValue = cfgGetItem(pCfg, "countAlwaysReturnValue")->i32;
tsQueryBufferSize = cfgGetItem(pCfg, "queryBufferSize")->i32; tsQueryBufferSize = cfgGetItem(pCfg, "queryBufferSize")->i32;
tsRetrieveBlockingModel = cfgGetItem(pCfg, "retrieveBlockingModel")->bval;
tsPrintAuth = cfgGetItem(pCfg, "printAuth")->bval; tsPrintAuth = cfgGetItem(pCfg, "printAuth")->bval;
tsMultiProcess = cfgGetItem(pCfg, "multiProcess")->bval; tsMultiProcess = cfgGetItem(pCfg, "multiProcess")->bval;
...@@ -832,9 +829,7 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { ...@@ -832,9 +829,7 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
break; break;
} }
case 'r': { case 'r': {
if (strcasecmp("retrieveBlockingModel", name) == 0) { if (strcasecmp("rpcQueueMemoryAllowed", name) == 0) {
tsRetrieveBlockingModel = cfgGetItem(pCfg, "retrieveBlockingModel")->bval;
} else if (strcasecmp("rpcQueueMemoryAllowed", name) == 0) {
tsRpcQueueMemoryAllowed = cfgGetItem(pCfg, "rpcQueueMemoryAllowed")->i64; tsRpcQueueMemoryAllowed = cfgGetItem(pCfg, "rpcQueueMemoryAllowed")->i64;
} else if (strcasecmp("rpcDebugFlag", name) == 0) { } else if (strcasecmp("rpcDebugFlag", name) == 0) {
rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32; rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32;
...@@ -1100,12 +1095,12 @@ void taosCfgDynamicOptions(const char *option, const char *value) { ...@@ -1100,12 +1095,12 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
const char *options[] = { const char *options[] = {
"dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag", "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag",
"tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag",
"tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "metaDebugFlag",
}; };
int32_t *optionVars[] = { int32_t *optionVars[] = {
&dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag, &dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag,
&tqDebugFlag, &fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tdbDebugFlag, &tqDebugFlag, &fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tdbDebugFlag,
&tmrDebugFlag, &uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag, &tmrDebugFlag, &uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag, &metaDebugFlag,
}; };
int32_t optionSize = tListLen(options); int32_t optionSize = tListLen(options);
...@@ -1152,5 +1147,6 @@ void taosSetAllDebugFlag(int32_t flag) { ...@@ -1152,5 +1147,6 @@ void taosSetAllDebugFlag(int32_t flag) {
taosSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag); taosSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag);
taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag); taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag);
taosSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag); taosSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag);
taosSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag);
uInfo("all debug flag are set to %d", flag); uInfo("all debug flag are set to %d", flag);
} }
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#define DM_VERSION "Print program version." #define DM_VERSION "Print program version."
#define DM_EMAIL "<support@taosdata.com>" #define DM_EMAIL "<support@taosdata.com>"
static struct { static struct {
#ifdef WINDOWS
bool winServiceMode;
#endif
bool dumpConfig; bool dumpConfig;
bool generateGrant; bool generateGrant;
bool printAuth; bool printAuth;
...@@ -93,6 +96,10 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { ...@@ -93,6 +96,10 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
global.dumpConfig = true; global.dumpConfig = true;
} else if (strcmp(argv[i], "-V") == 0) { } else if (strcmp(argv[i], "-V") == 0) {
global.printVersion = true; global.printVersion = true;
#ifdef WINDOWS
} else if (strcmp(argv[i], "--win_service") == 0) {
global.winServiceMode = true;
#endif
} else if (strcmp(argv[i], "-e") == 0) { } else if (strcmp(argv[i], "-e") == 0) {
global.envCmd[cmdEnvIndex] = argv[++i]; global.envCmd[cmdEnvIndex] = argv[++i];
cmdEnvIndex++; cmdEnvIndex++;
...@@ -169,6 +176,18 @@ int main(int argc, char const *argv[]) { ...@@ -169,6 +176,18 @@ int main(int argc, char const *argv[]) {
return -1; return -1;
} }
#ifdef WINDOWS
int mainWindows(int argc,char** argv);
if (global.winServiceMode) {
stratWindowsService(mainWindows);
} else {
return mainWindows(argc, argv);
}
return 0;
}
int mainWindows(int argc,char** argv) {
#endif
if (global.generateGrant) { if (global.generateGrant) {
dmGenerateGrant(); dmGenerateGrant();
taosCleanupArgs(); taosCleanupArgs();
......
...@@ -788,9 +788,9 @@ _OVER: ...@@ -788,9 +788,9 @@ _OVER:
static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node; SMnode *pMnode = pReq->info.node;
const char *options[] = { const char *options[] = {
"debugFlag", "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "debugFlag", "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag",
"tsdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag", "tmrDebugFlag",
"tdbDebugFlag", "tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "metaDebugFlag",
}; };
int32_t optionSize = tListLen(options); int32_t optionSize = tListLen(options);
......
...@@ -145,6 +145,8 @@ int32_t metaSnapWriterOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapWr ...@@ -145,6 +145,8 @@ int32_t metaSnapWriterOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapWr
pWriter->sver = sver; pWriter->sver = sver;
pWriter->ever = ever; pWriter->ever = ever;
metaBegin(pMeta);
*ppWriter = pWriter; *ppWriter = pWriter;
return code; return code;
......
...@@ -175,7 +175,7 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST ...@@ -175,7 +175,7 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST
cacheRow = (STSRow *)taosLRUCacheValue(pCache, h); cacheRow = (STSRow *)taosLRUCacheValue(pCache, h);
if (row->ts >= cacheRow->ts) { if (row->ts >= cacheRow->ts) {
if (row->ts == cacheRow->ts) { if (row->ts == cacheRow->ts) {
STSRow *mergedRow; STSRow *mergedRow = NULL;
SRowMerger merger = {0}; SRowMerger merger = {0};
STSchema *pTSchema = metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1); STSchema *pTSchema = metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1);
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
// clang-format off
#include "nodes.h" #include "nodes.h"
#include "plannodes.h" #include "plannodes.h"
#include "ttime.h" #include "ttime.h"
...@@ -77,6 +79,8 @@ extern "C" { ...@@ -77,6 +79,8 @@ extern "C" {
#define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64 #define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64
#define EXPLAIN_MODE_FORMAT "mode=%s" #define EXPLAIN_MODE_FORMAT "mode=%s"
#define EXPLAIN_STRING_TYPE_FORMAT "%s" #define EXPLAIN_STRING_TYPE_FORMAT "%s"
#define EXPLAIN_INPUT_ORDER_FORMAT "input_order=%s"
#define EXPLAIN_OUTPUT_ORDER_TYPE_FORMAT "output_order=%s"
#define COMMAND_RESET_LOG "resetLog" #define COMMAND_RESET_LOG "resetLog"
#define COMMAND_SCHEDULE_POLICY "schedulePolicy" #define COMMAND_SCHEDULE_POLICY "schedulePolicy"
...@@ -122,7 +126,7 @@ typedef struct SExplainCtx { ...@@ -122,7 +126,7 @@ typedef struct SExplainCtx {
SHashObj *groupHash; // Hash<SExplainGroup> SHashObj *groupHash; // Hash<SExplainGroup>
} SExplainCtx; } SExplainCtx;
#define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") #define EXPLAIN_ORDER_STRING(_order) ((ORDER_ASC == _order) ? "asc" : "desc")
#define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") #define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join")
#define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u))) #define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u)))
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// clang-format off
#include "commandInt.h" #include "commandInt.h"
#include "plannodes.h" #include "plannodes.h"
#include "query.h" #include "query.h"
...@@ -849,6 +850,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i ...@@ -849,6 +850,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pIntNode->window.pFuncs->length); EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pIntNode->window.pFuncs->length);
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pIntNode->window.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pIntNode->window.node.pOutputDataBlockDesc->totalRowSize);
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_INPUT_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pIntNode->window.inputTsOrder));
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_OUTPUT_ORDER_TYPE_FORMAT, EXPLAIN_ORDER_STRING(pIntNode->window.outputTsOrder));
EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT);
EXPLAIN_ROW_END(); EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level));
...@@ -1154,7 +1159,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i ...@@ -1154,7 +1159,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_MERGE_KEYS_FORMAT); EXPLAIN_ROW_NEW(level + 1, EXPLAIN_MERGE_KEYS_FORMAT);
for (int32_t i = 0; i < LIST_LENGTH(pMergeNode->pMergeKeys); ++i) { for (int32_t i = 0; i < LIST_LENGTH(pMergeNode->pMergeKeys); ++i) {
SOrderByExprNode *ptn = (SOrderByExprNode *)nodesListGetNode(pMergeNode->pMergeKeys, i); SOrderByExprNode *ptn = (SOrderByExprNode *)nodesListGetNode(pMergeNode->pMergeKeys, i);
EXPLAIN_ROW_APPEND("%s ", nodesGetNameFromColumnNode(ptn->pExpr)); EXPLAIN_ROW_APPEND(EXPLAIN_STRING_TYPE_FORMAT, nodesGetNameFromColumnNode(ptn->pExpr));
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_STRING_TYPE_FORMAT, EXPLAIN_ORDER_STRING(ptn->order));
} }
EXPLAIN_ROW_END(); EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
......
...@@ -523,7 +523,8 @@ typedef struct SIntervalAggOperatorInfo { ...@@ -523,7 +523,8 @@ typedef struct SIntervalAggOperatorInfo {
STimeWindow win; // query time range STimeWindow win; // query time range
bool timeWindowInterpo; // interpolation needed or not bool timeWindowInterpo; // interpolation needed or not
SArray* pInterpCols; // interpolation columns SArray* pInterpCols; // interpolation columns
int32_t order; // current SSDataBlock scan order int32_t resultTsOrder; // result timestamp order
int32_t inputOrder; // input data ts order
EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model]
STimeWindowAggSupp twAggSup; STimeWindowAggSupp twAggSup;
bool invertible; bool invertible;
...@@ -533,8 +534,7 @@ typedef struct SIntervalAggOperatorInfo { ...@@ -533,8 +534,7 @@ typedef struct SIntervalAggOperatorInfo {
SArray* pDelWins; // SWinRes SArray* pDelWins; // SWinRes
int32_t delIndex; int32_t delIndex;
SSDataBlock* pDelRes; SSDataBlock* pDelRes;
SNode* pCondition;
SNode *pCondition;
} SIntervalAggOperatorInfo; } SIntervalAggOperatorInfo;
typedef struct SMergeAlignedIntervalAggOperatorInfo { typedef struct SMergeAlignedIntervalAggOperatorInfo {
...@@ -804,7 +804,7 @@ typedef struct STagFilterOperatorInfo { ...@@ -804,7 +804,7 @@ typedef struct STagFilterOperatorInfo {
typedef struct SJoinOperatorInfo { typedef struct SJoinOperatorInfo {
SSDataBlock *pRes; SSDataBlock *pRes;
int32_t joinType; int32_t joinType;
int32_t inputTsOrder; int32_t inputOrder;
SSDataBlock *pLeft; SSDataBlock *pLeft;
int32_t leftPos; int32_t leftPos;
......
...@@ -74,9 +74,9 @@ void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataB ...@@ -74,9 +74,9 @@ void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataB
struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, const struct SNodeListNode* val); struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, const struct SNodeListNode* val);
bool taosFillHasMoreResults(struct SFillInfo* pFillInfo); bool taosFillHasMoreResults(struct SFillInfo* pFillInfo);
SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols,
SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t slotId, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t slotId,
const char* id); int32_t order, const char* id);
void* taosDestroyFillInfo(struct SFillInfo *pFillInfo); void* taosDestroyFillInfo(struct SFillInfo *pFillInfo);
int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, SSDataBlock* p, int32_t capacity); int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, SSDataBlock* p, int32_t capacity);
......
...@@ -3586,15 +3586,14 @@ void doDestroyExchangeOperatorInfo(void* param) { ...@@ -3586,15 +3586,14 @@ void doDestroyExchangeOperatorInfo(void* param) {
} }
static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SNodeListNode* pValNode, static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SNodeListNode* pValNode,
STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType) { STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType, int32_t order) {
SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pValNode); SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pValNode);
STimeWindow w = getAlignQueryTimeWindow(pInterval, pInterval->precision, win.skey); STimeWindow w = getAlignQueryTimeWindow(pInterval, pInterval->precision, win.skey);
w = getFirstQualifiedTimeWindow(win.skey, &w, pInterval, TSDB_ORDER_ASC); w = getFirstQualifiedTimeWindow(win.skey, &w, pInterval, TSDB_ORDER_ASC);
int32_t order = TSDB_ORDER_ASC;
pInfo->pFillInfo = pInfo->pFillInfo =
taosCreateFillInfo(order, w.skey, 0, capacity, numOfCols, pInterval, fillType, pColInfo, pInfo->primaryTsCol, id); taosCreateFillInfo(w.skey, 0, capacity, numOfCols, pInterval, fillType, pColInfo, pInfo->primaryTsCol, order, id);
pInfo->win = win; pInfo->win = win;
pInfo->p = taosMemoryCalloc(numOfCols, POINTER_BYTES); pInfo->p = taosMemoryCalloc(numOfCols, POINTER_BYTES);
...@@ -3624,6 +3623,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* ...@@ -3624,6 +3623,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
? &((SMergeAlignedIntervalAggOperatorInfo*)downstream->info)->intervalAggOperatorInfo->interval ? &((SMergeAlignedIntervalAggOperatorInfo*)downstream->info)->intervalAggOperatorInfo->interval
: &((SIntervalAggOperatorInfo*)downstream->info)->interval; : &((SIntervalAggOperatorInfo*)downstream->info)->interval;
int32_t order = (pPhyFillNode->inputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC;
int32_t type = convertFillType(pPhyFillNode->mode); int32_t type = convertFillType(pPhyFillNode->mode);
SResultInfo* pResultInfo = &pOperator->resultInfo; SResultInfo* pResultInfo = &pOperator->resultInfo;
...@@ -3635,7 +3635,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* ...@@ -3635,7 +3635,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
&numOfOutputCols, COL_MATCH_FROM_SLOT_ID); &numOfOutputCols, COL_MATCH_FROM_SLOT_ID);
int32_t code = initFillInfo(pInfo, pExprInfo, num, (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange, int32_t code = initFillInfo(pInfo, pExprInfo, num, (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange,
pResultInfo->capacity, pTaskInfo->id.str, pInterval, type); pResultInfo->capacity, pTaskInfo->id.str, pInterval, type, order);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
goto _error; goto _error;
} }
......
...@@ -77,11 +77,11 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t ...@@ -77,11 +77,11 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t
pInfo->pCondAfterMerge = NULL; pInfo->pCondAfterMerge = NULL;
} }
pInfo->inputTsOrder = TSDB_ORDER_ASC; pInfo->inputOrder = TSDB_ORDER_ASC;
if (pJoinNode->inputTsOrder == ORDER_ASC) { if (pJoinNode->inputTsOrder == ORDER_ASC) {
pInfo->inputTsOrder = TSDB_ORDER_ASC; pInfo->inputOrder = TSDB_ORDER_ASC;
} else if (pJoinNode->inputTsOrder == ORDER_DESC) { } else if (pJoinNode->inputTsOrder == ORDER_DESC) {
pInfo->inputTsOrder = TSDB_ORDER_DESC; pInfo->inputOrder = TSDB_ORDER_DESC;
} }
pOperator->fpSet = pOperator->fpSet =
...@@ -312,7 +312,7 @@ static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes) ...@@ -312,7 +312,7 @@ static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes)
int32_t nrows = pRes->info.rows; int32_t nrows = pRes->info.rows;
bool asc = (pJoinInfo->inputTsOrder == TSDB_ORDER_ASC) ? true : false; bool asc = (pJoinInfo->inputOrder == TSDB_ORDER_ASC) ? true : false;
while (1) { while (1) {
int64_t leftTs = 0; int64_t leftTs = 0;
......
...@@ -66,7 +66,7 @@ static void setNullRow(SSDataBlock* pBlock, int64_t ts, int32_t rowIndex) { ...@@ -66,7 +66,7 @@ static void setNullRow(SSDataBlock* pBlock, int64_t ts, int32_t rowIndex) {
static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey); static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey);
static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32_t rowIndex, int64_t currentKey) { static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32_t rowIndex, int64_t currentKey) {
if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) { if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) {
float v = 0; float v = 0;
GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); GET_TYPED_DATA(v, float, pVar->nType, &pVar->i);
...@@ -184,7 +184,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* ...@@ -184,7 +184,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
continue; continue;
} }
SVariant* pVar = &pFillInfo->pFillCol[i].fillVal; SVariant* pVar = &pFillInfo->pFillCol[i].fillVal;
SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i);
doSetUserSpecifiedValue(pDst, pVar, index, pFillInfo->currentKey); doSetUserSpecifiedValue(pDst, pVar, index, pFillInfo->currentKey);
} }
...@@ -298,7 +298,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t ...@@ -298,7 +298,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
SColumnInfoData* pSrc = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, srcSlotId); SColumnInfoData* pSrc = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, srcSlotId);
char* src = colDataGetData(pSrc, pFillInfo->index); char* src = colDataGetData(pSrc, pFillInfo->index);
if (/*i == 0 || (*/!colDataIsNull_s(pSrc, pFillInfo->index)) { if (/*i == 0 || (*/ !colDataIsNull_s(pSrc, pFillInfo->index)) {
bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); bool isNull = colDataIsNull_s(pSrc, pFillInfo->index);
colDataAppend(pDst, index, src, isNull); colDataAppend(pDst, index, src, isNull);
saveColData(pFillInfo->prev, i, src, isNull); saveColData(pFillInfo->prev, i, src, isNull);
...@@ -313,7 +313,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t ...@@ -313,7 +313,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
} else if (pFillInfo->type == TSDB_FILL_LINEAR) { } else if (pFillInfo->type == TSDB_FILL_LINEAR) {
bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); bool isNull = colDataIsNull_s(pSrc, pFillInfo->index);
colDataAppend(pDst, index, src, isNull); colDataAppend(pDst, index, src, isNull);
saveColData(pFillInfo->prev, i, src, isNull); // todo: saveColData(pFillInfo->prev, i, src, isNull); // todo:
} else if (pFillInfo->type == TSDB_FILL_NULL) { } else if (pFillInfo->type == TSDB_FILL_NULL) {
colDataAppendNULL(pDst, index); colDataAppendNULL(pDst, index);
} else if (pFillInfo->type == TSDB_FILL_NEXT) { } else if (pFillInfo->type == TSDB_FILL_NEXT) {
...@@ -433,9 +433,9 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) { ...@@ -433,9 +433,9 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
return pFillInfo->numOfRows - pFillInfo->index; return pFillInfo->numOfRows - pFillInfo->index;
} }
struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols,
SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t primaryTsSlotId, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol,
const char* id) { int32_t primaryTsSlotId, int32_t order, const char* id) {
if (fillType == TSDB_FILL_NONE) { if (fillType == TSDB_FILL_NONE) {
return NULL; return NULL;
} }
...@@ -446,10 +446,9 @@ struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTag ...@@ -446,10 +446,9 @@ struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTag
return NULL; return NULL;
} }
pFillInfo->order = order;
pFillInfo->tsSlotId = primaryTsSlotId; pFillInfo->tsSlotId = primaryTsSlotId;
taosResetFillInfo(pFillInfo, skey); taosResetFillInfo(pFillInfo, skey);
pFillInfo->order = order;
switch (fillType) { switch (fillType) {
case FILL_MODE_NONE: case FILL_MODE_NONE:
...@@ -535,6 +534,14 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) { ...@@ -535,6 +534,14 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) {
return NULL; return NULL;
} }
void taosFillSetDataOrderInfo(SFillInfo* pFillInfo, int32_t order) {
if (pFillInfo == NULL || (order != TSDB_ORDER_ASC && order != TSDB_ORDER_DESC)) {
return;
}
pFillInfo->order = order;
}
void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey) { void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey) {
if (pFillInfo->type == TSDB_FILL_NONE) { if (pFillInfo->type == TSDB_FILL_NONE) {
return; return;
...@@ -581,7 +588,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma ...@@ -581,7 +588,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
int64_t numOfRes = -1; int64_t numOfRes = -1;
if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set. if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set.
TSKEY lastKey = tsList[pFillInfo->numOfRows - 1]; TSKEY lastKey = (TSDB_ORDER_ASC == pFillInfo->order ? tsList[pFillInfo->numOfRows - 1] : tsList[0]);
numOfRes = taosTimeCountInterval(lastKey, pFillInfo->currentKey, pFillInfo->interval.sliding, numOfRes = taosTimeCountInterval(lastKey, pFillInfo->currentKey, pFillInfo->interval.sliding,
pFillInfo->interval.slidingUnit, pFillInfo->interval.precision); pFillInfo->interval.slidingUnit, pFillInfo->interval.precision);
numOfRes += 1; numOfRes += 1;
...@@ -626,9 +633,9 @@ int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, SSDataBlock* p, int32_t ca ...@@ -626,9 +633,9 @@ int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, SSDataBlock* p, int32_t ca
} }
qDebug("fill:%p, generated fill result, src block:%d, index:%d, brange:%" PRId64 "-%" PRId64 ", currentKey:%" PRId64 qDebug("fill:%p, generated fill result, src block:%d, index:%d, brange:%" PRId64 "-%" PRId64 ", currentKey:%" PRId64
", current : % d, total : % d, %s", pFillInfo, ", current : % d, total : % d, %s",
pFillInfo->numOfRows, pFillInfo->index, pFillInfo->start, pFillInfo->end, pFillInfo->currentKey, pFillInfo, pFillInfo->numOfRows, pFillInfo->index, pFillInfo->start, pFillInfo->end, pFillInfo->currentKey,
pFillInfo->numOfCurrent, pFillInfo->numOfTotal, pFillInfo->id); pFillInfo->numOfCurrent, pFillInfo->numOfTotal, pFillInfo->id);
return numOfRes; return numOfRes;
} }
......
...@@ -362,7 +362,7 @@ static void setNotInterpoWindowKey(SqlFunctionCtx* pCtx, int32_t numOfOutput, in ...@@ -362,7 +362,7 @@ static void setNotInterpoWindowKey(SqlFunctionCtx* pCtx, int32_t numOfOutput, in
static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, int32_t pos, SSDataBlock* pBlock, static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, int32_t pos, SSDataBlock* pBlock,
const TSKEY* tsCols, STimeWindow* win, SExprSupp* pSup) { const TSKEY* tsCols, STimeWindow* win, SExprSupp* pSup) {
bool ascQuery = (pInfo->order == TSDB_ORDER_ASC); bool ascQuery = (pInfo->inputOrder == TSDB_ORDER_ASC);
TSKEY curTs = tsCols[pos]; TSKEY curTs = tsCols[pos];
...@@ -392,7 +392,7 @@ static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, i ...@@ -392,7 +392,7 @@ static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, i
static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SExprSupp* pSup, int32_t endRowIndex, static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SExprSupp* pSup, int32_t endRowIndex,
SArray* pDataBlock, const TSKEY* tsCols, TSKEY blockEkey, SArray* pDataBlock, const TSKEY* tsCols, TSKEY blockEkey,
STimeWindow* win) { STimeWindow* win) {
int32_t order = pInfo->order; int32_t order = pInfo->inputOrder;
TSKEY actualEndKey = tsCols[endRowIndex]; TSKEY actualEndKey = tsCols[endRowIndex];
TSKEY key = (order == TSDB_ORDER_ASC) ? win->ekey : win->skey; TSKEY key = (order == TSDB_ORDER_ASC) ? win->ekey : win->skey;
...@@ -550,7 +550,7 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB ...@@ -550,7 +550,7 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB
if (!done) { if (!done) {
int32_t endRowIndex = startPos + forwardRows - 1; int32_t endRowIndex = startPos + forwardRows - 1;
TSKEY endKey = (pInfo->order == TSDB_ORDER_ASC) ? pBlock->info.window.ekey : pBlock->info.window.skey; TSKEY endKey = (pInfo->inputOrder == TSDB_ORDER_ASC) ? pBlock->info.window.ekey : pBlock->info.window.skey;
bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, pBlock->pDataBlock, tsCols, endKey, win); bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, pBlock->pDataBlock, tsCols, endKey, win);
if (interp) { if (interp) {
setResultRowInterpo(pResult, RESULT_ROW_END_INTERP); setResultRowInterpo(pResult, RESULT_ROW_END_INTERP);
...@@ -639,7 +639,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num ...@@ -639,7 +639,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
setNotInterpoWindowKey(pSup->pCtx, numOfExprs, RESULT_ROW_START_INTERP); setNotInterpoWindowKey(pSup->pCtx, numOfExprs, RESULT_ROW_START_INTERP);
doApplyFunctions(pTaskInfo, pSup->pCtx, &w, &pInfo->twAggSup.timeWindowData, startPos, 0, tsCols, pBlock->info.rows, doApplyFunctions(pTaskInfo, pSup->pCtx, &w, &pInfo->twAggSup.timeWindowData, startPos, 0, tsCols, pBlock->info.rows,
numOfExprs, pInfo->order); numOfExprs, pInfo->inputOrder);
if (isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)) { if (isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)) {
closeResultRow(pr); closeResultRow(pr);
...@@ -924,11 +924,11 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ...@@ -924,11 +924,11 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
int32_t numOfOutput = pSup->numOfExprs; int32_t numOfOutput = pSup->numOfExprs;
int64_t* tsCols = extractTsCol(pBlock, pInfo); int64_t* tsCols = extractTsCol(pBlock, pInfo);
uint64_t tableGroupId = pBlock->info.groupId; uint64_t tableGroupId = pBlock->info.groupId;
bool ascScan = (pInfo->order == TSDB_ORDER_ASC); bool ascScan = (pInfo->inputOrder == TSDB_ORDER_ASC);
TSKEY ts = getStartTsKey(&pBlock->info.window, tsCols); TSKEY ts = getStartTsKey(&pBlock->info.window, tsCols);
SResultRow* pResult = NULL; SResultRow* pResult = NULL;
STimeWindow win = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->order); STimeWindow win = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->inputOrder);
int32_t ret = TSDB_CODE_SUCCESS; int32_t ret = TSDB_CODE_SUCCESS;
if ((!pInfo->ignoreExpiredData || !isCloseWindow(&win, &pInfo->twAggSup)) && if ((!pInfo->ignoreExpiredData || !isCloseWindow(&win, &pInfo->twAggSup)) &&
inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) { inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) {
...@@ -946,7 +946,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ...@@ -946,7 +946,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
TSKEY ekey = ascScan ? win.ekey : win.skey; TSKEY ekey = ascScan ? win.ekey : win.skey;
int32_t forwardRows = int32_t forwardRows =
getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder);
ASSERT(forwardRows > 0); ASSERT(forwardRows > 0);
// prev time window not interpolation yet. // prev time window not interpolation yet.
...@@ -969,7 +969,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ...@@ -969,7 +969,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) { inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) {
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &win, true); updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &win, true);
doApplyFunctions(pTaskInfo, pSup->pCtx, &win, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, doApplyFunctions(pTaskInfo, pSup->pCtx, &win, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols,
pBlock->info.rows, numOfOutput, pInfo->order); pBlock->info.rows, numOfOutput, pInfo->inputOrder);
} }
doCloseWindow(pResultRowInfo, pInfo, pResult); doCloseWindow(pResultRowInfo, pInfo, pResult);
...@@ -977,14 +977,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ...@@ -977,14 +977,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
STimeWindow nextWin = win; STimeWindow nextWin = win;
while (1) { while (1) {
int32_t prevEndPos = forwardRows - 1 + startPos; int32_t prevEndPos = forwardRows - 1 + startPos;
startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, pInfo->order); startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, pInfo->inputOrder);
if (startPos < 0) { if (startPos < 0) {
break; break;
} }
if (pInfo->ignoreExpiredData && isCloseWindow(&nextWin, &pInfo->twAggSup)) { if (pInfo->ignoreExpiredData && isCloseWindow(&nextWin, &pInfo->twAggSup)) {
ekey = ascScan ? nextWin.ekey : nextWin.skey; ekey = ascScan ? nextWin.ekey : nextWin.skey;
forwardRows = forwardRows =
getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder);
continue; continue;
} }
...@@ -1002,14 +1002,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ...@@ -1002,14 +1002,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
ekey = ascScan ? nextWin.ekey : nextWin.skey; ekey = ascScan ? nextWin.ekey : nextWin.skey;
forwardRows = forwardRows =
getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder);
// window start(end) key interpolation // window start(end) key interpolation
doWindowBorderInterpolation(pInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pSup); doWindowBorderInterpolation(pInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pSup);
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, true); updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, true);
doApplyFunctions(pTaskInfo, pSup->pCtx, &nextWin, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, doApplyFunctions(pTaskInfo, pSup->pCtx, &nextWin, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols,
pBlock->info.rows, numOfOutput, pInfo->order); pBlock->info.rows, numOfOutput, pInfo->inputOrder);
doCloseWindow(pResultRowInfo, pInfo, pResult); doCloseWindow(pResultRowInfo, pInfo, pResult);
} }
...@@ -1082,7 +1082,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { ...@@ -1082,7 +1082,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
break; break;
} }
getTableScanInfo(pOperator, &pInfo->order, &scanFlag); getTableScanInfo(pOperator, &pInfo->inputOrder, &scanFlag);
if (pInfo->scalarSupp.pExprInfo != NULL) { if (pInfo->scalarSupp.pExprInfo != NULL) {
SExprSupp* pExprSup = &pInfo->scalarSupp; SExprSupp* pExprSup = &pInfo->scalarSupp;
...@@ -1090,13 +1090,13 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { ...@@ -1090,13 +1090,13 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
} }
// the pDataBlock are always the same one, no need to call this again // the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->order, scanFlag, true); setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->inputOrder, scanFlag, true);
blockDataUpdateTsWindow(pBlock, pInfo->primaryTsIndex); blockDataUpdateTsWindow(pBlock, pInfo->primaryTsIndex);
hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag, NULL); hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag, NULL);
} }
initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, pInfo->order); initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, pInfo->resultTsOrder);
OPTR_SET_OPENED(pOperator); OPTR_SET_OPENED(pOperator);
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
...@@ -1249,7 +1249,6 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) { ...@@ -1249,7 +1249,6 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) {
} }
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
pOperator->status = OP_RES_TO_RETURN; pOperator->status = OP_RES_TO_RETURN;
initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC); initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC);
...@@ -1550,7 +1549,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { ...@@ -1550,7 +1549,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SIntervalAggOperatorInfo* pInfo = pOperator->info; SIntervalAggOperatorInfo* pInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
pInfo->order = TSDB_ORDER_ASC; pInfo->inputOrder = TSDB_ORDER_ASC;
SExprSupp* pSup = &pOperator->exprSupp; SExprSupp* pSup = &pOperator->exprSupp;
if (pOperator->status == OP_EXEC_DONE) { if (pOperator->status == OP_EXEC_DONE) {
...@@ -1610,7 +1609,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { ...@@ -1610,7 +1609,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
// The timewindow that overlaps the timestamps of the input pBlock need to be recalculated and return to the // The timewindow that overlaps the timestamps of the input pBlock need to be recalculated and return to the
// caller. Note that all the time window are not close till now. // caller. Note that all the time window are not close till now.
// the pDataBlock are always the same one, no need to call this again // the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->order, MAIN_SCAN, true); setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->inputOrder, MAIN_SCAN, true);
if (pInfo->invertible) { if (pInfo->invertible) {
setInverFunction(pSup->pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.type); setInverFunction(pSup->pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.type);
} }
...@@ -1790,7 +1789,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* ...@@ -1790,7 +1789,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
} }
pInfo->win = pTaskInfo->window; pInfo->win = pTaskInfo->window;
pInfo->order = TSDB_ORDER_ASC; pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC;
pInfo->resultTsOrder = (pPhyNode->window.outputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC;
pInfo->interval = *pInterval; pInfo->interval = *pInterval;
pInfo->execModel = pTaskInfo->execModel; pInfo->execModel = pTaskInfo->execModel;
pInfo->twAggSup = *pTwAggSupp; pInfo->twAggSup = *pTwAggSupp;
...@@ -1807,7 +1807,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* ...@@ -1807,7 +1807,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
} }
pInfo->primaryTsIndex = primaryTsSlotId; pInfo->primaryTsIndex = primaryTsSlotId;
SExprSupp* pSup = &pOperator->exprSupp; SExprSupp* pSup = &pOperator->exprSupp;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
...@@ -1879,7 +1878,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExpr ...@@ -1879,7 +1878,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExpr
goto _error; goto _error;
} }
pInfo->order = TSDB_ORDER_ASC; pInfo->inputOrder = TSDB_ORDER_ASC;
pInfo->interval = *pInterval; pInfo->interval = *pInterval;
pInfo->execModel = OPTR_EXEC_MODEL_STREAM; pInfo->execModel = OPTR_EXEC_MODEL_STREAM;
pInfo->win = pTaskInfo->window; pInfo->win = pTaskInfo->window;
...@@ -3098,6 +3097,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, ...@@ -3098,6 +3097,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT); pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
pInfo->delIndex = 0; pInfo->delIndex = 0;
pInfo->pDelWins = taosArrayInit(4, sizeof(SWinRes)); pInfo->pDelWins = taosArrayInit(4, sizeof(SWinRes));
pInfo->pRecycledPages = taosArrayInit(4, sizeof(int32_t));
pOperator->operatorType = pPhyNode->type; pOperator->operatorType = pPhyNode->type;
pOperator->blocking = true; pOperator->blocking = true;
...@@ -4593,7 +4593,7 @@ static int32_t outputMergeAlignedIntervalResult(SOperatorInfo* pOperatorInfo, ui ...@@ -4593,7 +4593,7 @@ static int32_t outputMergeAlignedIntervalResult(SOperatorInfo* pOperatorInfo, ui
SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo; SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo;
SExprSupp* pSup = &pOperatorInfo->exprSupp; SExprSupp* pSup = &pOperatorInfo->exprSupp;
bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC);
SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &wstartTs, TSDB_KEYSIZE, tableGroupId); SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &wstartTs, TSDB_KEYSIZE, tableGroupId);
SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf,
...@@ -4647,7 +4647,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR ...@@ -4647,7 +4647,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
} else { } else {
updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &currWin, true); updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &currWin, true);
doApplyFunctions(pTaskInfo, pSup->pCtx, &currWin, &iaInfo->twAggSup.timeWindowData, startPos, currPos - startPos, doApplyFunctions(pTaskInfo, pSup->pCtx, &currWin, &iaInfo->twAggSup.timeWindowData, startPos, currPos - startPos,
tsCols, pBlock->info.rows, numOfOutput, iaInfo->order); tsCols, pBlock->info.rows, numOfOutput, iaInfo->inputOrder);
outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, currTs); outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, currTs);
...@@ -4666,7 +4666,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR ...@@ -4666,7 +4666,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
} }
updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &currWin, true); updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &currWin, true);
doApplyFunctions(pTaskInfo, pSup->pCtx, &currWin, &iaInfo->twAggSup.timeWindowData, startPos, currPos - startPos, doApplyFunctions(pTaskInfo, pSup->pCtx, &currWin, &iaInfo->twAggSup.timeWindowData, startPos, currPos - startPos,
tsCols, pBlock->info.rows, numOfOutput, iaInfo->order); tsCols, pBlock->info.rows, numOfOutput, iaInfo->inputOrder);
outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, currTs); outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, currTs);
} }
...@@ -4711,8 +4711,8 @@ static SSDataBlock* doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { ...@@ -4711,8 +4711,8 @@ static SSDataBlock* doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
break; break;
} }
getTableScanInfo(pOperator, &iaInfo->order, &scanFlag); getTableScanInfo(pOperator, &iaInfo->inputOrder, &scanFlag);
setInputDataBlock(pOperator, pSup->pCtx, pBlock, iaInfo->order, scanFlag, true); setInputDataBlock(pOperator, pSup->pCtx, pBlock, iaInfo->inputOrder, scanFlag, true);
doMergeAlignedIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes); doMergeAlignedIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes);
doFilter(miaInfo->pCondition, pRes, NULL); doFilter(miaInfo->pCondition, pRes, NULL);
if (pRes->info.rows >= pOperator->resultInfo.capacity) { if (pRes->info.rows >= pOperator->resultInfo.capacity) {
...@@ -4753,7 +4753,7 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, ...@@ -4753,7 +4753,7 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream,
miaInfo->pCondition = pCondition; miaInfo->pCondition = pCondition;
iaInfo->win = pTaskInfo->window; iaInfo->win = pTaskInfo->window;
iaInfo->order = TSDB_ORDER_ASC; iaInfo->inputOrder = TSDB_ORDER_ASC;
iaInfo->interval = *pInterval; iaInfo->interval = *pInterval;
iaInfo->execModel = pTaskInfo->execModel; iaInfo->execModel = pTaskInfo->execModel;
iaInfo->primaryTsIndex = primaryTsSlotId; iaInfo->primaryTsIndex = primaryTsSlotId;
...@@ -4835,7 +4835,7 @@ static int32_t finalizeWindowResult(SOperatorInfo* pOperatorInfo, uint64_t table ...@@ -4835,7 +4835,7 @@ static int32_t finalizeWindowResult(SOperatorInfo* pOperatorInfo, uint64_t table
SMergeIntervalAggOperatorInfo* miaInfo = pOperatorInfo->info; SMergeIntervalAggOperatorInfo* miaInfo = pOperatorInfo->info;
SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo; SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo;
SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo; SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo;
bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC);
SExprSupp* pExprSup = &pOperatorInfo->exprSupp; SExprSupp* pExprSup = &pOperatorInfo->exprSupp;
SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &win->skey, TSDB_KEYSIZE, tableGroupId); SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &win->skey, TSDB_KEYSIZE, tableGroupId);
...@@ -4853,7 +4853,7 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t ...@@ -4853,7 +4853,7 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t
SMergeIntervalAggOperatorInfo* miaInfo = pOperatorInfo->info; SMergeIntervalAggOperatorInfo* miaInfo = pOperatorInfo->info;
SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo; SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo;
SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo; SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo;
bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC);
SExprSupp* pExprSup = &pOperatorInfo->exprSupp; SExprSupp* pExprSup = &pOperatorInfo->exprSupp;
SGroupTimeWindow groupTimeWindow = {.groupId = tableGroupId, .window = *newWin}; SGroupTimeWindow groupTimeWindow = {.groupId = tableGroupId, .window = *newWin};
...@@ -4889,12 +4889,12 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* ...@@ -4889,12 +4889,12 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
int32_t numOfOutput = pExprSup->numOfExprs; int32_t numOfOutput = pExprSup->numOfExprs;
int64_t* tsCols = extractTsCol(pBlock, iaInfo); int64_t* tsCols = extractTsCol(pBlock, iaInfo);
uint64_t tableGroupId = pBlock->info.groupId; uint64_t tableGroupId = pBlock->info.groupId;
bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC);
TSKEY blockStartTs = getStartTsKey(&pBlock->info.window, tsCols); TSKEY blockStartTs = getStartTsKey(&pBlock->info.window, tsCols);
SResultRow* pResult = NULL; SResultRow* pResult = NULL;
STimeWindow win = STimeWindow win =
getActiveTimeWindow(iaInfo->aggSup.pResultBuf, pResultRowInfo, blockStartTs, &iaInfo->interval, iaInfo->order); getActiveTimeWindow(iaInfo->aggSup.pResultBuf, pResultRowInfo, blockStartTs, &iaInfo->interval, iaInfo->inputOrder);
int32_t ret = int32_t ret =
setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx, setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx,
...@@ -4905,7 +4905,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* ...@@ -4905,7 +4905,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
TSKEY ekey = ascScan ? win.ekey : win.skey; TSKEY ekey = ascScan ? win.ekey : win.skey;
int32_t forwardRows = int32_t forwardRows =
getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->order); getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->inputOrder);
ASSERT(forwardRows > 0); ASSERT(forwardRows > 0);
// prev time window not interpolation yet. // prev time window not interpolation yet.
...@@ -4926,7 +4926,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* ...@@ -4926,7 +4926,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &win, true); updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &win, true);
doApplyFunctions(pTaskInfo, pExprSup->pCtx, &win, &iaInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, doApplyFunctions(pTaskInfo, pExprSup->pCtx, &win, &iaInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols,
pBlock->info.rows, numOfOutput, iaInfo->order); pBlock->info.rows, numOfOutput, iaInfo->inputOrder);
doCloseWindow(pResultRowInfo, iaInfo, pResult); doCloseWindow(pResultRowInfo, iaInfo, pResult);
// output previous interval results after this interval (&win) is closed // output previous interval results after this interval (&win) is closed
...@@ -4935,7 +4935,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* ...@@ -4935,7 +4935,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
STimeWindow nextWin = win; STimeWindow nextWin = win;
while (1) { while (1) {
int32_t prevEndPos = forwardRows - 1 + startPos; int32_t prevEndPos = forwardRows - 1 + startPos;
startPos = getNextQualifiedWindow(&iaInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, iaInfo->order); startPos = getNextQualifiedWindow(&iaInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, iaInfo->inputOrder);
if (startPos < 0) { if (startPos < 0) {
break; break;
} }
...@@ -4950,14 +4950,14 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* ...@@ -4950,14 +4950,14 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
ekey = ascScan ? nextWin.ekey : nextWin.skey; ekey = ascScan ? nextWin.ekey : nextWin.skey;
forwardRows = forwardRows =
getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->order); getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->inputOrder);
// window start(end) key interpolation // window start(end) key interpolation
doWindowBorderInterpolation(iaInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pExprSup); doWindowBorderInterpolation(iaInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pExprSup);
updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &nextWin, true); updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &nextWin, true);
doApplyFunctions(pTaskInfo, pExprSup->pCtx, &nextWin, &iaInfo->twAggSup.timeWindowData, startPos, forwardRows, doApplyFunctions(pTaskInfo, pExprSup->pCtx, &nextWin, &iaInfo->twAggSup.timeWindowData, startPos, forwardRows,
tsCols, pBlock->info.rows, numOfOutput, iaInfo->order); tsCols, pBlock->info.rows, numOfOutput, iaInfo->inputOrder);
doCloseWindow(pResultRowInfo, iaInfo, pResult); doCloseWindow(pResultRowInfo, iaInfo, pResult);
// output previous interval results after this interval (&nextWin) is closed // output previous interval results after this interval (&nextWin) is closed
...@@ -5011,8 +5011,8 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) { ...@@ -5011,8 +5011,8 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
break; break;
} }
getTableScanInfo(pOperator, &iaInfo->order, &scanFlag); getTableScanInfo(pOperator, &iaInfo->inputOrder, &scanFlag);
setInputDataBlock(pOperator, pExpSupp->pCtx, pBlock, iaInfo->order, scanFlag, true); setInputDataBlock(pOperator, pExpSupp->pCtx, pBlock, iaInfo->inputOrder, scanFlag, true);
doMergeIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes); doMergeIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes);
if (pRes->info.rows >= pOperator->resultInfo.threshold) { if (pRes->info.rows >= pOperator->resultInfo.threshold) {
...@@ -5054,9 +5054,8 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI ...@@ -5054,9 +5054,8 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI
miaInfo->groupIntervals = tdListNew(sizeof(SGroupTimeWindow)); miaInfo->groupIntervals = tdListNew(sizeof(SGroupTimeWindow));
SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo; SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo;
iaInfo->win = pTaskInfo->window; iaInfo->win = pTaskInfo->window;
iaInfo->order = TSDB_ORDER_ASC; iaInfo->inputOrder = TSDB_ORDER_ASC;
iaInfo->interval = *pInterval; iaInfo->interval = *pInterval;
iaInfo->execModel = pTaskInfo->execModel; iaInfo->execModel = pTaskInfo->execModel;
......
...@@ -2068,7 +2068,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -2068,7 +2068,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "apercentile", .name = "apercentile",
.type = FUNCTION_TYPE_APERCENTILE, .type = FUNCTION_TYPE_APERCENTILE,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC,
.translateFunc = translateApercentile, .translateFunc = translateApercentile,
.getEnvFunc = getApercentileFuncEnv, .getEnvFunc = getApercentileFuncEnv,
.initFunc = apercentileFunctionSetup, .initFunc = apercentileFunctionSetup,
...@@ -2083,7 +2083,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -2083,7 +2083,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
}, },
{ {
.name = "_apercentile_partial", .name = "_apercentile_partial",
.type = FUNCTION_TYPE_APERCENTILE_PARTIAL, .type = FUNCTION_TYPE_APERCENTILE_PARTIAL | FUNC_MGT_TIMELINE_FUNC,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC,
.translateFunc = translateApercentilePartial, .translateFunc = translateApercentilePartial,
.getEnvFunc = getApercentileFuncEnv, .getEnvFunc = getApercentileFuncEnv,
...@@ -2096,7 +2096,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -2096,7 +2096,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "_apercentile_merge", .name = "_apercentile_merge",
.type = FUNCTION_TYPE_APERCENTILE_MERGE, .type = FUNCTION_TYPE_APERCENTILE_MERGE,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC,
.translateFunc = translateApercentileMerge, .translateFunc = translateApercentileMerge,
.getEnvFunc = getApercentileFuncEnv, .getEnvFunc = getApercentileFuncEnv,
.initFunc = apercentileFunctionSetup, .initFunc = apercentileFunctionSetup,
...@@ -2358,7 +2358,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -2358,7 +2358,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "histogram", .name = "histogram",
.type = FUNCTION_TYPE_HISTOGRAM, .type = FUNCTION_TYPE_HISTOGRAM,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC,
.translateFunc = translateHistogram, .translateFunc = translateHistogram,
.getEnvFunc = getHistogramFuncEnv, .getEnvFunc = getHistogramFuncEnv,
.initFunc = histogramFunctionSetup, .initFunc = histogramFunctionSetup,
...@@ -2373,7 +2373,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -2373,7 +2373,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "_histogram_partial", .name = "_histogram_partial",
.type = FUNCTION_TYPE_HISTOGRAM_PARTIAL, .type = FUNCTION_TYPE_HISTOGRAM_PARTIAL,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC,
.translateFunc = translateHistogramPartial, .translateFunc = translateHistogramPartial,
.getEnvFunc = getHistogramFuncEnv, .getEnvFunc = getHistogramFuncEnv,
.initFunc = histogramFunctionSetup, .initFunc = histogramFunctionSetup,
...@@ -2385,7 +2385,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -2385,7 +2385,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "_histogram_merge", .name = "_histogram_merge",
.type = FUNCTION_TYPE_HISTOGRAM_MERGE, .type = FUNCTION_TYPE_HISTOGRAM_MERGE,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC,
.translateFunc = translateHistogramMerge, .translateFunc = translateHistogramMerge,
.getEnvFunc = getHistogramFuncEnv, .getEnvFunc = getHistogramFuncEnv,
.initFunc = functionSetup, .initFunc = functionSetup,
......
...@@ -443,6 +443,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p ...@@ -443,6 +443,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p
COPY_SCALAR_FIELD(igExpired); COPY_SCALAR_FIELD(igExpired);
COPY_SCALAR_FIELD(windowAlgo); COPY_SCALAR_FIELD(windowAlgo);
COPY_SCALAR_FIELD(inputTsOrder); COPY_SCALAR_FIELD(inputTsOrder);
COPY_SCALAR_FIELD(outputTsOrder);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -452,6 +453,7 @@ static int32_t logicFillCopy(const SFillLogicNode* pSrc, SFillLogicNode* pDst) { ...@@ -452,6 +453,7 @@ static int32_t logicFillCopy(const SFillLogicNode* pSrc, SFillLogicNode* pDst) {
CLONE_NODE_FIELD(pWStartTs); CLONE_NODE_FIELD(pWStartTs);
CLONE_NODE_FIELD(pValues); CLONE_NODE_FIELD(pValues);
COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow));
COPY_SCALAR_FIELD(inputTsOrder);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -1936,6 +1936,8 @@ static const char* jkWindowPhysiPlanTsEnd = "TsEnd"; ...@@ -1936,6 +1936,8 @@ static const char* jkWindowPhysiPlanTsEnd = "TsEnd";
static const char* jkWindowPhysiPlanTriggerType = "TriggerType"; static const char* jkWindowPhysiPlanTriggerType = "TriggerType";
static const char* jkWindowPhysiPlanWatermark = "Watermark"; static const char* jkWindowPhysiPlanWatermark = "Watermark";
static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired"; static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired";
static const char* jkWindowPhysiPlanInputTsOrder = "inputTsOrder";
static const char* jkWindowPhysiPlanOutputTsOrder = "outputTsOrder";
static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) {
const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj; const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj;
...@@ -1962,6 +1964,12 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { ...@@ -1962,6 +1964,12 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanIgnoreExpired, pNode->igExpired); code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanIgnoreExpired, pNode->igExpired);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanInputTsOrder, pNode->inputTsOrder);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanOutputTsOrder, pNode->outputTsOrder);
}
return code; return code;
} }
...@@ -1991,6 +1999,12 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { ...@@ -1991,6 +1999,12 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanIgnoreExpired, &pNode->igExpired); code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanIgnoreExpired, &pNode->igExpired);
} }
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkWindowPhysiPlanInputTsOrder, pNode->inputTsOrder, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkWindowPhysiPlanOutputTsOrder, pNode->outputTsOrder, code);
}
return code; return code;
} }
...@@ -2053,6 +2067,7 @@ static const char* jkFillPhysiPlanValues = "Values"; ...@@ -2053,6 +2067,7 @@ static const char* jkFillPhysiPlanValues = "Values";
static const char* jkFillPhysiPlanTargets = "Targets"; static const char* jkFillPhysiPlanTargets = "Targets";
static const char* jkFillPhysiPlanStartTime = "StartTime"; static const char* jkFillPhysiPlanStartTime = "StartTime";
static const char* jkFillPhysiPlanEndTime = "EndTime"; static const char* jkFillPhysiPlanEndTime = "EndTime";
static const char* jkFillPhysiPlanInputTsOrder = "inputTsOrder";
static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) { static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) {
const SFillPhysiNode* pNode = (const SFillPhysiNode*)pObj; const SFillPhysiNode* pNode = (const SFillPhysiNode*)pObj;
...@@ -2076,6 +2091,9 @@ static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) { ...@@ -2076,6 +2091,9 @@ static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkFillPhysiPlanEndTime, pNode->timeRange.ekey); code = tjsonAddIntegerToObject(pJson, jkFillPhysiPlanEndTime, pNode->timeRange.ekey);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkFillPhysiPlanInputTsOrder, pNode->inputTsOrder);
}
return code; return code;
} }
...@@ -2103,6 +2121,9 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) { ...@@ -2103,6 +2121,9 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkFillPhysiPlanEndTime, &pNode->timeRange.ekey); code = tjsonGetBigIntValue(pJson, jkFillPhysiPlanEndTime, &pNode->timeRange.ekey);
} }
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkFillPhysiPlanInputTsOrder, pNode->inputTsOrder, code);
}
return code; return code;
} }
......
...@@ -632,6 +632,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm ...@@ -632,6 +632,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm
pWindow->igExpired = pCxt->pPlanCxt->igExpired; pWindow->igExpired = pCxt->pPlanCxt->igExpired;
} }
pWindow->inputTsOrder = ORDER_ASC; pWindow->inputTsOrder = ORDER_ASC;
pWindow->outputTsOrder = ORDER_ASC;
int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_WINDOW, fmIsWindowClauseFunc, &pWindow->pFuncs); int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_WINDOW, fmIsWindowClauseFunc, &pWindow->pFuncs);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
...@@ -764,6 +765,7 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect ...@@ -764,6 +765,7 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pFill->node.groupAction = GROUP_ACTION_KEEP; pFill->node.groupAction = GROUP_ACTION_KEEP;
pFill->node.requireDataOrder = DATA_ORDER_LEVEL_IN_GROUP; pFill->node.requireDataOrder = DATA_ORDER_LEVEL_IN_GROUP;
pFill->node.resultDataOrder = DATA_ORDER_LEVEL_IN_GROUP; pFill->node.resultDataOrder = DATA_ORDER_LEVEL_IN_GROUP;
pFill->inputTsOrder = ORDER_ASC;
int32_t code = nodesCollectColumns(pSelect, SQL_CLAUSE_WINDOW, NULL, COLLECT_COL_TYPE_ALL, &pFill->node.pTargets); int32_t code = nodesCollectColumns(pSelect, SQL_CLAUSE_WINDOW, NULL, COLLECT_COL_TYPE_ALL, &pFill->node.pTargets);
if (TSDB_CODE_SUCCESS == code && NULL == pFill->node.pTargets) { if (TSDB_CODE_SUCCESS == code && NULL == pFill->node.pTargets) {
......
...@@ -38,10 +38,13 @@ typedef struct SOptimizeRule { ...@@ -38,10 +38,13 @@ typedef struct SOptimizeRule {
FOptimize optimizeFunc; FOptimize optimizeFunc;
} SOptimizeRule; } SOptimizeRule;
typedef enum EScanOrder { SCAN_ORDER_ASC = 1, SCAN_ORDER_DESC, SCAN_ORDER_BOTH } EScanOrder;
typedef struct SOsdInfo { typedef struct SOsdInfo {
SScanLogicNode* pScan; SScanLogicNode* pScan;
SNodeList* pSdrFuncs; SNodeList* pSdrFuncs;
SNodeList* pDsoFuncs; SNodeList* pDsoFuncs;
EScanOrder scanOrder;
} SOsdInfo; } SOsdInfo;
typedef struct SCpdIsMultiTableCondCxt { typedef struct SCpdIsMultiTableCondCxt {
...@@ -97,6 +100,27 @@ static EDealRes optRebuildTbanme(SNode** pNode, void* pContext) { ...@@ -97,6 +100,27 @@ static EDealRes optRebuildTbanme(SNode** pNode, void* pContext) {
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
static void optSetParentOrder(SLogicNode* pNode, EOrder order) {
if (NULL == pNode) {
return;
}
switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_WINDOW:
((SWindowLogicNode*)pNode)->inputTsOrder = order;
// window has a sorting function, and the operator behind it uses its output order
return;
case QUERY_NODE_LOGIC_PLAN_JOIN:
((SJoinLogicNode*)pNode)->inputTsOrder = order;
break;
case QUERY_NODE_LOGIC_PLAN_FILL:
((SFillLogicNode*)pNode)->inputTsOrder = order;
break;
default:
break;
}
optSetParentOrder(pNode->pParent, order);
}
EDealRes scanPathOptHaveNormalColImpl(SNode* pNode, void* pContext) { EDealRes scanPathOptHaveNormalColImpl(SNode* pNode, void* pContext) {
if (QUERY_NODE_COLUMN == nodeType(pNode)) { if (QUERY_NODE_COLUMN == nodeType(pNode)) {
// *((bool*)pContext) = (COLUMN_TYPE_TAG != ((SColumnNode*)pNode)->colType); // *((bool*)pContext) = (COLUMN_TYPE_TAG != ((SColumnNode*)pNode)->colType);
...@@ -179,16 +203,18 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd ...@@ -179,16 +203,18 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd
SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent); SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent);
SNodeList* pTmpSdrFuncs = NULL; SNodeList* pTmpSdrFuncs = NULL;
SNodeList* pTmpDsoFuncs = NULL; SNodeList* pTmpDsoFuncs = NULL;
SNode* pFunc = NULL; SNode* pNode = NULL;
bool otherFunc = false; bool otherFunc = false;
FOREACH(pFunc, pAllFuncs) { FOREACH(pNode, pAllFuncs) {
int32_t code = TSDB_CODE_SUCCESS; SFunctionNode* pFunc = (SFunctionNode*)pNode;
if (scanPathOptNeedOptimizeDataRequire((SFunctionNode*)pFunc)) { int32_t code = TSDB_CODE_SUCCESS;
code = nodesListMakeStrictAppend(&pTmpSdrFuncs, nodesCloneNode(pFunc)); if (scanPathOptNeedOptimizeDataRequire(pFunc)) {
} else if (scanPathOptNeedDynOptimize((SFunctionNode*)pFunc)) { code = nodesListMakeStrictAppend(&pTmpSdrFuncs, nodesCloneNode(pNode));
code = nodesListMakeStrictAppend(&pTmpDsoFuncs, nodesCloneNode(pFunc)); } else if (scanPathOptNeedDynOptimize(pFunc)) {
code = nodesListMakeStrictAppend(&pTmpDsoFuncs, nodesCloneNode(pNode));
} else { } else {
otherFunc = true; otherFunc = true;
break;
} }
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
nodesDestroyList(pTmpSdrFuncs); nodesDestroyList(pTmpSdrFuncs);
...@@ -206,12 +232,46 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd ...@@ -206,12 +232,46 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t scanPathOptGetScanOrder(SScanLogicNode* pScan, EScanOrder* pScanOrder) {
SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent);
SNode* pNode = NULL;
bool hasFirst = false;
bool hasLast = false;
bool otherFunc = false;
FOREACH(pNode, pAllFuncs) {
SFunctionNode* pFunc = (SFunctionNode*)pNode;
if (FUNCTION_TYPE_FIRST == pFunc->funcType) {
hasFirst = true;
} else if (FUNCTION_TYPE_LAST == pFunc->funcType) {
hasLast = true;
} else if (FUNCTION_TYPE_SELECT_VALUE != pFunc->funcType) {
otherFunc = true;
}
}
if (hasFirst && hasLast && !otherFunc) {
*pScanOrder = SCAN_ORDER_BOTH;
} else if (hasLast) {
*pScanOrder = SCAN_ORDER_DESC;
} else {
*pScanOrder = SCAN_ORDER_ASC;
}
return TSDB_CODE_SUCCESS;
}
static int32_t scanPathOptSetOsdInfo(SOsdInfo* pInfo) {
int32_t code = scanPathOptGetRelatedFuncs(pInfo->pScan, &pInfo->pSdrFuncs, &pInfo->pDsoFuncs);
if (TSDB_CODE_SUCCESS == code) {
code = scanPathOptGetScanOrder(pInfo->pScan, &pInfo->scanOrder);
}
return code;
}
static int32_t scanPathOptMatch(SOptimizeContext* pCxt, SLogicNode* pLogicNode, SOsdInfo* pInfo) { static int32_t scanPathOptMatch(SOptimizeContext* pCxt, SLogicNode* pLogicNode, SOsdInfo* pInfo) {
pInfo->pScan = (SScanLogicNode*)optFindPossibleNode(pLogicNode, scanPathOptMayBeOptimized); pInfo->pScan = (SScanLogicNode*)optFindPossibleNode(pLogicNode, scanPathOptMayBeOptimized);
if (NULL == pInfo->pScan) { if (NULL == pInfo->pScan) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
return scanPathOptGetRelatedFuncs(pInfo->pScan, &pInfo->pSdrFuncs, &pInfo->pDsoFuncs); return scanPathOptSetOsdInfo(pInfo);
} }
static EFuncDataRequired scanPathOptPromoteDataRequired(EFuncDataRequired l, EFuncDataRequired r) { static EFuncDataRequired scanPathOptPromoteDataRequired(EFuncDataRequired l, EFuncDataRequired r) {
...@@ -258,15 +318,42 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) { ...@@ -258,15 +318,42 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) {
} }
} }
static void scanPathOptSetScanOrder(EScanOrder scanOrder, SScanLogicNode* pScan) {
if (pScan->sortPrimaryKey || pScan->scanSeq[0] > 1 || pScan->scanSeq[1] > 1) {
return;
}
switch (scanOrder) {
case SCAN_ORDER_ASC:
pScan->scanSeq[0] = 1;
pScan->scanSeq[1] = 0;
optSetParentOrder(pScan->node.pParent, ORDER_ASC);
break;
case SCAN_ORDER_DESC:
pScan->scanSeq[0] = 0;
pScan->scanSeq[1] = 1;
optSetParentOrder(pScan->node.pParent, ORDER_DESC);
break;
case SCAN_ORDER_BOTH:
pScan->scanSeq[0] = 1;
pScan->scanSeq[1] = 1;
break;
default:
break;
}
}
static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) {
SOsdInfo info = {0}; SOsdInfo info = {.scanOrder = SCAN_ORDER_ASC};
int32_t code = scanPathOptMatch(pCxt, pLogicSubplan->pNode, &info); int32_t code = scanPathOptMatch(pCxt, pLogicSubplan->pNode, &info);
if (TSDB_CODE_SUCCESS == code && info.pScan) { if (TSDB_CODE_SUCCESS == code && info.pScan) {
scanPathOptSetScanWin((SScanLogicNode*)info.pScan); scanPathOptSetScanWin(info.pScan);
scanPathOptSetScanOrder(info.scanOrder, info.pScan);
} }
if (TSDB_CODE_SUCCESS == code && (NULL != info.pDsoFuncs || NULL != info.pSdrFuncs)) { if (TSDB_CODE_SUCCESS == code && (NULL != info.pDsoFuncs || NULL != info.pSdrFuncs)) {
info.pScan->dataRequired = scanPathOptGetDataRequired(info.pSdrFuncs); info.pScan->dataRequired = scanPathOptGetDataRequired(info.pSdrFuncs);
info.pScan->pDynamicScanFuncs = info.pDsoFuncs; info.pScan->pDynamicScanFuncs = info.pDsoFuncs;
}
if (TSDB_CODE_SUCCESS == code && info.pScan) {
OPTIMIZE_FLAG_SET_MASK(info.pScan->node.optimizedFlag, OPTIMIZE_FLAG_SCAN_PATH); OPTIMIZE_FLAG_SET_MASK(info.pScan->node.optimizedFlag, OPTIMIZE_FLAG_SCAN_PATH);
pCxt->optimized = true; pCxt->optimized = true;
} }
...@@ -987,12 +1074,13 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) { ...@@ -987,12 +1074,13 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) {
} }
SSortLogicNode* pSort = (SSortLogicNode*)pNode; SSortLogicNode* pSort = (SSortLogicNode*)pNode;
if (pSort->groupSort || !sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) { if (pSort->groupSort || !sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) {
return TSDB_CODE_SUCCESS; return false;
} }
return true; return true;
} }
static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimize, SNodeList** pScanNodes) { static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool* pNotOptimize,
SNodeList** pSequencingNodes) {
switch (nodeType(pNode)) { switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_SCAN: { case QUERY_NODE_LOGIC_PLAN_SCAN: {
SScanLogicNode* pScan = (SScanLogicNode*)pNode; SScanLogicNode* pScan = (SScanLogicNode*)pNode;
...@@ -1000,17 +1088,19 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi ...@@ -1000,17 +1088,19 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi
*pNotOptimize = true; *pNotOptimize = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
return nodesListMakeAppend(pScanNodes, (SNode*)pNode); return nodesListMakeAppend(pSequencingNodes, (SNode*)pNode);
} }
case QUERY_NODE_LOGIC_PLAN_JOIN: { case QUERY_NODE_LOGIC_PLAN_JOIN: {
int32_t code = int32_t code = sortPriKeyOptGetSequencingNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0),
sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); pNotOptimize, pSequencingNodes);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = code = sortPriKeyOptGetSequencingNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 1), pNotOptimize,
sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 1), pNotOptimize, pScanNodes); pSequencingNodes);
} }
return code; return code;
} }
case QUERY_NODE_LOGIC_PLAN_WINDOW:
return nodesListMakeAppend(pSequencingNodes, (SNode*)pNode);
case QUERY_NODE_LOGIC_PLAN_AGG: case QUERY_NODE_LOGIC_PLAN_AGG:
case QUERY_NODE_LOGIC_PLAN_PARTITION: case QUERY_NODE_LOGIC_PLAN_PARTITION:
*pNotOptimize = true; *pNotOptimize = true;
...@@ -1024,14 +1114,15 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi ...@@ -1024,14 +1114,15 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
return sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); return sortPriKeyOptGetSequencingNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize,
pSequencingNodes);
} }
static int32_t sortPriKeyOptGetScanNodes(SLogicNode* pNode, SNodeList** pScanNodes) { static int32_t sortPriKeyOptGetSequencingNodes(SLogicNode* pNode, SNodeList** pSequencingNodes) {
bool notOptimize = false; bool notOptimize = false;
int32_t code = sortPriKeyOptGetScanNodesImpl(pNode, &notOptimize, pScanNodes); int32_t code = sortPriKeyOptGetSequencingNodesImpl(pNode, &notOptimize, pSequencingNodes);
if (TSDB_CODE_SUCCESS != code || notOptimize) { if (TSDB_CODE_SUCCESS != code || notOptimize) {
nodesClearList(*pScanNodes); nodesClearList(*pSequencingNodes);
} }
return code; return code;
} }
...@@ -1040,33 +1131,26 @@ static EOrder sortPriKeyOptGetPriKeyOrder(SSortLogicNode* pSort) { ...@@ -1040,33 +1131,26 @@ static EOrder sortPriKeyOptGetPriKeyOrder(SSortLogicNode* pSort) {
return ((SOrderByExprNode*)nodesListGetNode(pSort->pSortKeys, 0))->order; return ((SOrderByExprNode*)nodesListGetNode(pSort->pSortKeys, 0))->order;
} }
static void sortPriKeyOptSetParentOrder(SLogicNode* pNode, EOrder order) {
if (NULL == pNode) {
return;
}
if (QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode)) {
((SWindowLogicNode*)pNode)->inputTsOrder = order;
} else if (QUERY_NODE_LOGIC_PLAN_JOIN == nodeType(pNode)) {
((SJoinLogicNode*)pNode)->inputTsOrder = order;
}
sortPriKeyOptSetParentOrder(pNode->pParent, order);
}
static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort, static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort,
SNodeList* pScanNodes) { SNodeList* pSequencingNodes) {
EOrder order = sortPriKeyOptGetPriKeyOrder(pSort); EOrder order = sortPriKeyOptGetPriKeyOrder(pSort);
SNode* pScanNode = NULL; SNode* pSequencingNode = NULL;
FOREACH(pScanNode, pScanNodes) { FOREACH(pSequencingNode, pSequencingNodes) {
SScanLogicNode* pScan = (SScanLogicNode*)pScanNode; if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pSequencingNode)) {
if (ORDER_DESC == order && pScan->scanSeq[0] > 0) { SScanLogicNode* pScan = (SScanLogicNode*)pSequencingNode;
TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]); if ((ORDER_DESC == order && pScan->scanSeq[0] > 0) || (ORDER_ASC == order && pScan->scanSeq[1] > 0)) {
} TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]);
if (TSDB_SUPER_TABLE == pScan->tableType) { }
pScan->scanType = SCAN_TYPE_TABLE_MERGE; if (TSDB_SUPER_TABLE == pScan->tableType) {
pScan->node.resultDataOrder = DATA_ORDER_LEVEL_GLOBAL; pScan->scanType = SCAN_TYPE_TABLE_MERGE;
pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; pScan->node.resultDataOrder = DATA_ORDER_LEVEL_GLOBAL;
pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL;
}
pScan->sortPrimaryKey = true;
} else if (QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pSequencingNode)) {
((SWindowLogicNode*)pSequencingNode)->outputTsOrder = order;
} }
sortPriKeyOptSetParentOrder(pScan->node.pParent, order); optSetParentOrder(((SLogicNode*)pSequencingNode)->pParent, order);
} }
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0); SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0);
...@@ -1083,12 +1167,13 @@ static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicS ...@@ -1083,12 +1167,13 @@ static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicS
} }
static int32_t sortPrimaryKeyOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort) { static int32_t sortPrimaryKeyOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort) {
SNodeList* pScanNodes = NULL; SNodeList* pSequencingNodes = NULL;
int32_t code = sortPriKeyOptGetScanNodes((SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0), &pScanNodes); int32_t code =
if (TSDB_CODE_SUCCESS == code && NULL != pScanNodes) { sortPriKeyOptGetSequencingNodes((SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0), &pSequencingNodes);
code = sortPriKeyOptApply(pCxt, pLogicSubplan, pSort, pScanNodes); if (TSDB_CODE_SUCCESS == code && NULL != pSequencingNodes) {
code = sortPriKeyOptApply(pCxt, pLogicSubplan, pSort, pSequencingNodes);
} }
nodesClearList(pScanNodes); nodesClearList(pSequencingNodes);
return code; return code;
} }
......
...@@ -1089,6 +1089,8 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* ...@@ -1089,6 +1089,8 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList*
pWindow->triggerType = pWindowLogicNode->triggerType; pWindow->triggerType = pWindowLogicNode->triggerType;
pWindow->watermark = pWindowLogicNode->watermark; pWindow->watermark = pWindowLogicNode->watermark;
pWindow->igExpired = pWindowLogicNode->igExpired; pWindow->igExpired = pWindowLogicNode->igExpired;
pWindow->inputTsOrder = pWindowLogicNode->inputTsOrder;
pWindow->outputTsOrder = pWindowLogicNode->outputTsOrder;
SNodeList* pPrecalcExprs = NULL; SNodeList* pPrecalcExprs = NULL;
SNodeList* pFuncs = NULL; SNodeList* pFuncs = NULL;
...@@ -1363,6 +1365,7 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren ...@@ -1363,6 +1365,7 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
pFill->mode = pFillNode->mode; pFill->mode = pFillNode->mode;
pFill->timeRange = pFillNode->timeRange; pFill->timeRange = pFillNode->timeRange;
pFill->inputTsOrder = pFillNode->inputTsOrder;
SDataBlockDescNode* pChildTupe = (((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc); SDataBlockDescNode* pChildTupe = (((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc);
int32_t code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pFillNode->node.pTargets, &pFill->pTargets); int32_t code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pFillNode->node.pTargets, &pFill->pTargets);
......
...@@ -492,7 +492,7 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo ...@@ -492,7 +492,7 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo
((SWindowLogicNode*)pInfo->pSplitNode)->windowAlgo = INTERVAL_ALGO_MERGE; ((SWindowLogicNode*)pInfo->pSplitNode)->windowAlgo = INTERVAL_ALGO_MERGE;
SNodeList* pMergeKeys = NULL; SNodeList* pMergeKeys = NULL;
code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pInfo->pSplitNode)->pTspk, code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pInfo->pSplitNode)->pTspk,
((SWindowLogicNode*)pInfo->pSplitNode)->inputTsOrder, &pMergeKeys); ((SWindowLogicNode*)pInfo->pSplitNode)->outputTsOrder, &pMergeKeys);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, pMergeKeys, pPartWindow, true); code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, pMergeKeys, pPartWindow, true);
} }
......
...@@ -30,6 +30,11 @@ TEST_F(PlanOptimizeTest, scanPath) { ...@@ -30,6 +30,11 @@ TEST_F(PlanOptimizeTest, scanPath) {
run("SELECT COUNT(CAST(c1 AS BIGINT)) FROM t1"); run("SELECT COUNT(CAST(c1 AS BIGINT)) FROM t1");
run("SELECT PERCENTILE(c1, 40), COUNT(*) FROM t1"); run("SELECT PERCENTILE(c1, 40), COUNT(*) FROM t1");
run("SELECT LAST(c1) FROM t1");
run("SELECT LAST(c1) FROM t1 WHERE ts BETWEEN '2022-7-29 11:10:10' AND '2022-7-30 11:10:10' INTERVAL(10S) "
"FILL(LINEAR)");
} }
TEST_F(PlanOptimizeTest, pushDownCondition) { TEST_F(PlanOptimizeTest, pushDownCondition) {
...@@ -57,7 +62,15 @@ TEST_F(PlanOptimizeTest, sortPrimaryKey) { ...@@ -57,7 +62,15 @@ TEST_F(PlanOptimizeTest, sortPrimaryKey) {
run("SELECT c1 FROM t1 ORDER BY ts DESC"); run("SELECT c1 FROM t1 ORDER BY ts DESC");
run("SELECT c1 FROM st1 ORDER BY ts DESC");
run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTART DESC"); run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTART DESC");
run("SELECT FIRST(c1) FROM t1 WHERE ts BETWEEN '2022-7-29 11:10:10' AND '2022-7-30 11:10:10' INTERVAL(10S) "
"FILL(LINEAR) ORDER BY _WSTART DESC");
run("SELECT LAST(c1) FROM t1 WHERE ts BETWEEN '2022-7-29 11:10:10' AND '2022-7-30 11:10:10' INTERVAL(10S) "
"FILL(LINEAR) ORDER BY _WSTART");
} }
TEST_F(PlanOptimizeTest, PartitionTags) { TEST_F(PlanOptimizeTest, PartitionTags) {
......
...@@ -41,7 +41,7 @@ target_link_libraries( ...@@ -41,7 +41,7 @@ target_link_libraries(
) )
if(TD_WINDOWS) if(TD_WINDOWS)
target_link_libraries( target_link_libraries(
os PUBLIC ws2_32 iconv msvcregex wcwidth winmm os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump
) )
elseif(TD_DARWIN_64) elseif(TD_DARWIN_64)
target_link_libraries( target_link_libraries(
......
...@@ -91,6 +91,7 @@ LONG WINAPI FlCrashDump(PEXCEPTION_POINTERS ep) { ...@@ -91,6 +91,7 @@ LONG WINAPI FlCrashDump(PEXCEPTION_POINTERS ep) {
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception);
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
...@@ -841,7 +842,8 @@ char *taosGetCmdlineByPID(int pid) { ...@@ -841,7 +842,8 @@ char *taosGetCmdlineByPID(int pid) {
void taosSetCoreDump(bool enable) { void taosSetCoreDump(bool enable) {
#ifdef WINDOWS #ifdef WINDOWS
SetUnhandledExceptionFilter(&FlCrashDump); // SetUnhandledExceptionFilter(exceptionHandler);
// SetUnhandledExceptionFilter(&FlCrashDump);
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
#else #else
if (!enable) return; if (!enable) return;
......
...@@ -18,6 +18,63 @@ ...@@ -18,6 +18,63 @@
#include "os.h" #include "os.h"
#if defined(WINDOWS) #if defined(WINDOWS)
typedef void (*MainWindows)(int argc,char** argv);
MainWindows mainWindowsFunc = NULL;
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hServiceStatusHandle;
void WINAPI windowsServiceCtrlHandle(DWORD request) {
switch (request) {
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
raise(SIGINT);
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
if (!SetServiceStatus(hServiceStatusHandle, &ServiceStatus)) {
DWORD nError = GetLastError();
printf("failed to send stopped status to windows service: %d",nError);
}
break;
default:
return;
}
}
void WINAPI mainWindowsService(int argc,char** argv) {
int ret = 0;
ServiceStatus.dwServiceType = SERVICE_WIN32;
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
ServiceStatus.dwServiceSpecificExitCode = 0;
hServiceStatusHandle = RegisterServiceCtrlHandler("taosd", &windowsServiceCtrlHandle);
if (hServiceStatusHandle == 0) {
DWORD nError = GetLastError();
printf("failed to register windows service ctrl handler: %d",nError);
}
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
if (SetServiceStatus(hServiceStatusHandle, &ServiceStatus)) {
DWORD nError = GetLastError();
printf("failed to send running status to windows service: %d",nError);
}
if (mainWindowsFunc != NULL) mainWindowsFunc(argc, argv);
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
if (!SetServiceStatus(hServiceStatusHandle, &ServiceStatus)) {
DWORD nError = GetLastError();
printf("failed to send stopped status to windows service: %d",nError);
}
}
void stratWindowsService(MainWindows mainWindows) {
mainWindowsFunc = mainWindows;
SERVICE_TABLE_ENTRY ServiceTable[2];
ServiceTable[0].lpServiceName = "taosd";
ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)mainWindowsService;
ServiceTable[1].lpServiceName = NULL;
ServiceTable[1].lpServiceProc = NULL;
StartServiceCtrlDispatcher(ServiceTable);
}
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
#else #else
#include <dlfcn.h> #include <dlfcn.h>
......
...@@ -82,7 +82,7 @@ int64_t tsNumOfTraceLogs = 0; ...@@ -82,7 +82,7 @@ int64_t tsNumOfTraceLogs = 0;
// log // log
int32_t dDebugFlag = 135; int32_t dDebugFlag = 135;
int32_t vDebugFlag = 135; int32_t vDebugFlag = 135;
int32_t mDebugFlag = 131; int32_t mDebugFlag = 135;
int32_t cDebugFlag = 131; int32_t cDebugFlag = 131;
int32_t jniDebugFlag = 131; int32_t jniDebugFlag = 131;
int32_t tmrDebugFlag = 131; int32_t tmrDebugFlag = 131;
......
...@@ -89,15 +89,22 @@ ...@@ -89,15 +89,22 @@
./test.sh -f tsim/parser/alter_column.sim ./test.sh -f tsim/parser/alter_column.sim
./test.sh -f tsim/parser/alter_stable.sim ./test.sh -f tsim/parser/alter_stable.sim
./test.sh -f tsim/parser/alter.sim ./test.sh -f tsim/parser/alter.sim
# TD-17661 ./test.sh -f tsim/parser/alter1.sim # TD-17959 ./test.sh -f tsim/parser/alter1.sim
./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim ./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim
./test.sh -f tsim/parser/auto_create_tb.sim ./test.sh -f tsim/parser/auto_create_tb.sim
./test.sh -f tsim/parser/between_and.sim ./test.sh -f tsim/parser/between_and.sim
./test.sh -f tsim/parser/binary_escapeCharacter.sim ./test.sh -f tsim/parser/binary_escapeCharacter.sim
# TD-17738 ./test.sh -f tsim/parser/col_arithmetic_operation.sim ./test.sh -f tsim/parser/col_arithmetic_operation.sim
# TD-17661 ./test.sh -f tsim/parser/columnValue.sim ./test.sh -f tsim/parser/columnValue_bigint.sim
./test.sh -f tsim/parser/columnValue_bool.sim
./test.sh -f tsim/parser/columnValue_double.sim
./test.sh -f tsim/parser/columnValue_float.sim
./test.sh -f tsim/parser/columnValue_int.sim
./test.sh -f tsim/parser/columnValue_smallint.sim
./test.sh -f tsim/parser/columnValue_tinyint.sim
./test.sh -f tsim/parser/columnValue_unsign.sim
./test.sh -f tsim/parser/commit.sim ./test.sh -f tsim/parser/commit.sim
# TD-17661 ./test.sh -f tsim/parser/condition.sim ./test.sh -f tsim/parser/condition.sim
./test.sh -f tsim/parser/constCol.sim ./test.sh -f tsim/parser/constCol.sim
#./test.sh -f tsim/parser/create_db.sim #./test.sh -f tsim/parser/create_db.sim
./test.sh -f tsim/parser/create_mt.sim ./test.sh -f tsim/parser/create_mt.sim
...@@ -145,7 +152,7 @@ ...@@ -145,7 +152,7 @@
./test.sh -f tsim/parser/select_across_vnodes.sim ./test.sh -f tsim/parser/select_across_vnodes.sim
./test.sh -f tsim/parser/select_distinct_tag.sim ./test.sh -f tsim/parser/select_distinct_tag.sim
./test.sh -f tsim/parser/select_from_cache_disk.sim ./test.sh -f tsim/parser/select_from_cache_disk.sim
# TD-17832 ./test.sh -f tsim/parser/select_with_tags.sim ./test.sh -f tsim/parser/select_with_tags.sim
./test.sh -f tsim/parser/selectResNum.sim ./test.sh -f tsim/parser/selectResNum.sim
./test.sh -f tsim/parser/set_tag_vals.sim ./test.sh -f tsim/parser/set_tag_vals.sim
./test.sh -f tsim/parser/single_row_in_tb.sim ./test.sh -f tsim/parser/single_row_in_tb.sim
...@@ -154,15 +161,15 @@ ...@@ -154,15 +161,15 @@
./test.sh -f tsim/parser/slimit.sim ./test.sh -f tsim/parser/slimit.sim
./test.sh -f tsim/parser/slimit1.sim ./test.sh -f tsim/parser/slimit1.sim
./test.sh -f tsim/parser/stableOp.sim ./test.sh -f tsim/parser/stableOp.sim
# TD-17661 ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
# TD-17661 ./test.sh -f tsim/parser/tags_filter.sim ./test.sh -f tsim/parser/tags_filter.sim
./test.sh -f tsim/parser/tbnameIn.sim ./test.sh -f tsim/parser/tbnameIn.sim
./test.sh -f tsim/parser/timestamp.sim ./test.sh -f tsim/parser/timestamp.sim
./test.sh -f tsim/parser/top_groupby.sim ./test.sh -f tsim/parser/top_groupby.sim
./test.sh -f tsim/parser/topbot.sim ./test.sh -f tsim/parser/topbot.sim
./test.sh -f tsim/parser/union.sim ./test.sh -f tsim/parser/union.sim
# TD-17704 ./test.sh -f tsim/parser/union_sysinfo.sim ./test.sh -f tsim/parser/union_sysinfo.sim
# TD-17661 ./test.sh -f tsim/parser/where.sim ./test.sh -f tsim/parser/where.sim
# ---- query ---- # ---- query ----
./test.sh -f tsim/query/charScalarFunction.sim ./test.sh -f tsim/query/charScalarFunction.sim
...@@ -422,18 +429,18 @@ ...@@ -422,18 +429,18 @@
./test.sh -f tsim/tag/bool_binary.sim ./test.sh -f tsim/tag/bool_binary.sim
./test.sh -f tsim/tag/bool_int.sim ./test.sh -f tsim/tag/bool_int.sim
./test.sh -f tsim/tag/bool.sim ./test.sh -f tsim/tag/bool.sim
# TD-17661 ./test.sh -f tsim/tag/change.sim # TD-17407 ./test.sh -f tsim/tag/change.sim
./test.sh -f tsim/tag/column.sim ./test.sh -f tsim/tag/column.sim
./test.sh -f tsim/tag/commit.sim ./test.sh -f tsim/tag/commit.sim
# TD-17661 ./test.sh -f tsim/tag/create.sim # TD-17407 ./test.sh -f tsim/tag/create.sim
# TD-17661 ./test.sh -f tsim/tag/delete.sim # TD-17407 ./test.sh -f tsim/tag/delete.sim
# TD-17661 ./test.sh -f tsim/tag/double.sim # TD-17407 ./test.sh -f tsim/tag/double.sim
# TD-17661 ./test.sh -f tsim/tag/filter.sim ./test.sh -f tsim/tag/filter.sim
# TD-17407 ./test.sh -f tsim/tag/float.sim # TD-17407 ./test.sh -f tsim/tag/float.sim
./test.sh -f tsim/tag/int_binary.sim ./test.sh -f tsim/tag/int_binary.sim
./test.sh -f tsim/tag/int_float.sim ./test.sh -f tsim/tag/int_float.sim
./test.sh -f tsim/tag/int.sim ./test.sh -f tsim/tag/int.sim
# TD-17661 ./test.sh -f tsim/tag/set.sim # TD-17959 ./test.sh -f tsim/tag/set.sim
./test.sh -f tsim/tag/smallint.sim ./test.sh -f tsim/tag/smallint.sim
./test.sh -f tsim/tag/tinyint.sim ./test.sh -f tsim/tag/tinyint.sim
......
...@@ -24,14 +24,20 @@ sql alter dnode 1 'fsDebugFlag 131' ...@@ -24,14 +24,20 @@ sql alter dnode 1 'fsDebugFlag 131'
sql alter dnode 1 'udfDebugFlag 131' sql alter dnode 1 'udfDebugFlag 131'
sql alter dnode 1 'smaDebugFlag 131' sql alter dnode 1 'smaDebugFlag 131'
sql alter dnode 1 'idxDebugFlag 131' sql alter dnode 1 'idxDebugFlag 131'
sql alter dnode 1 'tdbDebugFlag 131'
sql alter dnode 1 'tmrDebugFlag 131' sql alter dnode 1 'tmrDebugFlag 131'
sql alter dnode 1 'uDebugFlag 131' sql alter dnode 1 'uDebugFlag 131'
sql alter dnode 1 'smaDebugFlag 131' sql alter dnode 1 'smaDebugFlag 131'
sql alter dnode 1 'rpcDebugFlag 131' sql alter dnode 1 'rpcDebugFlag 131'
sql alter dnode 1 'qDebugFlag 131' sql alter dnode 1 'qDebugFlag 131'
sql alter dnode 1 'metaDebugFlag 131'
sql_error alter dnode 2 'wDebugFlag 135' sql_error alter dnode 2 'wDebugFlag 135'
sql_error alter dnode 2 'tmrDebugFlag 135' sql_error alter dnode 2 'tmrDebugFlag 135'
sql_error alter dnode 1 'monDebugFlag 131'
sql_error alter dnode 1 'cqDebugFlag 131'
sql_error alter dnode 1 'httpDebugFlag 131'
sql_error alter dnode 1 'mqttDebugFlag 131'
print ======== step3 print ======== step3
sql_error alter $hostname1 debugFlag 135 sql_error alter $hostname1 debugFlag 135
......
...@@ -103,7 +103,7 @@ endi ...@@ -103,7 +103,7 @@ endi
print ================== change a tag value print ================== change a tag value
sql alter table car1 set tag carid=10 sql alter table car1 set tag carid=10
sql select carId, carmodel from car1 sql select distinct carId, carmodel from car1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
......
...@@ -131,20 +131,5 @@ sql_error select max(c1-c2) from $tb ...@@ -131,20 +131,5 @@ sql_error select max(c1-c2) from $tb
#========================================regression test cases==================================== #========================================regression test cases====================================
print =====================> td-1764 print =====================> td-1764
sql select sum(c1)/count(*), sum(c1) as b, count(*) as b from $stb interval(1y) sql select sum(c1)/count(*), sum(c1) as b, count(*) as b from $stb interval(1y)
if $rows != 1 then
return -1
endi
if $data00 != @18-01-01 00:00:00.000@ then
return -1
endi
if $data01 != 2.250000000 then
return -1
endi
if $data02 != 225000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -511,24 +511,21 @@ if $rows != 1 then ...@@ -511,24 +511,21 @@ if $rows != 1 then
endi endi
# slimit/soffset not support for normal table query. [d.11]=============================================================== # slimit/soffset not support for normal table query. [d.11]===============================================================
sql select sum(c1) from $stb slimit 1 soffset 19; sql_error select sum(c1) from $stb slimit 1 soffset 19;
if $rows != 0 then
return -1
endi
sql select sum(c1) from $stb interval(1s) group by tbname slimit 1 soffset 1 sql select sum(c1) from ca_stb0 partition by tbname interval(1s) slimit 1 soffset 1
sql select sum(c1) from ca_stb0 interval(1s) group by tbname slimit 2 soffset 4 limit 10 offset 1 sql select sum(c1) from ca_stb0 partition by tbname interval(1s) slimit 2 soffset 4 limit 10 offset 1
# fill [d.12]=============================================================== # fill [d.12]===============================================================
sql_error select first(c1)-last(c1), sum(c3)*count(c3), spread(c5 ) % count(*) from $stb interval(1s) fill(prev); sql_error select first(c1)-last(c1), sum(c3)*count(c3), spread(c5 ) % count(*) from ca_stb0 interval(1s) fill(prev);
sql_error select first(c1) from $stb fill(value, 20); sql_error select first(c1) from ca_stb0 fill(value, 20);
# constant column. [d.13]=============================================================== # constant column. [d.13]===============================================================
# column value filter [d.14]=============================================================== # column value filter [d.14]===============================================================
# tag filter. [d.15]=============================================================== # tag filter. [d.15]===============================================================
sql select sum(c2)+99 from $stb where t1=12; sql select sum(c2)+99 from ca_stb0 where t1=12;
# multi-field output [d.16]=============================================================== # multi-field output [d.16]===============================================================
sql select count(*), sum(c1)*avg(c2), avg(c3)*count(c3), sum(c3), sum(c4), first(c7), last(c8), first(c9), first(c7), last(c8) from $tb sql select count(*), sum(c1)*avg(c2), avg(c3)*count(c3), sum(c3), sum(c4), first(c7), last(c8), first(c9), first(c7), last(c8) from $tb
...@@ -548,15 +545,12 @@ if $data90 != 9.500000000 then ...@@ -548,15 +545,12 @@ if $data90 != 9.500000000 then
endi endi
# interval query [d.17]=============================================================== # interval query [d.17]===============================================================
sql select avg(c2)*count(c2), sum(c3)-first(c3), last(c4)+9 from $stb interval(1s) sql select avg(c2)*count(c2), sum(c3)-first(c3), last(c4)+9 from ca_stb0 interval(1s)
if $rows != 10000 then if $rows != 10000 then
return -1 return -1
endi endi
if $data00 != @18-09-17 09:00:00.000@ then
return -1
endi
sql_error select first(c7)- last(c1) from $tb interval(2y) sql select first(c7)- last(c1) from $tb interval(2y)
# aggregation query [d.18]=============================================================== # aggregation query [d.18]===============================================================
# all cases in this part are aggregation query test. # all cases in this part are aggregation query test.
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db
run tsim/parser/columnValue_bool.sim
run tsim/parser/columnValue_tinyint.sim
run tsim/parser/columnValue_smallint.sim
run tsim/parser/columnValue_int.sim
run tsim/parser/columnValue_bigint.sim
run tsim/parser/columnValue_float.sim
run tsim/parser/columnValue_double.sim
run tsim/parser/columnValue_unsign.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database if not exists db
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db sql use db
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
...@@ -10,78 +17,64 @@ sql create table mt_bigint (ts timestamp, c bigint) tags (tagname bigint) ...@@ -10,78 +17,64 @@ sql create table mt_bigint (ts timestamp, c bigint) tags (tagname bigint)
## case 00: static create table for test tag values ## case 00: static create table for test tag values
sql create table st_bigint_0 using mt_bigint tags (NULL) sql create table st_bigint_0 using mt_bigint tags (NULL)
sql select tagname from st_bigint_0 sql show tags from st_bigint_0
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_bigint_1 using mt_bigint tags (NULL) sql create table st_bigint_1 using mt_bigint tags (NULL)
sql select tagname from st_bigint_1 sql show tags from st_bigint_1
if $data00 != NULL then if $data05 != NULL then
return -1
endi
sql create table st_bigint_2 using mt_bigint tags ('NULL')
sql select tagname from st_bigint_2
if $data00 != NULL then
return -1
endi
sql create table st_bigint_3 using mt_bigint tags ('NULL')
sql select tagname from st_bigint_3
if $data00 != NULL then
return -1
endi
sql create table st_bigint_4 using mt_bigint tags ("NULL")
sql select tagname from st_bigint_4
if $data00 != NULL then
return -1
endi
sql create table st_bigint_5 using mt_bigint tags ("NULL")
sql select tagname from st_bigint_5
if $data00 != NULL then
return -1 return -1
endi endi
sql_error create table st_bigint_2 using mt_bigint tags ('NULL')
sql_error create table st_bigint_3 using mt_bigint tags ('NULL')
sql_error create table st_bigint_4 using mt_bigint tags ("NULL")
sql_error create table st_bigint_5 using mt_bigint tags ("NULL")
sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807) sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807)
sql select tagname from st_bigint_6 sql show tags from st_bigint_6
if $data00 != -9223372036854775807 then if $data05 != -9223372036854775807 then
return -1 return -1
endi endi
sql create table st_bigint_7 using mt_bigint tags (9223372036854775807) sql create table st_bigint_7 using mt_bigint tags (9223372036854775807)
sql select tagname from st_bigint_7 sql show tags from st_bigint_7
if $data00 != 9223372036854775807 then if $data05 != 9223372036854775807 then
return -1 return -1
endi endi
sql create table st_bigint_8 using mt_bigint tags (37) sql create table st_bigint_8 using mt_bigint tags (37)
sql select tagname from st_bigint_8 sql show tags from st_bigint_8
if $data00 != 37 then if $data05 != 37 then
return -1 return -1
endi endi
sql create table st_bigint_9 using mt_bigint tags (-100) sql create table st_bigint_9 using mt_bigint tags (-100)
sql select tagname from st_bigint_9 sql show tags from st_bigint_9
if $data00 != -100 then if $data05 != -100 then
return -1 return -1
endi endi
sql create table st_bigint_10 using mt_bigint tags (+113) sql create table st_bigint_10 using mt_bigint tags (+113)
sql select tagname from st_bigint_10 sql show tags from st_bigint_10
if $data00 != 113 then if $data05 != 113 then
return -1 return -1
endi endi
sql create table st_bigint_11 using mt_bigint tags ('-100') sql create table st_bigint_11 using mt_bigint tags ('-100')
sql select tagname from st_bigint_11 sql show tags from st_bigint_11
if $data00 != -100 then if $data05 != -100 then
return -1 return -1
endi endi
sql create table st_bigint_12 using mt_bigint tags ("+78") sql create table st_bigint_12 using mt_bigint tags ("+78")
sql select tagname from st_bigint_12 sql show tags from st_bigint_12
if $data00 != 78 then if $data05 != 78 then
return -1 return -1
endi endi
sql create table st_bigint_13 using mt_bigint tags (+0078) sql create table st_bigint_13 using mt_bigint tags (+0078)
sql select tagname from st_bigint_13 sql show tags from st_bigint_13
if $data00 != 78 then if $data05 != 78 then
return -1 return -1
endi endi
sql create table st_bigint_14 using mt_bigint tags (-00078) sql create table st_bigint_14 using mt_bigint tags (-00078)
sql select tagname from st_bigint_14 sql show tags from st_bigint_14
if $data00 != -78 then if $data05 != -78 then
return -1 return -1
endi endi
...@@ -102,38 +95,7 @@ endi ...@@ -102,38 +95,7 @@ endi
if $data01 != NULL then if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_2 values (now, 'NULL')
sql select * from st_bigint_2
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_3 values (now, 'NULL')
sql select * from st_bigint_3
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_4 values (now, "NULL")
sql select * from st_bigint_4
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_5 values (now, "NULL")
sql select * from st_bigint_5
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_6 values (now, 9223372036854775807) sql insert into st_bigint_6 values (now, 9223372036854775807)
sql select * from st_bigint_6 sql select * from st_bigint_6
if $rows != 1 then if $rows != 1 then
...@@ -211,8 +173,8 @@ endi ...@@ -211,8 +173,8 @@ endi
## case 02: dynamic create table for test tag values ## case 02: dynamic create table for test tag values
sql insert into st_bigint_16 using mt_bigint tags (NULL) values (now, NULL) sql insert into st_bigint_16 using mt_bigint tags (NULL) values (now, NULL)
sql select tagname from st_bigint_16 sql show tags from st_bigint_16
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_bigint_16 sql select * from st_bigint_16
...@@ -221,8 +183,8 @@ if $data01 != NULL then ...@@ -221,8 +183,8 @@ if $data01 != NULL then
endi endi
sql insert into st_bigint_17 using mt_bigint tags (NULL) values (now, NULL) sql insert into st_bigint_17 using mt_bigint tags (NULL) values (now, NULL)
sql select tagname from st_bigint_17 sql show tags from st_bigint_17
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_bigint_17 sql select * from st_bigint_17
...@@ -230,8 +192,8 @@ if $data01 != NULL then ...@@ -230,8 +192,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_18 using mt_bigint tags ('NULL') values (now, 'NULL') sql insert into st_bigint_18 using mt_bigint tags ('NULL') values (now, 'NULL')
sql select tagname from st_bigint_18 sql show tags from st_bigint_18
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_bigint_18 sql select * from st_bigint_18
...@@ -239,8 +201,8 @@ if $data01 != NULL then ...@@ -239,8 +201,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_19 using mt_bigint tags ('NULL') values (now, 'NULL') sql insert into st_bigint_19 using mt_bigint tags ('NULL') values (now, 'NULL')
sql select tagname from st_bigint_19 sql show tags from st_bigint_19
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_bigint_19 sql select * from st_bigint_19
...@@ -248,8 +210,8 @@ if $data01 != NULL then ...@@ -248,8 +210,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_20 using mt_bigint tags ("NULL") values (now, "NULL") sql insert into st_bigint_20 using mt_bigint tags ("NULL") values (now, "NULL")
sql select tagname from st_bigint_20 sql show tags from st_bigint_20
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_bigint_20 sql select * from st_bigint_20
...@@ -257,8 +219,8 @@ if $data01 != NULL then ...@@ -257,8 +219,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_21 using mt_bigint tags ("NULL") values (now, "NULL") sql insert into st_bigint_21 using mt_bigint tags ("NULL") values (now, "NULL")
sql select tagname from st_bigint_21 sql show tags from st_bigint_21
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_bigint_21 sql select * from st_bigint_21
...@@ -266,8 +228,8 @@ if $data01 != NULL then ...@@ -266,8 +228,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_22 using mt_bigint tags (9223372036854775807) values (now, 9223372036854775807) sql insert into st_bigint_22 using mt_bigint tags (9223372036854775807) values (now, 9223372036854775807)
sql select tagname from st_bigint_22 sql show tags from st_bigint_22
if $data00 != 9223372036854775807 then if $data05 != 9223372036854775807 then
return -1 return -1
endi endi
sql select * from st_bigint_22 sql select * from st_bigint_22
...@@ -275,8 +237,8 @@ if $data01 != 9223372036854775807 then ...@@ -275,8 +237,8 @@ if $data01 != 9223372036854775807 then
return -1 return -1
endi endi
sql insert into st_bigint_23 using mt_bigint tags (-9223372036854775807) values (now, -9223372036854775807) sql insert into st_bigint_23 using mt_bigint tags (-9223372036854775807) values (now, -9223372036854775807)
sql select tagname from st_bigint_23 sql show tags from st_bigint_23
if $data00 != -9223372036854775807 then if $data05 != -9223372036854775807 then
return -1 return -1
endi endi
sql select * from st_bigint_23 sql select * from st_bigint_23
...@@ -284,8 +246,8 @@ if $data01 != -9223372036854775807 then ...@@ -284,8 +246,8 @@ if $data01 != -9223372036854775807 then
return -1 return -1
endi endi
sql insert into st_bigint_24 using mt_bigint tags (10) values (now, 10) sql insert into st_bigint_24 using mt_bigint tags (10) values (now, 10)
sql select tagname from st_bigint_24 sql show tags from st_bigint_24
if $data00 != 10 then if $data05 != 10 then
return -1 return -1
endi endi
sql select * from st_bigint_24 sql select * from st_bigint_24
...@@ -293,8 +255,8 @@ if $data01 != 10 then ...@@ -293,8 +255,8 @@ if $data01 != 10 then
return -1 return -1
endi endi
sql insert into st_bigint_25 using mt_bigint tags ("-0") values (now, "-0") sql insert into st_bigint_25 using mt_bigint tags ("-0") values (now, "-0")
sql select tagname from st_bigint_25 sql show tags from st_bigint_25
if $data00 != 0 then if $data05 != 0 then
return -1 return -1
endi endi
sql select * from st_bigint_25 sql select * from st_bigint_25
...@@ -302,8 +264,8 @@ if $data01 != 0 then ...@@ -302,8 +264,8 @@ if $data01 != 0 then
return -1 return -1
endi endi
sql insert into st_bigint_26 using mt_bigint tags ('123') values (now, '123') sql insert into st_bigint_26 using mt_bigint tags ('123') values (now, '123')
sql select tagname from st_bigint_26 sql show tags from st_bigint_26
if $data00 != 123 then if $data05 != 123 then
return -1 return -1
endi endi
sql select * from st_bigint_26 sql select * from st_bigint_26
...@@ -311,8 +273,8 @@ if $data01 != 123 then ...@@ -311,8 +273,8 @@ if $data01 != 123 then
return -1 return -1
endi endi
sql insert into st_bigint_27 using mt_bigint tags (+056) values (now, +00056) sql insert into st_bigint_27 using mt_bigint tags (+056) values (now, +00056)
sql select tagname from st_bigint_27 sql show tags from st_bigint_27
if $data00 != 56 then if $data05 != 56 then
return -1 return -1
endi endi
sql select * from st_bigint_27 sql select * from st_bigint_27
...@@ -320,8 +282,8 @@ if $data01 != 56 then ...@@ -320,8 +282,8 @@ if $data01 != 56 then
return -1 return -1
endi endi
sql insert into st_bigint_28 using mt_bigint tags (-056) values (now, -0056) sql insert into st_bigint_28 using mt_bigint tags (-056) values (now, -0056)
sql select tagname from st_bigint_28 sql show tags from st_bigint_28
if $data00 != -56 then if $data05 != -56 then
return -1 return -1
endi endi
sql select * from st_bigint_28 sql select * from st_bigint_28
...@@ -331,50 +293,50 @@ endi ...@@ -331,50 +293,50 @@ endi
### case 03: alter tag values ### case 03: alter tag values
#sql alter table st_bigint_0 set tag tagname=9223372036854775807 #sql alter table st_bigint_0 set tag tagname=9223372036854775807
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != 9223372036854775807 then #if $data05 != 9223372036854775807 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname=-9223372036854775807 #sql alter table st_bigint_0 set tag tagname=-9223372036854775807
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != -9223372036854775807 then #if $data05 != -9223372036854775807 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname=+100 #sql alter table st_bigint_0 set tag tagname=+100
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != 100 then #if $data05 != 100 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname=-33 #sql alter table st_bigint_0 set tag tagname=-33
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != -33 then #if $data05 != -33 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname='+98' #sql alter table st_bigint_0 set tag tagname='+98'
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != 98 then #if $data05 != 98 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname='-076' #sql alter table st_bigint_0 set tag tagname='-076'
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != -76 then #if $data05 != -76 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname=+0012 #sql alter table st_bigint_0 set tag tagname=+0012
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != 12 then #if $data05 != 12 then
# return -1 # return -1
#endi #endi
#sql alter table st_bigint_0 set tag tagname=-00063 #sql alter table st_bigint_0 set tag tagname=-00063
#sql select tagname from st_bigint_0 #sql show tags from st_bigint_0
#if $data00 != -63 then #if $data05 != -63 then
# return -1 # return -1
#endi #endi
## case 04: illegal input ## case 04: illegal input
################## when overflow, auto set max ################## when overflow, auto set max
sql_error create table st_bigint_e0 using mt_bigint tags (9223372036854775808) sql_error create table st_bigint_e0 using mt_bigint tags (9223372036854775808)
sql_error create table st_bigint_e0_1 using mt_bigint tags (-9223372036854775808) sql create table st_bigint_e0_1 using mt_bigint tags (-9223372036854775808)
sql_error create table st_bigint_e0_2 using mt_bigint tags (92233720368547758080) sql_error create table st_bigint_e0_2 using mt_bigint tags (92233720368547758080)
sql_error create table st_bigint_e0_3 using mt_bigint tags (-9223372036854775809) sql_error create table st_bigint_e0_3 using mt_bigint tags (-9223372036854775809)
#sql_error create table st_bigint_e0 using mt_bigint tags (12.80) truncate integer part #sql_error create table st_bigint_e0 using mt_bigint tags (12.80) truncate integer part
...@@ -384,7 +346,7 @@ sql_error create table st_bigint_e0 using mt_bigint tags ("123abc") ...@@ -384,7 +346,7 @@ sql_error create table st_bigint_e0 using mt_bigint tags ("123abc")
sql_error create table st_bigint_e0 using mt_bigint tags (abc) sql_error create table st_bigint_e0 using mt_bigint tags (abc)
sql_error create table st_bigint_e0 using mt_bigint tags ("abc") sql_error create table st_bigint_e0 using mt_bigint tags ("abc")
sql_error create table st_bigint_e0 using mt_bigint tags (" ") sql_error create table st_bigint_e0 using mt_bigint tags (" ")
sql_error create table st_bigint_e0 using mt_bigint tags ('') sql create table st_bigint_e0_error using mt_bigint tags ('')
sql create table st_bigint_e0 using mt_bigint tags (123) sql create table st_bigint_e0 using mt_bigint tags (123)
sql create table st_bigint_e1 using mt_bigint tags (123) sql create table st_bigint_e1 using mt_bigint tags (123)
...@@ -401,9 +363,9 @@ sql create table st_bigint_e11 using mt_bigint tags (123) ...@@ -401,9 +363,9 @@ sql create table st_bigint_e11 using mt_bigint tags (123)
sql create table st_bigint_e12 using mt_bigint tags (123) sql create table st_bigint_e12 using mt_bigint tags (123)
sql_error insert into st_bigint_e0 values (now, 9223372036854775808) sql_error insert into st_bigint_e0 values (now, 9223372036854775808)
sql_error insert into st_bigint_e1 values (now, -9223372036854775808) sql insert into st_bigint_e1 values (now, -9223372036854775808)
sql_error insert into st_bigint_e2 values (now, 9223372036854775809) sql_error insert into st_bigint_e2 values (now, 9223372036854775809)
sql_error insert into st_bigint_e3 values (now, -9223372036854775808) sql insert into st_bigint_e3 values (now, -9223372036854775808)
#sql_error insert into st_bigint_e4 values (now, 922337203.6854775808) #sql_error insert into st_bigint_e4 values (now, 922337203.6854775808)
#sql_error insert into st_bigint_e5 values (now, -922337203685477580.9) #sql_error insert into st_bigint_e5 values (now, -922337203685477580.9)
sql_error insert into st_bigint_e6 values (now, 123abc) sql_error insert into st_bigint_e6 values (now, 123abc)
...@@ -411,10 +373,10 @@ sql_error insert into st_bigint_e7 values (now, "123abc") ...@@ -411,10 +373,10 @@ sql_error insert into st_bigint_e7 values (now, "123abc")
sql_error insert into st_bigint_e9 values (now, abc) sql_error insert into st_bigint_e9 values (now, abc)
sql_error insert into st_bigint_e10 values (now, "abc") sql_error insert into st_bigint_e10 values (now, "abc")
sql_error insert into st_bigint_e11 values (now, " ") sql_error insert into st_bigint_e11 values (now, " ")
sql_error insert into st_bigint_e12 values (now, '') sql insert into st_bigint_e12 values (now, '')
sql_error insert into st_bigint_e13 using mt_bigint tags (033) values (now, 9223372036854775808) sql_error insert into st_bigint_e13 using mt_bigint tags (033) values (now, 9223372036854775808)
sql_error insert into st_bigint_e14 using mt_bigint tags (033) values (now, -9223372036854775808) sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, -9223372036854775808)
sql_error insert into st_bigint_e15 using mt_bigint tags (033) values (now, 9223372036854775818) sql_error insert into st_bigint_e15 using mt_bigint tags (033) values (now, 9223372036854775818)
sql_error insert into st_bigint_e16 using mt_bigint tags (033) values (now, -9923372036854775808) sql_error insert into st_bigint_e16 using mt_bigint tags (033) values (now, -9923372036854775808)
#sql_error insert into st_bigint_e17 using mt_bigint tags (033) values (now, 92233720368547758.08) #sql_error insert into st_bigint_e17 using mt_bigint tags (033) values (now, 92233720368547758.08)
...@@ -424,10 +386,10 @@ sql_error insert into st_bigint_e20 using mt_bigint tags (033) values (now, "123 ...@@ -424,10 +386,10 @@ sql_error insert into st_bigint_e20 using mt_bigint tags (033) values (now, "123
sql_error insert into st_bigint_e22 using mt_bigint tags (033) values (now, abc) sql_error insert into st_bigint_e22 using mt_bigint tags (033) values (now, abc)
sql_error insert into st_bigint_e23 using mt_bigint tags (033) values (now, "abc") sql_error insert into st_bigint_e23 using mt_bigint tags (033) values (now, "abc")
sql_error insert into st_bigint_e24 using mt_bigint tags (033) values (now, " ") sql_error insert into st_bigint_e24 using mt_bigint tags (033) values (now, " ")
sql_error insert into st_bigint_e25 using mt_bigint tags (033) values (now, '') sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, '')
sql_error insert into st_bigint_e13_0 using mt_bigint tags (9223372036854775808) values (now, -033) sql_error insert into st_bigint_e13_0 using mt_bigint tags (9223372036854775808) values (now, -033)
sql_error insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033) sql insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033)
sql_error insert into st_bigint_e15_0 using mt_bigint tags (9223372036854775809) values (now, -033) sql_error insert into st_bigint_e15_0 using mt_bigint tags (9223372036854775809) values (now, -033)
sql_error insert into st_bigint_e16_0 using mt_bigint tags (-9223372036854775898) values (now, -033) sql_error insert into st_bigint_e16_0 using mt_bigint tags (-9223372036854775898) values (now, -033)
#sql_error insert into st_bigint_e17 using mt_bigint tags (12.80) values (now, -033) #sql_error insert into st_bigint_e17 using mt_bigint tags (12.80) values (now, -033)
...@@ -437,7 +399,7 @@ sql_error insert into st_bigint_e20 using mt_bigint tags ("123abc") values (now, ...@@ -437,7 +399,7 @@ sql_error insert into st_bigint_e20 using mt_bigint tags ("123abc") values (now,
sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033) sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033)
sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033) sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033)
sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033) sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033)
sql_error insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033) sql insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033)
sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062)
sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062)
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database if not exists db
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db sql use db
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
...@@ -10,110 +17,110 @@ sql create table mt_bool (ts timestamp, c bool) tags (tagname bool) ...@@ -10,110 +17,110 @@ sql create table mt_bool (ts timestamp, c bool) tags (tagname bool)
## case 00: static create table for test tag values ## case 00: static create table for test tag values
sql create table st_bool_0 using mt_bool tags (NULL) sql create table st_bool_0 using mt_bool tags (NULL)
sql select tagname from st_bool_0 sql show tags from st_bool_0
if $data00 != NULL then if $data05 != NULL then
print ==1== expect: NULL, actually: $data00 print ==1== expect: NULL, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_1 using mt_bool tags (NULL) sql create table st_bool_1 using mt_bool tags (NULL)
sql select tagname from st_bool_1 sql show tags from st_bool_1
if $data00 != NULL then if $data05 != NULL then
print ==2== expect: NULL, actually: $data00 print ==2== expect: NULL, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_2 using mt_bool tags ('NULL') sql create table st_bool_2 using mt_bool tags ('NULL')
sql select tagname from st_bool_2 sql show tags from st_bool_2
if $data00 != NULL then if $data05 != false then
print ==3== expect: NULL, actually: $data00 print ==3== expect: false, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_3 using mt_bool tags ('NULL') sql create table st_bool_3 using mt_bool tags ('NULL')
sql select tagname from st_bool_3 sql show tags from st_bool_3
if $data00 != NULL then if $data05 != false then
print ==4== expect: NULL, actually: $data00 print ==4== expect: false, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_4 using mt_bool tags ("NULL") sql create table st_bool_4 using mt_bool tags ("NULL")
sql select tagname from st_bool_4 sql show tags from st_bool_4
if $data00 != NULL then if $data05 != false then
print ==5== expect: NULL, actually: $data00 print ==5== expect: false, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_5 using mt_bool tags ("NULL") sql create table st_bool_5 using mt_bool tags ("NULL")
sql select tagname from st_bool_5 sql show tags from st_bool_5
if $data00 != NULL then if $data05 != false then
print ==6== expect: NULL, actually: $data00 print ==6== expect: false, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_6 using mt_bool tags ("true") sql create table st_bool_6 using mt_bool tags ("true")
sql select tagname from st_bool_6 sql show tags from st_bool_6
if $data00 != 1 then if $data05 != true then
print ==7== expect: 1, actually: $data00 print ==7== expect: 1, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_7 using mt_bool tags ('true') sql create table st_bool_7 using mt_bool tags ('true')
sql select tagname from st_bool_7 sql show tags from st_bool_7
if $data00 != 1 then if $data05 != true then
print ==8== expect: 1, actually: $data00 print ==8== expect: 1, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_8 using mt_bool tags (true) sql create table st_bool_8 using mt_bool tags (true)
sql select tagname from st_bool_8 sql show tags from st_bool_8
if $data00 != 1 then if $data05 != true then
print ==9== expect: 1, actually: $data00 print ==9== expect: 1, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_9 using mt_bool tags ("false") sql create table st_bool_9 using mt_bool tags ("false")
sql select tagname from st_bool_9 sql show tags from st_bool_9
if $data00 != 0 then if $data05 != false then
print ==10== expect: 0, actually: $data00 print ==10== expect: 0, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_10 using mt_bool tags ('false') sql create table st_bool_10 using mt_bool tags ('false')
sql select tagname from st_bool_10 sql show tags from st_bool_10
if $data00 != 0 then if $data05 != false then
print ==11== expect: 0, actually: $data00 print ==11== expect: 0, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_11 using mt_bool tags (false) sql create table st_bool_11 using mt_bool tags (false)
sql select tagname from st_bool_11 sql show tags from st_bool_11
if $data00 != 0 then if $data05 != false then
print ==12== expect: 0, actually: $data00 print ==12== expect: 0, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_12 using mt_bool tags (0) sql create table st_bool_12 using mt_bool tags (0)
sql select tagname from st_bool_12 sql show tags from st_bool_12
if $data00 != 0 then if $data05 != false then
print ==13== expect: 0, actually: $data00 print ==13== expect: 0, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_13 using mt_bool tags (1) sql create table st_bool_13 using mt_bool tags (1)
sql select tagname from st_bool_13 sql show tags from st_bool_13
if $data00 != 1 then if $data05 != true then
print ==14== expect: 1, actually: $data00 print ==14== expect: 1, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_14 using mt_bool tags (6.9) sql create table st_bool_14 using mt_bool tags (6.9)
sql select tagname from st_bool_14 sql show tags from st_bool_14
if $data00 != 1 then if $data05 != true then
print ==15== expect: 1, actually: $data00 print ==15== expect: 1, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_15 using mt_bool tags (-3) sql create table st_bool_15 using mt_bool tags (-3)
sql select tagname from st_bool_15 sql show tags from st_bool_15
if $data00 != 1 then if $data05 != true then
print ==16== expect: 1, actually: $data00 print ==16== expect: 1, actually: $data00
return -1 return -1
endi endi
sql create table st_bool_15_0 using mt_bool tags (+300) sql create table st_bool_15_0 using mt_bool tags (+300)
sql select tagname from st_bool_15_0 sql show tags from st_bool_15_0
if $data00 != 1 then if $data05 != true then
print ==16== expect: 1, actually: $data00 print ==16== expect: 1, actually: $data00
return -1 return -1
endi endi
sql create table st_bool_15_1 using mt_bool tags (-8.03) sql create table st_bool_15_1 using mt_bool tags (-8.03)
sql select tagname from st_bool_15_1 sql show tags from st_bool_15_1
if $data00 != 1 then if $data05 != true then
print ==16== expect: 1, actually: $data00 print ==16== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -284,8 +291,8 @@ endi ...@@ -284,8 +291,8 @@ endi
## case 02: dynamic create table for test tag values ## case 02: dynamic create table for test tag values
sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL) sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL)
sql select tagname from st_bool_16 sql show tags from st_bool_16
if $data00 != NULL then if $data05 != NULL then
print ==33== expect: NULL, actually: $data00 print ==33== expect: NULL, actually: $data00
return -1 return -1
endi endi
...@@ -296,8 +303,8 @@ if $data01 != NULL then ...@@ -296,8 +303,8 @@ if $data01 != NULL then
endi endi
sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL) sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL)
sql select tagname from st_bool_17 sql show tags from st_bool_17
if $data00 != NULL then if $data05 != NULL then
print ==35== expect: NULL, actually: $data00 print ==35== expect: NULL, actually: $data00
return -1 return -1
endi endi
...@@ -307,8 +314,8 @@ if $data01 != NULL then ...@@ -307,8 +314,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL') sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL')
sql select tagname from st_bool_18 sql show tags from st_bool_18
if $data00 != NULL then if $data05 != NULL then
print ==37== expect: NULL, actually: $data00 print ==37== expect: NULL, actually: $data00
return -1 return -1
endi endi
...@@ -318,8 +325,8 @@ if $data01 != NULL then ...@@ -318,8 +325,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bool_19 using mt_bool tags ('NULL') values (now, 'NULL') sql insert into st_bool_19 using mt_bool tags ('NULL') values (now, 'NULL')
sql select tagname from st_bool_19 sql show tags from st_bool_19
if $data00 != NULL then if $data05 != NULL then
print ==39== expect: NULL, actually: $data00 print ==39== expect: NULL, actually: $data00
return -1 return -1
endi endi
...@@ -329,8 +336,8 @@ if $data01 != NULL then ...@@ -329,8 +336,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bool_20 using mt_bool tags ("NULL") values (now, "NULL") sql insert into st_bool_20 using mt_bool tags ("NULL") values (now, "NULL")
sql select tagname from st_bool_20 sql show tags from st_bool_20
if $data00 != NULL then if $data05 != NULL then
print ==41== expect: NULL, actually: $data00 print ==41== expect: NULL, actually: $data00
return -1 return -1
endi endi
...@@ -340,8 +347,8 @@ if $data01 != NULL then ...@@ -340,8 +347,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bool_21 using mt_bool tags ("NULL") values (now, "NULL") sql insert into st_bool_21 using mt_bool tags ("NULL") values (now, "NULL")
sql select tagname from st_bool_21 sql show tags from st_bool_21
if $data00 != NULL then if $data05 != NULL then
print ==43== expect: NULL, actually: $data00 print ==43== expect: NULL, actually: $data00
return -1 return -1
endi endi
...@@ -351,8 +358,8 @@ if $data01 != NULL then ...@@ -351,8 +358,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bool_22 using mt_bool tags ("true") values (now, "true") sql insert into st_bool_22 using mt_bool tags ("true") values (now, "true")
sql select tagname from st_bool_22 sql show tags from st_bool_22
if $data00 != 1 then if $data05 != true then
print ==45== expect: 1, actually: $data00 print ==45== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -362,8 +369,8 @@ if $data01 != 1 then ...@@ -362,8 +369,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true') sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true')
sql select tagname from st_bool_23 sql show tags from st_bool_23
if $data00 != 1 then if $data05 != true then
print ==47== expect: 1, actually: $data00 print ==47== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -373,8 +380,8 @@ if $data01 != 1 then ...@@ -373,8 +380,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_24 using mt_bool tags (true) values (now, true) sql insert into st_bool_24 using mt_bool tags (true) values (now, true)
sql select tagname from st_bool_24 sql show tags from st_bool_24
if $data00 != 1 then if $data05 != true then
print ==49== expect: 1, actually: $data00 print ==49== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -384,8 +391,8 @@ if $data01 != 1 then ...@@ -384,8 +391,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false") sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false")
sql select tagname from st_bool_25 sql show tags from st_bool_25
if $data00 != 0 then if $data05 != false then
print ==51== expect: 0, actually: $data00 print ==51== expect: 0, actually: $data00
return -1 return -1
endi endi
...@@ -395,8 +402,8 @@ if $data01 != 0 then ...@@ -395,8 +402,8 @@ if $data01 != 0 then
return -1 return -1
endi endi
sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false') sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false')
sql select tagname from st_bool_26 sql show tags from st_bool_26
if $data00 != 0 then if $data05 != false then
print ==53== expect: 0, actually: $data00 print ==53== expect: 0, actually: $data00
return -1 return -1
endi endi
...@@ -406,8 +413,8 @@ if $data01 != 0 then ...@@ -406,8 +413,8 @@ if $data01 != 0 then
return -1 return -1
endi endi
sql insert into st_bool_27 using mt_bool tags (false) values (now, false) sql insert into st_bool_27 using mt_bool tags (false) values (now, false)
sql select tagname from st_bool_27 sql show tags from st_bool_27
if $data00 != 0 then if $data05 != false then
print ==55== expect: 0, actually: $data00 print ==55== expect: 0, actually: $data00
return -1 return -1
endi endi
...@@ -417,8 +424,8 @@ if $data01 != 0 then ...@@ -417,8 +424,8 @@ if $data01 != 0 then
return -1 return -1
endi endi
sql insert into st_bool_28 using mt_bool tags (0) values (now, 0) sql insert into st_bool_28 using mt_bool tags (0) values (now, 0)
sql select tagname from st_bool_28 sql show tags from st_bool_28
if $data00 != 0 then if $data05 != false then
print ==57== expect: 0, actually: $data00 print ==57== expect: 0, actually: $data00
return -1 return -1
endi endi
...@@ -428,8 +435,8 @@ if $data01 != 0 then ...@@ -428,8 +435,8 @@ if $data01 != 0 then
return -1 return -1
endi endi
sql insert into st_bool_29 using mt_bool tags (1) values (now, 1) sql insert into st_bool_29 using mt_bool tags (1) values (now, 1)
sql select tagname from st_bool_29 sql show tags from st_bool_29
if $data00 != 1 then if $data05 != true then
print ==59== expect: 1, actually: $data00 print ==59== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -439,8 +446,8 @@ if $data01 != 1 then ...@@ -439,8 +446,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9) sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9)
sql select tagname from st_bool_30 sql show tags from st_bool_30
if $data00 != 1 then if $data05 != true then
print ==61== expect: 1, actually: $data00 print ==61== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -450,8 +457,8 @@ if $data01 != 1 then ...@@ -450,8 +457,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3) sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3)
sql select tagname from st_bool_31 sql show tags from st_bool_31
if $data00 != 1 then if $data05 != true then
print ==63== expect: 1, actually: $data00 print ==63== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -461,8 +468,8 @@ if $data01 != 1 then ...@@ -461,8 +468,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300) sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300)
sql select tagname from st_bool_32 sql show tags from st_bool_32
if $data00 != 1 then if $data05 != true then
print ==63== expect: 1, actually: $data00 print ==63== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -472,8 +479,8 @@ if $data01 != 1 then ...@@ -472,8 +479,8 @@ if $data01 != 1 then
return -1 return -1
endi endi
sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890) sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890)
sql select tagname from st_bool_33 sql show tags from st_bool_33
if $data00 != 1 then if $data05 != true then
print ==63== expect: 1, actually: $data00 print ==63== expect: 1, actually: $data00
return -1 return -1
endi endi
...@@ -490,140 +497,140 @@ endi ...@@ -490,140 +497,140 @@ endi
## case 03: alter tag values ## case 03: alter tag values
#sql alter table st_bool_0 set tag tagname=true #sql alter table st_bool_0 set tag tagname=true
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != true then #if $data00 != true then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=NULL #sql alter table st_bool_0 set tag tagname=NULL
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != NULL then #if $data00 != NULL then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=false #sql alter table st_bool_0 set tag tagname=false
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != false then #if $data00 != false then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=NULL #sql alter table st_bool_0 set tag tagname=NULL
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != NULL then #if $data00 != NULL then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname='true' #sql alter table st_bool_0 set tag tagname='true'
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != true then #if $data00 != true then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname='NULL' #sql alter table st_bool_0 set tag tagname='NULL'
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != NULL then #if $data00 != NULL then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname='false' #sql alter table st_bool_0 set tag tagname='false'
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != false then #if $data00 != false then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname='NULL' #sql alter table st_bool_0 set tag tagname='NULL'
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != NULL then #if $data00 != NULL then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname="true" #sql alter table st_bool_0 set tag tagname="true"
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != true then #if $data00 != true then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname="NULL" #sql alter table st_bool_0 set tag tagname="NULL"
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != NULL then #if $data00 != NULL then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname="false" #sql alter table st_bool_0 set tag tagname="false"
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != false then #if $data00 != false then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname="NULL" #sql alter table st_bool_0 set tag tagname="NULL"
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != NULL then #if $data00 != NULL then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=1 #sql alter table st_bool_0 set tag tagname=1
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != true then #if $data00 != true then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=0 #sql alter table st_bool_0 set tag tagname=0
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != false then #if $data00 != false then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=6.9 #sql alter table st_bool_0 set tag tagname=6.9
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != true then #if $data00 != true then
# return -1 # return -1
#endi #endi
#sql alter table st_bool_0 set tag tagname=-3 #sql alter table st_bool_0 set tag tagname=-3
#sql select tagname from st_bool_0 #sql show tags from st_bool_0
#if $data00 != true then #if $data00 != true then
# return -1 # return -1
#endi #endi
# case 04: illegal input # case 04: illegal input
sql_error create table st_bool_e0 using mt_bool tags (123abc) sql_error create table st_bool_e0 using mt_bool tags (123abc)
sql_error create table st_bool_e1 using mt_bool tags ("123abc") sql create table st_bool_e1 using mt_bool tags ("123abc")
sql_error create table st_bool_e2 using mt_bool tags ("123") sql create table st_bool_e2 using mt_bool tags ("123")
sql_error create table st_bool_e3 using mt_bool tags (abc) sql_error create table st_bool_e3 using mt_bool tags (abc)
sql_error create table st_bool_e4 using mt_bool tags ("abc") sql create table st_bool_e4 using mt_bool tags ("abc")
sql_error create table st_bool_e5 using mt_bool tags (" ") sql create table st_bool_e5 using mt_bool tags (" ")
sql_error create table st_bool_e6 using mt_bool tags ('') sql create table st_bool_e6 using mt_bool tags ('')
sql create table st_bool_e0 using mt_bool tags (true) sql create table st_bool_f0 using mt_bool tags (true)
sql create table st_bool_e1 using mt_bool tags (true) sql create table st_bool_f1 using mt_bool tags (true)
sql create table st_bool_e2 using mt_bool tags (true) sql create table st_bool_f2 using mt_bool tags (true)
sql create table st_bool_e3 using mt_bool tags (true) sql create table st_bool_f3 using mt_bool tags (true)
sql create table st_bool_e4 using mt_bool tags (true) sql create table st_bool_f4 using mt_bool tags (true)
sql create table st_bool_e5 using mt_bool tags (true) sql create table st_bool_f5 using mt_bool tags (true)
sql create table st_bool_e6 using mt_bool tags (true) sql create table st_bool_f6 using mt_bool tags (true)
sql_error insert into st_bool_e0 values (now, 123abc) sql_error insert into st_bool_g0 values (now, 123abc)
sql_error insert into st_bool_e1 values (now, "123abc") sql_error insert into st_bool_g1 values (now, "123abc")
sql_error insert into st_bool_e2 values (now, "123") sql_error insert into st_bool_g2 values (now, "123")
sql_error insert into st_bool_e3 values (now, abc) sql_error insert into st_bool_g3 values (now, abc)
sql_error insert into st_bool_e4 values (now, "abc") sql_error insert into st_bool_g4 values (now, "abc")
sql_error insert into st_bool_e5 values (now, " ") sql_error insert into st_bool_g5 values (now, " ")
sql_error insert into st_bool_e6 values (now, '') sql_error insert into st_bool_g6 values (now, '')
sql_error insert into st_bool_e10 using mt_bool tags (123abc) values (now, 1) sql_error insert into st_bool_h0 using mt_bool tags (123abc) values (now, 1)
sql_error insert into st_bool_e11 using mt_bool tags ("123abc") values (now, 1) sql_error insert into st_bool_h1 using mt_bool tags ("123abc") values (now, 1)
sql_error insert into st_bool_e12 using mt_bool tags ("123") values (now, 1) sql_error insert into st_bool_h2 using mt_bool tags ("123") values (now, 1)
sql_error insert into st_bool_e13 using mt_bool tags (abc) values (now, 1) sql_error insert into st_bool_h3 using mt_bool tags (abc) values (now, 1)
sql_error insert into st_bool_e14 using mt_bool tags ("abc") values (now, 1) sql_error insert into st_bool_h4 using mt_bool tags ("abc") values (now, 1)
sql_error insert into st_bool_e15 using mt_bool tags (" ") values (now, 1) sql_error insert into st_bool_h5 using mt_bool tags (" ") values (now, 1)
sql_error insert into st_bool_e16 using mt_bool tags ('') values (now, 1) sql_error insert into st_bool_h6 using mt_bool tags ('') values (now, 1)
sql_error insert into st_bool_e17 using mt_bool tags (1) values (now, 123abc) sql_error insert into st_bool_h0 using mt_bool tags (1) values (now, 123abc)
sql_error insert into st_bool_e18 using mt_bool tags (1) values (now, "123abc") sql_error insert into st_bool_h1 using mt_bool tags (1) values (now, "123abc")
sql_error insert into st_bool_e19 using mt_bool tags (1) values (now, "123") sql_error insert into st_bool_h2 using mt_bool tags (1) values (now, "123")
sql_error insert into st_bool_e20 using mt_bool tags (1) values (now, abc) sql_error insert into st_bool_h3 using mt_bool tags (1) values (now, abc)
sql_error insert into st_bool_e21 using mt_bool tags (1) values (now, "abc") sql_error insert into st_bool_h4 using mt_bool tags (1) values (now, "abc")
sql_error insert into st_bool_e22 using mt_bool tags (1) values (now, " ") sql_error insert into st_bool_h5 using mt_bool tags (1) values (now, " ")
sql_error insert into st_bool_e23 using mt_bool tags (1) values (now, '') sql_error insert into st_bool_h6 using mt_bool tags (1) values (now, '')
sql insert into st_bool_e10 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i0 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_e11 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i1 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_e12 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i2 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_e13 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i3 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_e14 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i4 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_e15 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i5 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_e16 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1)
sql_error alter table st_bool_e10 set tag tagname=123abc sql_error alter table st_bool_i0 set tag tagname=123abc
sql_error alter table st_bool_e11 set tag tagname="123abc" sql alter table st_bool_i1 set tag tagname="123abc"
sql_error alter table st_bool_e12 set tag tagname="123" sql alter table st_bool_i2 set tag tagname="123"
sql_error alter table st_bool_e13 set tag tagname=abc sql_error alter table st_bool_i3 set tag tagname=abc
sql_error alter table st_bool_e14 set tag tagname="abc" sql alter table st_bool_i4 set tag tagname="abc"
sql_error alter table st_bool_e15 set tag tagname=" " sql alter table st_bool_i5 set tag tagname=" "
sql_error alter table st_bool_e16 set tag tagname='' sql alter table st_bool_i6 set tag tagname=''
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database if not exists db
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db sql use db
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
...@@ -10,135 +17,135 @@ sql create table mt_double (ts timestamp, c double) tags (tagname double) ...@@ -10,135 +17,135 @@ sql create table mt_double (ts timestamp, c double) tags (tagname double)
## case 00: static create table for test tag values ## case 00: static create table for test tag values
sql create table st_double_0 using mt_double tags (NULL ) sql create table st_double_0 using mt_double tags (NULL )
sql select tagname from st_double_0 sql show tags from st_double_0
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_double_1 using mt_double tags (NULL) sql create table st_double_1 using mt_double tags (NULL)
sql select tagname from st_double_1 sql show tags from st_double_1
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_double_2 using mt_double tags ('NULL') sql create table st_double_2 using mt_double tags ('NULL')
sql select tagname from st_double_2 sql show tags from st_double_2
if $data00 != NULL then if $data05 != 0.000000000 then
return -1 return -1
endi endi
sql create table st_double_3 using mt_double tags ('NULL') sql create table st_double_3 using mt_double tags ('NULL')
sql select tagname from st_double_3 sql show tags from st_double_3
if $data00 != NULL then if $data05 != 0.000000000 then
return -1 return -1
endi endi
sql create table st_double_4 using mt_double tags ("NULL") sql create table st_double_4 using mt_double tags ("NULL")
sql select tagname from st_double_4 sql show tags from st_double_4
if $data00 != NULL then if $data05 != 0.000000000 then
return -1 return -1
endi endi
sql create table st_double_5 using mt_double tags ("NULL") sql create table st_double_5 using mt_double tags ("NULL")
sql select tagname from st_double_5 sql show tags from st_double_5
if $data00 != NULL then if $data05 != 0.000000000 then
return -1 return -1
endi endi
sql create table st_double_6 using mt_double tags (-123.321) sql create table st_double_6 using mt_double tags (-123.321)
sql select tagname from st_double_6 sql show tags from st_double_6
if $data00 != -123.321000000 then if $data05 != -123.321000000 then
print expect -123.321000000, actual: $data00 print expect -123.321000000, actual: $data05
return -1 return -1
endi endi
sql create table st_double_7 using mt_double tags (+1.567) sql create table st_double_7 using mt_double tags (+1.567)
sql select tagname from st_double_7 sql show tags from st_double_7
if $data00 != 1.567000000 then if $data05 != 1.567000000 then
return -1 return -1
endi endi
sql create table st_double_8 using mt_double tags (379.001) sql create table st_double_8 using mt_double tags (379.001)
sql select tagname from st_double_8 sql show tags from st_double_8
if $data00 != 379.001000000 then if $data05 != 379.001000000 then
return -1 return -1
endi endi
sql create table st_double_9 using mt_double tags (1.5e+3) sql create table st_double_9 using mt_double tags (1.5e+3)
sql select tagname from st_double_9 sql show tags from st_double_9
if $data00 != 1500.000000000 then if $data05 != 1500.000000000 then
return -1 return -1
endi endi
sql create table st_double_10 using mt_double tags (-1.5e-3) sql create table st_double_10 using mt_double tags (-1.5e-3)
sql select tagname from st_double_10 sql show tags from st_double_10
if $data00 != -0.001500000 then if $data05 != -0.001500000 then
return -1 return -1
endi endi
sql create table st_double_11 using mt_double tags (+1.5e+3) sql create table st_double_11 using mt_double tags (+1.5e+3)
sql select tagname from st_double_11 sql show tags from st_double_11
if $data00 != 1500.000000000 then if $data05 != 1500.000000000 then
return -1 return -1
endi endi
sql create table st_double_12 using mt_double tags (-1.5e+3) sql create table st_double_12 using mt_double tags (-1.5e+3)
sql select tagname from st_double_12 sql show tags from st_double_12
if $data00 != -1500.000000000 then if $data05 != -1500.000000000 then
return -1 return -1
endi endi
sql create table st_double_13 using mt_double tags (1.5e-3) sql create table st_double_13 using mt_double tags (1.5e-3)
sql select tagname from st_double_13 sql show tags from st_double_13
if $data00 != 0.001500000 then if $data05 != 0.001500000 then
return -1 return -1
endi endi
sql create table st_double_14 using mt_double tags (1.5E-3) sql create table st_double_14 using mt_double tags (1.5E-3)
sql select tagname from st_double_14 sql show tags from st_double_14
if $data00 != 0.001500000 then if $data05 != 0.001500000 then
return -1 return -1
endi endi
sql create table st_double_6_0 using mt_double tags ('-123.321') sql create table st_double_6_0 using mt_double tags ('-123.321')
sql select tagname from st_double_6_0 sql show tags from st_double_6_0
if $data00 != -123.321000000 then if $data05 != -123.321000000 then
return -1 return -1
endi endi
sql create table st_double_7_0 using mt_double tags ('+1.567') sql create table st_double_7_0 using mt_double tags ('+1.567')
sql select tagname from st_double_7_0 sql show tags from st_double_7_0
if $data00 != 1.567000000 then if $data05 != 1.567000000 then
return -1 return -1
endi endi
sql create table st_double_8_0 using mt_double tags ('379.001') sql create table st_double_8_0 using mt_double tags ('379.001')
sql select tagname from st_double_8_0 sql show tags from st_double_8_0
if $data00 != 379.001000000 then if $data05 != 379.001000000 then
return -1 return -1
endi endi
sql create table st_double_9_0 using mt_double tags ('1.5e+3') sql create table st_double_9_0 using mt_double tags ('1.5e+3')
sql select tagname from st_double_9_0 sql show tags from st_double_9_0
if $data00 != 1500.000000000 then if $data05 != 1500.000000000 then
return -1 return -1
endi endi
sql create table st_double_10_0 using mt_double tags ('-1.5e-3') sql create table st_double_10_0 using mt_double tags ('-1.5e-3')
sql select tagname from st_double_10_0 sql show tags from st_double_10_0
if $data00 != -0.001500000 then if $data05 != -0.001500000 then
return -1 return -1
endi endi
sql create table st_double_11_0 using mt_double tags ('+1.5e+3') sql create table st_double_11_0 using mt_double tags ('+1.5e+3')
sql select tagname from st_double_11_0 sql show tags from st_double_11_0
if $data00 != 1500.000000000 then if $data05 != 1500.000000000 then
return -1 return -1
endi endi
sql create table st_double_12_0 using mt_double tags ('-1.5e+3') sql create table st_double_12_0 using mt_double tags ('-1.5e+3')
sql select tagname from st_double_12_0 sql show tags from st_double_12_0
if $data00 != -1500.000000000 then if $data05 != -1500.000000000 then
return -1 return -1
endi endi
sql create table st_double_13_0 using mt_double tags ('1.5e-3') sql create table st_double_13_0 using mt_double tags ('1.5e-3')
sql select tagname from st_double_13_0 sql show tags from st_double_13_0
if $data00 != 0.001500000 then if $data05 != 0.001500000 then
return -1 return -1
endi endi
sql create table st_double_14_0 using mt_double tags ('1.5E-3') sql create table st_double_14_0 using mt_double tags ('1.5E-3')
sql select tagname from st_double_14_0 sql show tags from st_double_14_0
if $data00 != 0.001500000 then if $data05 != 0.001500000 then
return -1 return -1
endi endi
sql create table st_double_15_0 using mt_double tags (1.7976931348623157e+308) sql create table st_double_15_0 using mt_double tags (1.7976931348623157e+308)
sql select tagname from st_double_15_0 sql show tags from st_double_15_0
#if $data00 != 0.001500000 then #if $data05 != 0.001500000 then
# return -1 # return -1
#endi #endi
sql create table st_double_16_0 using mt_double tags (-1.7976931348623157e+308) sql create table st_double_16_0 using mt_double tags (-1.7976931348623157e+308)
sql select tagname from st_double_16_0 sql show tags from st_double_16_0
#if $data00 != 0.001500000 then #if $data05 != 0.001500000 then
# return -1 # return -1
#endi #endi
...@@ -270,8 +277,8 @@ endi ...@@ -270,8 +277,8 @@ endi
## case 02: dynamic create table for test tag values ## case 02: dynamic create table for test tag values
sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL ) sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL )
sql select tagname from st_double_16 sql show tags from st_double_16
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_double_16 sql select * from st_double_16
...@@ -280,8 +287,8 @@ if $data01 != NULL then ...@@ -280,8 +287,8 @@ if $data01 != NULL then
endi endi
sql insert into st_double_17 using mt_double tags (NULL) values (now, NULL) sql insert into st_double_17 using mt_double tags (NULL) values (now, NULL)
sql select tagname from st_double_17 sql show tags from st_double_17
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_double_17 sql select * from st_double_17
...@@ -289,8 +296,8 @@ if $data01 != NULL then ...@@ -289,8 +296,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_double_18 using mt_double tags ('NULL') values (now, 'NULL') sql insert into st_double_18 using mt_double tags ('NULL') values (now, 'NULL')
sql select tagname from st_double_18 sql show tags from st_double_18
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_double_18 sql select * from st_double_18
...@@ -298,8 +305,8 @@ if $data01 != NULL then ...@@ -298,8 +305,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_double_19 using mt_double tags ('NULL') values (now, 'NULL') sql insert into st_double_19 using mt_double tags ('NULL') values (now, 'NULL')
sql select tagname from st_double_19 sql show tags from st_double_19
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_double_19 sql select * from st_double_19
...@@ -307,8 +314,8 @@ if $data01 != NULL then ...@@ -307,8 +314,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_double_20 using mt_double tags ("NULL") values (now, "NULL") sql insert into st_double_20 using mt_double tags ("NULL") values (now, "NULL")
sql select tagname from st_double_20 sql show tags from st_double_20
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_double_20 sql select * from st_double_20
...@@ -316,8 +323,8 @@ if $data01 != NULL then ...@@ -316,8 +323,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_double_21 using mt_double tags ("NULL") values (now, "NULL") sql insert into st_double_21 using mt_double tags ("NULL") values (now, "NULL")
sql select tagname from st_double_21 sql show tags from st_double_21
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_double_21 sql select * from st_double_21
...@@ -325,8 +332,8 @@ if $data01 != NULL then ...@@ -325,8 +332,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_double_22 using mt_double tags (127) values (now, 1.7976931348623157e+308) sql insert into st_double_22 using mt_double tags (127) values (now, 1.7976931348623157e+308)
sql select tagname from st_double_22 sql show tags from st_double_22
#if $data00 != 127 then #if $data05 != 127 then
# return -1 # return -1
#endi #endi
sql select * from st_double_22 sql select * from st_double_22
...@@ -334,8 +341,8 @@ sql select * from st_double_22 ...@@ -334,8 +341,8 @@ sql select * from st_double_22
# return -1 # return -1
#endi #endi
sql insert into st_double_23 using mt_double tags (-127) values (now, -1.7976931348623157e+308) sql insert into st_double_23 using mt_double tags (-127) values (now, -1.7976931348623157e+308)
sql select tagname from st_double_23 sql show tags from st_double_23
#if $data00 != -127 then #if $data05 != -127 then
# return -1 # return -1
#endi #endi
sql select * from st_double_23 sql select * from st_double_23
...@@ -343,8 +350,8 @@ sql select * from st_double_23 ...@@ -343,8 +350,8 @@ sql select * from st_double_23
# return -1 # return -1
#endi #endi
sql insert into st_double_24 using mt_double tags (10) values (now, 10) sql insert into st_double_24 using mt_double tags (10) values (now, 10)
sql select tagname from st_double_24 sql show tags from st_double_24
#if $data00 != 10 then #if $data05 != 10 then
# return -1 # return -1
#endi #endi
sql select * from st_double_24 sql select * from st_double_24
...@@ -352,8 +359,8 @@ sql select * from st_double_24 ...@@ -352,8 +359,8 @@ sql select * from st_double_24
# return -1 # return -1
#endi #endi
sql insert into st_double_25 using mt_double tags ("-0") values (now, "-0") sql insert into st_double_25 using mt_double tags ("-0") values (now, "-0")
sql select tagname from st_double_25 sql show tags from st_double_25
#if $data00 != 0 then #if $data05 != 0 then
# return -1 # return -1
#endi #endi
sql select * from st_double_25 sql select * from st_double_25
...@@ -361,8 +368,8 @@ sql select * from st_double_25 ...@@ -361,8 +368,8 @@ sql select * from st_double_25
# return -1 # return -1
#endi #endi
sql insert into st_double_26 using mt_double tags ('123') values (now, '12.3') sql insert into st_double_26 using mt_double tags ('123') values (now, '12.3')
sql select tagname from st_double_26 sql show tags from st_double_26
#if $data00 != 123 then #if $data05 != 123 then
# return -1 # return -1
#endi #endi
sql select * from st_double_26 sql select * from st_double_26
...@@ -370,8 +377,8 @@ sql select * from st_double_26 ...@@ -370,8 +377,8 @@ sql select * from st_double_26
# return -1 # return -1
#endi #endi
sql insert into st_double_27 using mt_double tags (+056) values (now, +0005.6) sql insert into st_double_27 using mt_double tags (+056) values (now, +0005.6)
sql select tagname from st_double_27 sql show tags from st_double_27
#if $data00 != 56 then #if $data05 != 56 then
# return -1 # return -1
#endi #endi
sql select * from st_double_27 sql select * from st_double_27
...@@ -379,8 +386,8 @@ sql select * from st_double_27 ...@@ -379,8 +386,8 @@ sql select * from st_double_27
# return -1 # return -1
#endi #endi
sql insert into st_double_28 using mt_double tags (-056) values (now, -005.6) sql insert into st_double_28 using mt_double tags (-056) values (now, -005.6)
sql select tagname from st_double_28 sql show tags from st_double_28
#if $data00 != -56 then #if $data05 != -56 then
# return -1 # return -1
#endi #endi
sql select * from st_double_28 sql select * from st_double_28
...@@ -390,43 +397,43 @@ sql select * from st_double_28 ...@@ -390,43 +397,43 @@ sql select * from st_double_28
### case 03: alter tag values ### case 03: alter tag values
#sql alter table st_double_0 set tag tagname=1.7976931348623157e+308 #sql alter table st_double_0 set tag tagname=1.7976931348623157e+308
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != 127 then ##if $data05 != 127 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname=-1.7976931348623157e+308 #sql alter table st_double_0 set tag tagname=-1.7976931348623157e+308
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != -127 then ##if $data05 != -127 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname=+10.340 #sql alter table st_double_0 set tag tagname=+10.340
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != 100 then ##if $data05 != 100 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname=-33.87 #sql alter table st_double_0 set tag tagname=-33.87
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != -33 then ##if $data05 != -33 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname='+9.8' #sql alter table st_double_0 set tag tagname='+9.8'
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != 98 then ##if $data05 != 98 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname='-07.6' #sql alter table st_double_0 set tag tagname='-07.6'
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != -76 then ##if $data05 != -76 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname=+0012.871 #sql alter table st_double_0 set tag tagname=+0012.871
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != 12 then ##if $data05 != 12 then
## return -1 ## return -1
##endi ##endi
#sql alter table st_double_0 set tag tagname=-00063.582 #sql alter table st_double_0 set tag tagname=-00063.582
#sql select tagname from st_double_0 #sql show tags from st_double_0
##if $data00 != -63 then ##if $data05 != -63 then
## return -1 ## return -1
##endi ##endi
...@@ -438,11 +445,11 @@ sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+ ...@@ -438,11 +445,11 @@ sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+
#sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part #sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part
#sql_error create table st_double_e0 using mt_double tags (-11.80) #sql_error create table st_double_e0 using mt_double tags (-11.80)
sql_error create table st_double_e0 using mt_double tags (123abc) sql_error create table st_double_e0 using mt_double tags (123abc)
sql_error create table st_double_e0 using mt_double tags ("123abc") sql create table st_double_e0_1 using mt_double tags ("123abc")
sql_error create table st_double_e0 using mt_double tags (abc) sql_error create table st_double_e0 using mt_double tags (abc)
sql_error create table st_double_e0 using mt_double tags ("abc") sql create table st_double_e0_2 using mt_double tags ("abc")
sql_error create table st_double_e0 using mt_double tags (" ") sql create table st_double_e0_3 using mt_double tags (" ")
sql_error create table st_double_e0 using mt_double tags ('') sql create table st_double_e0_4 using mt_double tags ('')
sql create table st_double_e0 using mt_double tags (123) sql create table st_double_e0 using mt_double tags (123)
sql create table st_double_e1 using mt_double tags (123) sql create table st_double_e1 using mt_double tags (123)
...@@ -469,7 +476,7 @@ sql_error insert into st_double_e7 values (now, "123abc") ...@@ -469,7 +476,7 @@ sql_error insert into st_double_e7 values (now, "123abc")
sql_error insert into st_double_e9 values (now, abc) sql_error insert into st_double_e9 values (now, abc)
sql_error insert into st_double_e10 values (now, "abc") sql_error insert into st_double_e10 values (now, "abc")
sql_error insert into st_double_e11 values (now, " ") sql_error insert into st_double_e11 values (now, " ")
sql_error insert into st_double_e12 values (now, '') sql insert into st_double_e12 values (now, '')
sql_error insert into st_double_e13 using mt_double tags (033) values (now, 11.7976931348623157e+308) sql_error insert into st_double_e13 using mt_double tags (033) values (now, 11.7976931348623157e+308)
sql_error insert into st_double_e14 using mt_double tags (033) values (now, -11.7976931348623157e+308) sql_error insert into st_double_e14 using mt_double tags (033) values (now, -11.7976931348623157e+308)
...@@ -482,7 +489,7 @@ sql_error insert into st_double_e20 using mt_double tags (033) values (now, "123 ...@@ -482,7 +489,7 @@ sql_error insert into st_double_e20 using mt_double tags (033) values (now, "123
sql_error insert into st_double_e22 using mt_double tags (033) values (now, abc) sql_error insert into st_double_e22 using mt_double tags (033) values (now, abc)
sql_error insert into st_double_e23 using mt_double tags (033) values (now, "abc") sql_error insert into st_double_e23 using mt_double tags (033) values (now, "abc")
sql_error insert into st_double_e24 using mt_double tags (033) values (now, " ") sql_error insert into st_double_e24 using mt_double tags (033) values (now, " ")
sql_error insert into st_double_e25 using mt_double tags (033) values (now, '') sql insert into st_double_e25_1 using mt_double tags (033) values (now, '')
sql_error insert into st_double_e13 using mt_double tags (31.7976931348623157e+308) values (now, -033) sql_error insert into st_double_e13 using mt_double tags (31.7976931348623157e+308) values (now, -033)
sql_error insert into st_double_e14 using mt_double tags (-31.7976931348623157e+308) values (now, -033) sql_error insert into st_double_e14 using mt_double tags (-31.7976931348623157e+308) values (now, -033)
...@@ -495,7 +502,7 @@ sql_error insert into st_double_e20 using mt_double tags ("123abc") values (now, ...@@ -495,7 +502,7 @@ sql_error insert into st_double_e20 using mt_double tags ("123abc") values (now,
sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033) sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033)
sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033) sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033)
sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033) sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033)
sql_error insert into st_double_e25 using mt_double tags ('') values (now, -033) sql insert into st_double_e25 using mt_double tags ('') values (now, -033)
sql insert into st_double_e13 using mt_double tags (033) values (now, 00062) sql insert into st_double_e13 using mt_double tags (033) values (now, 00062)
sql insert into st_double_e14 using mt_double tags (033) values (now, 00062) sql insert into st_double_e14 using mt_double tags (033) values (now, 00062)
...@@ -516,8 +523,8 @@ sql_error alter table st_double_e14 set tag tagname=-1.8976931348623157e+308 ...@@ -516,8 +523,8 @@ sql_error alter table st_double_e14 set tag tagname=-1.8976931348623157e+308
sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308 sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308
sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308 sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308
sql_error alter table st_double_e19 set tag tagname=123abc sql_error alter table st_double_e19 set tag tagname=123abc
sql_error alter table st_double_e20 set tag tagname="123abc" sql alter table st_double_e20 set tag tagname="123abc"
sql_error alter table st_double_e22 set tag tagname=abc sql_error alter table st_double_e22 set tag tagname=abc
sql_error alter table st_double_e23 set tag tagname="abc" sql alter table st_double_e23 set tag tagname="abc"
sql_error alter table st_double_e24 set tag tagname=" " sql alter table st_double_e24 set tag tagname=" "
sql_error alter table st_double_e25 set tag tagname='' sql alter table st_double_e25 set tag tagname=''
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database if not exists db
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db sql use db
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
...@@ -10,152 +17,152 @@ sql create table mt_float (ts timestamp, c float) tags (tagname float) ...@@ -10,152 +17,152 @@ sql create table mt_float (ts timestamp, c float) tags (tagname float)
## case 00: static create table for test tag values ## case 00: static create table for test tag values
sql create table st_float_0 using mt_float tags (NULL) sql create table st_float_0 using mt_float tags (NULL)
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_float_1 using mt_float tags (NULL) sql create table st_float_1 using mt_float tags (NULL)
sql select tagname from st_float_1 sql show tags from st_float_1
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_float_2 using mt_float tags ('NULL') sql create table st_float_2 using mt_float tags ('NULL')
sql select tagname from st_float_2 sql show tags from st_float_2
if $data00 != NULL then if $data05 != 0.00000 then
return -1 return -1
endi endi
sql create table st_float_3 using mt_float tags ('NULL') sql create table st_float_3 using mt_float tags ('NULL')
sql select tagname from st_float_3 sql show tags from st_float_3
if $data00 != NULL then if $data05 != 0.00000 then
return -1 return -1
endi endi
sql create table st_float_4 using mt_float tags ("NULL") sql create table st_float_4 using mt_float tags ("NULL")
sql select tagname from st_float_4 sql show tags from st_float_4
if $data00 != NULL then if $data05 != 0.00000 then
return -1 return -1
endi endi
sql create table st_float_5 using mt_float tags ("NULL") sql create table st_float_5 using mt_float tags ("NULL")
sql select tagname from st_float_5 sql show tags from st_float_5
if $data00 != NULL then if $data05 != 0.00000 then
return -1 return -1
endi endi
sql create table st_float_6 using mt_float tags (-123.321) sql create table st_float_6 using mt_float tags (-123.321)
sql select tagname from st_float_6 sql show tags from st_float_6
if $data00 != -123.32100 then if $data05 != -123.32100 then
print expect -123.32100, actual: $data00 print expect -123.32100, actual: $data05
return -1 return -1
endi endi
sql create table st_float_7 using mt_float tags (+1.567) sql create table st_float_7 using mt_float tags (+1.567)
sql select tagname from st_float_7 sql show tags from st_float_7
if $data00 != 1.56700 then if $data05 != 1.56700 then
print expect 1.56700, actual: $data00 print expect 1.56700, actual: $data05
return -1 return -1
endi endi
sql create table st_float_8 using mt_float tags (379.001) sql create table st_float_8 using mt_float tags (379.001)
sql select tagname from st_float_8 sql show tags from st_float_8
if $data00 != 379.00101 then if $data05 != 379.00101 then
print expect 379.00101, actual: $data00 print expect 379.00101, actual: $data05
return -1 return -1
endi endi
sql create table st_float_9 using mt_float tags (1.5e+3) sql create table st_float_9 using mt_float tags (1.5e+3)
sql select tagname from st_float_9 sql show tags from st_float_9
if $data00 != 1500.00000 then if $data05 != 1500.00000 then
print expect 1500.00000, actual: $data00 print expect 1500.00000, actual: $data05
return -1 return -1
endi endi
sql create table st_float_10 using mt_float tags (-1.5e-3) sql create table st_float_10 using mt_float tags (-1.5e-3)
sql select tagname from st_float_10 sql show tags from st_float_10
if $data00 != -0.00150 then if $data05 != -0.00150 then
print expect -0.00150, actual: $data00 print expect -0.00150, actual: $data05
return -1 return -1
endi endi
sql create table st_float_11 using mt_float tags (+1.5e+3) sql create table st_float_11 using mt_float tags (+1.5e+3)
sql select tagname from st_float_11 sql show tags from st_float_11
if $data00 != 1500.00000 then if $data05 != 1500.00000 then
print expect 1500.00000, actual: $data00 print expect 1500.00000, actual: $data05
return -1 return -1
endi endi
sql create table st_float_12 using mt_float tags (-1.5e+3) sql create table st_float_12 using mt_float tags (-1.5e+3)
sql select tagname from st_float_12 sql show tags from st_float_12
if $data00 != -1500.00000 then if $data05 != -1500.00000 then
print expect -1500.00000, actual: $data00 print expect -1500.00000, actual: $data05
return -1 return -1
endi endi
sql create table st_float_13 using mt_float tags (1.5e-3) sql create table st_float_13 using mt_float tags (1.5e-3)
sql select tagname from st_float_13 sql show tags from st_float_13
if $data00 != 0.00150 then if $data05 != 0.00150 then
print expect 0.00150, actual: $data00 print expect 0.00150, actual: $data05
return -1 return -1
endi endi
sql create table st_float_14 using mt_float tags (1.5E-3) sql create table st_float_14 using mt_float tags (1.5E-3)
sql select tagname from st_float_14 sql show tags from st_float_14
if $data00 != 0.00150 then if $data05 != 0.00150 then
print expect 0.00150, actual: $data00 print expect 0.00150, actual: $data05
return -1 return -1
endi endi
sql create table st_float_6_0 using mt_float tags ('-123.321') sql create table st_float_6_0 using mt_float tags ('-123.321')
sql select tagname from st_float_6_0 sql show tags from st_float_6_0
if $data00 != -123.32100 then if $data05 != -123.32100 then
print expect -123.32100, actual: $data00 print expect -123.32100, actual: $data05
return -1 return -1
endi endi
sql create table st_float_7_0 using mt_float tags ('+1.567') sql create table st_float_7_0 using mt_float tags ('+1.567')
sql select tagname from st_float_7_0 sql show tags from st_float_7_0
if $data00 != 1.56700 then if $data05 != 1.56700 then
print expect 1.56700, actual: $data00 print expect 1.56700, actual: $data05
return -1 return -1
endi endi
sql create table st_float_8_0 using mt_float tags ('379.001') sql create table st_float_8_0 using mt_float tags ('379.001')
sql select tagname from st_float_8_0 sql show tags from st_float_8_0
if $data00 != 379.00101 then if $data05 != 379.00101 then
print expect 379.00101, actual: $data00 print expect 379.00101, actual: $data05
return -1 return -1
endi endi
sql create table st_float_9_0 using mt_float tags ('1.5e+3') sql create table st_float_9_0 using mt_float tags ('1.5e+3')
sql select tagname from st_float_9_0 sql show tags from st_float_9_0
if $data00 != 1500.00000 then if $data05 != 1500.00000 then
print expect 1500.00000, actual: $data00 print expect 1500.00000, actual: $data05
return -1 return -1
endi endi
sql create table st_float_10_0 using mt_float tags ('-1.5e-3') sql create table st_float_10_0 using mt_float tags ('-1.5e-3')
sql select tagname from st_float_10_0 sql show tags from st_float_10_0
if $data00 != -0.00150 then if $data05 != -0.00150 then
print expect -0.00150, actual: $data00 print expect -0.00150, actual: $data05
return -1 return -1
endi endi
sql create table st_float_11_0 using mt_float tags ('+1.5e+3') sql create table st_float_11_0 using mt_float tags ('+1.5e+3')
sql select tagname from st_float_11_0 sql show tags from st_float_11_0
if $data00 != 1500.00000 then if $data05 != 1500.00000 then
print expect 1500.00000, actual: $data00 print expect 1500.00000, actual: $data05
return -1 return -1
endi endi
sql create table st_float_12_0 using mt_float tags ('-1.5e+3') sql create table st_float_12_0 using mt_float tags ('-1.5e+3')
sql select tagname from st_float_12_0 sql show tags from st_float_12_0
if $data00 != -1500.00000 then if $data05 != -1500.00000 then
print expect -1500.00000, actual: $data00 print expect -1500.00000, actual: $data05
return -1 return -1
endi endi
sql create table st_float_13_0 using mt_float tags ('1.5e-3') sql create table st_float_13_0 using mt_float tags ('1.5e-3')
sql select tagname from st_float_13_0 sql show tags from st_float_13_0
if $data00 != 0.00150 then if $data05 != 0.00150 then
print expect 0.00150, actual: $data00 print expect 0.00150, actual: $data05
return -1 return -1
endi endi
sql create table st_float_14_0 using mt_float tags ('1.5E-3') sql create table st_float_14_0 using mt_float tags ('1.5E-3')
sql select tagname from st_float_14_0 sql show tags from st_float_14_0
if $data00 != 0.00150 then if $data05 != 0.00150 then
print expect 0.00150, actual: $data00 print expect 0.00150, actual: $data05
return -1 return -1
endi endi
#sql create table st_float_15_0 using mt_float tags (3.40282347e+38) #sql create table st_float_15_0 using mt_float tags (3.40282347e+38)
#sql select tagname from st_float_15_0 #sql show tags from st_float_15_0
#if $data00 != 0.001500 then #if $data05 != 0.001500 then
# return -1 # return -1
#endi #endi
#sql create table st_float_16_0 using mt_float tags (-3.40282347e+38) #sql create table st_float_16_0 using mt_float tags (-3.40282347e+38)
#sql select tagname from st_float_16_0 #sql show tags from st_float_16_0
#if $data00 != 0.001500 then #if $data05 != 0.001500 then
# return -1 # return -1
#endi #endi
...@@ -292,8 +299,8 @@ endi ...@@ -292,8 +299,8 @@ endi
## case 02: dynamic create table for test tag values ## case 02: dynamic create table for test tag values
sql insert into st_float_16 using mt_float tags (NULL) values (now, NULL) sql insert into st_float_16 using mt_float tags (NULL) values (now, NULL)
sql select tagname from st_float_16 sql show tags from st_float_16
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_float_16 sql select * from st_float_16
...@@ -302,8 +309,8 @@ if $data01 != NULL then ...@@ -302,8 +309,8 @@ if $data01 != NULL then
endi endi
sql insert into st_float_17 using mt_float tags (NULL) values (now, NULL) sql insert into st_float_17 using mt_float tags (NULL) values (now, NULL)
sql select tagname from st_float_17 sql show tags from st_float_17
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_float_17 sql select * from st_float_17
...@@ -311,8 +318,8 @@ if $data01 != NULL then ...@@ -311,8 +318,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_float_18 using mt_float tags ('NULL') values (now, 'NULL') sql insert into st_float_18 using mt_float tags ('NULL') values (now, 'NULL')
sql select tagname from st_float_18 sql show tags from st_float_18
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_float_18 sql select * from st_float_18
...@@ -320,8 +327,8 @@ if $data01 != NULL then ...@@ -320,8 +327,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_float_19 using mt_float tags ('NULL') values (now, 'NULL') sql insert into st_float_19 using mt_float tags ('NULL') values (now, 'NULL')
sql select tagname from st_float_19 sql show tags from st_float_19
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_float_19 sql select * from st_float_19
...@@ -329,8 +336,8 @@ if $data01 != NULL then ...@@ -329,8 +336,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_float_20 using mt_float tags ("NULL") values (now, "NULL") sql insert into st_float_20 using mt_float tags ("NULL") values (now, "NULL")
sql select tagname from st_float_20 sql show tags from st_float_20
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_float_20 sql select * from st_float_20
...@@ -338,8 +345,8 @@ if $data01 != NULL then ...@@ -338,8 +345,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_float_21 using mt_float tags ("NULL") values (now, "NULL") sql insert into st_float_21 using mt_float tags ("NULL") values (now, "NULL")
sql select tagname from st_float_21 sql show tags from st_float_21
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_float_21 sql select * from st_float_21
...@@ -350,9 +357,9 @@ endi ...@@ -350,9 +357,9 @@ endi
sql_error insert into st_float_22 using mt_float tags (127) values (now, 3.40282347e+38) sql_error insert into st_float_22 using mt_float tags (127) values (now, 3.40282347e+38)
sql insert into st_float_22 using mt_float tags (127) values (now, 340282346638528859811704183484516925440.00000) sql insert into st_float_22 using mt_float tags (127) values (now, 340282346638528859811704183484516925440.00000)
sql select tagname from st_float_22 sql show tags from st_float_22
if $data00 != 127.00000 then if $data05 != 127.00000 then
print expect 127.00000, actual: $data00 print expect 127.00000, actual: $data05
return -1 return -1
endi endi
...@@ -362,14 +369,14 @@ if $data01 != 127.00000 then ...@@ -362,14 +369,14 @@ if $data01 != 127.00000 then
endi endi
sql insert into st_float_23 using mt_float tags (-127) values (now, -340282346638528859811704183484516925440.00000) sql insert into st_float_23 using mt_float tags (-127) values (now, -340282346638528859811704183484516925440.00000)
sql select tagname from st_float_23 sql show tags from st_float_23
if $data00 != -127.00000 then if $data05 != -127.00000 then
return -1 return -1
endi endi
sql insert into st_float_24 using mt_float tags (10) values (now, 10) sql insert into st_float_24 using mt_float tags (10) values (now, 10)
sql select tagname from st_float_24 sql show tags from st_float_24
if $data00 != 10.00000 then if $data05 != 10.00000 then
return -1 return -1
endi endi
sql select * from st_float_24 sql select * from st_float_24
...@@ -378,9 +385,9 @@ if $data01 != 10.00000 then ...@@ -378,9 +385,9 @@ if $data01 != 10.00000 then
endi endi
sql insert into st_float_25 using mt_float tags ("-0") values (now, "-0") sql insert into st_float_25 using mt_float tags ("-0") values (now, "-0")
sql select tagname from st_float_25 sql show tags from st_float_25
if $data00 != -0.00000 then if $data05 != -0.00000 then
print expect -0.00000, actual: $data00 print expect -0.00000, actual: $data05
return -1 return -1
endi endi
sql select * from st_float_25 sql select * from st_float_25
...@@ -388,9 +395,9 @@ if $data01 != -0.00000 then ...@@ -388,9 +395,9 @@ if $data01 != -0.00000 then
return -1 return -1
endi endi
sql insert into st_float_26 using mt_float tags ('123') values (now, '12.3') sql insert into st_float_26 using mt_float tags ('123') values (now, '12.3')
sql select tagname from st_float_26 sql show tags from st_float_26
if $data00 != 123.00000 then if $data05 != 123.00000 then
print expect 123.00000, actual: $data00 print expect 123.00000, actual: $data05
return -1 return -1
endi endi
sql select * from st_float_26 sql select * from st_float_26
...@@ -398,9 +405,9 @@ if $data01 != 12.30000 then ...@@ -398,9 +405,9 @@ if $data01 != 12.30000 then
return -1 return -1
endi endi
sql insert into st_float_27 using mt_float tags (+056) values (now, +0005.6) sql insert into st_float_27 using mt_float tags (+056) values (now, +0005.6)
sql select tagname from st_float_27 sql show tags from st_float_27
if $data00 != 56.00000 then if $data05 != 56.00000 then
print expect 56.00000, actual:$data00 print expect 56.00000, actual:$data05
return -1 return -1
endi endi
sql select * from st_float_27 sql select * from st_float_27
...@@ -408,8 +415,8 @@ if $data01 != 5.60000 then ...@@ -408,8 +415,8 @@ if $data01 != 5.60000 then
return -1 return -1
endi endi
sql insert into st_float_28 using mt_float tags (-056) values (now, -005.6) sql insert into st_float_28 using mt_float tags (-056) values (now, -005.6)
sql select tagname from st_float_28 sql show tags from st_float_28
if $data00 != -56.00000 then if $data05 != -56.00000 then
return -1 return -1
endi endi
sql select * from st_float_28 sql select * from st_float_28
...@@ -419,44 +426,44 @@ endi ...@@ -419,44 +426,44 @@ endi
### case 03: alter tag values ### case 03: alter tag values
sql alter table st_float_0 set tag tagname=340282346638528859811704183484516925440.00000 sql alter table st_float_0 set tag tagname=340282346638528859811704183484516925440.00000
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != 340282346638528859811704183484516925440.00000 then if $data05 != 340282346638528859811704183484516925440.00000 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname=-340282346638528859811704183484516925440.00000 sql alter table st_float_0 set tag tagname=-340282346638528859811704183484516925440.00000
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != -340282346638528859811704183484516925440.00000 then if $data05 != -340282346638528859811704183484516925440.00000 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname=+10.340 sql alter table st_float_0 set tag tagname=+10.340
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != 10.34000 then if $data05 != 10.34000 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname=-33.87 sql alter table st_float_0 set tag tagname=-33.87
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != -33.87000 then if $data05 != -33.87000 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname='+9.8' sql alter table st_float_0 set tag tagname='+9.8'
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != 9.80000 then if $data05 != 9.80000 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname='-07.6' sql alter table st_float_0 set tag tagname='-07.6'
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != -7.60000 then if $data05 != -7.60000 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname=+0012.871 sql alter table st_float_0 set tag tagname=+0012.871
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != 12.87100 then if $data05 != 12.87100 then
return -1 return -1
endi endi
sql alter table st_float_0 set tag tagname=-00063.582 sql alter table st_float_0 set tag tagname=-00063.582
sql select tagname from st_float_0 sql show tags from st_float_0
if $data00 != -63.58200 then if $data05 != -63.58200 then
return -1 return -1
endi endi
...@@ -468,11 +475,11 @@ sql_error create table st_float_e0 using mt_float tags (-333.40282347e+38) ...@@ -468,11 +475,11 @@ sql_error create table st_float_e0 using mt_float tags (-333.40282347e+38)
#sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part #sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part
#sql_error create table st_float_e0 using mt_float tags (-11.80) #sql_error create table st_float_e0 using mt_float tags (-11.80)
sql_error create table st_float_e0 using mt_float tags (123abc) sql_error create table st_float_e0 using mt_float tags (123abc)
sql_error create table st_float_e0 using mt_float tags ("123abc") sql create table st_float_e0_1 using mt_float tags ("123abc")
sql_error create table st_float_e0 using mt_float tags (abc) sql_error create table st_float_e0 using mt_float tags (abc)
sql_error create table st_float_e0 using mt_float tags ("abc") sql create table st_float_e0_2 using mt_float tags ("abc")
sql_error create table st_float_e0 using mt_float tags (" ") sql create table st_float_e0_3 using mt_float tags (" ")
sql_error create table st_float_e0 using mt_float tags ('') sql create table st_float_e0_4 using mt_float tags ('')
sql create table st_float_e0 using mt_float tags (123) sql create table st_float_e0 using mt_float tags (123)
sql create table st_float_e1 using mt_float tags (123) sql create table st_float_e1 using mt_float tags (123)
...@@ -499,7 +506,7 @@ sql_error insert into st_float_e7 values (now, "123abc") ...@@ -499,7 +506,7 @@ sql_error insert into st_float_e7 values (now, "123abc")
sql_error insert into st_float_e9 values (now, abc) sql_error insert into st_float_e9 values (now, abc)
sql_error insert into st_float_e10 values (now, "abc") sql_error insert into st_float_e10 values (now, "abc")
sql_error insert into st_float_e11 values (now, " ") sql_error insert into st_float_e11 values (now, " ")
sql_error insert into st_float_e12 values (now, '') sql insert into st_float_e12 values (now, '')
sql_error insert into st_float_e13 using mt_float tags (033) values (now, 3.50282347e+38) sql_error insert into st_float_e13 using mt_float tags (033) values (now, 3.50282347e+38)
sql_error insert into st_float_e14 using mt_float tags (033) values (now, -3.50282347e+38) sql_error insert into st_float_e14 using mt_float tags (033) values (now, -3.50282347e+38)
...@@ -512,7 +519,7 @@ sql_error insert into st_float_e20 using mt_float tags (033) values (now, "123ab ...@@ -512,7 +519,7 @@ sql_error insert into st_float_e20 using mt_float tags (033) values (now, "123ab
sql_error insert into st_float_e22 using mt_float tags (033) values (now, abc) sql_error insert into st_float_e22 using mt_float tags (033) values (now, abc)
sql_error insert into st_float_e23 using mt_float tags (033) values (now, "abc") sql_error insert into st_float_e23 using mt_float tags (033) values (now, "abc")
sql_error insert into st_float_e24 using mt_float tags (033) values (now, " ") sql_error insert into st_float_e24 using mt_float tags (033) values (now, " ")
sql_error insert into st_float_e25 using mt_float tags (033) values (now, '') sql insert into st_float_e25_1 using mt_float tags (033) values (now, '')
sql_error insert into st_float_e13 using mt_float tags (3.50282347e+38) values (now, -033) sql_error insert into st_float_e13 using mt_float tags (3.50282347e+38) values (now, -033)
sql_error insert into st_float_e14 using mt_float tags (-3.50282347e+38) values (now, -033) sql_error insert into st_float_e14 using mt_float tags (-3.50282347e+38) values (now, -033)
...@@ -525,7 +532,7 @@ sql_error insert into st_float_e20 using mt_float tags ("123abc") values (now, - ...@@ -525,7 +532,7 @@ sql_error insert into st_float_e20 using mt_float tags ("123abc") values (now, -
sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033) sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033)
sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033) sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033)
sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033) sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033)
sql_error insert into st_float_e25 using mt_float tags ('') values (now, -033) sql insert into st_float_e25_3 using mt_float tags ('') values (now, -033)
sql insert into st_float_e13 using mt_float tags (033) values (now, 00062) sql insert into st_float_e13 using mt_float tags (033) values (now, 00062)
sql insert into st_float_e14 using mt_float tags (033) values (now, 00062) sql insert into st_float_e14 using mt_float tags (033) values (now, 00062)
...@@ -546,8 +553,8 @@ sql_error alter table st_float_e14 set tag tagname=-3.50282347e+38 ...@@ -546,8 +553,8 @@ sql_error alter table st_float_e14 set tag tagname=-3.50282347e+38
sql_error alter table st_float_e15 set tag tagname=13.40282347e+38 sql_error alter table st_float_e15 set tag tagname=13.40282347e+38
sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38 sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38
sql_error alter table st_float_e19 set tag tagname=123abc sql_error alter table st_float_e19 set tag tagname=123abc
sql_error alter table st_float_e20 set tag tagname="123abc" sql alter table st_float_e20 set tag tagname="123abc"
sql_error alter table st_float_e22 set tag tagname=abc sql_error alter table st_float_e22 set tag tagname=abc
sql_error alter table st_float_e23 set tag tagname="abc" sql alter table st_float_e23 set tag tagname="abc"
sql_error alter table st_float_e24 set tag tagname=" " sql alter table st_float_e24 set tag tagname=" "
sql_error alter table st_float_e25 set tag tagname='' sql alter table st_float_e25 set tag tagname=''
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database if not exists db
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db sql use db
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
...@@ -10,78 +17,64 @@ sql create table mt_int (ts timestamp, c int) tags (tagname int) ...@@ -10,78 +17,64 @@ sql create table mt_int (ts timestamp, c int) tags (tagname int)
## case 00: static create table for test tag values ## case 00: static create table for test tag values
sql create table st_int_0 using mt_int tags (NULL) sql create table st_int_0 using mt_int tags (NULL)
sql select tagname from st_int_0 sql show tags from st_int_0
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_int_1 using mt_int tags (NULL) sql create table st_int_1 using mt_int tags (NULL)
sql select tagname from st_int_1 sql show tags from st_int_1
if $data00 != NULL then if $data05 != NULL then
return -1
endi
sql create table st_int_2 using mt_int tags ('NULL')
sql select tagname from st_int_2
if $data00 != NULL then
return -1
endi
sql create table st_int_3 using mt_int tags ('NULL')
sql select tagname from st_int_3
if $data00 != NULL then
return -1
endi
sql create table st_int_4 using mt_int tags ("NULL")
sql select tagname from st_int_4
if $data00 != NULL then
return -1
endi
sql create table st_int_5 using mt_int tags ("NULL")
sql select tagname from st_int_5
if $data00 != NULL then
return -1 return -1
endi endi
sql_error create table st_int_2 using mt_int tags ('NULL')
sql_error create table st_int_3 using mt_int tags ('NULL')
sql_error create table st_int_4 using mt_int tags ("NULL")
sql_error create table st_int_5 using mt_int tags ("NULL")
sql create table st_int_6 using mt_int tags (-2147483647) sql create table st_int_6 using mt_int tags (-2147483647)
sql select tagname from st_int_6 sql show tags from st_int_6
if $data00 != -2147483647 then if $data05 != -2147483647 then
return -1 return -1
endi endi
sql create table st_int_7 using mt_int tags (2147483647) sql create table st_int_7 using mt_int tags (2147483647)
sql select tagname from st_int_7 sql show tags from st_int_7
if $data00 != 2147483647 then if $data05 != 2147483647 then
return -1 return -1
endi endi
sql create table st_int_8 using mt_int tags (37) sql create table st_int_8 using mt_int tags (37)
sql select tagname from st_int_8 sql show tags from st_int_8
if $data00 != 37 then if $data05 != 37 then
return -1 return -1
endi endi
sql create table st_int_9 using mt_int tags (-100) sql create table st_int_9 using mt_int tags (-100)
sql select tagname from st_int_9 sql show tags from st_int_9
if $data00 != -100 then if $data05 != -100 then
return -1 return -1
endi endi
sql create table st_int_10 using mt_int tags (+113) sql create table st_int_10 using mt_int tags (+113)
sql select tagname from st_int_10 sql show tags from st_int_10
if $data00 != 113 then if $data05 != 113 then
return -1 return -1
endi endi
sql create table st_int_11 using mt_int tags ('-100') sql create table st_int_11 using mt_int tags ('-100')
sql select tagname from st_int_11 sql show tags from st_int_11
if $data00 != -100 then if $data05 != -100 then
return -1 return -1
endi endi
sql create table st_int_12 using mt_int tags ("+78") sql create table st_int_12 using mt_int tags ("+78")
sql select tagname from st_int_12 sql show tags from st_int_12
if $data00 != 78 then if $data05 != 78 then
return -1 return -1
endi endi
sql create table st_int_13 using mt_int tags (+0078) sql create table st_int_13 using mt_int tags (+0078)
sql select tagname from st_int_13 sql show tags from st_int_13
if $data00 != 78 then if $data05 != 78 then
return -1 return -1
endi endi
sql create table st_int_14 using mt_int tags (-00078) sql create table st_int_14 using mt_int tags (-00078)
sql select tagname from st_int_14 sql show tags from st_int_14
if $data00 != -78 then if $data05 != -78 then
return -1 return -1
endi endi
...@@ -102,38 +95,6 @@ endi ...@@ -102,38 +95,6 @@ endi
if $data01 != NULL then if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_int_2 values (now, 'NULL')
sql select * from st_int_2
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_int_3 values (now, 'NULL')
sql select * from st_int_3
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_int_4 values (now, "NULL")
sql select * from st_int_4
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_int_5 values (now, "NULL")
sql select * from st_int_5
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_int_6 values (now, 2147483647) sql insert into st_int_6 values (now, 2147483647)
sql select * from st_int_6 sql select * from st_int_6
if $rows != 1 then if $rows != 1 then
...@@ -211,8 +172,8 @@ endi ...@@ -211,8 +172,8 @@ endi
## case 02: dynamic create table for test tag values ## case 02: dynamic create table for test tag values
sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL) sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL)
sql select tagname from st_int_16 sql show tags from st_int_16
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_int_16 sql select * from st_int_16
...@@ -221,8 +182,8 @@ if $data01 != NULL then ...@@ -221,8 +182,8 @@ if $data01 != NULL then
endi endi
sql insert into st_int_17 using mt_int tags (NULL) values (now, NULL) sql insert into st_int_17 using mt_int tags (NULL) values (now, NULL)
sql select tagname from st_int_17 sql show tags from st_int_17
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_int_17 sql select * from st_int_17
...@@ -230,8 +191,8 @@ if $data01 != NULL then ...@@ -230,8 +191,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL') sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL')
sql select tagname from st_int_18 sql show tags from st_int_18
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_int_18 sql select * from st_int_18
...@@ -239,8 +200,8 @@ if $data01 != NULL then ...@@ -239,8 +200,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_int_19 using mt_int tags ('NULL') values (now, 'NULL') sql insert into st_int_19 using mt_int tags ('NULL') values (now, 'NULL')
sql select tagname from st_int_19 sql show tags from st_int_19
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_int_19 sql select * from st_int_19
...@@ -248,8 +209,8 @@ if $data01 != NULL then ...@@ -248,8 +209,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_int_20 using mt_int tags ("NULL") values (now, "NULL") sql insert into st_int_20 using mt_int tags ("NULL") values (now, "NULL")
sql select tagname from st_int_20 sql show tags from st_int_20
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_int_20 sql select * from st_int_20
...@@ -257,8 +218,8 @@ if $data01 != NULL then ...@@ -257,8 +218,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_int_21 using mt_int tags ("NULL") values (now, "NULL") sql insert into st_int_21 using mt_int tags ("NULL") values (now, "NULL")
sql select tagname from st_int_21 sql show tags from st_int_21
if $data00 != NULL then if $data05 != NULL then
return -1 return -1
endi endi
sql select * from st_int_21 sql select * from st_int_21
...@@ -266,8 +227,8 @@ if $data01 != NULL then ...@@ -266,8 +227,8 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_int_22 using mt_int tags (2147483647) values (now, 2147483647) sql insert into st_int_22 using mt_int tags (2147483647) values (now, 2147483647)
sql select tagname from st_int_22 sql show tags from st_int_22
if $data00 != 2147483647 then if $data05 != 2147483647 then
return -1 return -1
endi endi
sql select * from st_int_22 sql select * from st_int_22
...@@ -275,8 +236,8 @@ if $data01 != 2147483647 then ...@@ -275,8 +236,8 @@ if $data01 != 2147483647 then
return -1 return -1
endi endi
sql insert into st_int_23 using mt_int tags (-2147483647) values (now, -2147483647) sql insert into st_int_23 using mt_int tags (-2147483647) values (now, -2147483647)
sql select tagname from st_int_23 sql show tags from st_int_23
if $data00 != -2147483647 then if $data05 != -2147483647 then
return -1 return -1
endi endi
sql select * from st_int_23 sql select * from st_int_23
...@@ -284,8 +245,8 @@ if $data01 != -2147483647 then ...@@ -284,8 +245,8 @@ if $data01 != -2147483647 then
return -1 return -1
endi endi
sql insert into st_int_24 using mt_int tags (10) values (now, 10) sql insert into st_int_24 using mt_int tags (10) values (now, 10)
sql select tagname from st_int_24 sql show tags from st_int_24
if $data00 != 10 then if $data05 != 10 then
return -1 return -1
endi endi
sql select * from st_int_24 sql select * from st_int_24
...@@ -293,8 +254,8 @@ if $data01 != 10 then ...@@ -293,8 +254,8 @@ if $data01 != 10 then
return -1 return -1
endi endi
sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0") sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0")
sql select tagname from st_int_25 sql show tags from st_int_25
if $data00 != 0 then if $data05 != 0 then
return -1 return -1
endi endi
sql select * from st_int_25 sql select * from st_int_25
...@@ -302,8 +263,8 @@ if $data01 != 0 then ...@@ -302,8 +263,8 @@ if $data01 != 0 then
return -1 return -1
endi endi
sql insert into st_int_26 using mt_int tags ('123') values (now, '123') sql insert into st_int_26 using mt_int tags ('123') values (now, '123')
sql select tagname from st_int_26 sql show tags from st_int_26
if $data00 != 123 then if $data05 != 123 then
return -1 return -1
endi endi
sql select * from st_int_26 sql select * from st_int_26
...@@ -311,8 +272,8 @@ if $data01 != 123 then ...@@ -311,8 +272,8 @@ if $data01 != 123 then
return -1 return -1
endi endi
sql insert into st_int_27 using mt_int tags (+056) values (now, +00056) sql insert into st_int_27 using mt_int tags (+056) values (now, +00056)
sql select tagname from st_int_27 sql show tags from st_int_27
if $data00 != 56 then if $data05 != 56 then
return -1 return -1
endi endi
sql select * from st_int_27 sql select * from st_int_27
...@@ -320,8 +281,8 @@ if $data01 != 56 then ...@@ -320,8 +281,8 @@ if $data01 != 56 then
return -1 return -1
endi endi
sql insert into st_int_28 using mt_int tags (-056) values (now, -0056) sql insert into st_int_28 using mt_int tags (-056) values (now, -0056)
sql select tagname from st_int_28 sql show tags from st_int_28
if $data00 != -56 then if $data05 != -56 then
return -1 return -1
endi endi
sql select * from st_int_28 sql select * from st_int_28
...@@ -331,49 +292,49 @@ endi ...@@ -331,49 +292,49 @@ endi
### case 03: alter tag values ### case 03: alter tag values
#sql alter table st_int_0 set tag tagname=2147483647 #sql alter table st_int_0 set tag tagname=2147483647
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != 2147483647 then #if $data05 != 2147483647 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname=-2147483647 #sql alter table st_int_0 set tag tagname=-2147483647
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != -2147483647 then #if $data05 != -2147483647 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname=+100 #sql alter table st_int_0 set tag tagname=+100
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != 100 then #if $data05 != 100 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname=-33 #sql alter table st_int_0 set tag tagname=-33
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != -33 then #if $data05 != -33 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname='+98' #sql alter table st_int_0 set tag tagname='+98'
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != 98 then #if $data05 != 98 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname='-076' #sql alter table st_int_0 set tag tagname='-076'
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != -76 then #if $data05 != -76 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname=+0012 #sql alter table st_int_0 set tag tagname=+0012
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != 12 then #if $data05 != 12 then
# return -1 # return -1
#endi #endi
#sql alter table st_int_0 set tag tagname=-00063 #sql alter table st_int_0 set tag tagname=-00063
#sql select tagname from st_int_0 #sql show tags from st_int_0
#if $data00 != -63 then #if $data05 != -63 then
# return -1 # return -1
#endi #endi
## case 04: illegal input ## case 04: illegal input
sql_error create table st_int_e0 using mt_int tags (2147483648) sql_error create table st_int_e0 using mt_int tags (2147483648)
sql_error create table st_int_e0 using mt_int tags (-2147483648) sql create table st_int_e0_err1 using mt_int tags (-2147483648)
sql_error create table st_int_e0 using mt_int tags (214748364800) sql_error create table st_int_e0 using mt_int tags (214748364800)
sql_error create table st_int_e0 using mt_int tags (-214748364800) sql_error create table st_int_e0 using mt_int tags (-214748364800)
#sql_error create table st_int_e0 using mt_int tags (12.80) truncate integer part #sql_error create table st_int_e0 using mt_int tags (12.80) truncate integer part
...@@ -383,7 +344,7 @@ sql_error create table st_int_e0 using mt_int tags ("123abc") ...@@ -383,7 +344,7 @@ sql_error create table st_int_e0 using mt_int tags ("123abc")
sql_error create table st_int_e0 using mt_int tags (abc) sql_error create table st_int_e0 using mt_int tags (abc)
sql_error create table st_int_e0 using mt_int tags ("abc") sql_error create table st_int_e0 using mt_int tags ("abc")
sql_error create table st_int_e0 using mt_int tags (" ") sql_error create table st_int_e0 using mt_int tags (" ")
sql_error create table st_int_e0 using mt_int tags ('') sql create table st_int_e0_err2 using mt_int tags ('')
sql create table st_int_e0 using mt_int tags (123) sql create table st_int_e0 using mt_int tags (123)
sql create table st_int_e1 using mt_int tags (123) sql create table st_int_e1 using mt_int tags (123)
...@@ -400,7 +361,7 @@ sql create table st_int_e11 using mt_int tags (123) ...@@ -400,7 +361,7 @@ sql create table st_int_e11 using mt_int tags (123)
sql create table st_int_e12 using mt_int tags (123) sql create table st_int_e12 using mt_int tags (123)
sql_error insert into st_int_e0 values (now, 2147483648) sql_error insert into st_int_e0 values (now, 2147483648)
sql_error insert into st_int_e1 values (now, -2147483648) sql insert into st_int_e1 values (now, -2147483648)
sql_error insert into st_int_e2 values (now, 3147483648) sql_error insert into st_int_e2 values (now, 3147483648)
sql_error insert into st_int_e3 values (now, -21474836481) sql_error insert into st_int_e3 values (now, -21474836481)
#sql_error insert into st_int_e4 values (now, 12.80) #sql_error insert into st_int_e4 values (now, 12.80)
...@@ -410,10 +371,10 @@ sql_error insert into st_int_e7 values (now, "123abc") ...@@ -410,10 +371,10 @@ sql_error insert into st_int_e7 values (now, "123abc")
sql_error insert into st_int_e9 values (now, abc) sql_error insert into st_int_e9 values (now, abc)
sql_error insert into st_int_e10 values (now, "abc") sql_error insert into st_int_e10 values (now, "abc")
sql_error insert into st_int_e11 values (now, " ") sql_error insert into st_int_e11 values (now, " ")
sql_error insert into st_int_e12 values (now, '') sql insert into st_int_e12 values (now, '')
sql_error insert into st_int_e13 using mt_int tags (033) values (now, 2147483648) sql_error insert into st_int_e13 using mt_int tags (033) values (now, 2147483648)
sql_error insert into st_int_e14 using mt_int tags (033) values (now, -2147483648) sql insert into st_int_e14 using mt_int tags (033) values (now, -2147483648)
sql_error insert into st_int_e15 using mt_int tags (033) values (now, 5147483648) sql_error insert into st_int_e15 using mt_int tags (033) values (now, 5147483648)
sql_error insert into st_int_e16 using mt_int tags (033) values (now, -21474836481) sql_error insert into st_int_e16 using mt_int tags (033) values (now, -21474836481)
#sql_error insert into st_int_e17 using mt_int tags (033) values (now, 12.80) #sql_error insert into st_int_e17 using mt_int tags (033) values (now, 12.80)
...@@ -423,10 +384,10 @@ sql_error insert into st_int_e20 using mt_int tags (033) values (now, "123abc") ...@@ -423,10 +384,10 @@ sql_error insert into st_int_e20 using mt_int tags (033) values (now, "123abc")
sql_error insert into st_int_e22 using mt_int tags (033) values (now, abc) sql_error insert into st_int_e22 using mt_int tags (033) values (now, abc)
sql_error insert into st_int_e23 using mt_int tags (033) values (now, "abc") sql_error insert into st_int_e23 using mt_int tags (033) values (now, "abc")
sql_error insert into st_int_e24 using mt_int tags (033) values (now, " ") sql_error insert into st_int_e24 using mt_int tags (033) values (now, " ")
sql_error insert into st_int_e25 using mt_int tags (033) values (now, '') sql insert into st_int_e25 using mt_int tags (033) values (now, '')
sql_error insert into st_int_e13 using mt_int tags (2147483648) values (now, -033) sql_error insert into st_int_e13 using mt_int tags (2147483648) values (now, -033)
sql_error insert into st_int_e14 using mt_int tags (-2147483648) values (now, -033) sql insert into st_int_e14_1 using mt_int tags (-2147483648) values (now, -033)
sql_error insert into st_int_e15 using mt_int tags (21474836480) values (now, -033) sql_error insert into st_int_e15 using mt_int tags (21474836480) values (now, -033)
sql_error insert into st_int_e16 using mt_int tags (-2147483649) values (now, -033) sql_error insert into st_int_e16 using mt_int tags (-2147483649) values (now, -033)
#sql_error insert into st_int_e17 using mt_int tags (12.80) values (now, -033) #sql_error insert into st_int_e17 using mt_int tags (12.80) values (now, -033)
...@@ -436,7 +397,7 @@ sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033) ...@@ -436,7 +397,7 @@ sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033)
sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033) sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033)
sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033) sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033)
sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033) sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033)
sql_error insert into st_int_e25 using mt_int tags ('') values (now, -033) sql insert into st_int_e25_1 using mt_int tags ('') values (now, -033)
sql insert into st_int_e13 using mt_int tags (033) values (now, 00062) sql insert into st_int_e13 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e14 using mt_int tags (033) values (now, 00062) sql insert into st_int_e14 using mt_int tags (033) values (now, 00062)
...@@ -453,7 +414,7 @@ sql insert into st_int_e24 using mt_int tags (033) values (now, 00062) ...@@ -453,7 +414,7 @@ sql insert into st_int_e24 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e25 using mt_int tags (033) values (now, 00062) sql insert into st_int_e25 using mt_int tags (033) values (now, 00062)
sql_error alter table st_int_e13 set tag tagname=2147483648 sql_error alter table st_int_e13 set tag tagname=2147483648
sql_error alter table st_int_e14 set tag tagname=-2147483648 sql alter table st_int_e14 set tag tagname=-2147483648
sql_error alter table st_int_e15 set tag tagname=12147483648 sql_error alter table st_int_e15 set tag tagname=12147483648
sql_error alter table st_int_e16 set tag tagname=-3147483648 sql_error alter table st_int_e16 set tag tagname=-3147483648
sql_error alter table st_int_e19 set tag tagname=123abc sql_error alter table st_int_e19 set tag tagname=123abc
...@@ -461,4 +422,4 @@ sql_error alter table st_int_e20 set tag tagname="123abc" ...@@ -461,4 +422,4 @@ sql_error alter table st_int_e20 set tag tagname="123abc"
sql_error alter table st_int_e22 set tag tagname=abc sql_error alter table st_int_e22 set tag tagname=abc
sql_error alter table st_int_e23 set tag tagname="abc" sql_error alter table st_int_e23 set tag tagname="abc"
sql_error alter table st_int_e24 set tag tagname=" " sql_error alter table st_int_e24 set tag tagname=" "
sql_error alter table st_int_e25 set tag tagname='' sql alter table st_int_e25 set tag tagname=''
sql create database if not exists db system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print ========== columnValues.sim
sql drop database if exists db
sql create database db
sql use db sql use db
sql drop table if exists mt_unsigned; sql drop table if exists mt_unsigned;
...@@ -10,28 +18,21 @@ sql alter table mt_unsigned_1 set tag t1=138; ...@@ -10,28 +18,21 @@ sql alter table mt_unsigned_1 set tag t1=138;
sql alter table mt_unsigned_1 set tag t2=32769; sql alter table mt_unsigned_1 set tag t2=32769;
sql alter table mt_unsigned_1 set tag t3=294967295; sql alter table mt_unsigned_1 set tag t3=294967295;
sql alter table mt_unsigned_1 set tag t4=446744073709551615; sql alter table mt_unsigned_1 set tag t4=446744073709551615;
sql insert into mt_unsigned_1 values (now, 0, 0, 0, 0, 0, 0, 0, 0, 0)
sql select t1,t2,t3,t4 from mt_unsigned_1 sql select t1,t2,t3,t4 from mt_unsigned_1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
print $data01, $data02, $data03
print $data00, $data01, $data02, $data03
if $data00 != 138 then
print expect 138, actual: $data00
return -1
endi
if $data01 != 32769 then if $data01 != 32769 then
return -1 return -1
endi endi
if $data02 != 294967295 then if $data02 != 294967295 then
return -1 return -1
endi endi
if $data03 != 446744073709551615 then if $data03 != 446744073709551615 then
return -1 return -1
endi endi
sql_error sql alter table mt_unsigned_1 set tag t1 = 999; sql_error sql alter table mt_unsigned_1 set tag t1 = 999;
...@@ -44,10 +45,10 @@ sql_error create table mt_unsigned_3 using mt_unsigned tags(0, -1, 0, 0, 0, 0, 0 ...@@ -44,10 +45,10 @@ sql_error create table mt_unsigned_3 using mt_unsigned tags(0, -1, 0, 0, 0, 0, 0
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, -1, 0, 0, 0, 0, 0); sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, -1, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, -1, 0, 0, 0, 0); sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, -1, 0, 0, 0, 0);
sql_error create table mt_unsigned_2 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0); sql create table mt_unsigned_21 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0); sql create table mt_unsigned_31 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0); sql create table mt_unsigned_41 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0); sql create table mt_unsigned_51 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0);
sql_error create table mt_unsigned_2 using mt_unsigned tags(999, 0, 0, 0, 0, 0, 0, 0); sql_error create table mt_unsigned_2 using mt_unsigned tags(999, 0, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 95535, 0, 0, 0, 0, 0, 0); sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 95535, 0, 0, 0, 0, 0, 0);
...@@ -63,11 +64,6 @@ if $rows != 1 then ...@@ -63,11 +64,6 @@ if $rows != 1 then
return -1; return -1;
endi endi
if $data00 != NULL then
print expect NULL, actual: $data00
return -1
endi
if $data01 != NULL then if $data01 != NULL then
return -1 return -1
endi endi
...@@ -87,82 +83,44 @@ sql_error insert into mt_unsigned_1 values(now, -1, NULL, NULL, NULL, NULL, NULL ...@@ -87,82 +83,44 @@ sql_error insert into mt_unsigned_1 values(now, -1, NULL, NULL, NULL, NULL, NULL
sql_error insert into mt_unsigned_1 values(now, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL); sql_error insert into mt_unsigned_1 values(now, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL); sql_error insert into mt_unsigned_1 values(now, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL); sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); sql insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL); sql insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL); sql insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL); sql insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL);
sql select count(a),count(b),count(c),count(d), count(e) from mt_unsigned_1 sql select count(a),count(b),count(c),count(d), count(e) from mt_unsigned_1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 1 then if $data01 != 3 then
return -1
endi
if $data01 != 1 then
return -1 return -1
endi endi
sql select a+b+c from mt_unsigned_1 where a is null; sql select a+b+c from mt_unsigned_1 where a is null;
if $rows != 1 then if $rows != 4 then
return -1
endi
if $data00 != NULL then
print expect NULL, actual:$data00
return -1 return -1
endi endi
sql select count(*), a from mt_unsigned_1 group by a; sql select count(*), a from mt_unsigned_1 group by a;
if $rows != 1 then if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1 return -1
endi endi
sql select count(*), b from mt_unsigned_1 group by b; sql select count(*), b from mt_unsigned_1 group by b;
if $rows != 1 then if $rows != 4 then
return -1 return -1
endi endi
if $data00 != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
sql select count(*), c from mt_unsigned_1 group by c; sql select count(*), c from mt_unsigned_1 group by c;
if $rows != 1 then if $rows != 4 then
return -1 return -1
endi endi
if $data00 != 1 then
return -1
endi
if $data01 != 3 then
return -1
endi
sql select count(*), d from mt_unsigned_1 group by d; sql select count(*), d from mt_unsigned_1 group by d;
if $rows != 1 then if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 4 then
return -1 return -1
endi endi
......
...@@ -243,9 +243,6 @@ if $rows != $val then ...@@ -243,9 +243,6 @@ if $rows != $val then
return -1 return -1
endi endi
#TODO
return
#===========================aggregation=================================== #===========================aggregation===================================
#select + where condition #select + where condition
sql select count(join_tb1.*), count(join_tb0.*) from $tb1 , $tb2 where $ts1 = $ts2 and join_tb1.ts >= 100000 and join_tb0.c7 = false; sql select count(join_tb1.*), count(join_tb0.*) from $tb1 , $tb2 where $ts1 = $ts2 and join_tb1.ts >= 100000 and join_tb0.c7 = false;
......
...@@ -41,12 +41,10 @@ sql_error insert into tb17 (ts, c1, c3) using stb (t1, t3) tags ('tag5', 11.11, ...@@ -41,12 +41,10 @@ sql_error insert into tb17 (ts, c1, c3) using stb (t1, t3) tags ('tag5', 11.11,
sql_error insert into tb18 (ts, c1, c3) using stb tags ('tag5', 16) values ( now + 5s, 'binary6', 6.6) sql_error insert into tb18 (ts, c1, c3) using stb tags ('tag5', 16) values ( now + 5s, 'binary6', 6.6)
sql_error insert into tb19 (ts, c1, c2, c3) using stb tags (19, 'tag5', 91.11) values ( now + 5s, 'binary7', 7, 7.7) sql_error insert into tb19 (ts, c1, c2, c3) using stb tags (19, 'tag5', 91.11) values ( now + 5s, 'binary7', 7, 7.7)
sql create table stbx (ts timestamp, c1 binary(10), c2 int, c3 float) tags (t1 binary(10), t2 int, t3 float) sql create table stbx (ts timestamp, c1 binary(10), c2 int, c3 float) tags (t1 binary(10), t2 int, t3 float)
sql insert into tb100 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag100', 100, 100.123456) values ( now + 10s, 'binary100', 100, 100.9) tb101 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag101', 101, 101.9) values ( now + 10s, 'binary101', 101, 101.9) tb102 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag102', 102, 102.9) values ( now + 10s, 'binary102', 102, 102.9) sql insert into tb100 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag100', 100, 100.123456) values ( now + 10s, 'binary100', 100, 100.9) tb101 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag101', 101, 101.9) values ( now + 10s, 'binary101', 101, 101.9) tb102 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag102', 102, 102.9) values ( now + 10s, 'binary102', 102, 102.9)
sql select * from stbx sql select * from stbx order by t1
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
......
...@@ -100,7 +100,7 @@ endi ...@@ -100,7 +100,7 @@ endi
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi
......
...@@ -25,11 +25,5 @@ sql (select database()) union all (select database()) ...@@ -25,11 +25,5 @@ sql (select database()) union all (select database())
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
if $data00 != @union_db0@ then
return -1
endi
if $data10 != @union_db0@ then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -77,12 +77,12 @@ if $rows != $val then ...@@ -77,12 +77,12 @@ if $rows != $val then
return -1 return -1
endi endi
sql select tbname from $mt sql select distinct tbname from $mt
if $rows != $tbNum then if $rows != $tbNum then
return -1 return -1
endi endi
sql select tbname from $mt where t1 < 2 sql select distinct tbname from $mt where t1 < 2
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
...@@ -249,14 +249,14 @@ sql_error insert into tb_where_NULL values(now, ?, '12') ...@@ -249,14 +249,14 @@ sql_error insert into tb_where_NULL values(now, ?, '12')
sql insert into tb_where_NULL values ('2019-01-01 09:00:00.000', 1, 'val1') sql insert into tb_where_NULL values ('2019-01-01 09:00:00.000', 1, 'val1')
sql insert into tb_where_NULL values ('2019-01-01 09:00:01.000', NULL, NULL) sql insert into tb_where_NULL values ('2019-01-01 09:00:01.000', NULL, NULL)
sql insert into tb_where_NULL values ('2019-01-01 09:00:02.000', 2, 'val2') sql insert into tb_where_NULL values ('2019-01-01 09:00:02.000', 2, 'val2')
sql_error select * from tb_where_NULL where c1 = NULL sql select * from tb_where_NULL where c1 = NULL
sql_error select * from tb_where_NULL where c1 <> NULL sql select * from tb_where_NULL where c1 <> NULL
sql_error select * from tb_where_NULL where c1 < NULL sql select * from tb_where_NULL where c1 < NULL
sql_error select * from tb_where_NULL where c1 = "NULL" sql select * from tb_where_NULL where c1 = "NULL"
sql_error select * from tb_where_NULL where c1 <> "NULL" sql select * from tb_where_NULL where c1 <> "NULL"
sql_error select * from tb_where_NULL where c1 <> "nulL" sql select * from tb_where_NULL where c1 <> "nulL"
sql_error select * from tb_where_NULL where c1 > "NULL" sql select * from tb_where_NULL where c1 > "NULL"
sql_error select * from tb_where_NULL where c1 >= "NULL" sql select * from tb_where_NULL where c1 >= "NULL"
sql select * from tb_where_NULL where c2 = "NULL" sql select * from tb_where_NULL where c2 = "NULL"
if $rows != 0 then if $rows != 0 then
return -1 return -1
...@@ -300,15 +300,17 @@ endw ...@@ -300,15 +300,17 @@ endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql_error select * from wh_mt0 where c3 = 'abc' and tbname in ('test_null_filter'); sql select * from wh_mt0 where c3 = 'abc' and tbname in ('test_null_filter');
sql select * from wh_mt0 where c3 = '1' and tbname in ('test_null_filter'); sql select * from wh_mt0 where c3 = '1' and tbname in ('test_null_filter');
if $row != 0 then if $row != 0 then
return -1 return -1
endi endi
sql select * from wh_mt0 where c3 = '1'; sql select * from wh_mt0 where c3 = 1;
if $row == 0 then print $rows -> 1000
print $data00 $data01 $data02
if $row != 1000 then
return -1 return -1
endi endi
...@@ -336,7 +338,7 @@ sql insert into where_ts values('2021-06-19 16:22:00', 1); ...@@ -336,7 +338,7 @@ sql insert into where_ts values('2021-06-19 16:22:00', 1);
sql insert into where_ts values('2021-06-19 16:23:00', 2); sql insert into where_ts values('2021-06-19 16:23:00', 2);
sql insert into where_ts values('2021-06-19 16:24:00', 3); sql insert into where_ts values('2021-06-19 16:24:00', 3);
sql insert into where_ts values('2021-06-19 16:25:00', 1); sql insert into where_ts values('2021-06-19 16:25:00', 1);
sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' order by ts;
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
......
...@@ -311,7 +311,7 @@ sql select * from $mt where tgcol2 = 1 -x step52 ...@@ -311,7 +311,7 @@ sql select * from $mt where tgcol2 = 1 -x step52
return -1 return -1
step52: step52:
sql select * from $mt where tgcol3 = 1 sql select * from $mt where tgcol3 < 2
print $data01 $data02 $data03 print $data01 $data02 $data03
if $rows != 1 then if $rows != 1 then
return -1 return -1
......
...@@ -97,10 +97,10 @@ if $data23 != TAG then ...@@ -97,10 +97,10 @@ if $data23 != TAG then
return -1 return -1
endi endi
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol1 -x step40 sql alter table $mt drop tag tgcol1 -x step40
return -1 return -1
step40: step40:
sql alter table $mt drop tag tgcol2
print =============== step5 print =============== step5
$i = 5 $i = 5
...@@ -123,11 +123,11 @@ if $data03 != 2 then ...@@ -123,11 +123,11 @@ if $data03 != 2 then
return -1 return -1
endi endi
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol1 -x step50 sql alter table $mt drop tag tgcol1 -x step50
return -1 return -1
step50: step50:
sql alter table $mt drop tag tgcol2
print =============== step6 print =============== step6
$i = 6 $i = 6
$mt = $mtPrefix . $i $mt = $mtPrefix . $i
...@@ -186,7 +186,7 @@ endi ...@@ -186,7 +186,7 @@ endi
if $data31 != TINYINT then if $data31 != TINYINT then
return -1 return -1
endi endi
if $data41 != BINARY then if $data41 != VARCHAR then
return -1 return -1
endi endi
if $data22 != 2 then if $data22 != 2 then
...@@ -405,8 +405,6 @@ sql alter table $mt drop tag tgcol3 ...@@ -405,8 +405,6 @@ sql alter table $mt drop tag tgcol3
sql alter table $mt drop tag tgcol4 sql alter table $mt drop tag tgcol4
sql alter table $mt drop tag tgcol6 sql alter table $mt drop tag tgcol6
sleep 3000
print =============== step2 print =============== step2
$i = 2 $i = 2
$mt = $mtPrefix . $i $mt = $mtPrefix . $i
......
...@@ -32,7 +32,7 @@ if $data(2)[4] != ready then ...@@ -32,7 +32,7 @@ if $data(2)[4] != ready then
endi endi
print =============== kill dnode2 print =============== kill dnode2
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGKILL
print =============== create database print =============== create database
sql show transactions sql show transactions
...@@ -88,7 +88,7 @@ endi ...@@ -88,7 +88,7 @@ endi
sql show transactions sql show transactions
if $rows != 0 then if $rows != 0 then
return -1 goto step2
endi endi
sql_error create database d1 vgroups 2; sql_error create database d1 vgroups 2;
......
...@@ -50,9 +50,9 @@ class TDTestCase: ...@@ -50,9 +50,9 @@ class TDTestCase:
'col11': 'bool', 'col11': 'bool',
'col12': f'binary({self.str_length})', 'col12': f'binary({self.str_length})',
'col13': f'nchar({self.str_length})', 'col13': f'nchar({self.str_length})',
} }
self.tinyint_val = random.randint(constant.TINYINT_MIN,constant.TINYINT_MAX) self.tinyint_val = random.randint(constant.TINYINT_MIN,constant.TINYINT_MAX)
self.smallint_val = random.randint(constant.SMALLINT_MIN,constant.SMALLINT_MAX) self.smallint_val = random.randint(constant.SMALLINT_MIN,constant.SMALLINT_MAX)
self.int_val = random.randint(constant.INT_MIN,constant.INT_MAX) self.int_val = random.randint(constant.INT_MIN,constant.INT_MAX)
...@@ -100,15 +100,15 @@ class TDTestCase: ...@@ -100,15 +100,15 @@ class TDTestCase:
elif col_type.lower() == 'bigint unsigned': elif col_type.lower() == 'bigint unsigned':
tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["bigint unsigned"]})') tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["bigint unsigned"]})')
elif col_type.lower() == 'bool': elif col_type.lower() == 'bool':
tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["bool"]})') tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["bool"]})')
elif col_type.lower() == 'float': elif col_type.lower() == 'float':
tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["float"]})') tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["float"]})')
elif col_type.lower() == 'double': elif col_type.lower() == 'double':
tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["double"]})') tdSql.execute(f'insert into {tbname} values({self.ts+i},{base_data["double"]})')
elif 'binary' in col_type.lower(): elif 'binary' in col_type.lower():
tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['binary']}")''') tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['binary']}")''')
elif 'nchar' in col_type.lower(): elif 'nchar' in col_type.lower():
tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['nchar']}")''') tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['nchar']}")''')
def delete_all_data(self,tbname,col_type,row_num,base_data,dbname,tb_type,tb_num=1): def delete_all_data(self,tbname,col_type,row_num,base_data,dbname,tb_type,tb_num=1):
tdSql.execute(f'delete from {tbname}') tdSql.execute(f'delete from {tbname}')
tdSql.execute(f'flush database {dbname}') tdSql.execute(f'flush database {dbname}')
...@@ -164,7 +164,7 @@ class TDTestCase: ...@@ -164,7 +164,7 @@ class TDTestCase:
elif 'nchar' in column_type.lower(): elif 'nchar' in column_type.lower():
tdSql.checkEqual(tdSql.queryResult[0][0],base_data['nchar']) tdSql.checkEqual(tdSql.queryResult[0][0],base_data['nchar'])
else: else:
tdSql.checkEqual(tdSql.queryResult[0][0],base_data[column_type]) tdSql.checkEqual(tdSql.queryResult[0][0],base_data[column_type])
def delete_rows(self,dbname,tbname,col_name,col_type,base_data,row_num,tb_type,tb_num=1): def delete_rows(self,dbname,tbname,col_name,col_type,base_data,row_num,tb_type,tb_num=1):
for i in range(row_num): for i in range(row_num):
tdSql.execute(f'delete from {tbname} where ts>{self.ts+i}') tdSql.execute(f'delete from {tbname} where ts>{self.ts+i}')
...@@ -189,7 +189,7 @@ class TDTestCase: ...@@ -189,7 +189,7 @@ class TDTestCase:
elif tb_type == 'stb': elif tb_type == 'stb':
tdSql.checkRows(i*tb_num) tdSql.checkRows(i*tb_num)
for j in range(tb_num): for j in range(tb_num):
self.insert_base_data(col_type,f'{tbname}_{j}',row_num,base_data) self.insert_base_data(col_type,f'{tbname}_{j}',row_num,base_data)
for i in range(row_num): for i in range(row_num):
tdSql.execute(f'delete from {tbname} where ts<={self.ts+i}') tdSql.execute(f'delete from {tbname} where ts<={self.ts+i}')
tdSql.execute(f'flush database {dbname}') tdSql.execute(f'flush database {dbname}')
...@@ -240,7 +240,7 @@ class TDTestCase: ...@@ -240,7 +240,7 @@ class TDTestCase:
tdSql.error(f'''delete from {tbname} where {error_list} {column_name} ="{base_data['nchar']}"''') tdSql.error(f'''delete from {tbname} where {error_list} {column_name} ="{base_data['nchar']}"''')
else: else:
tdSql.error(f'delete from {tbname} where {error_list} {column_name} = {base_data[column_type]}') tdSql.error(f'delete from {tbname} where {error_list} {column_name} = {base_data[column_type]}')
def delete_data_ntb(self): def delete_data_ntb(self):
tdSql.execute(f'create database if not exists {self.dbname}') tdSql.execute(f'create database if not exists {self.dbname}')
tdSql.execute(f'use {self.dbname}') tdSql.execute(f'use {self.dbname}')
...@@ -295,4 +295,4 @@ class TDTestCase: ...@@ -295,4 +295,4 @@ class TDTestCase:
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
...@@ -38,7 +38,7 @@ class TDTestCase: ...@@ -38,7 +38,7 @@ class TDTestCase:
tlist = self.genMultiThreadSeq(sql_list) tlist = self.genMultiThreadSeq(sql_list)
self.multiThreadRun(tlist) self.multiThreadRun(tlist)
tdSql.query(f'show databases') tdSql.query(f'show databases')
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册