提交 f68583e7 编写于 作者: X Xiaoyu Wang

merge master

......@@ -81,6 +81,10 @@ tests/comparisonTest/opentsdb/opentsdbtest/.settings/
tests/examples/JDBC/JDBCDemo/.classpath
tests/examples/JDBC/JDBCDemo/.project
tests/examples/JDBC/JDBCDemo/.settings/
tests/script/api/batchprepare
tests/script/api/stmt
tests/script/api/stmtBatchTest
tests/script/api/stmtTest
# Emacs
# -*- mode: gitignore; -*-
......
......@@ -111,6 +111,77 @@ def pre_test(){
'''
return 1
}
def pre_test_noinstall(){
sh'hostname'
sh'''
cd ${WKC}
git reset --hard HEAD~10 >/dev/null
'''
script {
if (env.CHANGE_TARGET == 'master') {
sh '''
cd ${WKC}
git checkout master
'''
}
else if(env.CHANGE_TARGET == '2.0'){
sh '''
cd ${WKC}
git checkout 2.0
'''
}
else{
sh '''
cd ${WKC}
git checkout develop
'''
}
}
sh'''
cd ${WKC}
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git clean -dfx
git submodule update --init --recursive
cd ${WK}
git reset --hard HEAD~10
'''
script {
if (env.CHANGE_TARGET == 'master') {
sh '''
cd ${WK}
git checkout master
'''
}
else if(env.CHANGE_TARGET == '2.0'){
sh '''
cd ${WK}
git checkout 2.0
'''
}
else{
sh '''
cd ${WK}
git checkout develop
'''
}
}
sh '''
cd ${WK}
git pull >/dev/null
export TZ=Asia/Harbin
date
git clean -dfx
mkdir debug
cd debug
cmake .. > /dev/null
make
'''
return 1
}
def pre_test_win(){
bat '''
taskkill /f /t /im python.exe
......@@ -179,9 +250,9 @@ def pre_test_win(){
git clean -dfx
mkdir debug
cd debug
call "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat" amd64
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64
cmake ../ -G "NMake Makefiles"
nmake || exit 8
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
......@@ -396,7 +467,7 @@ pipeline {
stage('test_b4_s7') {
agent{label " slave7 || slave17 "}
steps {
timeout(time: 55, unit: 'MINUTES'){
timeout(time: 105, unit: 'MINUTES'){
pre_test()
sh '''
date
......@@ -428,7 +499,7 @@ pipeline {
stage('test_b6_s9') {
agent{label " slave9 || slave19 "}
steps {
timeout(time: 55, unit: 'MINUTES'){
timeout(time: 105, unit: 'MINUTES'){
pre_test()
sh '''
date
......@@ -451,36 +522,90 @@ pipeline {
}
}
}
stage('arm64centos7') {
agent{label " arm64centos7 "}
steps {
pre_test_noinstall()
}
}
stage('arm64centos8') {
agent{label " arm64centos8 "}
steps {
pre_test_noinstall()
}
}
stage('arm32bionic') {
agent{label " arm32bionic "}
steps {
pre_test_noinstall()
}
}
stage('arm64bionic') {
agent{label " arm64bionic "}
steps {
pre_test_noinstall()
}
}
stage('arm64focal') {
agent{label " arm64focal "}
steps {
pre_test_noinstall()
}
}
stage('centos7') {
agent{label " centos7 "}
steps {
pre_test_noinstall()
}
}
stage('ubuntu:trusty') {
agent{label " trusty "}
steps {
pre_test_noinstall()
}
}
stage('ubuntu:xenial') {
agent{label " xenial "}
steps {
pre_test_noinstall()
}
}
stage('ubuntu:bionic') {
agent{label " bionic "}
steps {
pre_test_noinstall()
}
}
// stage('build'){
// agent{label " wintest "}
// steps {
// pre_test()
// script{
// while(win_stop == 0){
// sleep(1)
// }
// }
// }
// }
// stage('test'){
// agent{label "win"}
// steps{
stage('build'){
agent{label " wintest "}
steps {
pre_test()
script{
while(win_stop == 0){
sleep(1)
}
}
}
}
stage('test'){
agent{label "win"}
steps{
// catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
// pre_test_win()
// timeout(time: 20, unit: 'MINUTES'){
// bat'''
// cd C:\\workspace\\TDinternal\\community\\tests\\pytest
// .\\test-all.bat Wintest
// '''
// }
// }
// script{
// win_stop=1
// }
// }
// }
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
pre_test_win()
timeout(time: 20, unit: 'MINUTES'){
bat'''
cd C:\\workspace\\TDinternal\\community\\tests\\pytest
.\\test-all.bat wintest
'''
}
}
script{
win_stop=1
}
}
}
}
......
......@@ -4,7 +4,7 @@ PROJECT(TDengine)
IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER})
ELSE ()
SET(TD_VER_NUMBER "2.2.1.1")
SET(TD_VER_NUMBER "2.2.1.3")
ENDIF ()
IF (DEFINED VERCOMPATIBLE)
......
......@@ -3,7 +3,7 @@
## <a class="anchor" id="grafana"></a>Grafana
TDengine能够与开源数据可视化系统[Grafana](https://www.grafana.com/)快速集成搭建数据监测报警系统,整个过程无需任何代码开发,TDengine中数据表中内容可以在仪表盘(DashBoard)上进行可视化展现
TDengine 能够与开源数据可视化系统 [Grafana](https://www.grafana.com/)快速集成搭建数据监测报警系统,整个过程无需任何代码开发,TDengine 中数据表中内容可以在仪表盘(DashBoard)上进行可视化展现。关于TDengine插件的使用您可以在[GitHub](https://github.com/taosdata/grafanaplugin/blob/master/README.md)中了解更多
### 安装Grafana
......@@ -11,12 +11,24 @@ TDengine能够与开源数据可视化系统[Grafana](https://www.grafana.com/)
### 配置Grafana
TDengine的Grafana插件在安装包的/usr/local/taos/connector/grafanaplugin目录下
TDengine 的 Grafana 插件请从 <https://github.com/taosdata/grafanaplugin/releases/latest> 下载
以CentOS 7.2操作系统为例,将grafanaplugin目录拷贝到/var/lib/grafana/plugins目录下,重新启动grafana即可。
```bash
GF_VERSION=3.1.1
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
```
以 CentOS 7.2 操作系统为例,将插件包解压到 /var/lib/grafana/plugins 目录下,重新启动 grafana 即可。
```bash
sudo cp -rf /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tdengine
sudo unzip tdengine-datasource-$GF_VERSION.zip -d /var/lib/grafana/plugins/
```
Grafana 7.3+ / 8.x 版本会对插件进行签名检查,因此还需要在 grafana.ini 文件中增加如下行,才能正确使用插件:
```ini
[plugins]
allow_loading_unsigned_plugins = tdengine-datasource
```
### 使用 Grafana
......@@ -55,7 +67,6 @@ sudo cp -rf /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tde
* ALIAS BY:可设置当前查询别名。
* GENERATE SQL: 点击该按钮会自动替换相应变量,并生成最终执行的语句。
按照默认提示查询当前 TDengine 部署所在服务器指定间隔系统内存平均使用量如下:
![img](page://images/connections/create_dashboard2.jpg)
......@@ -64,16 +75,15 @@ sudo cp -rf /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tde
#### 导入 Dashboard
在 Grafana 插件目录 /usr/local/taos/connector/grafana/tdengine/dashboard/ 下提供了一个 `tdengine-grafana.json` 可导入的 dashboard
我们提供一个 TDengine Dashboard 可以作为 TDengine 集群的监控可视化工具使用,见 [Grafana Dashboard 15146](https://grafana.com/grafana/dashboards/15146)
点击左侧 `Import` 按钮,并上传 `tdengine-grafana.json` 文件
点击左侧 `Import` 按钮,选择 **Grafana.com Dashboard**,j将id `15146` 填入并加载
![img](page://images/connections/import_dashboard1.jpg)
导入完成之后可看到如下效果:
![img](page://images/connections/import_dashboard2.jpg)
![img](../images/connections/dashboard-15146.png)
## <a class="anchor" id="matlab"></a>MATLAB
......
# 使用 TDengine + Telegraf + Grafana 快速搭建 IT 运维展示系统
## 背景介绍
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。自从 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。
IT 运维监测数据通常都是对时间特性比较敏感的数据,例如:
- 系统资源指标:CPU、内存、IO、带宽等。
- 软件系统指标:存活状态、连接数目、请求数目、超时数目、错误数目、响应时间、服务类型及其他与业务有关的指标。
当前主流的 IT 运维系统通常包含一个数据采集模块,一个数据存储模块,和一个可视化显示模块。Telegraf 和 Grafana 分别是当前最流行的数据采集模块和可视化显示模块之一。而数据存储模块可供选择的软件比较多,其中 OpenTSDB 或 InfluxDB 比较流行。而 TDengine 作为新兴的时序大数据平台,具备极强的高性能、高可靠、易管理、易维护的优势。
本文介绍不需要写一行代码,通过简单修改几行配置文件,就可以快速搭建一个基于 TDengine + Telegraf + Grafana 的 IT 运维系统。架构如下图:
![IT-DevOps-Solutions-Telegraf.png](../../images/IT-DevOps-Solutions-Telegraf.png)
## 安装步骤
### 安装 Telegraf,Grafana 和 TDengine
安装 Telegraf、Grafana 和 TDengine 请参考相关官方文档。
### Telegraf
请参考[官方文档](https://portal.influxdata.com/downloads/)
### Grafana
请参考[官方文档](https://grafana.com/grafana/download)
### 安装 TDengine
从涛思数据官网[下载](http://taosdata.com/cn/all-downloads/)页面下载最新 TDengine-server 2.3.0.0 或以上版本安装。
## 数据链路设置
### 下载 TDengine 插件到 grafana 插件目录
```bash
1. wget -c https://github.com/taosdata/grafanaplugin/releases/download/v3.1.1/tdengine-datasource-3.1.1.zip
2. sudo unzip tdengine-datasource-3.1.1.zip -d /var/lib/grafana/plugins/
3. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
4. echo -e "[plugins]\nallow_loading_unsigned_plugins = tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
5. sudo systemctl restart grafana-server.service
```
### 修改 /etc/telegraf/telegraf.conf
配置方法,在 /etc/telegraf/telegraf.conf 增加如下文字,其中 database name 请填写希望在 TDengine 保存 Telegraf 数据的数据库名,TDengine server/cluster host、username和 password 填写 TDengine 实际值:
```
[[outputs.http]]
url = "http://<TDengine server/cluster host>:6041/influxdb/v1/write?db=<database name>"
method = "POST"
timeout = "5s"
username = "<TDengine's username>"
password = "<TDengine's password>"
data_format = "influx"
influx_max_line_bytes = 250
```
然后重启 telegraf:
```
sudo systemctl start telegraf
```
### 导入 Dashboard
使用 Web 浏览器访问 IP:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
点击左侧加号图标并选择 Import,从 https://github.com/taosdata/grafanaplugin/blob/master/examples/telegraf/grafana/dashboards/telegraf-dashboard-v0.1.0.json 下载 dashboard JSON 文件后导入。之后可以看到如下界面的仪表盘:
![IT-DevOps-Solutions-telegraf-dashboard.png](../../images/IT-DevOps-Solutions-telegraf-dashboard.png)
## 总结
以上演示如何快速搭建一个完整的 IT 运维展示系统。得力于 TDengine 2.3.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统。TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品落地案例。
# 使用 TDengine + collectd/StatsD + Grafana 快速搭建 IT 运维监控系统
## 背景介绍
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。自从 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。
IT 运维监测数据通常都是对时间特性比较敏感的数据,例如:
- 系统资源指标:CPU、内存、IO、带宽等。
- 软件系统指标:存活状态、连接数目、请求数目、超时数目、错误数目、响应时间、服务类型及其他与业务有关的指标。
当前主流的 IT 运维系统通常包含一个数据采集模块,一个数据存储模块,和一个可视化显示模块。collectd / statsD 作为老牌开源数据采集工具,具有广泛的用户群。但是 collectd / StatsD 自身功能有限,往往需要配合 Telegraf、Grafana 以及时序数据库组合搭建成为完整的监控系统。而 TDengine 新版本支持多种数据协议接入,可以直接接受 collectd 和 statsD 的数据写入,并提供 Grafana dashboard 进行图形化展示。
本文介绍不需要写一行代码,通过简单修改几行配置文件,就可以快速搭建一个基于 TDengine + collectd / statsD + Grafana 的 IT 运维系统。架构如下图:
![IT-DevOps-Solutions-Collectd-StatsD.png](../../images/IT-DevOps-Solutions-Collectd-StatsD.png)
## 安装步骤
安装 collectd, StatsD, Grafana 和 TDengine 请参考相关官方文档。
### 安装 collectd
请参考[官方文档](https://collectd.org/documentation.shtml)
### 安装 StatsD
请参考[官方文档](https://github.com/statsd/statsd)
### 安装 Grafana
请参考[官方文档](https://grafana.com/grafana/download)
### 安装 TDengine
从涛思数据官网[下载](http://taosdata.com/cn/all-downloads/)页面下载最新 TDengine-server 2.3.0.0 或以上版本安装。
## 数据链路设置
### 复制 TDengine 插件到 grafana 插件目录
```bash
1. wget -c https://github.com/taosdata/grafanaplugin/releases/download/v3.1.1/tdengine-datasource-3.1.1.zip
2. sudo unzip tdengine-datasource-3.1.1.zip -d /var/lib/grafana/plugins/
3. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
4. echo -e "[plugins]\nallow_loading_unsigned_plugins = tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
5. sudo systemctl restart grafana-server.service
```
### 配置 collectd
在 /etc/collectd/collectd.conf 文件中增加如下内容,其中 host 和 port 请填写 TDengine 和 BLM3 配置的实际值:
```
LoadPlugin network
<Plugin network>
Server "<TDengine cluster/server host>" "<port for collectd>"
</Plugin>
sudo systemctl start collectd
```
### 配置 StatsD
在 config.js 文件中增加如下内容后启动 StatsD,其中 host 和 port 请填写 TDengine 和 BLM3 配置的实际值:
```
backends 部分添加 "./backends/repeater"
repeater 部分添加 { host:'<TDengine server/cluster host>', port: <port for StatsD>}
```
### 导入 Dashboard
使用 Web 浏览器访问运行 Grafana 的服务器的3000端口 host:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
#### 导入 collectd 仪表盘
从 https://github.com/taosdata/grafanaplugin/blob/master/examples/collectd/grafana/dashboards/collect-metrics-with-tdengine-v0.1.0.json 下载 dashboard json 文件,点击左侧加号图标并选择 Import,按照界面提示选择 JSON 文件导入。之后可以看到如下界面的仪表盘:
![IT-DevOps-Solutions-collectd-dashboard.png](../../images/IT-DevOps-Solutions-collectd-dashboard.png)
#### 导入 StatsD 仪表盘
从 https://github.com/taosdata/grafanaplugin/blob/master/examples/statsd/dashboards/statsd-with-tdengine-v0.1.0.json 下载 dashboard json 文件,点击左侧加号图标并选择 Import,按照界面提示导入JSON文件。之后可以看到如下界面的仪表盘:
![IT-DevOps-Solutions-statsd-dashboard.png](../../images/IT-DevOps-Solutions-statsd-dashboard.png)
## 总结
TDengine 作为新兴的时序大数据平台,具备极强的高性能、高可靠、易管理、易维护的优势。得力于 TDengine 2.3.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统或者适配一个已存在的系统。
TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品成功落地案例。
......@@ -12,12 +12,17 @@ https://grafana.com/grafana/download.
### Configure Grafana
TDengine Grafana plugin is in the /usr/local/taos/connector/grafanaplugin directory.
Download grafana plugin from <https://github.com/taosdata/grafanaplugin/releases/latest> .
```bash
GF_VERSION=3.1.1
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
```
Taking Centos 7.2 as an example, just copy grafanaplugin directory to /var/lib/grafana/plugins directory and restart Grafana.
```bash
sudo cp -rf /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tdengine
sudo unzip tdengine-datasource-$GF_VERSION.zip /var/lib/grafana/plugins/
```
### Use Grafana
......@@ -64,15 +69,15 @@ According to the default prompt, query the average system memory usage at the sp
#### Import Dashboard
A `tdengine-grafana.json` importable dashboard is provided under the Grafana plug-in directory/usr/local/taos/connector/grafana/tdengine/dashboard/.
We provide an example dashboard [Grafana Dashboard 15146](https://grafana.com/grafana/dashboards/15146)
Click the `Import` button on the left panel and upload the `tdengine-grafana.json` file:
Click the `Import` button on the left panel and load the grafana id:
![img](page://images/connections/import_dashboard1.jpg)
You can see as follows after Dashboard imported.
![img](page://images/connections/import_dashboard2.jpg)
![img](../images/connections/dashboard-15146.png)
## <a class="anchor" id="matlab"></a> MATLAB
......
......@@ -58,12 +58,6 @@ cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_pat
cp ${compile_dir}/../src/inc/taos.h ${pkg_dir}${install_home_path}/include
cp ${compile_dir}/../src/inc/taoserror.h ${pkg_dir}${install_home_path}/include
cp -r ${top_dir}/tests/examples/* ${pkg_dir}${install_home_path}/examples
if [ -d "${top_dir}/src/connector/grafanaplugin/dist" ]; then
cp -r ${top_dir}/src/connector/grafanaplugin/dist ${pkg_dir}${install_home_path}/connector/grafanaplugin
else
echo "grafanaplugin bundled directory not found!"
exit 1
fi
cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector
cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector
cp -r ${top_dir}/src/connector/nodejs ${pkg_dir}${install_home_path}/connector
......
......@@ -67,12 +67,6 @@ cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin
cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver
cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include
cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include
if [ -d %{_compiledir}/../src/connector/grafanaplugin/dist ]; then
cp -r %{_compiledir}/../src/connector/grafanaplugin/dist %{buildroot}%{homepath}/connector/grafanaplugin
else
echo grafanaplugin bundled directory not found!
exit 1
fi
cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector
......
......@@ -316,11 +316,6 @@ function install_data() {
}
function install_connector() {
if [ -d "${source_dir}/src/connector/grafanaplugin/dist" ]; then
${csudo} cp -rf ${source_dir}/src/connector/grafanaplugin/dist ${install_main_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if find ${source_dir}/src/connector/go -mindepth 1 -maxdepth 1 | read; then
${csudo} cp -r ${source_dir}/src/connector/go ${install_main_dir}/connector
else
......
......@@ -150,11 +150,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if [ "$osType" != "Darwin" ]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
fi
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
......@@ -210,11 +210,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if [ "$osType" != "Darwin" ]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
fi
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bunlded dir not found, please check if want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
......@@ -172,11 +172,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if [ "$osType" != "Darwin" ]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
fi
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bunlded dir not found, please check if want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
......@@ -177,11 +177,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if [ "$osType" != "Darwin" ]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
fi
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bunlded dir not found, please check if want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
......@@ -183,11 +183,6 @@ connector_dir="${code_dir}/connector"
mkdir -p ${install_dir}/connector
if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bundled dir not found, please check if you want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
......@@ -167,11 +167,6 @@ mkdir -p ${install_dir}/connector
if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
......@@ -153,11 +153,6 @@ mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo
#if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
# cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
# if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
# cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
# else
# echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
# fi
# if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
# cp -r ${connector_dir}/go ${install_dir}/connector
# else
......
......@@ -167,11 +167,6 @@ mkdir -p ${install_dir}/connector
if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
else
echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector
else
......
name: tdengine
base: core18
version: '2.2.1.1'
version: '2.2.1.3'
icon: snap/gui/t-dengine.svg
summary: an open-source big data platform designed and optimized for IoT.
description: |
......@@ -72,7 +72,7 @@ parts:
- usr/bin/taosd
- usr/bin/taos
- usr/bin/taosdemo
- usr/lib/libtaos.so.2.2.1.1
- usr/lib/libtaos.so.2.2.1.3
- usr/lib/libtaos.so.1
- usr/lib/libtaos.so
......
......@@ -108,6 +108,7 @@ typedef struct SBlockKeyInfo {
int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *len);
int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, SName* name, STableMeta* pTableMeta, STableDataBlocks** dataBlocks);
int32_t tscCreateDataBlockData(STableDataBlocks* dataBuf, size_t defaultSize, int32_t rowSize, int32_t startOffset);
void tscDestroyDataBlock(STableDataBlocks* pDataBlock, bool removeMeta);
void tscSortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf);
int tscSortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo);
......
......@@ -48,12 +48,14 @@ typedef struct SMultiTbStmt {
bool nameSet;
bool tagSet;
bool subSet;
bool tagColSet;
uint64_t currentUid;
char *sqlstr;
uint32_t tbNum;
SStrToken tbname;
SStrToken stbname;
SStrToken values;
SStrToken tagCols;
SArray *tags;
STableDataBlocks *lastBlock;
SHashObj *pTableHash;
......@@ -1246,6 +1248,12 @@ static void insertBatchClean(STscStmt* pStmt) {
pCmd->insertParam.pDataBlocks = tscDestroyBlockArrayList(pCmd->insertParam.pDataBlocks);
pCmd->insertParam.numOfTables = 0;
STableDataBlocks** p = taosHashIterate(pCmd->insertParam.pTableBlockHashList, NULL);
while(p) {
tfree((*p)->pData);
p = taosHashIterate(pCmd->insertParam.pTableBlockHashList, p);
}
taosHashClear(pCmd->insertParam.pTableBlockHashList);
tscFreeSqlResult(pSql);
tscFreeSubobj(pSql);
......@@ -1337,9 +1345,40 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) {
pStmt->mtb.stbname = sToken;
sToken = tStrGetToken(pCmd->insertParam.sql, &index, false);
if (sToken.n <= 0 || sToken.type != TK_TAGS) {
tscError("keyword TAGS expected, sql:%s", pCmd->insertParam.sql);
return tscSQLSyntaxErrMsg(pCmd->payload, "keyword TAGS expected", sToken.z ? sToken.z : pCmd->insertParam.sql);
if (sToken.n <= 0 || ((sToken.type != TK_TAGS) && (sToken.type != TK_LP))) {
tscError("invalid token, sql:%s", pCmd->insertParam.sql);
return tscSQLSyntaxErrMsg(pCmd->payload, "invalid token", sToken.z ? sToken.z : pCmd->insertParam.sql);
}
// ... (tag_col_list) TAGS(tag_val_list) ...
int32_t tagColsCnt = 0;
if (sToken.type == TK_LP) {
pStmt->mtb.tagColSet = true;
pStmt->mtb.tagCols = sToken;
int32_t tagColsStart = index;
while (1) {
sToken = tStrGetToken(pCmd->insertParam.sql, &index, false);
if (sToken.type == TK_ILLEGAL) {
return tscSQLSyntaxErrMsg(pCmd->payload, "unrecognized token", sToken.z);
}
if (sToken.type == TK_ID) {
++tagColsCnt;
}
if (sToken.type == TK_RP) {
break;
}
}
if (tagColsCnt == 0) {
tscError("tag column list expected, sql:%s", pCmd->insertParam.sql);
return tscSQLSyntaxErrMsg(pCmd->payload, "tag column list expected", pCmd->insertParam.sql);
}
pStmt->mtb.tagCols.n = index - tagColsStart + 1;
sToken = tStrGetToken(pCmd->insertParam.sql, &index, false);
if (sToken.n <= 0 || sToken.type != TK_TAGS) {
tscError("keyword TAGS expected, sql:%s", pCmd->insertParam.sql);
return tscSQLSyntaxErrMsg(pCmd->payload, "keyword TAGS expected", sToken.z ? sToken.z : pCmd->insertParam.sql);
}
}
sToken = tStrGetToken(pCmd->insertParam.sql, &index, false);
......@@ -1379,6 +1418,11 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) {
return tscSQLSyntaxErrMsg(pCmd->payload, "no tags", pCmd->insertParam.sql);
}
if (tagColsCnt > 0 && taosArrayGetSize(pStmt->mtb.tags) != tagColsCnt) {
tscError("not match tags, sql:%s", pCmd->insertParam.sql);
return tscSQLSyntaxErrMsg(pCmd->payload, "not match tags", pCmd->insertParam.sql);
}
sToken = tStrGetToken(pCmd->insertParam.sql, &index, false);
if (sToken.n <= 0 || (sToken.type != TK_VALUES && sToken.type != TK_LP)) {
tscError("sql error, sql:%s", pCmd->insertParam.sql);
......@@ -1401,7 +1445,13 @@ int stmtGenInsertStatement(SSqlObj* pSql, STscStmt* pStmt, const char* name, TAO
int32_t j = 0;
while (1) {
len = (size_t)snprintf(str, size - 1, "insert into %s using %.*s tags(", name, pStmt->mtb.stbname.n, pStmt->mtb.stbname.z);
if (pStmt->mtb.tagColSet) {
len = (size_t)snprintf(str, size - 1, "insert into %s using %.*s %.*s tags(",
name, pStmt->mtb.stbname.n, pStmt->mtb.stbname.z, pStmt->mtb.tagCols.n, pStmt->mtb.tagCols.z);
} else {
len = (size_t)snprintf(str, size - 1, "insert into %s using %.*s tags(", name, pStmt->mtb.stbname.n, pStmt->mtb.stbname.z);
}
if (len >= (size -1)) {
size *= 2;
free(str);
......@@ -1637,6 +1687,13 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STMT_RET(TSDB_CODE_TSC_APP_ERROR);
}
if ((*t1)->pData == NULL) {
code = tscCreateDataBlockData(*t1, TSDB_PAYLOAD_SIZE, (*t1)->pTableMeta->tableInfo.rowSize, sizeof(SSubmitBlk));
if (code != TSDB_CODE_SUCCESS) {
STMT_RET(code);
}
}
SSubmitBlk* pBlk = (SSubmitBlk*) (*t1)->pData;
pCmd->batchSize = pBlk->numOfRows;
if (pBlk->numOfRows == 0) {
......@@ -1695,7 +1752,6 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STMT_RET(TSDB_CODE_SUCCESS);
}
if (pStmt->mtb.tagSet) {
pStmt->mtb.tbname = tscReplaceStrToken(&pSql->sqlstr, &pStmt->mtb.tbname, name);
} else {
......@@ -1762,7 +1818,6 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STMT_RET(code);
}
int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name) {
STscStmt* pStmt = (STscStmt*)stmt;
STMT_CHECK
......@@ -1770,8 +1825,6 @@ int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name) {
return taos_stmt_set_tbname_tags(stmt, name, NULL);
}
int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) {
STscStmt* pStmt = (STscStmt*)stmt;
STMT_CHECK
......@@ -1779,7 +1832,6 @@ int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) {
return taos_stmt_set_tbname_tags(stmt, name, NULL);
}
int taos_stmt_close(TAOS_STMT* stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
if (pStmt == NULL || pStmt->taos == NULL) {
......@@ -1846,7 +1898,6 @@ int taos_stmt_bind_param(TAOS_STMT* stmt, TAOS_BIND* bind) {
}
}
int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind) {
STscStmt* pStmt = (STscStmt*)stmt;
......@@ -1910,8 +1961,6 @@ int taos_stmt_bind_single_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, in
STMT_RET(insertStmtBindParamBatch(pStmt, bind, colIdx));
}
int taos_stmt_add_batch(TAOS_STMT* stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
STMT_CHECK
......@@ -2052,7 +2101,6 @@ int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) {
}
}
char *taos_stmt_errstr(TAOS_STMT *stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
......@@ -2063,8 +2111,6 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) {
return taos_errstr(pStmt->pSql);
}
const char *taos_data_type(int type) {
switch (type) {
case TSDB_DATA_TYPE_NULL: return "TSDB_DATA_TYPE_NULL";
......@@ -2081,4 +2127,3 @@ const char *taos_data_type(int type) {
default: return "UNKNOWN";
}
}
......@@ -919,23 +919,31 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
pBlock->info.rows = pRes->numOfRows;
if (pRes->numOfRows != 0) {
doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo, pInput->numOfFilterCols);
*newgroup = false;
return pBlock;
if (pBlock->info.rows > 0) {
*newgroup = false;
return pBlock;
}
}
// No data block exists. So retrieve and transfer it into to SSDataBlock
TAOS_ROW pRow = NULL;
taos_fetch_block(pSql, &pRow);
SSDataBlock* result = NULL;
do {
// No data block exists. So retrieve and transfer it into to SSDataBlock
TAOS_ROW pRow = NULL;
taos_fetch_block(pSql, &pRow);
if (pRes->numOfRows == 0) {
pOperator->status = OP_EXEC_DONE;
return NULL;
}
if (pRes->numOfRows == 0) {
pOperator->status = OP_EXEC_DONE;
result = NULL;
break;
}
pBlock->info.rows = pRes->numOfRows;
doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo, pInput->numOfFilterCols);
*newgroup = false;
return pBlock;
pBlock->info.rows = pRes->numOfRows;
doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo, pInput->numOfFilterCols);
*newgroup = false;
result = pBlock;
} while (result->info.rows == 0);
return result;
}
static void fetchNextBlockIfCompleted(SOperatorInfo* pOperator, bool* newgroup) {
......@@ -1797,6 +1805,32 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
int32_t code = tscCreateDataBlockData(dataBuf, defaultSize, rowSize, startOffset);
if (code != TSDB_CODE_SUCCESS) {
tfree(dataBuf);
return code;
}
//Here we keep the tableMeta to avoid it to be remove by other threads.
dataBuf->pTableMeta = tscTableMetaDup(pTableMeta);
SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo;
SSchema* pSchema = tscGetTableSchema(dataBuf->pTableMeta);
tscSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns);
dataBuf->vgId = dataBuf->pTableMeta->vgId;
tNameAssign(&dataBuf->tableName, name);
assert(defaultSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL);
*dataBlocks = dataBuf;
return TSDB_CODE_SUCCESS;
}
int32_t tscCreateDataBlockData(STableDataBlocks* dataBuf, size_t defaultSize, int32_t rowSize, int32_t startOffset) {
assert(dataBuf != NULL);
dataBuf->nAllocSize = (uint32_t)defaultSize;
dataBuf->headerSize = startOffset;
......@@ -1809,30 +1843,16 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff
dataBuf->pData = malloc(dataBuf->nAllocSize);
if (dataBuf->pData == NULL) {
tscError("failed to allocated memory, reason:%s", strerror(errno));
tfree(dataBuf);
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
memset(dataBuf->pData, 0, sizeof(SSubmitBlk));
//Here we keep the tableMeta to avoid it to be remove by other threads.
dataBuf->pTableMeta = tscTableMetaDup(pTableMeta);
SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo;
SSchema* pSchema = tscGetTableSchema(dataBuf->pTableMeta);
tscSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns);
dataBuf->ordered = true;
dataBuf->prevTS = INT64_MIN;
dataBuf->rowSize = rowSize;
dataBuf->size = startOffset;
dataBuf->tsSource = -1;
dataBuf->vgId = dataBuf->pTableMeta->vgId;
tNameAssign(&dataBuf->tableName, name);
assert(defaultSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL);
*dataBlocks = dataBuf;
return TSDB_CODE_SUCCESS;
}
......
......@@ -45,7 +45,7 @@ extern int32_t tsDnodeId;
// common
extern int tsRpcTimer;
extern int tsRpcMaxTime;
extern int tsRpcForceTcp; // all commands go to tcp protocol if this is enabled
extern int tsRpcForceTcp; // all commands go to tcp protocol if this is enabled
extern int32_t tsMaxConnections;
extern int32_t tsMaxShellConns;
extern int32_t tsShellActivityTimer;
......@@ -56,18 +56,19 @@ extern float tsRatioOfQueryCores;
extern int8_t tsDaylight;
extern char tsTimezone[];
extern char tsLocale[];
extern char tsCharset[]; // default encode string
extern char tsCharset[]; // default encode string
extern int8_t tsEnableCoreFile;
extern int32_t tsCompressMsgSize;
extern int32_t tsMaxNumOfDistinctResults;
extern char tsTempDir[];
//query buffer management
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing
extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in byte for each data node during query processing
extern int32_t tsRetrieveBlockingModel;// retrieve threads will be blocked
// query buffer management
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing
extern int64_t
tsQueryBufferSizeBytes; // maximum allowed usage buffer size in byte for each data node during query processing
extern int32_t tsRetrieveBlockingModel; // retrieve threads will be blocked
extern int8_t tsKeepOriginalColumnName;
extern int8_t tsKeepOriginalColumnName;
// client
extern int32_t tsMaxSQLStringLen;
......@@ -126,6 +127,7 @@ extern int8_t tsHttpEnableCompress;
extern int8_t tsHttpEnableRecordSql;
extern int8_t tsTelegrafUseFieldNum;
extern int8_t tsHttpDbNameMandatory;
extern int32_t tsHttpKeepAlive;
// mqtt
extern int8_t tsEnableMqttModule;
......@@ -162,22 +164,22 @@ extern int64_t tsTickPerDay[3];
extern int32_t tsTopicBianryLen;
// system info
extern char tsOsName[];
extern int64_t tsPageSize;
extern int64_t tsOpenMax;
extern int64_t tsStreamMax;
extern int32_t tsNumOfCores;
extern float tsTotalLogDirGB;
extern float tsTotalTmpDirGB;
extern float tsTotalDataDirGB;
extern float tsAvailLogDirGB;
extern float tsAvailTmpDirectorySpace;
extern float tsAvailDataDirGB;
extern float tsUsedDataDirGB;
extern float tsMinimalLogDirGB;
extern float tsReservedTmpDirectorySpace;
extern float tsMinimalDataDirGB;
extern int32_t tsTotalMemoryMB;
extern char tsOsName[];
extern int64_t tsPageSize;
extern int64_t tsOpenMax;
extern int64_t tsStreamMax;
extern int32_t tsNumOfCores;
extern float tsTotalLogDirGB;
extern float tsTotalTmpDirGB;
extern float tsTotalDataDirGB;
extern float tsAvailLogDirGB;
extern float tsAvailTmpDirectorySpace;
extern float tsAvailDataDirGB;
extern float tsUsedDataDirGB;
extern float tsMinimalLogDirGB;
extern float tsReservedTmpDirectorySpace;
extern float tsMinimalDataDirGB;
extern int32_t tsTotalMemoryMB;
extern uint32_t tsVersion;
// build info
......@@ -188,26 +190,26 @@ extern char gitinfoOfInternal[];
extern char buildinfo[];
// log
extern int8_t tsAsyncLog;
extern int32_t tsNumOfLogLines;
extern int32_t tsLogKeepDays;
extern int32_t dDebugFlag;
extern int32_t vDebugFlag;
extern int32_t mDebugFlag;
extern int8_t tsAsyncLog;
extern int32_t tsNumOfLogLines;
extern int32_t tsLogKeepDays;
extern int32_t dDebugFlag;
extern int32_t vDebugFlag;
extern int32_t mDebugFlag;
extern uint32_t cDebugFlag;
extern int32_t jniDebugFlag;
extern int32_t tmrDebugFlag;
extern int32_t sdbDebugFlag;
extern int32_t httpDebugFlag;
extern int32_t mqttDebugFlag;
extern int32_t monDebugFlag;
extern int32_t uDebugFlag;
extern int32_t rpcDebugFlag;
extern int32_t odbcDebugFlag;
extern int32_t jniDebugFlag;
extern int32_t tmrDebugFlag;
extern int32_t sdbDebugFlag;
extern int32_t httpDebugFlag;
extern int32_t mqttDebugFlag;
extern int32_t monDebugFlag;
extern int32_t uDebugFlag;
extern int32_t rpcDebugFlag;
extern int32_t odbcDebugFlag;
extern uint32_t qDebugFlag;
extern int32_t wDebugFlag;
extern int32_t cqDebugFlag;
extern int32_t debugFlag;
extern int32_t wDebugFlag;
extern int32_t cqDebugFlag;
extern int32_t debugFlag;
extern int8_t tsClientMerge;
......@@ -218,7 +220,7 @@ extern double fPrecision;
extern double dPrecision;
extern uint32_t maxRange;
extern uint32_t curRange;
extern char Compressor[];
extern char Compressor[];
#endif
......
......@@ -253,9 +253,10 @@ int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPo
}
if(tdAllocMemForCol(pCol, maxPoints) < 0) return -1;
if (numOfRows > 0) {
if (((rowOffset == 0) && (numOfRows > 0)) || ((rowOffset == -1) && (numOfRows >= 0))) {
// Find the first not null value, fill all previouse values as NULL
dataColSetNEleNull(pCol, numOfRows);
dataColSetNEleNull(pCol, numOfRows - rowOffset);
}
}
......@@ -463,9 +464,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
int rcol = 0;
int dcol = 0;
while (dcol < pCols->numOfCols) {
bool setCol = 0;
SDataCol *pDataCol = &(pCols->cols[dcol]);
if (rcol >= schemaNCols(pSchema)) {
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset);
......@@ -476,14 +475,22 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
STColumn *pRowCol = schemaColAt(pSchema, rcol);
if (pRowCol->colId == pDataCol->colId) {
void *value = tdGetRowDataOfCol(row, pRowCol->type, pRowCol->offset + TD_DATA_ROW_HEAD_SIZE);
if(!isNull(value, pDataCol->type)) setCol = 1;
dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset);
if (rowOffset == 0) {
dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset);
} else if (rowOffset == -1) {
// for update 2
if (!isNull(value, pDataCol->type)) {
dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset);
}
} else {
ASSERT(0);
}
dcol++;
rcol++;
} else if (pRowCol->colId < pDataCol->colId) {
rcol++;
} else {
if(forceSetNull || setCol) {
if(forceSetNull) {
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset);
}
dcol++;
......@@ -501,7 +508,6 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
int nRowCols = kvRowNCols(row);
while (dcol < pCols->numOfCols) {
bool setCol = 0;
SDataCol *pDataCol = &(pCols->cols[dcol]);
if (rcol >= nRowCols || rcol >= schemaNCols(pSchema)) {
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset);
......@@ -513,14 +519,22 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
if (colIdx->colId == pDataCol->colId) {
void *value = tdGetKvRowDataOfCol(row, colIdx->offset);
if(!isNull(value, pDataCol->type)) setCol = 1;
dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset);
if (rowOffset == 0) {
dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset);
} else if (rowOffset == -1) {
// for update 2
if (!isNull(value, pDataCol->type)) {
dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset);
}
} else {
ASSERT(0);
}
++dcol;
++rcol;
} else if (colIdx->colId < pDataCol->colId) {
++rcol;
} else {
if (forceSetNull || setCol) {
if (forceSetNull) {
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset);
}
++dcol;
......
......@@ -14,18 +14,18 @@
*/
#define _DEFAULT_SOURCE
#include "tglobal.h"
#include "monitor.h"
#include "os.h"
#include "taosdef.h"
#include "taoserror.h"
#include "tulog.h"
#include "tcompare.h"
#include "tconfig.h"
#include "tglobal.h"
#include "monitor.h"
#include "tsocket.h"
#include "tutil.h"
#include "tlocale.h"
#include "tsocket.h"
#include "ttimezone.h"
#include "tcompare.h"
#include "tulog.h"
#include "tutil.h"
// TSDB
bool tsdbForceKeepFile = false;
......@@ -51,16 +51,16 @@ char tsEmail[TSDB_FQDN_LEN] = {0};
int32_t tsDnodeId = 0;
// common
int32_t tsRpcTimer = 300;
int32_t tsRpcMaxTime = 600; // seconds;
int32_t tsRpcForceTcp = 0; //disable this, means query, show command use udp protocol as default
int32_t tsMaxShellConns = 50000;
int32_t tsRpcTimer = 300;
int32_t tsRpcMaxTime = 600; // seconds;
int32_t tsRpcForceTcp = 0; // disable this, means query, show command use udp protocol as default
int32_t tsMaxShellConns = 50000;
int32_t tsMaxConnections = 5000;
int32_t tsShellActivityTimer = 3; // second
int32_t tsShellActivityTimer = 3; // second
float tsNumOfThreadsPerCore = 1.0f;
int32_t tsNumOfCommitThreads = 4;
float tsRatioOfQueryCores = 1.0f;
int8_t tsDaylight = 0;
int8_t tsDaylight = 0;
char tsTimezone[TSDB_TIMEZONE_LEN] = {0};
char tsLocale[TSDB_LOCALE_LEN] = {0};
char tsCharset[TSDB_LOCALE_LEN] = {0}; // default encode string
......@@ -90,7 +90,7 @@ int32_t tsMaxNumOfOrderedResults = 1000000;
int32_t tsMinSlidingTime = 10;
// the maxinum number of distict query result
int32_t tsMaxNumOfDistinctResults = 1000 * 10000;
int32_t tsMaxNumOfDistinctResults = 1000 * 10000;
// 1 us for interval time range, changed accordingly
int32_t tsMinIntervalTime = 1;
......@@ -102,7 +102,7 @@ int32_t tsMaxStreamComputDelay = 20000;
int32_t tsStreamCompStartDelay = 10000;
// the stream computing delay time after executing failed, change accordingly
int32_t tsRetryStreamCompDelay = 10*1000;
int32_t tsRetryStreamCompDelay = 10 * 1000;
// The delayed computing ration. 10% of the whole computing time window by default.
float tsStreamComputDelayRatio = 0.1f;
......@@ -121,26 +121,26 @@ int64_t tsQueryBufferSizeBytes = -1;
int32_t tsRetrieveBlockingModel = 0;
// last_row(*), first(*), last_row(ts, col1, col2) query, the result fields will be the original column name
int8_t tsKeepOriginalColumnName = 0;
int8_t tsKeepOriginalColumnName = 0;
// db parameters
int32_t tsCacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE;
int32_t tsBlocksPerVnode = TSDB_DEFAULT_TOTAL_BLOCKS;
int16_t tsDaysPerFile = TSDB_DEFAULT_DAYS_PER_FILE;
int32_t tsDaysToKeep = TSDB_DEFAULT_KEEP;
int16_t tsDaysPerFile = TSDB_DEFAULT_DAYS_PER_FILE;
int32_t tsDaysToKeep = TSDB_DEFAULT_KEEP;
int32_t tsMinRowsInFileBlock = TSDB_DEFAULT_MIN_ROW_FBLOCK;
int32_t tsMaxRowsInFileBlock = TSDB_DEFAULT_MAX_ROW_FBLOCK;
int16_t tsCommitTime = TSDB_DEFAULT_COMMIT_TIME; // seconds
int16_t tsCommitTime = TSDB_DEFAULT_COMMIT_TIME; // seconds
int32_t tsTimePrecision = TSDB_DEFAULT_PRECISION;
int8_t tsCompression = TSDB_DEFAULT_COMP_LEVEL;
int8_t tsWAL = TSDB_DEFAULT_WAL_LEVEL;
int32_t tsFsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD;
int32_t tsReplications = TSDB_DEFAULT_DB_REPLICA_OPTION;
int32_t tsQuorum = TSDB_DEFAULT_DB_QUORUM_OPTION;
int16_t tsPartitons = TSDB_DEFAULT_DB_PARTITON_OPTION;
int8_t tsUpdate = TSDB_DEFAULT_DB_UPDATE_OPTION;
int8_t tsCacheLastRow = TSDB_DEFAULT_CACHE_LAST_ROW;
int32_t tsMaxVgroupsPerDb = 0;
int8_t tsCompression = TSDB_DEFAULT_COMP_LEVEL;
int8_t tsWAL = TSDB_DEFAULT_WAL_LEVEL;
int32_t tsFsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD;
int32_t tsReplications = TSDB_DEFAULT_DB_REPLICA_OPTION;
int32_t tsQuorum = TSDB_DEFAULT_DB_QUORUM_OPTION;
int16_t tsPartitons = TSDB_DEFAULT_DB_PARTITON_OPTION;
int8_t tsUpdate = TSDB_DEFAULT_DB_UPDATE_OPTION;
int8_t tsCacheLastRow = TSDB_DEFAULT_CACHE_LAST_ROW;
int32_t tsMaxVgroupsPerDb = 0;
int32_t tsMinTablePerVnode = TSDB_TABLES_STEP;
int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES;
int32_t tsTableIncStepPerVnode = TSDB_TABLES_STEP;
......@@ -148,7 +148,7 @@ int32_t tsTableIncStepPerVnode = TSDB_TABLES_STEP;
// balance
int8_t tsEnableBalance = 1;
int8_t tsAlternativeRole = 0;
int32_t tsBalanceInterval = 300; // seconds
int32_t tsBalanceInterval = 300; // seconds
int32_t tsOfflineThreshold = 86400 * 10; // seconds of 10 days
int32_t tsMnodeEqualVnodeNum = 4;
int8_t tsEnableFlowCtrl = 1;
......@@ -166,15 +166,16 @@ int8_t tsHttpEnableCompress = 1;
int8_t tsHttpEnableRecordSql = 0;
int8_t tsTelegrafUseFieldNum = 0;
int8_t tsHttpDbNameMandatory = 0;
int32_t tsHttpKeepAlive = 30000;
// mqtt
int8_t tsEnableMqttModule = 0; // not finished yet, not started it by default
char tsMqttHostName[TSDB_MQTT_HOSTNAME_LEN] = "test.mosquitto.org";
char tsMqttPort[TSDB_MQTT_PORT_LEN] = "1883";
char tsMqttUser[TSDB_MQTT_USER_LEN] = {0};
char tsMqttPass[TSDB_MQTT_PASS_LEN] = {0};
char tsMqttClientId[TSDB_MQTT_CLIENT_ID_LEN] = "TDengineMqttSubscriber";
char tsMqttTopic[TSDB_MQTT_TOPIC_LEN] = "/test"; // #
char tsMqttHostName[TSDB_MQTT_HOSTNAME_LEN] = "test.mosquitto.org";
char tsMqttPort[TSDB_MQTT_PORT_LEN] = "1883";
char tsMqttUser[TSDB_MQTT_USER_LEN] = {0};
char tsMqttPass[TSDB_MQTT_PASS_LEN] = {0};
char tsMqttClientId[TSDB_MQTT_CLIENT_ID_LEN] = "TDengineMqttSubscriber";
char tsMqttTopic[TSDB_MQTT_TOPIC_LEN] = "/test"; // #
// monitor
int8_t tsEnableMonitorModule = 1;
......@@ -183,7 +184,7 @@ char tsInternalPass[] = "secretkey";
int32_t tsMonitorInterval = 30; // seconds
// stream
int8_t tsEnableStream = 1;
int8_t tsEnableStream = 1;
// internal
int8_t tsCompactMnodeWal = 0;
......@@ -199,7 +200,7 @@ char tsDataDir[PATH_MAX] = {0};
char tsScriptDir[PATH_MAX] = {0};
char tsTempDir[PATH_MAX] = "/tmp/";
int32_t tsDiskCfgNum = 0;
int32_t tsDiskCfgNum = 0;
int32_t tsTopicBianryLen = 16000;
#ifndef _STORAGE
......@@ -217,42 +218,42 @@ SDiskCfg tsDiskCfg[TSDB_MAX_DISKS];
int64_t tsTickPerDay[] = {86400000L, 86400000000L, 86400000000000L};
// system info
char tsOsName[10] = "Linux";
int64_t tsPageSize;
int64_t tsOpenMax;
int64_t tsStreamMax;
int32_t tsNumOfCores = 1;
float tsTotalTmpDirGB = 0;
float tsTotalDataDirGB = 0;
float tsAvailTmpDirectorySpace = 0;
float tsAvailDataDirGB = 0;
float tsUsedDataDirGB = 0;
float tsReservedTmpDirectorySpace = 1.0f;
float tsMinimalDataDirGB = 2.0f;
int32_t tsTotalMemoryMB = 0;
char tsOsName[10] = "Linux";
int64_t tsPageSize;
int64_t tsOpenMax;
int64_t tsStreamMax;
int32_t tsNumOfCores = 1;
float tsTotalTmpDirGB = 0;
float tsTotalDataDirGB = 0;
float tsAvailTmpDirectorySpace = 0;
float tsAvailDataDirGB = 0;
float tsUsedDataDirGB = 0;
float tsReservedTmpDirectorySpace = 1.0f;
float tsMinimalDataDirGB = 2.0f;
int32_t tsTotalMemoryMB = 0;
uint32_t tsVersion = 0;
// log
int32_t tsNumOfLogLines = 10000000;
int32_t mDebugFlag = 131;
int32_t sdbDebugFlag = 131;
int32_t dDebugFlag = 135;
int32_t vDebugFlag = 135;
int32_t tsNumOfLogLines = 10000000;
int32_t mDebugFlag = 131;
int32_t sdbDebugFlag = 131;
int32_t dDebugFlag = 135;
int32_t vDebugFlag = 135;
uint32_t cDebugFlag = 131;
int32_t jniDebugFlag = 131;
int32_t odbcDebugFlag = 131;
int32_t httpDebugFlag = 131;
int32_t mqttDebugFlag = 131;
int32_t monDebugFlag = 131;
int32_t jniDebugFlag = 131;
int32_t odbcDebugFlag = 131;
int32_t httpDebugFlag = 131;
int32_t mqttDebugFlag = 131;
int32_t monDebugFlag = 131;
uint32_t qDebugFlag = 131;
int32_t rpcDebugFlag = 131;
int32_t uDebugFlag = 131;
int32_t debugFlag = 0;
int32_t sDebugFlag = 135;
int32_t wDebugFlag = 135;
int32_t tsdbDebugFlag = 131;
int32_t cqDebugFlag = 131;
int32_t fsDebugFlag = 135;
int32_t rpcDebugFlag = 131;
int32_t uDebugFlag = 131;
int32_t debugFlag = 0;
int32_t sDebugFlag = 135;
int32_t wDebugFlag = 135;
int32_t tsdbDebugFlag = 131;
int32_t cqDebugFlag = 131;
int32_t fsDebugFlag = 135;
int8_t tsClientMerge = 0;
......@@ -260,13 +261,14 @@ int8_t tsClientMerge = 0;
//
// lossy compress 6
//
char lossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty can close lossy compress.
// below option can take effect when tsLossyColumns not empty
double fPrecision = 1E-8; // float column precision
double dPrecision = 1E-16; // double column precision
uint32_t maxRange = 500; // max range
uint32_t curRange = 100; // range
char Compressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR
char lossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty
// can close lossy compress.
// below option can take effect when tsLossyColumns not empty
double fPrecision = 1E-8; // float column precision
double dPrecision = 1E-16; // double column precision
uint32_t maxRange = 500; // max range
uint32_t curRange = 100; // range
char Compressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR
#endif
int32_t (*monStartSystemFp)() = NULL;
......@@ -278,7 +280,7 @@ char *qtypeStr[] = {"rpc", "fwd", "wal", "cq", "query"};
static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT;
void taosSetAllDebugFlag() {
if (debugFlag != 0) {
if (debugFlag != 0) {
mDebugFlag = debugFlag;
sdbDebugFlag = debugFlag;
dDebugFlag = debugFlag;
......@@ -289,7 +291,7 @@ void taosSetAllDebugFlag() {
httpDebugFlag = debugFlag;
mqttDebugFlag = debugFlag;
monDebugFlag = debugFlag;
qDebugFlag = debugFlag;
qDebugFlag = debugFlag;
rpcDebugFlag = debugFlag;
uDebugFlag = debugFlag;
sDebugFlag = debugFlag;
......@@ -301,12 +303,13 @@ void taosSetAllDebugFlag() {
}
bool taosCfgDynamicOptions(char *msg) {
char *option, *value;
int32_t olen, vlen;
int32_t vint = 0;
char *option, *value;
int32_t olen, vlen;
int32_t vint = 0;
paGetToken(msg, &option, &olen);
if (olen == 0) return false;;
if (olen == 0) return false;
;
paGetToken(option + olen + 1, &value, &vlen);
if (vlen == 0)
......@@ -319,9 +322,9 @@ bool taosCfgDynamicOptions(char *msg) {
for (int32_t i = 0; i < tsGlobalConfigNum; ++i) {
SGlobalCfg *cfg = tsGlobalConfig + i;
//if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_LOG)) continue;
// if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_LOG)) continue;
if (cfg->valType != TAOS_CFG_VTYPE_INT32 && cfg->valType != TAOS_CFG_VTYPE_INT8) continue;
int32_t cfgLen = (int32_t)strlen(cfg->option);
if (cfgLen != olen) continue;
if (strncasecmp(option, cfg->option, olen) != 0) continue;
......@@ -350,7 +353,7 @@ bool taosCfgDynamicOptions(char *msg) {
return true;
}
if (strncasecmp(cfg->option, "debugFlag", olen) == 0) {
taosSetAllDebugFlag();
taosSetAllDebugFlag();
}
return true;
}
......@@ -407,7 +410,7 @@ static void taosCheckDataDirCfg() {
}
static int32_t taosCheckTmpDir(void) {
if (strlen(tsTempDir) <= 0){
if (strlen(tsTempDir) <= 0) {
uError("tempDir is not set");
return -1;
}
......@@ -428,7 +431,7 @@ static void doInitGlobalConfig(void) {
srand(taosSafeRand());
SGlobalCfg cfg = {0};
// ip address
cfg.option = "firstEp";
cfg.ptr = tsFirst;
......@@ -557,12 +560,12 @@ static void doInitGlobalConfig(void) {
cfg.ptr = &tsMaxNumOfDistinctResults;
cfg.valType = TAOS_CFG_VTYPE_INT32;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT;
cfg.minValue = 10*10000;
cfg.maxValue = 10000*10000;
cfg.minValue = 10 * 10000;
cfg.maxValue = 10000 * 10000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "numOfMnodes";
cfg.ptr = &tsNumOfMnodes;
cfg.valType = TAOS_CFG_VTYPE_INT32;
......@@ -1149,7 +1152,7 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
// module configs
// module configs
cfg.option = "flowctrl";
cfg.ptr = &tsEnableFlowCtrl;
cfg.valType = TAOS_CFG_VTYPE_INT8;
......@@ -1280,6 +1283,17 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
// pContext in cache
cfg.option = "httpKeepAlive";
cfg.ptr = &tsHttpKeepAlive;
cfg.valType = TAOS_CFG_VTYPE_INT32;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG;
cfg.minValue = 3000;
cfg.maxValue = 3600000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
// debug flag
cfg.option = "numOfLogLines";
cfg.ptr = &tsNumOfLogLines;
......@@ -1361,7 +1375,6 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "sdbDebugFlag";
cfg.ptr = &sdbDebugFlag;
cfg.valType = TAOS_CFG_VTYPE_INT32;
......@@ -1648,21 +1661,18 @@ static void doInitGlobalConfig(void) {
#else
assert(tsGlobalConfigNum == TSDB_CFG_MAX_NUM - 5);
#endif
}
void taosInitGlobalCfg() {
pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig);
}
void taosInitGlobalCfg() { pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig); }
int32_t taosCheckGlobalCfg() {
char fqdn[TSDB_FQDN_LEN];
char fqdn[TSDB_FQDN_LEN];
uint16_t port;
if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP) {
taosSetAllDebugFlag();
}
if (tsLocalFqdn[0] == 0) {
taosGetFqdn(tsLocalFqdn);
}
......@@ -1689,7 +1699,7 @@ int32_t taosCheckGlobalCfg() {
if (taosCheckTmpDir()) {
return -1;
}
taosGetSystemInfo();
tsSetLocale();
......@@ -1711,8 +1721,8 @@ int32_t taosCheckGlobalCfg() {
}
if (tsMaxTablePerVnode < tsMinTablePerVnode) {
uError("maxTablesPerVnode(%d) < minTablesPerVnode(%d), reset to minTablesPerVnode(%d)",
tsMaxTablePerVnode, tsMinTablePerVnode, tsMinTablePerVnode);
uError("maxTablesPerVnode(%d) < minTablesPerVnode(%d), reset to minTablesPerVnode(%d)", tsMaxTablePerVnode,
tsMinTablePerVnode, tsMinTablePerVnode);
tsMaxTablePerVnode = tsMinTablePerVnode;
}
......@@ -1734,7 +1744,7 @@ int32_t taosCheckGlobalCfg() {
}
tsDnodeShellPort = tsServerPort + TSDB_PORT_DNODESHELL; // udp[6035-6039] tcp[6035]
tsDnodeDnodePort = tsServerPort + TSDB_PORT_DNODEDNODE; // udp/tcp
tsDnodeDnodePort = tsServerPort + TSDB_PORT_DNODEDNODE; // udp/tcp
tsSyncPort = tsServerPort + TSDB_PORT_SYNC;
tsHttpPort = tsServerPort + TSDB_PORT_HTTP;
......@@ -1754,17 +1764,17 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
strcpy(fqdn, ep);
char *temp = strchr(fqdn, ':');
if (temp) {
if (temp) {
*temp = 0;
*port = atoi(temp+1);
}
*port = atoi(temp + 1);
}
if (*port == 0) {
*port = tsServerPort;
return -1;
}
return 0;
return 0;
}
/*
......
......@@ -112,6 +112,7 @@
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/HttpClientPoolUtilTest.java</exclude>
<exclude>**/AppMemoryLeakTest.java</exclude>
<exclude>**/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java</exclude>
<exclude>**/DatetimeBefore1970Test.java</exclude>
......
......@@ -31,6 +31,8 @@ public class TSDBErrorNumbers {
public static final int ERROR_RESTFul_Client_IOException = 0x2318;
public static final int ERROR_USER_IS_REQUIRED = 0x2319; // user is required
public static final int ERROR_PASSWORD_IS_REQUIRED = 0x231a; // password is required
public static final int ERROR_INVALID_JSON_FORMAT = 0x231b;
public static final int ERROR_HTTP_ENTITY_IS_NULL = 0x231c; //http entity is null
public static final int ERROR_UNKNOWN = 0x2350; //unknown error
......@@ -72,6 +74,8 @@ public class TSDBErrorNumbers {
errorNumbers.add(ERROR_RESTFul_Client_IOException);
errorNumbers.add(ERROR_USER_IS_REQUIRED);
errorNumbers.add(ERROR_PASSWORD_IS_REQUIRED);
errorNumbers.add(ERROR_INVALID_JSON_FORMAT);
errorNumbers.add(ERROR_HTTP_ENTITY_IS_NULL);
errorNumbers.add(ERROR_RESTFul_Client_Protocol_Exception);
......
......@@ -5,6 +5,7 @@ import com.taosdata.jdbc.TSDBErrorNumbers;
import org.apache.http.HeaderElement;
import org.apache.http.HeaderElementIterator;
import org.apache.http.HttpEntity;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.config.RequestConfig;
......@@ -30,12 +31,12 @@ import java.sql.SQLException;
public class HttpClientPoolUtil {
private static final String DEFAULT_CONTENT_TYPE = "application/json";
private static final int DEFAULT_MAX_TOTAL = 200;
private static final int DEFAULT_MAX_PER_ROUTE = 20;
private static final int DEFAULT_TIME_OUT = 15000;
private static final int DEFAULT_HTTP_KEEP_TIME = 15000;
private static final int DEFAULT_MAX_RETRY_COUNT = 5;
private static final int DEFAULT_MAX_TOTAL = 50;
private static final int DEFAULT_MAX_PER_ROUTE = 5;
private static final int DEFAULT_HTTP_KEEP_TIME = -1;
private static final ConnectionKeepAliveStrategy DEFAULT_KEEP_ALIVE_STRATEGY = (response, context) -> {
HeaderElementIterator it = new BasicHeaderElementIterator(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
......@@ -52,29 +53,19 @@ public class HttpClientPoolUtil {
return DEFAULT_HTTP_KEEP_TIME * 1000;
};
private static final HttpRequestRetryHandler retryHandler = (exception, executionCount, httpContext) -> {
if (executionCount >= DEFAULT_MAX_RETRY_COUNT)
// do not retry if over max retry count
return false;
if (exception instanceof InterruptedIOException)
// timeout
return false;
if (exception instanceof UnknownHostException)
// unknown host
return false;
if (exception instanceof SSLException)
// SSL handshake exception
return false;
return true;
};
private static CloseableHttpClient httpClient;
static {
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(DEFAULT_MAX_TOTAL);
connectionManager.setDefaultMaxPerRoute(DEFAULT_MAX_PER_ROUTE);
httpClient = HttpClients.custom().setKeepAliveStrategy(DEFAULT_KEEP_ALIVE_STRATEGY).setConnectionManager(connectionManager).setRetryHandler(retryHandler).build();
httpClient = HttpClients.custom()
.setKeepAliveStrategy(DEFAULT_KEEP_ALIVE_STRATEGY)
.setConnectionManager(connectionManager)
.setRetryHandler((exception, executionCount, httpContext) -> executionCount < DEFAULT_MAX_RETRY_COUNT)
.build();
}
/*** execute GET request ***/
......@@ -118,9 +109,10 @@ public class HttpClientPoolUtil {
HttpContext context = HttpClientContext.create();
CloseableHttpResponse httpResponse = httpClient.execute(method, context);
httpEntity = httpResponse.getEntity();
if (httpEntity != null) {
responseBody = EntityUtils.toString(httpEntity, StandardCharsets.UTF_8);
if (httpEntity == null) {
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_HTTP_ENTITY_IS_NULL, "httpEntity is null, sql: " + data);
}
responseBody = EntityUtils.toString(httpEntity, StandardCharsets.UTF_8);
} catch (ClientProtocolException e) {
e.printStackTrace();
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_RESTFul_Client_Protocol_Exception, e.getMessage());
......@@ -139,9 +131,6 @@ public class HttpClientPoolUtil {
private static HttpRequestBase getRequest(String uri, String methodName) {
HttpRequestBase method;
RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(DEFAULT_TIME_OUT * 1000)
.setConnectTimeout(DEFAULT_TIME_OUT * 1000)
.setConnectionRequestTimeout(DEFAULT_TIME_OUT * 1000)
.setExpectContinueEnabled(false)
.build();
if (HttpPut.METHOD_NAME.equalsIgnoreCase(methodName)) {
......
package com.taosdata.jdbc.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.taosdata.jdbc.TSDBDriver;
import com.taosdata.jdbc.TSDBError;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class HttpClientPoolUtilTest {
String user = "root";
String password = "taosdata";
String host = "127.0.0.1";
String dbname = "log";
@Test
public void test() {
// given
List<Thread> threads = IntStream.range(0, 4000).mapToObj(i -> new Thread(() -> {
useDB();
// try {
// TimeUnit.SECONDS.sleep(10);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
})).collect(Collectors.toList());
threads.forEach(Thread::start);
for (Thread thread : threads) {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void useDB() {
try {
user = URLEncoder.encode(user, StandardCharsets.UTF_8.displayName());
password = URLEncoder.encode(password, StandardCharsets.UTF_8.displayName());
String loginUrl = "http://" + host + ":" + 6041 + "/rest/login/" + user + "/" + password + "";
String result = HttpClientPoolUtil.execute(loginUrl);
JSONObject jsonResult = JSON.parseObject(result);
String status = jsonResult.getString("status");
String token = jsonResult.getString("desc");
if (!status.equals("succ")) {
throw new SQLException(jsonResult.getString("desc"));
}
String url = "http://" + host + ":6041/rest/sql";
String sql = "use " + dbname;
result = HttpClientPoolUtil.execute(url, sql, token);
JSONObject resultJson = JSON.parseObject(result);
if (resultJson.getString("status").equals("error")) {
throw TSDBError.createSQLException(resultJson.getInteger("code"), resultJson.getString("desc"));
}
} catch (UnsupportedEncodingException | SQLException e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
......@@ -211,6 +211,7 @@
#define TK_INSERT 193
#define TK_INTO 194
#define TK_VALUES 195
#define TK_FILE 196
#define TK_SPACE 300
......@@ -219,7 +220,6 @@
#define TK_HEX 303 // hex number 0x123
#define TK_OCT 304 // oct number
#define TK_BIN 305 // bin format data 0b111
#define TK_FILE 306
#define TK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query
#endif
......
......@@ -65,6 +65,8 @@ static void taosGetSystemTimezone() {
struct tm tm1;
localtime_r(&tx1, &tm1);
tsDaylight = daylight;
/*
* format example:
*
......
......@@ -213,6 +213,8 @@ static void taosGetSystemTimezone() {
int32_t tz = (-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR;
tz += daylight;
tsDaylight = daylight;
/*
* format example:
*
......
......@@ -91,6 +91,17 @@ static void taosGetSystemTimezone() {
strcpy(tsTimezone, tz);
}
cfg_timezone->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
#ifdef _MSC_VER
#if _MSC_VER >= 1900
int64_t timezone = _timezone;
int32_t daylight = _daylight;
char **tzname = _tzname;
#endif
#endif
tsDaylight = daylight;
uInfo("timezone not configured, use default");
}
}
......
......@@ -140,28 +140,29 @@ typedef enum {
} EHTTP_CONTEXT_FAILED_CAUSE;
typedef struct HttpContext {
int32_t refCount;
SOCKET fd;
uint32_t accessTimes;
uint32_t lastAccessTime;
int32_t state;
uint8_t reqType;
uint8_t parsed;
uint8_t error;
char ipstr[22];
char user[TSDB_USER_LEN]; // parsed from auth token or login message
char pass[HTTP_PASSWORD_LEN];
char db[/*TSDB_ACCT_ID_LEN + */TSDB_DB_NAME_LEN];
TAOS * taos;
void * ppContext;
HttpSession *session;
z_stream gzipStream;
HttpParser *parser;
HttpSqlCmd singleCmd;
HttpSqlCmds *multiCmds;
JsonBuf * jsonBuf;
HttpEncodeMethod *encodeMethod;
HttpDecodeMethod *decodeMethod;
int32_t refCount;
SOCKET fd;
uint32_t accessTimes;
uint32_t lastAccessTime;
int32_t state;
uint8_t reqType;
uint8_t parsed;
uint8_t error;
char ipstr[22];
char user[TSDB_USER_LEN]; // parsed from auth token or login message
char pass[HTTP_PASSWORD_LEN];
char db[/*TSDB_ACCT_ID_LEN + */TSDB_DB_NAME_LEN];
TAOS * taos;
void * ppContext;
pthread_mutex_t ctxMutex;
HttpSession *session;
z_stream gzipStream;
HttpParser *parser;
HttpSqlCmd singleCmd;
HttpSqlCmds *multiCmds;
JsonBuf *jsonBuf;
HttpEncodeMethod *encodeMethod;
HttpDecodeMethod *decodeMethod;
struct HttpThread *pThread;
} HttpContext;
......
......@@ -67,6 +67,8 @@ static void httpDestroyContext(void *data) {
pContext->parser = NULL;
}
pthread_mutex_destroy(&pContext->ctxMutex);
tfree(pContext);
}
......@@ -121,13 +123,15 @@ HttpContext *httpCreateContext(SOCKET fd) {
TSDB_CACHE_PTR_TYPE handleVal = (TSDB_CACHE_PTR_TYPE)pContext;
HttpContext **ppContext = taosCachePut(tsHttpServer.contextCache, &handleVal, sizeof(TSDB_CACHE_PTR_TYPE), &pContext,
sizeof(TSDB_CACHE_PTR_TYPE), 3000);
sizeof(TSDB_CACHE_PTR_TYPE), tsHttpKeepAlive);
pContext->ppContext = ppContext;
httpDebug("context:%p, fd:%d, is created, data:%p", pContext, fd, ppContext);
// set the ref to 0
taosCacheRelease(tsHttpServer.contextCache, (void **)&ppContext, false);
pthread_mutex_init(&pContext->ctxMutex, NULL);
return pContext;
}
......
......@@ -45,15 +45,14 @@ bool httpProcessData(HttpContext* pContext) {
httpTrace("context:%p, fd:%d, process options request", pContext, pContext->fd);
httpSendOptionResp(pContext, "process options request success");
} else {
if (!httpDecodeRequest(pContext)) {
/*
* httpCloseContextByApp has been called when parsing the error
*/
// httpCloseContextByApp(pContext);
} else {
pthread_mutex_lock(&pContext->ctxMutex);
if (httpDecodeRequest(pContext)) {
httpClearParser(pContext->parser);
httpProcessRequest(pContext);
}
pthread_mutex_unlock(&pContext->ctxMutex);
}
return true;
......
......@@ -406,7 +406,14 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int32_t code) {
if (pContext->session == NULL) {
httpSendErrorResp(pContext, TSDB_CODE_HTTP_SESSION_FULL);
} else {
// httpProcessRequestCb called by another thread and a subsequent thread calls this
// function again, if this function called by httpProcessRequestCb executes memset
// just before the subsequent thread executes *Cmd function, nativSql will be NULL
pthread_mutex_lock(&pContext->ctxMutex);
httpExecCmd(pContext);
pthread_mutex_unlock(&pContext->ctxMutex);
}
}
......
......@@ -43,6 +43,8 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
#define GET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:((_r)->outputBuf)->info.rows)
#define RESET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:(((_r)->outputBuf)->info.rows = 0))
enum {
// when query starts to execute, this status will set
QUERY_NOT_COMPLETED = 0x1u,
......@@ -389,6 +391,7 @@ typedef struct SQInfo {
int32_t dataReady; // denote if query result is ready or not
void* rspContext; // response context
int64_t startExecTs; // start to exec timestamp
int64_t lastRetrieveTs; // last retrieve timestamp
char* sql; // query sql string
SQueryCostInfo summary;
} SQInfo;
......
......@@ -913,4 +913,4 @@ cmd ::= KILL QUERY INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); s
%fallback ID ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT COPY DATABASE DEFERRED
DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD
LIKE MATCH KEY OF OFFSET RAISE REPLACE RESTRICT ROW STATEMENT TRIGGER VIEW ALL
NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES.
NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES FILE.
......@@ -758,7 +758,7 @@ static int32_t lastDistFuncRequired(SQLFunctionCtx *pCtx, STimeWindow* w, int32_
if (pInfo->hasResult != DATA_SET_FLAG) {
return BLK_DATA_ALL_NEEDED;
} else {
return (pInfo->ts > w->ekey) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED;
return (pInfo->ts >= w->ekey) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED;
}
}
......
......@@ -2430,11 +2430,11 @@ bool isQueryKilled(SQInfo *pQInfo) {
// query has been executed more than tsShellActivityTimer, and the retrieve has not arrived
// abort current query execution.
if (pQInfo->owner != 0 && ((taosGetTimestampSec() - pQInfo->startExecTs) > getMaximumIdleDurationSec()) &&
if (pQInfo->owner != 0 && ((taosGetTimestampSec() - pQInfo->lastRetrieveTs/1000) > getMaximumIdleDurationSec()) &&
(!needBuildResAfterQueryComplete(pQInfo))) {
assert(pQInfo->startExecTs != 0);
qDebug("QInfo:%" PRIu64 " retrieve not arrive beyond %d sec, abort current query execution, start:%" PRId64
qDebug("QInfo:%" PRIu64 " retrieve not arrive beyond %d ms, abort current query execution, start:%" PRId64
", current:%d", pQInfo->qId, 1, pQInfo->startExecTs, taosGetTimestampSec());
return true;
}
......
......@@ -213,7 +213,10 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
}
*qId = pQInfo->qId;
pQInfo->startExecTs = taosGetTimestampSec();
if(pQInfo->startExecTs == 0) {
pQInfo->startExecTs = taosGetTimestampMs();
pQInfo->lastRetrieveTs = pQInfo->startExecTs;
}
if (isQueryKilled(pQInfo)) {
qDebug("QInfo:0x%"PRIx64" it is already killed, abort", pQInfo->qId);
......
......@@ -100,29 +100,29 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
#define YYNOCODE 277
#define YYNOCODE 278
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SStrToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
SCreateTableSql* yy56;
int yy70;
SCreatedTableInfo yy84;
SRelationInfo* yy114;
int32_t yy202;
SIntervalVal yy222;
SSqlNode* yy224;
SCreateDbInfo yy246;
tSqlExpr* yy260;
TAOS_FIELD yy363;
SSessionWindowVal yy365;
SCreateAcctInfo yy377;
int64_t yy387;
SArray* yy403;
SLimitVal yy404;
tVariant yy488;
SWindowStateVal yy544;
SRelationInfo* yy8;
SWindowStateVal yy40;
SSqlNode* yy56;
SCreateDbInfo yy90;
int yy96;
int32_t yy104;
SSessionWindowVal yy147;
SCreatedTableInfo yy152;
SLimitVal yy166;
SCreateAcctInfo yy171;
TAOS_FIELD yy183;
int64_t yy325;
SIntervalVal yy400;
SArray* yy421;
tVariant yy430;
SCreateTableSql* yy438;
tSqlExpr* yy439;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
......@@ -140,7 +140,7 @@ typedef union {
#define YYFALLBACK 1
#define YYNSTATE 363
#define YYNRULE 291
#define YYNTOKEN 196
#define YYNTOKEN 197
#define YY_MAX_SHIFT 362
#define YY_MIN_SHIFTREDUCE 571
#define YY_MAX_SHIFTREDUCE 861
......@@ -230,167 +230,167 @@ static const YYACTIONTYPE yy_action[] = {
/* 100 */ 51, 1014, 60, 318, 65, 63, 66, 64, 1131, 1081,
/* 110 */ 271, 290, 56, 55, 316, 1080, 54, 53, 52, 57,
/* 120 */ 59, 243, 61, 62, 1008, 1020, 249, 51, 95, 60,
/* 130 */ 318, 65, 63, 66, 64, 45, 800, 23, 1033, 56,
/* 140 */ 55, 160, 348, 54, 53, 52, 58, 242, 61, 62,
/* 130 */ 318, 65, 63, 66, 64, 45, 800, 348, 1033, 56,
/* 140 */ 55, 160, 1019, 54, 53, 52, 58, 242, 61, 62,
/* 150 */ 765, 766, 249, 51, 233, 60, 318, 65, 63, 66,
/* 160 */ 64, 1003, 1004, 35, 1007, 56, 55, 316, 245, 54,
/* 170 */ 53, 52, 44, 314, 355, 354, 313, 312, 311, 353,
/* 180 */ 310, 309, 308, 352, 307, 351, 350, 982, 970, 971,
/* 190 */ 972, 973, 974, 975, 976, 977, 978, 979, 980, 981,
/* 200 */ 983, 984, 61, 62, 24, 204, 249, 51, 263, 60,
/* 210 */ 318, 65, 63, 66, 64, 92, 74, 267, 266, 56,
/* 220 */ 55, 258, 210, 54, 53, 52, 248, 815, 207, 216,
/* 230 */ 804, 174, 807, 123, 810, 137, 136, 135, 215, 1132,
/* 240 */ 248, 815, 323, 86, 804, 348, 807, 160, 810, 250,
/* 250 */ 913, 205, 65, 63, 66, 64, 75, 188, 227, 228,
/* 260 */ 56, 55, 319, 923, 54, 53, 52, 5, 41, 178,
/* 200 */ 983, 984, 61, 62, 24, 23, 249, 51, 263, 60,
/* 210 */ 318, 65, 63, 66, 64, 92, 79, 267, 266, 56,
/* 220 */ 55, 123, 210, 54, 53, 52, 248, 815, 207, 216,
/* 230 */ 804, 93, 807, 348, 810, 137, 136, 135, 215, 1132,
/* 240 */ 248, 815, 323, 86, 804, 81, 807, 258, 810, 250,
/* 250 */ 1005, 204, 65, 63, 66, 64, 160, 174, 227, 228,
/* 260 */ 56, 55, 319, 913, 54, 53, 52, 5, 41, 178,
/* 270 */ 188, 622, 227, 228, 177, 104, 109, 100, 108, 623,
/* 280 */ 45, 730, 356, 951, 727, 38, 728, 38, 729, 121,
/* 290 */ 115, 126, 252, 303, 38, 806, 125, 809, 131, 134,
/* 300 */ 124, 805, 270, 808, 78, 257, 38, 128, 67, 207,
/* 310 */ 211, 223, 254, 255, 3, 189, 198, 196, 194, 292,
/* 320 */ 1132, 91, 67, 193, 141, 140, 139, 138, 1128, 239,
/* 330 */ 38, 240, 38, 1017, 44, 1017, 355, 354, 327, 258,
/* 340 */ 38, 353, 1017, 816, 811, 352, 38, 351, 350, 175,
/* 350 */ 812, 746, 38, 29, 1016, 38, 743, 816, 811, 1127,
/* 360 */ 38, 56, 55, 706, 812, 54, 53, 52, 253, 258,
/* 370 */ 251, 14, 326, 325, 328, 94, 329, 782, 1017, 1018,
/* 380 */ 1017, 259, 9, 256, 330, 333, 332, 272, 1017, 79,
/* 390 */ 334, 338, 337, 93, 1017, 914, 335, 731, 732, 336,
/* 400 */ 1017, 39, 188, 1017, 340, 97, 83, 81, 1017, 54,
/* 410 */ 53, 52, 359, 358, 599, 813, 151, 149, 148, 1,
/* 420 */ 176, 814, 84, 1005, 762, 772, 773, 716, 71, 802,
/* 430 */ 247, 295, 718, 297, 781, 717, 836, 750, 155, 68,
/* 440 */ 26, 39, 34, 274, 320, 39, 68, 96, 817, 68,
/* 450 */ 25, 16, 6, 15, 621, 114, 18, 113, 17, 274,
/* 460 */ 77, 735, 25, 736, 733, 803, 734, 20, 25, 19,
/* 470 */ 72, 120, 22, 119, 21, 298, 133, 132, 1126, 225,
/* 480 */ 226, 208, 209, 212, 206, 213, 214, 218, 1019, 219,
/* 490 */ 1151, 1143, 705, 220, 217, 203, 268, 1091, 1090, 237,
/* 500 */ 1087, 1086, 238, 339, 170, 152, 1041, 1052, 48, 150,
/* 510 */ 1049, 1050, 1034, 275, 1054, 154, 159, 286, 1015, 1073,
/* 520 */ 1072, 279, 171, 1013, 234, 281, 172, 163, 173, 1031,
/* 530 */ 928, 300, 301, 302, 305, 306, 46, 761, 201, 162,
/* 540 */ 283, 161, 293, 42, 317, 165, 76, 819, 291, 922,
/* 550 */ 73, 50, 164, 324, 1150, 111, 1149, 289, 285, 1146,
/* 560 */ 179, 331, 1142, 287, 117, 1141, 1138, 180, 166, 282,
/* 570 */ 948, 33, 43, 40, 47, 202, 49, 910, 127, 908,
/* 580 */ 129, 130, 906, 905, 260, 191, 192, 902, 901, 900,
/* 590 */ 899, 898, 897, 896, 195, 197, 304, 892, 890, 888,
/* 600 */ 199, 885, 200, 349, 273, 82, 87, 284, 1074, 122,
/* 610 */ 341, 342, 343, 344, 345, 346, 347, 224, 244, 299,
/* 620 */ 357, 861, 261, 262, 221, 222, 860, 264, 265, 105,
/* 630 */ 927, 926, 106, 859, 842, 269, 841, 274, 294, 10,
/* 640 */ 276, 738, 85, 88, 904, 903, 30, 142, 187, 182,
/* 650 */ 949, 181, 183, 184, 185, 143, 186, 895, 894, 986,
/* 660 */ 2, 144, 145, 887, 950, 886, 4, 763, 167, 168,
/* 670 */ 156, 158, 774, 157, 236, 768, 89, 31, 770, 996,
/* 680 */ 90, 288, 11, 32, 12, 13, 27, 296, 28, 97,
/* 290 */ 115, 126, 252, 303, 38, 16, 125, 15, 131, 134,
/* 300 */ 124, 205, 270, 38, 78, 257, 782, 128, 67, 207,
/* 310 */ 746, 223, 254, 255, 3, 189, 198, 196, 194, 806,
/* 320 */ 1132, 809, 67, 193, 141, 140, 139, 138, 292, 239,
/* 330 */ 91, 240, 923, 1017, 44, 1017, 355, 354, 327, 188,
/* 340 */ 38, 353, 1017, 816, 811, 352, 38, 351, 350, 706,
/* 350 */ 812, 1016, 805, 29, 808, 211, 38, 816, 811, 38,
/* 360 */ 1091, 56, 55, 781, 812, 54, 53, 52, 253, 38,
/* 370 */ 251, 38, 326, 325, 38, 14, 1128, 338, 337, 94,
/* 380 */ 914, 259, 743, 256, 328, 333, 332, 188, 1017, 258,
/* 390 */ 329, 54, 53, 52, 1017, 258, 750, 731, 732, 175,
/* 400 */ 330, 1, 176, 334, 1017, 1018, 272, 1017, 9, 97,
/* 410 */ 83, 84, 34, 335, 71, 336, 762, 1017, 340, 1017,
/* 420 */ 39, 772, 1017, 359, 358, 599, 151, 149, 148, 773,
/* 430 */ 155, 74, 716, 802, 320, 68, 295, 718, 77, 813,
/* 440 */ 247, 133, 132, 26, 297, 298, 39, 274, 274, 717,
/* 450 */ 39, 68, 836, 817, 621, 114, 72, 113, 96, 18,
/* 460 */ 1127, 17, 6, 68, 1126, 225, 25, 25, 25, 803,
/* 470 */ 705, 75, 814, 735, 733, 736, 734, 20, 226, 19,
/* 480 */ 120, 22, 119, 21, 208, 209, 212, 206, 213, 1151,
/* 490 */ 214, 1143, 1034, 1090, 218, 237, 219, 220, 217, 203,
/* 500 */ 1087, 1086, 238, 339, 268, 152, 1041, 1052, 48, 1073,
/* 510 */ 1049, 1050, 275, 1072, 1015, 1054, 150, 154, 159, 286,
/* 520 */ 170, 171, 279, 1013, 172, 173, 162, 234, 281, 283,
/* 530 */ 928, 163, 165, 1031, 761, 161, 300, 819, 301, 302,
/* 540 */ 305, 306, 46, 201, 293, 164, 42, 289, 291, 317,
/* 550 */ 922, 324, 76, 73, 50, 287, 1150, 166, 111, 1149,
/* 560 */ 282, 1146, 285, 167, 179, 49, 331, 1142, 304, 122,
/* 570 */ 349, 117, 1141, 1138, 180, 948, 43, 40, 47, 341,
/* 580 */ 202, 910, 127, 908, 129, 130, 906, 905, 260, 191,
/* 590 */ 192, 902, 901, 900, 899, 898, 897, 896, 195, 197,
/* 600 */ 892, 890, 888, 199, 885, 200, 342, 273, 82, 87,
/* 610 */ 343, 284, 1074, 344, 345, 346, 347, 357, 861, 261,
/* 620 */ 262, 860, 224, 244, 299, 264, 265, 859, 842, 841,
/* 630 */ 269, 274, 221, 10, 85, 294, 927, 105, 926, 222,
/* 640 */ 106, 738, 276, 30, 88, 763, 904, 156, 903, 774,
/* 650 */ 142, 143, 895, 183, 182, 949, 181, 184, 185, 187,
/* 660 */ 186, 144, 894, 887, 950, 145, 986, 886, 2, 157,
/* 670 */ 168, 768, 33, 4, 158, 89, 236, 770, 90, 996,
/* 680 */ 288, 31, 11, 32, 12, 13, 27, 296, 28, 97,
/* 690 */ 99, 102, 36, 101, 636, 37, 103, 671, 669, 668,
/* 700 */ 667, 665, 664, 663, 660, 626, 315, 7, 107, 818,
/* 710 */ 820, 321, 322, 8, 110, 112, 69, 70, 116, 708,
/* 720 */ 39, 707, 118, 704, 652, 650, 642, 648, 644, 646,
/* 700 */ 667, 665, 664, 663, 660, 626, 315, 107, 7, 820,
/* 710 */ 818, 321, 8, 322, 110, 112, 69, 70, 116, 708,
/* 720 */ 707, 39, 118, 704, 652, 650, 642, 648, 644, 646,
/* 730 */ 640, 638, 674, 673, 672, 670, 666, 662, 661, 190,
/* 740 */ 624, 589, 587, 865, 864, 864, 864, 864, 864, 864,
/* 740 */ 589, 624, 587, 865, 864, 864, 864, 864, 864, 864,
/* 750 */ 864, 864, 864, 864, 864, 146, 147,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 252, 1, 244, 1, 198, 199, 248, 199, 244, 9,
/* 10 */ 205, 9, 248, 13, 14, 199, 16, 17, 270, 199,
/* 20 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 222,
/* 30 */ 9, 224, 225, 33, 34, 199, 229, 37, 38, 39,
/* 40 */ 233, 199, 235, 236, 196, 197, 246, 45, 46, 47,
/* 0 */ 253, 1, 245, 1, 199, 200, 249, 200, 245, 9,
/* 10 */ 206, 9, 249, 13, 14, 200, 16, 17, 271, 200,
/* 20 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 223,
/* 30 */ 9, 225, 226, 33, 34, 200, 230, 37, 38, 39,
/* 40 */ 234, 200, 236, 237, 197, 198, 247, 45, 46, 47,
/* 50 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
/* 60 */ 58, 59, 262, 243, 62, 13, 14, 247, 16, 17,
/* 70 */ 265, 5, 20, 21, 266, 23, 24, 25, 26, 27,
/* 80 */ 28, 276, 0, 267, 268, 33, 34, 87, 206, 37,
/* 90 */ 38, 39, 13, 14, 246, 16, 17, 265, 83, 20,
/* 100 */ 21, 199, 23, 24, 25, 26, 27, 28, 276, 273,
/* 110 */ 262, 275, 33, 34, 85, 273, 37, 38, 39, 13,
/* 120 */ 14, 244, 16, 17, 242, 248, 20, 21, 206, 23,
/* 130 */ 24, 25, 26, 27, 28, 120, 84, 265, 246, 33,
/* 140 */ 34, 199, 91, 37, 38, 39, 14, 245, 16, 17,
/* 150 */ 126, 127, 20, 21, 262, 23, 24, 25, 26, 27,
/* 160 */ 28, 239, 240, 241, 242, 33, 34, 85, 205, 37,
/* 60 */ 58, 59, 263, 244, 62, 13, 14, 248, 16, 17,
/* 70 */ 266, 5, 20, 21, 267, 23, 24, 25, 26, 27,
/* 80 */ 28, 277, 0, 268, 269, 33, 34, 87, 207, 37,
/* 90 */ 38, 39, 13, 14, 247, 16, 17, 266, 83, 20,
/* 100 */ 21, 200, 23, 24, 25, 26, 27, 28, 277, 274,
/* 110 */ 263, 276, 33, 34, 85, 274, 37, 38, 39, 13,
/* 120 */ 14, 245, 16, 17, 243, 249, 20, 21, 207, 23,
/* 130 */ 24, 25, 26, 27, 28, 120, 84, 91, 247, 33,
/* 140 */ 34, 200, 249, 37, 38, 39, 14, 246, 16, 17,
/* 150 */ 126, 127, 20, 21, 263, 23, 24, 25, 26, 27,
/* 160 */ 28, 240, 241, 242, 243, 33, 34, 85, 206, 37,
/* 170 */ 38, 39, 99, 100, 101, 102, 103, 104, 105, 106,
/* 180 */ 107, 108, 109, 110, 111, 112, 113, 222, 223, 224,
/* 190 */ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
/* 200 */ 235, 236, 16, 17, 44, 265, 20, 21, 143, 23,
/* 210 */ 24, 25, 26, 27, 28, 273, 98, 152, 153, 33,
/* 220 */ 34, 199, 62, 37, 38, 39, 1, 2, 265, 69,
/* 230 */ 5, 209, 7, 79, 9, 75, 76, 77, 78, 276,
/* 240 */ 1, 2, 82, 83, 5, 91, 7, 199, 9, 205,
/* 250 */ 204, 265, 25, 26, 27, 28, 138, 211, 33, 34,
/* 260 */ 33, 34, 37, 204, 37, 38, 39, 63, 64, 65,
/* 270 */ 211, 1, 33, 34, 70, 71, 72, 73, 74, 9,
/* 280 */ 120, 2, 220, 221, 5, 199, 7, 199, 9, 63,
/* 290 */ 64, 65, 69, 89, 199, 5, 70, 7, 72, 73,
/* 300 */ 74, 5, 142, 7, 144, 69, 199, 81, 83, 265,
/* 310 */ 265, 151, 33, 34, 202, 203, 63, 64, 65, 271,
/* 320 */ 276, 273, 83, 70, 71, 72, 73, 74, 265, 243,
/* 330 */ 199, 243, 199, 247, 99, 247, 101, 102, 243, 199,
/* 340 */ 199, 106, 247, 118, 119, 110, 199, 112, 113, 209,
/* 350 */ 125, 37, 199, 83, 247, 199, 98, 118, 119, 265,
/* 360 */ 199, 33, 34, 5, 125, 37, 38, 39, 145, 199,
/* 370 */ 147, 83, 149, 150, 243, 87, 243, 77, 247, 209,
/* 380 */ 247, 145, 124, 147, 243, 149, 150, 84, 247, 206,
/* 390 */ 243, 33, 34, 249, 247, 204, 243, 118, 119, 243,
/* 400 */ 247, 98, 211, 247, 243, 117, 84, 263, 247, 37,
/* 410 */ 38, 39, 66, 67, 68, 125, 63, 64, 65, 207,
/* 420 */ 208, 125, 84, 240, 84, 84, 84, 84, 98, 1,
/* 430 */ 61, 84, 84, 84, 134, 84, 84, 123, 98, 98,
/* 440 */ 98, 98, 83, 121, 15, 98, 98, 98, 84, 98,
/* 450 */ 98, 146, 83, 148, 84, 146, 146, 148, 148, 121,
/* 460 */ 83, 5, 98, 7, 5, 37, 7, 146, 98, 148,
/* 470 */ 140, 146, 146, 148, 148, 116, 79, 80, 265, 265,
/* 480 */ 265, 265, 265, 265, 265, 265, 265, 265, 248, 265,
/* 490 */ 248, 248, 115, 265, 265, 265, 199, 238, 238, 238,
/* 500 */ 238, 238, 238, 238, 250, 199, 199, 199, 264, 61,
/* 510 */ 199, 199, 246, 246, 199, 199, 199, 199, 246, 274,
/* 520 */ 274, 269, 199, 199, 269, 269, 199, 258, 199, 261,
/* 530 */ 199, 199, 199, 199, 199, 199, 199, 125, 199, 259,
/* 540 */ 269, 260, 132, 199, 199, 256, 137, 118, 135, 199,
/* 550 */ 139, 136, 257, 199, 199, 199, 199, 130, 128, 199,
/* 560 */ 199, 199, 199, 129, 199, 199, 199, 199, 255, 131,
/* 570 */ 199, 251, 199, 199, 199, 199, 141, 199, 199, 199,
/* 580 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
/* 590 */ 199, 199, 199, 199, 199, 199, 90, 199, 199, 199,
/* 600 */ 199, 199, 199, 114, 200, 200, 200, 200, 200, 97,
/* 610 */ 96, 51, 93, 95, 55, 94, 92, 200, 200, 200,
/* 620 */ 85, 5, 154, 5, 200, 200, 5, 154, 5, 206,
/* 630 */ 210, 210, 206, 5, 101, 143, 100, 121, 116, 83,
/* 640 */ 98, 84, 122, 98, 200, 200, 83, 201, 212, 217,
/* 650 */ 219, 218, 213, 216, 214, 201, 215, 200, 200, 237,
/* 660 */ 207, 201, 201, 200, 221, 200, 202, 84, 254, 253,
/* 670 */ 83, 98, 84, 83, 1, 84, 83, 98, 84, 237,
/* 680 */ 83, 83, 133, 98, 133, 83, 83, 116, 83, 117,
/* 180 */ 107, 108, 109, 110, 111, 112, 113, 223, 224, 225,
/* 190 */ 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
/* 200 */ 236, 237, 16, 17, 44, 266, 20, 21, 143, 23,
/* 210 */ 24, 25, 26, 27, 28, 274, 207, 152, 153, 33,
/* 220 */ 34, 79, 62, 37, 38, 39, 1, 2, 266, 69,
/* 230 */ 5, 250, 7, 91, 9, 75, 76, 77, 78, 277,
/* 240 */ 1, 2, 82, 83, 5, 264, 7, 200, 9, 206,
/* 250 */ 241, 266, 25, 26, 27, 28, 200, 210, 33, 34,
/* 260 */ 33, 34, 37, 205, 37, 38, 39, 63, 64, 65,
/* 270 */ 212, 1, 33, 34, 70, 71, 72, 73, 74, 9,
/* 280 */ 120, 2, 221, 222, 5, 200, 7, 200, 9, 63,
/* 290 */ 64, 65, 69, 89, 200, 146, 70, 148, 72, 73,
/* 300 */ 74, 266, 142, 200, 144, 69, 77, 81, 83, 266,
/* 310 */ 37, 151, 33, 34, 203, 204, 63, 64, 65, 5,
/* 320 */ 277, 7, 83, 70, 71, 72, 73, 74, 272, 244,
/* 330 */ 274, 244, 205, 248, 99, 248, 101, 102, 244, 212,
/* 340 */ 200, 106, 248, 118, 119, 110, 200, 112, 113, 5,
/* 350 */ 125, 248, 5, 83, 7, 266, 200, 118, 119, 200,
/* 360 */ 239, 33, 34, 134, 125, 37, 38, 39, 145, 200,
/* 370 */ 147, 200, 149, 150, 200, 83, 266, 33, 34, 87,
/* 380 */ 205, 145, 98, 147, 244, 149, 150, 212, 248, 200,
/* 390 */ 244, 37, 38, 39, 248, 200, 123, 118, 119, 210,
/* 400 */ 244, 208, 209, 244, 248, 210, 84, 248, 124, 117,
/* 410 */ 84, 84, 83, 244, 98, 244, 84, 248, 244, 248,
/* 420 */ 98, 84, 248, 66, 67, 68, 63, 64, 65, 84,
/* 430 */ 98, 98, 84, 1, 15, 98, 84, 84, 83, 125,
/* 440 */ 61, 79, 80, 98, 84, 116, 98, 121, 121, 84,
/* 450 */ 98, 98, 84, 84, 84, 146, 140, 148, 98, 146,
/* 460 */ 266, 148, 83, 98, 266, 266, 98, 98, 98, 37,
/* 470 */ 115, 138, 125, 5, 5, 7, 7, 146, 266, 148,
/* 480 */ 146, 146, 148, 148, 266, 266, 266, 266, 266, 249,
/* 490 */ 266, 249, 247, 239, 266, 239, 266, 266, 266, 266,
/* 500 */ 239, 239, 239, 239, 200, 200, 200, 200, 265, 275,
/* 510 */ 200, 200, 247, 275, 247, 200, 61, 200, 200, 200,
/* 520 */ 251, 200, 270, 200, 200, 200, 260, 270, 270, 270,
/* 530 */ 200, 259, 257, 262, 125, 261, 200, 118, 200, 200,
/* 540 */ 200, 200, 200, 200, 132, 258, 200, 130, 135, 200,
/* 550 */ 200, 200, 137, 139, 136, 129, 200, 256, 200, 200,
/* 560 */ 131, 200, 128, 255, 200, 141, 200, 200, 90, 97,
/* 570 */ 114, 200, 200, 200, 200, 200, 200, 200, 200, 96,
/* 580 */ 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
/* 590 */ 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
/* 600 */ 200, 200, 200, 200, 200, 200, 51, 201, 201, 201,
/* 610 */ 93, 201, 201, 95, 55, 94, 92, 85, 5, 154,
/* 620 */ 5, 5, 201, 201, 201, 154, 5, 5, 101, 100,
/* 630 */ 143, 121, 201, 83, 122, 116, 211, 207, 211, 201,
/* 640 */ 207, 84, 98, 83, 98, 84, 201, 83, 201, 84,
/* 650 */ 202, 202, 201, 214, 218, 220, 219, 217, 215, 213,
/* 660 */ 216, 202, 201, 201, 222, 202, 238, 201, 208, 83,
/* 670 */ 254, 84, 252, 203, 98, 83, 1, 84, 83, 238,
/* 680 */ 83, 98, 133, 98, 133, 83, 83, 116, 83, 117,
/* 690 */ 79, 71, 88, 87, 5, 88, 87, 9, 5, 5,
/* 700 */ 5, 5, 5, 5, 5, 86, 15, 83, 79, 84,
/* 710 */ 118, 24, 59, 83, 148, 148, 16, 16, 148, 5,
/* 720 */ 98, 5, 148, 84, 5, 5, 5, 5, 5, 5,
/* 700 */ 5, 5, 5, 5, 5, 86, 15, 79, 83, 118,
/* 710 */ 84, 24, 83, 59, 148, 148, 16, 16, 148, 5,
/* 720 */ 5, 98, 148, 84, 5, 5, 5, 5, 5, 5,
/* 730 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 98,
/* 740 */ 86, 61, 60, 0, 277, 277, 277, 277, 277, 277,
/* 750 */ 277, 277, 277, 277, 277, 21, 21, 277, 277, 277,
/* 760 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 770 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 780 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 790 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 800 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 810 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 820 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 830 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 840 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 850 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 860 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 870 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 880 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 890 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 900 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 910 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 920 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 930 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 940 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
/* 950 */ 277, 277, 277,
/* 740 */ 61, 86, 60, 0, 278, 278, 278, 278, 278, 278,
/* 750 */ 278, 278, 278, 278, 278, 21, 21, 278, 278, 278,
/* 760 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 770 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 780 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 790 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 800 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 810 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 820 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 830 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 840 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 850 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 860 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 870 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 880 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 890 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 900 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 910 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 920 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 930 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 940 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 950 */ 278, 278, 278, 278,
};
#define YY_SHIFT_COUNT (362)
#define YY_SHIFT_MIN (0)
......@@ -400,65 +400,65 @@ static const unsigned short int yy_shift_ofst[] = {
/* 10 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 20 */ 21, 21, 21, 0, 2, 239, 279, 279, 279, 15,
/* 30 */ 15, 21, 21, 24, 21, 82, 21, 21, 21, 21,
/* 40 */ 154, 29, 51, 51, 66, 757, 757, 757, 239, 239,
/* 40 */ 142, 29, 46, 46, 66, 757, 757, 757, 239, 239,
/* 50 */ 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
/* 60 */ 239, 239, 239, 239, 239, 239, 239, 239, 279, 279,
/* 70 */ 279, 358, 358, 358, 358, 358, 358, 358, 21, 21,
/* 80 */ 21, 314, 21, 21, 21, 15, 15, 21, 21, 21,
/* 90 */ 21, 300, 300, 258, 15, 21, 21, 21, 21, 21,
/* 70 */ 279, 344, 344, 344, 344, 344, 344, 344, 21, 21,
/* 80 */ 21, 273, 21, 21, 21, 15, 15, 21, 21, 21,
/* 90 */ 21, 229, 229, 284, 15, 21, 21, 21, 21, 21,
/* 100 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 110 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 120 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 130 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 140 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 150 */ 21, 21, 448, 448, 448, 412, 412, 412, 412, 448,
/* 160 */ 448, 409, 411, 410, 415, 413, 427, 434, 430, 438,
/* 170 */ 435, 448, 448, 448, 506, 506, 489, 29, 29, 448,
/* 180 */ 448, 512, 514, 560, 519, 518, 559, 521, 524, 489,
/* 190 */ 66, 448, 448, 535, 535, 448, 535, 448, 535, 448,
/* 200 */ 448, 757, 757, 52, 79, 79, 106, 79, 132, 186,
/* 150 */ 21, 21, 455, 455, 455, 409, 409, 409, 409, 455,
/* 160 */ 455, 415, 414, 412, 418, 413, 417, 426, 434, 429,
/* 170 */ 424, 455, 455, 455, 478, 478, 456, 29, 29, 455,
/* 180 */ 455, 472, 483, 555, 517, 518, 559, 521, 524, 456,
/* 190 */ 66, 455, 455, 532, 532, 455, 532, 455, 532, 455,
/* 200 */ 455, 757, 757, 52, 79, 79, 106, 79, 132, 186,
/* 210 */ 204, 227, 227, 227, 227, 226, 253, 328, 328, 328,
/* 220 */ 328, 223, 236, 65, 288, 372, 372, 290, 296, 346,
/* 230 */ 353, 303, 322, 338, 340, 341, 342, 330, 118, 343,
/* 240 */ 347, 348, 349, 351, 359, 352, 364, 428, 369, 429,
/* 250 */ 370, 305, 309, 310, 456, 459, 321, 325, 377, 326,
/* 260 */ 397, 616, 468, 618, 621, 473, 623, 628, 533, 536,
/* 270 */ 492, 516, 522, 556, 520, 557, 563, 542, 545, 583,
/* 280 */ 587, 588, 590, 591, 573, 593, 594, 597, 673, 598,
/* 290 */ 579, 549, 585, 551, 602, 522, 603, 571, 605, 572,
/* 220 */ 328, 223, 236, 65, 292, 354, 354, 314, 347, 357,
/* 230 */ 363, 322, 326, 327, 332, 337, 345, 316, 333, 348,
/* 240 */ 352, 353, 360, 365, 329, 368, 369, 432, 379, 419,
/* 250 */ 370, 149, 309, 313, 468, 469, 331, 334, 355, 335,
/* 260 */ 362, 613, 465, 615, 616, 471, 621, 622, 527, 529,
/* 270 */ 487, 510, 519, 550, 512, 557, 560, 544, 546, 561,
/* 280 */ 564, 565, 586, 587, 576, 592, 593, 595, 675, 597,
/* 290 */ 583, 549, 585, 551, 602, 519, 603, 571, 605, 572,
/* 300 */ 611, 604, 606, 620, 689, 607, 609, 688, 693, 694,
/* 310 */ 695, 696, 697, 698, 699, 619, 691, 629, 624, 625,
/* 320 */ 592, 630, 687, 653, 700, 566, 567, 622, 622, 622,
/* 330 */ 622, 701, 570, 574, 622, 622, 622, 714, 716, 639,
/* 340 */ 622, 719, 720, 721, 722, 723, 724, 725, 726, 727,
/* 350 */ 728, 729, 730, 731, 732, 733, 641, 654, 734, 735,
/* 360 */ 680, 682, 743,
/* 310 */ 695, 696, 697, 698, 699, 619, 691, 628, 625, 626,
/* 320 */ 591, 629, 687, 654, 700, 566, 567, 623, 623, 623,
/* 330 */ 623, 701, 570, 574, 623, 623, 623, 714, 715, 639,
/* 340 */ 623, 719, 720, 721, 722, 723, 724, 725, 726, 727,
/* 350 */ 728, 729, 730, 731, 732, 733, 641, 655, 734, 735,
/* 360 */ 679, 682, 743,
};
#define YY_REDUCE_COUNT (202)
#define YY_REDUCE_MIN (-252)
#define YY_REDUCE_MAX (465)
#define YY_REDUCE_MIN (-253)
#define YY_REDUCE_MAX (470)
static const short yy_reduce_ofst[] = {
/* 0 */ -152, -35, -35, -193, -193, -78, -195, -37, 44, -184,
/* 10 */ -180, -164, 48, 86, 88, 95, 131, 133, 141, 147,
/* 20 */ 153, 156, 161, -192, -194, -168, -242, -236, -123, -200,
/* 30 */ -108, -158, -58, -252, -98, -118, 22, 140, 170, 107,
/* 40 */ 46, 183, 59, 191, 62, 144, 212, 112, -128, -60,
/* 50 */ -14, 45, 63, 94, 213, 214, 215, 216, 217, 218,
/* 60 */ 219, 220, 221, 222, 224, 228, 229, 230, 240, 242,
/* 70 */ 243, 259, 260, 261, 262, 263, 264, 265, 297, 306,
/* 80 */ 307, 244, 308, 311, 312, 266, 267, 315, 316, 317,
/* 90 */ 318, 245, 246, 254, 272, 323, 324, 327, 329, 331,
/* 100 */ 332, 333, 334, 335, 336, 337, 339, 344, 345, 350,
/* 110 */ 354, 355, 356, 357, 360, 361, 362, 363, 365, 366,
/* 120 */ 367, 368, 371, 373, 374, 375, 376, 378, 379, 380,
/* 130 */ 381, 382, 383, 384, 385, 386, 387, 388, 389, 390,
/* 140 */ 391, 392, 393, 394, 395, 396, 398, 399, 400, 401,
/* 150 */ 402, 403, 404, 405, 406, 252, 255, 256, 271, 407,
/* 160 */ 408, 268, 281, 280, 269, 295, 289, 313, 414, 416,
/* 170 */ 320, 417, 418, 419, 420, 421, 422, 423, 426, 424,
/* 180 */ 425, 431, 433, 432, 439, 437, 440, 441, 436, 442,
/* 190 */ 443, 444, 445, 446, 454, 457, 460, 458, 461, 463,
/* 200 */ 465, 453, 464,
/* 0 */ -153, -36, -36, -194, -194, -79, -196, -38, 43, -185,
/* 10 */ -181, -165, 56, 85, 87, 94, 140, 146, 156, 159,
/* 20 */ 169, 171, 174, -193, -195, -169, -243, -237, -124, -201,
/* 30 */ -109, -159, -59, -253, -99, -119, 47, 189, 195, 103,
/* 40 */ 58, 9, 127, 175, 61, -19, 193, 111, -61, -15,
/* 50 */ 35, 89, 110, 194, 198, 199, 212, 218, 219, 220,
/* 60 */ 221, 222, 224, 228, 230, 231, 232, 233, -107, 240,
/* 70 */ 242, 121, 254, 256, 261, 262, 263, 264, 304, 305,
/* 80 */ 306, 243, 307, 310, 311, 245, 265, 315, 317, 318,
/* 90 */ 319, 234, 238, 269, 267, 321, 323, 324, 325, 330,
/* 100 */ 336, 338, 339, 340, 341, 342, 343, 346, 349, 350,
/* 110 */ 351, 356, 358, 359, 361, 364, 366, 367, 371, 372,
/* 120 */ 373, 374, 375, 376, 377, 378, 380, 381, 382, 383,
/* 130 */ 384, 385, 386, 387, 388, 389, 390, 391, 392, 393,
/* 140 */ 394, 395, 396, 397, 398, 399, 400, 401, 402, 403,
/* 150 */ 404, 405, 406, 407, 408, 252, 257, 258, 259, 410,
/* 160 */ 411, 271, 274, 266, 272, 287, 275, 301, 308, 416,
/* 170 */ 420, 421, 422, 423, 425, 427, 428, 430, 433, 431,
/* 180 */ 438, 435, 437, 436, 439, 440, 443, 444, 446, 441,
/* 190 */ 442, 445, 447, 448, 449, 451, 459, 461, 463, 462,
/* 200 */ 466, 460, 470,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 862, 985, 924, 995, 911, 921, 1134, 1134, 1134, 862,
......@@ -713,6 +713,7 @@ static const YYCODETYPE yyFallback[] = {
1, /* INSERT => ID */
1, /* INTO => ID */
1, /* VALUES => ID */
1, /* FILE => ID */
};
#endif /* YYFALLBACK */
......@@ -996,87 +997,88 @@ static const char *const yyTokenName[] = {
/* 193 */ "INSERT",
/* 194 */ "INTO",
/* 195 */ "VALUES",
/* 196 */ "program",
/* 197 */ "cmd",
/* 198 */ "dbPrefix",
/* 199 */ "ids",
/* 200 */ "cpxName",
/* 201 */ "ifexists",
/* 202 */ "alter_db_optr",
/* 203 */ "alter_topic_optr",
/* 204 */ "acct_optr",
/* 205 */ "exprlist",
/* 206 */ "ifnotexists",
/* 207 */ "db_optr",
/* 208 */ "topic_optr",
/* 209 */ "typename",
/* 210 */ "bufsize",
/* 211 */ "pps",
/* 212 */ "tseries",
/* 213 */ "dbs",
/* 214 */ "streams",
/* 215 */ "storage",
/* 216 */ "qtime",
/* 217 */ "users",
/* 218 */ "conns",
/* 219 */ "state",
/* 220 */ "intitemlist",
/* 221 */ "intitem",
/* 222 */ "keep",
/* 223 */ "cache",
/* 224 */ "replica",
/* 225 */ "quorum",
/* 226 */ "days",
/* 227 */ "minrows",
/* 228 */ "maxrows",
/* 229 */ "blocks",
/* 230 */ "ctime",
/* 231 */ "wal",
/* 232 */ "fsync",
/* 233 */ "comp",
/* 234 */ "prec",
/* 235 */ "update",
/* 236 */ "cachelast",
/* 237 */ "partitions",
/* 238 */ "signed",
/* 239 */ "create_table_args",
/* 240 */ "create_stable_args",
/* 241 */ "create_table_list",
/* 242 */ "create_from_stable",
/* 243 */ "columnlist",
/* 244 */ "tagitemlist",
/* 245 */ "tagNamelist",
/* 246 */ "select",
/* 247 */ "column",
/* 248 */ "tagitem",
/* 249 */ "selcollist",
/* 250 */ "from",
/* 251 */ "where_opt",
/* 252 */ "interval_option",
/* 253 */ "sliding_opt",
/* 254 */ "session_option",
/* 255 */ "windowstate_option",
/* 256 */ "fill_opt",
/* 257 */ "groupby_opt",
/* 258 */ "having_opt",
/* 259 */ "orderby_opt",
/* 260 */ "slimit_opt",
/* 261 */ "limit_opt",
/* 262 */ "union",
/* 263 */ "sclp",
/* 264 */ "distinct",
/* 265 */ "expr",
/* 266 */ "as",
/* 267 */ "tablelist",
/* 268 */ "sub",
/* 269 */ "tmvar",
/* 270 */ "intervalKey",
/* 271 */ "sortlist",
/* 272 */ "sortitem",
/* 273 */ "item",
/* 274 */ "sortorder",
/* 275 */ "grouplist",
/* 276 */ "expritem",
/* 196 */ "FILE",
/* 197 */ "program",
/* 198 */ "cmd",
/* 199 */ "dbPrefix",
/* 200 */ "ids",
/* 201 */ "cpxName",
/* 202 */ "ifexists",
/* 203 */ "alter_db_optr",
/* 204 */ "alter_topic_optr",
/* 205 */ "acct_optr",
/* 206 */ "exprlist",
/* 207 */ "ifnotexists",
/* 208 */ "db_optr",
/* 209 */ "topic_optr",
/* 210 */ "typename",
/* 211 */ "bufsize",
/* 212 */ "pps",
/* 213 */ "tseries",
/* 214 */ "dbs",
/* 215 */ "streams",
/* 216 */ "storage",
/* 217 */ "qtime",
/* 218 */ "users",
/* 219 */ "conns",
/* 220 */ "state",
/* 221 */ "intitemlist",
/* 222 */ "intitem",
/* 223 */ "keep",
/* 224 */ "cache",
/* 225 */ "replica",
/* 226 */ "quorum",
/* 227 */ "days",
/* 228 */ "minrows",
/* 229 */ "maxrows",
/* 230 */ "blocks",
/* 231 */ "ctime",
/* 232 */ "wal",
/* 233 */ "fsync",
/* 234 */ "comp",
/* 235 */ "prec",
/* 236 */ "update",
/* 237 */ "cachelast",
/* 238 */ "partitions",
/* 239 */ "signed",
/* 240 */ "create_table_args",
/* 241 */ "create_stable_args",
/* 242 */ "create_table_list",
/* 243 */ "create_from_stable",
/* 244 */ "columnlist",
/* 245 */ "tagitemlist",
/* 246 */ "tagNamelist",
/* 247 */ "select",
/* 248 */ "column",
/* 249 */ "tagitem",
/* 250 */ "selcollist",
/* 251 */ "from",
/* 252 */ "where_opt",
/* 253 */ "interval_option",
/* 254 */ "sliding_opt",
/* 255 */ "session_option",
/* 256 */ "windowstate_option",
/* 257 */ "fill_opt",
/* 258 */ "groupby_opt",
/* 259 */ "having_opt",
/* 260 */ "orderby_opt",
/* 261 */ "slimit_opt",
/* 262 */ "limit_opt",
/* 263 */ "union",
/* 264 */ "sclp",
/* 265 */ "distinct",
/* 266 */ "expr",
/* 267 */ "as",
/* 268 */ "tablelist",
/* 269 */ "sub",
/* 270 */ "tmvar",
/* 271 */ "intervalKey",
/* 272 */ "sortlist",
/* 273 */ "sortitem",
/* 274 */ "item",
/* 275 */ "sortorder",
/* 276 */ "grouplist",
/* 277 */ "expritem",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
......@@ -1500,60 +1502,60 @@ static void yy_destructor(
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 205: /* exprlist */
case 249: /* selcollist */
case 263: /* sclp */
case 206: /* exprlist */
case 250: /* selcollist */
case 264: /* sclp */
{
tSqlExprListDestroy((yypminor->yy403));
tSqlExprListDestroy((yypminor->yy421));
}
break;
case 220: /* intitemlist */
case 222: /* keep */
case 243: /* columnlist */
case 244: /* tagitemlist */
case 245: /* tagNamelist */
case 256: /* fill_opt */
case 257: /* groupby_opt */
case 259: /* orderby_opt */
case 271: /* sortlist */
case 275: /* grouplist */
{
taosArrayDestroy((yypminor->yy403));
case 221: /* intitemlist */
case 223: /* keep */
case 244: /* columnlist */
case 245: /* tagitemlist */
case 246: /* tagNamelist */
case 257: /* fill_opt */
case 258: /* groupby_opt */
case 260: /* orderby_opt */
case 272: /* sortlist */
case 276: /* grouplist */
{
taosArrayDestroy((yypminor->yy421));
}
break;
case 241: /* create_table_list */
case 242: /* create_table_list */
{
destroyCreateTableSql((yypminor->yy56));
destroyCreateTableSql((yypminor->yy438));
}
break;
case 246: /* select */
case 247: /* select */
{
destroySqlNode((yypminor->yy224));
destroySqlNode((yypminor->yy56));
}
break;
case 250: /* from */
case 267: /* tablelist */
case 268: /* sub */
case 251: /* from */
case 268: /* tablelist */
case 269: /* sub */
{
destroyRelationInfo((yypminor->yy114));
destroyRelationInfo((yypminor->yy8));
}
break;
case 251: /* where_opt */
case 258: /* having_opt */
case 265: /* expr */
case 276: /* expritem */
case 252: /* where_opt */
case 259: /* having_opt */
case 266: /* expr */
case 277: /* expritem */
{
tSqlExprDestroy((yypminor->yy260));
tSqlExprDestroy((yypminor->yy439));
}
break;
case 262: /* union */
case 263: /* union */
{
destroyAllSqlNode((yypminor->yy403));
destroyAllSqlNode((yypminor->yy421));
}
break;
case 272: /* sortitem */
case 273: /* sortitem */
{
tVariantDestroy(&(yypminor->yy488));
tVariantDestroy(&(yypminor->yy430));
}
break;
/********* End destructor definitions *****************************************/
......@@ -1850,297 +1852,297 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
{ 196, -1 }, /* (0) program ::= cmd */
{ 197, -2 }, /* (1) cmd ::= SHOW DATABASES */
{ 197, -2 }, /* (2) cmd ::= SHOW TOPICS */
{ 197, -2 }, /* (3) cmd ::= SHOW FUNCTIONS */
{ 197, -2 }, /* (4) cmd ::= SHOW MNODES */
{ 197, -2 }, /* (5) cmd ::= SHOW DNODES */
{ 197, -2 }, /* (6) cmd ::= SHOW ACCOUNTS */
{ 197, -2 }, /* (7) cmd ::= SHOW USERS */
{ 197, -2 }, /* (8) cmd ::= SHOW MODULES */
{ 197, -2 }, /* (9) cmd ::= SHOW QUERIES */
{ 197, -2 }, /* (10) cmd ::= SHOW CONNECTIONS */
{ 197, -2 }, /* (11) cmd ::= SHOW STREAMS */
{ 197, -2 }, /* (12) cmd ::= SHOW VARIABLES */
{ 197, -2 }, /* (13) cmd ::= SHOW SCORES */
{ 197, -2 }, /* (14) cmd ::= SHOW GRANTS */
{ 197, -2 }, /* (15) cmd ::= SHOW VNODES */
{ 197, -3 }, /* (16) cmd ::= SHOW VNODES IPTOKEN */
{ 198, 0 }, /* (17) dbPrefix ::= */
{ 198, -2 }, /* (18) dbPrefix ::= ids DOT */
{ 200, 0 }, /* (19) cpxName ::= */
{ 200, -2 }, /* (20) cpxName ::= DOT ids */
{ 197, -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */
{ 197, -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */
{ 197, -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */
{ 197, -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */
{ 197, -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */
{ 197, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */
{ 197, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */
{ 197, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */
{ 197, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */
{ 197, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */
{ 197, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */
{ 197, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */
{ 197, -3 }, /* (33) cmd ::= DROP FUNCTION ids */
{ 197, -3 }, /* (34) cmd ::= DROP DNODE ids */
{ 197, -3 }, /* (35) cmd ::= DROP USER ids */
{ 197, -3 }, /* (36) cmd ::= DROP ACCOUNT ids */
{ 197, -2 }, /* (37) cmd ::= USE ids */
{ 197, -3 }, /* (38) cmd ::= DESCRIBE ids cpxName */
{ 197, -3 }, /* (39) cmd ::= DESC ids cpxName */
{ 197, -5 }, /* (40) cmd ::= ALTER USER ids PASS ids */
{ 197, -5 }, /* (41) cmd ::= ALTER USER ids PRIVILEGE ids */
{ 197, -4 }, /* (42) cmd ::= ALTER DNODE ids ids */
{ 197, -5 }, /* (43) cmd ::= ALTER DNODE ids ids ids */
{ 197, -3 }, /* (44) cmd ::= ALTER LOCAL ids */
{ 197, -4 }, /* (45) cmd ::= ALTER LOCAL ids ids */
{ 197, -4 }, /* (46) cmd ::= ALTER DATABASE ids alter_db_optr */
{ 197, -4 }, /* (47) cmd ::= ALTER TOPIC ids alter_topic_optr */
{ 197, -4 }, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */
{ 197, -6 }, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{ 197, -6 }, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */
{ 199, -1 }, /* (51) ids ::= ID */
{ 199, -1 }, /* (52) ids ::= STRING */
{ 201, -2 }, /* (53) ifexists ::= IF EXISTS */
{ 201, 0 }, /* (54) ifexists ::= */
{ 206, -3 }, /* (55) ifnotexists ::= IF NOT EXISTS */
{ 206, 0 }, /* (56) ifnotexists ::= */
{ 197, -3 }, /* (57) cmd ::= CREATE DNODE ids */
{ 197, -6 }, /* (58) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ 197, -5 }, /* (59) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{ 197, -5 }, /* (60) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
{ 197, -8 }, /* (61) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ 197, -9 }, /* (62) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ 197, -5 }, /* (63) cmd ::= CREATE USER ids PASS ids */
{ 210, 0 }, /* (64) bufsize ::= */
{ 210, -2 }, /* (65) bufsize ::= BUFSIZE INTEGER */
{ 211, 0 }, /* (66) pps ::= */
{ 211, -2 }, /* (67) pps ::= PPS INTEGER */
{ 212, 0 }, /* (68) tseries ::= */
{ 212, -2 }, /* (69) tseries ::= TSERIES INTEGER */
{ 213, 0 }, /* (70) dbs ::= */
{ 213, -2 }, /* (71) dbs ::= DBS INTEGER */
{ 214, 0 }, /* (72) streams ::= */
{ 214, -2 }, /* (73) streams ::= STREAMS INTEGER */
{ 215, 0 }, /* (74) storage ::= */
{ 215, -2 }, /* (75) storage ::= STORAGE INTEGER */
{ 216, 0 }, /* (76) qtime ::= */
{ 216, -2 }, /* (77) qtime ::= QTIME INTEGER */
{ 217, 0 }, /* (78) users ::= */
{ 217, -2 }, /* (79) users ::= USERS INTEGER */
{ 218, 0 }, /* (80) conns ::= */
{ 218, -2 }, /* (81) conns ::= CONNS INTEGER */
{ 219, 0 }, /* (82) state ::= */
{ 219, -2 }, /* (83) state ::= STATE ids */
{ 204, -9 }, /* (84) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{ 220, -3 }, /* (85) intitemlist ::= intitemlist COMMA intitem */
{ 220, -1 }, /* (86) intitemlist ::= intitem */
{ 221, -1 }, /* (87) intitem ::= INTEGER */
{ 222, -2 }, /* (88) keep ::= KEEP intitemlist */
{ 223, -2 }, /* (89) cache ::= CACHE INTEGER */
{ 224, -2 }, /* (90) replica ::= REPLICA INTEGER */
{ 225, -2 }, /* (91) quorum ::= QUORUM INTEGER */
{ 226, -2 }, /* (92) days ::= DAYS INTEGER */
{ 227, -2 }, /* (93) minrows ::= MINROWS INTEGER */
{ 228, -2 }, /* (94) maxrows ::= MAXROWS INTEGER */
{ 229, -2 }, /* (95) blocks ::= BLOCKS INTEGER */
{ 230, -2 }, /* (96) ctime ::= CTIME INTEGER */
{ 231, -2 }, /* (97) wal ::= WAL INTEGER */
{ 232, -2 }, /* (98) fsync ::= FSYNC INTEGER */
{ 233, -2 }, /* (99) comp ::= COMP INTEGER */
{ 234, -2 }, /* (100) prec ::= PRECISION STRING */
{ 235, -2 }, /* (101) update ::= UPDATE INTEGER */
{ 236, -2 }, /* (102) cachelast ::= CACHELAST INTEGER */
{ 237, -2 }, /* (103) partitions ::= PARTITIONS INTEGER */
{ 207, 0 }, /* (104) db_optr ::= */
{ 207, -2 }, /* (105) db_optr ::= db_optr cache */
{ 207, -2 }, /* (106) db_optr ::= db_optr replica */
{ 207, -2 }, /* (107) db_optr ::= db_optr quorum */
{ 207, -2 }, /* (108) db_optr ::= db_optr days */
{ 207, -2 }, /* (109) db_optr ::= db_optr minrows */
{ 207, -2 }, /* (110) db_optr ::= db_optr maxrows */
{ 207, -2 }, /* (111) db_optr ::= db_optr blocks */
{ 207, -2 }, /* (112) db_optr ::= db_optr ctime */
{ 207, -2 }, /* (113) db_optr ::= db_optr wal */
{ 207, -2 }, /* (114) db_optr ::= db_optr fsync */
{ 207, -2 }, /* (115) db_optr ::= db_optr comp */
{ 207, -2 }, /* (116) db_optr ::= db_optr prec */
{ 207, -2 }, /* (117) db_optr ::= db_optr keep */
{ 207, -2 }, /* (118) db_optr ::= db_optr update */
{ 207, -2 }, /* (119) db_optr ::= db_optr cachelast */
{ 208, -1 }, /* (120) topic_optr ::= db_optr */
{ 208, -2 }, /* (121) topic_optr ::= topic_optr partitions */
{ 202, 0 }, /* (122) alter_db_optr ::= */
{ 202, -2 }, /* (123) alter_db_optr ::= alter_db_optr replica */
{ 202, -2 }, /* (124) alter_db_optr ::= alter_db_optr quorum */
{ 202, -2 }, /* (125) alter_db_optr ::= alter_db_optr keep */
{ 202, -2 }, /* (126) alter_db_optr ::= alter_db_optr blocks */
{ 202, -2 }, /* (127) alter_db_optr ::= alter_db_optr comp */
{ 202, -2 }, /* (128) alter_db_optr ::= alter_db_optr update */
{ 202, -2 }, /* (129) alter_db_optr ::= alter_db_optr cachelast */
{ 203, -1 }, /* (130) alter_topic_optr ::= alter_db_optr */
{ 203, -2 }, /* (131) alter_topic_optr ::= alter_topic_optr partitions */
{ 209, -1 }, /* (132) typename ::= ids */
{ 209, -4 }, /* (133) typename ::= ids LP signed RP */
{ 209, -2 }, /* (134) typename ::= ids UNSIGNED */
{ 238, -1 }, /* (135) signed ::= INTEGER */
{ 238, -2 }, /* (136) signed ::= PLUS INTEGER */
{ 238, -2 }, /* (137) signed ::= MINUS INTEGER */
{ 197, -3 }, /* (138) cmd ::= CREATE TABLE create_table_args */
{ 197, -3 }, /* (139) cmd ::= CREATE TABLE create_stable_args */
{ 197, -3 }, /* (140) cmd ::= CREATE STABLE create_stable_args */
{ 197, -3 }, /* (141) cmd ::= CREATE TABLE create_table_list */
{ 241, -1 }, /* (142) create_table_list ::= create_from_stable */
{ 241, -2 }, /* (143) create_table_list ::= create_table_list create_from_stable */
{ 239, -6 }, /* (144) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{ 240, -10 }, /* (145) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{ 242, -10 }, /* (146) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
{ 242, -13 }, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
{ 245, -3 }, /* (148) tagNamelist ::= tagNamelist COMMA ids */
{ 245, -1 }, /* (149) tagNamelist ::= ids */
{ 239, -5 }, /* (150) create_table_args ::= ifnotexists ids cpxName AS select */
{ 243, -3 }, /* (151) columnlist ::= columnlist COMMA column */
{ 243, -1 }, /* (152) columnlist ::= column */
{ 247, -2 }, /* (153) column ::= ids typename */
{ 244, -3 }, /* (154) tagitemlist ::= tagitemlist COMMA tagitem */
{ 244, -1 }, /* (155) tagitemlist ::= tagitem */
{ 248, -1 }, /* (156) tagitem ::= INTEGER */
{ 248, -1 }, /* (157) tagitem ::= FLOAT */
{ 248, -1 }, /* (158) tagitem ::= STRING */
{ 248, -1 }, /* (159) tagitem ::= BOOL */
{ 248, -1 }, /* (160) tagitem ::= NULL */
{ 248, -1 }, /* (161) tagitem ::= NOW */
{ 248, -2 }, /* (162) tagitem ::= MINUS INTEGER */
{ 248, -2 }, /* (163) tagitem ::= MINUS FLOAT */
{ 248, -2 }, /* (164) tagitem ::= PLUS INTEGER */
{ 248, -2 }, /* (165) tagitem ::= PLUS FLOAT */
{ 246, -14 }, /* (166) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{ 246, -3 }, /* (167) select ::= LP select RP */
{ 262, -1 }, /* (168) union ::= select */
{ 262, -4 }, /* (169) union ::= union UNION ALL select */
{ 197, -1 }, /* (170) cmd ::= union */
{ 246, -2 }, /* (171) select ::= SELECT selcollist */
{ 263, -2 }, /* (172) sclp ::= selcollist COMMA */
{ 263, 0 }, /* (173) sclp ::= */
{ 249, -4 }, /* (174) selcollist ::= sclp distinct expr as */
{ 249, -2 }, /* (175) selcollist ::= sclp STAR */
{ 266, -2 }, /* (176) as ::= AS ids */
{ 266, -1 }, /* (177) as ::= ids */
{ 266, 0 }, /* (178) as ::= */
{ 264, -1 }, /* (179) distinct ::= DISTINCT */
{ 264, 0 }, /* (180) distinct ::= */
{ 250, -2 }, /* (181) from ::= FROM tablelist */
{ 250, -2 }, /* (182) from ::= FROM sub */
{ 268, -3 }, /* (183) sub ::= LP union RP */
{ 268, -4 }, /* (184) sub ::= LP union RP ids */
{ 268, -6 }, /* (185) sub ::= sub COMMA LP union RP ids */
{ 267, -2 }, /* (186) tablelist ::= ids cpxName */
{ 267, -3 }, /* (187) tablelist ::= ids cpxName ids */
{ 267, -4 }, /* (188) tablelist ::= tablelist COMMA ids cpxName */
{ 267, -5 }, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */
{ 269, -1 }, /* (190) tmvar ::= VARIABLE */
{ 252, -4 }, /* (191) interval_option ::= intervalKey LP tmvar RP */
{ 252, -6 }, /* (192) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{ 252, 0 }, /* (193) interval_option ::= */
{ 270, -1 }, /* (194) intervalKey ::= INTERVAL */
{ 270, -1 }, /* (195) intervalKey ::= EVERY */
{ 254, 0 }, /* (196) session_option ::= */
{ 254, -7 }, /* (197) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{ 255, 0 }, /* (198) windowstate_option ::= */
{ 255, -4 }, /* (199) windowstate_option ::= STATE_WINDOW LP ids RP */
{ 256, 0 }, /* (200) fill_opt ::= */
{ 256, -6 }, /* (201) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{ 256, -4 }, /* (202) fill_opt ::= FILL LP ID RP */
{ 253, -4 }, /* (203) sliding_opt ::= SLIDING LP tmvar RP */
{ 253, 0 }, /* (204) sliding_opt ::= */
{ 259, 0 }, /* (205) orderby_opt ::= */
{ 259, -3 }, /* (206) orderby_opt ::= ORDER BY sortlist */
{ 271, -4 }, /* (207) sortlist ::= sortlist COMMA item sortorder */
{ 271, -2 }, /* (208) sortlist ::= item sortorder */
{ 273, -2 }, /* (209) item ::= ids cpxName */
{ 274, -1 }, /* (210) sortorder ::= ASC */
{ 274, -1 }, /* (211) sortorder ::= DESC */
{ 274, 0 }, /* (212) sortorder ::= */
{ 257, 0 }, /* (213) groupby_opt ::= */
{ 257, -3 }, /* (214) groupby_opt ::= GROUP BY grouplist */
{ 275, -3 }, /* (215) grouplist ::= grouplist COMMA item */
{ 275, -1 }, /* (216) grouplist ::= item */
{ 258, 0 }, /* (217) having_opt ::= */
{ 258, -2 }, /* (218) having_opt ::= HAVING expr */
{ 261, 0 }, /* (219) limit_opt ::= */
{ 261, -2 }, /* (220) limit_opt ::= LIMIT signed */
{ 261, -4 }, /* (221) limit_opt ::= LIMIT signed OFFSET signed */
{ 261, -4 }, /* (222) limit_opt ::= LIMIT signed COMMA signed */
{ 260, 0 }, /* (223) slimit_opt ::= */
{ 260, -2 }, /* (224) slimit_opt ::= SLIMIT signed */
{ 260, -4 }, /* (225) slimit_opt ::= SLIMIT signed SOFFSET signed */
{ 260, -4 }, /* (226) slimit_opt ::= SLIMIT signed COMMA signed */
{ 251, 0 }, /* (227) where_opt ::= */
{ 251, -2 }, /* (228) where_opt ::= WHERE expr */
{ 265, -3 }, /* (229) expr ::= LP expr RP */
{ 265, -1 }, /* (230) expr ::= ID */
{ 265, -3 }, /* (231) expr ::= ID DOT ID */
{ 265, -3 }, /* (232) expr ::= ID DOT STAR */
{ 265, -1 }, /* (233) expr ::= INTEGER */
{ 265, -2 }, /* (234) expr ::= MINUS INTEGER */
{ 265, -2 }, /* (235) expr ::= PLUS INTEGER */
{ 265, -1 }, /* (236) expr ::= FLOAT */
{ 265, -2 }, /* (237) expr ::= MINUS FLOAT */
{ 265, -2 }, /* (238) expr ::= PLUS FLOAT */
{ 265, -1 }, /* (239) expr ::= STRING */
{ 265, -1 }, /* (240) expr ::= NOW */
{ 265, -1 }, /* (241) expr ::= VARIABLE */
{ 265, -2 }, /* (242) expr ::= PLUS VARIABLE */
{ 265, -2 }, /* (243) expr ::= MINUS VARIABLE */
{ 265, -1 }, /* (244) expr ::= BOOL */
{ 265, -1 }, /* (245) expr ::= NULL */
{ 265, -4 }, /* (246) expr ::= ID LP exprlist RP */
{ 265, -4 }, /* (247) expr ::= ID LP STAR RP */
{ 265, -3 }, /* (248) expr ::= expr IS NULL */
{ 265, -4 }, /* (249) expr ::= expr IS NOT NULL */
{ 265, -3 }, /* (250) expr ::= expr LT expr */
{ 265, -3 }, /* (251) expr ::= expr GT expr */
{ 265, -3 }, /* (252) expr ::= expr LE expr */
{ 265, -3 }, /* (253) expr ::= expr GE expr */
{ 265, -3 }, /* (254) expr ::= expr NE expr */
{ 265, -3 }, /* (255) expr ::= expr EQ expr */
{ 265, -5 }, /* (256) expr ::= expr BETWEEN expr AND expr */
{ 265, -3 }, /* (257) expr ::= expr AND expr */
{ 265, -3 }, /* (258) expr ::= expr OR expr */
{ 265, -3 }, /* (259) expr ::= expr PLUS expr */
{ 265, -3 }, /* (260) expr ::= expr MINUS expr */
{ 265, -3 }, /* (261) expr ::= expr STAR expr */
{ 265, -3 }, /* (262) expr ::= expr SLASH expr */
{ 265, -3 }, /* (263) expr ::= expr REM expr */
{ 265, -3 }, /* (264) expr ::= expr LIKE expr */
{ 265, -5 }, /* (265) expr ::= expr IN LP exprlist RP */
{ 205, -3 }, /* (266) exprlist ::= exprlist COMMA expritem */
{ 205, -1 }, /* (267) exprlist ::= expritem */
{ 276, -1 }, /* (268) expritem ::= expr */
{ 276, 0 }, /* (269) expritem ::= */
{ 197, -3 }, /* (270) cmd ::= RESET QUERY CACHE */
{ 197, -3 }, /* (271) cmd ::= SYNCDB ids REPLICA */
{ 197, -7 }, /* (272) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{ 197, -7 }, /* (273) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{ 197, -7 }, /* (274) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{ 197, -7 }, /* (275) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{ 197, -7 }, /* (276) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{ 197, -8 }, /* (277) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{ 197, -9 }, /* (278) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{ 197, -7 }, /* (279) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{ 197, -7 }, /* (280) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{ 197, -7 }, /* (281) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
{ 197, -7 }, /* (282) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{ 197, -7 }, /* (283) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{ 197, -7 }, /* (284) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
{ 197, -8 }, /* (285) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
{ 197, -9 }, /* (286) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
{ 197, -7 }, /* (287) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{ 197, -3 }, /* (288) cmd ::= KILL CONNECTION INTEGER */
{ 197, -5 }, /* (289) cmd ::= KILL STREAM INTEGER COLON INTEGER */
{ 197, -5 }, /* (290) cmd ::= KILL QUERY INTEGER COLON INTEGER */
{ 197, -1 }, /* (0) program ::= cmd */
{ 198, -2 }, /* (1) cmd ::= SHOW DATABASES */
{ 198, -2 }, /* (2) cmd ::= SHOW TOPICS */
{ 198, -2 }, /* (3) cmd ::= SHOW FUNCTIONS */
{ 198, -2 }, /* (4) cmd ::= SHOW MNODES */
{ 198, -2 }, /* (5) cmd ::= SHOW DNODES */
{ 198, -2 }, /* (6) cmd ::= SHOW ACCOUNTS */
{ 198, -2 }, /* (7) cmd ::= SHOW USERS */
{ 198, -2 }, /* (8) cmd ::= SHOW MODULES */
{ 198, -2 }, /* (9) cmd ::= SHOW QUERIES */
{ 198, -2 }, /* (10) cmd ::= SHOW CONNECTIONS */
{ 198, -2 }, /* (11) cmd ::= SHOW STREAMS */
{ 198, -2 }, /* (12) cmd ::= SHOW VARIABLES */
{ 198, -2 }, /* (13) cmd ::= SHOW SCORES */
{ 198, -2 }, /* (14) cmd ::= SHOW GRANTS */
{ 198, -2 }, /* (15) cmd ::= SHOW VNODES */
{ 198, -3 }, /* (16) cmd ::= SHOW VNODES IPTOKEN */
{ 199, 0 }, /* (17) dbPrefix ::= */
{ 199, -2 }, /* (18) dbPrefix ::= ids DOT */
{ 201, 0 }, /* (19) cpxName ::= */
{ 201, -2 }, /* (20) cpxName ::= DOT ids */
{ 198, -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */
{ 198, -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */
{ 198, -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */
{ 198, -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */
{ 198, -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */
{ 198, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */
{ 198, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */
{ 198, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */
{ 198, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */
{ 198, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */
{ 198, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */
{ 198, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */
{ 198, -3 }, /* (33) cmd ::= DROP FUNCTION ids */
{ 198, -3 }, /* (34) cmd ::= DROP DNODE ids */
{ 198, -3 }, /* (35) cmd ::= DROP USER ids */
{ 198, -3 }, /* (36) cmd ::= DROP ACCOUNT ids */
{ 198, -2 }, /* (37) cmd ::= USE ids */
{ 198, -3 }, /* (38) cmd ::= DESCRIBE ids cpxName */
{ 198, -3 }, /* (39) cmd ::= DESC ids cpxName */
{ 198, -5 }, /* (40) cmd ::= ALTER USER ids PASS ids */
{ 198, -5 }, /* (41) cmd ::= ALTER USER ids PRIVILEGE ids */
{ 198, -4 }, /* (42) cmd ::= ALTER DNODE ids ids */
{ 198, -5 }, /* (43) cmd ::= ALTER DNODE ids ids ids */
{ 198, -3 }, /* (44) cmd ::= ALTER LOCAL ids */
{ 198, -4 }, /* (45) cmd ::= ALTER LOCAL ids ids */
{ 198, -4 }, /* (46) cmd ::= ALTER DATABASE ids alter_db_optr */
{ 198, -4 }, /* (47) cmd ::= ALTER TOPIC ids alter_topic_optr */
{ 198, -4 }, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */
{ 198, -6 }, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{ 198, -6 }, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */
{ 200, -1 }, /* (51) ids ::= ID */
{ 200, -1 }, /* (52) ids ::= STRING */
{ 202, -2 }, /* (53) ifexists ::= IF EXISTS */
{ 202, 0 }, /* (54) ifexists ::= */
{ 207, -3 }, /* (55) ifnotexists ::= IF NOT EXISTS */
{ 207, 0 }, /* (56) ifnotexists ::= */
{ 198, -3 }, /* (57) cmd ::= CREATE DNODE ids */
{ 198, -6 }, /* (58) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ 198, -5 }, /* (59) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{ 198, -5 }, /* (60) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
{ 198, -8 }, /* (61) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ 198, -9 }, /* (62) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ 198, -5 }, /* (63) cmd ::= CREATE USER ids PASS ids */
{ 211, 0 }, /* (64) bufsize ::= */
{ 211, -2 }, /* (65) bufsize ::= BUFSIZE INTEGER */
{ 212, 0 }, /* (66) pps ::= */
{ 212, -2 }, /* (67) pps ::= PPS INTEGER */
{ 213, 0 }, /* (68) tseries ::= */
{ 213, -2 }, /* (69) tseries ::= TSERIES INTEGER */
{ 214, 0 }, /* (70) dbs ::= */
{ 214, -2 }, /* (71) dbs ::= DBS INTEGER */
{ 215, 0 }, /* (72) streams ::= */
{ 215, -2 }, /* (73) streams ::= STREAMS INTEGER */
{ 216, 0 }, /* (74) storage ::= */
{ 216, -2 }, /* (75) storage ::= STORAGE INTEGER */
{ 217, 0 }, /* (76) qtime ::= */
{ 217, -2 }, /* (77) qtime ::= QTIME INTEGER */
{ 218, 0 }, /* (78) users ::= */
{ 218, -2 }, /* (79) users ::= USERS INTEGER */
{ 219, 0 }, /* (80) conns ::= */
{ 219, -2 }, /* (81) conns ::= CONNS INTEGER */
{ 220, 0 }, /* (82) state ::= */
{ 220, -2 }, /* (83) state ::= STATE ids */
{ 205, -9 }, /* (84) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{ 221, -3 }, /* (85) intitemlist ::= intitemlist COMMA intitem */
{ 221, -1 }, /* (86) intitemlist ::= intitem */
{ 222, -1 }, /* (87) intitem ::= INTEGER */
{ 223, -2 }, /* (88) keep ::= KEEP intitemlist */
{ 224, -2 }, /* (89) cache ::= CACHE INTEGER */
{ 225, -2 }, /* (90) replica ::= REPLICA INTEGER */
{ 226, -2 }, /* (91) quorum ::= QUORUM INTEGER */
{ 227, -2 }, /* (92) days ::= DAYS INTEGER */
{ 228, -2 }, /* (93) minrows ::= MINROWS INTEGER */
{ 229, -2 }, /* (94) maxrows ::= MAXROWS INTEGER */
{ 230, -2 }, /* (95) blocks ::= BLOCKS INTEGER */
{ 231, -2 }, /* (96) ctime ::= CTIME INTEGER */
{ 232, -2 }, /* (97) wal ::= WAL INTEGER */
{ 233, -2 }, /* (98) fsync ::= FSYNC INTEGER */
{ 234, -2 }, /* (99) comp ::= COMP INTEGER */
{ 235, -2 }, /* (100) prec ::= PRECISION STRING */
{ 236, -2 }, /* (101) update ::= UPDATE INTEGER */
{ 237, -2 }, /* (102) cachelast ::= CACHELAST INTEGER */
{ 238, -2 }, /* (103) partitions ::= PARTITIONS INTEGER */
{ 208, 0 }, /* (104) db_optr ::= */
{ 208, -2 }, /* (105) db_optr ::= db_optr cache */
{ 208, -2 }, /* (106) db_optr ::= db_optr replica */
{ 208, -2 }, /* (107) db_optr ::= db_optr quorum */
{ 208, -2 }, /* (108) db_optr ::= db_optr days */
{ 208, -2 }, /* (109) db_optr ::= db_optr minrows */
{ 208, -2 }, /* (110) db_optr ::= db_optr maxrows */
{ 208, -2 }, /* (111) db_optr ::= db_optr blocks */
{ 208, -2 }, /* (112) db_optr ::= db_optr ctime */
{ 208, -2 }, /* (113) db_optr ::= db_optr wal */
{ 208, -2 }, /* (114) db_optr ::= db_optr fsync */
{ 208, -2 }, /* (115) db_optr ::= db_optr comp */
{ 208, -2 }, /* (116) db_optr ::= db_optr prec */
{ 208, -2 }, /* (117) db_optr ::= db_optr keep */
{ 208, -2 }, /* (118) db_optr ::= db_optr update */
{ 208, -2 }, /* (119) db_optr ::= db_optr cachelast */
{ 209, -1 }, /* (120) topic_optr ::= db_optr */
{ 209, -2 }, /* (121) topic_optr ::= topic_optr partitions */
{ 203, 0 }, /* (122) alter_db_optr ::= */
{ 203, -2 }, /* (123) alter_db_optr ::= alter_db_optr replica */
{ 203, -2 }, /* (124) alter_db_optr ::= alter_db_optr quorum */
{ 203, -2 }, /* (125) alter_db_optr ::= alter_db_optr keep */
{ 203, -2 }, /* (126) alter_db_optr ::= alter_db_optr blocks */
{ 203, -2 }, /* (127) alter_db_optr ::= alter_db_optr comp */
{ 203, -2 }, /* (128) alter_db_optr ::= alter_db_optr update */
{ 203, -2 }, /* (129) alter_db_optr ::= alter_db_optr cachelast */
{ 204, -1 }, /* (130) alter_topic_optr ::= alter_db_optr */
{ 204, -2 }, /* (131) alter_topic_optr ::= alter_topic_optr partitions */
{ 210, -1 }, /* (132) typename ::= ids */
{ 210, -4 }, /* (133) typename ::= ids LP signed RP */
{ 210, -2 }, /* (134) typename ::= ids UNSIGNED */
{ 239, -1 }, /* (135) signed ::= INTEGER */
{ 239, -2 }, /* (136) signed ::= PLUS INTEGER */
{ 239, -2 }, /* (137) signed ::= MINUS INTEGER */
{ 198, -3 }, /* (138) cmd ::= CREATE TABLE create_table_args */
{ 198, -3 }, /* (139) cmd ::= CREATE TABLE create_stable_args */
{ 198, -3 }, /* (140) cmd ::= CREATE STABLE create_stable_args */
{ 198, -3 }, /* (141) cmd ::= CREATE TABLE create_table_list */
{ 242, -1 }, /* (142) create_table_list ::= create_from_stable */
{ 242, -2 }, /* (143) create_table_list ::= create_table_list create_from_stable */
{ 240, -6 }, /* (144) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{ 241, -10 }, /* (145) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{ 243, -10 }, /* (146) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
{ 243, -13 }, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
{ 246, -3 }, /* (148) tagNamelist ::= tagNamelist COMMA ids */
{ 246, -1 }, /* (149) tagNamelist ::= ids */
{ 240, -5 }, /* (150) create_table_args ::= ifnotexists ids cpxName AS select */
{ 244, -3 }, /* (151) columnlist ::= columnlist COMMA column */
{ 244, -1 }, /* (152) columnlist ::= column */
{ 248, -2 }, /* (153) column ::= ids typename */
{ 245, -3 }, /* (154) tagitemlist ::= tagitemlist COMMA tagitem */
{ 245, -1 }, /* (155) tagitemlist ::= tagitem */
{ 249, -1 }, /* (156) tagitem ::= INTEGER */
{ 249, -1 }, /* (157) tagitem ::= FLOAT */
{ 249, -1 }, /* (158) tagitem ::= STRING */
{ 249, -1 }, /* (159) tagitem ::= BOOL */
{ 249, -1 }, /* (160) tagitem ::= NULL */
{ 249, -1 }, /* (161) tagitem ::= NOW */
{ 249, -2 }, /* (162) tagitem ::= MINUS INTEGER */
{ 249, -2 }, /* (163) tagitem ::= MINUS FLOAT */
{ 249, -2 }, /* (164) tagitem ::= PLUS INTEGER */
{ 249, -2 }, /* (165) tagitem ::= PLUS FLOAT */
{ 247, -14 }, /* (166) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{ 247, -3 }, /* (167) select ::= LP select RP */
{ 263, -1 }, /* (168) union ::= select */
{ 263, -4 }, /* (169) union ::= union UNION ALL select */
{ 198, -1 }, /* (170) cmd ::= union */
{ 247, -2 }, /* (171) select ::= SELECT selcollist */
{ 264, -2 }, /* (172) sclp ::= selcollist COMMA */
{ 264, 0 }, /* (173) sclp ::= */
{ 250, -4 }, /* (174) selcollist ::= sclp distinct expr as */
{ 250, -2 }, /* (175) selcollist ::= sclp STAR */
{ 267, -2 }, /* (176) as ::= AS ids */
{ 267, -1 }, /* (177) as ::= ids */
{ 267, 0 }, /* (178) as ::= */
{ 265, -1 }, /* (179) distinct ::= DISTINCT */
{ 265, 0 }, /* (180) distinct ::= */
{ 251, -2 }, /* (181) from ::= FROM tablelist */
{ 251, -2 }, /* (182) from ::= FROM sub */
{ 269, -3 }, /* (183) sub ::= LP union RP */
{ 269, -4 }, /* (184) sub ::= LP union RP ids */
{ 269, -6 }, /* (185) sub ::= sub COMMA LP union RP ids */
{ 268, -2 }, /* (186) tablelist ::= ids cpxName */
{ 268, -3 }, /* (187) tablelist ::= ids cpxName ids */
{ 268, -4 }, /* (188) tablelist ::= tablelist COMMA ids cpxName */
{ 268, -5 }, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */
{ 270, -1 }, /* (190) tmvar ::= VARIABLE */
{ 253, -4 }, /* (191) interval_option ::= intervalKey LP tmvar RP */
{ 253, -6 }, /* (192) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{ 253, 0 }, /* (193) interval_option ::= */
{ 271, -1 }, /* (194) intervalKey ::= INTERVAL */
{ 271, -1 }, /* (195) intervalKey ::= EVERY */
{ 255, 0 }, /* (196) session_option ::= */
{ 255, -7 }, /* (197) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{ 256, 0 }, /* (198) windowstate_option ::= */
{ 256, -4 }, /* (199) windowstate_option ::= STATE_WINDOW LP ids RP */
{ 257, 0 }, /* (200) fill_opt ::= */
{ 257, -6 }, /* (201) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{ 257, -4 }, /* (202) fill_opt ::= FILL LP ID RP */
{ 254, -4 }, /* (203) sliding_opt ::= SLIDING LP tmvar RP */
{ 254, 0 }, /* (204) sliding_opt ::= */
{ 260, 0 }, /* (205) orderby_opt ::= */
{ 260, -3 }, /* (206) orderby_opt ::= ORDER BY sortlist */
{ 272, -4 }, /* (207) sortlist ::= sortlist COMMA item sortorder */
{ 272, -2 }, /* (208) sortlist ::= item sortorder */
{ 274, -2 }, /* (209) item ::= ids cpxName */
{ 275, -1 }, /* (210) sortorder ::= ASC */
{ 275, -1 }, /* (211) sortorder ::= DESC */
{ 275, 0 }, /* (212) sortorder ::= */
{ 258, 0 }, /* (213) groupby_opt ::= */
{ 258, -3 }, /* (214) groupby_opt ::= GROUP BY grouplist */
{ 276, -3 }, /* (215) grouplist ::= grouplist COMMA item */
{ 276, -1 }, /* (216) grouplist ::= item */
{ 259, 0 }, /* (217) having_opt ::= */
{ 259, -2 }, /* (218) having_opt ::= HAVING expr */
{ 262, 0 }, /* (219) limit_opt ::= */
{ 262, -2 }, /* (220) limit_opt ::= LIMIT signed */
{ 262, -4 }, /* (221) limit_opt ::= LIMIT signed OFFSET signed */
{ 262, -4 }, /* (222) limit_opt ::= LIMIT signed COMMA signed */
{ 261, 0 }, /* (223) slimit_opt ::= */
{ 261, -2 }, /* (224) slimit_opt ::= SLIMIT signed */
{ 261, -4 }, /* (225) slimit_opt ::= SLIMIT signed SOFFSET signed */
{ 261, -4 }, /* (226) slimit_opt ::= SLIMIT signed COMMA signed */
{ 252, 0 }, /* (227) where_opt ::= */
{ 252, -2 }, /* (228) where_opt ::= WHERE expr */
{ 266, -3 }, /* (229) expr ::= LP expr RP */
{ 266, -1 }, /* (230) expr ::= ID */
{ 266, -3 }, /* (231) expr ::= ID DOT ID */
{ 266, -3 }, /* (232) expr ::= ID DOT STAR */
{ 266, -1 }, /* (233) expr ::= INTEGER */
{ 266, -2 }, /* (234) expr ::= MINUS INTEGER */
{ 266, -2 }, /* (235) expr ::= PLUS INTEGER */
{ 266, -1 }, /* (236) expr ::= FLOAT */
{ 266, -2 }, /* (237) expr ::= MINUS FLOAT */
{ 266, -2 }, /* (238) expr ::= PLUS FLOAT */
{ 266, -1 }, /* (239) expr ::= STRING */
{ 266, -1 }, /* (240) expr ::= NOW */
{ 266, -1 }, /* (241) expr ::= VARIABLE */
{ 266, -2 }, /* (242) expr ::= PLUS VARIABLE */
{ 266, -2 }, /* (243) expr ::= MINUS VARIABLE */
{ 266, -1 }, /* (244) expr ::= BOOL */
{ 266, -1 }, /* (245) expr ::= NULL */
{ 266, -4 }, /* (246) expr ::= ID LP exprlist RP */
{ 266, -4 }, /* (247) expr ::= ID LP STAR RP */
{ 266, -3 }, /* (248) expr ::= expr IS NULL */
{ 266, -4 }, /* (249) expr ::= expr IS NOT NULL */
{ 266, -3 }, /* (250) expr ::= expr LT expr */
{ 266, -3 }, /* (251) expr ::= expr GT expr */
{ 266, -3 }, /* (252) expr ::= expr LE expr */
{ 266, -3 }, /* (253) expr ::= expr GE expr */
{ 266, -3 }, /* (254) expr ::= expr NE expr */
{ 266, -3 }, /* (255) expr ::= expr EQ expr */
{ 266, -5 }, /* (256) expr ::= expr BETWEEN expr AND expr */
{ 266, -3 }, /* (257) expr ::= expr AND expr */
{ 266, -3 }, /* (258) expr ::= expr OR expr */
{ 266, -3 }, /* (259) expr ::= expr PLUS expr */
{ 266, -3 }, /* (260) expr ::= expr MINUS expr */
{ 266, -3 }, /* (261) expr ::= expr STAR expr */
{ 266, -3 }, /* (262) expr ::= expr SLASH expr */
{ 266, -3 }, /* (263) expr ::= expr REM expr */
{ 266, -3 }, /* (264) expr ::= expr LIKE expr */
{ 266, -5 }, /* (265) expr ::= expr IN LP exprlist RP */
{ 206, -3 }, /* (266) exprlist ::= exprlist COMMA expritem */
{ 206, -1 }, /* (267) exprlist ::= expritem */
{ 277, -1 }, /* (268) expritem ::= expr */
{ 277, 0 }, /* (269) expritem ::= */
{ 198, -3 }, /* (270) cmd ::= RESET QUERY CACHE */
{ 198, -3 }, /* (271) cmd ::= SYNCDB ids REPLICA */
{ 198, -7 }, /* (272) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{ 198, -7 }, /* (273) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{ 198, -7 }, /* (274) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{ 198, -7 }, /* (275) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{ 198, -7 }, /* (276) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{ 198, -8 }, /* (277) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{ 198, -9 }, /* (278) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{ 198, -7 }, /* (279) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{ 198, -7 }, /* (280) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{ 198, -7 }, /* (281) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
{ 198, -7 }, /* (282) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{ 198, -7 }, /* (283) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{ 198, -7 }, /* (284) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
{ 198, -8 }, /* (285) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
{ 198, -9 }, /* (286) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
{ 198, -7 }, /* (287) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{ 198, -3 }, /* (288) cmd ::= KILL CONNECTION INTEGER */
{ 198, -5 }, /* (289) cmd ::= KILL STREAM INTEGER COLON INTEGER */
{ 198, -5 }, /* (290) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
static void yy_accept(yyParser*); /* Forward Declaration */
......@@ -2400,16 +2402,16 @@ static YYACTIONTYPE yy_reduce(
break;
case 46: /* cmd ::= ALTER DATABASE ids alter_db_optr */
case 47: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==47);
{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy246, &t);}
{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy90, &t);}
break;
case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy377);}
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy171);}
break;
case 49: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy377);}
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);}
break;
case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */
{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy403);}
{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy421);}
break;
case 51: /* ids ::= ID */
case 52: /* ids ::= STRING */ yytestcase(yyruleno==52);
......@@ -2431,17 +2433,17 @@ static YYACTIONTYPE yy_reduce(
{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
break;
case 58: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy377);}
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);}
break;
case 59: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
case 60: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==60);
{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy246, &yymsp[-2].minor.yy0);}
{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy90, &yymsp[-2].minor.yy0);}
break;
case 61: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy363, &yymsp[0].minor.yy0, 1);}
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy183, &yymsp[0].minor.yy0, 1);}
break;
case 62: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy363, &yymsp[0].minor.yy0, 2);}
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy183, &yymsp[0].minor.yy0, 2);}
break;
case 63: /* cmd ::= CREATE USER ids PASS ids */
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
......@@ -2472,38 +2474,38 @@ static YYACTIONTYPE yy_reduce(
break;
case 84: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
yylhsminor.yy377.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
yylhsminor.yy377.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
yylhsminor.yy377.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
yylhsminor.yy377.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
yylhsminor.yy377.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
yylhsminor.yy377.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy377.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy377.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
yylhsminor.yy377.stat = yymsp[0].minor.yy0;
yylhsminor.yy171.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
yylhsminor.yy171.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
yylhsminor.yy171.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
yylhsminor.yy171.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
yylhsminor.yy171.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
yylhsminor.yy171.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy171.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy171.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
yylhsminor.yy171.stat = yymsp[0].minor.yy0;
}
yymsp[-8].minor.yy377 = yylhsminor.yy377;
yymsp[-8].minor.yy171 = yylhsminor.yy171;
break;
case 85: /* intitemlist ::= intitemlist COMMA intitem */
case 154: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==154);
{ yylhsminor.yy403 = tVariantListAppend(yymsp[-2].minor.yy403, &yymsp[0].minor.yy488, -1); }
yymsp[-2].minor.yy403 = yylhsminor.yy403;
{ yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); }
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
case 86: /* intitemlist ::= intitem */
case 155: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==155);
{ yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); }
yymsp[0].minor.yy403 = yylhsminor.yy403;
{ yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); }
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
case 87: /* intitem ::= INTEGER */
case 156: /* tagitem ::= INTEGER */ yytestcase(yyruleno==156);
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.yy488, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy488 = yylhsminor.yy488;
{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy430 = yylhsminor.yy430;
break;
case 88: /* keep ::= KEEP intitemlist */
{ yymsp[-1].minor.yy403 = yymsp[0].minor.yy403; }
{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; }
break;
case 89: /* cache ::= CACHE INTEGER */
case 90: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==90);
......@@ -2523,221 +2525,221 @@ static YYACTIONTYPE yy_reduce(
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
case 104: /* db_optr ::= */
{setDefaultCreateDbOption(&yymsp[1].minor.yy246); yymsp[1].minor.yy246.dbType = TSDB_DB_TYPE_DEFAULT;}
{setDefaultCreateDbOption(&yymsp[1].minor.yy90); yymsp[1].minor.yy90.dbType = TSDB_DB_TYPE_DEFAULT;}
break;
case 105: /* db_optr ::= db_optr cache */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 106: /* db_optr ::= db_optr replica */
case 123: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==123);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 107: /* db_optr ::= db_optr quorum */
case 124: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==124);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 108: /* db_optr ::= db_optr days */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 109: /* db_optr ::= db_optr minrows */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 110: /* db_optr ::= db_optr maxrows */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 111: /* db_optr ::= db_optr blocks */
case 126: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==126);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 112: /* db_optr ::= db_optr ctime */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 113: /* db_optr ::= db_optr wal */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 114: /* db_optr ::= db_optr fsync */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 115: /* db_optr ::= db_optr comp */
case 127: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==127);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 116: /* db_optr ::= db_optr prec */
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.precision = yymsp[0].minor.yy0; }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.precision = yymsp[0].minor.yy0; }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 117: /* db_optr ::= db_optr keep */
case 125: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==125);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.keep = yymsp[0].minor.yy403; }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.keep = yymsp[0].minor.yy421; }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 118: /* db_optr ::= db_optr update */
case 128: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==128);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 119: /* db_optr ::= db_optr cachelast */
case 129: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==129);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 120: /* topic_optr ::= db_optr */
case 130: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==130);
{ yylhsminor.yy246 = yymsp[0].minor.yy246; yylhsminor.yy246.dbType = TSDB_DB_TYPE_TOPIC; }
yymsp[0].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[0].minor.yy90; yylhsminor.yy90.dbType = TSDB_DB_TYPE_TOPIC; }
yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
case 121: /* topic_optr ::= topic_optr partitions */
case 131: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==131);
{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy246 = yylhsminor.yy246;
{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
case 122: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yymsp[1].minor.yy246); yymsp[1].minor.yy246.dbType = TSDB_DB_TYPE_DEFAULT;}
{ setDefaultCreateDbOption(&yymsp[1].minor.yy90); yymsp[1].minor.yy90.dbType = TSDB_DB_TYPE_DEFAULT;}
break;
case 132: /* typename ::= ids */
{
yymsp[0].minor.yy0.type = 0;
tSetColumnType (&yylhsminor.yy363, &yymsp[0].minor.yy0);
tSetColumnType (&yylhsminor.yy183, &yymsp[0].minor.yy0);
}
yymsp[0].minor.yy363 = yylhsminor.yy363;
yymsp[0].minor.yy183 = yylhsminor.yy183;
break;
case 133: /* typename ::= ids LP signed RP */
{
if (yymsp[-1].minor.yy387 <= 0) {
if (yymsp[-1].minor.yy325 <= 0) {
yymsp[-3].minor.yy0.type = 0;
tSetColumnType(&yylhsminor.yy363, &yymsp[-3].minor.yy0);
tSetColumnType(&yylhsminor.yy183, &yymsp[-3].minor.yy0);
} else {
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy387; // negative value of name length
tSetColumnType(&yylhsminor.yy363, &yymsp[-3].minor.yy0);
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy325; // negative value of name length
tSetColumnType(&yylhsminor.yy183, &yymsp[-3].minor.yy0);
}
}
yymsp[-3].minor.yy363 = yylhsminor.yy363;
yymsp[-3].minor.yy183 = yylhsminor.yy183;
break;
case 134: /* typename ::= ids UNSIGNED */
{
yymsp[-1].minor.yy0.type = 0;
yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
tSetColumnType (&yylhsminor.yy363, &yymsp[-1].minor.yy0);
tSetColumnType (&yylhsminor.yy183, &yymsp[-1].minor.yy0);
}
yymsp[-1].minor.yy363 = yylhsminor.yy363;
yymsp[-1].minor.yy183 = yylhsminor.yy183;
break;
case 135: /* signed ::= INTEGER */
{ yylhsminor.yy387 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[0].minor.yy387 = yylhsminor.yy387;
{ yylhsminor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[0].minor.yy325 = yylhsminor.yy325;
break;
case 136: /* signed ::= PLUS INTEGER */
{ yymsp[-1].minor.yy387 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
{ yymsp[-1].minor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 137: /* signed ::= MINUS INTEGER */
{ yymsp[-1].minor.yy387 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
{ yymsp[-1].minor.yy325 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
break;
case 141: /* cmd ::= CREATE TABLE create_table_list */
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy56;}
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy438;}
break;
case 142: /* create_table_list ::= create_from_stable */
{
SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy84);
taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy152);
pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE;
yylhsminor.yy56 = pCreateTable;
yylhsminor.yy438 = pCreateTable;
}
yymsp[0].minor.yy56 = yylhsminor.yy56;
yymsp[0].minor.yy438 = yylhsminor.yy438;
break;
case 143: /* create_table_list ::= create_table_list create_from_stable */
{
taosArrayPush(yymsp[-1].minor.yy56->childTableInfo, &yymsp[0].minor.yy84);
yylhsminor.yy56 = yymsp[-1].minor.yy56;
taosArrayPush(yymsp[-1].minor.yy438->childTableInfo, &yymsp[0].minor.yy152);
yylhsminor.yy438 = yymsp[-1].minor.yy438;
}
yymsp[-1].minor.yy56 = yylhsminor.yy56;
yymsp[-1].minor.yy438 = yylhsminor.yy438;
break;
case 144: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{
yylhsminor.yy56 = tSetCreateTableInfo(yymsp[-1].minor.yy403, NULL, NULL, TSQL_CREATE_TABLE);
setSqlInfo(pInfo, yylhsminor.yy56, NULL, TSDB_SQL_CREATE_TABLE);
yylhsminor.yy438 = tSetCreateTableInfo(yymsp[-1].minor.yy421, NULL, NULL, TSQL_CREATE_TABLE);
setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0);
}
yymsp[-5].minor.yy56 = yylhsminor.yy56;
yymsp[-5].minor.yy438 = yylhsminor.yy438;
break;
case 145: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{
yylhsminor.yy56 = tSetCreateTableInfo(yymsp[-5].minor.yy403, yymsp[-1].minor.yy403, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, yylhsminor.yy56, NULL, TSDB_SQL_CREATE_TABLE);
yylhsminor.yy438 = tSetCreateTableInfo(yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
}
yymsp[-9].minor.yy56 = yylhsminor.yy56;
yymsp[-9].minor.yy438 = yylhsminor.yy438;
break;
case 146: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yylhsminor.yy84 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy403, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
yylhsminor.yy152 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy421, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
}
yymsp[-9].minor.yy84 = yylhsminor.yy84;
yymsp[-9].minor.yy152 = yylhsminor.yy152;
break;
case 147: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
{
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
yylhsminor.yy84 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy403, yymsp[-1].minor.yy403, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
yylhsminor.yy152 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
}
yymsp[-12].minor.yy84 = yylhsminor.yy84;
yymsp[-12].minor.yy152 = yylhsminor.yy152;
break;
case 148: /* tagNamelist ::= tagNamelist COMMA ids */
{taosArrayPush(yymsp[-2].minor.yy403, &yymsp[0].minor.yy0); yylhsminor.yy403 = yymsp[-2].minor.yy403; }
yymsp[-2].minor.yy403 = yylhsminor.yy403;
{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); yylhsminor.yy421 = yymsp[-2].minor.yy421; }
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
case 149: /* tagNamelist ::= ids */
{yylhsminor.yy403 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy403, &yymsp[0].minor.yy0);}
yymsp[0].minor.yy403 = yylhsminor.yy403;
{yylhsminor.yy421 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy0);}
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
case 150: /* create_table_args ::= ifnotexists ids cpxName AS select */
{
yylhsminor.yy56 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy224, TSQL_CREATE_STREAM);
setSqlInfo(pInfo, yylhsminor.yy56, NULL, TSDB_SQL_CREATE_TABLE);
yylhsminor.yy438 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy56, TSQL_CREATE_STREAM);
setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0);
}
yymsp[-4].minor.yy56 = yylhsminor.yy56;
yymsp[-4].minor.yy438 = yylhsminor.yy438;
break;
case 151: /* columnlist ::= columnlist COMMA column */
{taosArrayPush(yymsp[-2].minor.yy403, &yymsp[0].minor.yy363); yylhsminor.yy403 = yymsp[-2].minor.yy403; }
yymsp[-2].minor.yy403 = yylhsminor.yy403;
{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy183); yylhsminor.yy421 = yymsp[-2].minor.yy421; }
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
case 152: /* columnlist ::= column */
{yylhsminor.yy403 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy403, &yymsp[0].minor.yy363);}
yymsp[0].minor.yy403 = yylhsminor.yy403;
{yylhsminor.yy421 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy183);}
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
case 153: /* column ::= ids typename */
{
tSetColumnInfo(&yylhsminor.yy363, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy363);
tSetColumnInfo(&yylhsminor.yy183, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183);
}
yymsp[-1].minor.yy363 = yylhsminor.yy363;
yymsp[-1].minor.yy183 = yylhsminor.yy183;
break;
case 160: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy488 = yylhsminor.yy488;
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy430 = yylhsminor.yy430;
break;
case 161: /* tagitem ::= NOW */
{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0);}
yymsp[0].minor.yy488 = yylhsminor.yy488;
{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0);}
yymsp[0].minor.yy430 = yylhsminor.yy430;
break;
case 162: /* tagitem ::= MINUS INTEGER */
case 163: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==163);
......@@ -2747,56 +2749,56 @@ static YYACTIONTYPE yy_reduce(
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.yy488, &yymsp[-1].minor.yy0);
tVariantCreate(&yylhsminor.yy430, &yymsp[-1].minor.yy0);
}
yymsp[-1].minor.yy488 = yylhsminor.yy488;
yymsp[-1].minor.yy430 = yylhsminor.yy430;
break;
case 166: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{
yylhsminor.yy224 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy403, yymsp[-11].minor.yy114, yymsp[-10].minor.yy260, yymsp[-4].minor.yy403, yymsp[-2].minor.yy403, &yymsp[-9].minor.yy222, &yymsp[-7].minor.yy365, &yymsp[-6].minor.yy544, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy403, &yymsp[0].minor.yy404, &yymsp[-1].minor.yy404, yymsp[-3].minor.yy260);
yylhsminor.yy56 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy421, yymsp[-11].minor.yy8, yymsp[-10].minor.yy439, yymsp[-4].minor.yy421, yymsp[-2].minor.yy421, &yymsp[-9].minor.yy400, &yymsp[-7].minor.yy147, &yymsp[-6].minor.yy40, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy421, &yymsp[0].minor.yy166, &yymsp[-1].minor.yy166, yymsp[-3].minor.yy439);
}
yymsp[-13].minor.yy224 = yylhsminor.yy224;
yymsp[-13].minor.yy56 = yylhsminor.yy56;
break;
case 167: /* select ::= LP select RP */
{yymsp[-2].minor.yy224 = yymsp[-1].minor.yy224;}
{yymsp[-2].minor.yy56 = yymsp[-1].minor.yy56;}
break;
case 168: /* union ::= select */
{ yylhsminor.yy403 = setSubclause(NULL, yymsp[0].minor.yy224); }
yymsp[0].minor.yy403 = yylhsminor.yy403;
{ yylhsminor.yy421 = setSubclause(NULL, yymsp[0].minor.yy56); }
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
case 169: /* union ::= union UNION ALL select */
{ yylhsminor.yy403 = appendSelectClause(yymsp[-3].minor.yy403, yymsp[0].minor.yy224); }
yymsp[-3].minor.yy403 = yylhsminor.yy403;
{ yylhsminor.yy421 = appendSelectClause(yymsp[-3].minor.yy421, yymsp[0].minor.yy56); }
yymsp[-3].minor.yy421 = yylhsminor.yy421;
break;
case 170: /* cmd ::= union */
{ setSqlInfo(pInfo, yymsp[0].minor.yy403, NULL, TSDB_SQL_SELECT); }
{ setSqlInfo(pInfo, yymsp[0].minor.yy421, NULL, TSDB_SQL_SELECT); }
break;
case 171: /* select ::= SELECT selcollist */
{
yylhsminor.yy224 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy403, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
yylhsminor.yy56 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy421, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
yymsp[-1].minor.yy224 = yylhsminor.yy224;
yymsp[-1].minor.yy56 = yylhsminor.yy56;
break;
case 172: /* sclp ::= selcollist COMMA */
{yylhsminor.yy403 = yymsp[-1].minor.yy403;}
yymsp[-1].minor.yy403 = yylhsminor.yy403;
{yylhsminor.yy421 = yymsp[-1].minor.yy421;}
yymsp[-1].minor.yy421 = yylhsminor.yy421;
break;
case 173: /* sclp ::= */
case 205: /* orderby_opt ::= */ yytestcase(yyruleno==205);
{yymsp[1].minor.yy403 = 0;}
{yymsp[1].minor.yy421 = 0;}
break;
case 174: /* selcollist ::= sclp distinct expr as */
{
yylhsminor.yy403 = tSqlExprListAppend(yymsp[-3].minor.yy403, yymsp[-1].minor.yy260, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
yylhsminor.yy421 = tSqlExprListAppend(yymsp[-3].minor.yy421, yymsp[-1].minor.yy439, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
}
yymsp[-3].minor.yy403 = yylhsminor.yy403;
yymsp[-3].minor.yy421 = yylhsminor.yy421;
break;
case 175: /* selcollist ::= sclp STAR */
{
tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL);
yylhsminor.yy403 = tSqlExprListAppend(yymsp[-1].minor.yy403, pNode, 0, 0);
yylhsminor.yy421 = tSqlExprListAppend(yymsp[-1].minor.yy421, pNode, 0, 0);
}
yymsp[-1].minor.yy403 = yylhsminor.yy403;
yymsp[-1].minor.yy421 = yylhsminor.yy421;
break;
case 176: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
......@@ -2814,85 +2816,85 @@ static YYACTIONTYPE yy_reduce(
break;
case 181: /* from ::= FROM tablelist */
case 182: /* from ::= FROM sub */ yytestcase(yyruleno==182);
{yymsp[-1].minor.yy114 = yymsp[0].minor.yy114;}
{yymsp[-1].minor.yy8 = yymsp[0].minor.yy8;}
break;
case 183: /* sub ::= LP union RP */
{yymsp[-2].minor.yy114 = addSubqueryElem(NULL, yymsp[-1].minor.yy403, NULL);}
{yymsp[-2].minor.yy8 = addSubqueryElem(NULL, yymsp[-1].minor.yy421, NULL);}
break;
case 184: /* sub ::= LP union RP ids */
{yymsp[-3].minor.yy114 = addSubqueryElem(NULL, yymsp[-2].minor.yy403, &yymsp[0].minor.yy0);}
{yymsp[-3].minor.yy8 = addSubqueryElem(NULL, yymsp[-2].minor.yy421, &yymsp[0].minor.yy0);}
break;
case 185: /* sub ::= sub COMMA LP union RP ids */
{yylhsminor.yy114 = addSubqueryElem(yymsp[-5].minor.yy114, yymsp[-2].minor.yy403, &yymsp[0].minor.yy0);}
yymsp[-5].minor.yy114 = yylhsminor.yy114;
{yylhsminor.yy8 = addSubqueryElem(yymsp[-5].minor.yy8, yymsp[-2].minor.yy421, &yymsp[0].minor.yy0);}
yymsp[-5].minor.yy8 = yylhsminor.yy8;
break;
case 186: /* tablelist ::= ids cpxName */
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy114 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
yylhsminor.yy8 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
}
yymsp[-1].minor.yy114 = yylhsminor.yy114;
yymsp[-1].minor.yy8 = yylhsminor.yy8;
break;
case 187: /* tablelist ::= ids cpxName ids */
{
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy114 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
yylhsminor.yy8 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[-2].minor.yy114 = yylhsminor.yy114;
yymsp[-2].minor.yy8 = yylhsminor.yy8;
break;
case 188: /* tablelist ::= tablelist COMMA ids cpxName */
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy114 = setTableNameList(yymsp[-3].minor.yy114, &yymsp[-1].minor.yy0, NULL);
yylhsminor.yy8 = setTableNameList(yymsp[-3].minor.yy8, &yymsp[-1].minor.yy0, NULL);
}
yymsp[-3].minor.yy114 = yylhsminor.yy114;
yymsp[-3].minor.yy8 = yylhsminor.yy8;
break;
case 189: /* tablelist ::= tablelist COMMA ids cpxName ids */
{
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy114 = setTableNameList(yymsp[-4].minor.yy114, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
yylhsminor.yy8 = setTableNameList(yymsp[-4].minor.yy8, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[-4].minor.yy114 = yylhsminor.yy114;
yymsp[-4].minor.yy8 = yylhsminor.yy8;
break;
case 190: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 191: /* interval_option ::= intervalKey LP tmvar RP */
{yylhsminor.yy222.interval = yymsp[-1].minor.yy0; yylhsminor.yy222.offset.n = 0; yylhsminor.yy222.token = yymsp[-3].minor.yy202;}
yymsp[-3].minor.yy222 = yylhsminor.yy222;
{yylhsminor.yy400.interval = yymsp[-1].minor.yy0; yylhsminor.yy400.offset.n = 0; yylhsminor.yy400.token = yymsp[-3].minor.yy104;}
yymsp[-3].minor.yy400 = yylhsminor.yy400;
break;
case 192: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{yylhsminor.yy222.interval = yymsp[-3].minor.yy0; yylhsminor.yy222.offset = yymsp[-1].minor.yy0; yylhsminor.yy222.token = yymsp[-5].minor.yy202;}
yymsp[-5].minor.yy222 = yylhsminor.yy222;
{yylhsminor.yy400.interval = yymsp[-3].minor.yy0; yylhsminor.yy400.offset = yymsp[-1].minor.yy0; yylhsminor.yy400.token = yymsp[-5].minor.yy104;}
yymsp[-5].minor.yy400 = yylhsminor.yy400;
break;
case 193: /* interval_option ::= */
{memset(&yymsp[1].minor.yy222, 0, sizeof(yymsp[1].minor.yy222));}
{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));}
break;
case 194: /* intervalKey ::= INTERVAL */
{yymsp[0].minor.yy202 = TK_INTERVAL;}
{yymsp[0].minor.yy104 = TK_INTERVAL;}
break;
case 195: /* intervalKey ::= EVERY */
{yymsp[0].minor.yy202 = TK_EVERY; }
{yymsp[0].minor.yy104 = TK_EVERY; }
break;
case 196: /* session_option ::= */
{yymsp[1].minor.yy365.col.n = 0; yymsp[1].minor.yy365.gap.n = 0;}
{yymsp[1].minor.yy147.col.n = 0; yymsp[1].minor.yy147.gap.n = 0;}
break;
case 197: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
yymsp[-6].minor.yy365.col = yymsp[-4].minor.yy0;
yymsp[-6].minor.yy365.gap = yymsp[-1].minor.yy0;
yymsp[-6].minor.yy147.col = yymsp[-4].minor.yy0;
yymsp[-6].minor.yy147.gap = yymsp[-1].minor.yy0;
}
break;
case 198: /* windowstate_option ::= */
{ yymsp[1].minor.yy544.col.n = 0; yymsp[1].minor.yy544.col.z = NULL;}
{ yymsp[1].minor.yy40.col.n = 0; yymsp[1].minor.yy40.col.z = NULL;}
break;
case 199: /* windowstate_option ::= STATE_WINDOW LP ids RP */
{ yymsp[-3].minor.yy544.col = yymsp[-1].minor.yy0; }
{ yymsp[-3].minor.yy40.col = yymsp[-1].minor.yy0; }
break;
case 200: /* fill_opt ::= */
{ yymsp[1].minor.yy403 = 0; }
{ yymsp[1].minor.yy421 = 0; }
break;
case 201: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
......@@ -2900,14 +2902,14 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-3].minor.yy0.type);
tVariantCreate(&A, &yymsp[-3].minor.yy0);
tVariantListInsert(yymsp[-1].minor.yy403, &A, -1, 0);
yymsp[-5].minor.yy403 = yymsp[-1].minor.yy403;
tVariantListInsert(yymsp[-1].minor.yy421, &A, -1, 0);
yymsp[-5].minor.yy421 = yymsp[-1].minor.yy421;
}
break;
case 202: /* fill_opt ::= FILL LP ID RP */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-3].minor.yy403 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
yymsp[-3].minor.yy421 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
}
break;
case 203: /* sliding_opt ::= SLIDING LP tmvar RP */
......@@ -2917,235 +2919,235 @@ static YYACTIONTYPE yy_reduce(
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
break;
case 206: /* orderby_opt ::= ORDER BY sortlist */
{yymsp[-2].minor.yy403 = yymsp[0].minor.yy403;}
{yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;}
break;
case 207: /* sortlist ::= sortlist COMMA item sortorder */
{
yylhsminor.yy403 = tVariantListAppend(yymsp[-3].minor.yy403, &yymsp[-1].minor.yy488, yymsp[0].minor.yy70);
yylhsminor.yy421 = tVariantListAppend(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96);
}
yymsp[-3].minor.yy403 = yylhsminor.yy403;
yymsp[-3].minor.yy421 = yylhsminor.yy421;
break;
case 208: /* sortlist ::= item sortorder */
{
yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[-1].minor.yy488, yymsp[0].minor.yy70);
yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96);
}
yymsp[-1].minor.yy403 = yylhsminor.yy403;
yymsp[-1].minor.yy421 = yylhsminor.yy421;
break;
case 209: /* item ::= ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
tVariantCreate(&yylhsminor.yy488, &yymsp[-1].minor.yy0);
tVariantCreate(&yylhsminor.yy430, &yymsp[-1].minor.yy0);
}
yymsp[-1].minor.yy488 = yylhsminor.yy488;
yymsp[-1].minor.yy430 = yylhsminor.yy430;
break;
case 210: /* sortorder ::= ASC */
{ yymsp[0].minor.yy70 = TSDB_ORDER_ASC; }
{ yymsp[0].minor.yy96 = TSDB_ORDER_ASC; }
break;
case 211: /* sortorder ::= DESC */
{ yymsp[0].minor.yy70 = TSDB_ORDER_DESC;}
{ yymsp[0].minor.yy96 = TSDB_ORDER_DESC;}
break;
case 212: /* sortorder ::= */
{ yymsp[1].minor.yy70 = TSDB_ORDER_ASC; }
{ yymsp[1].minor.yy96 = TSDB_ORDER_ASC; }
break;
case 213: /* groupby_opt ::= */
{ yymsp[1].minor.yy403 = 0;}
{ yymsp[1].minor.yy421 = 0;}
break;
case 214: /* groupby_opt ::= GROUP BY grouplist */
{ yymsp[-2].minor.yy403 = yymsp[0].minor.yy403;}
{ yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;}
break;
case 215: /* grouplist ::= grouplist COMMA item */
{
yylhsminor.yy403 = tVariantListAppend(yymsp[-2].minor.yy403, &yymsp[0].minor.yy488, -1);
yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1);
}
yymsp[-2].minor.yy403 = yylhsminor.yy403;
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
case 216: /* grouplist ::= item */
{
yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1);
yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1);
}
yymsp[0].minor.yy403 = yylhsminor.yy403;
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
case 217: /* having_opt ::= */
case 227: /* where_opt ::= */ yytestcase(yyruleno==227);
case 269: /* expritem ::= */ yytestcase(yyruleno==269);
{yymsp[1].minor.yy260 = 0;}
{yymsp[1].minor.yy439 = 0;}
break;
case 218: /* having_opt ::= HAVING expr */
case 228: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==228);
{yymsp[-1].minor.yy260 = yymsp[0].minor.yy260;}
{yymsp[-1].minor.yy439 = yymsp[0].minor.yy439;}
break;
case 219: /* limit_opt ::= */
case 223: /* slimit_opt ::= */ yytestcase(yyruleno==223);
{yymsp[1].minor.yy404.limit = -1; yymsp[1].minor.yy404.offset = 0;}
{yymsp[1].minor.yy166.limit = -1; yymsp[1].minor.yy166.offset = 0;}
break;
case 220: /* limit_opt ::= LIMIT signed */
case 224: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==224);
{yymsp[-1].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-1].minor.yy404.offset = 0;}
{yymsp[-1].minor.yy166.limit = yymsp[0].minor.yy325; yymsp[-1].minor.yy166.offset = 0;}
break;
case 221: /* limit_opt ::= LIMIT signed OFFSET signed */
{ yymsp[-3].minor.yy404.limit = yymsp[-2].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[0].minor.yy387;}
{ yymsp[-3].minor.yy166.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[0].minor.yy325;}
break;
case 222: /* limit_opt ::= LIMIT signed COMMA signed */
{ yymsp[-3].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[-2].minor.yy387;}
{ yymsp[-3].minor.yy166.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[-2].minor.yy325;}
break;
case 225: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
{yymsp[-3].minor.yy404.limit = yymsp[-2].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[0].minor.yy387;}
{yymsp[-3].minor.yy166.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[0].minor.yy325;}
break;
case 226: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[-2].minor.yy387;}
{yymsp[-3].minor.yy166.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[-2].minor.yy325;}
break;
case 229: /* expr ::= LP expr RP */
{yylhsminor.yy260 = yymsp[-1].minor.yy260; yylhsminor.yy260->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy260->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = yymsp[-1].minor.yy439; yylhsminor.yy439->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy439->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 230: /* expr ::= ID */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 231: /* expr ::= ID DOT ID */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 232: /* expr ::= ID DOT STAR */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 233: /* expr ::= INTEGER */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 234: /* expr ::= MINUS INTEGER */
case 235: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==235);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy260 = yylhsminor.yy260;
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy439 = yylhsminor.yy439;
break;
case 236: /* expr ::= FLOAT */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 237: /* expr ::= MINUS FLOAT */
case 238: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==238);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
yymsp[-1].minor.yy260 = yylhsminor.yy260;
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
yymsp[-1].minor.yy439 = yylhsminor.yy439;
break;
case 239: /* expr ::= STRING */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 240: /* expr ::= NOW */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 241: /* expr ::= VARIABLE */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 242: /* expr ::= PLUS VARIABLE */
case 243: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==243);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
yymsp[-1].minor.yy260 = yylhsminor.yy260;
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
yymsp[-1].minor.yy439 = yylhsminor.yy439;
break;
case 244: /* expr ::= BOOL */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 245: /* expr ::= NULL */
{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 246: /* expr ::= ID LP exprlist RP */
{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy260 = tSqlExprCreateFunction(yymsp[-1].minor.yy403, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy260 = yylhsminor.yy260;
{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy439 = tSqlExprCreateFunction(yymsp[-1].minor.yy421, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy439 = yylhsminor.yy439;
break;
case 247: /* expr ::= ID LP STAR RP */
{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy260 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy260 = yylhsminor.yy260;
{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy439 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy439 = yylhsminor.yy439;
break;
case 248: /* expr ::= expr IS NULL */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, NULL, TK_ISNULL);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, NULL, TK_ISNULL);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 249: /* expr ::= expr IS NOT NULL */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-3].minor.yy260, NULL, TK_NOTNULL);}
yymsp[-3].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-3].minor.yy439, NULL, TK_NOTNULL);}
yymsp[-3].minor.yy439 = yylhsminor.yy439;
break;
case 250: /* expr ::= expr LT expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_LT);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LT);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 251: /* expr ::= expr GT expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_GT);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GT);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 252: /* expr ::= expr LE expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_LE);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LE);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 253: /* expr ::= expr GE expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_GE);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GE);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 254: /* expr ::= expr NE expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_NE);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NE);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 255: /* expr ::= expr EQ expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_EQ);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_EQ);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 256: /* expr ::= expr BETWEEN expr AND expr */
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy260); yylhsminor.yy260 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy260, yymsp[-2].minor.yy260, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy260, TK_LE), TK_AND);}
yymsp[-4].minor.yy260 = yylhsminor.yy260;
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy439); yylhsminor.yy439 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy439, yymsp[-2].minor.yy439, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy439, TK_LE), TK_AND);}
yymsp[-4].minor.yy439 = yylhsminor.yy439;
break;
case 257: /* expr ::= expr AND expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_AND);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_AND);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 258: /* expr ::= expr OR expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_OR); }
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_OR); }
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 259: /* expr ::= expr PLUS expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_PLUS); }
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_PLUS); }
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 260: /* expr ::= expr MINUS expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_MINUS); }
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MINUS); }
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 261: /* expr ::= expr STAR expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_STAR); }
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_STAR); }
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 262: /* expr ::= expr SLASH expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_DIVIDE);}
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_DIVIDE);}
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 263: /* expr ::= expr REM expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_REM); }
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_REM); }
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 264: /* expr ::= expr LIKE expr */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_LIKE); }
yymsp[-2].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LIKE); }
yymsp[-2].minor.yy439 = yylhsminor.yy439;
break;
case 265: /* expr ::= expr IN LP exprlist RP */
{yylhsminor.yy260 = tSqlExprCreate(yymsp[-4].minor.yy260, (tSqlExpr*)yymsp[-1].minor.yy403, TK_IN); }
yymsp[-4].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = tSqlExprCreate(yymsp[-4].minor.yy439, (tSqlExpr*)yymsp[-1].minor.yy421, TK_IN); }
yymsp[-4].minor.yy439 = yylhsminor.yy439;
break;
case 266: /* exprlist ::= exprlist COMMA expritem */
{yylhsminor.yy403 = tSqlExprListAppend(yymsp[-2].minor.yy403,yymsp[0].minor.yy260,0, 0);}
yymsp[-2].minor.yy403 = yylhsminor.yy403;
{yylhsminor.yy421 = tSqlExprListAppend(yymsp[-2].minor.yy421,yymsp[0].minor.yy439,0, 0);}
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
case 267: /* exprlist ::= expritem */
{yylhsminor.yy403 = tSqlExprListAppend(0,yymsp[0].minor.yy260,0, 0);}
yymsp[0].minor.yy403 = yylhsminor.yy403;
{yylhsminor.yy421 = tSqlExprListAppend(0,yymsp[0].minor.yy439,0, 0);}
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
case 268: /* expritem ::= expr */
{yylhsminor.yy260 = yymsp[0].minor.yy260;}
yymsp[0].minor.yy260 = yylhsminor.yy260;
{yylhsminor.yy439 = yymsp[0].minor.yy439;}
yymsp[0].minor.yy439 = yylhsminor.yy439;
break;
case 270: /* cmd ::= RESET QUERY CACHE */
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
......@@ -3156,7 +3158,7 @@ static YYACTIONTYPE yy_reduce(
case 272: /* 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.yy403, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
......@@ -3174,14 +3176,14 @@ static YYACTIONTYPE yy_reduce(
case 274: /* 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.yy403, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
case 275: /* 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.yy403, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
......@@ -3216,7 +3218,7 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy488, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy430, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
......@@ -3225,14 +3227,14 @@ static YYACTIONTYPE yy_reduce(
case 279: /* 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.yy403, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
case 280: /* 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.yy403, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
......@@ -3250,14 +3252,14 @@ static YYACTIONTYPE yy_reduce(
case 282: /* 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.yy403, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
case 283: /* 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.yy403, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
......@@ -3292,7 +3294,7 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy488, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy430, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
......@@ -3301,7 +3303,7 @@ static YYACTIONTYPE yy_reduce(
case 287: /* 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.yy403, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
......
......@@ -20,7 +20,7 @@
extern "C" {
#endif
#define TSDB_CFG_MAX_NUM 120
#define TSDB_CFG_MAX_NUM 121
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
......
......@@ -73,21 +73,18 @@ class TDTestCase:
tdSql.error(sql)
sql = 'select abs_max(c2) from db.stb'
tdSql.query(sql)
tdSql.checkData(0,0,1410065607)
tdSql.checkData(0,0,10000000199)
def test_udf_values(self):
tdSql.execute("drop function abs_max")
tdSql.execute("create function add_one as '/tmp/add_one.so' outputtype int")
tdSql.execute("create aggregate function abs_max as '/tmp/abs_max.so' outputtype bigint;")
tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype int bufsize 128;")
tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype bigint;")
# UDF bug no 1 -> follow 3 cases about this bug ;
# tdSql.error("create aggregate function max as '/tmp/abs_max.so' outputtype bigint ;")
# tdSql.error("create aggregate function avg as '/tmp/abs_max.so' outputtype bigint ;")
# tdSql.error("create aggregate function dbs as '/tmp/abs_max.so' outputtype bigint ;")
tdSql.execute("drop database if exists test")
tdSql.execute("create database test")
tdSql.execute("use test")
......@@ -117,7 +114,7 @@ class TDTestCase:
tdSql.execute("insert into bound values(%d, %d , %f, %d , %s)"%(epoch_time+1000,intdata2+1,float(intdata2+1),bigintdata2+1,"'binary"+str(intdata2+1)+"'"))
# check super table calculation results
tdSql.query("select add_one(id) from st")
tdSql.query("select add_one(id) test from st")
tdSql.checkData(0,0,1)
tdSql.checkData(1,0,2)
tdSql.checkData(4,0,5)
......@@ -157,29 +154,266 @@ class TDTestCase:
tdLog.info(" ====== unexpected error occured about UDF function =====")
sys.exit()
# UDF bug no 2 -> values of abs_max not inconsistent from common table and stable.
# tdSql.query("select abs_max(val) from st") # result is 0 rows
# tdSql.query("select abs_max(val) from tb1")
# tdSql.checkData(0,0,0) # this is error result
# tdSql.query("select sum_double(val) from st") # result is 0 rows
# tdSql.query("select sum_double(val) from tb1")
# tdSql.checkData(0,0,0) # this is error result
tdSql.query("select abs_max(val) from st")
tdSql.query("select abs_max(val) from tb1")
tdSql.checkRows(0)
tdSql.query("select sum_double(val) from st")
tdSql.query("select sum_double(val) from tb1")
tdSql.checkRows(0)
# UDF bug no 3 -> values of abs_max will error for boundary number
# check super table calculation results
# tdSql.query("select abs_max(number) from st")
# tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from st")
tdSql.checkData(0,0,9223372036854775807)
# check common table calculation results
tdSql.query("select abs_max(number) from tb1")
tdSql.checkData(0,0,400)
tdSql.query("select abs_max(number) from tb2")
tdSql.checkData(0,0,400)
tdSql.execute("select add_one(id) from st limit 10 offset 2")
tdSql.query("select add_one(id) from st where ts > 1604298064000 and ts < 1604298064020 ")
tdSql.checkData(0,0,1)
tdSql.checkData(1,0,-2147483644)
tdSql.query("select add_one(id) from tb1 where ts > 1604298064000 and ts < 1604298064020 ")
tdSql.checkData(0,0,1)
tdSql.query("select sum_double(id) from st where ts > 1604298064030 and ts < 1604298064060 ")
tdSql.checkData(0,0,14)
tdSql.query("select sum_double(id) from tb2 where ts > 1604298064030 and ts < 1604298064060 ")
tdSql.checkRows(0)
tdSql.query("select add_one(id) from st where ts = 1604298064000 ")
tdSql.checkData(0,0,-2147483645)
tdSql.query("select add_one(id) from st where ts > 1604298064000 and id in (2,3) and ind =1;")
tdSql.checkData(0,0,3)
tdSql.checkData(1,0,4)
tdSql.query("select id , add_one(id) from tb1 where ts > 1604298064000 and id in (2,3)")
tdSql.checkData(0,0,2)
tdSql.checkData(0,1,3)
tdSql.checkData(1,0,3)
tdSql.checkData(1,1,4)
tdSql.query("select sum_double(id) from tb1 where ts > 1604298064000 and id in (2,3)")
tdSql.checkData(0,0,10)
tdSql.query("select sum_double(id) from st where ts > 1604298064000 and id in (2,3) and ind =1")
tdSql.checkData(0,0,10)
tdSql.query("select abs_max(number) from st where ts > 1604298064000 and id in (2,3) and ind =1")
tdSql.checkData(0,0,300)
tdSql.query("select sum_double(id) from st where ts = 1604298064030 ")
tdSql.checkData(0,0,4)
tdSql.query("select abs_max(number) from st where ts = 1604298064100 ")
tdSql.checkData(0,0,9223372036854775806)
tdSql.query("select abs_max(number) from tb2 where ts = 1604298064100 ")
tdSql.checkData(0,0,400)
tdSql.query("select sum_double(id) from tb2 where ts = 1604298064100 ")
tdSql.checkData(0,0,8)
tdSql.query("select add_one(id) from st where ts >= 1604298064000 and ts <= 1604298064010")
tdSql.checkData(0,0,1)
tdSql.checkData(1,0,-2147483645)
tdSql.checkData(2,0,-2147483644)
tdSql.query("select add_one(id) from tb1 where ts >= 1604298064000 and ts <= 1604298064010")
tdSql.checkData(0,0,1)
tdSql.query("select sum_double(id) from st where ts >= 1604298064030 and ts <= 1604298064050")
tdSql.checkData(0,0,18)
tdSql.query("select sum_double(id) from tb2 where ts >= 1604298064030 and ts <= 1604298064100")
tdSql.checkData(0,0,20)
tdSql.query("select abs_max(number) from tb2 where ts >= 1604298064030 and ts <= 1604298064100")
tdSql.checkData(0,0,400)
tdSql.query("select abs_max(number) from st where ts >= 1604298064030 and ts <= 1604298064100")
tdSql.checkData(0,0,9223372036854775806)
tdSql.query("select id from st where id != 0 and ts >=1604298064070")
tdSql.checkData(0,0,1)
tdSql.query("select add_one(id) from st where id != 0 and ts >=1604298064070")
tdSql.checkData(0,0,2)
tdSql.query("select add_one(id) from st where id <> 0 and ts >=1604298064010")
tdSql.checkData(0,0,2)
tdSql.query("select sum_double(id) from st where id in (2,3,4) and ts >=1604298064070")
tdSql.checkData(0,0,18)
tdSql.query("select sum_double(id) from tb2 where id in (2,3,4) and ts >=1604298064070")
tdSql.checkData(0,0,18)
tdSql.query("select abs_max(number) from st where id in (2,3,4) and ts >=1604298064070")
tdSql.checkData(0,0,400)
tdSql.query("select add_one(id) from st where id = 0 ")
tdSql.checkData(0,0,1)
tdSql.checkData(1,0,1)
tdSql.query("select add_one(id) from tb2 where id = 0 ")
tdSql.checkData(0,0,1)
tdSql.query("select sum_double(id) from st where id = 1")
tdSql.checkData(0,0,4)
tdSql.query("select sum_double(id) from tb2 where id = 1")
tdSql.checkData(0,0,2)
tdSql.query("select add_one(id) from st where id is not null and ts >=1604298065000 ")
tdSql.checkData(0,0,None)
tdSql.query("select abs_max(number) from st where id is not null and ts >=1604298065000 ")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from bound where id is not null and ts >=1604298065000 ")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select sum_double(id) from st where id is not null and ts >=1604298064000 and ind = 1 ")
tdSql.checkData(0,0,20)
tdSql.query("select sum_double(id) from tb1 where id is not null and ts >=1604298064000 ")
tdSql.checkData(0,0,20)
tdSql.query("select add_one(id) from st where id is null and ts >=1604298065000 ")
tdSql.checkRows(0)
tdSql.query("select abs_max(number) from st where id is null and ts >=1604298065000 ")
tdSql.checkRows(0)
tdSql.query("select abs_max(number) from tb1 where id is null and ts >=1604298065000 ")
tdSql.checkRows(0)
tdSql.query("select add_one(id) from bound where id is not null and ts >=1604298065000;")
tdSql.checkData(0,0,None)
tdSql.query("select id,add_one(id) from bound;")
tdSql.checkRowCol(4,2)
tdSql.checkData(3,1,None)
tdSql.query("select add_one(id) from st where ts between 1604298064000 and 1604298064010")
tdSql.checkRows(3)
tdSql.query("select add_one(id) from tb1 where ts between 1604298064000 and 1604298064010")
tdSql.checkRows(1)
tdSql.query("select sum_double(id) from st where ts between 1604298064000 and 1604298064010 and id>=0")
tdSql.checkData(0,0,0)
tdSql.query("select sum_double(id) from tb1 where ts between 1604298064000 and 1604298064010 and id>=0")
tdSql.checkData(0,0,0)
tdSql.query("select add_one(id) from st where id in (1,2)")
tdSql.checkData(0,0,2)
tdSql.checkData(1,0,3)
tdSql.checkData(2,0,2)
tdSql.checkData(3,0,3)
tdSql.checkRows(4)
tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(1s)")
tdSql.checkData(0,1,20)
tdSql.error("select sum_double(id) from st where ts < now and ind =1 interval(3s) sliding (1s) fill (NULL) ")
tdSql.error("select sum_double(id) from st session(ts, 1s)")
tdSql.query("select sum_double(id) from tb1 session(ts, 1s)")
tdSql.checkData(0,1,20)
# intervals sliding values calculation
tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2")
tdSql.checkData(0,1,20)
tdSql.checkData(1,1,20)
# scalar_function can't work when using interval and sliding =========
tdSql.error("select add_one(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2 ")
tdSql.error("select add_one(id) from st order by ts")
tdSql.error("select ts,id,add_one(id) from st order by ts asc;")
# # UDF not support order by
tdSql.error("select ts,id,add_one(id) from st order by ts desc;")
# UDF function union all
tdSql.query("select add_one(id) from tb1 union all select add_one(id) from tb2;")
tdSql.checkRows(10)
tdSql.checkData(0,0,1)
tdSql.checkData(5,0,1)
tdSql.query("select sum_double(id) from tb1 union all select sum_double(id) from tb2;")
tdSql.checkRows(2)
tdSql.checkData(0,0,20)
tdSql.checkData(1,0,20)
tdSql.query("select abs_max(number) from tb1 union all select abs_max(number) from bound;")
tdSql.checkRows(2)
tdSql.checkData(0,0,400)
tdSql.checkData(1,0,9223372036854775807)
tdSql.execute("create stable stb (ts timestamp,id int , val double , number bigint, chars binary(200)) tags (ind int)")
tdSql.execute("create table stb1 using stb tags(3)")
tdSql.execute("insert into stb1 values(1604298064000 , 1 , 1.0 , 10000 ,'chars')")
tdSql.query("select add_one(id) from st union all select add_one(id) from stb;")
tdSql.checkRows(15)
tdSql.checkData(13,0,None)
tdSql.checkData(14,0,2)
tdSql.query("select add_one(id) from st union all select add_one(id) from stb1;")
tdSql.checkRows(15)
tdSql.checkData(13,0,None)
tdSql.checkData(14,0,2)
tdSql.query("select id ,add_one(id) from tb1 union all select id ,add_one(id) from stb1;")
tdSql.checkRows(6)
tdSql.checkData(0,0,0)
tdSql.checkData(0,1,1)
tdSql.checkData(1,0,1)
tdSql.checkData(1,1,2)
# aggregate union all for different stables
tdSql.query("select sum_double(id) from st union all select sum_double(id) from stb;")
tdSql.checkRows(2)
tdSql.checkData(0,0,44)
tdSql.checkData(1,0,2)
tdSql.query("select id from st union all select id from stb1;")
tdSql.checkRows(15)
tdSql.query("select id from tb1 union all select id from stb1")
tdSql.checkRows(6)
tdSql.query("select sum_double(id) from tb1 union all select sum_double(id) from stb")
tdSql.checkData(0,0,20)
tdSql.checkData(1,0,2)
tdSql.query("select sum_double(id) from st union all select sum_double(id) from stb1;")
tdSql.checkRows(2)
tdSql.checkData(0,0,44)
tdSql.checkData(1,0,2)
tdSql.query("select abs_max(number) from st union all select abs_max(number) from stb;")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from bound union all select abs_max(number) from stb1;")
tdSql.checkData(0,0,9223372036854775807)
tdSql.checkData(1,0,10000)
tdSql.query("select abs_max(number) from st union all select abs_max(number) from stb1;")
tdSql.checkData(0,0,9223372036854775807)
tdSql.checkData(1,0,10000)
# group by for aggegate function ;
tdSql.query("select sum_double(id) from st group by tbname;")
tdSql.checkData(0,0,20)
tdSql.checkData(0,1,'tb1')
tdSql.checkData(1,0,20)
tdSql.checkData(1,1,'tb2')
tdSql.query("select sum_double(id) from st group by id;")
tdSql.checkRows(9)
tdSql.query("select sum_double(id) from st group by ts")
tdSql.checkRows(12)
tdSql.query("select sum_double(id) from st group by ind")
tdSql.checkRows(3)
tdSql.query("select sum_double(id) from st group by tbname order by ts asc;")
tdSql.query("select abs_max(number) from st group by id")
tdSql.checkRows(9)
tdSql.checkData(0,0,9223372036854775806)
tdSql.checkData(8,0,9223372036854775807)
tdSql.query("select abs_max(number) from st group by ts")
tdSql.checkRows(12)
tdSql.checkData(11,0,9223372036854775807)
tdSql.checkData(1,0,9223372036854775805)
tdSql.query("select abs_max(number) from st group by ind")
tdSql.checkRows(3)
tdSql.checkData(0,0,400)
tdSql.checkData(2,0,9223372036854775807)
# UDF join
tdSql.query("select add_one(tb1.id),add_one(bound.id) from tb1,bound where tb1.ts=bound.ts;")
tdSql.checkData(0,0,1)
tdSql.checkData(0,1,-2147483644)
tdSql.query("select stb1.ts,add_one(stb1.id),bound.ts,add_one(bound.id) from stb1,bound where stb1.ts=bound.ts")
tdSql.checkData(0,1,2)
tdSql.checkData(0,3,-2147483645)
tdSql.query("select st.ts,add_one(st.id),stb.ts,add_one(stb.id) from st,stb where st.ts=stb.ts and st.ind=stb.ind")
tdSql.checkData(0,1,-2147483645)
tdSql.checkData(0,3,2)
tdSql.query("select sum_double(tb1.id),sum_double(bound.id) from tb1,bound where tb1.ts=bound.ts;")
tdSql.checkData(0,0,0)
tdSql.checkData(0,1,-4294967290)
tdSql.query("select sum_double(stb1.id),sum_double(bound.id) from stb1,bound where stb1.ts=bound.ts")
tdSql.checkData(0,0,2)
tdSql.checkData(0,1,-4294967292)
#UDF join for stables
tdSql.query("select sum_double(st.id),sum_double(stb.id) from st,stb where st.ts=stb.ts and st.ind=stb.ind")
tdSql.checkData(0,0,-4294967292)
tdSql.checkData(0,1,2)
tdSql.query("select abs_max(tb1.number),abs_max(bound.number) from tb1,bound where tb1.ts=bound.ts;")
tdSql.checkData(0,0,0)
tdSql.checkData(0,1,9223372036854775805)
tdSql.query("select abs_max(stb1.number),abs_max(bound.number) from stb1,bound where stb1.ts=bound.ts")
tdSql.checkData(0,0,10000)
tdSql.checkData(0,1,9223372036854775806)
tdSql.query("select abs_max(st.number),abs_max(stb.number) from st,stb where st.ts=stb.ts and st.ind=stb.ind")
tdSql.checkData(0,0,9223372036854775806)
tdSql.checkData(0,1,10000)
# check boundary
# tdSql.query("select abs_max(number) from bound")
# tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from bound")
tdSql.checkData(0,0,9223372036854775807)
tdLog.info("======= UDF function sum_double check =======")
......@@ -189,14 +423,10 @@ class TDTestCase:
tdSql.query("select sum_double(id) from tb1")
tdSql.checkData(0,0,20)
# UDF bug no 4 -> values error while two function work : it is limit that udf can't work with build-in functions.
# tdSql.query("select sum_double(id) , abs_max(number) from tb1")
# tdSql.checkData(0,0,20)
# tdSql.checkData(0,0,400)
# tdSql.query("select sum_double(id) , abs_max(number) from st")
# tdSql.checkData(0,0,44)
# tdSql.checkData(0,0,9223372036854775807)
# only one udf function in SQL can use ,follow errors notice.
tdSql.error("select sum_double(id) , abs_max(number) from tb1")
tdSql.error("select sum_double(id) , abs_max(number) from st")
# UDF not support mix up with build-in functions
# it seems like not support scalar_function mix up with aggregate functions
......@@ -204,147 +434,162 @@ class TDTestCase:
tdSql.error("select sum_double(id) ,add_one(id) from tb1")
tdSql.error("select sum_double(id) ,max(id) from st")
tdSql.error("select sum_double(id) ,max(id) from tb1")
tdSql.error("select twa(id),add_one(id) from st")
tdSql.error("select twa(id),add_one(id) from tb1")
# UDF function not support Arithmetic ===================
tdSql.query("select max(id) + 5 from st")
tdSql.query("select max(id) + 5 from tb1")
tdSql.query("select max(id) + avg(val) from st")
tdSql.query("select abs_max(number)*5 from st")
tdSql.checkData(0,0,46116860184273879040.000000000)
tdSql.query("select abs_max(number)*5 from tb1")
tdSql.checkData(0,0,2000.000000000)
tdSql.query("select max(id) + avg(val) from tb1")
tdSql.query("select abs_max(number) + 5 from st")
tdSql.query("select add_one(id) + 5 from st")
tdSql.checkData(4,0,10.000000000)
tdSql.query("select add_one(id)/5 from tb1")
tdSql.checkData(4,0,1.000000000)
tdSql.query("select sum_double(id)-5 from st")
tdSql.checkData(0,0,39.000000000)
tdSql.query("select sum_double(id)*5 from tb1")
tdSql.checkData(0,0,100.000000000)
tdSql.query("select abs_max(number) + 5 from tb1")
tdSql.error("select abs_max(number) + max(id) from st")
tdSql.query("select abs_max(number)*abs_max(val) from st")
tdSql.query("select abs_max(number)*abs_max(val) from st")
tdSql.query("select sum_double(id) + sum_double(id) from st")
tdSql.checkData(0,0,88.000000000)
tdLog.info("======= UDF Nested query test =======")
tdSql.query("select sum(id) from (select id from st)")
tdSql.checkData(0,0,22)
#UDF bug no 5 -> not support Nested query
# tdSql.query("select abs_max(number) from (select number from st)")
# tdSql.checkData(0,0,9223372036854775807)
# tdSql.query("select abs_max(number) from (select number from bound)")
# tdSql.checkData(0,0,9223372036854775807)
# tdSql.query("select sum_double(id) from (select id from st)")
# tdSql.checkData(0,0,44)
# tdSql.query("select sum_double(id) from (select id from tb1)")
# tdSql.checkData(0,0,10)
#UDF bug -> Nested query
# outer nest query
tdSql.query("select abs_max(number) from (select number from st)")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from (select number from bound)")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select sum_double(id) from (select id from st)")
tdSql.checkData(0,0,44)
tdSql.query("select sum_double(id) from (select id from bound)")
tdSql.checkData(0,0,4)
tdSql.query("select add_one(id) from (select id from st);")
tdSql.checkRows(14)
tdSql.checkData(1,0,2)
tdSql.query("select add_one(id) from (select id from bound);")
tdSql.checkRows(4)
tdSql.checkData(1,0,-2147483644)
# UDF bug no 6 -> group by work error
tdLog.info("======= UDF work with group by =======")
# inner nest query
tdSql.query("select id from (select add_one(id) id from st)")
tdSql.checkRows(14)
tdSql.checkData(13,0,None)
tdSql.query("select id from (select add_one(id) id from bound)")
tdSql.checkRows(4)
tdSql.checkData(3,0,None)
# tdSql.query("select sum_double(id) from st group by tbname;")
# tdSql.checkData(0,0,6)
# tdSql.checkData(0,1,'tb1')
# tdSql.checkData(1,0,2)
# tdSql.checkData(1,1,'tb2')
# tdSql.query("select sum_double(id) from st group by id;")
# tdSql.checkRows(2)
# tdSql.query("select sum_double(id) from st group by tbname order by ts asc;")
tdSql.query("select id from (select sum_double(id) id from bound)")
tdSql.checkData(0,0,4)
tdSql.query("select id from (select sum_double(id) id from st)") # it will crash taos shell
tdSql.checkData(0,0,44)
tdSql.query("select id from (select abs_max(number) id from st)") # it will crash taos shell
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select id from (select abs_max(number) id from bound)")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(1s)")
tdSql.checkData(0,1,20)
tdSql.error("select sum_double(id) from st session(ts, 1s) interval (10s,1s) sliding(10s) fill (NULL) ")
tdSql.error("select sum_double(id) from st session(ts, 1s)")
tdSql.query("select sum_double(id) from tb1 session(ts, 1s)")
tdSql.checkData(0,1,20)
# inner and outer nest query
# UDF -> bug no 7 : intervals sliding values calculation error
# tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2")
# tdSql.checkData(0,1,20)
# tdSql.checkData(1,1,20)
tdSql.query("select add_one(id) from (select add_one(id) id from st)")
tdSql.checkRows(14)
tdSql.checkData(0,0,2)
tdSql.checkData(1,0,3)
tdSql.query("select add_one(id) from (select add_one(id) id from tb1)")
tdSql.checkRows(5)
tdSql.checkData(0,0,2)
tdSql.checkData(1,0,3)
tdSql.query("select sum_double(sumdb) from (select sum_double(id) sumdb from st)")
tdSql.query("select sum_double(sumdb) from (select sum_double(id) sumdb from tb1)")
# scalar_function can't work when using interval and sliding =========
tdSql.error("select add_one(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2 ")
tdSql.query("select abs_max(number) from (select abs_max(number) number from st)")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from (select abs_max(number) number from bound)")
tdSql.checkData(0,0,9223372036854775807)
# nest inner and outer with build-in func
tdSql.query("select max(number) from (select abs_max(number) number from st)")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select max(number) from (select abs_max(number) number from bound)")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select sum_double(sumdb) from (select sum_double(id) sumdb from st)")
tdSql.query("select sum(sumdb) from (select sum_double(id) sumdb from tb1)")
tdSql.checkData(0,0,20)
tdLog.info(" =====================test illegal creation method =====================")
tdSql.execute("drop function add_one")
# tdSql.execute("drop function add_one")
tdSql.execute("drop function abs_max")
tdSql.execute("drop function sum_double")
tdSql.execute("create aggregate function error_use1 as '/tmp/abs_max.so' outputtype bigint ")
tdSql.error("select error_use1(number) from st")
# UDF -> bug no 8: error return values when create aggregate functions as an scalar_function
# illega UDF create aggregate functions as an scalar_function
# with no aggregate
# tdSql.execute("create function abs_max as '/tmp/abs_max.so' outputtype bigint bufsize 128")
# tdSql.query("select abs_max(number) from st") # this bug will return 3 rows
# tdSql.checkRows(1)
# tdSql.execute("create function sum_double as '/tmp/sum_double.so' outputtype bigint bufsize 128")
# tdSql.execute("select sum_double(id) from st")
# tdSql.checkRows(1)
# UDF -> bug no 9: give bufsize for scalar_function add_one;
# UDF -> need improve : when outputtype is not match datatype which is defined in function codes
tdSql.execute("create function add_one as '/tmp/add_one.so' outputtype bigint bufsize 128")
# tdSql.error("select add_one(val) from st") # it should return error not [] for not match col datatype
# tdSql.query("select add_one(id) from st") # return error query result
# tdSql.checkData(0,0,1)
# tdSql.checkData(1,0,2)
# tdSql.checkData(5,0,1)
# tdSql.checkData(10,0,-2147483645)
# tdSql.checkData(13,0,None)
tdSql.execute("create function abs_max as '/tmp/abs_max.so' outputtype bigint bufsize 128")
tdSql.error("select abs_max(number) from st")
tdSql.execute("create function sum_double as '/tmp/sum_double.so' outputtype bigint bufsize 128")
tdSql.error("select sum_double(id) from st")
# UDF -> improve : aggregate function with no bufsize : it seems with no affect
# tdSql.execute("drop function abs_max")
# tdSql.execute("drop function sum_double")
tdSql.execute("drop function abs_max")
tdSql.execute("drop function sum_double")
tdSql.execute("create aggregate function abs_max as '/tmp/abs_max.so' outputtype bigint ")
tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype int ")
tdSql.query("select sum_double(id) from st")
tdSql.checkData(0,0,44)
tdSql.query("select sum_double(id) from tb1")
tdSql.checkData(0,0,20)
# tdSql.query("select abs_max(number) from st")
# tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from st")
tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from tb1")
tdSql.checkData(0,0,400)
#UDF bug no 10 -> create function datatype of outputtype not match col datatype
tdSql.execute("drop function abs_max")
tdSql.execute("drop function sum_double")
tdSql.execute("drop function add_one")
tdSql.execute("create function add_one as '/tmp/add_one.so' outputtype bigint;")
tdSql.execute("create aggregate function abs_max as '/tmp/abs_max.so' outputtype int bufsize 128;")
tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype double bufsize 128;")
# tdSql.query("select sum_double(id) from st") this bug will return 0.000000
# tdSql.checkData(0,0,44)
# tdSql.query("select sum_double(id) from tb1")
# tdSql.checkData(0,0,20) this bug will return 0.000000
# tdSql.query("select add_one(id) from st") this bug will return series error values
# tdSql.checkData(0,0,1)
# tdSql.checkData(1,0,2)
# tdSql.checkData(5,0,1)
# tdSql.checkData(10,0,-2147483645)
# tdSql.checkData(13,0,None)
# tdSql.query("select add_one(id) from tb1") this bug will return series error values
# tdSql.checkData(0,0,1)
# tdSql.checkData(2,0,3)
# tdSql.query("select abs_max(id) from st")
# tdSql.checkData(0,0,9223372036854775807)
tdSql.query("select abs_max(number) from tb1") # it seems work well
tdSql.checkData(0,0,400)
# UDF scalar function not support group by
tdSql.error("select add_one(id) from st group by tbname")
# UDF bug no 11 -> follow test case will coredump for taosd and let data lost
# tdSql.query("select add_one(id) from st group by tbname")
# UDF -> bug no 12: give aggregate for scalar_function add_one ,it will let taosd coredump as data lost
# tdSql.execute("drop function add_one")
# tdSql.execute("create aggregate function add_one as '/tmp/add_one.so' outputtype bigint bufsize 128")
# tdSql.query("select add_one(id) from st")
# UDF bug no 13 -> follow test case will coredump for taosc
# tdSql.query("select add_one(*) from st ")
# tdSql.query("select add_one(*) from tb1 ")
# UDF bug no 14 -> follow test case will coredump for taosc
# tdSql.query("select abs_max(id),abs_max(number) from st ")
# tdSql.query("select abs_max(number),abs_max(number) from st ")
# tdSql.query("select sum_double(id),sum_double(id) from st ")
# UDF : give aggregate for scalar_function add_one ,it can't work well
tdSql.execute("drop function add_one")
tdSql.execute("create aggregate function add_one as '/tmp/add_one.so' outputtype bigint bufsize 128")
tdSql.error("select add_one(id) from st")
# udf must give col list
tdSql.error("select add_one(*) from st ")
tdSql.error("select add_one(*) from tb1 ")
# one udf function can multi use
tdSql.query("select abs_max(id),abs_max(number) from st ")
tdSql.query("select abs_max(number),abs_max(number)*3 from st ")
tdSql.query("select abs_max(number),abs_max(number)*3 from tb1 ")
tdSql.query("select sum_double(id),sum_double(id) from st ")
def run(self):
tdSql.prepare()
......@@ -366,4 +611,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
......@@ -1761,7 +1761,7 @@ int stmt_funcb_autoctb_e1(TAOS_STMT *stmt) {
int code = taos_stmt_prepare(stmt, sql, 0);
if (code != 0){
printf("failed to execute taos_stmt_prepare. error:%s\n", taos_stmt_errstr(stmt));
return -1;
exit(1);
}
int id = 0;
......@@ -1797,9 +1797,44 @@ int stmt_funcb_autoctb_e1(TAOS_STMT *stmt) {
return 0;
}
int stmt_multi_insert_check(TAOS_STMT *stmt) {
char *sql;
// The number of tag column list is not equal to the number of tag value list
sql = "insert into ? using stb1 (id1) tags(1,?) values(?,?,?,?,?,?,?,?,?,?)";
if (0 == taos_stmt_prepare(stmt, sql, 0)) {
printf("failed to check taos_stmt_prepare. sql:%s\n", sql);
exit(1);
}
// The number of column list is not equal to the number of value list
sql = "insert into ? using stb1 tags(1,?,2,?,4,?,6.0,?,'b') "
"(ts, b, v1, v2, v4, v8, f4, f8, bin) values(?,?,?,?,?,?,?,?,?,?)";
if (0 == taos_stmt_prepare(stmt, sql, 0)) {
printf("failed to check taos_stmt_prepare. sql:%s\n", sql);
exit(1);
}
sql = "insert into ? using stb1 () tags(1,?) values(?,?,?,?,?,?,?,?,?,?)";
if (0 == taos_stmt_prepare(stmt, sql, 0)) {
printf("failed to check taos_stmt_prepare. sql:%s\n", sql);
exit(1);
}
sql = "insert into ? using stb1 ( tags(1,?) values(?,?,?,?,?,?,?,?,?,?)";
if (0 == taos_stmt_prepare(stmt, sql, 0)) {
printf("failed to check taos_stmt_prepare. sql:%s\n", sql);
exit(1);
}
sql = "insert into ? using stb1 ) tags(1,?) values(?,?,?,?,?,?,?,?,?,?)";
if (0 == taos_stmt_prepare(stmt, sql, 0)) {
printf("failed to check taos_stmt_prepare. sql:%s\n", sql);
exit(1);
}
return 0;
}
//1 tables 10 records
int stmt_funcb_autoctb_e2(TAOS_STMT *stmt) {
......@@ -4505,7 +4540,6 @@ void* runcase(void *par) {
(void)idx;
#if 1
prepare(taos, 1, 1);
......@@ -4819,6 +4853,16 @@ void* runcase(void *par) {
#endif
#if 1
prepare(taos, 1, 0);
stmt = taos_stmt_init(taos);
printf("stmt_multi_insert_check start\n");
stmt_multi_insert_check(stmt);
printf("stmt_multi_insert_check end\n");
taos_stmt_close(stmt);
#endif
#if 1
prepare(taos, 1, 1);
......@@ -5007,7 +5051,6 @@ void* runcase(void *par) {
printf("check result end\n");
#endif
#if 1
preparem(taos, 0, idx);
......
......@@ -10,7 +10,7 @@ sql connect
print ======================== dnode1 start
sql create function add_one as '/tmp/add_one.so' outputtype int;
sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype int;
sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype bigint;
sql show functions;
if $rows != 2 then
return -1
......
......@@ -11,7 +11,7 @@ print ======================== dnode1 start
sql create function add_one as '/tmp/add_one.so' outputtype int;
sql create function add_one_64232 as '/tmp/add_one_64232.so' outputtype int;
sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype int;
sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype bigint;
sql show functions;
if $rows != 3 then
return -1
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
typedef struct SUdfInit{
int maybe_null; /* 1 if function can return NULL */
int decimals; /* for real functions */
long long length; /* For string functions */
int64_t length; /* For string functions */
char *ptr; /* free pointer for function data */
int const_item; /* 0 if result is independent of arguments */
} SUdfInit;
......@@ -14,31 +15,36 @@ typedef struct SUdfInit{
#define TSDB_DATA_INT_NULL 0x80000000L
#define TSDB_DATA_BIGINT_NULL 0x8000000000000000L
void abs_max(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput,
void abs_max(char* data, short itype, short ibytes, int numOfRows, int64_t* ts, char* dataOutput, char* interBuf, char* tsOutput,
int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
int i;
int r = 0;
printf("abs_max input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
int64_t r = 0;
// printf("abs_max input data:%p, type:%d, rows:%d, ts:%p, %" PRId64 ", dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
if (itype == 5) {
r=*(long *)dataOutput;
r=*(int64_t *)dataOutput;
*numOfOutput=0;
for(i=0;i<numOfRows;++i) {
if (*((long *)data + i) == TSDB_DATA_BIGINT_NULL) {
if (*((int64_t *)data + i) == TSDB_DATA_BIGINT_NULL) {
continue;
}
*numOfOutput=1;
long v = abs(*((long *)data + i));
//int64_t v = abs(*((int64_t *)data + i));
int64_t v = *((int64_t *)data + i);
if (v < 0) {
v = 0 - v;
}
if (v > r) {
r = v;
}
}
*(long *)dataOutput=r;
*(int64_t *)dataOutput=r;
printf("abs_max out, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput);
} else {
// printf("abs_max out, dataoutput:%" PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput);
}else {
*numOfOutput=0;
}
}
......@@ -47,44 +53,43 @@ void abs_max(char* data, short itype, short ibytes, int numOfRows, long long* ts
void abs_max_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf) {
int i;
int r = 0;
printf("abs_max_finalize dataoutput:%p:%d, numOfOutput:%d, buf:%p\n", dataOutput, *dataOutput, *numOfOutput, buf);
printf("abs_max finalize, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput);
//int64_t r = 0;
// printf("abs_max_finalize dataoutput:%p:%d, numOfOutput:%d, buf:%p\n", dataOutput, *dataOutput, *numOfOutput, buf);
// *numOfOutput=1;
// printf("abs_max finalize, dataoutput:%" PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput);
}
void abs_max_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) {
int r = 0;
int64_t r = 0;
if (numOfRows > 0) {
r = *((long *)data);
r = *((int64_t *)data);
}
printf("abs_max_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf);
// printf("abs_max_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf);
for (int i = 1; i < numOfRows; ++i) {
printf("abs_max_merge %d - %ld\n", i, *((long *)data + i));
if (*((long*)data + i) > r) {
r= *((long*)data + i);
// printf("abs_max_merge %d - %" PRId64"\n", i, *((int64_t *)data + i));
if (*((int64_t*)data + i) > r) {
r= *((int64_t*)data + i);
}
}
*(long*)dataOutput=r;
*(int64_t*)dataOutput=r;
if (numOfRows > 0) {
*numOfOutput=1;
} else {
*numOfOutput=0;
}
printf("abs_max_merge, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput);
// printf("abs_max_merge, dataoutput:%" PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput);
}
int abs_max_init(SUdfInit* buf) {
printf("abs_max init\n");
// printf("abs_max init\n");
return 0;
}
void abs_max_destroy(SUdfInit* buf) {
printf("abs_max destroy\n");
}
// printf("abs_max destroy\n");
}
\ No newline at end of file
......@@ -14,20 +14,18 @@ void add_one(char* data, short itype, short ibytes, int numOfRows, long long* ts
int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
int i;
int r = 0;
printf("add_one input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
// printf("add_one input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
if (itype == 4) {
for(i=0;i<numOfRows;++i) {
printf("input %d - %d", i, *((int *)data + i));
// printf("input %d - %d", i, *((int *)data + i));
*((int *)dataOutput+i)=*((int *)data + i) + 1;
printf(", output %d\n", *((int *)dataOutput+i));
// printf(", output %d\n", *((int *)dataOutput+i));
if (tsOutput) {
*(long long*)tsOutput=1000000;
}
}
*numOfOutput=numOfRows;
printf("add_one out, numOfOutput:%d\n", *numOfOutput);
// printf("add_one out, numOfOutput:%d\n", *numOfOutput);
}
}
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ void add_one_64232(char* data, short itype, short ibytes, int numOfRows, long lo
printf("add_one_64232 input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
if (itype == 5) {
for(i=0;i<numOfRows;++i) {
printf("input %d - %d", i, *((long *)data + i));
printf("input %d - %ld", i, *((long *)data + i));
*((int *)dataOutput+i)=(int)*((long *)data + i) + 1;
printf(", output %d\n", *((int *)dataOutput+i));
if (tsOutput) {
......@@ -28,6 +28,4 @@ void add_one_64232(char* data, short itype, short ibytes, int numOfRows, long lo
printf("add_one_64232 out, numOfOutput:%d\n", *numOfOutput);
}
}
}
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
typedef struct SUdfInit{
int maybe_null; /* 1 if function can return NULL */
int decimals; /* for real functions */
long long length; /* For string functions */
int64_t length; /* For string functions */
char *ptr; /* free pointer for function data */
int const_item; /* 0 if result is independent of arguments */
} SUdfInit;
......@@ -13,13 +14,13 @@ typedef struct SUdfInit{
#define TSDB_DATA_INT_NULL 0x80000000L
void sum_double(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput,
void sum_double(char* data, short itype, short ibytes, int numOfRows, int64_t* ts, char* dataOutput, char* interBuf, char* tsOutput,
int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
int i;
int r = 0;
printf("sum_double input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
int64_t r = 0;
printf("sum_double input data:%p, type:%d, rows:%d, ts:%p,%"PRId64", dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
if (itype == 4) {
r=*(int *)dataOutput;
r=*(int64_t *)dataOutput;
*numOfOutput=0;
for(i=0;i<numOfRows;++i) {
......@@ -29,10 +30,10 @@ void sum_double(char* data, short itype, short ibytes, int numOfRows, long long*
*numOfOutput=1;
r+=*((int *)data + i);
*(int *)dataOutput=r;
}
*(int64_t *)dataOutput=r;
}
printf("sum_double out, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput);
// printf("sum_double out, dataoutput:%"PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput);
}
}
......@@ -40,45 +41,44 @@ void sum_double(char* data, short itype, short ibytes, int numOfRows, long long*
void sum_double_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf) {
int i;
int r = 0;
printf("sum_double_finalize dataoutput:%p:%d, numOfOutput:%d, buf:%p\n", dataOutput, *dataOutput, *numOfOutput, buf);
*numOfOutput=1;
*(int*)(buf->ptr)=*(int*)dataOutput*2;
*(int*)dataOutput=*(int*)(buf->ptr);
printf("sum_double finalize, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput);
int64_t r = 0;
// printf("sum_double_finalize dataoutput:%p:%"PRId64", numOfOutput:%d, buf:%p\n", dataOutput, *(int64_t*)dataOutput, *numOfOutput, buf);
// *numOfOutput=1;
*(int64_t*)(buf->ptr)=*(int64_t*)dataOutput*2;
*(int64_t*)dataOutput=*(int64_t*)(buf->ptr);
// printf("sum_double finalize, dataoutput:%"PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput);
}
void sum_double_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) {
void sum_double_merge(char* data, int32_t numOfRows, char* dataOutput, int* numOfOutput, SUdfInit* buf) {
int r = 0;
int sum = 0;
int64_t sum = 0;
printf("sum_double_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf);
// printf("sum_double_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf);
for (int i = 0; i < numOfRows; ++i) {
printf("sum_double_merge %d - %d\n", i, *((int*)data + i));
sum +=*((int*)data + i);
// printf("sum_double_merge %d - %"PRId64"\n", i, *((int64_t*)data + i));
sum +=*((int64_t*)data + i);
}
*(int*)dataOutput+=sum;
*(int64_t*)dataOutput+=sum;
if (numOfRows > 0) {
*numOfOutput=1;
} else {
*numOfOutput=0;
}
printf("sum_double_merge, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput);
// printf("sum_double_merge, dataoutput:%"PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput);
}
int sum_double_init(SUdfInit* buf) {
buf->maybe_null=1;
buf->ptr = malloc(sizeof(int));
printf("sum_double init\n");
buf->ptr = malloc(sizeof(int64_t));
// printf("sum_double init\n");
return 0;
}
void sum_double_destroy(SUdfInit* buf) {
free(buf->ptr);
printf("sum_double destroy\n");
}
// printf("sum_double destroy\n");
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册