diff --git a/Jenkinsfile b/Jenkinsfile index d8803cd1a993250055c9aa3f2e0b457ab4d0f170..9d131d0ca500ef248740b5ce31fd92ce197b32f8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,7 +57,7 @@ def pre_test(){ cd ${WKC} git checkout 2.0 ''' - } + } else{ sh ''' cd ${WKC} @@ -67,6 +67,7 @@ def pre_test(){ } sh''' cd ${WKC} + git remote prune origin [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge @@ -88,28 +89,28 @@ def pre_test(){ cd ${WK} git checkout 2.0 ''' - } + } else{ sh ''' cd ${WK} git checkout develop ''' - } + } } sh ''' cd ${WK} - git pull >/dev/null - + git pull >/dev/null + export TZ=Asia/Harbin date git clean -dfx mkdir debug cd debug - cmake .. -DBUILD_HTTP=false > /dev/null + cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true > /dev/null make > /dev/null make install > /dev/null cd ${WKC}/tests - pip3 install ${WKC}/src/connector/python/ + pip3 install ${WKC}/src/connector/python/ ''' return 1 } @@ -131,7 +132,7 @@ def pre_test_noinstall(){ cd ${WKC} git checkout 2.0 ''' - } + } else{ sh ''' cd ${WKC} @@ -141,6 +142,7 @@ def pre_test_noinstall(){ } sh''' cd ${WKC} + git remote prune origin [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge @@ -162,24 +164,24 @@ def pre_test_noinstall(){ cd ${WK} git checkout 2.0 ''' - } + } else{ sh ''' cd ${WK} git checkout develop ''' - } + } } sh ''' cd ${WK} - git pull >/dev/null - + git pull >/dev/null + export TZ=Asia/Harbin date git clean -dfx mkdir debug cd debug - cmake .. -DBUILD_HTTP=false > /dev/null + cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=false > /dev/null make ''' return 1 @@ -202,7 +204,7 @@ def pre_test_mac(){ cd ${WKC} git checkout 2.0 ''' - } + } else{ sh ''' cd ${WKC} @@ -212,6 +214,7 @@ def pre_test_mac(){ } sh''' cd ${WKC} + git remote prune origin [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge @@ -233,24 +236,24 @@ def pre_test_mac(){ cd ${WK} git checkout 2.0 ''' - } + } else{ sh ''' cd ${WK} git checkout develop ''' - } + } } sh ''' cd ${WK} - git pull >/dev/null - + git pull >/dev/null + export TZ=Asia/Harbin date git clean -dfx mkdir debug cd debug - cmake .. > /dev/null + cmake .. -DBUILD_TOOLS=false > /dev/null go env -w GOPROXY=https://goproxy.cn,direct go env -w GO111MODULE=on cmake --build . @@ -265,7 +268,7 @@ def pre_test_win(){ cd C:\\workspace\\TDinternal rd /s /Q C:\\workspace\\TDinternal\\debug cd C:\\workspace\\TDinternal\\community - git reset --hard HEAD~10 + git reset --hard HEAD~10 ''' script { if (env.CHANGE_TARGET == 'master') { @@ -279,7 +282,7 @@ def pre_test_win(){ cd C:\\workspace\\TDinternal\\community git checkout 2.0 ''' - } + } else{ bat ''' cd C:\\workspace\\TDinternal\\community @@ -289,7 +292,8 @@ def pre_test_win(){ } bat''' cd C:\\workspace\\TDinternal\\community - git pull + git remote prune origin + git pull git fetch origin +refs/pull/%CHANGE_ID%/merge git checkout -qf FETCH_HEAD git clean -dfx @@ -309,36 +313,36 @@ def pre_test_win(){ cd C:\\workspace\\TDinternal git checkout 2.0 ''' - } + } else{ bat ''' cd C:\\workspace\\TDinternal git checkout develop ''' - } + } } bat ''' cd C:\\workspace\\TDinternal - git pull + git pull date git clean -dfx mkdir debug cd debug call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64 - cmake ../ -G "NMake Makefiles" + cmake ../ -G "NMake Makefiles" set CL=/MP nmake nmake || exit 8 nmake install || exit 8 xcopy /e/y/i/f C:\\workspace\\TDinternal\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 || exit 8 cd C:\\workspace\\TDinternal\\community\\src\\connector\\python python -m pip install . - + ''' return 1 } pipeline { agent none - options { skipDefaultCheckout() } + options { skipDefaultCheckout() } environment{ WK = '/var/lib/jenkins/workspace/TDinternal' WKC= '/var/lib/jenkins/workspace/TDinternal/community' @@ -346,7 +350,7 @@ pipeline { stages { stage('pre_build'){ agent{label 'master'} - options { skipDefaultCheckout() } + options { skipDefaultCheckout() } when { changeRequest() } @@ -371,32 +375,32 @@ pipeline { // sh ''' // git checkout 2.0 // ''' - // } + // } // else{ // sh ''' // git checkout develop // ''' - // } + // } // } // sh''' // git fetch origin +refs/pull/${CHANGE_ID}/merge // git checkout -qf FETCH_HEAD - // ''' + // ''' - // script{ - // skipbuild='2' + // script{ + // skipbuild='2' // skipbuild=sh(script: "git log -2 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' && echo 1 || echo 2", returnStdout:true) // println skipbuild // } // sh''' // rm -rf ${WORKSPACE}.tes // ''' - // } + // } } } stage('Parallel test stage') { //only build pr - options { skipDefaultCheckout() } + options { skipDefaultCheckout() } when { allOf{ changeRequest() @@ -415,13 +419,11 @@ pipeline { ./test-all.sh p1 date''' } - } } stage('python_2_s5') { agent{label " slave5 || slave15 "} steps { - pre_test() timeout(time: 55, unit: 'MINUTES'){ sh ''' @@ -434,8 +436,8 @@ pipeline { } stage('python_3_s6') { agent{label " slave6 || slave16 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ + steps { + timeout(time: 55, unit: 'MINUTES'){ pre_test() sh ''' date @@ -447,8 +449,8 @@ pipeline { } stage('test_b1_s2') { agent{label " slave2 || slave12 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ + steps { + timeout(time: 55, unit: 'MINUTES'){ pre_test() sh ''' rm -rf /var/lib/taos/* @@ -492,11 +494,11 @@ pipeline { cd ${WKC}/src/connector/C# dotnet test dotnet run --project src/test/Cases/Cases.csproj - + cd ${WKC}/tests/examples/C# dotnet run --project C#checker/C#checker.csproj dotnet run --project TDengineTest/TDengineTest.csproj - dotnet run --project schemaless/schemaless.csproj + dotnet run --project schemaless/schemaless.csproj cd ${WKC}/tests/examples/C#/taosdemo dotnet build -c Release @@ -517,7 +519,7 @@ pipeline { } stage('test_crash_gen_s3') { agent{label " slave3 || slave13 "} - + steps { pre_test() timeout(time: 60, unit: 'MINUTES'){ @@ -547,7 +549,7 @@ pipeline { ./test-all.sh b2fq date ''' - } + } } } stage('test_valgrind_s4') { @@ -561,8 +563,8 @@ pipeline { ./valgrind-test.sh 2>&1 > mem-error-out.log ./handle_val_log.sh ''' - } - timeout(time: 55, unit: 'MINUTES'){ + } + timeout(time: 55, unit: 'MINUTES'){ sh ''' date cd ${WKC}/tests @@ -578,8 +580,8 @@ pipeline { } stage('test_b4_s7') { agent{label " slave7 || slave17 "} - steps { - timeout(time: 105, unit: 'MINUTES'){ + steps { + timeout(time: 105, unit: 'MINUTES'){ pre_test() sh ''' date @@ -592,14 +594,13 @@ pipeline { // ./test-all.sh full jdbc // cd ${WKC}/tests // ./test-all.sh full unit - } } } stage('test_b5_s8') { agent{label " slave8 || slave18 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ + steps { + timeout(time: 55, unit: 'MINUTES'){ pre_test() sh ''' date @@ -611,8 +612,8 @@ pipeline { } stage('test_b6_s9') { agent{label " slave9 || slave19 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ + steps { + timeout(time: 55, unit: 'MINUTES'){ pre_test() sh ''' cd ${WKC}/tests @@ -623,14 +624,13 @@ pipeline { cd ${WKC}/tests ./test-all.sh b6fq date''' - } } } stage('test_b7_s10') { agent{label " slave10 || slave20 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ + steps { + timeout(time: 55, unit: 'MINUTES'){ pre_test() sh ''' cd ${WKC}/tests @@ -640,68 +640,68 @@ pipeline { date cd ${WKC}/tests ./test-all.sh b7fq - date''' + date''' } } - } + } stage('arm64centos7') { agent{label " arm64centos7 "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('arm64centos8') { agent{label " arm64centos8 "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('arm32bionic') { agent{label " arm32bionic "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('arm64bionic') { agent{label " arm64bionic "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('arm64focal') { agent{label " arm64focal "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('centos7') { agent{label " centos7 "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('ubuntu:trusty') { agent{label " trusty "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('ubuntu:xenial') { agent{label " xenial "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('ubuntu:bionic') { agent{label " bionic "} - steps { - pre_test_noinstall() + steps { + pre_test_noinstall() } } stage('Mac_build') { agent{label " catalina "} - steps { - pre_test_mac() + steps { + pre_test_mac() } } @@ -709,7 +709,7 @@ pipeline { agent{label " wintest "} steps { pre_test() - script{ + script{ while(win_stop == 0){ sleep(1) } @@ -719,7 +719,6 @@ pipeline { stage('test'){ agent{label "win"} steps{ - catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { pre_test_win() timeout(time: 20, unit: 'MINUTES'){ @@ -728,18 +727,16 @@ pipeline { .\\test-all.bat wintest ''' } - } + } script{ win_stop=1 } } } - - } } } - post { + post { success { emailext ( subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS", @@ -766,7 +763,6 @@ pipeline {
  • 提交信息:${env.CHANGE_TITLE}
  • 构建地址:${BUILD_URL}
  • 构建日志:${BUILD_URL}console
  • - @@ -804,7 +800,6 @@ pipeline {
  • 提交信息:${env.CHANGE_TITLE}
  • 构建地址:${BUILD_URL}
  • 构建日志:${BUILD_URL}console
  • - @@ -816,5 +811,5 @@ pipeline { from: "support@taosdata.com" ) } - } + } } diff --git a/README.md b/README.md index 6cf09e1589946cdb752eba2f3e3135af1699fe3c..31973af6c7baa6fbbe78dcedda52c40a942752b9 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,9 @@ sudo apt-get install -y maven ``` #### Install build dependencies for taos-tools +We provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. From TDengine 2.4.0.0, taosBenchmark and taosdump were not released together with TDengine. +By default, TDengine compiling does not include taos-tools. You can use 'cmake .. -DBUILD_TOOLS=true' to make them be compiled with TDengine. + To build the [taos-tools](https://github.com/taosdata/taos-tools) on Ubuntu/Debian, the following packages need to be installed. ```bash sudo apt install libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config @@ -142,7 +145,7 @@ mkdir debug && cd debug cmake .. && cmake --build . ``` -Note TDengine 2.3.x.0 and later use a component named 'taosAdapter' to play http daemon role by default instead of the http daemon embedded in the early version of TDengine. The taosAdapter is programmed by go language. If you pull TDengine source code to the latest from an existing codebase, please execute 'git submodule update --init --recursive' to pull taosAdapter source code. Please install go language 1.14 or above for compiling taosAdapter. If you meet difficulties regarding 'go mod', especially you are from China, you can use a proxy to solve the problem. +Note TDengine 2.3.x.0 and later use a component named 'taosAdapter' to play http daemon role by default instead of the http daemon embedded in the early version of TDengine. The taosAdapter is programmed by go language. If you pull TDengine source code to the latest from an existing codebase, please execute 'git submodule update --init --recursive' to pull taosAdapter source code. Please install go language version 1.14 or above for compiling taosAdapter. If you meet difficulties regarding 'go mod', especially you are from China, you can use a proxy to solve the problem. ``` go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct diff --git a/cmake/define.inc b/cmake/define.inc index 07df84a7f4df5d27020716b4d9986a578b839595..6877ee7257cab244c6cc2872e44fa899a798c856 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -168,7 +168,7 @@ IF ("${BUILD_TOOLS}" STREQUAL "") ELSEIF (TD_ARM_64) SET(BUILD_TOOLS "false") ELSE () - SET(BUILD_TOOLS "true") + SET(BUILD_TOOLS "false") ENDIF () ELSEIF (TD_DARWIN) SET(BUILD_TOOLS "false") diff --git a/documentation20/cn/02.getting-started/docs.md b/documentation20/cn/02.getting-started/docs.md index 5f887df914ef06d40f3b3b8bf6ef8dfe18fe6ecf..f38522b5c257fdb3f72e833e72f14f4c9acdefb0 100644 --- a/documentation20/cn/02.getting-started/docs.md +++ b/documentation20/cn/02.getting-started/docs.md @@ -30,7 +30,7 @@ wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add - echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-stable stable main" | sudo tee /etc/apt/sources.list.d/tdengine-stable.list [ beta 版安装包仓库为可选安装项 ] echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-beta beta main" | sudo tee /etc/apt/sources.list.d/tdengine-beta.list sudo apt-get update -apt-get policy tdengine +apt-cache policy tdengine sudo apt-get install tdengine ``` diff --git a/documentation20/cn/05.insert/docs.md b/documentation20/cn/05.insert/docs.md index 243d8509f069e5073cc15ee69438ff6e2cc28e3d..d32a23e9a187e662cf00e2fbe4864472a859b3e0 100644 --- a/documentation20/cn/05.insert/docs.md +++ b/documentation20/cn/05.insert/docs.md @@ -319,118 +319,9 @@ taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相 ## 使用 Bailongma 2.0 接入 Telegraf 数据写入 -*注意:TDengine 新版本(2.3.0.0+)提供新版本 Bailongma ,命名为 taosAdapter ,提供更简便的 Telegraf 数据写入以及其他更强大的功能,Bailongma v2 即之前版本将逐步不再维护。 +**注意:** +TDengine 新版本(2.3.0.0+)提供新版本 Bailongma ,命名为 taosAdapter ,提供更简便的 Telegraf 数据写入以及其他更强大的功能,Bailongma v2 及之前版本将逐步不再维护。 -[Telegraf](https://www.influxdata.com/time-series-platform/telegraf/)是一流行的IT运维数据采集开源工具,TDengine提供一个小工具[Bailongma](https://github.com/taosdata/Bailongma),只需在Telegraf做简单配置,无需任何代码,就可将Telegraf采集的数据直接写入TDengine,并按规则在TDengine自动创建库和相关表项。博文[用Docker容器快速搭建一个Devops监控Demo](https://www.taosdata.com/blog/2020/02/03/1189.html)即是采用bailongma将Prometheus和Telegraf的数据写入TDengine中的示例,可以参考。 - -### 从源代码编译 blm_telegraf - -用户需要从github下载[Bailongma](https://github.com/taosdata/Bailongma)的源码,使用Golang语言编译器编译生成可执行文件。在开始编译前,需要准备好以下条件: - -- Linux操作系统的服务器 -- 安装好Golang,1.10版本以上 -- 对应的TDengine版本。因为用到了TDengine的客户端动态链接库,因此需要安装好和服务端相同版本的TDengine程序;比如服务端版本是TDengine 2.0.0, 则在Bailongma所在的Linux服务器(可以与TDengine在同一台服务器,或者不同服务器) - -Bailongma项目中有一个文件夹blm_telegraf,存放了Telegraf的写入API程序。编译过程如下: - -```bash -cd blm_telegraf -go build -``` - -一切正常的情况下,就会在对应的目录下生成一个blm_telegraf的可执行程序。 - -### 安装 Telegraf - -目前TDengine支持Telegraf 1.7.4以上的版本。用户可以根据当前的操作系统,到Telegraf官网下载安装包,并执行安装。下载地址如下:https://portal.influxdata.com/downloads 。 - -### 配置 Telegraf - -修改Telegraf配置文件/etc/telegraf/telegraf.conf中与TDengine有关的配置项。 - -在output plugins部分,增加[[outputs.http]]配置项: - -- url:Bailongma API服务提供的URL,参考下面的启动示例章节 -- data_format:"json" -- json_timestamp_units:"1ms" - -在agent部分: - -- hostname: 区分不同采集设备的机器名称,需确保其唯一性。 -- metric_batch_size: 100,允许Telegraf每批次写入记录最大数量,增大其数量可以降低Telegraf的请求发送频率。 - -关于如何使用Telegraf采集数据以及更多有关使用Telegraf的信息,请参考Telegraf官方的[文档](https://docs.influxdata.com/telegraf/v1.11/)。 - -### 启动 blm_telegraf 程序 - -blm_telegraf程序有以下选项,在启动blm_telegraf程序时可以通过设定这些选项来设定blm_telegraf的配置。 - -```bash ---host -TDengine服务端的IP地址,缺省值为空。 - ---batch-size -blm_telegraf会将收到的telegraf的数据拼装成TDengine的写入请求,这个参数控制一次发给TDengine的写入请求中携带的数据条数。 - ---dbname -设置在TDengine中创建的数据库名称,blm_telegraf会自动在TDengine中创建一个以dbname为名称的数据库,缺省值是prometheus。 - ---dbuser -设置访问TDengine的用户名,缺省值是'root'。 - ---dbpassword -设置访问TDengine的密码,缺省值是'taosdata'。 - ---port -blm_telegraf对telegraf提供服务的端口号。 -``` - -### 启动示例 - -通过以下命令启动一个blm_telegraf的API服务: -```bash -./blm_telegraf -host 127.0.0.1 -port 8089 -``` - -假设blm_telegraf所在服务器的IP地址为"10.1.2.3",则在telegraf的配置文件中, 在output plugins部分,增加[[outputs.http]]配置项: - -```yaml -url = "http://10.1.2.3:8089/telegraf" -``` - -### 查询 telegraf 写入数据 - -telegraf产生的数据格式如下: -```json -{ - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 89.7897897897898, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0, - "usage_steal": 0, - "usage_system": 5.405405405405405, - "usage_user": 4.804804804804805 - }, - - "name": "cpu", - "tags": { - "cpu": "cpu2", - "host": "bogon" - }, - "timestamp": 1576464360 -} -``` - -其中,name字段为telegraf采集的时序数据的名称,tags字段为该时序数据的标签。blm_telegraf会以时序数据的名称在TDengine中自动创建一个超级表,并将tags字段中的标签转换成TDengine的tag值,timestamp作为时间戳,fields字段中的值作为该时序数据的值。因此在TDengine的客户端中,可以通过以下指令查到这个数据是否成功写入。 - -```mysql -use telegraf; -select * from cpu; -``` ## EMQ Broker 直接写入 diff --git a/documentation20/en/05.insert/docs.md b/documentation20/en/05.insert/docs.md index 7abecfda380b1219a6c5d407d48e7876eecd55ea..aa8ea7dde45959347bbc8f51da012fa864e5bf46 100644 --- a/documentation20/en/05.insert/docs.md +++ b/documentation20/en/05.insert/docs.md @@ -1,6 +1,6 @@ # Efficient Data Writing -TDengine supports multiple ways to write data, including SQL, Prometheus, Telegraf, EMQ MQTT Broker, HiveMQ Broker, CSV file, etc. Kafka, OPC and other interfaces will be provided in the future. Data can be inserted in one single record or in batches, data from one or multiple data collection points can be inserted at the same time. TDengine supports multi-thread insertion, out-of-order data insertion, and also historical data insertion. +TDengine supports multiple ways to write data, including SQL, Prometheus, Telegraf, collectd, StatsD, EMQ MQTT Broker, HiveMQ Broker, CSV file, etc. Kafka, OPC and other interfaces will be provided in the future. Data can be inserted in one single record or in batches, data from one or multiple data collection points can be inserted at the same time. TDengine supports multi-thread insertion, out-of-order data insertion, and also historical data insertion. ## Data Writing via SQL @@ -141,141 +141,84 @@ use prometheus; select * from apiserver_request_latencies_bucket; ``` +## Data Writing via Telegraf and taosAdapter +Please refer to [Official document](https://portal.influxdata.com/downloads/) for Telegraf installation. +TDengine version 2.3.0.0+ includes a stand-alone application taosAdapter in charge of receive data insertion from Telegraf. -## Data Writing via Telegraf - -[Telegraf](https://www.influxdata.com/time-series-platform/telegraf/) is a popular open source tool for IT operation data collection. TDengine provides a simple tool [Bailongma](https://github.com/taosdata/Bailongma), which only needs to be simply configured in Telegraf without any code, and can directly write the data collected by Telegraf into TDengine, then automatically create databases and related table entries in TDengine according to rules. Blog post [Use Docker Container to Quickly Build a Devops Monitoring Demo](https://www.taosdata.com/blog/2020/02/03/1189.html), which is an example of using bailongma to write Prometheus and Telegraf data into TDengine. - -### Compile blm_telegraf From Source Code - -Users need to download the source code of [Bailongma](https://github.com/taosdata/Bailongma) from github, then compile and generate an executable file using Golang language compiler. Before you start compiling, you need to complete following prepares: - -- A server running Linux OS -- Golang version 1.10 and higher installed -- An appropriated TDengine version. Because the client dynamic link library of TDengine is used, it is necessary to install the same version of TDengine as the server-side; for example, if the server version is TDengine 2.0. 0, ensure install the same version on the linux server where bailongma is located (can be on the same server as TDengine, or on a different server) - -Bailongma project has a folder, blm_telegraf, which holds the Telegraf writing API. The compiling process is as follows: - -```bash -cd blm_telegraf - -go build +Configuration: +Please add following words in /etc/telegraf/telegraf.conf. Fill 'database name' with the database name you want to store in the TDengine for Telegraf data. Please fill the values in TDengine server/cluster host, username and password fields. +``` +[[outputs.http]] + url = "http://:6041/influxdb/v1/write?db=" + method = "POST" + timeout = "5s" + username = "" + password = "" + data_format = "influx" + influx_max_line_bytes = 250 ``` -If everything goes well, an executable of blm_telegraf will be generated in the corresponding directory. - -### Install Telegraf - -At the moment, TDengine supports Telegraf version 1.7. 4 and above. Users can download the installation package on Telegraf's website according to your current operating system. The download address is as follows: https://portal.influxdata.com/downloads - -### Configure Telegraf - -Modify the TDengine-related configurations in the Telegraf configuration file /etc/telegraf/telegraf.conf. - -In the output plugins section, add the [[outputs.http]] configuration: - -- url: The URL provided by bailongma API service, please refer to the example section below -- data_format: "json" -- json_timestamp_units: "1ms" - -In agent section: - -- hostname: The machine name that distinguishes different collection devices, and it is necessary to ensure its uniqueness -- metric_batch_size: 100, which is the max number of records per batch written by Telegraf allowed. Increasing the number can reduce the request sending frequency of Telegraf. - -For information on how to use Telegraf to collect data and more about using Telegraf, please refer to the official [document](https://docs.influxdata.com/telegraf/v1.11/) of Telegraf. - -### Launch blm_telegraf - -blm_telegraf has following options, which can be set to tune configurations of blm_telegraf when launching. - -```sh ---host - -The ip address of TDengine server, default is null - ---batch-size - -blm_prometheus assembles the received telegraf data into a TDengine writing request. This parameter controls the number of data pieces carried in a writing request sent to TDengine at a time. - ---dbname - -Set a name for the database created in TDengine, blm_telegraf will automatically create a database named dbname in TDengine, and the default value is prometheus. - ---dbuser +Then restart telegraf: +``` +sudo systemctl start telegraf +``` +Now you can query the metrics data of Telegraf from TDengine. -Set the user name to access TDengine, the default value is 'root ' +Please find taosAdapter configuration and usage from `taosadapter --help` output. ---dbpassword +## collectd 直接写入(通过 taosAdapter) +Please refer to [official document](https://collectd.org/download.shtml) for collectd installation. -Set the password to access TDengine, the default value is'taosdata ' +TDengine version 2.3.0.0+ includes a stand-alone application taosAdapter in charge of receive data insertion from collectd. ---port - -The port number blm_telegraf used to serve Telegraf. +Configuration: +Please add following words in /etc/collectd/collectd.conf. Please fill the value 'host' and 'port' with what the TDengine and taosAdapter using. ``` +LoadPlugin network + + Server "" "" + +``` +Then restart collectd +``` +sudo systemctl start collectd +``` +Please find taosAdapter configuration and usage from `taosadapter --help` output. +## StatsD 直接写入(通过 taosAdapter) +Please refer to [official document](https://github.com/statsd/statsd) for StatsD installation. +TDengine version 2.3.0.0+ includes a stand-alone application taosAdapter in charge of receive data insertion from StatsD. -### Example - -Launch an API service for blm_telegraf with the following command - -```bash -./blm_telegraf -host 127.0.0.1 -port 8089 +Please add following words in the config.js file. Please fill the value to 'host' and 'port' with what the TDengine and taosAdapter using. ``` - -Assuming that the IP address of the server where blm_telegraf located is "10.1.2. 3", the URL shall be added to the configuration file of telegraf as: - -```yaml -url = "http://10.1.2.3:8089/telegraf" +add "./backends/repeater" to backends section. +add { host:'', port: } to repeater section. ``` -### Query written data of telegraf - -The format of generated data by telegraf is as follows: - -```json +Example file: +``` { - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 89.7897897897898, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0, - "usage_steal": 0, - "usage_system": 5.405405405405405, - "usage_user": 4.804804804804805 - }, - - "name": "cpu", - "tags": { - "cpu": "cpu2", - "host": "bogon" - }, - "timestamp": 1576464360 +port: 8125 +, backends: ["./backends/repeater"] +, repeater: [{ host: '127.0.0.1', port: 6044}] } ``` -Where the name field is the name of the time-series data collected by telegraf, and the tag field is the tag of the time-series data. blm_telegraf automatically creates a STable in TDengine with the name of the time series data, and converts the tag field into the tag value of TDengine, with Timestamp as the timestamp and fields values as the value of the time-series data. Therefore, in the client of TDEngine, you can check whether this data was successfully written through the following instruction. +Please find taosAdapter configuration and usage from `taosadapter --help` output. -```mysql -use telegraf; -select * from cpu; -``` +## Insert data via Bailongma 2.0 and Telegraf + +**Notice:** +TDengine 2.3.0.0+ provides taosAdapter to support Telegraf data writing. Bailongma v2 will be abandoned and no more maintained. -MQTT is a popular data transmission protocol in the IoT. TDengine can easily access the data received by MQTT Broker and write it to TDengine. ## Data Writing via EMQ Broker [EMQ](https://github.com/emqx/emqx) is an open source MQTT Broker software, with no need of coding, only to use "rules" in EMQ Dashboard for simple configuration, and MQTT data can be directly written into TDengine. EMQ X supports storing data to the TDengine by sending it to a Web service, and also provides a native TDengine driver on Enterprise Edition for direct data store. Please refer to [EMQ official documents](https://docs.emqx.io/broker/latest/cn/rule/rule-example.html#%E4%BF%9D%E5%AD%98%E6%95%B0%E6%8D%AE%E5%88%B0-tdengine) for more details. - - ## Data Writing via HiveMQ Broker -[HiveMQ](https://www.hivemq.com/) is an MQTT agent that provides Free Personal and Enterprise Edition versions. It is mainly used for enterprises, emerging machine-to-machine(M2M) communication and internal transmission to meet scalability, easy management and security features. HiveMQ provides an open source plug-in development kit. You can store data to TDengine via HiveMQ extension-TDengine. Refer to the [HiveMQ extension-TDengine documentation](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md) for more details. \ No newline at end of file +[HiveMQ](https://www.hivemq.com/) is an MQTT agent that provides Free Personal and Enterprise Edition versions. It is mainly used for enterprises, emerging machine-to-machine(M2M) communication and internal transmission to meet scalability, easy management and security features. HiveMQ provides an open source plug-in development kit. You can store data to TDengine via HiveMQ extension-TDengine. Refer to the [HiveMQ extension-TDengine documentation](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md) for more details. diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 1828cda348d0140cce35a648e3e86d05d61c7442..324a9ba9e9d938b8675b64477549d87573e74549 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2759,7 +2759,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col if (pItem->pNode->Expr.paramList == NULL || (functionId != TSDB_FUNC_LEASTSQR && functionId != TSDB_FUNC_DERIVATIVE && functionId != TSDB_FUNC_ELAPSED && numOfParams != 1) || ((functionId == TSDB_FUNC_LEASTSQR || functionId == TSDB_FUNC_DERIVATIVE) && numOfParams != 3) || - (functionId == TSDB_FUNC_ELAPSED && numOfParams > 2)) { + (functionId == TSDB_FUNC_ELAPSED && numOfParams != 1 && numOfParams != 2)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -6277,7 +6277,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq const char* msg0 = "only one column allowed in orderby"; const char* msg1 = "invalid column name in orderby clause"; const char* msg2 = "too many order by columns"; - const char* msg3 = "only primary timestamp/column in groupby clause allowed as order column"; + const char* msg3 = "only primary timestamp, first tag/tbname in groupby clause allowed as order column"; const char* msg4 = "only tag in groupby clause allowed in order clause"; const char* msg5 = "only primary timestamp/column in top/bottom function allowed as order column"; const char* msg6 = "only primary timestamp allowed as the second order column"; diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 5f8964bb34b5939ab768877cb8ae701e20443f75..bcec2ffc57ba46aea9ffd222aa3bf3d3415ab0de 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -3783,7 +3783,7 @@ void tscSetQuerySort(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr) { size_t size = taosArrayGetSize(pQueryInfo->pUpstream); for(int32_t i = 0; i < size; ++i) { SQueryInfo* pq = taosArrayGetP(pQueryInfo->pUpstream, i); - if (pq->groupbyTag && pq->interval.interval > 0) { + if (pq->groupbyTag) { pQueryAttr->needSort = true; return; } diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index bbd448e2d8b5069fae438d7adb9de14a31446d1b..7041c922d9b8ff32d6c1340fe313769cf4cf9729 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -113,7 +113,7 @@ int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncry SRpcObj rpcObj; memset(&rpcObj, 0, sizeof(rpcObj)); - strncpy(rpcObj.key, key, strlen(key)); + tstrncpy(rpcObj.key, key, sizeof(rpcObj.key)); rpcObj.pDnodeConn = rpcOpen(&rpcInit); if (rpcObj.pDnodeConn == NULL) { pthread_mutex_unlock(&rpcObjMutex); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index e2263f696a885e885091e86c6b1210bc817996c2..874a022a7104860fce8f6389bcc933b36a2fef22 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4928,7 +4928,11 @@ int32_t createProjectionExpr(SQueryInfo* pQueryInfo, STableMetaInfo* pTableMetaI } } - pse->colInfo.flag = pSource->base.colInfo.flag; //TSDB_COL_NORMAL; + if (!pQueryInfo->stableQuery && TSDB_COL_IS_TAG(pSource->base.colInfo.flag)) { + pse->colInfo.flag = (pSource->base.colInfo.flag) & (~TSDB_COL_TAG); + } else { + pse->colInfo.flag = pSource->base.colInfo.flag; + } pse->resType = pSource->base.resType; pse->resBytes = pSource->base.resBytes; strncpy(pse->colInfo.name, pSource->base.aliasName, tListLen(pse->colInfo.name)); @@ -5558,7 +5562,7 @@ end: int8_t jsonType2DbType(double data, int jsonType){ switch(jsonType){ case cJSON_Number: - if (data - (int64_t)data > 0) return TSDB_DATA_TYPE_DOUBLE; else return TSDB_DATA_TYPE_BIGINT; + if (data - (int64_t)data == 0) return TSDB_DATA_TYPE_BIGINT; else return TSDB_DATA_TYPE_DOUBLE; case cJSON_String: return TSDB_DATA_TYPE_NCHAR; case cJSON_NULL: diff --git a/src/common/inc/tvariant.h b/src/common/inc/tvariant.h index 31bc7a247ad9851aa48d99a3c6eec31e90313972..23fd601090bc24606e22b7bc99f7fbf52bd4ac34 100644 --- a/src/common/inc/tvariant.h +++ b/src/common/inc/tvariant.h @@ -39,7 +39,9 @@ typedef struct tVariant { bool tVariantIsValid(tVariant *pVar); -void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape); +void tVariantCreate(tVariant *pVar, SStrToken *token); + +void tVariantCreateExt(tVariant *pVar, SStrToken *token, int32_t optrType, bool needRmquoteEscape); void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32_t type); diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 68ed5c5c109cdfacb5ffac50e4f424ec431b78a0..33b93cfde482e67667e463b13a95be33db785462 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -16,6 +16,7 @@ #include "hash.h" #include "taos.h" +#include "taoserror.h" #include "taosdef.h" #include "ttoken.h" #include "ttokendef.h" @@ -30,7 +31,11 @@ assert(0); \ } while (0) -void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) { +void tVariantCreate(tVariant *pVar, SStrToken *token) { + tVariantCreateExt(pVar, token, TK_ID, true); +} + +void tVariantCreateExt(tVariant *pVar, SStrToken *token, int32_t optrType, bool needRmquoteEscape) { int32_t ret = 0; int32_t type = token->type; @@ -54,7 +59,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) { case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_INT:{ ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true); - if (ret != 0) { + if (ret != TSDB_CODE_SUCCESS) { SStrToken t = {0}; tGetToken(token->z, &t.type); if (t.type == TK_MINUS) { // it is a signed number which is greater than INT64_MAX or less than INT64_MIN @@ -64,7 +69,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) { // data overflow, try unsigned parse the input number ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, false); - if (ret != 0) { + if (ret != TSDB_CODE_SUCCESS) { pVar->nType = -1; // -1 means error type return; } @@ -85,15 +90,29 @@ void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) { break; } case TSDB_DATA_TYPE_TIMESTAMP: { - pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO); - break; - } - + if (optrType == TK_NOW) { + pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + } else if (optrType == TK_PLUS || optrType == TK_MINUS) { + char unit = 0; + ret = parseAbsoluteDuration(token->z, token->n, &pVar->i64, &unit, TSDB_TIME_PRECISION_NANO); + if (ret != TSDB_CODE_SUCCESS) { + pVar->nType = -1; // -1 means error type + return; + } + if (optrType == TK_PLUS) { + pVar->i64 += taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + } else { + pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO) - pVar->i64; + } + } + break; + } + default: { // nType == 0 means the null value type = TSDB_DATA_TYPE_NULL; } } - + pVar->nType = type; } @@ -164,7 +183,7 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32 pVar->wpz = calloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE); memcpy(pVar->wpz, pz, lenInwchar * TSDB_NCHAR_SIZE); pVar->nLen = (int32_t)len; - + break; } case TSDB_DATA_TYPE_JSON:{ @@ -179,18 +198,18 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32 pVar->nLen = (int32_t)len; break; } - + default: pVar->i64 = GET_INT32_VAL(pz); pVar->nLen = tDataTypes[TSDB_DATA_TYPE_INT].bytes; } - + pVar->nType = type; } void tVariantDestroy(tVariant *pVar) { if (pVar == NULL) return; - + if (pVar->nType == TSDB_DATA_TYPE_BINARY || pVar->nType == TSDB_DATA_TYPE_NCHAR || pVar->nType == TSDB_DATA_TYPE_JSON) { tfree(pVar->pz); pVar->nLen = 0; @@ -248,7 +267,7 @@ bool tVariantTypeMatch(tVariant *pVar, int8_t dbType){ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) { if (pSrc == NULL || pDst == NULL) return; - + pDst->nType = pSrc->nType; if (pSrc->nType == TSDB_DATA_TYPE_BINARY || pSrc->nType == TSDB_DATA_TYPE_NCHAR || pSrc->nType == TSDB_DATA_TYPE_JSON) { int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE; @@ -332,14 +351,14 @@ int32_t tVariantCompare(const tVariant* p1, const tVariant* p2) { int32_t tVariantToString(tVariant *pVar, char *dst) { if (pVar == NULL || dst == NULL) return 0; - + switch (pVar->nType) { case TSDB_DATA_TYPE_BINARY: { int32_t len = sprintf(dst, "\'%s\'", pVar->pz); assert(len <= pVar->nLen + sizeof("\'") * 2); // two more chars return len; } - + case TSDB_DATA_TYPE_NCHAR: { dst[0] = '\''; taosUcs4ToMbs(pVar->wpz, (twcslen(pVar->wpz) + 1) * TSDB_NCHAR_SIZE, dst + 1); @@ -348,7 +367,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) { dst[len + 1] = 0; return len + 1; } - + case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_SMALLINT: @@ -357,7 +376,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) { case TSDB_DATA_TYPE_USMALLINT: case TSDB_DATA_TYPE_UINT: return sprintf(dst, "%d", (int32_t)pVar->i64); - + case TSDB_DATA_TYPE_BIGINT: return sprintf(dst, "%" PRId64, pVar->i64); case TSDB_DATA_TYPE_UBIGINT: @@ -365,7 +384,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) { case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_DOUBLE: return sprintf(dst, "%.9lf", pVar->dKey); - + default: return 0; } @@ -403,21 +422,21 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { if (*pDest == pVariant->pz) { pBuf = calloc(1, INITIAL_ALLOC_SIZE); } - + if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) { size_t newSize = pVariant->nLen * TSDB_NCHAR_SIZE; if (pBuf != NULL) { if (newSize >= INITIAL_ALLOC_SIZE) { pBuf = realloc(pBuf, newSize + 1); } - + taosUcs4ToMbs(pVariant->wpz, (int32_t)newSize, pBuf); free(pVariant->wpz); pBuf[newSize] = 0; } else { taosUcs4ToMbs(pVariant->wpz, (int32_t)newSize, *pDest); } - + } else { if (IS_SIGNED_NUMERIC_TYPE(pVariant->nType)) { sprintf(pBuf == NULL ? *pDest : pBuf, "%" PRId64, pVariant->i64); @@ -429,18 +448,18 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { setNull(pBuf == NULL ? *pDest : pBuf, TSDB_DATA_TYPE_BINARY, 0); } } - + if (pBuf != NULL) { *pDest = pBuf; } - + *pDestSize = (int32_t)strlen(*pDest); return 0; } static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { char tmpBuf[40] = {0}; - + char * pDst = tmpBuf; int32_t nLen = 0; @@ -778,7 +797,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc if (converted) { *converted = true; } - + if (value > FLT_MAX || value < -FLT_MAX) { SET_EXT_INFO(converted, value, -FLT_MAX, FLT_MAX, extInfo); return -1; @@ -789,8 +808,8 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc if (converted) { *converted = true; } - - if (pVariant->i64 > FLT_MAX || pVariant->i64 < -FLT_MAX) { + + if (pVariant->i64 > FLT_MAX || pVariant->i64 < -FLT_MAX) { SET_EXT_INFO(converted, pVariant->i64, -FLT_MAX, FLT_MAX, extInfo); return -1; } @@ -800,12 +819,12 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc if (converted) { *converted = true; } - - if (pVariant->dKey > FLT_MAX || pVariant->dKey < -FLT_MAX) { + + if (pVariant->dKey > FLT_MAX || pVariant->dKey < -FLT_MAX) { SET_EXT_INFO(converted, pVariant->dKey, -FLT_MAX, FLT_MAX, extInfo); return -1; } - + SET_FLOAT_VAL(payload, pVariant->dKey); } else if (pVariant->nType == TSDB_DATA_TYPE_NULL) { *((uint32_t *)payload) = TSDB_DATA_FLOAT_NULL; @@ -850,7 +869,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc break; } - + case TSDB_DATA_TYPE_BINARY:{ if (!includeLengthPrefix) { if (pVariant->nType == TSDB_DATA_TYPE_NULL) { @@ -921,7 +940,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc assert(p == varDataVal(payload)); } } - + break; } case TSDB_DATA_TYPE_JSON:{ @@ -935,7 +954,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc break; } } - + return 0; } @@ -950,13 +969,13 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { if (pVariant == NULL || pVariant->nType == 0) { // value is not set return 0; } - + switch (type) { case TSDB_DATA_TYPE_BOOL: { // bool if (convertToBool(pVariant, &pVariant->i64) < 0) { return -1; } - + pVariant->nType = type; break; } @@ -977,7 +996,7 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { free(pVariant->pz); return -1; } - + free(pVariant->pz); pVariant->dKey = v; } else if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) { @@ -987,14 +1006,14 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { free(pVariant->pz); return -1; } - + free(pVariant->pz); pVariant->dKey = v; } else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { double tmp = (double) pVariant->i64; pVariant->dKey = tmp; } - + pVariant->nType = TSDB_DATA_TYPE_DOUBLE; break; } @@ -1015,6 +1034,6 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { break; } } - + return 0; } diff --git a/src/connector/go b/src/connector/go index 25f8683ece07897fea12c347d369602b2235665f..7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4 160000 --- a/src/connector/go +++ b/src/connector/go @@ -1 +1 @@ -Subproject commit 25f8683ece07897fea12c347d369602b2235665f +Subproject commit 7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4 diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java index afba0398752f1fd6c23dd7874301be27616fdab2..501c7e17c837ce311ec0f7b43f63122e53b8a0d9 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java @@ -1,19 +1,19 @@ package com.taosdata.jdbc; -import com.google.common.collect.Lists; -import org.checkerframework.checker.units.qual.A; +import com.taosdata.jdbc.annotation.CatalogRunner; +import com.taosdata.jdbc.annotation.Description; +import com.taosdata.jdbc.annotation.TestTarget; import org.junit.*; +import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import java.sql.*; -import java.util.List; -/** - * test json tag - */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) +@RunWith(CatalogRunner.class) +@TestTarget(alias = "JsonTag", author = "huolibo", version = "2.0.36") public class JsonTagTest { - private static String dbname = "json_tag_test"; + private static final String dbName = "json_tag_test"; private static Connection connection; private static Statement statement; private static final String superSql = "create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)"; @@ -74,6 +74,7 @@ public class JsonTagTest { }; @Test + @Description("insert json tag") public void case01_InsertTest() throws SQLException { for (String sql : sql) { statement.execute(sql); @@ -87,7 +88,8 @@ public class JsonTagTest { } @Test - public void case02_InvalidJsonInsertTest() { + @Description("error json tag insert") + public void case02_ErrorJsonInsertTest() { int count = 0; for (String sql : errorJsonInsertSql) { try { @@ -99,59 +101,62 @@ public class JsonTagTest { Assert.assertEquals(errorJsonInsertSql.length, count); } - // test invalidate json key, key must can be printed assic char @Test(expected = SQLException.class) + @Description("exception will throw when json value is array") public void case02_ArrayErrorTest() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":[1,true]}')"); } @Test(expected = SQLException.class) - public void case02_EmptyKeyErrorTest() throws SQLException { - statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\":\"fff\"}')"); - } - - @Test(expected = SQLException.class) + @Description("exception will throw when json value is empty") public void case02_EmptyValueErrorTest() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":{}}')"); } @Test(expected = SQLException.class) + @Description("exception will throw when json key is not ASCII") public void case02_AbnormalKeyErrorTest1() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"。loc\":\"fff\"}')"); } @Test(expected = SQLException.class) + @Description("exception will throw when json key is '\\t'") public void case02_AbnormalKeyErrorTest2() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\t\":\"fff\"}')"); } @Test(expected = SQLException.class) + @Description("exception will throw when json key is chinese") public void case02_AbnormalKeyErrorTest3() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"试试\":\"fff\"}')"); } @Test + @Description("alter json tag") public void case03_AlterTag() throws SQLException { statement.execute("ALTER TABLE jsons1_1 SET TAG jtag='{\"tag1\":\"femail\",\"tag2\":35,\"tag3\":true}'"); } @Test(expected = SQLException.class) + @Description("exception will throw when add json tag") public void case03_AddTagErrorTest() throws SQLException { statement.execute("ALTER STABLE jsons1 add tag tag2 nchar(20)"); } @Test(expected = SQLException.class) + @Description("exception will throw when delete json tag") public void case03_dropTagErrorTest() throws SQLException { statement.execute("ALTER STABLE jsons1 drop tag jtag"); } @Test(expected = SQLException.class) + @Description("exception will throw when set some json tag value") public void case03_AlterTagErrorTest() throws SQLException { statement.execute("ALTER TABLE jsons1_1 SET TAG jtag=4"); } - // test error syntax @Test + @Description("exception will throw when select syntax error") public void case04_SelectErrorTest() { int count = 0; for (String sql : errorSelectSql) { @@ -164,8 +169,8 @@ public class JsonTagTest { Assert.assertEquals(errorSelectSql.length, count); } - // test select normal column @Test + @Description("normal select stable") public void case04_select01() throws SQLException { ResultSet resultSet = statement.executeQuery("select dataint from jsons1"); int count = 0; @@ -176,8 +181,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag @Test + @Description("select all column from stable") public void case04_select02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1"); int count = 0; @@ -189,6 +194,7 @@ public class JsonTagTest { } @Test + @Description("select json tag from stable") public void case04_select03() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1"); int count = 0; @@ -200,6 +206,7 @@ public class JsonTagTest { } @Test + @Description("where condition tag is null") public void case04_select04() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1 where jtag is null"); int count = 0; @@ -211,6 +218,7 @@ public class JsonTagTest { } @Test + @Description("where condition tag is not null") public void case04_select05() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1 where jtag is not null"); int count = 0; @@ -222,6 +230,7 @@ public class JsonTagTest { } @Test + @Description("select json tag") public void case04_select06() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1_8"); resultSet.next(); @@ -231,6 +240,7 @@ public class JsonTagTest { } @Test + @Description("select json tag") public void case04_select07() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1_1"); resultSet.next(); @@ -239,8 +249,8 @@ public class JsonTagTest { close(resultSet); } - // test jtag is NULL @Test + @Description("select not exist json tag") public void case04_select08() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1_9"); resultSet.next(); @@ -249,8 +259,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is string @Test + @Description("select a json tag") public void case04_select09() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_1"); resultSet.next(); @@ -260,6 +270,7 @@ public class JsonTagTest { } @Test + @Description("select a json tag, the value is empty") public void case04_select10() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag2' from jsons1_6"); resultSet.next(); @@ -268,8 +279,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is int @Test + @Description("select a json tag, the value is int") public void case04_select11() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag2' from jsons1_1"); resultSet.next(); @@ -278,8 +289,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is bool @Test + @Description("select a json tag, the value is boolean") public void case04_select12() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag3' from jsons1_1"); resultSet.next(); @@ -288,8 +299,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is null @Test + @Description("select a json tag, the value is null") public void case04_select13() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_4"); resultSet.next(); @@ -298,8 +309,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is double @Test + @Description("select a json tag, the value is double") public void case04_select14() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_5"); resultSet.next(); @@ -308,8 +319,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', key is not exist @Test + @Description("select a json tag, the key is not exist") public void case04_select15() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag10' from jsons1_4"); resultSet.next(); @@ -319,6 +330,7 @@ public class JsonTagTest { } @Test + @Description("select a json tag, the result number equals tables number") public void case04_select16() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1"); int count = 0; @@ -330,18 +342,7 @@ public class JsonTagTest { } @Test - public void case04_select17() throws SQLException { - ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1"); - int count = 0; - while (resultSet.next()) { - count++; - } - Assert.assertEquals(sql.length + invalidJsonCreateSql.length + invalidJsonInsertSql.length, count); - close(resultSet); - } - - // where json value is string - @Test + @Description("where condition '=' for string") public void case04_select19() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'='beijing'"); int count = 0; @@ -353,6 +354,7 @@ public class JsonTagTest { } @Test + @Description("select and where conditon '=' for string") public void case04_select20() throws SQLException { ResultSet resultSet = statement.executeQuery("select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'"); int count = 0; @@ -364,6 +366,7 @@ public class JsonTagTest { } @Test + @Description("where condition result is null") public void case04_select21() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='beijing'"); int count = 0; @@ -375,6 +378,7 @@ public class JsonTagTest { } @Test + @Description("where condition equation has chinese") public void case04_select23() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='收到货'"); int count = 0; @@ -386,6 +390,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>' for character") public void case05_symbolOperation01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'>'beijing'"); int count = 0; @@ -397,6 +402,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>=' for character") public void case05_symbolOperation02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'>='beijing'"); int count = 0; @@ -408,6 +414,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<' for character") public void case05_symbolOperation03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'<'beijing'"); int count = 0; @@ -419,6 +426,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<=' in character") public void case05_symbolOperation04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'<='beijing'"); int count = 0; @@ -430,6 +438,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' in character") public void case05_symbolOperation05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'!='beijing'"); int count = 0; @@ -441,6 +450,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '=' empty") public void case05_symbolOperation06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'=''"); int count = 0; @@ -453,11 +463,11 @@ public class JsonTagTest { // where json value is int @Test + @Description("where condition support '=' for int") public void case06_selectValue01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=5"); int count = 0; while (resultSet.next()) { - System.out.println(resultSet.getString(1)); count++; } Assert.assertEquals(1, count); @@ -465,6 +475,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '<' for int") public void case06_selectValue02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<54"); int count = 0; @@ -476,6 +487,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<=' for int") public void case06_selectValue03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<=11"); int count = 0; @@ -487,6 +499,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '>' for int") public void case06_selectValue04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>4"); int count = 0; @@ -498,6 +511,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>=' for int") public void case06_selectValue05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>=5"); int count = 0; @@ -509,6 +523,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '!=' for int") public void case06_selectValue06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=5"); int count = 0; @@ -520,6 +535,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '!=' for int") public void case06_selectValue07() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=55"); int count = 0; @@ -531,6 +547,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '!=' for int and result is nothing") public void case06_selectValue08() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=10"); int count = 0; @@ -541,8 +558,8 @@ public class JsonTagTest { close(resultSet); } - // where json value is double @Test + @Description("where condition support '=' for double") public void case07_selectValue01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=1.232"); int count = 0; @@ -554,6 +571,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<' for double") public void case07_doubleOperation01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<1.232"); int count = 0; @@ -565,6 +583,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<=' for double") public void case07_doubleOperation02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<=1.232"); int count = 0; @@ -576,6 +595,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>' for double") public void case07_doubleOperation03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>1.23"); int count = 0; @@ -587,6 +607,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>=' for double") public void case07_doubleOperation04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>=1.232"); int count = 0; @@ -598,6 +619,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' for double") public void case07_doubleOperation05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=1.232"); int count = 0; @@ -609,6 +631,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' for double") public void case07_doubleOperation06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=3.232"); int count = 0; @@ -620,16 +643,19 @@ public class JsonTagTest { } @Test(expected = SQLException.class) + @Description("exception will throw when denominator is zero") public void case07_doubleOperation07() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1'/0=3"); } @Test(expected = SQLException.class) + @Description("exception will throw when invalid operation") public void case07_doubleOperation08() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1'/5=1"); } @Test + @Description("where condition support '=' for boolean") public void case08_boolOperation01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=true"); int count = 0; @@ -641,6 +667,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '=' for boolean") public void case08_boolOperation02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false"); int count = 0; @@ -652,6 +679,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' for boolean") public void case08_boolOperation03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=false"); int count = 0; @@ -663,12 +691,13 @@ public class JsonTagTest { } @Test(expected = SQLException.class) + @Description("exception will throw when '>' operation for boolean") public void case08_boolOperation04() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1'>false"); } - // where json value is null @Test + @Description("where conditional support '=null'") public void case09_select01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=null"); int count = 0; @@ -680,6 +709,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support 'is null'") public void case09_select02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag is null"); int count = 0; @@ -691,6 +721,7 @@ public class JsonTagTest { } @Test + @Description("where condition support 'is not null'") public void case09_select03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag is not null"); int count = 0; @@ -702,6 +733,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag '='") public void case09_select04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag_no_exist'=3"); int count = 0; @@ -713,6 +745,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag 'is null'") public void case09_select05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' is null"); int count = 0; @@ -724,6 +757,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag 'is null'") public void case09_select06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag4' is null"); int count = 0; @@ -735,6 +769,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag 'is not null'") public void case09_select07() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag3' is not null"); int count = 0; @@ -745,8 +780,8 @@ public class JsonTagTest { close(resultSet); } - // test ? @Test + @Description("contains") public void case09_select10() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag1'"); int count = 0; @@ -758,6 +793,7 @@ public class JsonTagTest { } @Test + @Description("contains") public void case09_select11() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag3'"); int count = 0; @@ -769,6 +805,7 @@ public class JsonTagTest { } @Test + @Description("contains with no exist tag") public void case09_select12() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag_no_exist'"); int count = 0; @@ -779,8 +816,8 @@ public class JsonTagTest { close(resultSet); } - // test json tag in where condition with and/or @Test + @Description("where condition with and") public void case10_selectAndOr01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'"); int count = 0; @@ -792,6 +829,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'or'") public void case10_selectAndOr02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'"); int count = 0; @@ -803,6 +841,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'and'") public void case10_selectAndOr03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'"); int count = 0; @@ -814,6 +853,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'or'") public void case10_selectAndOr04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35"); int count = 0; @@ -825,6 +865,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'or' and contains") public void case10_selectAndOr05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' is not null and jtag contains 'tag3'"); int count = 0; @@ -836,6 +877,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'and' and contains") public void case10_selectAndOr06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='femail' and jtag contains 'tag3'"); int count = 0; @@ -846,8 +888,8 @@ public class JsonTagTest { close(resultSet); } - // test with tbname/normal column @Test + @Description("test with tbname/normal column") public void case11_selectTbName01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1'"); int count = 0; @@ -859,6 +901,7 @@ public class JsonTagTest { } @Test + @Description("test with tbname/normal column") public void case11_selectTbName02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3'"); int count = 0; @@ -870,6 +913,7 @@ public class JsonTagTest { } @Test + @Description("test with tbname/normal column") public void case11_selectTbName03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=3"); int count = 0; @@ -881,6 +925,7 @@ public class JsonTagTest { } @Test + @Description("test with tbname/normal column") public void case11_selectTbName04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=23"); int count = 0; @@ -891,8 +936,8 @@ public class JsonTagTest { close(resultSet); } - // test where condition like @Test + @Description("where condition like") public void case12_selectWhere01() throws SQLException { ResultSet resultSet = statement.executeQuery("select *,tbname from jsons1 where jtag->'tag2' like 'bei%'"); int count = 0; @@ -904,6 +949,7 @@ public class JsonTagTest { } @Test + @Description("where condition like") public void case12_selectWhere02() throws SQLException { ResultSet resultSet = statement.executeQuery("select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null"); int count = 0; @@ -914,14 +960,14 @@ public class JsonTagTest { close(resultSet); } - // test where condition in no support in @Test(expected = SQLException.class) + @Description("where condition in no support in") public void case12_selectWhere03() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1' in ('beijing')"); } - // test where condition match @Test + @Description("where condition match") public void case12_selectWhere04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match 'ma'"); int count = 0; @@ -933,6 +979,7 @@ public class JsonTagTest { } @Test + @Description("where condition match") public void case12_selectWhere05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match 'ma$'"); int count = 0; @@ -944,6 +991,7 @@ public class JsonTagTest { } @Test + @Description("where condition match") public void case12_selectWhere06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2' match 'jing$'"); int count = 0; @@ -955,6 +1003,7 @@ public class JsonTagTest { } @Test + @Description("where condition match") public void case12_selectWhere07() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match '收到'"); int count = 0; @@ -965,13 +1014,14 @@ public class JsonTagTest { close(resultSet); } - // test distinct @Test + @Description("insert distinct") public void case13_selectDistinct01() throws SQLException { statement.execute("insert into jsons1_14 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '你就会', 'dws')"); } @Test + @Description("distinct json tag") public void case13_selectDistinct02() throws SQLException { ResultSet resultSet = statement.executeQuery("select distinct jtag->'tag1' from jsons1"); int count = 0; @@ -983,6 +1033,7 @@ public class JsonTagTest { } @Test + @Description("distinct json tag") public void case13_selectDistinct03() throws SQLException { ResultSet resultSet = statement.executeQuery("select distinct jtag from jsons1"); int count = 0; @@ -993,13 +1044,14 @@ public class JsonTagTest { close(resultSet); } - // test dumplicate key with normal colomn @Test + @Description("insert json tag") public void case14_selectDump01() throws SQLException { statement.execute("INSERT INTO jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"datastr\":\"是是是\"}') values(1591060828000, 4, false, 'jjsf', \"你就会\")"); } @Test + @Description("test duplicate key with normal column") public void case14_selectDump02() throws SQLException { ResultSet resultSet = statement.executeQuery("select *,tbname,jtag from jsons1 where jtag->'datastr' match '是' and datastr match 'js'"); int count = 0; @@ -1011,6 +1063,7 @@ public class JsonTagTest { } @Test + @Description("test duplicate key with normal column") public void case14_selectDump03() throws SQLException { ResultSet resultSet = statement.executeQuery("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'"); int count = 0; @@ -1021,8 +1074,8 @@ public class JsonTagTest { close(resultSet); } - // test join @Test + @Description("insert json tag for join test") public void case15_selectJoin01() throws SQLException { statement.execute("create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)"); statement.execute("insert into jsons2_1 using jsons2 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 2, false, 'json2', '你是2')"); @@ -1033,17 +1086,17 @@ public class JsonTagTest { statement.execute("insert into jsons3_2 using jsons3 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060638000, 2, true, 'json3', 'sss')"); } - // TODO check result @Test + @Description("select json tag from join") public void case15_selectJoin02() throws SQLException { ResultSet resultSet = statement.executeQuery("select 'sss',33,a.jtag->'tag3' from jsons2 a,jsons3 b where a.ts=b.ts and a.jtag->'tag1'=b.jtag->'tag1'"); - + resultSet.next(); + Assert.assertEquals("sss", resultSet.getString(1)); close(resultSet); } - // test group by & order by json tag - // TODO check other result @Test + @Description("group by and order by json tag desc") public void case16_selectGroupOrder01() throws SQLException { ResultSet resultSet = statement.executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc"); int count = 0; @@ -1055,6 +1108,7 @@ public class JsonTagTest { } @Test + @Description("group by and order by json tag asc") public void case16_selectGroupOrder02() throws SQLException { ResultSet resultSet = statement.executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc"); int count = 0; @@ -1065,9 +1119,8 @@ public class JsonTagTest { close(resultSet); } - // test stddev with group by json tag - // TODO check result @Test + @Description("stddev with group by json tag") public void case17_selectStddev01() throws SQLException { ResultSet resultSet = statement.executeQuery("select stddev(dataint) from jsons1 group by jtag->'tag1'"); String s = ""; @@ -1082,8 +1135,8 @@ public class JsonTagTest { close(resultSet); } - // subquery with json tag @Test + @Description("subquery json tag") public void case18_selectSubquery01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from (select jtag, dataint from jsons1)"); int count = 0; @@ -1095,8 +1148,14 @@ public class JsonTagTest { } @Test + @Description("subquery some json tags") public void case18_selectSubquery02() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)"); + + ResultSetMetaData metaData = resultSet.getMetaData(); + String columnName = metaData.getColumnName(1); + Assert.assertEquals("jtag->'tag1'", columnName); + int count = 0; while (resultSet.next()) { count++; @@ -1106,15 +1165,7 @@ public class JsonTagTest { } @Test - public void case18_selectSubquery03() throws SQLException { - ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)"); - ResultSetMetaData metaData = resultSet.getMetaData(); - String columnName = metaData.getColumnName(1); - Assert.assertEquals("jtag->'tag1'", columnName); - close(resultSet); - } - - @Test + @Description("query some json tags from subquery") public void case18_selectSubquery04() throws SQLException { ResultSet resultSet = statement.executeQuery("select ts,tbname,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)"); int count = 0; @@ -1142,9 +1193,9 @@ public class JsonTagTest { try { connection = DriverManager.getConnection(url); statement = connection.createStatement(); - statement.execute("drop database if exists " + dbname); - statement.execute("create database if not exists " + dbname); - statement.execute("use " + dbname); + statement.execute("drop database if exists " + dbName); + statement.execute("create database if not exists " + dbName); + statement.execute("use " + dbName); statement.execute(superSql); } catch (SQLException e) { e.printStackTrace(); @@ -1155,7 +1206,7 @@ public class JsonTagTest { public static void afterClass() { try { if (null != statement) { - statement.execute("drop database " + dbname); + statement.execute("drop database " + dbName); statement.close(); } if (null != connection) { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java index a090dd10e3564d498ab807909f97aefb3b2f3466..712cc0c8c1b0b094a20db0fe36d33f553878d71d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java @@ -2,17 +2,23 @@ package com.taosdata.jdbc; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.taosdata.jdbc.annotation.CatalogRunner; +import com.taosdata.jdbc.annotation.Description; +import com.taosdata.jdbc.annotation.TestTarget; import com.taosdata.jdbc.enums.SchemalessProtocolType; import com.taosdata.jdbc.enums.SchemalessTimestampType; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import java.sql.*; import java.util.ArrayList; import java.util.List; +@RunWith(CatalogRunner.class) +@TestTarget(alias = "Schemaless",author = "huolibo", version = "2.0.36") public class SchemalessInsertTest { private final String dbname = "test_schemaless_insert"; private Connection conn; @@ -23,6 +29,7 @@ public class SchemalessInsertTest { * @throws SQLException execute error */ @Test + @Description("line insert") public void schemalessInsert() throws SQLException { // given String[] lines = new String[]{ @@ -53,6 +60,7 @@ public class SchemalessInsertTest { * @throws SQLException execute error */ @Test + @Description("telnet insert") public void telnetInsert() throws SQLException { // given String[] lines = new String[]{ @@ -87,6 +95,7 @@ public class SchemalessInsertTest { * @throws SQLException execute error */ @Test + @Description("json insert") public void jsonInsert() throws SQLException { // given String json = "[\n" + diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java new file mode 100644 index 0000000000000000000000000000000000000000..490346e401dba956c8743abb452bcc943df67904 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java @@ -0,0 +1,86 @@ +package com.taosdata.jdbc.annotation; + +import java.util.ArrayList; +import java.util.List; + +/** + * Test class + */ +public class CatalogClass { + + private String name; + private String alias; + private String author; + private String version; + private List methods = new ArrayList<>(); + private int total; + private int failure; + + public void setTotal(int total) { + this.total = total; + } + + public void setFailure(int failure) { + this.failure = failure; + } + + public void setAuthor(String author) { + this.author = author; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setName(String name) { + this.name = name; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public void setMethods(List methods) { + this.methods = methods; + } + + @Override + public String toString() { + if (methods.size() < 1) + return null; + StringBuilder sb = new StringBuilder(); + sb.append("ClassName: ").append(name); + String msg = trim(alias); + if (null != msg) + sb.append("\tAlias:").append(alias); + sb.append("\tTotal:").append(total) + .append("\tFailure:").append(failure).append("\n"); + for (CatalogMethod method : methods) { + sb.append("\t").append(method.getName()); + sb.append("\t").append(method.isSuccess()); + sb.append("\t").append(method.getMessage()); + String mAuthor = trim(method.getAuthor()); + if (null == mAuthor) { + sb.append("\t").append(author); + } else { + sb.append("\t").append(method.getAuthor()); + } + String mVersion = trim(method.getVersion()); + if (null == mVersion) { + sb.append("\t").append(version); + } else { + sb.append("\t").append(mVersion); + } + sb.append("\n"); + } + return sb.toString(); + } + + private String trim(String s) { + if (null == s || s.trim().equals("")) { + return null; + } else { + return s.trim(); + } + } +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java new file mode 100644 index 0000000000000000000000000000000000000000..2d22302d02f531eca055fa76dea18d8de9f7371f --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java @@ -0,0 +1,104 @@ +package com.taosdata.jdbc.annotation; + +import org.junit.runner.Description; +import org.junit.runner.Result; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunListener; + +import java.io.File; +import java.io.FileWriter; +import java.util.LinkedList; + +public class CatalogListener extends RunListener { + public static final String CATALOG_FILE = "target/TestCaseCatalog.txt"; + CatalogClass catalogClass = null; + private final LinkedList methods = new LinkedList<>(); + + @Override + public void testRunStarted(Description description) throws Exception { + catalogClass = new CatalogClass(); + TestTarget target = description.getAnnotation(TestTarget.class); + if (target != null) { + catalogClass.setAlias(target.alias()); + catalogClass.setAuthor(target.author()); + catalogClass.setVersion(target.version()); + } + catalogClass.setName(getClassName(description.getClassName())); + } + + private String getClassName(String name) { + if (null == name || name.trim().equals("")) { + return null; + } + name = name.trim(); + int pos = name.lastIndexOf("."); + if (-1 == pos) { + return name; + } + return name.substring(pos + 1); + } + + @Override + public void testRunFinished(Result result) throws Exception { + catalogClass.setMethods(methods); + catalogClass.setTotal(result.getRunCount()); + catalogClass.setFailure(result.getFailureCount()); + File file = new File(CATALOG_FILE); + if (!file.exists()) { + synchronized (CatalogListener.class) { + if (!file.exists()) { + file.createNewFile(); + try (FileWriter writer = new FileWriter(file, true)) { + writer.write("\tName\tPass\tMessage\tAuthor\tVersion\n"); + writer.write(catalogClass.toString()); + } + } + } + } else { + try (FileWriter writer = new FileWriter(file, true)) { + writer.write(catalogClass.toString()); + } + } + } + + @Override + public void testStarted(Description description) throws Exception { + } + + @Override + public void testFinished(Description description) throws Exception { + com.taosdata.jdbc.annotation.Description annotation + = description.getAnnotation(com.taosdata.jdbc.annotation.Description.class); + if (annotation != null) { + CatalogMethod method = new CatalogMethod(); + method.setMessage(annotation.value()); + method.setAuthor(annotation.author()); + method.setVersion(annotation.version()); + method.setSuccess(true); + method.setName(description.getMethodName()); + methods.addLast(method); + } + } + + @Override + public void testFailure(Failure failure) throws Exception { + com.taosdata.jdbc.annotation.Description annotation + = failure.getDescription().getAnnotation(com.taosdata.jdbc.annotation.Description.class); + CatalogMethod method = new CatalogMethod(); + method.setMessage(annotation.value()); + method.setAuthor(annotation.author()); + method.setVersion(annotation.version()); + method.setSuccess(false); + method.setName(failure.getDescription().getMethodName()); + methods.addFirst(method); + } + + @Override + public void testAssumptionFailure(Failure failure) { + } + + @Override + public void testIgnored(Description description) throws Exception { + super.testIgnored(description); + } +} \ No newline at end of file diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java new file mode 100644 index 0000000000000000000000000000000000000000..1dd074df2d1298781bbbfa7e7709113db2c6ca01 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java @@ -0,0 +1,52 @@ +package com.taosdata.jdbc.annotation; + +/** + * Test method + */ +public class CatalogMethod { + private String name; + private boolean success; + private String message; + private String author; + private String version; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java new file mode 100644 index 0000000000000000000000000000000000000000..08e5f9212287d517838448d0122ab0876812cc1d --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java @@ -0,0 +1,36 @@ +package com.taosdata.jdbc.annotation; + +import org.junit.internal.AssumptionViolatedException; +import org.junit.internal.runners.model.EachTestNotifier; +import org.junit.runner.notification.RunNotifier; +import org.junit.runner.notification.StoppedByUserException; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.InitializationError; +import org.junit.runners.model.Statement; + +public class CatalogRunner extends BlockJUnit4ClassRunner { + + public CatalogRunner(Class testClass) throws InitializationError { + super(testClass); + } + + @Override + public void run(RunNotifier notifier) { + //add user-defined listener + notifier.addListener(new CatalogListener()); + EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription()); + + notifier.fireTestRunStarted(getDescription()); + + try { + Statement statement = classBlock(notifier); + statement.evaluate(); + } catch (AssumptionViolatedException av) { + testNotifier.addFailedAssumption(av); + } catch (StoppedByUserException exception) { + throw exception; + } catch (Throwable e) { + testNotifier.addFailure(e); + } + } +} \ No newline at end of file diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java new file mode 100644 index 0000000000000000000000000000000000000000..669b0a088656c030281e82620117469b3a375c75 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java @@ -0,0 +1,19 @@ +package com.taosdata.jdbc.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface Description { + + String value(); + + // git blame author + String author() default ""; + + // since which version; + String version() default ""; +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java new file mode 100644 index 0000000000000000000000000000000000000000..3d1db681647d3b23818143156ffd513c46a6e495 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java @@ -0,0 +1,18 @@ +package com.taosdata.jdbc.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE}) +public @interface TestTarget { + + String alias() default ""; + + String author(); + + String version() default ""; + +} diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 5d73f48eb6378573bbecc8261790a18a147f2133..7d721d21a0b85bb3e7119977f74f3e05e69cc361 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -16,7 +16,6 @@ #ifndef TDENGINE_TTOKENDEF_H #define TDENGINE_TTOKENDEF_H - #define TK_ID 1 #define TK_BOOL 2 #define TK_TINYINT 3 @@ -139,12 +138,12 @@ #define TK_USING 120 #define TK_NULL 121 #define TK_NOW 122 -#define TK_SELECT 123 -#define TK_UNION 124 -#define TK_ALL 125 -#define TK_DISTINCT 126 -#define TK_FROM 127 -#define TK_VARIABLE 128 +#define TK_VARIABLE 123 +#define TK_SELECT 124 +#define TK_UNION 125 +#define TK_ALL 126 +#define TK_DISTINCT 127 +#define TK_FROM 128 #define TK_RANGE 129 #define TK_INTERVAL 130 #define TK_EVERY 131 @@ -219,7 +218,6 @@ #define TK_FILE 200 - #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/kit/taos-tools b/src/kit/taos-tools index 78519c0c90a261b6a559c6bbe7f3d3b5a7b630b4..0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0 160000 --- a/src/kit/taos-tools +++ b/src/kit/taos-tools @@ -1 +1 @@ -Subproject commit 78519c0c90a261b6a559c6bbe7f3d3b5a7b630b4 +Subproject commit 0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0 diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index b435722d2093ce6434fe38f1af2f743885b46249..7f0ca21c7a616198cbbf9956d373b3712ecbe1ec 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -253,7 +253,7 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); } intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); } -intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } +intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } %type keep {SArray*} %destructor keep {taosArrayDestroy($$);} @@ -438,39 +438,49 @@ column(A) ::= ids(X) typename(Y). { tagitemlist(A) ::= tagitemlist(X) COMMA tagitem(Y). { A = tVariantListAppend(X, &Y, -1); } tagitemlist(A) ::= tagitem(X). { A = tVariantListAppend(NULL, &X, -1); } -tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } -tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } -tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } -tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } -tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X, true); } -tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X, true);} +tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } +tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } +tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } +tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } +tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); } +tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreateExt(&A, &X, TK_NOW, true);} + +tagitem(A) ::= NOW PLUS VARIABLE(X).{ + X.type = TSDB_DATA_TYPE_TIMESTAMP; + tVariantCreateExt(&A, &X, TK_PLUS, true); +} + +tagitem(A) ::= NOW MINUS VARIABLE(X).{ + X.type = TSDB_DATA_TYPE_TIMESTAMP; + tVariantCreateExt(&A, &X, TK_MINUS, true); +} tagitem(A) ::= MINUS(X) INTEGER(Y).{ X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X, true); + tVariantCreate(&A, &X); } tagitem(A) ::= MINUS(X) FLOAT(Y). { X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X, true); + tVariantCreate(&A, &X); } tagitem(A) ::= PLUS(X) INTEGER(Y). { X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X, true); + tVariantCreate(&A, &X); } tagitem(A) ::= PLUS(X) FLOAT(Y). { X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X, true); + tVariantCreate(&A, &X); } //////////////////////// The SELECT statement ///////////////////////////////// @@ -609,7 +619,7 @@ fill_opt(N) ::= . { N = 0; } fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. { tVariant A = {0}; toTSDBType(Y.type); - tVariantCreate(&A, &Y, true); + tVariantCreate(&A, &Y); tVariantListInsert(X, &A, -1, 0); N = X; @@ -652,12 +662,12 @@ sortlist(A) ::= arrow(Y) sortorder(Z). { %type item {tVariant} item(A) ::= ID(X). { toTSDBType(X.type); - tVariantCreate(&A, &X, true); + tVariantCreate(&A, &X); } item(A) ::= ID(X) DOT ID(Y). { toTSDBType(X.type); X.n += (1+Y.n); - tVariantCreate(&A, &X, true); + tVariantCreate(&A, &X); } %type sortorder {int} diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index 4c61cbb0f730780c6c7106a02c765974b2d21706..6a19ca5c8d1e0c7f30da30c37c24c008ea34b2ee 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -588,6 +588,12 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { op = OP_Fill; taosArrayPush(plan, &op); } + // outer query order by support + int32_t orderColId = pQueryAttr->order.orderColId; + if (pQueryAttr->vgId == 0 && orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX && orderColId != INT32_MIN) { + op = OP_Order; + taosArrayPush(plan, &op); + } } } else if (pQueryAttr->groupbyColumn) { diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index f34f54710dfd259a338ad43e5d299eb0e6e2283d..166881346fb4bae0bcf97d0c325c52a03c44cb85 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -143,14 +143,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr if (optrType == TK_NULL) { if (pToken){ pToken->type = TSDB_DATA_TYPE_NULL; - tVariantCreate(&pSqlExpr->value, pToken, true); + tVariantCreate(&pSqlExpr->value, pToken); } pSqlExpr->tokenId = optrType; pSqlExpr->type = SQL_NODE_VALUE; } else if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) { if (pToken) { toTSDBType(pToken->type); - tVariantCreate(&pSqlExpr->value, pToken, true); + tVariantCreate(&pSqlExpr->value, pToken); } pSqlExpr->tokenId = optrType; pSqlExpr->type = SQL_NODE_VALUE; @@ -211,7 +211,7 @@ tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType) { if (optrType == TK_INTEGER || optrType == TK_STRING) { if (pToken) { toTSDBType(pToken->type); - tVariantCreate(&pSqlExpr->value, pToken, true); + tVariantCreate(&pSqlExpr->value, pToken); } pSqlExpr->tokenId = optrType; pSqlExpr->type = SQL_NODE_VALUE; @@ -599,7 +599,7 @@ SArray *tVariantListAppendToken(SArray *pList, SStrToken *pToken, uint8_t order, if (pToken) { tVariantListItem item; - tVariantCreate(&item.pVar, pToken, needRmquoteEscape); + tVariantCreateExt(&item.pVar, pToken, TK_ID, needRmquoteEscape); item.sortOrder = order; taosArrayPush(pList, &item); diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 0b8e9542742b9ab8b04d265c7cd6da0e482b7c92..c2d150911dc694ae6b9ab6e35f34207e86219a85 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -162,12 +162,12 @@ #define TK_USING 120 #define TK_NULL 121 #define TK_NOW 122 -#define TK_SELECT 123 -#define TK_UNION 124 -#define TK_ALL 125 -#define TK_DISTINCT 126 -#define TK_FROM 127 -#define TK_VARIABLE 128 +#define TK_VARIABLE 123 +#define TK_SELECT 124 +#define TK_UNION 125 +#define TK_ALL 126 +#define TK_DISTINCT 127 +#define TK_FROM 128 #define TK_RANGE 129 #define TK_INTERVAL 130 #define TK_EVERY 131 @@ -338,18 +338,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 390 -#define YYNRULE 313 -#define YYNRULE_WITH_ACTION 313 +#define YYNSTATE 393 +#define YYNRULE 315 +#define YYNRULE_WITH_ACTION 315 #define YYNTOKEN 201 -#define YY_MAX_SHIFT 389 -#define YY_MIN_SHIFTREDUCE 613 -#define YY_MAX_SHIFTREDUCE 925 -#define YY_ERROR_ACTION 926 -#define YY_ACCEPT_ACTION 927 -#define YY_NO_ACTION 928 -#define YY_MIN_REDUCE 929 -#define YY_MAX_REDUCE 1241 +#define YY_MAX_SHIFT 392 +#define YY_MIN_SHIFTREDUCE 617 +#define YY_MAX_SHIFTREDUCE 931 +#define YY_ERROR_ACTION 932 +#define YY_ACCEPT_ACTION 933 +#define YY_NO_ACTION 934 +#define YY_MIN_REDUCE 935 +#define YY_MAX_REDUCE 1249 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -416,94 +416,94 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (854) +#define YY_ACTTAB_COUNT (858) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 102, 664, 664, 1158, 161, 1159, 311, 804, 260, 665, - /* 10 */ 665, 807, 388, 241, 37, 38, 24, 41, 42, 1078, - /* 20 */ 1070, 263, 31, 30, 29, 1083, 1215, 40, 343, 45, - /* 30 */ 43, 46, 44, 1067, 1068, 55, 1071, 36, 35, 297, - /* 40 */ 298, 34, 33, 32, 37, 38, 213, 41, 42, 250, - /* 50 */ 84, 263, 31, 30, 29, 214, 1215, 40, 343, 45, - /* 60 */ 43, 46, 44, 927, 389, 1215, 256, 36, 35, 211, - /* 70 */ 215, 34, 33, 32, 292, 291, 128, 122, 133, 1215, - /* 80 */ 1215, 1218, 1217, 132, 1069, 138, 141, 131, 37, 38, - /* 90 */ 85, 41, 42, 977, 135, 263, 31, 30, 29, 664, - /* 100 */ 196, 40, 343, 45, 43, 46, 44, 665, 339, 286, - /* 110 */ 13, 36, 35, 1097, 101, 34, 33, 32, 37, 38, + /* 0 */ 102, 668, 668, 1166, 161, 1167, 312, 810, 260, 669, + /* 10 */ 669, 813, 391, 241, 37, 38, 24, 41, 42, 1084, + /* 20 */ 1076, 263, 31, 30, 29, 1089, 1223, 40, 344, 45, + /* 30 */ 43, 46, 44, 1073, 1074, 55, 1077, 36, 35, 298, + /* 40 */ 299, 34, 33, 32, 37, 38, 213, 41, 42, 250, + /* 50 */ 84, 263, 31, 30, 29, 214, 1223, 40, 344, 45, + /* 60 */ 43, 46, 44, 933, 392, 1223, 256, 36, 35, 211, + /* 70 */ 215, 34, 33, 32, 293, 292, 128, 122, 133, 1223, + /* 80 */ 1223, 1226, 1225, 132, 1075, 138, 141, 131, 37, 38, + /* 90 */ 85, 41, 42, 983, 135, 263, 31, 30, 29, 668, + /* 100 */ 196, 40, 344, 45, 43, 46, 44, 669, 340, 287, + /* 110 */ 13, 36, 35, 1105, 101, 34, 33, 32, 37, 38, /* 120 */ 58, 41, 42, 60, 246, 263, 31, 30, 29, 220, - /* 130 */ 285, 40, 343, 45, 43, 46, 44, 315, 97, 1215, - /* 140 */ 96, 36, 35, 664, 104, 34, 33, 32, 339, 37, - /* 150 */ 39, 665, 41, 42, 1097, 176, 263, 31, 30, 29, - /* 160 */ 1106, 856, 40, 343, 45, 43, 46, 44, 34, 33, - /* 170 */ 32, 244, 36, 35, 301, 221, 34, 33, 32, 206, - /* 180 */ 204, 202, 376, 59, 51, 1215, 201, 148, 147, 146, - /* 190 */ 145, 614, 615, 616, 617, 618, 619, 620, 621, 622, - /* 200 */ 623, 624, 625, 626, 627, 159, 987, 242, 38, 277, - /* 210 */ 41, 42, 59, 196, 263, 31, 30, 29, 281, 280, - /* 220 */ 40, 343, 45, 43, 46, 44, 978, 222, 243, 1103, - /* 230 */ 36, 35, 1081, 196, 34, 33, 32, 1215, 41, 42, - /* 240 */ 384, 1015, 263, 31, 30, 29, 1, 184, 40, 343, - /* 250 */ 45, 43, 46, 44, 387, 386, 641, 253, 36, 35, - /* 260 */ 700, 1081, 34, 33, 32, 67, 337, 383, 382, 336, - /* 270 */ 335, 334, 381, 333, 332, 331, 380, 330, 379, 378, - /* 280 */ 1046, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, - /* 290 */ 1043, 1044, 1045, 1047, 1048, 234, 871, 25, 862, 860, - /* 300 */ 865, 863, 1237, 866, 772, 59, 59, 769, 1207, 770, - /* 310 */ 861, 771, 864, 1206, 219, 1205, 234, 871, 1215, 59, - /* 320 */ 860, 227, 863, 1215, 866, 1215, 59, 144, 143, 142, - /* 330 */ 226, 239, 240, 788, 351, 91, 5, 62, 186, 268, - /* 340 */ 269, 3, 197, 185, 111, 116, 107, 115, 266, 91, - /* 350 */ 254, 355, 239, 240, 1081, 1081, 345, 45, 43, 46, - /* 360 */ 44, 59, 326, 271, 356, 36, 35, 785, 1081, 34, - /* 370 */ 33, 32, 68, 1229, 67, 1080, 383, 382, 36, 35, - /* 380 */ 47, 381, 34, 33, 32, 380, 68, 379, 378, 1054, - /* 390 */ 259, 1052, 1053, 10, 293, 284, 1055, 83, 264, 1169, - /* 400 */ 1056, 47, 1057, 1058, 235, 59, 357, 59, 59, 342, - /* 410 */ 1081, 158, 156, 155, 748, 872, 867, 1097, 792, 59, - /* 420 */ 130, 869, 868, 773, 774, 267, 100, 265, 59, 354, - /* 430 */ 353, 341, 376, 870, 245, 294, 872, 867, 88, 237, - /* 440 */ 273, 86, 270, 868, 361, 360, 366, 365, 262, 1215, - /* 450 */ 358, 215, 362, 363, 1081, 238, 1081, 1081, 1156, 215, - /* 460 */ 1157, 1215, 217, 1218, 364, 1215, 218, 105, 1081, 1215, - /* 470 */ 6, 1218, 1215, 368, 223, 288, 1215, 1081, 836, 216, - /* 480 */ 224, 225, 229, 230, 1215, 99, 231, 98, 228, 1215, - /* 490 */ 1215, 1215, 1215, 1215, 212, 248, 1215, 89, 1215, 1084, - /* 500 */ 272, 255, 257, 1072, 1215, 1084, 1084, 816, 817, 272, - /* 510 */ 272, 182, 272, 296, 295, 813, 823, 824, 341, 76, - /* 520 */ 183, 344, 79, 1082, 758, 318, 760, 320, 759, 163, - /* 530 */ 71, 48, 54, 347, 288, 314, 835, 900, 60, 60, - /* 540 */ 71, 103, 71, 873, 261, 348, 663, 15, 82, 14, - /* 550 */ 282, 9, 121, 1168, 120, 346, 17, 9, 16, 251, - /* 560 */ 9, 1165, 77, 80, 777, 321, 778, 19, 775, 18, - /* 570 */ 776, 160, 127, 21, 126, 20, 140, 139, 1164, 252, - /* 580 */ 747, 1105, 367, 26, 859, 1116, 1113, 178, 1114, 1118, - /* 590 */ 162, 1098, 167, 289, 307, 1079, 179, 1148, 1077, 1147, - /* 600 */ 1146, 1145, 180, 181, 992, 157, 323, 324, 325, 300, - /* 610 */ 328, 329, 803, 169, 69, 209, 65, 340, 986, 352, - /* 620 */ 1095, 247, 1236, 118, 302, 304, 81, 1235, 1232, 187, - /* 630 */ 359, 78, 168, 316, 1228, 124, 1227, 1224, 188, 1012, - /* 640 */ 28, 312, 172, 170, 171, 66, 61, 70, 210, 310, - /* 650 */ 876, 974, 134, 308, 972, 136, 137, 970, 969, 306, - /* 660 */ 274, 199, 299, 200, 966, 303, 965, 964, 963, 962, - /* 670 */ 961, 960, 203, 205, 327, 956, 954, 952, 207, 27, - /* 680 */ 949, 208, 945, 377, 129, 287, 87, 92, 305, 369, - /* 690 */ 370, 371, 372, 373, 374, 236, 375, 258, 322, 385, - /* 700 */ 925, 276, 924, 275, 232, 278, 279, 923, 173, 233, - /* 710 */ 991, 990, 112, 906, 113, 905, 283, 288, 317, 11, - /* 720 */ 290, 90, 968, 967, 780, 149, 959, 191, 190, 1013, - /* 730 */ 189, 192, 193, 195, 194, 2, 52, 150, 1014, 4, - /* 740 */ 1050, 151, 958, 951, 53, 152, 174, 177, 175, 950, - /* 750 */ 93, 812, 74, 1060, 810, 809, 806, 805, 75, 166, - /* 760 */ 814, 164, 249, 825, 165, 22, 819, 94, 63, 821, - /* 770 */ 95, 309, 346, 313, 12, 64, 23, 49, 319, 50, - /* 780 */ 104, 106, 109, 56, 108, 678, 713, 711, 710, 57, - /* 790 */ 110, 709, 707, 706, 705, 702, 668, 338, 114, 7, - /* 800 */ 897, 895, 875, 898, 874, 896, 8, 877, 350, 117, - /* 810 */ 72, 60, 349, 119, 73, 123, 750, 125, 749, 746, - /* 820 */ 694, 692, 684, 690, 686, 688, 682, 680, 716, 715, - /* 830 */ 714, 712, 708, 704, 703, 198, 666, 631, 929, 928, - /* 840 */ 928, 928, 928, 928, 928, 928, 928, 928, 928, 928, - /* 850 */ 928, 928, 153, 154, + /* 130 */ 286, 40, 344, 45, 43, 46, 44, 316, 97, 1223, + /* 140 */ 96, 36, 35, 668, 104, 34, 33, 32, 340, 37, + /* 150 */ 39, 669, 41, 42, 1105, 176, 263, 31, 30, 29, + /* 160 */ 1114, 862, 40, 344, 45, 43, 46, 44, 34, 33, + /* 170 */ 32, 244, 36, 35, 302, 221, 34, 33, 32, 206, + /* 180 */ 204, 202, 379, 59, 51, 1223, 201, 148, 147, 146, + /* 190 */ 145, 618, 619, 620, 621, 622, 623, 624, 625, 626, + /* 200 */ 627, 628, 629, 630, 631, 159, 993, 242, 38, 278, + /* 210 */ 41, 42, 59, 196, 263, 31, 30, 29, 282, 281, + /* 220 */ 40, 344, 45, 43, 46, 44, 984, 222, 243, 1111, + /* 230 */ 36, 35, 1087, 196, 34, 33, 32, 1223, 41, 42, + /* 240 */ 387, 1021, 263, 31, 30, 29, 822, 823, 40, 344, + /* 250 */ 45, 43, 46, 44, 390, 389, 645, 253, 36, 35, + /* 260 */ 704, 1087, 34, 33, 32, 67, 338, 386, 385, 337, + /* 270 */ 336, 335, 384, 334, 333, 332, 383, 331, 382, 381, + /* 280 */ 1052, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, + /* 290 */ 1049, 1050, 1051, 1053, 1054, 234, 877, 25, 1215, 866, + /* 300 */ 1164, 869, 1165, 872, 776, 59, 59, 773, 1223, 774, + /* 310 */ 868, 775, 871, 867, 219, 870, 234, 877, 59, 1245, + /* 320 */ 866, 227, 869, 1214, 872, 342, 266, 144, 143, 142, + /* 330 */ 226, 239, 240, 1223, 352, 91, 5, 62, 186, 268, + /* 340 */ 269, 259, 315, 185, 111, 116, 107, 115, 272, 59, + /* 350 */ 254, 356, 239, 240, 1087, 1087, 346, 45, 43, 46, + /* 360 */ 44, 67, 327, 386, 385, 36, 35, 1086, 384, 34, + /* 370 */ 33, 32, 383, 68, 382, 381, 100, 59, 264, 1060, + /* 380 */ 47, 1058, 1059, 36, 35, 1237, 1061, 34, 33, 32, + /* 390 */ 1062, 86, 1063, 1064, 357, 285, 343, 83, 1087, 59, + /* 400 */ 752, 47, 215, 267, 235, 265, 248, 355, 354, 59, + /* 410 */ 1090, 59, 1223, 294, 1226, 878, 873, 874, 342, 59, + /* 420 */ 59, 91, 358, 777, 270, 274, 1087, 271, 875, 364, + /* 430 */ 363, 876, 369, 368, 273, 262, 878, 873, 874, 215, + /* 440 */ 158, 156, 155, 255, 359, 182, 257, 1090, 1087, 1223, + /* 450 */ 1090, 1226, 1213, 237, 365, 130, 366, 6, 1087, 68, + /* 460 */ 1087, 238, 1223, 1223, 367, 371, 217, 379, 1087, 1087, + /* 470 */ 218, 1223, 223, 216, 224, 225, 1223, 1105, 105, 794, + /* 480 */ 1223, 229, 1223, 1223, 1223, 1223, 230, 273, 842, 231, + /* 490 */ 228, 1223, 791, 212, 245, 273, 1223, 88, 183, 1223, + /* 500 */ 1223, 273, 99, 1223, 98, 89, 345, 1, 184, 819, + /* 510 */ 3, 197, 1088, 829, 1078, 297, 296, 830, 76, 10, + /* 520 */ 762, 79, 319, 163, 764, 349, 321, 71, 763, 261, + /* 530 */ 54, 48, 348, 906, 60, 289, 60, 879, 71, 667, + /* 540 */ 103, 295, 71, 289, 1177, 82, 841, 9, 15, 1176, + /* 550 */ 14, 9, 251, 9, 347, 121, 17, 120, 16, 361, + /* 560 */ 360, 77, 80, 322, 783, 798, 784, 1173, 781, 865, + /* 570 */ 782, 19, 1172, 18, 127, 252, 126, 751, 21, 370, + /* 580 */ 20, 140, 139, 283, 160, 1113, 26, 1124, 1121, 1122, + /* 590 */ 1106, 290, 1126, 162, 1156, 167, 308, 1155, 1154, 1153, + /* 600 */ 178, 1085, 179, 1083, 180, 181, 998, 324, 157, 809, + /* 610 */ 325, 1103, 326, 301, 329, 330, 69, 209, 65, 341, + /* 620 */ 168, 169, 992, 247, 303, 317, 353, 305, 1244, 81, + /* 630 */ 882, 28, 118, 78, 1243, 1240, 170, 187, 171, 362, + /* 640 */ 313, 172, 311, 1236, 309, 124, 1235, 307, 1232, 173, + /* 650 */ 188, 1018, 66, 304, 61, 175, 70, 210, 980, 134, + /* 660 */ 978, 136, 300, 137, 976, 975, 275, 199, 200, 972, + /* 670 */ 971, 970, 969, 968, 967, 966, 203, 205, 962, 960, + /* 680 */ 958, 27, 207, 955, 208, 951, 328, 174, 288, 87, + /* 690 */ 92, 380, 306, 373, 129, 372, 374, 375, 236, 376, + /* 700 */ 258, 323, 377, 378, 388, 931, 276, 232, 277, 930, + /* 710 */ 233, 279, 997, 996, 112, 113, 280, 929, 912, 284, + /* 720 */ 911, 318, 289, 11, 90, 291, 786, 52, 974, 973, + /* 730 */ 1019, 191, 149, 189, 190, 192, 193, 195, 150, 194, + /* 740 */ 965, 2, 1056, 151, 964, 4, 152, 1020, 957, 53, + /* 750 */ 177, 956, 93, 818, 74, 816, 815, 812, 1066, 811, + /* 760 */ 75, 166, 820, 164, 249, 831, 165, 22, 825, 94, + /* 770 */ 63, 827, 95, 310, 347, 314, 12, 64, 49, 23, + /* 780 */ 320, 50, 104, 106, 56, 682, 108, 109, 57, 110, + /* 790 */ 717, 715, 714, 713, 711, 710, 709, 706, 672, 339, + /* 800 */ 114, 7, 903, 901, 881, 904, 880, 902, 8, 883, + /* 810 */ 350, 351, 72, 754, 780, 117, 119, 60, 73, 123, + /* 820 */ 125, 779, 753, 750, 698, 696, 688, 694, 690, 692, + /* 830 */ 686, 684, 720, 719, 718, 716, 712, 708, 707, 198, + /* 840 */ 670, 635, 935, 934, 934, 934, 934, 934, 934, 934, + /* 850 */ 934, 934, 934, 934, 934, 934, 153, 154, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 211, 1, 1, 279, 203, 281, 282, 5, 210, 9, @@ -530,68 +530,68 @@ static const YYCODETYPE yy_lookahead[] = { /* 210 */ 17, 18, 203, 216, 21, 22, 23, 24, 156, 157, /* 220 */ 27, 28, 29, 30, 31, 32, 209, 271, 248, 272, /* 230 */ 37, 38, 252, 216, 41, 42, 43, 281, 17, 18, - /* 240 */ 225, 226, 21, 22, 23, 24, 212, 213, 27, 28, + /* 240 */ 225, 226, 21, 22, 23, 24, 130, 131, 27, 28, /* 250 */ 29, 30, 31, 32, 69, 70, 71, 248, 37, 38, /* 260 */ 5, 252, 41, 42, 43, 102, 103, 104, 105, 106, /* 270 */ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, /* 280 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - /* 290 */ 237, 238, 239, 240, 241, 1, 2, 48, 5, 5, - /* 300 */ 7, 7, 253, 9, 2, 203, 203, 5, 271, 7, - /* 310 */ 5, 9, 7, 271, 65, 271, 1, 2, 281, 203, - /* 320 */ 5, 72, 7, 281, 9, 281, 203, 78, 79, 80, - /* 330 */ 81, 37, 38, 41, 85, 86, 66, 67, 68, 37, - /* 340 */ 38, 207, 208, 73, 74, 75, 76, 77, 72, 86, + /* 290 */ 237, 238, 239, 240, 241, 1, 2, 48, 271, 5, + /* 300 */ 279, 7, 281, 9, 2, 203, 203, 5, 281, 7, + /* 310 */ 5, 9, 7, 5, 65, 7, 1, 2, 203, 253, + /* 320 */ 5, 72, 7, 271, 9, 47, 72, 78, 79, 80, + /* 330 */ 81, 37, 38, 281, 85, 86, 66, 67, 68, 37, + /* 340 */ 38, 210, 64, 73, 74, 75, 76, 77, 72, 203, /* 350 */ 248, 248, 37, 38, 252, 252, 41, 29, 30, 31, - /* 360 */ 32, 203, 92, 72, 248, 37, 38, 101, 252, 41, - /* 370 */ 42, 43, 123, 253, 102, 252, 104, 105, 37, 38, - /* 380 */ 86, 109, 41, 42, 43, 113, 123, 115, 116, 227, - /* 390 */ 210, 229, 230, 127, 276, 146, 234, 148, 210, 243, - /* 400 */ 238, 86, 240, 241, 155, 203, 248, 203, 203, 25, - /* 410 */ 252, 66, 67, 68, 5, 121, 122, 251, 126, 203, - /* 420 */ 82, 128, 128, 121, 122, 149, 254, 151, 203, 153, - /* 430 */ 154, 47, 94, 128, 268, 276, 121, 122, 87, 271, - /* 440 */ 149, 269, 151, 128, 153, 154, 37, 38, 64, 281, - /* 450 */ 248, 271, 248, 248, 252, 271, 252, 252, 279, 271, - /* 460 */ 281, 281, 271, 283, 248, 281, 271, 211, 252, 281, - /* 470 */ 86, 283, 281, 248, 271, 124, 281, 252, 80, 271, - /* 480 */ 271, 271, 271, 271, 281, 279, 271, 281, 271, 281, - /* 490 */ 281, 281, 281, 281, 271, 249, 281, 87, 281, 253, - /* 500 */ 203, 249, 249, 247, 281, 253, 253, 130, 131, 203, - /* 510 */ 203, 214, 203, 37, 38, 87, 87, 87, 47, 101, - /* 520 */ 214, 214, 101, 214, 87, 87, 87, 87, 87, 101, - /* 530 */ 101, 101, 86, 25, 124, 64, 138, 87, 101, 101, - /* 540 */ 101, 101, 101, 87, 1, 16, 87, 150, 86, 152, - /* 550 */ 203, 101, 150, 243, 152, 47, 150, 101, 152, 243, - /* 560 */ 101, 243, 144, 142, 5, 119, 7, 150, 5, 152, - /* 570 */ 7, 203, 150, 150, 152, 152, 82, 83, 243, 243, - /* 580 */ 118, 203, 243, 270, 41, 203, 203, 255, 203, 203, - /* 590 */ 203, 251, 203, 251, 203, 251, 203, 280, 203, 280, - /* 600 */ 280, 280, 203, 203, 203, 64, 203, 203, 203, 275, - /* 610 */ 203, 203, 128, 265, 203, 203, 203, 203, 203, 203, - /* 620 */ 267, 275, 203, 203, 275, 275, 141, 203, 203, 203, - /* 630 */ 203, 143, 266, 136, 203, 203, 203, 203, 203, 203, - /* 640 */ 140, 139, 262, 264, 263, 203, 203, 203, 203, 134, - /* 650 */ 121, 203, 203, 133, 203, 203, 203, 203, 203, 132, - /* 660 */ 203, 203, 129, 203, 203, 135, 203, 203, 203, 203, - /* 670 */ 203, 203, 203, 203, 93, 203, 203, 203, 203, 145, - /* 680 */ 203, 203, 203, 117, 100, 205, 205, 205, 205, 99, - /* 690 */ 55, 96, 98, 59, 97, 205, 95, 205, 205, 88, - /* 700 */ 5, 5, 5, 158, 205, 158, 5, 5, 261, 205, - /* 710 */ 215, 215, 211, 104, 211, 103, 147, 124, 119, 86, - /* 720 */ 101, 125, 205, 205, 87, 206, 205, 218, 222, 224, - /* 730 */ 223, 221, 219, 217, 220, 212, 86, 206, 226, 207, - /* 740 */ 242, 206, 205, 205, 257, 206, 260, 256, 259, 205, - /* 750 */ 101, 87, 101, 242, 128, 128, 5, 5, 86, 101, - /* 760 */ 87, 86, 1, 87, 86, 137, 87, 86, 101, 87, - /* 770 */ 86, 86, 47, 1, 86, 101, 137, 86, 119, 86, - /* 780 */ 120, 82, 74, 91, 90, 5, 9, 5, 5, 91, - /* 790 */ 90, 5, 5, 5, 5, 5, 89, 16, 82, 86, - /* 800 */ 9, 9, 87, 9, 87, 9, 86, 121, 63, 152, - /* 810 */ 17, 101, 28, 152, 17, 152, 5, 152, 5, 87, - /* 820 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 830 */ 5, 5, 5, 5, 5, 101, 89, 64, 0, 284, - /* 840 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - /* 850 */ 284, 284, 22, 22, 284, 284, 284, 284, 284, 284, + /* 360 */ 32, 102, 92, 104, 105, 37, 38, 252, 109, 41, + /* 370 */ 42, 43, 113, 124, 115, 116, 254, 203, 210, 227, + /* 380 */ 86, 229, 230, 37, 38, 253, 234, 41, 42, 43, + /* 390 */ 238, 269, 240, 241, 248, 146, 25, 148, 252, 203, + /* 400 */ 5, 86, 271, 149, 155, 151, 249, 153, 154, 203, + /* 410 */ 253, 203, 281, 276, 283, 121, 122, 123, 47, 203, + /* 420 */ 203, 86, 248, 121, 122, 149, 252, 151, 123, 153, + /* 430 */ 154, 123, 37, 38, 203, 64, 121, 122, 123, 271, + /* 440 */ 66, 67, 68, 249, 248, 214, 249, 253, 252, 281, + /* 450 */ 253, 283, 271, 271, 248, 82, 248, 86, 252, 124, + /* 460 */ 252, 271, 281, 281, 248, 248, 271, 94, 252, 252, + /* 470 */ 271, 281, 271, 271, 271, 271, 281, 251, 211, 41, + /* 480 */ 281, 271, 281, 281, 281, 281, 271, 203, 80, 271, + /* 490 */ 271, 281, 101, 271, 268, 203, 281, 87, 214, 281, + /* 500 */ 281, 203, 279, 281, 281, 87, 214, 212, 213, 87, + /* 510 */ 207, 208, 214, 87, 247, 37, 38, 87, 101, 128, + /* 520 */ 87, 101, 87, 101, 87, 16, 87, 101, 87, 1, + /* 530 */ 86, 101, 25, 87, 101, 125, 101, 87, 101, 87, + /* 540 */ 101, 276, 101, 125, 243, 86, 138, 101, 150, 243, + /* 550 */ 152, 101, 243, 101, 47, 150, 150, 152, 152, 37, + /* 560 */ 38, 144, 142, 119, 5, 127, 7, 243, 5, 41, + /* 570 */ 7, 150, 243, 152, 150, 243, 152, 118, 150, 243, + /* 580 */ 152, 82, 83, 203, 203, 203, 270, 203, 203, 203, + /* 590 */ 251, 251, 203, 203, 280, 203, 203, 280, 280, 280, + /* 600 */ 255, 251, 203, 203, 203, 203, 203, 203, 64, 123, + /* 610 */ 203, 267, 203, 275, 203, 203, 203, 203, 203, 203, + /* 620 */ 266, 265, 203, 275, 275, 136, 203, 275, 203, 141, + /* 630 */ 121, 140, 203, 143, 203, 203, 264, 203, 263, 203, + /* 640 */ 139, 262, 134, 203, 133, 203, 203, 132, 203, 261, + /* 650 */ 203, 203, 203, 135, 203, 259, 203, 203, 203, 203, + /* 660 */ 203, 203, 129, 203, 203, 203, 203, 203, 203, 203, + /* 670 */ 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + /* 680 */ 203, 145, 203, 203, 203, 203, 93, 260, 205, 205, + /* 690 */ 205, 117, 205, 55, 100, 99, 96, 98, 205, 59, + /* 700 */ 205, 205, 97, 95, 88, 5, 158, 205, 5, 5, + /* 710 */ 205, 158, 215, 215, 211, 211, 5, 5, 104, 147, + /* 720 */ 103, 119, 125, 86, 126, 101, 87, 86, 205, 205, + /* 730 */ 224, 218, 206, 223, 222, 221, 219, 217, 206, 220, + /* 740 */ 205, 212, 242, 206, 205, 207, 206, 226, 205, 257, + /* 750 */ 256, 205, 101, 87, 101, 123, 123, 5, 242, 5, + /* 760 */ 86, 101, 87, 86, 1, 87, 86, 137, 87, 86, + /* 770 */ 101, 87, 86, 86, 47, 1, 86, 101, 86, 137, + /* 780 */ 119, 86, 120, 82, 91, 5, 90, 74, 91, 90, + /* 790 */ 9, 5, 5, 5, 5, 5, 5, 5, 89, 16, + /* 800 */ 82, 86, 9, 9, 87, 9, 87, 9, 86, 121, + /* 810 */ 28, 63, 17, 5, 123, 152, 152, 101, 17, 152, + /* 820 */ 152, 123, 5, 87, 5, 5, 5, 5, 5, 5, + /* 830 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 101, + /* 840 */ 89, 64, 0, 284, 284, 284, 284, 284, 284, 284, + /* 850 */ 284, 284, 284, 284, 284, 284, 22, 22, 284, 284, /* 860 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, /* 870 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, /* 880 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, @@ -611,119 +611,121 @@ static const YYCODETYPE yy_lookahead[] = { /* 1020 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, /* 1030 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, /* 1040 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - /* 1050 */ 284, 284, 284, 284, 284, + /* 1050 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, }; -#define YY_SHIFT_COUNT (389) +#define YY_SHIFT_COUNT (392) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (838) +#define YY_SHIFT_MAX (842) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 249, 163, 163, 272, 272, 60, 315, 294, 294, 294, + /* 0 */ 249, 163, 163, 259, 259, 60, 315, 294, 294, 294, /* 10 */ 98, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20 */ 1, 1, 48, 48, 0, 142, 294, 294, 294, 294, /* 30 */ 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, /* 40 */ 294, 294, 294, 294, 294, 294, 294, 294, 302, 302, - /* 50 */ 302, 263, 263, 377, 1, 20, 1, 1, 1, 1, - /* 60 */ 1, 338, 60, 48, 48, 88, 88, 255, 854, 854, - /* 70 */ 854, 302, 302, 302, 2, 2, 409, 409, 409, 409, - /* 80 */ 409, 409, 409, 1, 1, 1, 292, 1, 1, 1, - /* 90 */ 263, 263, 1, 1, 1, 1, 398, 398, 398, 398, - /* 100 */ 266, 263, 1, 1, 1, 1, 1, 1, 1, 1, + /* 50 */ 302, 335, 335, 116, 1, 20, 1, 1, 1, 1, + /* 60 */ 1, 373, 60, 48, 48, 88, 88, 255, 858, 858, + /* 70 */ 858, 302, 302, 302, 2, 2, 395, 395, 395, 395, + /* 80 */ 395, 395, 395, 1, 1, 1, 438, 1, 1, 1, + /* 90 */ 335, 335, 1, 1, 1, 1, 408, 408, 408, 408, + /* 100 */ 391, 335, 1, 1, 1, 1, 1, 1, 1, 1, /* 110 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 120 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 130 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 150 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - /* 160 */ 541, 541, 541, 484, 484, 484, 484, 541, 485, 488, - /* 170 */ 497, 500, 502, 515, 520, 527, 530, 533, 534, 541, - /* 180 */ 541, 541, 581, 581, 566, 60, 60, 541, 541, 584, - /* 190 */ 590, 635, 595, 594, 634, 597, 601, 566, 255, 541, - /* 200 */ 541, 611, 611, 541, 611, 541, 611, 541, 541, 854, - /* 210 */ 854, 30, 74, 104, 104, 104, 135, 193, 221, 270, - /* 220 */ 328, 328, 328, 328, 328, 328, 10, 113, 341, 341, - /* 230 */ 341, 341, 276, 291, 384, 62, 24, 127, 127, 293, - /* 240 */ 305, 185, 345, 22, 351, 410, 476, 428, 429, 430, - /* 250 */ 471, 418, 421, 437, 438, 439, 440, 441, 446, 450, - /* 260 */ 456, 508, 543, 529, 459, 397, 402, 406, 559, 563, - /* 270 */ 417, 422, 462, 423, 494, 695, 545, 696, 697, 547, - /* 280 */ 701, 702, 609, 612, 569, 593, 599, 633, 596, 637, - /* 290 */ 650, 619, 649, 664, 651, 626, 627, 751, 752, 672, - /* 300 */ 673, 675, 676, 678, 679, 658, 681, 682, 684, 761, - /* 310 */ 685, 667, 628, 725, 772, 674, 639, 688, 599, 691, - /* 320 */ 659, 693, 660, 699, 692, 694, 708, 780, 698, 700, - /* 330 */ 777, 782, 783, 786, 787, 788, 789, 790, 707, 781, - /* 340 */ 716, 791, 792, 713, 715, 717, 794, 796, 686, 720, - /* 350 */ 784, 745, 793, 657, 661, 710, 710, 710, 710, 797, - /* 360 */ 663, 665, 710, 710, 710, 811, 813, 732, 710, 815, - /* 370 */ 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, - /* 380 */ 826, 827, 828, 829, 734, 747, 830, 831, 773, 838, + /* 160 */ 544, 544, 544, 486, 486, 486, 486, 544, 488, 490, + /* 170 */ 489, 491, 501, 508, 511, 515, 518, 533, 536, 544, + /* 180 */ 544, 544, 593, 593, 574, 60, 60, 544, 544, 594, + /* 190 */ 596, 638, 600, 599, 640, 605, 608, 574, 255, 544, + /* 200 */ 544, 616, 616, 544, 616, 544, 616, 544, 544, 858, + /* 210 */ 858, 30, 74, 104, 104, 104, 135, 193, 221, 270, + /* 220 */ 328, 328, 328, 328, 328, 328, 10, 113, 346, 346, + /* 230 */ 346, 346, 254, 276, 371, 62, 24, 127, 127, 305, + /* 240 */ 308, 185, 374, 22, 410, 418, 478, 422, 426, 430, + /* 250 */ 278, 417, 420, 433, 435, 437, 439, 441, 444, 446, + /* 260 */ 450, 507, 528, 509, 452, 398, 405, 406, 559, 563, + /* 270 */ 522, 421, 424, 459, 428, 499, 700, 548, 703, 704, + /* 280 */ 553, 711, 712, 614, 617, 572, 597, 602, 637, 598, + /* 290 */ 639, 641, 624, 651, 666, 653, 632, 633, 752, 754, + /* 300 */ 674, 675, 677, 678, 680, 681, 660, 683, 684, 686, + /* 310 */ 763, 687, 669, 630, 727, 774, 676, 642, 690, 602, + /* 320 */ 692, 661, 695, 662, 701, 693, 696, 713, 780, 697, + /* 330 */ 699, 781, 786, 787, 788, 789, 790, 791, 792, 709, + /* 340 */ 783, 718, 793, 794, 715, 717, 719, 796, 798, 688, + /* 350 */ 722, 782, 748, 795, 663, 664, 716, 716, 716, 716, + /* 360 */ 691, 698, 801, 667, 668, 716, 716, 716, 808, 817, + /* 370 */ 736, 716, 819, 820, 821, 822, 823, 824, 825, 826, + /* 380 */ 827, 828, 829, 830, 831, 832, 833, 738, 751, 834, + /* 390 */ 835, 777, 842, }; #define YY_REDUCE_COUNT (210) #define YY_REDUCE_MIN (-276) -#define YY_REDUCE_MAX (544) +#define YY_REDUCE_MAX (546) static const short yy_reduce_ofst[] = { - /* 0 */ -138, 53, 53, 162, 162, -211, -202, 180, 188, -201, - /* 10 */ -199, -20, 9, 102, 103, 116, 158, 202, 204, 205, - /* 20 */ 216, 225, -276, -141, -43, -191, -255, -225, -216, -142, - /* 30 */ -96, -44, 37, 42, 44, 168, 184, 191, 195, 203, - /* 40 */ 208, 209, 210, 211, 212, 215, 217, 223, 246, 252, - /* 50 */ 253, -97, 166, -103, -184, 256, 297, 306, 307, 309, - /* 60 */ 123, -116, -161, 179, 206, -3, 17, 15, 172, 34, - /* 70 */ 134, -228, 49, 120, 118, 159, 156, 310, 316, 318, - /* 80 */ 335, 336, 339, 347, 368, 378, 313, 382, 383, 385, - /* 90 */ 340, 342, 386, 387, 389, 391, 317, 319, 320, 321, - /* 100 */ 332, 344, 393, 395, 399, 400, 401, 403, 404, 405, - /* 110 */ 407, 408, 411, 412, 413, 414, 415, 416, 419, 420, - /* 120 */ 424, 425, 426, 427, 431, 432, 433, 434, 435, 436, - /* 130 */ 442, 443, 444, 445, 448, 449, 451, 452, 453, 454, - /* 140 */ 455, 457, 458, 460, 461, 463, 464, 465, 466, 467, - /* 150 */ 468, 469, 470, 472, 473, 474, 475, 477, 478, 479, - /* 160 */ 480, 481, 482, 334, 346, 349, 350, 483, 353, 366, - /* 170 */ 348, 379, 381, 380, 447, 486, 489, 487, 491, 490, - /* 180 */ 492, 493, 495, 496, 498, 501, 503, 499, 504, 505, - /* 190 */ 507, 506, 509, 510, 513, 514, 516, 511, 512, 517, - /* 200 */ 518, 519, 531, 521, 535, 537, 539, 538, 544, 523, - /* 210 */ 532, + /* 0 */ -138, 53, 53, 152, 152, -211, -202, 131, 168, -201, + /* 10 */ -199, -20, 9, 102, 103, 146, 174, 196, 206, 208, + /* 20 */ 216, 217, -276, -141, -43, -191, -255, -225, -216, -142, + /* 30 */ -96, -44, 27, 52, 181, 182, 190, 195, 199, 201, + /* 40 */ 202, 203, 204, 210, 215, 218, 219, 222, 157, 194, + /* 50 */ 197, -97, 226, -103, -184, 267, 231, 284, 292, 298, + /* 60 */ 115, -116, -161, 21, 223, -3, 17, 15, 122, 295, + /* 70 */ 303, -228, 66, 132, 137, 265, 301, 306, 309, 324, + /* 80 */ 329, 332, 336, 380, 381, 382, 316, 384, 385, 386, + /* 90 */ 339, 340, 389, 390, 392, 393, 314, 317, 318, 319, + /* 100 */ 345, 350, 399, 400, 401, 402, 403, 404, 407, 409, + /* 110 */ 411, 412, 413, 414, 415, 416, 419, 423, 425, 429, + /* 120 */ 431, 432, 434, 436, 440, 442, 443, 445, 447, 448, + /* 130 */ 449, 451, 453, 454, 455, 456, 457, 458, 460, 461, + /* 140 */ 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + /* 150 */ 472, 473, 474, 475, 476, 477, 479, 480, 481, 482, + /* 160 */ 483, 484, 485, 338, 348, 349, 352, 487, 344, 354, + /* 170 */ 356, 372, 375, 379, 388, 427, 396, 492, 494, 493, + /* 180 */ 495, 496, 497, 498, 500, 503, 504, 502, 505, 506, + /* 190 */ 510, 512, 513, 514, 517, 519, 520, 516, 521, 523, + /* 200 */ 524, 526, 532, 535, 537, 539, 540, 543, 546, 529, + /* 210 */ 538, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 926, 1049, 988, 1059, 975, 985, 1220, 1220, 1220, 1220, - /* 10 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 20 */ 926, 926, 926, 926, 1107, 946, 926, 926, 926, 926, - /* 30 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 40 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 50 */ 926, 926, 926, 1131, 926, 985, 926, 926, 926, 926, - /* 60 */ 926, 995, 985, 926, 926, 995, 995, 926, 1102, 1033, - /* 70 */ 1051, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 80 */ 926, 926, 926, 926, 926, 926, 1109, 1115, 1112, 926, - /* 90 */ 926, 926, 1117, 926, 926, 926, 1153, 1153, 1153, 1153, - /* 100 */ 1100, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 110 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 120 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 130 */ 926, 926, 926, 926, 973, 926, 971, 926, 926, 926, - /* 140 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 150 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 944, - /* 160 */ 948, 948, 948, 926, 926, 926, 926, 948, 1162, 1166, - /* 170 */ 1143, 1160, 1154, 1138, 1136, 1134, 1142, 1127, 1170, 948, - /* 180 */ 948, 948, 993, 993, 989, 985, 985, 948, 948, 1011, - /* 190 */ 1009, 1007, 999, 1005, 1001, 1003, 997, 976, 926, 948, - /* 200 */ 948, 983, 983, 948, 983, 948, 983, 948, 948, 1033, - /* 210 */ 1051, 1219, 926, 1171, 1161, 1219, 926, 1202, 1201, 926, - /* 220 */ 1210, 1209, 1208, 1200, 1199, 1198, 926, 926, 1194, 1197, - /* 230 */ 1196, 1195, 926, 926, 1173, 926, 926, 1204, 1203, 926, - /* 240 */ 926, 926, 926, 926, 926, 926, 1124, 926, 926, 926, - /* 250 */ 1149, 1167, 1163, 926, 926, 926, 926, 926, 926, 926, - /* 260 */ 926, 1174, 926, 926, 926, 926, 926, 926, 926, 926, - /* 270 */ 926, 926, 1061, 926, 926, 926, 926, 926, 926, 926, - /* 280 */ 926, 926, 926, 926, 926, 1099, 926, 926, 926, 926, - /* 290 */ 926, 1111, 1110, 926, 926, 926, 926, 926, 926, 926, - /* 300 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 310 */ 926, 1155, 926, 1150, 926, 1144, 926, 926, 1073, 926, - /* 320 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 330 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 340 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 350 */ 926, 926, 926, 926, 926, 1238, 1233, 1234, 1231, 926, - /* 360 */ 926, 926, 1230, 1225, 1226, 926, 926, 926, 1223, 926, - /* 370 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, - /* 380 */ 926, 926, 926, 926, 1017, 926, 955, 953, 926, 926, + /* 0 */ 932, 1055, 994, 1065, 981, 991, 1228, 1228, 1228, 1228, + /* 10 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 20 */ 932, 932, 932, 932, 1115, 952, 932, 932, 932, 932, + /* 30 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 40 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 50 */ 932, 932, 932, 1139, 932, 991, 932, 932, 932, 932, + /* 60 */ 932, 1001, 991, 932, 932, 1001, 1001, 932, 1110, 1039, + /* 70 */ 1057, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 80 */ 932, 932, 932, 932, 932, 932, 1117, 1123, 1120, 932, + /* 90 */ 932, 932, 1125, 932, 932, 932, 1161, 1161, 1161, 1161, + /* 100 */ 1108, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 110 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 120 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 130 */ 932, 932, 932, 932, 979, 932, 977, 932, 932, 932, + /* 140 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 150 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 950, + /* 160 */ 954, 954, 954, 932, 932, 932, 932, 954, 1170, 1174, + /* 170 */ 1151, 1168, 1162, 1146, 1144, 1142, 1150, 1135, 1178, 954, + /* 180 */ 954, 954, 999, 999, 995, 991, 991, 954, 954, 1017, + /* 190 */ 1015, 1013, 1005, 1011, 1007, 1009, 1003, 982, 932, 954, + /* 200 */ 954, 989, 989, 954, 989, 954, 989, 954, 954, 1039, + /* 210 */ 1057, 1227, 932, 1179, 1169, 1227, 932, 1210, 1209, 932, + /* 220 */ 1218, 1217, 1216, 1208, 1207, 1206, 932, 932, 1202, 1205, + /* 230 */ 1204, 1203, 932, 932, 1181, 932, 932, 1212, 1211, 932, + /* 240 */ 932, 932, 932, 932, 932, 932, 1132, 932, 932, 932, + /* 250 */ 1157, 1175, 1171, 932, 932, 932, 932, 932, 932, 932, + /* 260 */ 932, 1182, 932, 932, 932, 932, 932, 932, 932, 932, + /* 270 */ 1096, 932, 932, 1067, 932, 932, 932, 932, 932, 932, + /* 280 */ 932, 932, 932, 932, 932, 932, 1107, 932, 932, 932, + /* 290 */ 932, 932, 1119, 1118, 932, 932, 932, 932, 932, 932, + /* 300 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 310 */ 932, 932, 1163, 932, 1158, 932, 1152, 932, 932, 1079, + /* 320 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 330 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 340 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, + /* 350 */ 932, 932, 932, 932, 932, 932, 1246, 1241, 1242, 1239, + /* 360 */ 932, 932, 932, 932, 932, 1238, 1233, 1234, 932, 932, + /* 370 */ 932, 1231, 932, 932, 932, 932, 932, 932, 932, 932, + /* 380 */ 932, 932, 932, 932, 932, 932, 932, 1023, 932, 961, + /* 390 */ 959, 932, 932, }; /********** End of lemon-generated parsing tables *****************************/ @@ -866,12 +868,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* USING => nothing */ 1, /* NULL => ID */ 1, /* NOW => ID */ + 0, /* VARIABLE => nothing */ 0, /* SELECT => nothing */ 0, /* UNION => nothing */ 1, /* ALL => ID */ 0, /* DISTINCT => nothing */ 0, /* FROM => nothing */ - 0, /* VARIABLE => nothing */ 0, /* RANGE => nothing */ 0, /* INTERVAL => nothing */ 0, /* EVERY => nothing */ @@ -1155,12 +1157,12 @@ static const char *const yyTokenName[] = { /* 120 */ "USING", /* 121 */ "NULL", /* 122 */ "NOW", - /* 123 */ "SELECT", - /* 124 */ "UNION", - /* 125 */ "ALL", - /* 126 */ "DISTINCT", - /* 127 */ "FROM", - /* 128 */ "VARIABLE", + /* 123 */ "VARIABLE", + /* 124 */ "SELECT", + /* 125 */ "UNION", + /* 126 */ "ALL", + /* 127 */ "DISTINCT", + /* 128 */ "FROM", /* 129 */ "RANGE", /* 130 */ "INTERVAL", /* 131 */ "EVERY", @@ -1485,157 +1487,159 @@ static const char *const yyRuleName[] = { /* 159 */ "tagitem ::= BOOL", /* 160 */ "tagitem ::= NULL", /* 161 */ "tagitem ::= NOW", - /* 162 */ "tagitem ::= MINUS INTEGER", - /* 163 */ "tagitem ::= MINUS FLOAT", - /* 164 */ "tagitem ::= PLUS INTEGER", - /* 165 */ "tagitem ::= PLUS FLOAT", - /* 166 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", - /* 167 */ "select ::= LP select RP", - /* 168 */ "union ::= select", - /* 169 */ "union ::= union UNION ALL select", - /* 170 */ "cmd ::= union", - /* 171 */ "select ::= SELECT selcollist", - /* 172 */ "sclp ::= selcollist COMMA", - /* 173 */ "sclp ::=", - /* 174 */ "selcollist ::= sclp distinct expr as", - /* 175 */ "selcollist ::= sclp STAR", - /* 176 */ "as ::= AS ids", - /* 177 */ "as ::= ids", - /* 178 */ "as ::=", - /* 179 */ "distinct ::= DISTINCT", - /* 180 */ "distinct ::=", - /* 181 */ "from ::= FROM tablelist", - /* 182 */ "from ::= FROM sub", - /* 183 */ "sub ::= LP union RP", - /* 184 */ "sub ::= LP union RP ids", - /* 185 */ "sub ::= sub COMMA LP union RP ids", - /* 186 */ "tablelist ::= ids cpxName", - /* 187 */ "tablelist ::= ids cpxName ids", - /* 188 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 189 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 190 */ "tmvar ::= VARIABLE", - /* 191 */ "timestamp ::= INTEGER", - /* 192 */ "timestamp ::= MINUS INTEGER", - /* 193 */ "timestamp ::= PLUS INTEGER", - /* 194 */ "timestamp ::= STRING", - /* 195 */ "timestamp ::= NOW", - /* 196 */ "timestamp ::= NOW PLUS VARIABLE", - /* 197 */ "timestamp ::= NOW MINUS VARIABLE", - /* 198 */ "range_option ::=", - /* 199 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP", - /* 200 */ "interval_option ::= intervalKey LP tmvar RP", - /* 201 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", - /* 202 */ "interval_option ::=", - /* 203 */ "intervalKey ::= INTERVAL", - /* 204 */ "intervalKey ::= EVERY", - /* 205 */ "session_option ::=", - /* 206 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", - /* 207 */ "windowstate_option ::=", - /* 208 */ "windowstate_option ::= STATE_WINDOW LP ids RP", - /* 209 */ "fill_opt ::=", - /* 210 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 211 */ "fill_opt ::= FILL LP ID RP", - /* 212 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 213 */ "sliding_opt ::=", - /* 214 */ "orderby_opt ::=", - /* 215 */ "orderby_opt ::= ORDER BY sortlist", - /* 216 */ "sortlist ::= sortlist COMMA item sortorder", - /* 217 */ "sortlist ::= sortlist COMMA arrow sortorder", - /* 218 */ "sortlist ::= item sortorder", - /* 219 */ "sortlist ::= arrow sortorder", - /* 220 */ "item ::= ID", - /* 221 */ "item ::= ID DOT ID", - /* 222 */ "sortorder ::= ASC", - /* 223 */ "sortorder ::= DESC", - /* 224 */ "sortorder ::=", - /* 225 */ "groupby_opt ::=", - /* 226 */ "groupby_opt ::= GROUP BY grouplist", - /* 227 */ "grouplist ::= grouplist COMMA item", - /* 228 */ "grouplist ::= grouplist COMMA arrow", - /* 229 */ "grouplist ::= item", - /* 230 */ "grouplist ::= arrow", - /* 231 */ "having_opt ::=", - /* 232 */ "having_opt ::= HAVING expr", - /* 233 */ "limit_opt ::=", - /* 234 */ "limit_opt ::= LIMIT signed", - /* 235 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 236 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 237 */ "slimit_opt ::=", - /* 238 */ "slimit_opt ::= SLIMIT signed", - /* 239 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 240 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 241 */ "where_opt ::=", - /* 242 */ "where_opt ::= WHERE expr", - /* 243 */ "expr ::= LP expr RP", - /* 244 */ "expr ::= ID", - /* 245 */ "expr ::= ID DOT ID", - /* 246 */ "expr ::= ID DOT STAR", - /* 247 */ "expr ::= INTEGER", - /* 248 */ "expr ::= MINUS INTEGER", - /* 249 */ "expr ::= PLUS INTEGER", - /* 250 */ "expr ::= FLOAT", - /* 251 */ "expr ::= MINUS FLOAT", - /* 252 */ "expr ::= PLUS FLOAT", - /* 253 */ "expr ::= STRING", - /* 254 */ "expr ::= NOW", - /* 255 */ "expr ::= VARIABLE", - /* 256 */ "expr ::= PLUS VARIABLE", - /* 257 */ "expr ::= MINUS VARIABLE", - /* 258 */ "expr ::= BOOL", - /* 259 */ "expr ::= NULL", - /* 260 */ "expr ::= ID LP exprlist RP", - /* 261 */ "expr ::= ID LP STAR RP", - /* 262 */ "expr ::= ID LP expr AS typename RP", - /* 263 */ "expr ::= expr IS NULL", - /* 264 */ "expr ::= expr IS NOT NULL", - /* 265 */ "expr ::= expr LT expr", - /* 266 */ "expr ::= expr GT expr", - /* 267 */ "expr ::= expr LE expr", - /* 268 */ "expr ::= expr GE expr", - /* 269 */ "expr ::= expr NE expr", - /* 270 */ "expr ::= expr EQ expr", - /* 271 */ "expr ::= expr BETWEEN expr AND expr", - /* 272 */ "expr ::= expr AND expr", - /* 273 */ "expr ::= expr OR expr", - /* 274 */ "expr ::= expr PLUS expr", - /* 275 */ "expr ::= expr MINUS expr", - /* 276 */ "expr ::= expr STAR expr", - /* 277 */ "expr ::= expr SLASH expr", - /* 278 */ "expr ::= expr REM expr", - /* 279 */ "expr ::= expr LIKE expr", - /* 280 */ "expr ::= expr MATCH expr", - /* 281 */ "expr ::= expr NMATCH expr", - /* 282 */ "expr ::= ID CONTAINS STRING", - /* 283 */ "expr ::= ID DOT ID CONTAINS STRING", - /* 284 */ "arrow ::= ID ARROW STRING", - /* 285 */ "arrow ::= ID DOT ID ARROW STRING", - /* 286 */ "expr ::= arrow", - /* 287 */ "expr ::= expr IN LP exprlist RP", - /* 288 */ "exprlist ::= exprlist COMMA expritem", - /* 289 */ "exprlist ::= expritem", - /* 290 */ "expritem ::= expr", - /* 291 */ "expritem ::=", - /* 292 */ "cmd ::= RESET QUERY CACHE", - /* 293 */ "cmd ::= SYNCDB ids REPLICA", - /* 294 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 295 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 296 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 297 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 298 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 299 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 300 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 301 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 302 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 303 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 304 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 305 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 306 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 307 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 308 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 309 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 310 */ "cmd ::= KILL CONNECTION INTEGER", - /* 311 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 312 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 162 */ "tagitem ::= NOW PLUS VARIABLE", + /* 163 */ "tagitem ::= NOW MINUS VARIABLE", + /* 164 */ "tagitem ::= MINUS INTEGER", + /* 165 */ "tagitem ::= MINUS FLOAT", + /* 166 */ "tagitem ::= PLUS INTEGER", + /* 167 */ "tagitem ::= PLUS FLOAT", + /* 168 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", + /* 169 */ "select ::= LP select RP", + /* 170 */ "union ::= select", + /* 171 */ "union ::= union UNION ALL select", + /* 172 */ "cmd ::= union", + /* 173 */ "select ::= SELECT selcollist", + /* 174 */ "sclp ::= selcollist COMMA", + /* 175 */ "sclp ::=", + /* 176 */ "selcollist ::= sclp distinct expr as", + /* 177 */ "selcollist ::= sclp STAR", + /* 178 */ "as ::= AS ids", + /* 179 */ "as ::= ids", + /* 180 */ "as ::=", + /* 181 */ "distinct ::= DISTINCT", + /* 182 */ "distinct ::=", + /* 183 */ "from ::= FROM tablelist", + /* 184 */ "from ::= FROM sub", + /* 185 */ "sub ::= LP union RP", + /* 186 */ "sub ::= LP union RP ids", + /* 187 */ "sub ::= sub COMMA LP union RP ids", + /* 188 */ "tablelist ::= ids cpxName", + /* 189 */ "tablelist ::= ids cpxName ids", + /* 190 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 191 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 192 */ "tmvar ::= VARIABLE", + /* 193 */ "timestamp ::= INTEGER", + /* 194 */ "timestamp ::= MINUS INTEGER", + /* 195 */ "timestamp ::= PLUS INTEGER", + /* 196 */ "timestamp ::= STRING", + /* 197 */ "timestamp ::= NOW", + /* 198 */ "timestamp ::= NOW PLUS VARIABLE", + /* 199 */ "timestamp ::= NOW MINUS VARIABLE", + /* 200 */ "range_option ::=", + /* 201 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP", + /* 202 */ "interval_option ::= intervalKey LP tmvar RP", + /* 203 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", + /* 204 */ "interval_option ::=", + /* 205 */ "intervalKey ::= INTERVAL", + /* 206 */ "intervalKey ::= EVERY", + /* 207 */ "session_option ::=", + /* 208 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", + /* 209 */ "windowstate_option ::=", + /* 210 */ "windowstate_option ::= STATE_WINDOW LP ids RP", + /* 211 */ "fill_opt ::=", + /* 212 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 213 */ "fill_opt ::= FILL LP ID RP", + /* 214 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 215 */ "sliding_opt ::=", + /* 216 */ "orderby_opt ::=", + /* 217 */ "orderby_opt ::= ORDER BY sortlist", + /* 218 */ "sortlist ::= sortlist COMMA item sortorder", + /* 219 */ "sortlist ::= sortlist COMMA arrow sortorder", + /* 220 */ "sortlist ::= item sortorder", + /* 221 */ "sortlist ::= arrow sortorder", + /* 222 */ "item ::= ID", + /* 223 */ "item ::= ID DOT ID", + /* 224 */ "sortorder ::= ASC", + /* 225 */ "sortorder ::= DESC", + /* 226 */ "sortorder ::=", + /* 227 */ "groupby_opt ::=", + /* 228 */ "groupby_opt ::= GROUP BY grouplist", + /* 229 */ "grouplist ::= grouplist COMMA item", + /* 230 */ "grouplist ::= grouplist COMMA arrow", + /* 231 */ "grouplist ::= item", + /* 232 */ "grouplist ::= arrow", + /* 233 */ "having_opt ::=", + /* 234 */ "having_opt ::= HAVING expr", + /* 235 */ "limit_opt ::=", + /* 236 */ "limit_opt ::= LIMIT signed", + /* 237 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 238 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 239 */ "slimit_opt ::=", + /* 240 */ "slimit_opt ::= SLIMIT signed", + /* 241 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 242 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 243 */ "where_opt ::=", + /* 244 */ "where_opt ::= WHERE expr", + /* 245 */ "expr ::= LP expr RP", + /* 246 */ "expr ::= ID", + /* 247 */ "expr ::= ID DOT ID", + /* 248 */ "expr ::= ID DOT STAR", + /* 249 */ "expr ::= INTEGER", + /* 250 */ "expr ::= MINUS INTEGER", + /* 251 */ "expr ::= PLUS INTEGER", + /* 252 */ "expr ::= FLOAT", + /* 253 */ "expr ::= MINUS FLOAT", + /* 254 */ "expr ::= PLUS FLOAT", + /* 255 */ "expr ::= STRING", + /* 256 */ "expr ::= NOW", + /* 257 */ "expr ::= VARIABLE", + /* 258 */ "expr ::= PLUS VARIABLE", + /* 259 */ "expr ::= MINUS VARIABLE", + /* 260 */ "expr ::= BOOL", + /* 261 */ "expr ::= NULL", + /* 262 */ "expr ::= ID LP exprlist RP", + /* 263 */ "expr ::= ID LP STAR RP", + /* 264 */ "expr ::= ID LP expr AS typename RP", + /* 265 */ "expr ::= expr IS NULL", + /* 266 */ "expr ::= expr IS NOT NULL", + /* 267 */ "expr ::= expr LT expr", + /* 268 */ "expr ::= expr GT expr", + /* 269 */ "expr ::= expr LE expr", + /* 270 */ "expr ::= expr GE expr", + /* 271 */ "expr ::= expr NE expr", + /* 272 */ "expr ::= expr EQ expr", + /* 273 */ "expr ::= expr BETWEEN expr AND expr", + /* 274 */ "expr ::= expr AND expr", + /* 275 */ "expr ::= expr OR expr", + /* 276 */ "expr ::= expr PLUS expr", + /* 277 */ "expr ::= expr MINUS expr", + /* 278 */ "expr ::= expr STAR expr", + /* 279 */ "expr ::= expr SLASH expr", + /* 280 */ "expr ::= expr REM expr", + /* 281 */ "expr ::= expr LIKE expr", + /* 282 */ "expr ::= expr MATCH expr", + /* 283 */ "expr ::= expr NMATCH expr", + /* 284 */ "expr ::= ID CONTAINS STRING", + /* 285 */ "expr ::= ID DOT ID CONTAINS STRING", + /* 286 */ "arrow ::= ID ARROW STRING", + /* 287 */ "arrow ::= ID DOT ID ARROW STRING", + /* 288 */ "expr ::= arrow", + /* 289 */ "expr ::= expr IN LP exprlist RP", + /* 290 */ "exprlist ::= exprlist COMMA expritem", + /* 291 */ "exprlist ::= expritem", + /* 292 */ "expritem ::= expr", + /* 293 */ "expritem ::=", + /* 294 */ "cmd ::= RESET QUERY CACHE", + /* 295 */ "cmd ::= SYNCDB ids REPLICA", + /* 296 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 297 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 298 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 299 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 300 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 301 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 302 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 303 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 304 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 305 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 306 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 307 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 308 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 309 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 310 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 311 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 312 */ "cmd ::= KILL CONNECTION INTEGER", + /* 313 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 314 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -2262,157 +2266,159 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 253, /* (159) tagitem ::= BOOL */ 253, /* (160) tagitem ::= NULL */ 253, /* (161) tagitem ::= NOW */ - 253, /* (162) tagitem ::= MINUS INTEGER */ - 253, /* (163) tagitem ::= MINUS FLOAT */ - 253, /* (164) tagitem ::= PLUS INTEGER */ - 253, /* (165) tagitem ::= PLUS FLOAT */ - 251, /* (166) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - 251, /* (167) select ::= LP select RP */ - 268, /* (168) union ::= select */ - 268, /* (169) union ::= union UNION ALL select */ - 202, /* (170) cmd ::= union */ - 251, /* (171) select ::= SELECT selcollist */ - 269, /* (172) sclp ::= selcollist COMMA */ - 269, /* (173) sclp ::= */ - 254, /* (174) selcollist ::= sclp distinct expr as */ - 254, /* (175) selcollist ::= sclp STAR */ - 272, /* (176) as ::= AS ids */ - 272, /* (177) as ::= ids */ - 272, /* (178) as ::= */ - 270, /* (179) distinct ::= DISTINCT */ - 270, /* (180) distinct ::= */ - 255, /* (181) from ::= FROM tablelist */ - 255, /* (182) from ::= FROM sub */ - 274, /* (183) sub ::= LP union RP */ - 274, /* (184) sub ::= LP union RP ids */ - 274, /* (185) sub ::= sub COMMA LP union RP ids */ - 273, /* (186) tablelist ::= ids cpxName */ - 273, /* (187) tablelist ::= ids cpxName ids */ - 273, /* (188) tablelist ::= tablelist COMMA ids cpxName */ - 273, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */ - 275, /* (190) tmvar ::= VARIABLE */ - 276, /* (191) timestamp ::= INTEGER */ - 276, /* (192) timestamp ::= MINUS INTEGER */ - 276, /* (193) timestamp ::= PLUS INTEGER */ - 276, /* (194) timestamp ::= STRING */ - 276, /* (195) timestamp ::= NOW */ - 276, /* (196) timestamp ::= NOW PLUS VARIABLE */ - 276, /* (197) timestamp ::= NOW MINUS VARIABLE */ - 257, /* (198) range_option ::= */ - 257, /* (199) range_option ::= RANGE LP timestamp COMMA timestamp RP */ - 258, /* (200) interval_option ::= intervalKey LP tmvar RP */ - 258, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - 258, /* (202) interval_option ::= */ - 277, /* (203) intervalKey ::= INTERVAL */ - 277, /* (204) intervalKey ::= EVERY */ - 260, /* (205) session_option ::= */ - 260, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - 261, /* (207) windowstate_option ::= */ - 261, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */ - 262, /* (209) fill_opt ::= */ - 262, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - 262, /* (211) fill_opt ::= FILL LP ID RP */ - 259, /* (212) sliding_opt ::= SLIDING LP tmvar RP */ - 259, /* (213) sliding_opt ::= */ - 265, /* (214) orderby_opt ::= */ - 265, /* (215) orderby_opt ::= ORDER BY sortlist */ - 278, /* (216) sortlist ::= sortlist COMMA item sortorder */ - 278, /* (217) sortlist ::= sortlist COMMA arrow sortorder */ - 278, /* (218) sortlist ::= item sortorder */ - 278, /* (219) sortlist ::= arrow sortorder */ - 279, /* (220) item ::= ID */ - 279, /* (221) item ::= ID DOT ID */ - 280, /* (222) sortorder ::= ASC */ - 280, /* (223) sortorder ::= DESC */ - 280, /* (224) sortorder ::= */ - 263, /* (225) groupby_opt ::= */ - 263, /* (226) groupby_opt ::= GROUP BY grouplist */ - 282, /* (227) grouplist ::= grouplist COMMA item */ - 282, /* (228) grouplist ::= grouplist COMMA arrow */ - 282, /* (229) grouplist ::= item */ - 282, /* (230) grouplist ::= arrow */ - 264, /* (231) having_opt ::= */ - 264, /* (232) having_opt ::= HAVING expr */ - 267, /* (233) limit_opt ::= */ - 267, /* (234) limit_opt ::= LIMIT signed */ - 267, /* (235) limit_opt ::= LIMIT signed OFFSET signed */ - 267, /* (236) limit_opt ::= LIMIT signed COMMA signed */ - 266, /* (237) slimit_opt ::= */ - 266, /* (238) slimit_opt ::= SLIMIT signed */ - 266, /* (239) slimit_opt ::= SLIMIT signed SOFFSET signed */ - 266, /* (240) slimit_opt ::= SLIMIT signed COMMA signed */ - 256, /* (241) where_opt ::= */ - 256, /* (242) where_opt ::= WHERE expr */ - 271, /* (243) expr ::= LP expr RP */ - 271, /* (244) expr ::= ID */ - 271, /* (245) expr ::= ID DOT ID */ - 271, /* (246) expr ::= ID DOT STAR */ - 271, /* (247) expr ::= INTEGER */ - 271, /* (248) expr ::= MINUS INTEGER */ - 271, /* (249) expr ::= PLUS INTEGER */ - 271, /* (250) expr ::= FLOAT */ - 271, /* (251) expr ::= MINUS FLOAT */ - 271, /* (252) expr ::= PLUS FLOAT */ - 271, /* (253) expr ::= STRING */ - 271, /* (254) expr ::= NOW */ - 271, /* (255) expr ::= VARIABLE */ - 271, /* (256) expr ::= PLUS VARIABLE */ - 271, /* (257) expr ::= MINUS VARIABLE */ - 271, /* (258) expr ::= BOOL */ - 271, /* (259) expr ::= NULL */ - 271, /* (260) expr ::= ID LP exprlist RP */ - 271, /* (261) expr ::= ID LP STAR RP */ - 271, /* (262) expr ::= ID LP expr AS typename RP */ - 271, /* (263) expr ::= expr IS NULL */ - 271, /* (264) expr ::= expr IS NOT NULL */ - 271, /* (265) expr ::= expr LT expr */ - 271, /* (266) expr ::= expr GT expr */ - 271, /* (267) expr ::= expr LE expr */ - 271, /* (268) expr ::= expr GE expr */ - 271, /* (269) expr ::= expr NE expr */ - 271, /* (270) expr ::= expr EQ expr */ - 271, /* (271) expr ::= expr BETWEEN expr AND expr */ - 271, /* (272) expr ::= expr AND expr */ - 271, /* (273) expr ::= expr OR expr */ - 271, /* (274) expr ::= expr PLUS expr */ - 271, /* (275) expr ::= expr MINUS expr */ - 271, /* (276) expr ::= expr STAR expr */ - 271, /* (277) expr ::= expr SLASH expr */ - 271, /* (278) expr ::= expr REM expr */ - 271, /* (279) expr ::= expr LIKE expr */ - 271, /* (280) expr ::= expr MATCH expr */ - 271, /* (281) expr ::= expr NMATCH expr */ - 271, /* (282) expr ::= ID CONTAINS STRING */ - 271, /* (283) expr ::= ID DOT ID CONTAINS STRING */ - 281, /* (284) arrow ::= ID ARROW STRING */ - 281, /* (285) arrow ::= ID DOT ID ARROW STRING */ - 271, /* (286) expr ::= arrow */ - 271, /* (287) expr ::= expr IN LP exprlist RP */ - 210, /* (288) exprlist ::= exprlist COMMA expritem */ - 210, /* (289) exprlist ::= expritem */ - 283, /* (290) expritem ::= expr */ - 283, /* (291) expritem ::= */ - 202, /* (292) cmd ::= RESET QUERY CACHE */ - 202, /* (293) cmd ::= SYNCDB ids REPLICA */ - 202, /* (294) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - 202, /* (295) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 202, /* (296) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - 202, /* (297) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - 202, /* (298) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - 202, /* (299) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - 202, /* (300) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 202, /* (301) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - 202, /* (302) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - 202, /* (303) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 202, /* (304) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - 202, /* (305) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 202, /* (306) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 202, /* (307) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 202, /* (308) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - 202, /* (309) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - 202, /* (310) cmd ::= KILL CONNECTION INTEGER */ - 202, /* (311) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 202, /* (312) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 253, /* (162) tagitem ::= NOW PLUS VARIABLE */ + 253, /* (163) tagitem ::= NOW MINUS VARIABLE */ + 253, /* (164) tagitem ::= MINUS INTEGER */ + 253, /* (165) tagitem ::= MINUS FLOAT */ + 253, /* (166) tagitem ::= PLUS INTEGER */ + 253, /* (167) tagitem ::= PLUS FLOAT */ + 251, /* (168) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + 251, /* (169) select ::= LP select RP */ + 268, /* (170) union ::= select */ + 268, /* (171) union ::= union UNION ALL select */ + 202, /* (172) cmd ::= union */ + 251, /* (173) select ::= SELECT selcollist */ + 269, /* (174) sclp ::= selcollist COMMA */ + 269, /* (175) sclp ::= */ + 254, /* (176) selcollist ::= sclp distinct expr as */ + 254, /* (177) selcollist ::= sclp STAR */ + 272, /* (178) as ::= AS ids */ + 272, /* (179) as ::= ids */ + 272, /* (180) as ::= */ + 270, /* (181) distinct ::= DISTINCT */ + 270, /* (182) distinct ::= */ + 255, /* (183) from ::= FROM tablelist */ + 255, /* (184) from ::= FROM sub */ + 274, /* (185) sub ::= LP union RP */ + 274, /* (186) sub ::= LP union RP ids */ + 274, /* (187) sub ::= sub COMMA LP union RP ids */ + 273, /* (188) tablelist ::= ids cpxName */ + 273, /* (189) tablelist ::= ids cpxName ids */ + 273, /* (190) tablelist ::= tablelist COMMA ids cpxName */ + 273, /* (191) tablelist ::= tablelist COMMA ids cpxName ids */ + 275, /* (192) tmvar ::= VARIABLE */ + 276, /* (193) timestamp ::= INTEGER */ + 276, /* (194) timestamp ::= MINUS INTEGER */ + 276, /* (195) timestamp ::= PLUS INTEGER */ + 276, /* (196) timestamp ::= STRING */ + 276, /* (197) timestamp ::= NOW */ + 276, /* (198) timestamp ::= NOW PLUS VARIABLE */ + 276, /* (199) timestamp ::= NOW MINUS VARIABLE */ + 257, /* (200) range_option ::= */ + 257, /* (201) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + 258, /* (202) interval_option ::= intervalKey LP tmvar RP */ + 258, /* (203) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 258, /* (204) interval_option ::= */ + 277, /* (205) intervalKey ::= INTERVAL */ + 277, /* (206) intervalKey ::= EVERY */ + 260, /* (207) session_option ::= */ + 260, /* (208) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 261, /* (209) windowstate_option ::= */ + 261, /* (210) windowstate_option ::= STATE_WINDOW LP ids RP */ + 262, /* (211) fill_opt ::= */ + 262, /* (212) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 262, /* (213) fill_opt ::= FILL LP ID RP */ + 259, /* (214) sliding_opt ::= SLIDING LP tmvar RP */ + 259, /* (215) sliding_opt ::= */ + 265, /* (216) orderby_opt ::= */ + 265, /* (217) orderby_opt ::= ORDER BY sortlist */ + 278, /* (218) sortlist ::= sortlist COMMA item sortorder */ + 278, /* (219) sortlist ::= sortlist COMMA arrow sortorder */ + 278, /* (220) sortlist ::= item sortorder */ + 278, /* (221) sortlist ::= arrow sortorder */ + 279, /* (222) item ::= ID */ + 279, /* (223) item ::= ID DOT ID */ + 280, /* (224) sortorder ::= ASC */ + 280, /* (225) sortorder ::= DESC */ + 280, /* (226) sortorder ::= */ + 263, /* (227) groupby_opt ::= */ + 263, /* (228) groupby_opt ::= GROUP BY grouplist */ + 282, /* (229) grouplist ::= grouplist COMMA item */ + 282, /* (230) grouplist ::= grouplist COMMA arrow */ + 282, /* (231) grouplist ::= item */ + 282, /* (232) grouplist ::= arrow */ + 264, /* (233) having_opt ::= */ + 264, /* (234) having_opt ::= HAVING expr */ + 267, /* (235) limit_opt ::= */ + 267, /* (236) limit_opt ::= LIMIT signed */ + 267, /* (237) limit_opt ::= LIMIT signed OFFSET signed */ + 267, /* (238) limit_opt ::= LIMIT signed COMMA signed */ + 266, /* (239) slimit_opt ::= */ + 266, /* (240) slimit_opt ::= SLIMIT signed */ + 266, /* (241) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 266, /* (242) slimit_opt ::= SLIMIT signed COMMA signed */ + 256, /* (243) where_opt ::= */ + 256, /* (244) where_opt ::= WHERE expr */ + 271, /* (245) expr ::= LP expr RP */ + 271, /* (246) expr ::= ID */ + 271, /* (247) expr ::= ID DOT ID */ + 271, /* (248) expr ::= ID DOT STAR */ + 271, /* (249) expr ::= INTEGER */ + 271, /* (250) expr ::= MINUS INTEGER */ + 271, /* (251) expr ::= PLUS INTEGER */ + 271, /* (252) expr ::= FLOAT */ + 271, /* (253) expr ::= MINUS FLOAT */ + 271, /* (254) expr ::= PLUS FLOAT */ + 271, /* (255) expr ::= STRING */ + 271, /* (256) expr ::= NOW */ + 271, /* (257) expr ::= VARIABLE */ + 271, /* (258) expr ::= PLUS VARIABLE */ + 271, /* (259) expr ::= MINUS VARIABLE */ + 271, /* (260) expr ::= BOOL */ + 271, /* (261) expr ::= NULL */ + 271, /* (262) expr ::= ID LP exprlist RP */ + 271, /* (263) expr ::= ID LP STAR RP */ + 271, /* (264) expr ::= ID LP expr AS typename RP */ + 271, /* (265) expr ::= expr IS NULL */ + 271, /* (266) expr ::= expr IS NOT NULL */ + 271, /* (267) expr ::= expr LT expr */ + 271, /* (268) expr ::= expr GT expr */ + 271, /* (269) expr ::= expr LE expr */ + 271, /* (270) expr ::= expr GE expr */ + 271, /* (271) expr ::= expr NE expr */ + 271, /* (272) expr ::= expr EQ expr */ + 271, /* (273) expr ::= expr BETWEEN expr AND expr */ + 271, /* (274) expr ::= expr AND expr */ + 271, /* (275) expr ::= expr OR expr */ + 271, /* (276) expr ::= expr PLUS expr */ + 271, /* (277) expr ::= expr MINUS expr */ + 271, /* (278) expr ::= expr STAR expr */ + 271, /* (279) expr ::= expr SLASH expr */ + 271, /* (280) expr ::= expr REM expr */ + 271, /* (281) expr ::= expr LIKE expr */ + 271, /* (282) expr ::= expr MATCH expr */ + 271, /* (283) expr ::= expr NMATCH expr */ + 271, /* (284) expr ::= ID CONTAINS STRING */ + 271, /* (285) expr ::= ID DOT ID CONTAINS STRING */ + 281, /* (286) arrow ::= ID ARROW STRING */ + 281, /* (287) arrow ::= ID DOT ID ARROW STRING */ + 271, /* (288) expr ::= arrow */ + 271, /* (289) expr ::= expr IN LP exprlist RP */ + 210, /* (290) exprlist ::= exprlist COMMA expritem */ + 210, /* (291) exprlist ::= expritem */ + 283, /* (292) expritem ::= expr */ + 283, /* (293) expritem ::= */ + 202, /* (294) cmd ::= RESET QUERY CACHE */ + 202, /* (295) cmd ::= SYNCDB ids REPLICA */ + 202, /* (296) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 202, /* (297) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 202, /* (298) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 202, /* (299) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 202, /* (300) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 202, /* (301) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 202, /* (302) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 202, /* (303) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 202, /* (304) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 202, /* (305) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 202, /* (306) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 202, /* (307) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 202, /* (308) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 202, /* (309) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 202, /* (310) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 202, /* (311) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 202, /* (312) cmd ::= KILL CONNECTION INTEGER */ + 202, /* (313) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 202, /* (314) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2580,157 +2586,159 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (159) tagitem ::= BOOL */ -1, /* (160) tagitem ::= NULL */ -1, /* (161) tagitem ::= NOW */ - -2, /* (162) tagitem ::= MINUS INTEGER */ - -2, /* (163) tagitem ::= MINUS FLOAT */ - -2, /* (164) tagitem ::= PLUS INTEGER */ - -2, /* (165) tagitem ::= PLUS FLOAT */ - -15, /* (166) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - -3, /* (167) select ::= LP select RP */ - -1, /* (168) union ::= select */ - -4, /* (169) union ::= union UNION ALL select */ - -1, /* (170) cmd ::= union */ - -2, /* (171) select ::= SELECT selcollist */ - -2, /* (172) sclp ::= selcollist COMMA */ - 0, /* (173) sclp ::= */ - -4, /* (174) selcollist ::= sclp distinct expr as */ - -2, /* (175) selcollist ::= sclp STAR */ - -2, /* (176) as ::= AS ids */ - -1, /* (177) as ::= ids */ - 0, /* (178) as ::= */ - -1, /* (179) distinct ::= DISTINCT */ - 0, /* (180) distinct ::= */ - -2, /* (181) from ::= FROM tablelist */ - -2, /* (182) from ::= FROM sub */ - -3, /* (183) sub ::= LP union RP */ - -4, /* (184) sub ::= LP union RP ids */ - -6, /* (185) sub ::= sub COMMA LP union RP ids */ - -2, /* (186) tablelist ::= ids cpxName */ - -3, /* (187) tablelist ::= ids cpxName ids */ - -4, /* (188) tablelist ::= tablelist COMMA ids cpxName */ - -5, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */ - -1, /* (190) tmvar ::= VARIABLE */ - -1, /* (191) timestamp ::= INTEGER */ - -2, /* (192) timestamp ::= MINUS INTEGER */ - -2, /* (193) timestamp ::= PLUS INTEGER */ - -1, /* (194) timestamp ::= STRING */ - -1, /* (195) timestamp ::= NOW */ - -3, /* (196) timestamp ::= NOW PLUS VARIABLE */ - -3, /* (197) timestamp ::= NOW MINUS VARIABLE */ - 0, /* (198) range_option ::= */ - -6, /* (199) range_option ::= RANGE LP timestamp COMMA timestamp RP */ - -4, /* (200) interval_option ::= intervalKey LP tmvar RP */ - -6, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - 0, /* (202) interval_option ::= */ - -1, /* (203) intervalKey ::= INTERVAL */ - -1, /* (204) intervalKey ::= EVERY */ - 0, /* (205) session_option ::= */ - -7, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - 0, /* (207) windowstate_option ::= */ - -4, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */ - 0, /* (209) fill_opt ::= */ - -6, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - -4, /* (211) fill_opt ::= FILL LP ID RP */ - -4, /* (212) sliding_opt ::= SLIDING LP tmvar RP */ - 0, /* (213) sliding_opt ::= */ - 0, /* (214) orderby_opt ::= */ - -3, /* (215) orderby_opt ::= ORDER BY sortlist */ - -4, /* (216) sortlist ::= sortlist COMMA item sortorder */ - -4, /* (217) sortlist ::= sortlist COMMA arrow sortorder */ - -2, /* (218) sortlist ::= item sortorder */ - -2, /* (219) sortlist ::= arrow sortorder */ - -1, /* (220) item ::= ID */ - -3, /* (221) item ::= ID DOT ID */ - -1, /* (222) sortorder ::= ASC */ - -1, /* (223) sortorder ::= DESC */ - 0, /* (224) sortorder ::= */ - 0, /* (225) groupby_opt ::= */ - -3, /* (226) groupby_opt ::= GROUP BY grouplist */ - -3, /* (227) grouplist ::= grouplist COMMA item */ - -3, /* (228) grouplist ::= grouplist COMMA arrow */ - -1, /* (229) grouplist ::= item */ - -1, /* (230) grouplist ::= arrow */ - 0, /* (231) having_opt ::= */ - -2, /* (232) having_opt ::= HAVING expr */ - 0, /* (233) limit_opt ::= */ - -2, /* (234) limit_opt ::= LIMIT signed */ - -4, /* (235) limit_opt ::= LIMIT signed OFFSET signed */ - -4, /* (236) limit_opt ::= LIMIT signed COMMA signed */ - 0, /* (237) slimit_opt ::= */ - -2, /* (238) slimit_opt ::= SLIMIT signed */ - -4, /* (239) slimit_opt ::= SLIMIT signed SOFFSET signed */ - -4, /* (240) slimit_opt ::= SLIMIT signed COMMA signed */ - 0, /* (241) where_opt ::= */ - -2, /* (242) where_opt ::= WHERE expr */ - -3, /* (243) expr ::= LP expr RP */ - -1, /* (244) expr ::= ID */ - -3, /* (245) expr ::= ID DOT ID */ - -3, /* (246) expr ::= ID DOT STAR */ - -1, /* (247) expr ::= INTEGER */ - -2, /* (248) expr ::= MINUS INTEGER */ - -2, /* (249) expr ::= PLUS INTEGER */ - -1, /* (250) expr ::= FLOAT */ - -2, /* (251) expr ::= MINUS FLOAT */ - -2, /* (252) expr ::= PLUS FLOAT */ - -1, /* (253) expr ::= STRING */ - -1, /* (254) expr ::= NOW */ - -1, /* (255) expr ::= VARIABLE */ - -2, /* (256) expr ::= PLUS VARIABLE */ - -2, /* (257) expr ::= MINUS VARIABLE */ - -1, /* (258) expr ::= BOOL */ - -1, /* (259) expr ::= NULL */ - -4, /* (260) expr ::= ID LP exprlist RP */ - -4, /* (261) expr ::= ID LP STAR RP */ - -6, /* (262) expr ::= ID LP expr AS typename RP */ - -3, /* (263) expr ::= expr IS NULL */ - -4, /* (264) expr ::= expr IS NOT NULL */ - -3, /* (265) expr ::= expr LT expr */ - -3, /* (266) expr ::= expr GT expr */ - -3, /* (267) expr ::= expr LE expr */ - -3, /* (268) expr ::= expr GE expr */ - -3, /* (269) expr ::= expr NE expr */ - -3, /* (270) expr ::= expr EQ expr */ - -5, /* (271) expr ::= expr BETWEEN expr AND expr */ - -3, /* (272) expr ::= expr AND expr */ - -3, /* (273) expr ::= expr OR expr */ - -3, /* (274) expr ::= expr PLUS expr */ - -3, /* (275) expr ::= expr MINUS expr */ - -3, /* (276) expr ::= expr STAR expr */ - -3, /* (277) expr ::= expr SLASH expr */ - -3, /* (278) expr ::= expr REM expr */ - -3, /* (279) expr ::= expr LIKE expr */ - -3, /* (280) expr ::= expr MATCH expr */ - -3, /* (281) expr ::= expr NMATCH expr */ - -3, /* (282) expr ::= ID CONTAINS STRING */ - -5, /* (283) expr ::= ID DOT ID CONTAINS STRING */ - -3, /* (284) arrow ::= ID ARROW STRING */ - -5, /* (285) arrow ::= ID DOT ID ARROW STRING */ - -1, /* (286) expr ::= arrow */ - -5, /* (287) expr ::= expr IN LP exprlist RP */ - -3, /* (288) exprlist ::= exprlist COMMA expritem */ - -1, /* (289) exprlist ::= expritem */ - -1, /* (290) expritem ::= expr */ - 0, /* (291) expritem ::= */ - -3, /* (292) cmd ::= RESET QUERY CACHE */ - -3, /* (293) cmd ::= SYNCDB ids REPLICA */ - -7, /* (294) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (295) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -7, /* (296) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (297) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - -7, /* (298) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - -8, /* (299) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (300) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (301) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - -7, /* (302) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (303) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -7, /* (304) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (305) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (306) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (307) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (308) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (309) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - -3, /* (310) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (311) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (312) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -3, /* (162) tagitem ::= NOW PLUS VARIABLE */ + -3, /* (163) tagitem ::= NOW MINUS VARIABLE */ + -2, /* (164) tagitem ::= MINUS INTEGER */ + -2, /* (165) tagitem ::= MINUS FLOAT */ + -2, /* (166) tagitem ::= PLUS INTEGER */ + -2, /* (167) tagitem ::= PLUS FLOAT */ + -15, /* (168) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + -3, /* (169) select ::= LP select RP */ + -1, /* (170) union ::= select */ + -4, /* (171) union ::= union UNION ALL select */ + -1, /* (172) cmd ::= union */ + -2, /* (173) select ::= SELECT selcollist */ + -2, /* (174) sclp ::= selcollist COMMA */ + 0, /* (175) sclp ::= */ + -4, /* (176) selcollist ::= sclp distinct expr as */ + -2, /* (177) selcollist ::= sclp STAR */ + -2, /* (178) as ::= AS ids */ + -1, /* (179) as ::= ids */ + 0, /* (180) as ::= */ + -1, /* (181) distinct ::= DISTINCT */ + 0, /* (182) distinct ::= */ + -2, /* (183) from ::= FROM tablelist */ + -2, /* (184) from ::= FROM sub */ + -3, /* (185) sub ::= LP union RP */ + -4, /* (186) sub ::= LP union RP ids */ + -6, /* (187) sub ::= sub COMMA LP union RP ids */ + -2, /* (188) tablelist ::= ids cpxName */ + -3, /* (189) tablelist ::= ids cpxName ids */ + -4, /* (190) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (191) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (192) tmvar ::= VARIABLE */ + -1, /* (193) timestamp ::= INTEGER */ + -2, /* (194) timestamp ::= MINUS INTEGER */ + -2, /* (195) timestamp ::= PLUS INTEGER */ + -1, /* (196) timestamp ::= STRING */ + -1, /* (197) timestamp ::= NOW */ + -3, /* (198) timestamp ::= NOW PLUS VARIABLE */ + -3, /* (199) timestamp ::= NOW MINUS VARIABLE */ + 0, /* (200) range_option ::= */ + -6, /* (201) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + -4, /* (202) interval_option ::= intervalKey LP tmvar RP */ + -6, /* (203) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 0, /* (204) interval_option ::= */ + -1, /* (205) intervalKey ::= INTERVAL */ + -1, /* (206) intervalKey ::= EVERY */ + 0, /* (207) session_option ::= */ + -7, /* (208) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (209) windowstate_option ::= */ + -4, /* (210) windowstate_option ::= STATE_WINDOW LP ids RP */ + 0, /* (211) fill_opt ::= */ + -6, /* (212) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (213) fill_opt ::= FILL LP ID RP */ + -4, /* (214) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (215) sliding_opt ::= */ + 0, /* (216) orderby_opt ::= */ + -3, /* (217) orderby_opt ::= ORDER BY sortlist */ + -4, /* (218) sortlist ::= sortlist COMMA item sortorder */ + -4, /* (219) sortlist ::= sortlist COMMA arrow sortorder */ + -2, /* (220) sortlist ::= item sortorder */ + -2, /* (221) sortlist ::= arrow sortorder */ + -1, /* (222) item ::= ID */ + -3, /* (223) item ::= ID DOT ID */ + -1, /* (224) sortorder ::= ASC */ + -1, /* (225) sortorder ::= DESC */ + 0, /* (226) sortorder ::= */ + 0, /* (227) groupby_opt ::= */ + -3, /* (228) groupby_opt ::= GROUP BY grouplist */ + -3, /* (229) grouplist ::= grouplist COMMA item */ + -3, /* (230) grouplist ::= grouplist COMMA arrow */ + -1, /* (231) grouplist ::= item */ + -1, /* (232) grouplist ::= arrow */ + 0, /* (233) having_opt ::= */ + -2, /* (234) having_opt ::= HAVING expr */ + 0, /* (235) limit_opt ::= */ + -2, /* (236) limit_opt ::= LIMIT signed */ + -4, /* (237) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (238) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (239) slimit_opt ::= */ + -2, /* (240) slimit_opt ::= SLIMIT signed */ + -4, /* (241) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (242) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (243) where_opt ::= */ + -2, /* (244) where_opt ::= WHERE expr */ + -3, /* (245) expr ::= LP expr RP */ + -1, /* (246) expr ::= ID */ + -3, /* (247) expr ::= ID DOT ID */ + -3, /* (248) expr ::= ID DOT STAR */ + -1, /* (249) expr ::= INTEGER */ + -2, /* (250) expr ::= MINUS INTEGER */ + -2, /* (251) expr ::= PLUS INTEGER */ + -1, /* (252) expr ::= FLOAT */ + -2, /* (253) expr ::= MINUS FLOAT */ + -2, /* (254) expr ::= PLUS FLOAT */ + -1, /* (255) expr ::= STRING */ + -1, /* (256) expr ::= NOW */ + -1, /* (257) expr ::= VARIABLE */ + -2, /* (258) expr ::= PLUS VARIABLE */ + -2, /* (259) expr ::= MINUS VARIABLE */ + -1, /* (260) expr ::= BOOL */ + -1, /* (261) expr ::= NULL */ + -4, /* (262) expr ::= ID LP exprlist RP */ + -4, /* (263) expr ::= ID LP STAR RP */ + -6, /* (264) expr ::= ID LP expr AS typename RP */ + -3, /* (265) expr ::= expr IS NULL */ + -4, /* (266) expr ::= expr IS NOT NULL */ + -3, /* (267) expr ::= expr LT expr */ + -3, /* (268) expr ::= expr GT expr */ + -3, /* (269) expr ::= expr LE expr */ + -3, /* (270) expr ::= expr GE expr */ + -3, /* (271) expr ::= expr NE expr */ + -3, /* (272) expr ::= expr EQ expr */ + -5, /* (273) expr ::= expr BETWEEN expr AND expr */ + -3, /* (274) expr ::= expr AND expr */ + -3, /* (275) expr ::= expr OR expr */ + -3, /* (276) expr ::= expr PLUS expr */ + -3, /* (277) expr ::= expr MINUS expr */ + -3, /* (278) expr ::= expr STAR expr */ + -3, /* (279) expr ::= expr SLASH expr */ + -3, /* (280) expr ::= expr REM expr */ + -3, /* (281) expr ::= expr LIKE expr */ + -3, /* (282) expr ::= expr MATCH expr */ + -3, /* (283) expr ::= expr NMATCH expr */ + -3, /* (284) expr ::= ID CONTAINS STRING */ + -5, /* (285) expr ::= ID DOT ID CONTAINS STRING */ + -3, /* (286) arrow ::= ID ARROW STRING */ + -5, /* (287) arrow ::= ID DOT ID ARROW STRING */ + -1, /* (288) expr ::= arrow */ + -5, /* (289) expr ::= expr IN LP exprlist RP */ + -3, /* (290) exprlist ::= exprlist COMMA expritem */ + -1, /* (291) exprlist ::= expritem */ + -1, /* (292) expritem ::= expr */ + 0, /* (293) expritem ::= */ + -3, /* (294) cmd ::= RESET QUERY CACHE */ + -3, /* (295) cmd ::= SYNCDB ids REPLICA */ + -7, /* (296) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (297) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (298) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (299) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (300) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (301) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (302) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (303) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (304) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (305) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (306) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (307) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (308) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (309) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (310) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (311) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (312) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (313) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (314) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2966,7 +2974,7 @@ static YYACTIONTYPE yy_reduce( break; case 54: /* ifexists ::= */ case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56); - case 180: /* distinct ::= */ yytestcase(yyruleno==180); + case 182: /* distinct ::= */ yytestcase(yyruleno==182); { yymsp[1].minor.yy0.n = 0;} break; case 55: /* ifnotexists ::= IF NOT EXISTS */ @@ -3044,7 +3052,7 @@ static YYACTIONTYPE yy_reduce( case 157: /* tagitem ::= FLOAT */ yytestcase(yyruleno==157); case 158: /* tagitem ::= STRING */ yytestcase(yyruleno==158); case 159: /* tagitem ::= BOOL */ yytestcase(yyruleno==159); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true); } +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0); } yymsp[0].minor.yy162 = yylhsminor.yy162; break; case 88: /* keep ::= KEEP intitemlist */ @@ -3277,523 +3285,535 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy279 = yylhsminor.yy279; break; case 160: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true); } +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0); } yymsp[0].minor.yy162 = yylhsminor.yy162; break; case 161: /* tagitem ::= NOW */ -{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true);} +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreateExt(&yylhsminor.yy162, &yymsp[0].minor.yy0, TK_NOW, true);} yymsp[0].minor.yy162 = yylhsminor.yy162; break; - case 162: /* tagitem ::= MINUS INTEGER */ - case 163: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==163); - case 164: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==164); - case 165: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==165); + case 162: /* tagitem ::= NOW PLUS VARIABLE */ +{ + yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; + tVariantCreateExt(&yymsp[-2].minor.yy162, &yymsp[0].minor.yy0, TK_PLUS, true); +} + break; + case 163: /* tagitem ::= NOW MINUS VARIABLE */ +{ + yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; + tVariantCreateExt(&yymsp[-2].minor.yy162, &yymsp[0].minor.yy0, TK_MINUS, true); +} + break; + case 164: /* tagitem ::= MINUS INTEGER */ + case 165: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==165); + case 166: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==166); + case 167: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==167); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy162, &yymsp[-1].minor.yy0, true); + tVariantCreate(&yylhsminor.yy162, &yymsp[-1].minor.yy0); } yymsp[-1].minor.yy162 = yylhsminor.yy162; break; - case 166: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + case 168: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { yylhsminor.yy16 = tSetQuerySqlNode(&yymsp[-14].minor.yy0, yymsp[-13].minor.yy189, yymsp[-12].minor.yy36, yymsp[-11].minor.yy18, yymsp[-4].minor.yy189, yymsp[-2].minor.yy189, &yymsp[-9].minor.yy32, &yymsp[-7].minor.yy155, &yymsp[-6].minor.yy336, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy189, &yymsp[0].minor.yy38, &yymsp[-1].minor.yy38, yymsp[-3].minor.yy18, &yymsp[-10].minor.yy124); } yymsp[-14].minor.yy16 = yylhsminor.yy16; break; - case 167: /* select ::= LP select RP */ + case 169: /* select ::= LP select RP */ {yymsp[-2].minor.yy16 = yymsp[-1].minor.yy16;} break; - case 168: /* union ::= select */ + case 170: /* union ::= select */ { yylhsminor.yy189 = setSubclause(NULL, yymsp[0].minor.yy16); } yymsp[0].minor.yy189 = yylhsminor.yy189; break; - case 169: /* union ::= union UNION ALL select */ + case 171: /* union ::= union UNION ALL select */ { yylhsminor.yy189 = appendSelectClause(yymsp[-3].minor.yy189, yymsp[0].minor.yy16); } yymsp[-3].minor.yy189 = yylhsminor.yy189; break; - case 170: /* cmd ::= union */ + case 172: /* cmd ::= union */ { setSqlInfo(pInfo, yymsp[0].minor.yy189, NULL, TSDB_SQL_SELECT); } break; - case 171: /* select ::= SELECT selcollist */ + case 173: /* select ::= SELECT selcollist */ { yylhsminor.yy16 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy189, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } yymsp[-1].minor.yy16 = yylhsminor.yy16; break; - case 172: /* sclp ::= selcollist COMMA */ + case 174: /* sclp ::= selcollist COMMA */ {yylhsminor.yy189 = yymsp[-1].minor.yy189;} yymsp[-1].minor.yy189 = yylhsminor.yy189; break; - case 173: /* sclp ::= */ - case 214: /* orderby_opt ::= */ yytestcase(yyruleno==214); + case 175: /* sclp ::= */ + case 216: /* orderby_opt ::= */ yytestcase(yyruleno==216); {yymsp[1].minor.yy189 = 0;} break; - case 174: /* selcollist ::= sclp distinct expr as */ + case 176: /* selcollist ::= sclp distinct expr as */ { yylhsminor.yy189 = tSqlExprListAppend(yymsp[-3].minor.yy189, yymsp[-1].minor.yy18, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } yymsp[-3].minor.yy189 = yylhsminor.yy189; break; - case 175: /* selcollist ::= sclp STAR */ + case 177: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(pInfo, NULL, TK_ALL); yylhsminor.yy189 = tSqlExprListAppend(yymsp[-1].minor.yy189, pNode, 0, 0); } yymsp[-1].minor.yy189 = yylhsminor.yy189; break; - case 176: /* as ::= AS ids */ + case 178: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 177: /* as ::= ids */ + case 179: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 178: /* as ::= */ + case 180: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 179: /* distinct ::= DISTINCT */ + case 181: /* distinct ::= DISTINCT */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 181: /* from ::= FROM tablelist */ - case 182: /* from ::= FROM sub */ yytestcase(yyruleno==182); + case 183: /* from ::= FROM tablelist */ + case 184: /* from ::= FROM sub */ yytestcase(yyruleno==184); {yymsp[-1].minor.yy36 = yymsp[0].minor.yy36;} break; - case 183: /* sub ::= LP union RP */ + case 185: /* sub ::= LP union RP */ {yymsp[-2].minor.yy36 = addSubqueryElem(NULL, yymsp[-1].minor.yy189, NULL);} break; - case 184: /* sub ::= LP union RP ids */ + case 186: /* sub ::= LP union RP ids */ {yymsp[-3].minor.yy36 = addSubqueryElem(NULL, yymsp[-2].minor.yy189, &yymsp[0].minor.yy0);} break; - case 185: /* sub ::= sub COMMA LP union RP ids */ + case 187: /* sub ::= sub COMMA LP union RP ids */ {yylhsminor.yy36 = addSubqueryElem(yymsp[-5].minor.yy36, yymsp[-2].minor.yy189, &yymsp[0].minor.yy0);} yymsp[-5].minor.yy36 = yylhsminor.yy36; break; - case 186: /* tablelist ::= ids cpxName */ + case 188: /* tablelist ::= ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy36 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } yymsp[-1].minor.yy36 = yylhsminor.yy36; break; - case 187: /* tablelist ::= ids cpxName ids */ + case 189: /* tablelist ::= ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yylhsminor.yy36 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy36 = yylhsminor.yy36; break; - case 188: /* tablelist ::= tablelist COMMA ids cpxName */ + case 190: /* tablelist ::= tablelist COMMA ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy36 = setTableNameList(yymsp[-3].minor.yy36, &yymsp[-1].minor.yy0, NULL); } yymsp[-3].minor.yy36 = yylhsminor.yy36; break; - case 189: /* tablelist ::= tablelist COMMA ids cpxName ids */ + case 191: /* tablelist ::= tablelist COMMA ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yylhsminor.yy36 = setTableNameList(yymsp[-4].minor.yy36, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } yymsp[-4].minor.yy36 = yylhsminor.yy36; break; - case 190: /* tmvar ::= VARIABLE */ + case 192: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 191: /* timestamp ::= INTEGER */ + case 193: /* timestamp ::= INTEGER */ { yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_INTEGER);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 192: /* timestamp ::= MINUS INTEGER */ - case 193: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==193); + case 194: /* timestamp ::= MINUS INTEGER */ + case 195: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==195); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[-1].minor.yy0, TK_INTEGER);} yymsp[-1].minor.yy18 = yylhsminor.yy18; break; - case 194: /* timestamp ::= STRING */ + case 196: /* timestamp ::= STRING */ { yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_STRING);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 195: /* timestamp ::= NOW */ + case 197: /* timestamp ::= NOW */ { yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_NOW); } yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 196: /* timestamp ::= NOW PLUS VARIABLE */ + case 198: /* timestamp ::= NOW PLUS VARIABLE */ {yymsp[-2].minor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_PLUS); } break; - case 197: /* timestamp ::= NOW MINUS VARIABLE */ + case 199: /* timestamp ::= NOW MINUS VARIABLE */ {yymsp[-2].minor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_MINUS); } break; - case 198: /* range_option ::= */ + case 200: /* range_option ::= */ {yymsp[1].minor.yy124.start = 0; yymsp[1].minor.yy124.end = 0;} break; - case 199: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */ + case 201: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */ {yymsp[-5].minor.yy124.start = yymsp[-3].minor.yy18; yymsp[-5].minor.yy124.end = yymsp[-1].minor.yy18;} break; - case 200: /* interval_option ::= intervalKey LP tmvar RP */ + case 202: /* interval_option ::= intervalKey LP tmvar RP */ {yylhsminor.yy32.interval = yymsp[-1].minor.yy0; yylhsminor.yy32.offset.n = 0; yylhsminor.yy32.token = yymsp[-3].minor.yy516;} yymsp[-3].minor.yy32 = yylhsminor.yy32; break; - case 201: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + case 203: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ {yylhsminor.yy32.interval = yymsp[-3].minor.yy0; yylhsminor.yy32.offset = yymsp[-1].minor.yy0; yylhsminor.yy32.token = yymsp[-5].minor.yy516;} yymsp[-5].minor.yy32 = yylhsminor.yy32; break; - case 202: /* interval_option ::= */ + case 204: /* interval_option ::= */ {memset(&yymsp[1].minor.yy32, 0, sizeof(yymsp[1].minor.yy32));} break; - case 203: /* intervalKey ::= INTERVAL */ + case 205: /* intervalKey ::= INTERVAL */ {yymsp[0].minor.yy516 = TK_INTERVAL;} break; - case 204: /* intervalKey ::= EVERY */ + case 206: /* intervalKey ::= EVERY */ {yymsp[0].minor.yy516 = TK_EVERY; } break; - case 205: /* session_option ::= */ + case 207: /* session_option ::= */ {yymsp[1].minor.yy155.col.n = 0; yymsp[1].minor.yy155.gap.n = 0;} break; - case 206: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + case 208: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-6].minor.yy155.col = yymsp[-4].minor.yy0; yymsp[-6].minor.yy155.gap = yymsp[-1].minor.yy0; } break; - case 207: /* windowstate_option ::= */ + case 209: /* windowstate_option ::= */ { yymsp[1].minor.yy336.col.n = 0; yymsp[1].minor.yy336.col.z = NULL;} break; - case 208: /* windowstate_option ::= STATE_WINDOW LP ids RP */ + case 210: /* windowstate_option ::= STATE_WINDOW LP ids RP */ { yymsp[-3].minor.yy336.col = yymsp[-1].minor.yy0; } break; - case 209: /* fill_opt ::= */ + case 211: /* fill_opt ::= */ { yymsp[1].minor.yy189 = 0; } break; - case 210: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 212: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); - tVariantCreate(&A, &yymsp[-3].minor.yy0, true); + tVariantCreate(&A, &yymsp[-3].minor.yy0); tVariantListInsert(yymsp[-1].minor.yy189, &A, -1, 0); yymsp[-5].minor.yy189 = yymsp[-1].minor.yy189; } break; - case 211: /* fill_opt ::= FILL LP ID RP */ + case 213: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-3].minor.yy189 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true); } break; - case 212: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 214: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 213: /* sliding_opt ::= */ + case 215: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 215: /* orderby_opt ::= ORDER BY sortlist */ + case 217: /* orderby_opt ::= ORDER BY sortlist */ {yymsp[-2].minor.yy189 = yymsp[0].minor.yy189;} break; - case 216: /* sortlist ::= sortlist COMMA item sortorder */ + case 218: /* sortlist ::= sortlist COMMA item sortorder */ { yylhsminor.yy189 = commonItemAppend(yymsp[-3].minor.yy189, &yymsp[-1].minor.yy162, NULL, false, yymsp[0].minor.yy420); } yymsp[-3].minor.yy189 = yylhsminor.yy189; break; - case 217: /* sortlist ::= sortlist COMMA arrow sortorder */ + case 219: /* sortlist ::= sortlist COMMA arrow sortorder */ { yylhsminor.yy189 = commonItemAppend(yymsp[-3].minor.yy189, NULL, yymsp[-1].minor.yy18, true, yymsp[0].minor.yy420); } yymsp[-3].minor.yy189 = yylhsminor.yy189; break; - case 218: /* sortlist ::= item sortorder */ + case 220: /* sortlist ::= item sortorder */ { yylhsminor.yy189 = commonItemAppend(NULL, &yymsp[-1].minor.yy162, NULL, false, yymsp[0].minor.yy420); } yymsp[-1].minor.yy189 = yylhsminor.yy189; break; - case 219: /* sortlist ::= arrow sortorder */ + case 221: /* sortlist ::= arrow sortorder */ { yylhsminor.yy189 = commonItemAppend(NULL, NULL, yymsp[-1].minor.yy18, true, yymsp[0].minor.yy420); } yymsp[-1].minor.yy189 = yylhsminor.yy189; break; - case 220: /* item ::= ID */ + case 222: /* item ::= ID */ { toTSDBType(yymsp[0].minor.yy0.type); - tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true); + tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0); } yymsp[0].minor.yy162 = yylhsminor.yy162; break; - case 221: /* item ::= ID DOT ID */ + case 223: /* item ::= ID DOT ID */ { toTSDBType(yymsp[-2].minor.yy0.type); yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); - tVariantCreate(&yylhsminor.yy162, &yymsp[-2].minor.yy0, true); + tVariantCreate(&yylhsminor.yy162, &yymsp[-2].minor.yy0); } yymsp[-2].minor.yy162 = yylhsminor.yy162; break; - case 222: /* sortorder ::= ASC */ + case 224: /* sortorder ::= ASC */ { yymsp[0].minor.yy420 = TSDB_ORDER_ASC; } break; - case 223: /* sortorder ::= DESC */ + case 225: /* sortorder ::= DESC */ { yymsp[0].minor.yy420 = TSDB_ORDER_DESC;} break; - case 224: /* sortorder ::= */ + case 226: /* sortorder ::= */ { yymsp[1].minor.yy420 = TSDB_ORDER_ASC; } break; - case 225: /* groupby_opt ::= */ + case 227: /* groupby_opt ::= */ { yymsp[1].minor.yy189 = 0;} break; - case 226: /* groupby_opt ::= GROUP BY grouplist */ + case 228: /* groupby_opt ::= GROUP BY grouplist */ { yymsp[-2].minor.yy189 = yymsp[0].minor.yy189;} break; - case 227: /* grouplist ::= grouplist COMMA item */ + case 229: /* grouplist ::= grouplist COMMA item */ { yylhsminor.yy189 = commonItemAppend(yymsp[-2].minor.yy189, &yymsp[0].minor.yy162, NULL, false, -1); } yymsp[-2].minor.yy189 = yylhsminor.yy189; break; - case 228: /* grouplist ::= grouplist COMMA arrow */ + case 230: /* grouplist ::= grouplist COMMA arrow */ { yylhsminor.yy189 = commonItemAppend(yymsp[-2].minor.yy189, NULL, yymsp[0].minor.yy18, true, -1); } yymsp[-2].minor.yy189 = yylhsminor.yy189; break; - case 229: /* grouplist ::= item */ + case 231: /* grouplist ::= item */ { yylhsminor.yy189 = commonItemAppend(NULL, &yymsp[0].minor.yy162, NULL, false, -1); } yymsp[0].minor.yy189 = yylhsminor.yy189; break; - case 230: /* grouplist ::= arrow */ + case 232: /* grouplist ::= arrow */ { yylhsminor.yy189 = commonItemAppend(NULL, NULL, yymsp[0].minor.yy18, true, -1); } yymsp[0].minor.yy189 = yylhsminor.yy189; break; - case 231: /* having_opt ::= */ - case 241: /* where_opt ::= */ yytestcase(yyruleno==241); - case 291: /* expritem ::= */ yytestcase(yyruleno==291); + case 233: /* having_opt ::= */ + case 243: /* where_opt ::= */ yytestcase(yyruleno==243); + case 293: /* expritem ::= */ yytestcase(yyruleno==293); {yymsp[1].minor.yy18 = 0;} break; - case 232: /* having_opt ::= HAVING expr */ - case 242: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==242); + case 234: /* having_opt ::= HAVING expr */ + case 244: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==244); {yymsp[-1].minor.yy18 = yymsp[0].minor.yy18;} break; - case 233: /* limit_opt ::= */ - case 237: /* slimit_opt ::= */ yytestcase(yyruleno==237); + case 235: /* limit_opt ::= */ + case 239: /* slimit_opt ::= */ yytestcase(yyruleno==239); {yymsp[1].minor.yy38.limit = -1; yymsp[1].minor.yy38.offset = 0;} break; - case 234: /* limit_opt ::= LIMIT signed */ - case 238: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==238); + case 236: /* limit_opt ::= LIMIT signed */ + case 240: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==240); {yymsp[-1].minor.yy38.limit = yymsp[0].minor.yy69; yymsp[-1].minor.yy38.offset = 0;} break; - case 235: /* limit_opt ::= LIMIT signed OFFSET signed */ + case 237: /* limit_opt ::= LIMIT signed OFFSET signed */ { yymsp[-3].minor.yy38.limit = yymsp[-2].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[0].minor.yy69;} break; - case 236: /* limit_opt ::= LIMIT signed COMMA signed */ + case 238: /* limit_opt ::= LIMIT signed COMMA signed */ { yymsp[-3].minor.yy38.limit = yymsp[0].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[-2].minor.yy69;} break; - case 239: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ + case 241: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ {yymsp[-3].minor.yy38.limit = yymsp[-2].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[0].minor.yy69;} break; - case 240: /* slimit_opt ::= SLIMIT signed COMMA signed */ + case 242: /* slimit_opt ::= SLIMIT signed COMMA signed */ {yymsp[-3].minor.yy38.limit = yymsp[0].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[-2].minor.yy69;} break; - case 243: /* expr ::= LP expr RP */ + case 245: /* expr ::= LP expr RP */ {yylhsminor.yy18 = yymsp[-1].minor.yy18; yylhsminor.yy18->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy18->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 244: /* expr ::= ID */ + case 246: /* expr ::= ID */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 245: /* expr ::= ID DOT ID */ + case 247: /* expr ::= ID DOT ID */ { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 246: /* expr ::= ID DOT STAR */ + case 248: /* expr ::= ID DOT STAR */ { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 247: /* expr ::= INTEGER */ + case 249: /* expr ::= INTEGER */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 248: /* expr ::= MINUS INTEGER */ - case 249: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==249); + case 250: /* expr ::= MINUS INTEGER */ + case 251: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==251); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} yymsp[-1].minor.yy18 = yylhsminor.yy18; break; - case 250: /* expr ::= FLOAT */ + case 252: /* expr ::= FLOAT */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 251: /* expr ::= MINUS FLOAT */ - case 252: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==252); + case 253: /* expr ::= MINUS FLOAT */ + case 254: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==254); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} yymsp[-1].minor.yy18 = yylhsminor.yy18; break; - case 253: /* expr ::= STRING */ + case 255: /* expr ::= STRING */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 254: /* expr ::= NOW */ + case 256: /* expr ::= NOW */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 255: /* expr ::= VARIABLE */ + case 257: /* expr ::= VARIABLE */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 256: /* expr ::= PLUS VARIABLE */ - case 257: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==257); + case 258: /* expr ::= PLUS VARIABLE */ + case 259: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==259); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} yymsp[-1].minor.yy18 = yylhsminor.yy18; break; - case 258: /* expr ::= BOOL */ + case 260: /* expr ::= BOOL */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 259: /* expr ::= NULL */ + case 261: /* expr ::= NULL */ { yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 260: /* expr ::= ID LP exprlist RP */ + case 262: /* expr ::= ID LP exprlist RP */ { tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy18 = tSqlExprCreateFunction(yymsp[-1].minor.yy189, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy18 = yylhsminor.yy18; break; - case 261: /* expr ::= ID LP STAR RP */ + case 263: /* expr ::= ID LP STAR RP */ { tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy18 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy18 = yylhsminor.yy18; break; - case 262: /* expr ::= ID LP expr AS typename RP */ + case 264: /* expr ::= ID LP expr AS typename RP */ { tStrTokenAppend(pInfo->funcs, &yymsp[-5].minor.yy0); yylhsminor.yy18 = tSqlExprCreateFuncWithParams(pInfo, yymsp[-3].minor.yy18, &yymsp[-1].minor.yy279, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, yymsp[-5].minor.yy0.type); } yymsp[-5].minor.yy18 = yylhsminor.yy18; break; - case 263: /* expr ::= expr IS NULL */ + case 265: /* expr ::= expr IS NULL */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, NULL, TK_ISNULL);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 264: /* expr ::= expr IS NOT NULL */ + case 266: /* expr ::= expr IS NOT NULL */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-3].minor.yy18, NULL, TK_NOTNULL);} yymsp[-3].minor.yy18 = yylhsminor.yy18; break; - case 265: /* expr ::= expr LT expr */ + case 267: /* expr ::= expr LT expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_LT);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 266: /* expr ::= expr GT expr */ + case 268: /* expr ::= expr GT expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_GT);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 267: /* expr ::= expr LE expr */ + case 269: /* expr ::= expr LE expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_LE);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 268: /* expr ::= expr GE expr */ + case 270: /* expr ::= expr GE expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_GE);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 269: /* expr ::= expr NE expr */ + case 271: /* expr ::= expr NE expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_NE);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 270: /* expr ::= expr EQ expr */ + case 272: /* expr ::= expr EQ expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_EQ);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 271: /* expr ::= expr BETWEEN expr AND expr */ + case 273: /* expr ::= expr BETWEEN expr AND expr */ { tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy18); yylhsminor.yy18 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy18, yymsp[-2].minor.yy18, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy18, TK_LE), TK_AND);} yymsp[-4].minor.yy18 = yylhsminor.yy18; break; - case 272: /* expr ::= expr AND expr */ + case 274: /* expr ::= expr AND expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_AND);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 273: /* expr ::= expr OR expr */ + case 275: /* expr ::= expr OR expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_OR); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 274: /* expr ::= expr PLUS expr */ + case 276: /* expr ::= expr PLUS expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_PLUS); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 275: /* expr ::= expr MINUS expr */ + case 277: /* expr ::= expr MINUS expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_MINUS); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 276: /* expr ::= expr STAR expr */ + case 278: /* expr ::= expr STAR expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_STAR); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 277: /* expr ::= expr SLASH expr */ + case 279: /* expr ::= expr SLASH expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_DIVIDE);} yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 278: /* expr ::= expr REM expr */ + case 280: /* expr ::= expr REM expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_REM); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 279: /* expr ::= expr LIKE expr */ + case 281: /* expr ::= expr LIKE expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_LIKE); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 280: /* expr ::= expr MATCH expr */ + case 282: /* expr ::= expr MATCH expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_MATCH); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 281: /* expr ::= expr NMATCH expr */ + case 283: /* expr ::= expr NMATCH expr */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_NMATCH); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 282: /* expr ::= ID CONTAINS STRING */ + case 284: /* expr ::= ID CONTAINS STRING */ { tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_CONTAINS); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 283: /* expr ::= ID DOT ID CONTAINS STRING */ + case 285: /* expr ::= ID DOT ID CONTAINS STRING */ { yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_CONTAINS); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; - case 284: /* arrow ::= ID ARROW STRING */ + case 286: /* arrow ::= ID ARROW STRING */ {tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_ARROW); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; - case 285: /* arrow ::= ID DOT ID ARROW STRING */ + case 287: /* arrow ::= ID DOT ID ARROW STRING */ {yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_ARROW); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; - case 286: /* expr ::= arrow */ - case 290: /* expritem ::= expr */ yytestcase(yyruleno==290); + case 288: /* expr ::= arrow */ + case 292: /* expritem ::= expr */ yytestcase(yyruleno==292); {yylhsminor.yy18 = yymsp[0].minor.yy18;} yymsp[0].minor.yy18 = yylhsminor.yy18; break; - case 287: /* expr ::= expr IN LP exprlist RP */ + case 289: /* expr ::= expr IN LP exprlist RP */ {yylhsminor.yy18 = tSqlExprCreate(yymsp[-4].minor.yy18, (tSqlExpr*)yymsp[-1].minor.yy189, TK_IN); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; - case 288: /* exprlist ::= exprlist COMMA expritem */ + case 290: /* exprlist ::= exprlist COMMA expritem */ {yylhsminor.yy189 = tSqlExprListAppend(yymsp[-2].minor.yy189,yymsp[0].minor.yy18,0, 0);} yymsp[-2].minor.yy189 = yylhsminor.yy189; break; - case 289: /* exprlist ::= expritem */ + case 291: /* exprlist ::= expritem */ {yylhsminor.yy189 = tSqlExprListAppend(0,yymsp[0].minor.yy18,0, 0);} yymsp[0].minor.yy189 = yylhsminor.yy189; break; - case 292: /* cmd ::= RESET QUERY CACHE */ + case 294: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 293: /* cmd ::= SYNCDB ids REPLICA */ + case 295: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 294: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 296: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 295: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 297: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3804,21 +3824,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 296: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + case 298: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 297: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 299: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 298: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 300: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3829,7 +3849,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 299: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 301: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3843,7 +3863,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 300: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 302: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3855,21 +3875,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 301: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + case 303: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 302: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 304: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 303: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 305: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3880,21 +3900,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 304: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + case 306: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 305: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 307: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 306: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 308: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3905,7 +3925,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 307: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 309: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3919,7 +3939,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 308: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + case 310: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3931,20 +3951,20 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 309: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + case 311: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 310: /* cmd ::= KILL CONNECTION INTEGER */ + case 312: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 311: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 313: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 312: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 314: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 232d10a7d07594c9c62cd13767c320da27af2a73..7b5dafcc8e771ba7d6e7b5691226bbc84a556ef8 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -131,7 +131,7 @@ void taosCloseLog() { taosStopLog(); //tsem_post(&(tsLogObj.logHandle->buffNotEmpty)); taosMsleep(MAX_LOG_INTERVAL/1000); - if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { + if (tsLogObj.logHandle && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { pthread_join(tsLogObj.logHandle->asyncThread, NULL); } // In case that other threads still use log resources causing invalid write in valgrind diff --git a/tests/develop-test/0-management/3-tag/json_tag.py b/tests/develop-test/0-management/3-tag/json_tag.py index 4810ec8b4e2437f5aecbb67a10c8d2ce4e5c55c5..dc7affe870f4462526aa1095311278d280abe77f 100644 --- a/tests/develop-test/0-management/3-tag/json_tag.py +++ b/tests/develop-test/0-management/3-tag/json_tag.py @@ -16,6 +16,7 @@ import taos from util.log import tdLog from util.cases import tdCases from util.sql import tdSql +import json class TDTestCase: @@ -505,6 +506,11 @@ class TDTestCase: tdSql.query("select round(dataint) from jsons1 where jtag->'tag1'>1") tdSql.checkRows(3) + #test TD-12077 + tdSql.execute("insert into jsons1_16 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":-2.111}') values(1591062628000, 2, NULL, '你就会', 'dws')") + tdSql.query("select jtag->'tag3' from jsons1_16") + tdSql.checkData(0, 0, '-2.111000000') + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/examples/C#/taosdemo/taosdemo.cs b/tests/examples/C#/taosdemo/taosdemo.cs index 2c77285488830323ed03a04a1d1c89c048ad2ea8..e62a502d1508c1339e559160b50da39e622a021f 100644 --- a/tests/examples/C#/taosdemo/taosdemo.cs +++ b/tests/examples/C#/taosdemo/taosdemo.cs @@ -361,7 +361,10 @@ namespace TDengineDriver threadArr[i] = new Thread(createTableThread.ThreadMain); threadArr[i].Start(); - threadArr[i].Join(); + } + for (int j = 0; j < numOfThreads; j++) + { + threadArr[j].Join(); } } @@ -482,7 +485,10 @@ namespace TDengineDriver threadArr[i] = new Thread(insertThread.ThreadMain); threadArr[i].Start(); - threadArr[i].Join(); + } + for (int j = 0; j < numOfThreads; j++) + { + threadArr[j].Join(); } } diff --git a/tests/pytest/fulltest-connector.sh b/tests/pytest/fulltest-connector.sh new file mode 100755 index 0000000000000000000000000000000000000000..eb685bd2146508a55d470c45bd3b4780997de64c --- /dev/null +++ b/tests/pytest/fulltest-connector.sh @@ -0,0 +1,9 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +# restful test for python +# python3 test.py -f restful/restful_bind_db1.py +# python3 test.py -f restful/restful_bind_db2.py +python3 ./test.py -f client/nettest.py \ No newline at end of file diff --git a/tests/pytest/fulltest-insert.sh b/tests/pytest/fulltest-insert.sh new file mode 100755 index 0000000000000000000000000000000000000000..6a2a027c818ecc018829436b63e86a9d96629e5b --- /dev/null +++ b/tests/pytest/fulltest-insert.sh @@ -0,0 +1,154 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +python3 testCompress.py +python3 testNoCompress.py + +python3 ./test.py -f import_merge/importBlock1HO.py +python3 ./test.py -f import_merge/importBlock1HPO.py +python3 ./test.py -f import_merge/importBlock1H.py +python3 ./test.py -f import_merge/importBlock1S.py +python3 ./test.py -f import_merge/importBlock1Sub.py +python3 ./test.py -f import_merge/importBlock1TO.py +python3 ./test.py -f import_merge/importBlock1TPO.py +python3 ./test.py -f import_merge/importBlock1T.py +python3 ./test.py -f import_merge/importBlock2HO.py +python3 ./test.py -f import_merge/importBlock2HPO.py +python3 ./test.py -f import_merge/importBlock2H.py +python3 ./test.py -f import_merge/importBlock2S.py +python3 ./test.py -f import_merge/importBlock2Sub.py +python3 ./test.py -f import_merge/importBlock2TO.py +python3 ./test.py -f import_merge/importBlock2TPO.py +python3 ./test.py -f import_merge/importBlock2T.py +python3 ./test.py -f import_merge/importBlockbetween.py +python3 ./test.py -f import_merge/importCacheFileHO.py +python3 ./test.py -f import_merge/importCacheFileHPO.py +python3 ./test.py -f import_merge/importCacheFileH.py +python3 ./test.py -f import_merge/importCacheFileS.py +python3 ./test.py -f import_merge/importCacheFileSub.py +python3 ./test.py -f import_merge/importCacheFileTO.py +python3 ./test.py -f import_merge/importCacheFileTPO.py +python3 ./test.py -f import_merge/importCacheFileT.py +python3 ./test.py -f import_merge/importDataH2.py +python3 ./test.py -f import_merge/importDataHO2.py +python3 ./test.py -f import_merge/importDataHO.py +python3 ./test.py -f import_merge/importDataHPO.py +python3 ./test.py -f import_merge/importDataLastHO.py +python3 ./test.py -f import_merge/importDataLastHPO.py +python3 ./test.py -f import_merge/importDataLastH.py +python3 ./test.py -f import_merge/importDataLastS.py +python3 ./test.py -f import_merge/importDataLastSub.py +python3 ./test.py -f import_merge/importDataLastTO.py +python3 ./test.py -f import_merge/importDataLastTPO.py +python3 ./test.py -f import_merge/importDataLastT.py +python3 ./test.py -f import_merge/importDataS.py +python3 ./test.py -f import_merge/importDataSub.py +python3 ./test.py -f import_merge/importDataTO.py +python3 ./test.py -f import_merge/importDataTPO.py +python3 ./test.py -f import_merge/importDataT.py +python3 ./test.py -f import_merge/importHeadOverlap.py +python3 ./test.py -f import_merge/importHeadPartOverlap.py +python3 ./test.py -f import_merge/importHead.py +python3 ./test.py -f import_merge/importHORestart.py +python3 ./test.py -f import_merge/importHPORestart.py +python3 ./test.py -f import_merge/importHRestart.py +python3 ./test.py -f import_merge/importLastHO.py +python3 ./test.py -f import_merge/importLastHPO.py +python3 ./test.py -f import_merge/importLastH.py +python3 ./test.py -f import_merge/importLastS.py +python3 ./test.py -f import_merge/importLastSub.py +python3 ./test.py -f import_merge/importLastTO.py +python3 ./test.py -f import_merge/importLastTPO.py +python3 ./test.py -f import_merge/importLastT.py +python3 ./test.py -f import_merge/importSpan.py +python3 ./test.py -f import_merge/importSRestart.py +python3 ./test.py -f import_merge/importSubRestart.py +python3 ./test.py -f import_merge/importTailOverlap.py +python3 ./test.py -f import_merge/importTailPartOverlap.py +python3 ./test.py -f import_merge/importTail.py +python3 ./test.py -f import_merge/importToCommit.py +python3 ./test.py -f import_merge/importTORestart.py +python3 ./test.py -f import_merge/importTPORestart.py +python3 ./test.py -f import_merge/importTRestart.py +python3 ./test.py -f import_merge/importInsertThenImport.py +python3 ./test.py -f import_merge/importCSV.py +python3 ./test.py -f import_merge/import_update_0.py +python3 ./test.py -f import_merge/import_update_1.py +python3 ./test.py -f import_merge/import_update_2.py + +python3 ./test.py -f insert/basic.py +python3 ./test.py -f insert/int.py +python3 ./test.py -f insert/float.py +python3 ./test.py -f insert/bigint.py +python3 ./test.py -f insert/bool.py +python3 ./test.py -f insert/double.py +python3 ./test.py -f insert/smallint.py +python3 ./test.py -f insert/tinyint.py +python3 ./test.py -f insert/date.py +python3 ./test.py -f insert/binary.py +python3 ./test.py -f insert/nchar.py +#python3 ./test.py -f insert/nchar-boundary.py +python3 ./test.py -f insert/nchar-unicode.py +python3 ./test.py -f insert/multi.py +python3 ./test.py -f insert/randomNullCommit.py +python3 insert/retentionpolicy.py +python3 ./test.py -f insert/alterTableAndInsert.py +python3 ./test.py -f insert/insertIntoTwoTables.py +python3 ./test.py -f insert/before_1970.py +python3 ./test.py -f insert/special_character_show.py +python3 bug2265.py +python3 ./test.py -f insert/bug3654.py +python3 ./test.py -f insert/insertDynamicColBeforeVal.py +python3 ./test.py -f insert/in_function.py +python3 ./test.py -f insert/modify_column.py +#python3 ./test.py -f insert/line_insert.py +python3 ./test.py -f insert/specialSql.py +python3 ./test.py -f insert/timestamp.py +python3 ./test.py -f insert/metadataUpdate.py +python3 ./test.py -f insert/unsignedInt.py +python3 ./test.py -f insert/unsignedBigint.py +python3 ./test.py -f insert/unsignedSmallint.py +python3 ./test.py -f insert/unsignedTinyint.py +python3 ./test.py -f insert/insertFromCSV.py +python3 ./test.py -f insert/boundary2.py +python3 ./test.py -f insert/insert_locking.py +python3 test.py -f insert/insert_before_use_db.py +python3 ./test.py -f insert/flushwhiledrop.py +python3 ./test.py -f insert/verifyMemToDiskCrash.py +#python3 ./test.py -f insert/schemalessInsert.py +#python3 ./test.py -f insert/openTsdbJsonInsert.py +python3 ./test.py -f insert/openTsdbTelnetLinesInsert.py + + +# update +python3 ./test.py -f update/merge_commit_data.py +python3 ./test.py -f update/allow_update.py +python3 ./test.py -f update/allow_update-0.py +python3 ./test.py -f update/append_commit_data.py +python3 ./test.py -f update/append_commit_last-0.py +python3 ./test.py -f update/append_commit_last.py + + +python3 ./test.py -f update/merge_commit_data2.py +python3 ./test.py -f update/merge_commit_data2_update0.py +python3 ./test.py -f update/merge_commit_last-0.py +python3 ./test.py -f update/merge_commit_last.py +python3 ./test.py -f update/update_options.py +python3 ./test.py -f update/merge_commit_data-0.py + +# wal +python3 ./test.py -f wal/addOldWalTest.py +python3 ./test.py -f wal/sdbComp.py + + + + + + + + + + + diff --git a/tests/pytest/fulltest-others.sh b/tests/pytest/fulltest-others.sh new file mode 100755 index 0000000000000000000000000000000000000000..e0b0851a22de16dbc3e6aea17937121573eb9997 --- /dev/null +++ b/tests/pytest/fulltest-others.sh @@ -0,0 +1,48 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +#python3 ./test.py -f dbmgmt/database-name-boundary.py +python3 test.py -f dbmgmt/nanoSecondCheck.py + +# +python3 ./test.py -f tsdb/tsdbComp.py + +# user +python3 ./test.py -f user/user_create.py +python3 ./test.py -f user/pass_len.py + +# perfbenchmark +python3 ./test.py -f perfbenchmark/bug3433.py +#python3 ./test.py -f perfbenchmark/bug3589.py +#python3 ./test.py -f perfbenchmark/taosdemoInsert.py + +#alter table +python3 ./test.py -f alter/alter_table_crash.py +python3 ./test.py -f alter/alterTabAddTagWithNULL.py +python3 ./test.py -f alter/alterTimestampColDataProcess.py +python3 ./test.py -f alter/alter_table.py +python3 ./test.py -f alter/alter_debugFlag.py +python3 ./test.py -f alter/alter_keep.py +python3 ./test.py -f alter/alter_cacheLastRow.py +python3 ./test.py -f alter/alter_create_exception.py +python3 ./test.py -f alter/alterColMultiTimes.py + +python3 ./test.py -f account/account_create.py + +# client +python3 ./test.py -f client/client.py +python3 ./test.py -f client/version.py +python3 ./test.py -f client/alterDatabase.py +python3 ./test.py -f client/noConnectionErrorTest.py +python3 ./test.py -f client/taoshellCheckCase.py +# python3 ./test.py -f client/change_time_1_1.py +# python3 ./test.py -f client/change_time_1_2.py +python3 client/twoClients.py + +python3 testMinTablesPerVnode.py + +# topic +python3 ./test.py -f topic/topicQuery.py + diff --git a/tests/pytest/fulltest-query.sh b/tests/pytest/fulltest-query.sh new file mode 100755 index 0000000000000000000000000000000000000000..04e1eb7c527a69fdadf78985062ee2ba02d41517 --- /dev/null +++ b/tests/pytest/fulltest-query.sh @@ -0,0 +1,200 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + + +# timezone +python3 ./test.py -f TimeZone/TestCaseTimeZone.py + +#stable +python3 ./test.py -f stable/insert.py +python3 ./test.py -f stable/query_after_reset.py + +#table +python3 ./test.py -f table/alter_wal0.py +python3 ./test.py -f table/column_name.py +python3 ./test.py -f table/column_num.py +python3 ./test.py -f table/db_table.py +python3 ./test.py -f table/create_sensitive.py +python3 ./test.py -f table/tablename-boundary.py +python3 ./test.py -f table/max_table_length.py +python3 ./test.py -f table/alter_column.py +python3 ./test.py -f table/boundary.py +#python3 ./test.py -f table/create.py +python3 ./test.py -f table/del_stable.py +python3 ./test.py -f table/create_db_from_normal_db.py + +# tag +python3 ./test.py -f tag_lite/filter.py +python3 ./test.py -f tag_lite/create-tags-boundary.py +python3 ./test.py -f tag_lite/3.py +python3 ./test.py -f tag_lite/4.py +python3 ./test.py -f tag_lite/5.py +python3 ./test.py -f tag_lite/6.py +python3 ./test.py -f tag_lite/add.py +python3 ./test.py -f tag_lite/bigint.py +python3 ./test.py -f tag_lite/binary_binary.py +python3 ./test.py -f tag_lite/binary.py +python3 ./test.py -f tag_lite/bool_binary.py +python3 ./test.py -f tag_lite/bool_int.py +python3 ./test.py -f tag_lite/bool.py +python3 ./test.py -f tag_lite/change.py +python3 ./test.py -f tag_lite/column.py +python3 ./test.py -f tag_lite/commit.py +python3 ./test.py -f tag_lite/create.py +python3 ./test.py -f tag_lite/datatype.py +python3 ./test.py -f tag_lite/datatype-without-alter.py +python3 ./test.py -f tag_lite/delete.py +python3 ./test.py -f tag_lite/double.py +python3 ./test.py -f tag_lite/float.py +python3 ./test.py -f tag_lite/int_binary.py +python3 ./test.py -f tag_lite/int_float.py +python3 ./test.py -f tag_lite/int.py +python3 ./test.py -f tag_lite/set.py +python3 ./test.py -f tag_lite/smallint.py +python3 ./test.py -f tag_lite/tinyint.py +python3 ./test.py -f tag_lite/timestamp.py +python3 ./test.py -f tag_lite/TestModifyTag.py +python3 ./test.py -f tag_lite/unsignedInt.py +python3 ./test.py -f tag_lite/unsignedBigint.py +python3 ./test.py -f tag_lite/unsignedSmallint.py +python3 ./test.py -f tag_lite/unsignedTinyint.py +python3 ./test.py -f tag_lite/alter_tag.py +python3 ./test.py -f tag_lite/drop_auto_create.py +python3 ./test.py -f tag_lite/json_tag_extra.py + +#query +python3 ./test.py -f query/distinctOneColTb.py +python3 ./test.py -f query/filter.py +python3 ./test.py -f query/filterCombo.py +python3 ./test.py -f query/queryNormal.py +python3 ./test.py -f query/queryError.py +python3 ./test.py -f query/filterAllIntTypes.py +python3 ./test.py -f query/filterFloatAndDouble.py +python3 ./test.py -f query/filterOtherTypes.py +python3 ./test.py -f query/querySort.py +python3 ./test.py -f query/queryJoin.py +python3 ./test.py -f query/select_last_crash.py +python3 ./test.py -f query/queryNullValueTest.py +python3 ./test.py -f query/queryInsertValue.py +python3 ./test.py -f query/queryConnection.py +python3 ./test.py -f query/queryCountCSVData.py +python3 ./test.py -f query/natualInterval.py +python3 ./test.py -f query/bug1471.py +#python3 ./test.py -f query/dataLossTest.py +python3 ./test.py -f query/bug1874.py +python3 ./test.py -f query/bug1875.py +python3 ./test.py -f query/bug1876.py +python3 ./test.py -f query/bug2218.py +python3 ./test.py -f query/bug2117.py +python3 ./test.py -f query/bug2118.py +python3 ./test.py -f query/bug2143.py +python3 ./test.py -f query/sliding.py +python3 ./test.py -f query/unionAllTest.py +python3 ./test.py -f query/bug2281.py +python3 ./test.py -f query/udf.py +python3 ./test.py -f query/bug2119.py +python3 ./test.py -f query/isNullTest.py +python3 ./test.py -f query/queryWithTaosdKilled.py +python3 ./test.py -f query/floatCompare.py +python3 ./test.py -f query/query1970YearsAf.py +python3 ./test.py -f query/bug3351.py +python3 ./test.py -f query/bug3375.py +python3 ./test.py -f query/queryJoin10tables.py +python3 ./test.py -f query/queryStddevWithGroupby.py +python3 ./test.py -f query/querySecondtscolumnTowherenow.py +python3 ./test.py -f query/queryFilterTswithDateUnit.py +python3 ./test.py -f query/queryTscomputWithNow.py +python3 ./test.py -f query/queryStableJoin.py +python3 ./test.py -f query/computeErrorinWhere.py +python3 ./test.py -f query/queryTsisNull.py +python3 ./test.py -f query/subqueryFilter.py +python3 ./test.py -f query/nestedQuery/queryInterval.py +python3 ./test.py -f query/queryStateWindow.py +# python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py +python3 ./test.py -f query/nestquery_last_row.py +python3 ./test.py -f query/nestedQuery/nestedQuery.py +python3 ./test.py -f query/nestedQuery/nestedQuery_datacheck.py +python3 ./test.py -f query/queryCnameDisplay.py +# python3 ./test.py -f query/operator_cost.py +# python3 ./test.py -f query/long_where_query.py +python3 test.py -f query/nestedQuery/queryWithSpread.py +python3 ./test.py -f query/bug6586.py +# python3 ./test.py -f query/bug5903.py +python3 test.py -f query/queryInterval.py +python3 test.py -f query/queryFillTest.py +python3 ./test.py -f query/last_cache.py +python3 ./test.py -f query/last_row_cache.py +python3 ./test.py -f query/queryGroupbySort.py +python3 ./test.py -f query/filterAllUnsignedIntTypes.py +python3 ./test.py -f query/queryBetweenAnd.py +python3 ./test.py -f query/querySession.py +python3 ./test.py -f query/queryWildcardLength.py +python3 ./test.py -f query/queryTbnameUpperLower.py +python3 ./test.py -f query/query.py +python3 ./test.py -f query/queryDiffColsTagsAndOr.py +python3 ./test.py -f query/queryGroupTbname.py +python3 ./test.py -f query/queryRegex.py + +#stream +python3 ./test.py -f stream/metric_1.py +python3 ./test.py -f stream/metric_n.py +python3 ./test.py -f stream/new.py +python3 ./test.py -f stream/stream1.py +python3 ./test.py -f stream/stream2.py +#python3 ./test.py -f stream/parser.py +python3 ./test.py -f stream/history.py +python3 ./test.py -f stream/sys.py +python3 ./test.py -f stream/table_1.py +python3 ./test.py -f stream/table_n.py +python3 ./test.py -f stream/showStreamExecTimeisNull.py +python3 ./test.py -f stream/cqSupportBefore1970.py + +python3 ./test.py -f query/queryGroupbyWithInterval.py +python3 queryCount.py + +# subscribe +python3 test.py -f subscribe/singlemeter.py +#python3 test.py -f subscribe/stability.py +python3 test.py -f subscribe/supertable.py + +# functions +python3 ./test.py -f functions/all_null_value.py +python3 ./test.py -f functions/function_avg.py -r 1 +python3 ./test.py -f functions/function_bottom.py -r 1 +python3 ./test.py -f functions/function_count.py -r 1 +python3 ./test.py -f functions/function_count_last_stab.py +python3 ./test.py -f functions/function_diff.py -r 1 +python3 ./test.py -f functions/function_first.py -r 1 +python3 ./test.py -f functions/function_last.py -r 1 +python3 ./test.py -f functions/function_last_row.py -r 1 +python3 ./test.py -f functions/function_leastsquares.py -r 1 +python3 ./test.py -f functions/function_max.py -r 1 +python3 ./test.py -f functions/function_min.py -r 1 +python3 ./test.py -f functions/function_operations.py -r 1 +python3 ./test.py -f functions/function_percentile.py -r 1 +python3 ./test.py -f functions/function_spread.py -r 1 +python3 ./test.py -f functions/function_stddev.py -r 1 +python3 ./test.py -f functions/function_sum.py -r 1 +python3 ./test.py -f functions/function_top.py -r 1 +python3 ./test.py -f functions/function_sample.py -r 1 +python3 ./test.py -f functions/function_twa.py -r 1 +python3 ./test.py -f functions/function_twa_test2.py +python3 ./test.py -f functions/function_stddev_td2555.py +python3 ./test.py -f functions/showOfflineThresholdIs864000.py +python3 ./test.py -f functions/function_interp.py +#python3 ./test.py -f functions/queryTestCases.py +python3 ./test.py -f functions/function_stateWindow.py +python3 ./test.py -f functions/function_derivative.py +python3 ./test.py -f functions/function_irate.py +python3 ./test.py -f functions/function_ceil.py +python3 ./test.py -f functions/function_floor.py +python3 ./test.py -f functions/function_round.py +python3 ./test.py -f functions/function_elapsed.py +python3 ./test.py -f functions/function_mavg.py +python3 ./test.py -f functions/function_csum.py +python3 ./test.py -f functions/function_percentile2.py +python3 ./test.py -f functions/variable_httpDbNameMandatory.py + + diff --git a/tests/pytest/fulltest-tools.sh b/tests/pytest/fulltest-tools.sh new file mode 100755 index 0000000000000000000000000000000000000000..cac445501229f0b54f1464a07583d05cbf4c88a4 --- /dev/null +++ b/tests/pytest/fulltest-tools.sh @@ -0,0 +1,47 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +# tools +python3 test.py -f tools/taosdumpTest.py +python3 test.py -f tools/taosdumpTest2.py + +python3 test.py -f tools/taosdemoTest.py +python3 test.py -f tools/taosdemoTestWithoutMetric.py +python3 test.py -f tools/taosdemoTestWithJson.py +python3 test.py -f tools/taosdemoTestLimitOffset.py +python3 test.py -f tools/taosdemoTestTblAlt.py +python3 test.py -f tools/taosdemoTestSampleData.py +python3 test.py -f tools/taosdemoTestInterlace.py +# python3 test.py -f tools/taosdemoTestQuery.py +python3 ./test.py -f tools/taosdemoTestdatatype.py + +# nano support +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoQuery.py +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosubscribe.py +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py +python3 test.py -f tools/taosdumpTestNanoSupport.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py +python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py +python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py +python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py +#python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py + + + + + + + + + + + + diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 47e535cbd81b9cbc9675493342c1b734ccbeeca2..b14be1cc110caea6fc42dd6ca66934d5b5333f3f 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -52,6 +52,8 @@ python3 ./test.py -f table/create_db_from_normal_db.py #stable python3 ./test.py -f stable/insert.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py +python3 test.py -f tag_lite/json_tag_extra.py # tag python3 ./test.py -f tag_lite/filter.py @@ -223,6 +225,7 @@ python3 ./test.py -f perfbenchmark/bug3433.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py #query python3 test.py -f query/distinctOneColTb.py diff --git a/tests/pytest/functions/function_elapsed_case.py b/tests/pytest/functions/function_elapsed_case.py index 56610a9347c3ab90a9addc64dd62a6ed60758abf..6b279d7f63de0cdbd854457350b670520ea455ec 100644 --- a/tests/pytest/functions/function_elapsed_case.py +++ b/tests/pytest/functions/function_elapsed_case.py @@ -320,6 +320,8 @@ class ElapsedCase: def selectIllegalTest(self): tdSql.execute("use wxy_db") + tdSql.error("select elapsed() from t1") + tdSql.error("select elapsed(,) from t1") tdSql.error("select elapsed(1) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") tdSql.error("select elapsed('2021-11-18 00:00:10') from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") tdSql.error("select elapsed(now) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") diff --git a/tests/pytest/functions/variable_httpDbNameMandatory.py b/tests/pytest/functions/variable_httpDbNameMandatory.py index 3be620ad1e1631126697d93e388df82be3e9d57c..1cd2516ec9303f2f038bc22a69afcd01bce3a930 100644 --- a/tests/pytest/functions/variable_httpDbNameMandatory.py +++ b/tests/pytest/functions/variable_httpDbNameMandatory.py @@ -34,11 +34,15 @@ class TDTestCase: def getBuildPath(self) -> str: selfPath = os.path.dirname(os.path.realpath(__file__)) + global cfgPath if ("community" in selfPath): projPath = selfPath[:selfPath.find("community")] + cfgPath = projPath + "/community/sim/dnode1/cfg" else: projPath = selfPath[:selfPath.find("tests")] + cfgPath = projPath + "/sim/dnode1/cfg" + for root, dirs, files in os.walk(projPath): if ("taosd" in files): @@ -53,8 +57,10 @@ class TDTestCase: if ("community" in selfPath): cfgDir = self.getBuildPath() + "/community/sim/dnode1/cfg" + else: cfgDir = self.getBuildPath() + "/sim/dnode1/cfg" + return cfgDir def getCfgFile(self) -> str: @@ -85,8 +91,8 @@ class TDTestCase: def TS834(self): tdLog.printNoPrefix("==========TS-782==========") tdSql.prepare() - - cfgfile = self.getCfgFile() + buildPath = self.getBuildPath() + cfgfile = cfgPath + "/taos.cfg" tdSql.execute("show variables") res_com = tdSql.cursor.fetchall() diff --git a/tests/pytest/tag_lite/json_tag_extra.py b/tests/pytest/tag_lite/json_tag_extra.py new file mode 100644 index 0000000000000000000000000000000000000000..094359d05141d02e181bd2ed92beffbfd612f507 --- /dev/null +++ b/tests/pytest/tag_lite/json_tag_extra.py @@ -0,0 +1,591 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, db_test.stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +import time +import random + +class TDTestCase: + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + tdSql.execute("drop database if exists db_json;") + print("==============step1 tag format =======") + tdLog.info("create database ") + tdSql.execute("create database db_json") + tdSql.execute("use db_json") + # test tag format + tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)") + tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json(10000000))") + tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,jtag1 json)") + tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,dataBool bool)") + + tdSql.execute("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":\"fff\",\"id\":5}')") + + # two stables: jsons1 jsons2 ,test tag's value and key + tdSql.execute("insert into jsons1_1(ts,dataInt) using jsons1 tags('{\"loc+\":\"fff\",\"id\":5}') values (now,12)") + + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{oc:\"fff\",\"id\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":fff,\"id\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('3333')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":}')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":bool)") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags(true)") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('[{\"num\":5}]')") + + # test object and key max length. max key length is 256, max object length is 4096 include abcd. + tdSql.execute("create table if not exists jsons4(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)") + + char1= ''.join(['abcd']*64) + char2=''.join(char1) + char3= ''.join(['abcd']*1022) + print(len(char3)) # 4088 + tdSql.execute("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s\":5}')" % char1) # len(key)=256 + tdSql.error("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s1\":5}')" % char2) # len(key)=257 + tdSql.execute("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"T\":\"%s\"}')" % char3) # len(object)=4096 + tdSql.error("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"TS\":\"%s\"}')" % char3) # len(object)=4097 + + tdSql.execute("insert into jsons1_1 values(now, 1, 'json1')") + tdSql.execute("insert into jsons1_1 values(now+1s, 1, 'json1')") + tdSql.execute("insert into jsons1_2 using jsons1 tags('{\"num\":5,\"location\":\"beijing\"}') values (now, 1, 'json2')") + tdSql.execute("insert into jsons1_3 using jsons1 tags('{\"num\":34,\"location\":\"beijing\",\"level\":\"l1\"}') values (now, 1, 'json3')") + tdSql.execute("insert into jsons1_4 using jsons1 tags('{\"class\":55,\"location\":\"beijing\",\"name\":\"name4\"}') values (now, 1, 'json4')") + + # test : json'vaule is null and + tdSql.execute("create table if not exists jsons2(ts timestamp, dataInt2 int, dataStr2 nchar(50)) tags(jtag2 json)") + tdSql.execute("CREATE TABLE if not exists jsons2_1 using jsons2 tags('{}')") + tdSql.query("select jtag2 from jsons2_1") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_2 using jsons2 tags('')") + tdSql.query("select jtag2 from jsons2_2") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_3 using jsons2 tags('null')") + tdSql.query("select jtag2 from jsons2_3") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_4 using jsons2 tags('\t')") + tdSql.query("select jtag2 from jsons2_4") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_5 using jsons2 tags(' ')") + tdSql.query("select jtag2 from jsons2_5") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_6 using jsons2 tags('{\"nv\":null,\"tea\":true,\"\":false,\"\":123,\"tea\":false}')") + tdSql.query("select jtag2 from jsons2_6") + tdSql.checkData(0, 0, "{\"nv\":null,\"tea\":true}") + tdSql.execute("CREATE TABLE if not exists jsons2_7 using jsons2 tags('{\"test7\":\"\"}')") + tdSql.query("select jtag2 from jsons2_7") + tdSql.checkData(0, 0, "{\"test7\":\"\"}") + tdSql.execute("CREATE TABLE if not exists jsons2_8 using jsons2 tags('{\"nv\":null,\"tea\":123,\"\":false,\"\":123,\"tea\":false}')") + tdSql.query("select jtag2 from jsons2_8") + tdSql.checkData(0, 0, "{\"nv\":null,\"tea\":123}") + + print("==============step2 alter json table==") + tdLog.info("alter stable add tag") + tdSql.error("ALTER STABLE jsons2 add tag jtag3 nchar(20)") + tdSql.error("ALTER STABLE jsons2 drop tag jtag2") + tdSql.execute("ALTER STABLE jsons2 change tag jtag2 jtag3") + tdSql.query("select jtag3->'tea' from jsons2_6") + tdSql.checkData(0, 0, "true") + tdSql.error("ALTER TABLE jsons2_6 SET TAG jtag3='{\"tea-=[].;!@#$%^&*()/\":}'") + tdSql.execute("ALTER TABLE jsons2_6 SET TAG jtag3='{\"tea-=[].;!@#$%^&*()/\":false}'") + tdSql.query("select jtag3 from jsons2_6") + tdSql.checkData(0, 0, "{\"tea-=[].;!@#$%^&*()/\":false}") + tdSql.execute("ALTER TABLE jsons1_1 SET TAG jtag='{\"sex\":\"femail\",\"age\":35}'") + tdSql.query("select jtag from jsons1_1") + tdSql.checkData(0, 0, "{\"sex\":\"femail\",\"age\":35}") + + + + print("==============step3") + tdLog.info("select table") + + tdSql.query("select jtag from jsons1_1") + tdSql.checkData(0, 0, "{\"sex\":\"femail\",\"age\":35}") + + tdSql.query("select jtag from jsons1 where jtag->'name'='name4'") + tdSql.checkData(0, 0, "{\"class\":55,\"location\":\"beijing\",\"name\":\"name4\"}") + + + tdSql.query("select * from jsons1") + tdSql.checkRows(6) + + tdSql.query("select * from jsons1_1") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where jtag->'location'='beijing'") + tdSql.checkRows(3) + + tdSql.query("select jtag->'location' from jsons1_2") + tdSql.checkData(0, 0, "\"beijing\"") + + + tdSql.query("select jtag->'num' from jsons1 where jtag->'level'='l1'") + tdSql.checkData(0, 0, 34) + + tdSql.query("select jtag->'location' from jsons1") + tdSql.checkRows(4) + + tdSql.query("select jtag from jsons1_1") + tdSql.checkRows(1) + + tdSql.query("select * from jsons1 where jtag contains 'sex' or jtag contains 'num'") + tdSql.checkRows(5) + + tdSql.query("select * from jsons1 where jtag contains 'sex' and jtag contains 'num'") + tdSql.checkRows(0) + + tdSql.query("select jtag->'sex' from jsons1 where jtag contains 'sex' or jtag contains 'num'") + tdSql.checkData(0, 0, "\"femail\"") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'location'='beijing'") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'num'=5 or jtag contains 'sex'") + tdSql.checkRows(4) + + # test with tbname + tdSql.query("select * from jsons1 where tbname = 'jsons1_1'") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where tbname = 'jsons1_1' or jtag contains 'num'") + tdSql.checkRows(5) + + tdSql.query("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'num'") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where tbname = 'jsons1_1' or jtag->'num'=5") + tdSql.checkRows(4) + + # test where condition like + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%'") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' and jtag->'location'='beijin'") + tdSql.checkRows(0) + + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' or jtag->'location'='beijin'") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' and jtag->'num'=34") + tdSql.checkRows(1) + + tdSql.query("select *,tbname from jsons1 where (jtag->'location' like 'shanghai%' or jtag->'num'=34) and jtag->'class'=55") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where jtag->'num' like '5%'") + tdSql.checkRows(0) + + # # test where condition in + # tdSql.query("select * from jsons1 where jtag->'location' in ('beijing')") + # tdSql.checkRows(3) + + # tdSql.query("select * from jsons1 where jtag->'num' in (5,34)") + # tdSql.checkRows(2) + + # tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)") + + # tdSql.query("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55") + # tdSql.checkRows(1) + + # test where condition match + tdSql.query("select * from jsons1 where jtag->'location' match 'jin$'") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where jtag->'location' match 'jin'") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where datastr match 'json' and jtag->'location' match 'jin'") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where jtag->'num' match '5'") + tdSql.checkRows(0) + + # test json string parse + tdSql.error("CREATE TABLE if not exists jsons1_5 using jsons1 tags('efwewf')") + tdSql.execute("CREATE TABLE if not exists jsons1_5 using jsons1 tags('\t')") + tdSql.execute("CREATE TABLE if not exists jsons1_6 using jsons1 tags('')") + + tdSql.query("select jtag from jsons1_6") + tdSql.checkData(0, 0, None) + + tdSql.execute("CREATE TABLE if not exists jsons1_7 using jsons1 tags('{}')") + tdSql.query("select jtag from jsons1_7") + tdSql.checkData(0, 0, None) + + tdSql.execute("CREATE TABLE if not exists jsons1_8 using jsons1 tags('null')") + tdSql.query("select jtag from jsons1_8") + tdSql.checkData(0, 0, None) + + tdSql.execute("CREATE TABLE if not exists jsons1_9 using jsons1 tags('{\"\":4,\"time\":null}')") + tdSql.query("select jtag from jsons1_9") + tdSql.checkData(0, 0, "{\"time\":null}") + + tdSql.execute("CREATE TABLE if not exists jsons1_10 using jsons1 tags('{\"k1\":\"\",\"k1\":\"v1\",\"k2\":true,\"k3\":false,\"k4\":55}')") + tdSql.query("select jtag from jsons1_10") + tdSql.checkData(0, 0, "{\"k1\":\"\",\"k2\":true,\"k3\":false,\"k4\":55}") + + tdSql.query("select jtag->'k2' from jsons1_10") + tdSql.checkData(0, 0, "true") + + tdSql.query("select jtag from jsons1 where jtag->'k1'=''") + tdSql.checkRows(1) + + tdSql.query("select jtag from jsons1 where jtag->'k2'=true") + tdSql.checkRows(1) + + tdSql.query("select jtag from jsons1 where jtag is null") + tdSql.checkRows(4) + + tdSql.query("select jtag from jsons1 where jtag is not null") + tdSql.checkRows(6) + + tdSql.query("select * from jsons1 where jtag->'location' is not null") + tdSql.checkRows(3) + + tdSql.query("select tbname,jtag from jsons1 where jtag->'location' is null") + tdSql.checkRows(7) + + tdSql.query("select * from jsons1 where jtag->'num' is not null") + tdSql.checkRows(2) + + tdSql.query("select * from jsons1 where jtag->'location'='null'") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where jtag->'num'=null") + tdSql.checkRows(0) + + # test distinct + tdSql.query("select distinct jtag from jsons1") + tdSql.checkRows(7) + + tdSql.query("select distinct jtag->'location' from jsons1") + tdSql.checkRows(2) + + # test chinese + tdSql.execute("CREATE TABLE if not exists jsons1_11 using jsons1 tags('{\"k1\":\"中国\",\"k5\":\"是是是\"}')") + + tdSql.query("select tbname,jtag from jsons1 where jtag->'k1' match '中'") + tdSql.checkRows(1) + + tdSql.query("select tbname,jtag from jsons1 where jtag->'k1'='中国'") + tdSql.checkRows(1) + + #test dumplicate key with normal colomn + tdSql.execute("INSERT INTO jsons1_12 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"dataStr\":\"是是是\"}') values(now, 4, \"你就会\")") + + tdSql.query("select *,tbname,jtag from jsons1 where jtag->'dataStr' match '是'") + tdSql.checkRows(1) + + tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt'") + tdSql.checkRows(1) + + # test filter : and /or / in/ like + tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool'") + tdSql.checkRows(2) + + tdSql.query("select * from jsons1 where jtag->'num' is not null and jtag contains 'class' or jtag contains 'databool'") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 4) + + tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' and jtag->'location' like 'bei%'") + tdSql.checkRows(2) + + tdSql.query("select * from jsons1 where datastr like '你就会' and ( jtag->'num' is not null or jtag contains 'tbname' and jtag contains 'databool' )") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 4) + + tdSql.error("select * from jsons1 where datastr like '你就会' and jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool'") + + + tdSql.error("select * from jsons1 where datastr like '你就会' or jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' or jtag->'location' in ('beijing') and jtag->'location' like 'bei%' ") + + tdSql.query("select * from jsons1 where datastr like '你就会' and (jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' and jtag->'location' like 'bei%' )") + tdSql.checkRows(0) + + tdSql.error("select *,tbname,jtag from jsons1 where dataBool=true") + + # test error + tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags(3333)") + tdSql.execute("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"1loc\":\"fff\",\";id\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"。loc\":\"fff\",\"fsd\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"试试\":\"fff\",\";id\":5}')") + tdSql.error("insert into jsons1_13 using jsons1 tags(3)") + + # test query normal column,tag and tbname + tdSql.execute("create stable if not exists jsons3(ts timestamp, dataInt3 int, dataBool3 bool, dataStr3 nchar(50)) tags(jtag3 json)") + tdSql.execute("create table jsons3_2 using jsons3 tags('{\"t\":true,\"t123\":123,\"\":\"true\"}')") + + tdSql.execute("create table jsons3_3 using jsons3 tags('{\"t\":true,\"t123\":456,\"k1\":true,\"str1\":\"111\"}')") + tdSql.execute("insert into jsons3_3 values(now, 4, true, 'test')") + + tdSql.execute("insert into jsons3_4 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null,\"str1\":\"112\"}') values(now, 5, true, 'test')") + tdSql.query("select * from jsons3 where jtag3->'k1'=true") + tdSql.checkRows(1) + tdSql.error("select jtag3->k1 from jsons3 ") + tdSql.error("select jtag3 from jsons3 where jtag3->'k1'") + tdSql.error("select jtag3 from jsons3 where jtag3 contains 'k1'=true") + tdSql.error("select jtag3 contains 'k1' from jsons3;") + tdSql.error("select jtag3 contains 'k1'=true from jsons3;") + tdSql.error("select jtag3->'k1'=true from jsons3;") + tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":123,\"s\":null}') values(now, 5, true, 'test')") + tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":012,\"k2\":null,\"s\":null}') values(now+1s, 5, true, 'test')") + tdSql.query("select jtag3 from jsons3_5") + tdSql.checkData(0, 0, '{\"t\":true,\"t123\":789,\"k1\":123,\"s\":null}') + tdSql.execute("insert into jsons3_6 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null}') values(now, 5, true, 'test')") + tdSql.query("select jtag3 from jsons3 where jtag3->'t123'=12 or jtag3 contains 'k1'") + tdSql.checkRows(4) + tdSql.query("select distinct jtag3 from jsons3 where jtag3->'t123'=12 or jtag3 contains 'k1'") + tdSql.checkRows(4) + + + tdSql.execute("INSERT INTO jsons1_14 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"tianjing\",\"dataStr\":\"是是是\"}') values(now,5, \"你就会\")") + + tdSql.query("select ts,jtag->'tbname',tbname from jsons1 where dataint>=1 and jtag contains 'tbname'") + tdSql.checkRows(2) + tdSql.checkData(0, 1, '\"tt\"') + + tdSql.query("select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'") + tdSql.checkRows(1) + tdSql.checkData(0, 3, 'jsons1_14') + + tdSql.query("select ts,jtag3->'tbname', jtag3->'str1',tbname from jsons3 where jtag3->'t123' between 456 and 789 and jtag3->'str1' like '11%' ") + tdSql.checkRows(2) + for i in range(1): + if tdSql.queryResult[i][1] == 'jsons3_3': + tdSql.checkData(i, 2, 111) + + tdSql.query("select jtag3->'',dataint3 from jsons3") + tdSql.checkRows(5) + for i in range(4): + if tdSql.queryResult[i][1] == 4: + tdSql.checkData(i, 0, None) + tdSql.query("select tbname,dataint3,jtag3->'k1' from jsons3;") + tdSql.checkRows(5) + for i in range(4): + if tdSql.queryResult[i][1] == 4: + tdSql.checkData(i, 2, 'true') + + # Select_exprs is SQL function -Aggregation function , tests includes group by and order by + + tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by jtag->'location';") + tdSql.checkData(2, 3, '\"tianjing\"') + tdSql.checkRows(3) + for i in range(2): + if tdSql.queryResult[i][3] == 'beijing': + tdSql.checkData(i, 0, 1) + tdSql.checkData(i, 1, 3) + tdSql.error("select avg(dataInt) as 123 ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by 123") + tdSql.error("select avg(dataInt) as avgdata ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by avgdata ;") + tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by ts;") + tdSql.checkRows(3) + tdSql.error("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by tbname;") + #notice,it should return error **** + tdSql.error("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by jtag->'num' ;") + tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by jtag->'age' ;") + tdSql.checkRows(2) + tdSql.error("select avg(dataInt) from jsons1 group by jtag->'location' order by dataInt;") + tdSql.error("select avg(dataInt),tbname from jsons1 group by jtag->'location' order by tbname;") + tdSql.execute("CREATE TABLE if not exists jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"beijing\"}')") + tdSql.execute("insert into jsons1_15 values(now+1s, 2, 'json1')") + tdSql.error("select twa(dataint) from jsons1 group by jtag->'location' order by jtag->'location';") + tdSql.error("select irate(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select stddev(dataint) from jsons1 group by jtag->'location';") + tdSql.checkRows(3) + tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';") + tdSql.checkRows(1) + tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;") + + + + # Select_exprs is SQL function -Selection function + + tdSql.query(" select min(dataint),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing' or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.query(" select max(dataint),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 12) + tdSql.query(" select first(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select last(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.error(" select last(*),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select last_row(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,0) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,50) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,90) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,100) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,0,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,50,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,100,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location';") + tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' asc;") + tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' desc;") + tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts desc;") + tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts asc;") + tdSql.query("select top(dataint,100) from jsons1 group by jtag->'location';") + tdSql.query("select bottom(dataint,1) from jsons1 group by jtag->'location';") + tdSql.query("select bottom(dataint,100) from jsons1 group by jtag->'location';") + + tdSql.execute("create table if not exists jsons_interp(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)") + tdSql.execute("insert into jsons_interp_1 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"rate\":456,\"tea\":false}') values ('2021-07-25 02:19:54.119',2,'true',0.9,0.1,'123')") + tdSql.execute("insert into jsons_interp_1 values ('2021-07-25 02:19:54.219',3,'true',-4.8,-5.5,'123') ") + tdSql.execute("insert into jsons_interp_2 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"level\":\"123456\",\"rate\":123,\"tea\":false}') values ('2021-07-25 02:19:54.319',4,'true',0.9,0.1,'123')") + tdSql.execute("insert into jsons_interp_2 values ('2021-07-25 02:19:54.419',5,'true',-5.1,1.3,'123') ") + tdSql.query("select interp(dataint) as itd from jsons_interp where (jtag->'rate'=123 or jtag->'rate'=456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) group by tbname order by ts desc ;") + tdSql.checkRows(4) + tdSql.checkData(0,1,3) + tdSql.checkData(2,1,5) + + tdSql.query("select interp(dataint) as itd from jsons_interp where (jtag->'rate'=123 or jtag->'rate'=456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) group by tbname order by tbname asc;") + tdSql.checkRows(4) + tdSql.checkData(0,1,2) + tdSql.checkData(2,1,4) + + # Select_exprs is SQL function -Calculation function + tdSql.error(" select diff(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.error(" select Derivative(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select SPREAD(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkData(0, 0, 11) + tdSql.query(" select ceil(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select floor(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select round(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + #need insert new data --data type is double or float and tests ceil floor round . + tdSql.execute("create table if not exists jsons7(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)") + tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now+2s,2,'true',0.9,0.1,'123')") + tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"tea\":false}') values (now+3s,2,'true',0.9,0.1,'123')") + tdSql.query("select * from jsons7 where jtag->'tea'=0 ;") + tdSql.checkRows(0) + tdSql.query("select * from jsons7 where jtag->'tea'=3;") + # tdSql.checkRows(0) + tdSql.execute("insert into jsons7_1 values (now+1s,3,'true',-4.8,-5.5,'123') ") + tdSql.execute("insert into jsons7_1 values (now+2s,4,'true',1.9998,2.00001,'123') ") + tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":123,\"tea\":false}') values (now,5,'true',4.01,2.2,'123') ") + tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"tag\":123,\"tea\":false}') values (now+5s,5,'false',4.01,2.2,'123') ") + tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+3s,-0.9) ") + tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+4s,-2.9) ") + tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+1s,-0.9) ") + tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+2s,-1.9) ") + tdSql.execute("CREATE TABLE if not exists jsons7_3 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":4569,\"tea\":false}') ") + tdSql.query("select ts,ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select ts,floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select ts,round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';") + + #modify one same key and diffirent data type,include negative number of double + tdSql.execute("insert into jsons7_4 using jsons7 tags('{\"nv\":null,\"tea\":123,\"tag\":123,\"tea\":false}') values (now+1s,5,'true',4.01,2.2,'abc'); ") + tdSql.execute("insert into jsons7_5 using jsons7 tags('{\"nv\":null,\"tea\":\"app\",\"tag\":123,\"tea\":false}') values (now+2s,5,'true',4.01,2.2,'abc'); ") + tdSql.error("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111111111111111111111111111111111111111111111111111111111111111,\"tag\":123,\"tea\":false}') values (now+3s,5,'true',4.01,2.2,'123'); ") + tdSql.execute("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111,\"tag\":123,\"tea\":false}') values (now,5,'false',4.01,2.2,'t123'); ") + tdSql.query("select jtag from jsons7 where jtag->'tea'>-1.01;") + # tdSql.checkRows(2) + + # test join + tdSql.execute("create table if not exists jsons6(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)") + tdSql.execute("create table if not exists jsons5(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)") + tdSql.execute("CREATE TABLE if not exists jsons6_1 using jsons6 tags('{\"loc\":\"fff\",\"id\":6,\"user\":\"ffc\"}')") + tdSql.execute("CREATE TABLE if not exists jsons6_2 using jsons6 tags('{\"loc\":\"ffc\",\"id\":5}')") + tdSql.execute("insert into jsons6_1 values ('2020-04-18 15:00:00.000', 1, false, 'json1')") + tdSql.execute("insert into jsons6_2 values ('2020-04-18 15:00:01.000', 2, false, 'json1')") + tdSql.execute("insert into jsons5_1 using jsons5 tags('{\"loc\":\"fff\",\"num\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:00.000', 2, true, 'json2')") + tdSql.execute("insert into jsons5_2 using jsons5 tags('{\"loc\":\"fff\",\"id\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:01.000', 2, true, 'json2')") + tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'loc'=b.jtag->'loc'") + tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'user'=b.jtag->'loc';") + tdSql.query("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'id'=b.jtag->'id'") + tdSql.checkData(0, 0, "sss") + tdSql.checkData(0, 2, "\"ffc\"") + + + + # #nested query + tdSql.error("select jtag->'tag' from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where cdata=3 ") # not currently supported + tdSql.error("select jtag from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where jtag->'tag'=123 ") # not currently supported + tdSql.query("select * from (select tbname,jtag->'tea',ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where cdata=5 ") + tdSql.checkRows(5) + for i in range(5): + if tdSql.queryResult[i][0] == 'jsons7_4': + tdSql.checkData(i, 1, 123) + tdSql.checkData(i, 3, 5) + if tdSql.queryResult[i][0] == 'jsons7_5': + tdSql.checkData(i, 1, "\"app\"") + + # query child table + tdSql.error("select * from jsons3_2 where jtag3->'k1'=true;") + # tdSql.checkData(0, 0, None) + # tdSql.checkRows(3) + + # union all :max times is 100 + unioSql = "select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing' union all " + for i in range(99): + if (i < 98): + unioSql += "select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing' union all " + else: + print(i) + unioSql += " select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'" + tdSql.query(unioSql) + tdSql.checkRows(100) + unioSql += " union all select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'" + tdSql.error(unioSql) + + + + # fuction testcase : stddev, supported data type: int\str\bool unsupported data type: float\double + tdSql.query(" select stddev(datafloat),dataint from jsons7 group by dataint;") + tdSql.checkRows(5) + tdSql.query(" select stddev(dataint) from jsons7 group by datastr;") + tdSql.checkRows(4) + tdSql.query(" select stddev(dataint) from jsons7 group by databool;") + tdSql.checkRows(3) + tdSql.error(" select stddev(dataint) from jsons7 group by datafloat;") + tdSql.error(" select stddev(dataint) from jsons7 group by datadouble;") + tdSql.execute("create table if not exists jsons8(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50),datatime timestamp) tags(jtag json)") + tdSql.execute("insert into jsons8_1 using jsons8 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now,2,'true',0.9,0.1,'abc',now+60s)") + tdSql.execute("insert into jsons8_2 using jsons8 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now+5s,2,'true',0.9,0.1,'abc',now+65s)") + tdSql.query(" select stddev(dataint) from jsons8 group by datatime;") + tdSql.error(" select stddev(datatime) from jsons8 group by datadouble;") + + + # # test drop tables and databases + # tdSql.execute("drop table jsons1_1") + # tdSql.execute("drop stable jsons1") + # tdSql.execute("drop stable jsons3") + # tdSql.execute("drop stable jsons2") + # tdSql.execute("drop database db_json") + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json index 3f194f376a12772151c4d1c32f233e0d67e72857..e10fd1116b948032d5aa67dc0844bbf493d650de 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json @@ -41,7 +41,7 @@ "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 10000, + "insert_rows": 100, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", @@ -67,7 +67,7 @@ "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 20000, + "insert_rows": 200, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", diff --git a/tests/pytest/tools/taosdemoAllTest/insert-chinese.json b/tests/pytest/tools/taosdemoAllTest/insert-chinese.json new file mode 100644 index 0000000000000000000000000000000000000000..b7f3be9546c61fe895979cdc13e39eea5a322400 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-chinese.json @@ -0,0 +1,63 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "chinese": "yes", + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 150, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json index 0a4f8a0df22e7362124ce3be2f581d437739368b..2c3b8c6f81962e02ff5aac37c58fb04b79159a7c 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json @@ -32,7 +32,7 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, @@ -56,7 +56,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, @@ -80,7 +80,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, @@ -104,7 +104,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, @@ -128,7 +128,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, @@ -152,7 +152,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json index 7b90980445ddf3a0bbbd7a5652179635a85c6b53..f8fe21a6c4015a27ee663bc7ac54a7889af62add 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json @@ -32,7 +32,7 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, @@ -56,7 +56,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, @@ -80,7 +80,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, @@ -104,7 +104,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, @@ -128,7 +128,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, @@ -152,7 +152,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json index 5f1c3fb6ca9ac7d088281f89e93e4c038d97ad56..d51dee428fc8f1bb61af84d5f570f69cce344651 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json @@ -35,13 +35,13 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 100, + "childtable_count": 10, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 20000, + "insert_rows": 200, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", @@ -61,13 +61,13 @@ { "name": "stb1", "child_table_exists":"no", - "childtable_count": 100, + "childtable_count": 20, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 20000, + "insert_rows": 200, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json new file mode 100644 index 0000000000000000000000000000000000000000..be55d31d5595b210695584f6dbbc334bb7b7f8e6 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json index 02efafbbbe5657ab5a81e64fef0c43405ca6e317..67abdc67eed813501e012c8b7dce5d0719d22eb6 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json @@ -109,58 +109,6 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb2", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb02_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb4", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb04_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 100, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json index c86ed978170d2a0c8fac12a3c9346dc5a87839f7..17153c2f2c00a2e296ebf59409be1287cb203c24 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json @@ -55,7 +55,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 1, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json b/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json index c85713c94c3dd6fe5ee55bcc36badcce474a746e..6a59d4d75d9f7f29e3697c26d72793b9ad8bd554 100644 --- a/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json +++ b/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json @@ -11,7 +11,7 @@ "super_table_query": { "stblname": "stb0", "query_interval": 10000, - "concurrent": 9, + "threads": 9, "sqls": [ { "sql": "select last_row(*) from xxxx", diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json index 5be20c28bba11ff40296d062f93ab4fda57a1f88..cbd4f6cb59c1ddd146b42a233c740d6bbaca45d3 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json @@ -35,7 +35,7 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 1000, + "childtable_count": 10, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 1, @@ -55,13 +55,13 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "TIMESTAMP"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}], + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}], "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}] }, { "name": "stb1", "child_table_exists":"no", - "childtable_count": 1000, + "childtable_count": 20, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 10, diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json index 2de298efa6553ec0c6de095ee0515a73e777445f..f21cd6297c5a6277c4d9dfb5ec6eda1d9220de97 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json @@ -35,14 +35,14 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 2, + "childtable_count": 1, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "json" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 0, @@ -59,16 +59,16 @@ "tags": [{"type": "INT", "count":1}] }, { - "name": "stb2", + "name": "stb1", "child_table_exists":"no", - "childtable_count": 4, + "childtable_count": 2, "childtable_prefix": "stb02_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "json" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -265,6 +265,84 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16, "count":1}], "tags": [{"type": "BINARY", "count":1}] + }, + { + "name": "stb10", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb10_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UBIGINT"}], + "tags": [{"type": "UBIGINT", "count":1}] + }, + { + "name": "stb11", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb11_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UTINYINT"}], + "tags": [{"type": "UTINYINT", "count":1}] + }, + { + "name": "stb12", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "USMALLINT"}], + "tags": [{"type": "USMALLINT", "count":1}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json index ff825440e5cbfd8aa5d8d6e74538c5802af8af38..983a3009db68e95fecf3f8eda91f0aa3f41aff37 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json @@ -35,14 +35,14 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 2, + "childtable_count": 1, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 0, @@ -61,14 +61,14 @@ { "name": "stb1", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 2, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -87,14 +87,14 @@ { "name": "stb2", "child_table_exists":"no", - "childtable_count": 4, + "childtable_count": 3, "childtable_prefix": "stb02_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -113,14 +113,14 @@ { "name": "stb3", "child_table_exists":"no", - "childtable_count": 5, + "childtable_count": 4, "childtable_prefix": "stb03_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -139,14 +139,14 @@ { "name": "stb4", "child_table_exists":"no", - "childtable_count": 6, + "childtable_count": 5, "childtable_prefix": "stb04_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":30, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -165,14 +165,14 @@ { "name": "stb5", "child_table_exists":"no", - "childtable_count": 15, + "childtable_count": 6, "childtable_prefix": "stb05_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":20, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -191,7 +191,7 @@ { "name": "stb6", "child_table_exists":"no", - "childtable_count": 20, + "childtable_count": 7, "childtable_prefix": "stb06_", "auto_create_table": "no", "batch_create_tbl_num": 100, @@ -217,14 +217,14 @@ { "name": "stb7", "child_table_exists":"no", - "childtable_count": 30, + "childtable_count": 8 , "childtable_prefix": "stb07_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":5, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -243,14 +243,14 @@ { "name": "stb8", "child_table_exists":"no", - "childtable_count": 20, + "childtable_count": 9, "childtable_prefix": "stb08_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":30, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -269,14 +269,14 @@ { "name": "stb9", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 10, "childtable_prefix": "stb09_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -295,14 +295,14 @@ { "name": "stb10", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 11, "childtable_prefix": "stb10_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -321,14 +321,14 @@ { "name": "stb11", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 12, "childtable_prefix": "stb11_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -347,14 +347,14 @@ { "name": "stb12", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 13, "childtable_prefix": "stb12_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json new file mode 100644 index 0000000000000000000000000000000000000000..4e8ff40cfdb7650f9d82635ac5be42f67904158a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json @@ -0,0 +1,113 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "TIMESTAMP"}], + "tags": [{"type": "TIMESTAMP", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "TIMESTAMP"}], + "tags": [{"type": "TIMESTAMP", "count":1}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "TIMESTAMP"}], + "tags": [{"type": "TIMESTAMP", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..c70db14b4c9b5fabe590eb8fec4a1f0e4dbc831a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json index 83689d6c40e3844707cc367431f37f4f8ec144d5..12034adc0788f84852019d776fc0987cbc9c4f16 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json @@ -109,58 +109,6 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb2", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb02_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "sml", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb4", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb04_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "sml", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 100, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json index 98770a9fc80d8cde52674352469dffb5fa268715..2712f885936c12c1cf7742376ea541fd12e55cd4 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json @@ -32,14 +32,14 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "NN123_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -56,14 +56,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "NNN_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -80,14 +80,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "NNY_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -104,14 +104,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "NY123_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -128,14 +128,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "NYN_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -152,14 +152,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "NYY_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json index 9646f3dd23ef7bc9cbde6317437e10d96b0b213a..f8fe21a6c4015a27ee663bc7ac54a7889af62add 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json @@ -32,14 +32,14 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "YN123_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -56,14 +56,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "YNN_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -80,14 +80,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "YNY_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -104,14 +104,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "YY123_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -128,14 +128,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "YYN_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -152,14 +152,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "YYY_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..f59d2e4e22e165ddf1adf8b95212d521a75737d9 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json index 5b7a7eda59831646a97318025b2b66979a17411a..4903335d181a0f06a0f0714072301438883f0f6e 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json @@ -109,58 +109,6 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb2", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb02_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "stmt", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb4", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb04_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "stmt", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 100, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py index 3bb290fdd0550bbebd95ebd9c30ee34272808281..4fdaab25fe182141bebbc06a30fa257481360be3 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py @@ -48,7 +48,7 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - # insert: create one or mutiple tables per sql and insert multiple rows per sql + # taosc interface os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-allDataType.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") @@ -79,7 +79,52 @@ class TDTestCase: tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 200000) - + + # insert-interface: sml + os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-allDataType-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + # tdSql.query("select last(ts) from db.stb00_0") + # tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 1000) + # tdSql.query("select last(ts) from db.stb01_0") + # tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 4000) + + + # # insert-interface: sml-json + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath) + # tdSql.execute("use db") + # tdSql.query("show stables") + # for i in range(13): + # for j in range(13): + # if tdSql.queryResult[i][0] == 'stb%d'%j: + # # print(i,"stb%d"%j) + # tdSql.checkData(i, 4, j+1) + + + # insert-interface: sml-telnet + os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("show stables") + for i in range(13): + for j in range(13): + if tdSql.queryResult[i][0] == 'stb%d'%j: + # print(i,"stb%d"%j) + tdSql.checkData(i, 4, j+1) + for i in range(13): + tdSql.query("select count(*) from stb%d"%i) + tdSql.checkData(0, 0, (i+1)*10) + + # insert-interface: sml-telnet + assert os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-sml-timestamp.json -y " % binPath) !=0 + + # taosdemo command line os.system("%staosBenchmark -t 1000 -n 100 -T 10 -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,NCHAR,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY -y " % binPath) tdSql.execute("use test") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py new file mode 100644 index 0000000000000000000000000000000000000000..7f3106e0fa52b8622fe91546e13e4df69defed73 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py @@ -0,0 +1,184 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + global cfgPath + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + cfgPath = projPath + "/community/sim/dnode1/cfg" + + else: + projPath = selfPath[:selfPath.find("tests")] + cfgPath = projPath + "/sim/dnode1/cfg" + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + # def checkGerData(): + + def run(self): + buildPath = self.getBuildPath() + print("%s" % cfgPath ) + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + tdLog.info("create super table") + # create super table + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("describe meters;") + tdSql.checkRows(13) + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + + tdLog.info("create general table -N ") + tdSql.execute("drop database db1;") + # create general table -N + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("describe `test.0`;") + tdSql.checkRows(11) + tdSql.error("select count(*) from meters") + tdSql.error("select count(tbname) from meters") + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + tdLog.info("use diffrent interface stmt") + tdSql.execute("drop database db1;") + # use diffrent interface-stmt + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + # tdLog.info("use diffrent interface rest") + # tdSql.execute("drop database db1;") + # # use diffrent interface -rest + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + tdLog.info("use diffrent interface sml") + tdSql.execute("drop database db1;") + # use diffrent interface-sml + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + + tdLog.info("all data type") + tdSql.execute("drop database db1;") + # all data type + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + tdLog.info("all data type and interlace rows") + tdSql.execute("drop database db1;") + # all data type + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\ + -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096\ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + tdSql.execute("use db3") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + tdLog.info("all data type and too much para") + tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ + localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + tdSql.execute("drop database db3;") + # repeate parameters + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ + localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + # tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ + # -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath,cfgPath)) + # # taosdemo error-exceeds max length + # assert os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ + # -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath,cfgPath)) != 0 + + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res*.txt*") + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 2aaa5795866e03ab0bf4d3dbf6c0e431ebd604d3..06236a1d0175e4f685b29584cc0456e621fb754b 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -68,21 +68,21 @@ class TDTestCase: tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 2000) - # restful connector insert data - os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath) - tdSql.execute("use db") - tdSql.query("select count (tbname) from stb0") - tdSql.checkData(0, 0, 10) - tdSql.query("select count (tbname) from stb1") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 100) - tdSql.query("select count(*) from stb01_1") - tdSql.checkData(0, 0, 20) - tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 200) + # # restful connector insert data + # os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath) + # tdSql.execute("use db") + # tdSql.query("select count (tbname) from stb0") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count (tbname) from stb1") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from stb00_0") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from stb0") + # tdSql.checkData(0, 0, 100) + # tdSql.query("select count(*) from stb01_1") + # tdSql.checkData(0, 0, 20) + # tdSql.query("select count(*) from stb1") + # tdSql.checkData(0, 0, 200) # default values json files tdSql.execute("drop database if exists db") @@ -103,30 +103,30 @@ class TDTestCase: tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 20) tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 10000) + tdSql.checkData(0, 0, 100) tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 100000) + tdSql.checkData(0, 0, 1000) tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 20000) + tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 400000) + tdSql.checkData(0, 0, 4000) # insert: using parament "insert_interval to controls spped of insert. # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath) tdSql.execute("use db") tdSql.query("show stables") - tdSql.checkData(0, 4, 100) + tdSql.checkData(0, 4, 10) tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 20000) + tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 2000000) + tdSql.checkData(0, 0, 2000) tdSql.query("show stables") - tdSql.checkData(1, 4, 100) + tdSql.checkData(1, 4, 20) tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 20000) + tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 2000000) + tdSql.checkData(0, 0, 4000) # spend 2min30s for 3 testcases. # insert: drop and child_table_exists combination test @@ -218,6 +218,10 @@ class TDTestCase: tdSql.query("select count(*) from db.stb3") tdSql.checkRows(1) tdSql.execute("drop database if exists db") + os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath) tdSql.error("select count(*) from db.stb0") tdSql.execute("drop database if exists db") @@ -353,6 +357,15 @@ class TDTestCase: tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes tdSql.checkRows(20) + # insert: test chinese encoding + os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (*) from stb0") + tdSql.checkData(0, 0, 1500) + + # rm useless files os.system("rm -rf ./insert*_res.txt*") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py index 4c2baf5a11d3f5dff3a98664be11cac78ebb9c6b..f1eee8d0cff9f3ca22e70c683343f57ec7baca2b 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py @@ -56,12 +56,8 @@ class TDTestCase: tdSql.checkData(0, 0, 10) tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 20) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 100) tdSql.query("select count(*) from stb0") tdSql.checkData(0, 0, 1000) - tdSql.query("select count(*) from stb01_1") - tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 4000) @@ -73,31 +69,27 @@ class TDTestCase: tdSql.checkData(0, 0, 10) tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 15) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 150) tdSql.query("select count(*) from stb0") tdSql.checkData(0, 0, 1500) - tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 3000) - # insert: using parament "insert_interval to controls spped of insert. - # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath) - tdSql.execute("use db") - tdSql.query("select tbname from stb0") - tdSql.checkRows(100 ) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 20) - tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 2000) - tdSql.query("show stables") - tdSql.checkData(1, 4, 20) - tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 35) - tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 700) + # # insert: using parament "insert_interval to controls spped of insert. + # # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath) + # tdSql.execute("use db") + # tdSql.query("select tbname from db.stb0") + # tdSql.checkRows(100 ) + # # tdSql.query("select count(*) from stb00_0") + # # tdSql.checkData(0, 0, 20) + # tdSql.query("select count(*) from stb0") + # tdSql.checkData(0, 0, 2000) + # tdSql.query("show stables") + # tdSql.checkData(1, 4, 20) + # # tdSql.query("select count(*) from stb01_0") + # # tdSql.checkData(0, 0, 35) + # tdSql.query("select count(*) from stb1") + # tdSql.checkData(0, 0, 700) # spend 2min30s for 3 testcases. # insert: drop and child_table_exists combination test @@ -142,10 +134,10 @@ class TDTestCase: # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath) # tdSql.query("select count(*) from db.stb0") # tdSql.checkData(0, 0, 10000) - tdSql.execute("drop database if exists db") - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath) - tdSql.query("select count(*) from db.stb0") - tdSql.checkRows(0) + # tdSql.execute("drop database if exists db") + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath) + # tdSql.query("select count(*) from db.stb0") + # tdSql.checkRows(0) tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath) tdSql.execute("use db") @@ -160,11 +152,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select count(*) from db.stb1") tdSql.checkRows(1) - tdSql.error("select * from db.stb4") - tdSql.error("select * from db.stb2") tdSql.query("select count(*) from db.stb3") tdSql.checkRows(1) tdSql.execute("drop database if exists db") + os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json -y " % binPath) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json -y " % binPath) tdSql.error("select count(*) from db.stb0") tdSql.execute("drop database if exists db") @@ -177,14 +171,17 @@ class TDTestCase: os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json -y " % binPath) tdSql.error("use db") tdSql.execute("drop database if exists blf") - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath) - tdSql.execute("use blf") - tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") - tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") - tdSql.query("select first(ts) from blf.p_0_topics_2") - tdSql.checkData(0, 0, "2019-10-01 00:00:00") - tdSql.query("select last(ts) from blf.p_0_topics_6 ") - tdSql.checkData(0, 0, "2020-09-29 23:59:00") + + # child table name is invalid reading,so + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath) + # tdSql.execute("use blf") + # tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") + # tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") + # tdSql.query("select first(ts) from blf.p_0_topics_2") + # tdSql.checkData(0, 0, "2019-10-01 00:00:00") + # tdSql.query("select last(ts) from blf.p_0_topics_6 ") + # tdSql.checkData(0, 0, "2020-09-29 23:59:00") + # it will be commented in ci because it spend too much time to insert data, but when you can excute it when you want to test this case. # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json -y " % binPath) # tdSql.execute("use db") @@ -200,6 +197,7 @@ class TDTestCase: # tdSql.checkData(0, 0, 5000000) + # insert: timestamp and step os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-timestep-sml.json -y " % binPath) tdSql.execute("use db") @@ -207,12 +205,12 @@ class TDTestCase: tdSql.checkData(0, 0, 10) tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 20) - tdSql.query("select last(ts) from db.stb00_0") - tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + # tdSql.query("select last(ts) from db.stb00_0") + # tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") tdSql.query("select count(*) from stb0") tdSql.checkData(0, 0, 200) - tdSql.query("select last(ts) from db.stb01_0") - tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + # tdSql.query("select last(ts) from db.stb01_0") + # tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 400) @@ -228,17 +226,17 @@ class TDTestCase: tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 10) - # insert: sample json - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath) - tdSql.execute("use dbtest123") - tdSql.query("select c2 from stb0") - tdSql.checkData(0, 0, 2147483647) - tdSql.query("select * from stb1 where t1=-127") - tdSql.checkRows(20) - tdSql.query("select * from stb1 where t2=127") - tdSql.checkRows(10) - tdSql.query("select * from stb1 where t2=126") - tdSql.checkRows(10) + # insert: doesn‘t currently supported sample json + assert os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath) != 0 + # tdSql.execute("use dbtest123") + # tdSql.query("select c2 from stb0") + # tdSql.checkData(0, 0, 2147483647) + # tdSql.query("select * from stb1 where t1=-127") + # tdSql.checkRows(20) + # tdSql.query("select * from stb1 where t2=127") + # tdSql.checkRows(10) + # tdSql.query("select * from stb1 where t2=126") + # tdSql.checkRows(10) # insert: test interlace parament os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interlace-row-sml.json -y " % binPath) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py index 5dba103ef9eafaf15d3159cae94e2b3a264cd8a9..05ccce79101b5bec1b541bd0436b86fc0151492c 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py @@ -187,6 +187,10 @@ class TDTestCase: tdSql.query("select count(*) from db.stb3") tdSql.checkRows(1) tdSql.execute("drop database if exists db") + os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json -y " % binPath) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json -y " % binPath) tdSql.error("select count(*) from db.stb0") tdSql.execute("drop database if exists db") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py index e0b56b93ba0ed2c1e0a3e25bdc176059ea1ef61a..06dcda48064913d69b18cfa004a8218958e35413 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py @@ -174,15 +174,15 @@ class TDTestCase: "2020-11-01 00:00:00.004") # query times less than or equal to 100 - os.system( + assert os.system( "%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json" % - binPath) - os.system( + binPath) == 0 + assert os.system( "%staosBenchmark -f tools/taosdemoAllTest/querySpeciMutisql100.json" % - binPath) - os.system( + binPath) != 0 + assert os.system( "%staosBenchmark -f tools/taosdemoAllTest/querySuperMutisql100.json" % - binPath) + binPath) == 0 # query result print QPS os.system( diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index 6cec3895eb5e24bda398f8ce7472da83b403fbe7..e2ab5e6ffcd9dd499fda37ac3433023d85d4a446 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -238,3 +238,4 @@ run general/parser/tbname_escape.sim run general/parser/columnName_escape.sim run general/parser/tagName_escape.sim run general/parser/interp_blocks.sim +run general/parser/create_tb_with_timestamp_tag.sim diff --git a/tests/script/general/parser/create_tb_with_timestamp_tag.sim b/tests/script/general/parser/create_tb_with_timestamp_tag.sim new file mode 100644 index 0000000000000000000000000000000000000000..452fd2ddbf7d475a00f2fdd334e5065b6da71dc9 --- /dev/null +++ b/tests/script/general/parser/create_tb_with_timestamp_tag.sim @@ -0,0 +1,115 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 +system sh/exec.sh -n dnode1 -s start + +sleep 100 +sql connect +print ======================== dnode1 start + +$db = testdb + +sql create database $db precision 'ns' +sql use $db + +sql create stable st1 (ts timestamp , c1 int) tags(t1 timestamp, t2 int) + +sql create table t1_0 using st1 tags(now, 0) +#nanoseconds +sql create table t1_1 using st1 tags(now + 1b, 0) +#microseconds +sql create table t1_2 using st1 tags(now + 1u, 0) +#milliseconds +sql create table t1_3 using st1 tags(now + 1a, 0) +#seconds +sql create table t1_4 using st1 tags(now + 1s, 0) +#minutes +sql create table t1_5 using st1 tags(now + 1m, 0) +#hours +sql create table t1_6 using st1 tags(now + 1h, 0) +#days +sql create table t1_7 using st1 tags(now + 1d, 0) +#weeks +sql create table t1_8 using st1 tags(now + 1w, 0) +#months(not supported) +sql_error create table t1_9 using st1 tags(now + 1n, 0) +#years(not supported) +sql_error create table t1_10 using st1 tags(now + 1y, 0) + + +sql create stable st2 (ts timestamp , c1 int) tags(t1 timestamp, t2 int) + +sql create table t2_0 using st2 tags(now, 0) +#nanoseconds +sql create table t2_1 using st2 tags(now - 1b, 0) +#microseconds +sql create table t2_2 using st2 tags(now - 1u, 0) +#milliseconds +sql create table t2_3 using st2 tags(now - 1a, 0) +#seconds +sql create table t2_4 using st2 tags(now - 1s, 0) +#minutes +sql create table t2_5 using st2 tags(now - 1m, 0) +#hours +sql create table t2_6 using st2 tags(now - 1h, 0) +#days +sql create table t2_7 using st2 tags(now - 1d, 0) +#weeks +sql create table t2_8 using st2 tags(now - 1w, 0) +#months(not supported) +sql_error create table t2_9 using st2 tags(now - 1n, 0) +#years(not supported) +sql_error create table t2_10 using st2 tags(now - 1y, 0) + +sql insert into t1_0 values (now, 0) +sql insert into t1_1 values (now, 1) +sql insert into t1_2 values (now, 2) +sql insert into t1_3 values (now, 3) +sql insert into t1_4 values (now, 4) +sql insert into t1_5 values (now, 5) +sql insert into t1_6 values (now, 6) +sql insert into t1_7 values (now, 7) +sql insert into t1_8 values (now, 8) + +sql insert into t2_0 values (now, 0) +sql insert into t2_1 values (now, 1) +sql insert into t2_2 values (now, 2) +sql insert into t2_3 values (now, 3) +sql insert into t2_4 values (now, 4) +sql insert into t2_5 values (now, 5) +sql insert into t2_6 values (now, 6) +sql insert into t2_7 values (now, 7) +sql insert into t2_8 values (now, 8) + +sql select * from st1 + +if $rows != 9 then + return -1 +endi + +sql select * from st2 + +if $rows != 9 then + return -1 +endi + +sql create stable st3 (ts timestamp , c1 int) tags (t1 timestamp, t2 timestamp, t3 timestamp, t4 timestamp, t5 timestamp, t6 timestamp, t7 timestamp, t8 timestamp, t9 timestamp) +sql create table t3 using st3 tags(now, now + 1b, now + 1u, now + 1a, now + 1s, now + 1m, now + 1h, now + 1d, now + 1w) +sql insert into t3 values (now, 1) + +sql select * from st3 +if $rows != 1 then + return -1 +endi + +sql create stable st4 (ts timestamp , c1 int) tags (t1 timestamp, t2 timestamp, t3 timestamp, t4 timestamp, t5 timestamp, t6 timestamp, t7 timestamp, t8 timestamp, t9 timestamp) +sql create table t4 using st4 tags(now, now - 1b, now - 1u, now - 1a, now - 1s, now - 1m, now - 1h, now - 1d, now - 1w) +sql insert into t4 values (now, 1) + +sql select * from st4 +if $rows != 1 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim index 16803ea0965a66107a90aaf7ad37d715314a8258..a721e19b99f95274c658497a0fcbeb097903edf2 100644 --- a/tests/script/general/parser/nestquery.sim +++ b/tests/script/general/parser/nestquery.sim @@ -941,4 +941,207 @@ if $data02 != 0 then return -1 endi +print ==========================================> TD-11097 +sql create database td11097 +sql use td11097 +sql create table meters2 (ts timestamp, voltage bigint,num int) tags (location binary(30), groupid int); +sql create table D001 using meters2 tags ("Beijing.Chaoyang", 1); +sql create table D002 using meters2 tags ("Beijing.haidian", 2); +sql create table D003 using meters2 tags ('"Beijing.Tongzhou"', 3); +$ts = 1639556426000 +sql insert into d001 values ( $ts ,1,2); +sql insert into d001 values ( $ts +1m,2,3); +sql insert into d001 values ( $ts +2m,4,3); +sql insert into d001 values ( $ts +4m,8,3); +sql insert into d002 values ( $ts ,4,3); +sql insert into d002 values ( $ts +3m,40,3); +sql insert into d002 values ( $ts +1m,46,3); +sql insert into d001 values ( $ts +20m,1,2); +sql insert into d002 values ( $ts +21m,4,3); +sql select diff(voltage) value from meters2 group by tbname; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; + +$emptyString = @@ +print execute sql select diff(voltage) value from meters2 group by tbname; +sql select diff(voltage) value from meters2 group by tbname; +if $data00 != @21-12-15 16:21:26.000@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @d001@ then + return -1 +endi +if $data10 != @21-12-15 16:22:26.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data12 != @d001@ then + return -1 +endi +if $data20 != @21-12-15 16:24:26.000@ then + return -1 +endi +if $data21 != @4@ then + return -1 +endi +if $data22 != @d001@ then + return -1 +endi +if $data30 != @21-12-15 16:40:26.000@ then + return -1 +endi +if $data31 != @-7@ then + return -1 +endi +if $data32 != @d001@ then + return -1 +endi +if $data40 != @21-12-15 16:21:26.000@ then + return -1 +endi +if $data41 != @42@ then + return -1 +endi +if $data42 != @d002@ then + return -1 +endi +if $data50 != @21-12-15 16:23:26.000@ then + return -1 +endi +if $data51 != @-6@ then + return -1 +endi +if $data52 != @d002@ then + return -1 +endi +if $data60 != @21-12-15 16:41:26.000@ then + return -1 +endi +if $data61 != @-36@ then + return -1 +endi +if $data62 != @d002@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +if $data00 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data01 != @43@ then + return -1 +endi +if $data10 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data21 != @-6@ then + return -1 +endi +if $data30 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data41 != @-7@ then + return -1 +endi +if $data50 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data51 != @-36@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +if $data00 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data01 != @43@ then + return -1 +endi +if $data10 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data21 != @-6@ then + return -1 +endi +if $data30 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data41 != @-7@ then + return -1 +endi +if $data50 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data51 != @-36@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; +if $data00 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data01 != @-36@ then + return -1 +endi +if $data10 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data11 != @-7@ then + return -1 +endi +if $data20 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data21 != @4@ then + return -1 +endi +if $data30 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data31 != @-6@ then + return -1 +endi +if $data40 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data41 != @2@ then + return -1 +endi +if $data50 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data51 != @43@ then + return -1 +endi +sql drop database td11097 system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim index 195eca928fa4ddbf3795ae3e40f973ea0a5e8def..258b59f4ae5ffd75878bca469efc226a6d2d0825 100644 --- a/tests/script/general/parser/select_with_tags.sim +++ b/tests/script/general/parser/select_with_tags.sim @@ -956,4 +956,39 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group #sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; #sql select count(*),tbname from select_tags_mt0 group by tbname +print ==================================> TD-11943 +sql create database test11943; +sql use test11943; +sql create stable st (ts timestamp , id int ) tags (ind int ); +sql insert into sub1 using st tags(1) values(now ,1); +sql insert into sub1 using st tags(1) values(now ,2); +sql insert into sub2 using st tags(2) values(now ,3); +sql insert into sub2 using st tags(2) values(now ,4); +sql select tbname ,max(id)+5 from sub1; +if $data00 != @sub1@ then + return -1 +endi +if $data01 != @7.000000000@ then + return -1 +endi +sql select ind, max(id)+5 from st group by tbname +if $data00 != @1@ then + return -1 +endi +if $data01 != @7.000000000@ then + return -1 +endi +if $data02 != @sub1@ then + return -1 +endi +if $data10 != @2@ then + return -1 +endi +if $data11 != @9.000000000@ then + return -1 +endi +if $data12 != @sub2@ then + return -1 +endi +sql drop database test11943 system sh/exec.sh -n dnode1 -s stop -x SIGINT