diff --git a/documentation20/cn/00.index/docs.md b/documentation20/cn/00.index/docs.md index 18bdc15d30430516c3ae6c847fc448477003dd66..df5a82517183f967aaaeb6767804cefa795301a1 100644 --- a/documentation20/cn/00.index/docs.md +++ b/documentation20/cn/00.index/docs.md @@ -40,17 +40,19 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专 * [超级表管理](/taos-sql#super-table):添加、删除、查看、修改超级表 * [标签管理](/taos-sql#tags):增加、删除、修改标签 * [数据写入](/taos-sql#insert):支持单表单条、多条、多表多条写入,支持历史数据写入 -* [数据查询](/taos-sql#select):支持时间段、值过滤、排序、查询结果手动分页等 +* [数据查询](/taos-sql#select):支持时间段、值过滤、排序、嵌套查询、UINON、JOIN、查询结果手动分页等 * [SQL函数](/taos-sql#functions):支持各种聚合函数、选择函数、计算函数,如avg, min, diff等 * [窗口切分聚合](/taos-sql#aggregation):将表中数据按照时间段等方式进行切割后聚合,降维处理 * [边界限制](/taos-sql#limitation):库、表、SQL等边界限制条件 +* [UDF](/taos-sql/udf):用户定义函数的创建和管理方法 * [错误码](/taos-sql/error-code):TDengine 2.0 错误码以及对应的十进制码 ## [高效写入数据](/insert) -* [SQL写入](/insert#sql):使用SQL insert命令向一张或多张表写入单条或多条记录 -* [Prometheus写入](/insert#prometheus):配置Prometheus, 不用任何代码,将数据直接写入 -* [Telegraf写入](/insert#telegraf):配置Telegraf, 不用任何代码,将采集数据直接写入 +* [SQL 写入](/insert#sql):使用SQL insert命令向一张或多张表写入单条或多条记录 +* [Schemaless 写入](/insert#schemaless):免于预先建表,将数据直接写入时自动维护元数据结构 +* [Prometheus 写入](/insert#prometheus):配置Prometheus, 不用任何代码,将数据直接写入 +* [Telegraf 写入](/insert#telegraf):配置Telegraf, 不用任何代码,将采集数据直接写入 * [EMQ X Broker](/insert#emq):配置EMQ X,不用任何代码,就可将MQTT数据直接写入 * [HiveMQ Broker](/insert#hivemq):配置HiveMQ,不用任何代码,就可将MQTT数据直接写入 diff --git a/documentation20/cn/01.evaluation/docs.md b/documentation20/cn/01.evaluation/docs.md index edfa7af7e9a24be9a6d6ab1de3591deb48e22b3a..050046645c24e7db58ef2f39683433c3a4b53169 100644 --- a/documentation20/cn/01.evaluation/docs.md +++ b/documentation20/cn/01.evaluation/docs.md @@ -2,28 +2,27 @@ ## TDengine 简介 -TDengine 是涛思数据面对高速增长的物联网大数据市场和技术挑战推出的创新性的大数据处理产品,它不依赖任何第三方软件,也不是优化或包装了一个开源的数据库或流式计算产品,而是在吸取众多传统关系型数据库、NoSQL 数据库、流式计算引擎、消息队列等软件的优点之后自主开发的产品,在时序空间大数据处理上,有着自己独到的优势。 +TDengine 是涛思数据面对高速增长的物联网大数据市场和技术挑战推出的创新性的大数据处理产品,它不依赖任何第三方软件,也不是优化或包装了一个开源的数据库或流式计算产品,而是在吸取众多传统关系型数据库、NoSQL 数据库、流式计算引擎、消息队列等软件的优点之后自主开发的产品,TDengine 在时序空间大数据处理上,有着自己独到的优势。 -TDengine 的模块之一是时序数据库。但除此之外,为减少研发的复杂度、系统维护的难度,TDengine 还提供缓存、消息队列、订阅、流式计算等功能,为物联网、工业互联网大数据的处理提供全栈的技术方案,是一个高效易用的物联网大数据平台。与 Hadoop 等典型的大数据平台相比,它具有如下鲜明的特点: +TDengine 的模块之一是时序数据库。但除此之外,为减少研发的复杂度、系统维护的难度,TDengine 还提供缓存、消息队列、订阅、流式计算等功能,为物联网和工业互联网大数据的处理提供全栈的技术方案,是一个高效易用的物联网大数据平台。与 Hadoop 等典型的大数据平台相比,TDengine 具有如下鲜明的特点: * __10 倍以上的性能提升__:定义了创新的数据存储结构,单核每秒能处理至少 2 万次请求,插入数百万个数据点,读出一千万以上数据点,比现有通用数据库快十倍以上。 -* __硬件或云服务成本降至 1/5__:由于超强性能,计算资源不到通用大数据方案的 1/5;通过列式存储和先进的压缩算法,存储空间不到通用数据库的 1/10。 +* __硬件或云服务成本降至 1/5__:由于超强性能,计算资源不到通用大数据方案的 1/5;通过列式存储和先进的压缩算法,存储占用不到通用数据库的 1/10。 * __全栈时序数据处理引擎__:将数据库、消息队列、缓存、流式计算等功能融为一体,应用无需再集成 Kafka/Redis/HBase/Spark/HDFS 等软件,大幅降低应用开发和维护的复杂度成本。 * __强大的分析功能__:无论是十年前还是一秒钟前的数据,指定时间范围即可查询。数据可在时间轴上或多个设备上进行聚合。即席查询可通过 Shell, Python, R, MATLAB 随时进行。 -* __与第三方工具无缝连接__:不用一行代码,即可与 Telegraf, Grafana, EMQ, HiveMQ, Prometheus, MATLAB, R 等集成。后续将支持 OPC, Hadoop, Spark 等,BI 工具也将无缝连接。 -* __零运维成本、零学习成本__:安装集群简单快捷,无需分库分表,实时备份。类标准 SQL,支持 RESTful,支持 Python/Java/C/C++/C#/Go/Node.js, 与 MySQL 相似,零学习成本。 +* __高可用性和水平扩展__:通过分布式架构和一致性算法,通过多复制和集群特性,TDengine确保了高可用性和水平扩展性以支持关键任务应用程序。 +* __零运维成本、零学习成本__:安装集群简单快捷,无需分库分表,实时备份。类似标准 SQL,支持 RESTful,支持 Python/Java/C/C++/C#/Go/Node.js, 与 MySQL 相似,零学习成本。 +* __核心开源__:除了一些辅助功能外,TDengine的核心是开源的。企业再也不会被数据库绑定了。这使生态更加强大,产品更加稳定,开发者社区更加活跃。 采用 TDengine,可将典型的物联网、车联网、工业互联网大数据平台的总拥有成本大幅降低。但需要指出的是,因充分利用了物联网时序数据的特点,它无法用来处理网络爬虫、微博、微信、电商、ERP、CRM 等通用型数据。 ![TDengine技术生态图](page://images/eco_system.png)
图 1. TDengine技术生态图
- ## TDengine 总体适用场景 作为一个 IoT 大数据平台,TDengine 的典型适用场景是在 IoT 范畴,而且用户有一定的数据量。本文后续的介绍主要针对这个范畴里面的系统。范畴之外的系统,比如 CRM,ERP 等,不在本文讨论范围内。 - ### 数据源特点和需求 从数据源角度,设计人员可以从下面几个角度分析 TDengine 在目标应用系统里面的适用性。 @@ -64,4 +63,3 @@ TDengine 的模块之一是时序数据库。但除此之外,为减少研发 |要求系统可靠运行| | | √ | TDengine 的系统架构非常稳定可靠,日常维护也简单便捷,对维护人员的要求简洁明了,最大程度上杜绝人为错误和事故。| |要求运维学习成本可控| | | √ |同上。| |要求市场有大量人才储备| √ | | | TDengine 作为新一代产品,目前人才市场里面有经验的人员还有限。但是学习成本低,我们作为厂家也提供运维的培训和辅助服务。| - diff --git a/documentation20/cn/03.architecture/docs.md b/documentation20/cn/03.architecture/docs.md index 8adafc73c21bc915a4564ccf530441bf33a16bda..3e9877b4465eac2ca05d99c88a620a0c6bf89689 100644 --- a/documentation20/cn/03.architecture/docs.md +++ b/documentation20/cn/03.architecture/docs.md @@ -250,7 +250,7 @@ vnode(虚拟数据节点)负责为采集的时序数据提供写入、查询和 创建DB时,系统并不会马上分配资源。但当创建一张表时,系统将看是否有已经分配的vnode, 且该vnode是否有空余的表空间,如果有,立即在该有空位的vnode创建表。如果没有,系统将从集群中,根据当前的负载情况,在一个dnode上创建一新的vnode, 然后创建表。如果DB有多个副本,系统不是只创建一个vnode,而是一个vgroup(虚拟数据节点组)。系统对vnode的数目没有任何限制,仅仅受限于物理节点本身的计算和存储资源。 -每张表的meda data(包含schema, 标签等)也存放于vnode里,而不是集中存放于mnode,实际上这是对Meta数据的分片,这样便于高效并行的进行标签过滤操作。 +每张表的meta data(包含schema, 标签等)也存放于vnode里,而不是集中存放于mnode,实际上这是对Meta数据的分片,这样便于高效并行的进行标签过滤操作。 ### 数据分区 diff --git a/documentation20/cn/05.insert/docs.md b/documentation20/cn/05.insert/docs.md index 92b60be27cd6a4ff3bfa15c99a669f9503a2b902..556d51759cb126f3b49b032b6efeb7e9924f864c 100644 --- a/documentation20/cn/05.insert/docs.md +++ b/documentation20/cn/05.insert/docs.md @@ -56,7 +56,6 @@ measurement,tag_set field_set timestamp - 后缀为 i16,表示为 SMALLINT (INT16) 类型; - 后缀为 i32,表示为 INT (INT32) 类型; - 后缀为 i64,表示为 BIGINT (INT64) 类型; - - 后缀为 b,表示为 BOOL 类型。 * t, T, true, True, TRUE, f, F, false, False 将直接作为 BOOL 型来处理。 timestamp 位置的时间戳通过后缀来声明时间精度,具体如下: @@ -72,13 +71,15 @@ timestamp 位置的时间戳通过后缀来声明时间精度,具体如下: st,t1=3i64,t2=4f64,t3="t3" c1=3i64,c3=L"passit",c2=false,c4=4f64 1626006833639000000ns ``` +需要注意的是,如果描述数据类型后缀时使用了错误的大小写,或者为数据指定的数据类型有误,均可能引发报错提示而导致数据写入失败。 + ### Schemaless 的处理逻辑 Schemaless 按照如下原则来处理行数据: 1. 当 tag_set 中有 ID 字段时,该字段的值将作为数据子表的表名。 2. 没有 ID 字段时,将使用 `measurement + tag_value1 + tag_value2 + ...` 的 md5 值来作为子表名。 3. 如果指定的超级表名不存在,则 Schemaless 会创建这个超级表。 -4. 如果指定的数据子表不存在,则 Schemaless 会使用 tag values 创建这个数据子表。 +4. 如果指定的数据子表不存在,则 Schemaless 会按照步骤 1 或 2 确定的子表名来创建子表。 5. 如果数据行中指定的标签列或普通列不存在,则 Schemaless 会在超级表中增加对应的标签列或普通列(只增不减)。 6. 如果超级表中存在一些标签列或普通列未在一个数据行中被指定取值,那么这些列的值在这一行中会被置为 NULL。 7. 对 BINARY 或 NCHAR 列,如果数据行中所提供值的长度超出了列类型的限制,那么 Schemaless 会增加该列允许存储的字符长度上限(只增不减),以保证数据的完整保存。 diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md index f6a00e64cb3168cef79cb61ad0cb65b5db0c1bef..68b8d6f052384615ca0643663cca6ddab3b7e1d3 100644 --- a/documentation20/cn/08.connector/docs.md +++ b/documentation20/cn/08.connector/docs.md @@ -776,7 +776,7 @@ curl -u username:password -d '' :/rest/sql/[db_name] - data: 具体返回的数据,一行一行的呈现,如果不返回结果集,那么就仅有 [[affected_rows]]。data 中每一行的数据列顺序,与 column_meta 中描述数据列的顺序完全一致。 - rows: 表明总共多少行数据。 -column_meta 中的列类型说明: +column_meta 中的列类型说明: * 1:BOOL * 2:TINYINT * 3:SMALLINT diff --git a/documentation20/cn/11.administrator/docs.md b/documentation20/cn/11.administrator/docs.md index 35eff03423e1400ff3339bb493e1816e9d899056..fe9417a861a5284b25525f16c87ab8d07d43181e 100644 --- a/documentation20/cn/11.administrator/docs.md +++ b/documentation20/cn/11.administrator/docs.md @@ -568,6 +568,35 @@ COMPACT 命令对指定的一个或多个 VGroup 启动碎片重整,系统会 需要注意的是,碎片重整操作会大幅消耗磁盘 I/O。因此在重整进行期间,有可能会影响节点的写入和查询性能,甚至在极端情况下导致短时间的阻写。 + +## 浮点数有损压缩 + +在车联网等物联网智能应用场景中,经常会采集和存储海量的浮点数类型数据,如果能更高效地对此类数据进行压缩,那么不但能够节省数据存储的硬件资源,也能够因降低磁盘 I/O 数据量而提升系统性能表现。 + +从 2.1.6.0 版本开始,TDengine 提供一种名为 TSZ 的新型数据压缩算法,无论设置为有损压缩还是无损压缩,都能够显著提升浮点数类型数据的压缩率表现。目前该功能以可选模块的方式进行发布,可以通过添加特定的编译参数来启用该功能(也即常规安装包中暂未包含该功能)。 + +**需要注意的是,该功能一旦启用,效果是全局的,也即会对系统中所有的 FLOAT、DOUBLE 类型的数据生效。同时,在启用了浮点数有损压缩功能后写入的数据,也无法被未启用该功能的版本载入,并有可能因此而导致数据库服务报错退出。** + +### 创建支持 TSZ 压缩算法的 TDengine 版本 + +TSZ 模块保存在单独的代码仓库 https://github.com/taosdata/TSZ 中。可以通过以下步骤创建包含此模块的 TDengine 版本: +1. TDengine 中的插件目前只支持通过 SSH 的方式拉取和编译,所以需要自己先配置好通过 SSH 拉取 GitHub 代码的环境。 +2. `git clone git@github.com:taosdata/TDengine -b your_branchname --recurse-submodules` 通过 `--recurse-submodules` 使依赖模块的源代码可以被一并下载。 +3. `mkdir debug && cd debug` 进入单独的编译目录。 +4. `cmake .. -DTSZ_ENABLED=true` 其中参数 `-DTSZ_ENABLED=true` 表示在编译过程中加入对 TSZ 插件功能的支持。如果成功激活对 TSZ 模块的编译,那么 CMAKE 过程中也会显示 `build with TSZ enabled` 字样。 +5. 编译成功后,包含 TSZ 浮点压缩功能的插件便已经编译进了 TDengine 中了,可以通过调整 taos.cfg 中的配置参数来使用此功能了。 + +### 通过配置文件来启用 TSZ 压缩算法 + +如果要启用 TSZ 压缩算法,除了在 TDengine 的编译过程需要声明启用 TSZ 模块之外,还需要在 taos.cfg 配置文件中对以下参数进行设置: +* lossyColumns:配置要进行有损压缩的浮点数数据类型。参数值类型为字符串,含义为:空 - 关闭有损压缩;float - 只对 FLOAT 类型进行有损压缩;double - 只对 DOUBLE 类型进行有损压缩;float|double:对 FLOAT 和 DOUBLE 类型都进行有损压缩。默认值是“空”,也即关闭有损压缩。 +* fPrecision:设置 float 类型浮点数压缩精度,小于此值的浮点数尾数部分将被截断。参数值类型为 FLOAT,最小值为 0.0,最大值为 100,000.0。缺省值为 0.00000001(1E-8)。 +* dPrecision:设置 double 类型浮点数压缩精度,小于此值的浮点数尾数部分将被截断。参数值类型为 DOUBLE,最小值为 0.0,最大值为 100,000.0。缺省值为 0.0000000000000001(1E-16)。 +* maxRange:表示数据的最大浮动范围。一般无需调整,在数据具有特定特征时可以配合 range 参数来实现极高的数据压缩率。默认值为 500。 +* range:表示数据大体浮动范围。一般无需调整,在数据具有特定特征时可以配合 maxRange 参数来实现极高的数据压缩率。默认值为 100。 + +**注意:**对 cfg 配置文件中参数值的任何调整,都需要重新启动 taosd 才能生效。并且以上选项为全局配置选项,配置后对所有数据库中所有表的 FLOAT 及 DOUBLE 类型的字段生效。 + ## 文件目录结构 安装TDengine后,默认会在操作系统中生成下列目录或文件: diff --git a/documentation20/cn/12.taos-sql/02.udf/docs.md b/documentation20/cn/12.taos-sql/02.udf/docs.md new file mode 100644 index 0000000000000000000000000000000000000000..db820cfa87f38c8f2cf185d433c4ca70443964f9 --- /dev/null +++ b/documentation20/cn/12.taos-sql/02.udf/docs.md @@ -0,0 +1,137 @@ +# UDF(用户定义函数) + +在有些应用场景中,应用逻辑需要的查询无法直接使用系统内置的函数来表示。利用 UDF 功能,TDengine 可以插入用户编写的处理代码并在查询中使用它们,就能够很方便地解决特殊应用场景中的使用需求。 + +从 2.2.0.0 版本开始,TDengine 支持通过 C/C++ 语言进行 UDF 定义。接下来结合示例讲解 UDF 的使用方法。 + +## 用 C/C++ 语言来定义 UDF + +TDengine 提供 3 个 UDF 的源代码示例,分别为: +* [add_one.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/add_one.c) +* [abs_max.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/abs_max.c) +* [sum_double.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/sum_double.c) + +### 无需中间变量的标量函数 + +[add_one.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/add_one.c) 是结构最简单的 UDF 实现。其功能为:对传入的一个数据列(可能因 WHERE 子句进行了筛选)中的每一项,都输出 +1 之后的值,并且要求输入的列数据类型为 INT。 + +这一具体的处理逻辑在函数 `void add_one(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBUf, char* tsOutput, int* numOfOutput, short otype, short obytes, SUdfInit* buf)` 中定义。这类用于实现 UDF 的基础计算逻辑的函数,我们称为 udfNormalFunc,也就是对行数据块的标量计算函数。需要注意的是,udfNormalFunc 的参数项是固定的,用于按照约束完成与引擎之间的数据交换。 + +- udfNormalFunc 中各参数的具体含义是: + * data:存有输入的数据。 + * itype:输入数据的类型。这里采用的是短整型表示法,与各种数据类型对应的值可以参见 [column_meta 中的列类型说明](https://www.taosdata.com/cn/documentation/connector#column_meta)。例如 4 用于表示 INT 型。 + * iBytes:输入数据中每个值会占用的字节数。 + * numOfRows:输入数据的总行数。 + * ts:主键时间戳在输入中的列数据。 + * dataOutput:输出数据的缓冲区。 + * interBuf:系统使用的中间临时缓冲区,通常用户逻辑无需对 interBuf 进行处理。 + * tsOutput:主键时间戳在输出时的列数据。 + * numOfOutput:输出数据的个数。 + * oType:输出数据的类型。取值含义与 itype 参数一致。 + * oBytes:输出数据中每个值会占用的字节数。 + * buf:计算过程的中间变量缓冲区。 + +其中 buf 参数需要用到一个自定义结构体 SUdfInit。在这个例子中,因为 add_one 的计算过程无需用到中间变量缓存,所以可以把 SUdfInit 定义成一个空结构体。 + +### 无需中间变量的聚合函数 + +[abs_max.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/abs_max.c) 实现的是一个聚合函数,功能是对一组数据按绝对值取最大值。 + +其计算过程为:与所在查询语句相关的数据会被分为多个行数据块,对每个行数据块调用 udfNormalFunc(在本例的实现代码中,实际函数名是 `abs_max`),再将每个数据块的计算结果调用 udfMergeFunc(本例中,其实际的函数名是 `abs_max_merge`)进行聚合,生成每个子表的聚合结果。如果查询指令涉及超级表,那么最后还会通过 udfFinalizeFunc(本例中,其实际的函数名是 `abs_max_finalize`)再把子表的计算结果聚合为超级表的计算结果。 + +值得注意的是,udfNormalFunc、udfMergeFunc、udfFinalizeFunc 之间,函数名约定使用相同的前缀,此前缀即 udfNormalFunc 的实际函数名。udfMergeFunc 的函数名后缀 `_merge`、udfFinalizeFunc 的函数名后缀 `_finalize`,是 UDF 实现规则的一部分,系统会按照这些函数名后缀来调用相应功能。 + +- udfMergeFunc 用于对计算中间结果进行聚合。本例中 udfMergeFunc 对应的实现函数为 `void abs_max_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf)`,其中各参数的具体含义是: + * data:udfNormalFunc 的输出组合在一起的数据,也就成为了 udfMergeFunc 的输入。 + * numOfRows:data 中数据的行数。 + * dataOutput:输出数据的缓冲区。 + * numOfOutput:输出数据的个数。 + * buf:计算过程的中间变量缓冲区。 + +- udfFinalizeFunc 用于对计算结果进行最终聚合。本例中 udfFinalizeFunc 对应的实现函数为 `void abs_max_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf)`,其中各参数的具体含义是: + * dataOutput:输出数据的缓冲区。对 udfFinalizeFunc 来说,其输入数据也来自于这里。 + * interBuf:系统使用的中间临时缓冲区,与 udfNormalFunc 中的同名参数含义一致。 + * numOfOutput:输出数据的个数。 + * buf:计算过程的中间变量缓冲区。 + +同样因为 abs_max 的计算过程无需用到中间变量缓存,所以同样是可以把 SUdfInit 定义成一个空结构体。 + +### 使用中间变量的聚合函数 + +[sum_double.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/sum_double.c) 也是一个聚合函数,功能是对一组数据输出求和结果的倍数。 + +出于功能演示的目的,在这个用户定义函数的实现方法中,用到了中间变量缓冲区 buf。因此,在这个源代码文件中,SUdfInit 就不再是一个空的结构体,而是定义了缓冲区的具体存储内容。 + +也正是因为用到了中间变量缓冲区,因此就需要对这一缓冲区进行初始化和资源释放。具体来说,也即对应 udfInitFunc(本例中,其实际的函数名是 `sum_double_init`)和 udfDestroyFunc(本例中,其实际的函数名是 `sum_double_destroy`)。其函数名命名规则同样是采取以 udfNormalFunc 的实际函数名为前缀,以 `_init` 和 `_destroy` 为后缀。系统会在初始化和资源释放时调用对应名称的函数。 + +- udfInitFunc 用于初始化中间变量缓冲区中的变量和内容。本例中 udfInitFunc 对应的实现函数为 `int sum_double_init(SUdfInit* buf)`,其中各参数的具体含义是: + * buf:计算过程的中间变量缓冲区。 + +- udfDestroyFunc 用于释放中间变量缓冲区中的变量和内容。本例中 udfDestroyFunc 对应的实现函数为 `void sum_double_destroy(SUdfInit* buf)`,其中各参数的具体含义是: + * buf:计算过程的中间变量缓冲区。 + +注意,UDF 的实现过程中需要小心处理对中间变量缓冲区的使用,如果使用不当则有可能导致内存泄露或对资源的过度占用,甚至导致系统服务进程崩溃等。 + +### UDF 实现方式的规则总结 + +根据所要实现的 UDF 类型不同,用户所要实现的功能函数内容也会有所区别: +* 无需中间变量的标量函数:结构体 SUdfInit 可以为空,需实现 udfNormalFunc。 +* 无需中间变量的聚合函数:结构体 SUdfInit 可以为空,需实现 udfNormalFunc、udfMergeFunc、udfFinalizeFunc。 +* 使用中间变量的标量函数:结构体 SUdfInit 需要具体定义,并需实现 udfNormalFunc、udfInitFunc、udfDestroyFunc。 +* 使用中间变量的聚合函数:结构体 SUdfInit 需要具体定义,并需实现 udfNormalFunc、udfInitFunc、udfDestroyFunc、udfMergeFunc、udfFinalizeFunc。 + +## 编译 UDF + +用户定义函数的 C 语言源代码无法直接被 TDengine 系统使用,而是需要先编译为 .so 链接库,之后才能载入 TDengine 系统。 + +例如,按照上一章节描述的规则准备好了用户定义函数的源代码 add_one.c,那么可以执行如下指令编译得到动态链接库文件: +```bash +gcc -g -O0 -fPIC -shared add_one.c -o add_one.so +``` + +这样就准备好了动态链接库 add_one.so 文件,可以供后文创建 UDF 时使用了。 + +## 在系统中管理和使用 UDF + +### 创建 UDF + +用户可以通过 SQL 指令在系统中加载客户端所在主机上的 UDF 函数库(不能通过 RESTful 接口或 HTTP 管理界面来进行这一过程)。一旦创建成功,则当前 TDengine 集群的所有用户都可以在 SQL 指令中使用这些函数。UDF 存储在系统的 MNode 节点上,因此即使重启 TDengine 系统,已经创建的 UDF 也仍然可用。 + +在创建 UDF 时,需要区分标量函数和聚合函数。如果创建时声明了错误的函数类别,则可能导致通过 SQL 指令调用函数时出错。 + +- 创建标量函数:`CREATE FUNCTION ids(X) AS ids(Y) OUTPUTTYPE typename(Z) bufsize(B);` + * X:标量函数未来在 SQL 指令中被调用时的函数名,必须与函数实现中 udfNormalFunc 的实际名称一致; + * Y:包含 UDF 函数实现的动态链接库的库文件路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 .so 文件); + * Z:此函数计算结果的数据类型,使用数字表示,含义与上文中 udfNormalFunc 的 itype 参数一致; + * B:系统使用的中间临时缓冲区大小,单位是字节,最小 0,最大 512,通常可以设置为 128。 + +- 创建聚合函数:`CREATE AGGREGATE FUNCTION ids(X) AS ids(Y) OUTPUTTYPE typename(Z) bufsize(B);` + * X:标量函数未来在 SQL 指令中被调用时的函数名,必须与函数实现中 udfNormalFunc 的实际名称一致; + * Y:包含 UDF 函数实现的动态链接库的库文件路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 .so 文件); + * Z:此函数计算结果的数据类型,使用数字表示,含义与上文中 udfNormalFunc 的 itype 参数一致; + * B:系统使用的中间临时缓冲区大小,单位是字节,最小 0,最大 512,通常可以设置为 128。 + +### 管理 UDF + +- 删除指定名称的用户定义函数:`DROP FUNCTION ids(X);` + * X:此参数的含义与 CREATE 指令中的 X 参数一致。 +- 显示系统中当前可用的所有 UDF:`SHOW FUNCTIONS;` + +### 调用 UDF + +在 SQL 指令中,可以直接以在系统中创建 UDF 时赋予的函数名来调用用户定义函数。例如: +```sql +SELECT X(c) FROM table/stable; +``` + +表示对名为 c 的数据列调用名为 X 的用户定义函数。SQL 指令中用户定义函数可以配合 WHERE 等查询特性来使用。 + +## UDF 的一些使用限制 + +在当前版本下,使用 UDF 存在如下这些限制: +1. 在创建和调用 UDF 时,服务端和客户端都只支持 Linux 操作系统; +2. UDF 不能与系统内建的 SQL 函数混合使用; +3. UDF 只支持以单个数据列作为输入; +4. UDF 只要创建成功,就会被持久化存储到 MNode 节点中; +5. 无法通过 RESTful 接口来创建 UDF; +6. UDF 在 SQL 中定义的函数名,必须与 .so 库文件实现中的接口函数名前缀保持一致,也即必须是 udfNormalFunc 的名称,而且不可与 TDengine 中已有的内建 SQL 函数重名。 diff --git a/documentation20/cn/12.taos-sql/docs.md b/documentation20/cn/12.taos-sql/docs.md index c53972d7ca4178f33e4b359bc0d99059997c70c1..d4ae0be7202c4a452024d58839dacef818cd4c64 100644 --- a/documentation20/cn/12.taos-sql/docs.md +++ b/documentation20/cn/12.taos-sql/docs.md @@ -730,6 +730,34 @@ Query OK, 1 row(s) in set (0.001091s) 5. 从 2.0.17.0 版本开始,条件过滤开始支持 BETWEEN AND 语法,例如 `WHERE col2 BETWEEN 1.5 AND 3.25` 表示查询条件为“1.5 ≤ col2 ≤ 3.25”。 6. 从 2.1.4.0 版本开始,条件过滤开始支持 IN 算子,例如 `WHERE city IN ('Beijing', 'Shanghai')`。说明:BOOL 类型写作 `{true, false}` 或 `{0, 1}` 均可,但不能写作 0、1 之外的整数;FLOAT 和 DOUBLE 类型会受到浮点数精度影响,集合内的值在精度范围内认为和数据行的值完全相等才能匹配成功;TIMESTAMP 类型支持非主键的列。 + +### JOIN 子句 + +从 2.2.0.0 版本开始,TDengine 对内连接(INNER JOIN)中的自然连接(Natural join)操作实现了完整的支持。也即支持“普通表与普通表之间”、“超级表与超级表之间”、“子查询与子查询之间”进行自然连接。自然连接与内连接的主要区别是,自然连接要求参与连接的字段在不同的表/超级表中必须是同名字段。也即,TDengine 在连接关系的表达中,要求必须使用同名数据列/标签列的相等关系。 + +在普通表与普通表之间的 JOIN 操作中,只能使用主键时间戳之间的相等关系。例如: +```sql +SELECT * +FROM temp_tb_1 t1, pressure_tb_1 t2 +WHERE t1.ts = t2.ts +``` + +在超级表与超级表之间的 JOIN 操作中,除了主键时间戳一致的条件外,还要求引入能实现一一对应的标签列的相等关系。例如: +```sql +SELECT * +FROM temp_stable t1, temp_stable t2 +WHERE t1.ts = t2.ts AND t1.deviceid = t2.deviceid AND t1.status=0; +``` + +类似地,也可以对多个子查询的查询结果进行 JOIN 操作。 + +注意,JOIN 操作存在如下限制要求: +1. 参与一条语句中 JOIN 操作的表/超级表最多可以有 10 个。 +2. 在包含 JOIN 操作的查询语句中不支持 FILL。 +3. 暂不支持参与 JOIN 操作的表之间聚合后的四则运算。 +4. 不支持只对其中一部分表做 GROUP BY。 +5. JOIN 查询的不同表的过滤条件之间不能为 OR。 + ### 嵌套查询 @@ -757,7 +785,7 @@ SELECT ... FROM (SELECT ... FROM ...) ...; * 外层查询不支持 GROUP BY。 -### UNION ALL 操作符 +### UNION ALL 子句 ```mysql SELECT ... @@ -1486,12 +1514,6 @@ SELECT AVG(current), MAX(current), LEASTSQUARES(current, start_val, step_val), P TAOS SQL 支持对标签、TBNAME 进行 GROUP BY 操作,也支持普通列进行 GROUP BY,前提是:仅限一列且该列的唯一值小于 10 万个。 -**JOIN 操作的限制** - -TAOS SQL 支持表之间按主键时间戳来 join 两张表的列,暂不支持两个表之间聚合后的四则运算。 - -JOIN 查询的不同表的过滤条件之间不能为 OR。 - **IS NOT NULL 与不为空的表达式适用范围** IS NOT NULL 支持所有类型的列。不为空的表达式为 <>"",仅对非数值类型的列适用。 diff --git a/documentation20/en/01.evaluation/docs.md b/documentation20/en/01.evaluation/docs.md index ecbde8c5776e3bd3735aed2bd64906f8bef1afc1..5b2d0dd974203db1dafe8758e673a2f0970c3f17 100644 --- a/documentation20/en/01.evaluation/docs.md +++ b/documentation20/en/01.evaluation/docs.md @@ -6,17 +6,16 @@ TDengine is an innovative Big Data processing product launched by TAOS Data in t One of the modules of TDengine is the time-series database. However, in addition to this, to reduce the complexity of research and development and the difficulty of system operation, TDengine also provides functions such as caching, message queuing, subscription, stream computing, etc. TDengine provides a full-stack technical solution for the processing of IoT and Industrial Internet BigData. It is an efficient and easy-to-use IoT Big Data platform. Compared with typical Big Data platforms such as Hadoop, TDengine has the following distinct characteristics: -- **Performance improvement over 10 times**: An innovative data storage structure is defined, with each single core can process at least 20,000 requests per second, insert millions of data points, and read more than 10 million data points, which is more than 10 times faster than other existing general database. +- **Performance improvement over 10 times**: An innovative data storage structure is defined, with every single core that can process at least 20,000 requests per second, insert millions of data points, and read more than 10 million data points, which is more than 10 times faster than other existing general database. - **Reduce the cost of hardware or cloud services to 1/5**: Due to its ultra-performance, TDengine’s computing resources consumption is less than 1/5 of other common Big Data solutions; through columnar storage and advanced compression algorithms, the storage consumption is less than 1/10 of other general databases. - **Full-stack time-series data processing engine**: Integrate database, message queue, cache, stream computing, and other functions, and the applications do not need to integrate with software such as Kafka/Redis/HBase/Spark/HDFS, thus greatly reducing the complexity cost of application development and maintenance. -- **Highly Available and Horizontal Scalable **: With the distributed architecture and consistency algorithm, via multi-replication and clustering features, TDengine ensures high availability and horizontal scalability to support the mission-critical applications. +- **Highly Available and Horizontal Scalable**: With the distributed architecture and consistency algorithm, via multi-replication and clustering features, TDengine ensures high availability and horizontal scalability to support mission-critical applications. - **Zero operation cost & zero learning cost**: Installing clusters is simple and quick, with real-time backup built-in, and no need to split libraries or tables. Similar to standard SQL, TDengine can support RESTful, Python/Java/C/C++/C#/Go/Node.js, and similar to MySQL with zero learning cost. -- **Core is Open Sourced:** Except some auxiliary features, the core of TDengine is open sourced. Enterprise won't be locked by the database anymore. Ecosystem is more strong, product is more stable, and developer communities are more active. +- **Core is Open Sourced:** Except for some auxiliary features, the core of TDengine is open-sourced. Enterprise won't be locked by the database anymore. The ecosystem is more strong, products are more stable, and developer communities are more active. With TDengine, the total cost of ownership of typical IoT, Internet of Vehicles, and Industrial Internet Big Data platforms can be greatly reduced. However, since it makes full use of the characteristics of IoT time-series data, TDengine cannot be used to process general data from web crawlers, microblogs, WeChat, e-commerce, ERP, CRM, and other sources. ![TDengine Technology Ecosystem](page://images/eco_system.png) -
Figure 1. TDengine Technology Ecosystem
## Overall Scenarios of TDengine @@ -62,4 +61,4 @@ From the perspective of data sources, designers can analyze the applicability of | ------------------------------------------------- | ------------------ | ----------------------- | ------------------- | ------------------------------------------------------------ | | Require system with high-reliability | | | √ | TDengine has a very robust and reliable system architecture to implement simple and convenient daily operation with streamlined experiences for operators, thus human errors and accidents are eliminated to the greatest extent. | | Require controllable operation learning cost | | | √ | As above. | -| Require abundant talent supply | √ | | | As a new-generation product, it’s still difficult to find talents with TDengine experiences from market. However, the learning cost is low. As the vendor, we also provide extensive operation training and counselling services. | \ No newline at end of file +| Require abundant talent supply | √ | | | As a new-generation product, it’s still difficult to find talents with TDengine experiences from the market. However, the learning cost is low. As the vendor, we also provide extensive operation training and counseling services. | diff --git a/documentation20/en/03.architecture/docs.md b/documentation20/en/03.architecture/docs.md index bc686aebbf0b7696b1355fe45be6d09fcca63411..e0a324acad37d3c9e23d73a1f5762651b32e924d 100644 --- a/documentation20/en/03.architecture/docs.md +++ b/documentation20/en/03.architecture/docs.md @@ -13,7 +13,6 @@ In typical industry IoT, Internet of Vehicles and Operation Monitoring scenarios Collected Metrics Tags - Device ID Time Stamp @@ -108,16 +107,16 @@ Each data record contains the device ID, timestamp, collected metrics (current, As the data points are a series of data points over time, the data points generated by IoT, Internet of Vehicles, and Operation Monitoring have some strong common characteristics: -1. metrics are always structured data; -2. there are rarely delete/update operations on collected data; -3. unlike traditional databases, transaction processing is not required; -4. the ratio of writing over reading is much higher than typical Internet applications; -5. data volume is stable and can be predicted according to the number of devices and sampling rate; -6. the user pays attention to the trend of data, not a specific value at a specific time; -7. there is always a data retention policy; -8. the data query is always executed in a given time range and a subset of space; -9. in addition to storage and query operations, various statistical and real-time computing are also required; -10. data volume is huge, a system may generate over 10 billion data points in a day. +1. Metrics are always structured data; +2. There are rarely delete/update operations on collected data; +3. Unlike traditional databases, transaction processing is not required; +4. The ratio of writing over reading is much higher than typical Internet applications; +5. Data volume is stable and can be predicted according to the number of devices and sampling rate; +6. The user pays attention to the trend of data, not a specific value at a specific time; +7. There is always a data retention policy; +8. The data query is always executed in a given time range and a subset of space; +9. In addition to storage and query operations, various statistical and real-time computing are also required; +10. Data volume is huge, a system may generate over 10 billion data points in a day. By utilizing the above characteristics, TDengine designs the storage and computing engine in a special and optimized way for time-series data, resulting in massive improvements in system efficiency. @@ -160,7 +159,7 @@ Logical structure diagram of TDengine distributed architecture as following: -A complete TDengine system runs on one or more physical nodes. Logically, it includes data node (dnode), TDEngine application driver (taosc) and application (app). There are one or more data nodes in the system, which form a cluster. The application interacts with the TDengine cluster through taosc's API. The following is a brief introduction to each logical unit. +A complete TDengine system runs on one or more physical nodes. Logically, it includes data node (dnode), TDEngine application driver (TAOSC) and application (app). There are one or more data nodes in the system, which form a cluster. The application interacts with the TDengine cluster through TAOSC's API. The following is a brief introduction to each logical unit. **Physical node (pnode)**: A pnode is a computer that runs independently and has its own computing, storage and network capabilities. It can be a physical machine, virtual machine, or Docker container installed with OS. The physical node is identified by its configured FQDN (Fully Qualified Domain Name). TDengine relies entirely on FQDN for network communication. If you don't know about FQDN, please read the blog post "[All about FQDN of TDengine](https://www.taosdata.com/blog/2020/09/11/1824.html)". @@ -172,7 +171,7 @@ A complete TDengine system runs on one or more physical nodes. Logically, it inc **Virtual node group (VGroup)**: Vnodes on different data nodes can form a virtual node group to ensure the high availability of the system. The virtual node group is managed in a master/slave mechanism. Write operations can only be performed on the master vnode, and then replicated to slave vnodes, thus ensuring that one single replica of data is copied on multiple physical nodes. The number of virtual nodes in a vgroup equals the number of data replicas. If the number of replicas of a DB is N, the system must have at least N data nodes. The number of replicas can be specified by the parameter `replica` when creating DB, and the default is 1. Using the multi-replication feature of TDengine, the same high data reliability can be achieved without the need for expensive storage devices such as disk arrays. Virtual node group is created and managed by the management node, and the management node assigns a system unique ID, aka VGroup ID. If two virtual nodes have the same vnode group ID, means that they belong to the same group and the data is backed up to each other. The number of virtual nodes in a virtual node group can be dynamically changed, allowing only one, that is, no data replication. VGroup ID is never changed. Even if a virtual node group is deleted, its ID will not be reused. -**TAOSC**: TAOSC is the driver provided by TDengine to applications, which is responsible for dealing with the interaction between application and cluster, and provides the native interface of C/C++ language, which is embedded in JDBC, C #, Python, Go, Node.js language connection libraries. Applications interact with the whole cluster through taosc instead of directly connecting to data nodes in the cluster. This module is responsible for obtaining and caching metadata; forwarding requests for insertion, query, etc. to the correct data node; when returning the results to the application, taosc also needs to be responsible for the final level of aggregation, sorting, filtering and other operations. For JDBC, C/C++/C #/Python/Go/Node.js interfaces, this module runs on the physical node where the application is located. At the same time, in order to support the fully distributed RESTful interface, taosc has a running instance on each dnode of TDengine cluster. +**TAOSC**: TAOSC is the driver provided by TDengine to applications, which is responsible for dealing with the interaction between application and cluster, and provides the native interface of C/C++ language, which is embedded in JDBC, C #, Python, Go, Node.js language connection libraries. Applications interact with the whole cluster through TAOSC instead of directly connecting to data nodes in the cluster. This module is responsible for obtaining and caching metadata; forwarding requests for insertion, query, etc. to the correct data node; when returning the results to the application, TAOSC also needs to be responsible for the final level of aggregation, sorting, filtering and other operations. For JDBC, C/C++/C #/Python/Go/Node.js interfaces, this module runs on the physical node where the application is located. At the same time, in order to support the fully distributed RESTful interface, TAOSC has a running instance on each dnode of TDengine cluster. ### Node Communication @@ -184,35 +183,39 @@ A complete TDengine system runs on one or more physical nodes. Logically, it inc **Cluster external connection**: TDengine cluster can accommodate one single, multiple or even thousands of data nodes. The application only needs to initiate a connection to any data node in the cluster. The network parameter required for connection is the End Point (FQDN plus configured port number) of a data node. When starting the application taos through CLI, the FQDN of the data node can be specified through the option `-h`, and the configured port number can be specified through `-p`. If the port is not configured, the system configuration parameter serverPort of TDengine will be adopted. -**Inter-cluster communication**: Data nodes connect with each other through TCP/UDP. When a data node starts, it will obtain the EP information of the dnode where the mnode is located, and then establish a connection with the mnode in the system to exchange information. There are three steps to obtain EP information of the mnode: 1. Check whether the mnodeEpList file exists, if it does not exist or cannot be opened normally to obtain EP information of the mnode, skip to the second step; 2: Check the system configuration file taos.cfg to obtain node configuration parameters firstEp and secondEp (the node specified by these two parameters can be a normal node without mnode, in this case, the node will try to redirect to the mnode node when connected). If these two configuration parameters do not exist or do not exist in taos.cfg, or are invalid, skip to the third step; 3: Set your own EP as a mnode EP and run it independently. After obtaining the mnode EP list, the data node initiates the connection. It will successfully join the working cluster after connection. If not successful, it will try the next item in the mnode EP list. If all attempts are made, but the connection still fails, sleep for a few seconds before trying again. +**Inter-cluster communication**: Data nodes connect with each other through TCP/UDP. When a data node starts, it will obtain the EP information of the dnode where the mnode is located, and then establish a connection with the mnode in the system to exchange information. There are three steps to obtain EP information of the mnode: + +1. Check whether the mnodeEpList file exists, if it does not exist or cannot be opened normally to obtain EP information of the mnode, skip to the second step; +2. Check the system configuration file taos.cfg to obtain node configuration parameters firstEp and secondEp (the node specified by these two parameters can be a normal node without mnode, in this case, the node will try to redirect to the mnode node when connected). If these two configuration parameters do not exist or do not exist in taos.cfg, or are invalid, skip to the third step; +3. Set your own EP as a mnode EP and run it independently. After obtaining the mnode EP list, the data node initiates the connection. It will successfully join the working cluster after connection. If not successful, it will try the next item in the mnode EP list. If all attempts are made, but the connection still fails, sleep for a few seconds before trying again. **The choice of MNODE**: TDengine logically has a management node, but there is no separated execution code. The server-side only has a set of execution code taosd. So which data node will be the management node? This is determined automatically by the system without any manual intervention. The principle is as follows: when a data node starts, it will check its End Point and compare it with the obtained mnode EP List. If its EP exists in it, the data node shall start the mnode module and become a mnode. If your own EP is not in the mnode EP List, the mnode module will not start. During the system operation, due to load balancing, downtime and other reasons, mnode may migrate to the new dnode, while totally transparent without manual intervention. The modification of configuration parameters is the decision made by mnode itself according to resources usage. **Add new data nodes:** After the system has a data node, it has become a working system. There are two steps to add a new node into the cluster. Step1: Connect to the existing working data node using TDengine CLI, and then add the End Point of the new data node with the command "create dnode"; Step 2: In the system configuration parameter file taos.cfg of the new data node, set the firstEp and secondEp parameters to the EP of any two data nodes in the existing cluster. Please refer to the detailed user tutorial for detailed steps. In this way, the cluster will be established step by step. -**Redirection**: No matter about dnode or taosc, the connection to the mnode shall be initiated first, but the mnode is automatically created and maintained by the system, so the user does not know which dnode is running the mnode. TDengine only requires a connection to any working dnode in the system. Because any running dnode maintains the currently running mnode EP List, when receiving a connecting request from the newly started dnode or taosc, if it’s not a mnode by self, it will reply to the mnode EP List back. After receiving this list, taosc or the newly started dnode will try to establish the connection again. When the mnode EP List changes, each data node quickly obtains the latest list and notifies taosc through messaging interaction among nodes. +**Redirection**: No matter about dnode or TAOSC, the connection to the mnode shall be initiated first, but the mnode is automatically created and maintained by the system, so the user does not know which dnode is running the mnode. TDengine only requires a connection to any working dnode in the system. Because any running dnode maintains the currently running mnode EP List, when receiving a connecting request from the newly started dnode or TAOSC, if it’s not a mnode by self, it will reply to the mnode EP List back. After receiving this list, TAOSC or the newly started dnode will try to establish the connection again. When the mnode EP List changes, each data node quickly obtains the latest list and notifies TAOSC through messaging interaction among nodes. ### A Typical Data Writinfg Process -To explain the relationship between vnode, mnode, taosc and application and their respective roles, the following is an analysis of a typical data writing process. +To explain the relationship between vnode, mnode, TAOSC and application and their respective roles, the following is an analysis of a typical data writing process. ![ typical process of TDengine](page://images/architecture/message.png)
Picture 2 typical process of TDengine
1. Application initiates a request to insert data through JDBC, ODBC, or other APIs. -2. taosc checks if meta data existing for the table in the cache. If so, go straight to Step 4. If not, taosc sends a get meta-data request to mnode. -3. Mnode returns the meta-data of the table to taosc. Meta-data contains the schema of the table, and also the vgroup information to which the table belongs (the vnode ID and the End Point of the dnode where the table belongs. If the number of replicas is N, there will be N groups of End Points). If taosc does not receive a response from the mnode for a long time, and there are multiple mnodes, taosc will send a request to the next mnode. -4. Taosc initiates an insert request to master vnode. -5. After vnode inserts the data, it gives a reply to taosc, indicating that the insertion is successful. If taosc doesn't get a response from vnode for a long time, taosc will treat this node as offline. In this case, if there are multiple replicas of the inserted database, taosc will issue an insert request to the next vnode in vgroup. -6. Taosc notifies APP that writing is successful. +2. TAOSC checks if meta data existing for the table in the cache. If so, go straight to Step 4. If not, TAOSC sends a get meta-data request to mnode. +3. Mnode returns the meta-data of the table to TAOSC. Meta-data contains the schema of the table, and also the vgroup information to which the table belongs (the vnode ID and the End Point of the dnode where the table belongs. If the number of replicas is N, there will be N groups of End Points). If TAOSC does not receive a response from the mnode for a long time, and there are multiple mnodes, TAOSC will send a request to the next mnode. +4. TAOSC initiates an insert request to master vnode. +5. After vnode inserts the data, it gives a reply to TAOSC, indicating that the insertion is successful. If TAOSC doesn't get a response from vnode for a long time, TAOSC will treat this node as offline. In this case, if there are multiple replicas of the inserted database, TAOSC will issue an insert request to the next vnode in vgroup. +6. TAOSC notifies APP that writing is successful. -For Step 2 and 3, when taosc starts, it does not know the End Point of mnode, so it will directly initiate a request to the configured serving End Point of the cluster. If the dnode that receives the request does not have a mnode configured, it will inform the mnode EP list in a reply message, so that taosc will re-issue a request to obtain meta-data to the EP of another new mnode. +For Step 2 and 3, when TAOSC starts, it does not know the End Point of mnode, so it will directly initiate a request to the configured serving End Point of the cluster. If the dnode that receives the request does not have a mnode configured, it will inform the mnode EP list in a reply message, so that TAOSC will re-issue a request to obtain meta-data to the EP of another new mnode. -For Step 4 and 5, without caching, taosc can't recognize the master in the virtual node group, so assumes that the first vnode is the master and sends a request to it. If this vnode is not the master, it will reply to the actual master as a new target where taosc shall send a request to. Once the reply of successful insertion is obtained, taosc will cache the information of master node. +For Step 4 and 5, without caching, TAOSC can't recognize the master in the virtual node group, so assumes that the first vnode is the master and sends a request to it. If this vnode is not the master, it will reply to the actual master as a new target where TAOSC shall send a request to. Once the reply of successful insertion is obtained, TAOSC will cache the information of master node. -The above is the process of inserting data, and the processes of querying and computing are the same. Taosc encapsulates and hides all these complicated processes, and it is transparent to applications. +The above is the process of inserting data, and the processes of querying and computing are the same. TAOSC encapsulates and hides all these complicated processes, and it is transparent to applications. -Through taosc caching mechanism, mnode needs to be accessed only when a table is accessed for the first time, so mnode will not become a system bottleneck. However, because schema and vgroup may change (such as load balancing), taosc will interact with mnode regularly to automatically update the cache. +Through TAOSC caching mechanism, mnode needs to be accessed only when a table is accessed for the first time, so mnode will not become a system bottleneck. However, because schema and vgroup may change (such as load balancing), TAOSC will interact with mnode regularly to automatically update the cache. ## Storage Model and Data Partitioning/Sharding @@ -259,7 +262,7 @@ The load balancing process does not require any manual intervention, and it is t ## Data Writing and Replication Process -If a database has N replicas, thus a virtual node group has N virtual nodes, but only one as Master and all others are slaves. When the application writes a new record to system, only the Master vnode can accept the writing request. If a slave vnode receives a writing request, the system will notifies taosc to redirect. +If a database has N replicas, thus a virtual node group has N virtual nodes, but only one as Master and all others are slaves. When the application writes a new record to system, only the Master vnode can accept the writing request. If a slave vnode receives a writing request, the system will notifies TAOSC to redirect. ### Master vnode Writing Process @@ -281,9 +284,9 @@ For a slave vnode, the write process as follows: ![TDengine Slave Writing Process](page://images/architecture/write_master.png)
Picture 3 TDengine Slave Writing Process
-1. Slave vnode receives a data insertion request forwarded by Master vnode. +1. Slave vnode receives a data insertion request forwarded by Master vnode; 2. If the system configuration parameter `walLevel` is greater than 0, vnode will write the original request packet into database log file WAL. If walLevel is set to 2 and fsync is set to 0, TDengine will make WAL data written immediately to ensure that even system goes down, all data can be recovered from database log file; -3. Write into memory and add the record to “skip list”; +3. Write into memory and add the record to “skip list”. Compared with Master vnode, slave vnode has no forwarding or reply confirmation step, means two steps less. But writing into memory and WAL is exactly the same. @@ -297,7 +300,7 @@ However, the asynchronous replication has a tiny time window where data can be l 1. Master vnode has finished its 5-step operations, confirmed the success of writing to APP, and then went down; 2. Slave vnode receives the write request, then processing fails before writing to the log in Step 2; -3. Slave vnode will become the new master, thus losing one record +3. Slave vnode will become the new master, thus losing one record. In theory, for asynchronous replication, there is no guarantee to prevent data loss. However, this window is extremely small, only if mater and slave fail at the same time, and just confirm the successful write to the application before. @@ -419,11 +422,11 @@ TDengine creates a separate table for each data collection point, but in practic
Picture 4 Diagram of multi-table aggregation query
1. Application sends a query condition to system; -2. taosc sends the STable name to Meta Node(management node); -3. Management node sends the vnode list owned by the STable back to taosc; -4. taosc sends the computing request together with tag filters to multiple data nodes corresponding to these vnodes; -5. Each vnode first finds out the set of tables within its own node that meet the tag filters from memory, then scans the stored time-series data, completes corresponding aggregation calculations, and returns result to taosc; -6. taosc finally aggregates the results returned by multiple data nodes and send them back to application. +2. TAOSC sends the STable name to Meta Node(management node); +3. Management node sends the vnode list owned by the STable back to TAOSC; +4. TAOSC sends the computing request together with tag filters to multiple data nodes corresponding to these vnodes; +5. Each vnode first finds out the set of tables within its own node that meet the tag filters from memory, then scans the stored time-series data, completes corresponding aggregation calculations, and returns result to TAOSC; +6. TAOSC finally aggregates the results returned by multiple data nodes and send them back to application. Since TDengine stores tag data and time-series data separately in vnode, by filtering tag data in memory, the set of tables that need to participate in aggregation operation is first found, which greatly reduces the volume of data scanned and improves aggregation speed. At the same time, because the data is distributed in multiple vnodes/dnodes, the aggregation operation is carried out concurrently in multiple vnodes, which further improves the aggregation speed. Aggregation functions for ordinary tables and most operations are applicable to STables. The syntax is exactly the same. Please see TAOS SQL for details. diff --git a/documentation20/en/08.connector/docs.md b/documentation20/en/08.connector/docs.md index 27d38a61f07969df98a6994968c1bc5ccfe2e7dc..fd9d129e50fa4450aed2fbebe80eddb978ef1263 100644 --- a/documentation20/en/08.connector/docs.md +++ b/documentation20/en/08.connector/docs.md @@ -413,11 +413,11 @@ See [video tutorials](https://www.taosdata.com/blog/2020/11/11/1963.html) for th Users can find the connector package for python2 and python3 in the source code src/connector/python (or tar.gz/connector/python) folder. Users can install it through `pip` command: -`pip install src/connector/python/linux/python2/` +`pip install src/connector/python/` or - `pip3 install src/connector/python/linux/python3/` + `pip3 install src/connector/python/` #### Windows diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index aa09013e538253b8740a0aaf70d04358320a6dd8..3df7013b197baaf4d78bb0f0ae5d507d6be92715 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -128,8 +128,12 @@ function install_lib() { ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib fi - - ${csudo} ldconfig + + if [ "$osType" != "Darwin" ]; then + ${csudo} ldconfig + else + ${csudo} update_dyld_shared_cache + fi } function install_header() { diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 0d06e5d39c0ed1916e0c2af7ccce5918e31ac42f..df0cf15fe00eda5bc8e6004e2794733537b8aee0 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -13,13 +13,13 @@ IF (TD_LINUX) # set the static lib name ADD_LIBRARY(taos_static STATIC ${SRC}) - TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt ${VAR_TSZ}) + TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt cJson ${VAR_TSZ}) SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static") SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) # generate dynamic library (*.so) ADD_LIBRARY(taos SHARED ${SRC}) - TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m rt) + TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m rt cJson) IF (TD_LINUX_64) TARGET_LINK_LIBRARIES(taos lua) ENDIF () @@ -39,13 +39,13 @@ ELSEIF (TD_DARWIN) # set the static lib name ADD_LIBRARY(taos_static STATIC ${SRC}) - TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m lua) + TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m lua cJson) SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static") SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) # generate dynamic library (*.dylib) ADD_LIBRARY(taos SHARED ${SRC}) - TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m lua) + TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m lua cJson) SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1) #set version of .dylib @@ -63,26 +63,26 @@ ELSEIF (TD_WINDOWS) CONFIGURE_FILE("${TD_COMMUNITY_DIR}/src/client/src/taos.rc.in" "${TD_COMMUNITY_DIR}/src/client/src/taos.rc") ADD_LIBRARY(taos_static STATIC ${SRC}) - TARGET_LINK_LIBRARIES(taos_static trpc tutil query) + TARGET_LINK_LIBRARIES(taos_static trpc tutil query cJson) # generate dynamic library (*.dll) ADD_LIBRARY(taos SHARED ${SRC} ${TD_COMMUNITY_DIR}/src/client/src/taos.rc) IF (NOT TD_GODLL) SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def) ENDIF () - TARGET_LINK_LIBRARIES(taos trpc tutil query lua) + TARGET_LINK_LIBRARIES(taos trpc tutil query lua cJson) ELSEIF (TD_DARWIN) SET(CMAKE_MACOSX_RPATH 1) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux) ADD_LIBRARY(taos_static STATIC ${SRC}) - TARGET_LINK_LIBRARIES(taos_static query trpc tutil pthread m lua) + TARGET_LINK_LIBRARIES(taos_static query trpc tutil pthread m lua cJson) SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static") # generate dynamic library (*.dylib) ADD_LIBRARY(taos SHARED ${SRC}) - TARGET_LINK_LIBRARIES(taos query trpc tutil pthread m lua) + TARGET_LINK_LIBRARIES(taos query trpc tutil pthread m lua cJson) SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1) diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 6b12cd0da04c0f791201182c793d647fc54c00b1..4a621d47c0dcae4c2765d53b0d5b650e22d64a58 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -60,17 +60,25 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para tscDebugL("0x%"PRIx64" SQL: %s", pSql->self, pSql->sqlstr); pCmd->resColumnId = TSDB_RES_COL_ID; + taosAcquireRef(tscObjRef, pSql->self); + int32_t code = tsParseSql(pSql, true); - if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) return; + + if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) { + taosReleaseRef(tscObjRef, pSql->self); + return; + } if (code != TSDB_CODE_SUCCESS) { pSql->res.code = code; tscAsyncResultOnError(pSql); + taosReleaseRef(tscObjRef, pSql->self); return; } SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); executeQuery(pSql, pQueryInfo); + taosReleaseRef(tscObjRef, pSql->self); } // TODO return the correct error code to client in tscQueueAsyncError diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index c9ad7361efa3ade3e3e221a0128a5ad1f3e22ccb..e26e439492cec9c83b624c2bbb2bbc3a95de97b0 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -2128,11 +2128,12 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile int taos_insert_lines(TAOS* taos, char* lines[], int numLines) { int32_t code = 0; - SSmlLinesInfo* info = calloc(1, sizeof(SSmlLinesInfo)); + SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo)); info->id = genLinesSmlId(); if (numLines <= 0 || numLines > 65536) { tscError("SML:0x%"PRIx64" taos_insert_lines numLines should be between 1 and 65536. numLines: %d", info->id, numLines); + tfree(info); code = TSDB_CODE_TSC_APP_ERROR; return code; } @@ -2140,7 +2141,7 @@ int taos_insert_lines(TAOS* taos, char* lines[], int numLines) { for (int i = 0; i < numLines; ++i) { if (lines[i] == NULL) { tscError("SML:0x%"PRIx64" taos_insert_lines line %d is NULL", info->id, i); - free(info); + tfree(info); code = TSDB_CODE_TSC_APP_ERROR; return code; } @@ -2149,7 +2150,7 @@ int taos_insert_lines(TAOS* taos, char* lines[], int numLines) { SArray* lpPoints = taosArrayInit(numLines, sizeof(TAOS_SML_DATA_POINT)); if (lpPoints == NULL) { tscError("SML:0x%"PRIx64" taos_insert_lines failed to allocate memory", info->id); - free(info); + tfree(info); return TSDB_CODE_TSC_OUT_OF_MEMORY; } @@ -2177,7 +2178,7 @@ cleanup: taosArrayDestroy(lpPoints); - free(info); + tfree(info); return code; } diff --git a/src/client/src/tscParseOpenTSDB.c b/src/client/src/tscParseOpenTSDB.c index 397b5d3e97c2ed7fc1a42bd0e773bcff8f659c65..12f8ec84fd301d2d8851e92826cfcb3d860c1ceb 100644 --- a/src/client/src/tscParseOpenTSDB.c +++ b/src/client/src/tscParseOpenTSDB.c @@ -3,6 +3,7 @@ #include #include +#include "cJSON.h" #include "hash.h" #include "taos.h" @@ -12,9 +13,12 @@ #include "tscParseLine.h" -#define MAX_TELNET_FILEDS_NUM 2 -#define OTS_TIMESTAMP_COLUMN_NAME "ts" -#define OTS_METRIC_VALUE_COLUMN_NAME "value" +#define OTD_MAX_FIELDS_NUM 2 +#define OTD_JSON_SUB_FIELDS_NUM 2 +#define OTD_JSON_FIELDS_NUM 4 + +#define OTD_TIMESTAMP_COLUMN_NAME "ts" +#define OTD_METRIC_VALUE_COLUMN_NAME "value" /* telnet style API parser */ static uint64_t HandleId = 0; @@ -77,12 +81,12 @@ static int32_t parseTelnetTimeStamp(TAOS_SML_KV **pTS, int *num_kvs, const char const char *start, *cur; int32_t ret = TSDB_CODE_SUCCESS; int len = 0; - char key[] = OTS_TIMESTAMP_COLUMN_NAME; + char key[] = OTD_TIMESTAMP_COLUMN_NAME; char *value = NULL; start = cur = *index; //allocate fields for timestamp and value - *pTS = tcalloc(MAX_TELNET_FILEDS_NUM, sizeof(TAOS_SML_KV)); + *pTS = tcalloc(OTD_MAX_FIELDS_NUM, sizeof(TAOS_SML_KV)); while(*cur != '\0') { if (*cur == ' ') { @@ -123,7 +127,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch const char *start, *cur; int32_t ret = TSDB_CODE_SUCCESS; int len = 0; - char key[] = OTS_METRIC_VALUE_COLUMN_NAME; + char key[] = OTD_METRIC_VALUE_COLUMN_NAME; char *value = NULL; start = cur = *index; @@ -405,7 +409,7 @@ cleanup: tscDebug("OTD:0x%"PRIx64" taos_insert_telnet_lines finish inserting %d lines. code: %d", info->id, numLines, code); points = TARRAY_GET_START(lpPoints); numPoints = taosArrayGetSize(lpPoints); - for (int i=0; ivaluestring); + if (stableLen > TSDB_TABLE_NAME_LEN) { + tscError("OTD:0x%"PRIx64" Metric cannot exceeds 193 characters in JSON", info->id); + return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; + } + + pSml->stableName = tcalloc(stableLen + 1, sizeof(char)); + if (pSml->stableName == NULL){ + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + if (isdigit(metric->valuestring[0])) { + tscError("OTD:0x%"PRIx64" Metric cannnot start with digit in JSON", info->id); + tfree(pSml->stableName); + return TSDB_CODE_TSC_INVALID_JSON; + } + + tstrncpy(pSml->stableName, metric->valuestring, stableLen + 1); + + return TSDB_CODE_SUCCESS; + +} + +int32_t parseTimestampFromJSONObj(cJSON *root, int64_t *tsVal, SSmlLinesInfo* info) { + int32_t size = cJSON_GetArraySize(root); + if (size != OTD_JSON_SUB_FIELDS_NUM) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + cJSON *value = cJSON_GetObjectItem(root, "value"); + if (!cJSON_IsNumber(value)) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + cJSON *type = cJSON_GetObjectItem(root, "type"); + if (!cJSON_IsString(type)) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + *tsVal = value->valueint; + //if timestamp value is 0 use current system time + if (*tsVal == 0) { + *tsVal = taosGetTimestampNs(); + return TSDB_CODE_SUCCESS; + } + + size_t typeLen = strlen(type->valuestring); + if (typeLen == 1 && type->valuestring[0] == 's') { + //seconds + *tsVal = (int64_t)(*tsVal * 1e9); + } else if (typeLen == 2 && type->valuestring[1] == 's') { + switch (type->valuestring[0]) { + case 'm': + //milliseconds + *tsVal = convertTimePrecision(*tsVal, TSDB_TIME_PRECISION_MILLI, TSDB_TIME_PRECISION_NANO); + break; + case 'u': + //microseconds + *tsVal = convertTimePrecision(*tsVal, TSDB_TIME_PRECISION_MICRO, TSDB_TIME_PRECISION_NANO); + break; + case 'n': + //nanoseconds + *tsVal = *tsVal * 1; + break; + default: + return TSDB_CODE_TSC_INVALID_JSON; + } + } + + return TSDB_CODE_SUCCESS; +} + +int32_t parseTimestampFromJSON(cJSON *root, TAOS_SML_KV **pTS, int *num_kvs, SSmlLinesInfo* info) { + //Timestamp must be the first KV to parse + assert(*num_kvs == 0); + int64_t tsVal; + char key[] = OTD_TIMESTAMP_COLUMN_NAME; + + cJSON *timestamp = cJSON_GetObjectItem(root, "timestamp"); + if (cJSON_IsNumber(timestamp)) { + //timestamp value 0 indicates current system time + if (timestamp->valueint == 0) { + tsVal = taosGetTimestampNs(); + } else { + tsVal = convertTimePrecision(timestamp->valueint, TSDB_TIME_PRECISION_MICRO, TSDB_TIME_PRECISION_NANO); + } + } else if (cJSON_IsObject(timestamp)) { + int32_t ret = parseTimestampFromJSONObj(timestamp, &tsVal, info); + if (ret != TSDB_CODE_SUCCESS) { + tscError("OTD:0x%"PRIx64" Failed to parse timestamp from JSON Obj", info->id); + return ret; + } + } else { + return TSDB_CODE_TSC_INVALID_JSON; + } + + //allocate fields for timestamp and value + *pTS = tcalloc(OTD_MAX_FIELDS_NUM, sizeof(TAOS_SML_KV)); + + + (*pTS)->key = tcalloc(sizeof(key), 1); + memcpy((*pTS)->key, key, sizeof(key)); + + (*pTS)->type = TSDB_DATA_TYPE_TIMESTAMP; + (*pTS)->length = (int16_t)tDataTypes[(*pTS)->type].bytes; + (*pTS)->value = tcalloc((*pTS)->length, 1); + memcpy((*pTS)->value, &tsVal, (*pTS)->length); + + *num_kvs += 1; + return TSDB_CODE_SUCCESS; + +} + +int32_t convertJSONBool(TAOS_SML_KV *pVal, char* typeStr, int64_t valueInt, SSmlLinesInfo* info) { + if (strcasecmp(typeStr, "bool") != 0) { + tscError("OTD:0x%"PRIx64" invalid type(%s) for JSON Bool", info->id, typeStr); + return TSDB_CODE_TSC_INVALID_JSON_TYPE; + } + pVal->type = TSDB_DATA_TYPE_BOOL; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(bool *)(pVal->value) = valueInt ? true : false; + + return TSDB_CODE_SUCCESS; +} + +int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, SSmlLinesInfo* info) { + //tinyint + if (strcasecmp(typeStr, "i8") == 0 || + strcasecmp(typeStr, "tinyint") == 0) { + if (!IS_VALID_TINYINT(value->valueint)) { + tscError("OTD:0x%"PRIx64" JSON value(%"PRId64") cannot fit in type(tinyint)", info->id, value->valueint); + return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } + pVal->type = TSDB_DATA_TYPE_TINYINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(int8_t *)(pVal->value) = (int8_t)(value->valueint); + return TSDB_CODE_SUCCESS; + } + //smallint + if (strcasecmp(typeStr, "i16") == 0 || + strcasecmp(typeStr, "smallint") == 0) { + if (!IS_VALID_SMALLINT(value->valueint)) { + tscError("OTD:0x%"PRIx64" JSON value(%"PRId64") cannot fit in type(smallint)", info->id, value->valueint); + return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } + pVal->type = TSDB_DATA_TYPE_SMALLINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(int16_t *)(pVal->value) = (int16_t)(value->valueint); + return TSDB_CODE_SUCCESS; + } + //int + if (strcasecmp(typeStr, "i32") == 0 || + strcasecmp(typeStr, "int") == 0) { + if (!IS_VALID_INT(value->valueint)) { + tscError("OTD:0x%"PRIx64" JSON value(%"PRId64") cannot fit in type(int)", info->id, value->valueint); + return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } + pVal->type = TSDB_DATA_TYPE_INT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(int32_t *)(pVal->value) = (int32_t)(value->valueint); + return TSDB_CODE_SUCCESS; + } + //bigint + if (strcasecmp(typeStr, "i64") == 0 || + strcasecmp(typeStr, "bigint") == 0) { + if (!IS_VALID_BIGINT(value->valueint)) { + tscError("OTD:0x%"PRIx64" JSON value(%"PRId64") cannot fit in type(bigint)", info->id, value->valueint); + return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } + pVal->type = TSDB_DATA_TYPE_BIGINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(int64_t *)(pVal->value) = (int64_t)(value->valueint); + return TSDB_CODE_SUCCESS; + } + //float + if (strcasecmp(typeStr, "f32") == 0 || + strcasecmp(typeStr, "float") == 0) { + if (!IS_VALID_FLOAT(value->valuedouble)) { + tscError("OTD:0x%"PRIx64" JSON value(%f) cannot fit in type(float)", info->id, value->valuedouble); + return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } + pVal->type = TSDB_DATA_TYPE_FLOAT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(float *)(pVal->value) = (float)(value->valuedouble); + return TSDB_CODE_SUCCESS; + } + //double + if (strcasecmp(typeStr, "f64") == 0 || + strcasecmp(typeStr, "double") == 0) { + if (!IS_VALID_DOUBLE(value->valuedouble)) { + tscError("OTD:0x%"PRIx64" JSON value(%f) cannot fit in type(double)", info->id, value->valuedouble); + return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } + pVal->type = TSDB_DATA_TYPE_DOUBLE; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(double *)(pVal->value) = (double)(value->valuedouble); + return TSDB_CODE_SUCCESS; + } + + //if reach here means type is unsupported + tscError("OTD:0x%"PRIx64" invalid type(%s) for JSON Number", info->id, typeStr); + return TSDB_CODE_TSC_INVALID_JSON_TYPE; +} + +int32_t convertJSONString(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, SSmlLinesInfo* info) { + if (strcasecmp(typeStr, "binary") == 0) { + pVal->type = TSDB_DATA_TYPE_BINARY; + } else if (strcasecmp(typeStr, "nchar") == 0) { + pVal->type = TSDB_DATA_TYPE_NCHAR; + } else { + tscError("OTD:0x%"PRIx64" invalid type(%s) for JSON String", info->id, typeStr); + return TSDB_CODE_TSC_INVALID_JSON_TYPE; + } + pVal->length = (int16_t)strlen(value->valuestring); + pVal->value = tcalloc(pVal->length + 1, 1); + memcpy(pVal->value, value->valuestring, pVal->length); + return TSDB_CODE_SUCCESS; +} + +int32_t parseValueFromJSONObj(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* info) { + int32_t ret = TSDB_CODE_SUCCESS; + int32_t size = cJSON_GetArraySize(root); + + if (size != OTD_JSON_SUB_FIELDS_NUM) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + cJSON *value = cJSON_GetObjectItem(root, "value"); + if (value == NULL) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + cJSON *type = cJSON_GetObjectItem(root, "type"); + if (!cJSON_IsString(type)) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + switch (value->type) { + case cJSON_True: + case cJSON_False: { + ret = convertJSONBool(pVal, type->valuestring, value->valueint, info); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + break; + } + case cJSON_Number: { + ret = convertJSONNumber(pVal, type->valuestring, value, info); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + break; + } + case cJSON_String: { + ret = convertJSONString(pVal, type->valuestring, value, info); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + break; + } + default: + return TSDB_CODE_TSC_INVALID_JSON_TYPE; + } + + return TSDB_CODE_SUCCESS; +} + +int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* info) { + int type = root->type; + + switch (type) { + case cJSON_True: + case cJSON_False: { + pVal->type = TSDB_DATA_TYPE_BOOL; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(bool *)(pVal->value) = root->valueint ? true : false; + break; + } + case cJSON_Number: { + //convert default JSON Number type to float + pVal->type = TSDB_DATA_TYPE_FLOAT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = tcalloc(pVal->length, 1); + *(float *)(pVal->value) = (float)(root->valuedouble); + break; + } + case cJSON_String: { + //convert default JSON String type to nchar + pVal->type = TSDB_DATA_TYPE_NCHAR; + //pVal->length = wcslen((wchar_t *)root->valuestring) * TSDB_NCHAR_SIZE; + pVal->length = (int16_t)strlen(root->valuestring); + pVal->value = tcalloc(pVal->length + 1, 1); + memcpy(pVal->value, root->valuestring, pVal->length); + break; + } + case cJSON_Object: { + int32_t ret = parseValueFromJSONObj(root, pVal, info); + if (ret != TSDB_CODE_SUCCESS) { + tscError("OTD:0x%"PRIx64" Failed to parse timestamp from JSON Obj", info->id); + return ret; + } + break; + } + default: + return TSDB_CODE_TSC_INVALID_JSON; + } + + return TSDB_CODE_SUCCESS; +} + +int32_t parseMetricValueFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, SSmlLinesInfo* info) { + //skip timestamp + TAOS_SML_KV *pVal = *pKVs + 1; + char key[] = OTD_METRIC_VALUE_COLUMN_NAME; + + cJSON *metricVal = cJSON_GetObjectItem(root, "value"); + if (metricVal == NULL) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + int32_t ret = parseValueFromJSON(metricVal, pVal, info); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + + pVal->key = tcalloc(sizeof(key), 1); + memcpy(pVal->key, key, sizeof(key)); + + *num_kvs += 1; + return TSDB_CODE_SUCCESS; + +} + +int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char **childTableName, SSmlLinesInfo* info) { + int32_t ret = TSDB_CODE_SUCCESS; + + cJSON *tags = cJSON_GetObjectItem(root, "tags"); + if (tags == NULL || tags->type != cJSON_Object) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + //only pick up the first ID value as child table name + cJSON *id = cJSON_GetObjectItem(tags, "ID"); + if (id != NULL) { + size_t idLen = strlen(id->valuestring); + ret = isValidChildTableName(id->valuestring, (int16_t)idLen); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + *childTableName = tcalloc(idLen + 1, sizeof(char)); + memcpy(*childTableName, id->valuestring, idLen); + //remove all ID fields from tags list no case sensitive + while (id != NULL) { + cJSON_DeleteItemFromObject(tags, "ID"); + id = cJSON_GetObjectItem(tags, "ID"); + } + } + + int32_t tagNum = cJSON_GetArraySize(tags); + //at least one tag pair required + if (tagNum <= 0) { + return TSDB_CODE_TSC_INVALID_JSON; + } + + //allocate memory for tags + *pKVs = tcalloc(tagNum, sizeof(TAOS_SML_KV)); + TAOS_SML_KV *pkv = *pKVs; + + for (int32_t i = 0; i < tagNum; ++i) { + cJSON *tag = cJSON_GetArrayItem(tags, i); + if (tag == NULL) { + return TSDB_CODE_TSC_INVALID_JSON; + } + //key + size_t keyLen = strlen(tag->string); + pkv->key = tcalloc(keyLen + 1, sizeof(char)); + strncpy(pkv->key, tag->string, keyLen); + //value + ret = parseValueFromJSON(tag, pkv, info); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + *num_kvs += 1; + pkv++; + } + + return ret; + +} + +int32_t tscParseJSONPayload(cJSON *root, TAOS_SML_DATA_POINT* pSml, SSmlLinesInfo* info) { + int32_t ret = TSDB_CODE_SUCCESS; + + if (!cJSON_IsObject(root)) { + tscError("OTD:0x%"PRIx64" data point needs to be JSON object", info->id); + return TSDB_CODE_TSC_INVALID_JSON; + } + + int32_t size = cJSON_GetArraySize(root); + //outmost json fields has to be exactly 4 + if (size != OTD_JSON_FIELDS_NUM) { + tscError("OTD:0x%"PRIx64" Invalid number of JSON fields in data point %d", info->id, size); + return TSDB_CODE_TSC_INVALID_JSON; + } + + //Parse metric + ret = parseMetricFromJSON(root, pSml, info); + if (ret != TSDB_CODE_SUCCESS) { + tscError("OTD:0x%"PRIx64" Unable to parse metric from JSON payload", info->id); + return ret; + } + tscDebug("OTD:0x%"PRIx64" Parse metric from JSON payload finished", info->id); + + //Parse timestamp + ret = parseTimestampFromJSON(root, &pSml->fields, &pSml->fieldNum, info); + if (ret) { + tscError("OTD:0x%"PRIx64" Unable to parse timestamp from JSON payload", info->id); + return ret; + } + tscDebug("OTD:0x%"PRIx64" Parse timestamp from JSON payload finished", info->id); + + //Parse metric value + ret = parseMetricValueFromJSON(root, &pSml->fields, &pSml->fieldNum, info); + if (ret) { + tscError("OTD:0x%"PRIx64" Unable to parse metric value from JSON payload", info->id); + return ret; + } + tscDebug("OTD:0x%"PRIx64" Parse metric value from JSON payload finished", info->id); + + //Parse tags + ret = parseTagsFromJSON(root, &pSml->tags, &pSml->tagNum, &pSml->childTableName, info); + if (ret) { + tscError("OTD:0x%"PRIx64" Unable to parse tags from JSON payload", info->id); + return ret; + } + tscDebug("OTD:0x%"PRIx64" Parse tags from JSON payload finished", info->id); + + return TSDB_CODE_SUCCESS; +} + +int32_t tscParseMultiJSONPayload(char* payload, SArray* points, SSmlLinesInfo* info) { + int32_t payloadNum, ret; + ret = TSDB_CODE_SUCCESS; + + if (payload == NULL) { + tscError("OTD:0x%"PRIx64" empty JSON Payload", info->id); + return TSDB_CODE_TSC_INVALID_JSON; + } + + cJSON *root = cJSON_Parse(payload); + //multiple data points must be sent in JSON array + if (cJSON_IsObject(root)) { + payloadNum = 1; + } else if (cJSON_IsArray(root)) { + payloadNum = cJSON_GetArraySize(root); + } else { + tscError("OTD:0x%"PRIx64" Invalid JSON Payload", info->id); + ret = TSDB_CODE_TSC_INVALID_JSON; + goto PARSE_JSON_OVER; + } + + for (int32_t i = 0; i < payloadNum; ++i) { + TAOS_SML_DATA_POINT point = {0}; + cJSON *dataPoint = (payloadNum == 1) ? root : cJSON_GetArrayItem(root, i); + + ret = tscParseJSONPayload(dataPoint, &point, info); + if (ret != TSDB_CODE_SUCCESS) { + tscError("OTD:0x%"PRIx64" JSON data point parse failed", info->id); + destroySmlDataPoint(&point); + goto PARSE_JSON_OVER; + } else { + tscDebug("OTD:0x%"PRIx64" JSON data point parse success", info->id); + } + taosArrayPush(points, &point); + } + +PARSE_JSON_OVER: + cJSON_Delete(root); + return ret; +} + +int taos_insert_json_payload(TAOS* taos, char* payload) { + int32_t code = 0; + + SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo)); + info->id = genUID(); + + if (payload == NULL) { + tscError("OTD:0x%"PRIx64" taos_insert_json_payload payload is NULL", info->id); + tfree(info); + code = TSDB_CODE_TSC_APP_ERROR; + return code; + } + + SArray* lpPoints = taosArrayInit(1, sizeof(TAOS_SML_DATA_POINT)); + if (lpPoints == NULL) { + tscError("OTD:0x%"PRIx64" taos_insert_json_payload failed to allocate memory", info->id); + tfree(info); + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + tscDebug("OTD:0x%"PRIx64" taos_insert_telnet_lines begin inserting %d points", info->id, 1); + code = tscParseMultiJSONPayload(payload, lpPoints, info); + size_t numPoints = taosArrayGetSize(lpPoints); + + if (code != 0) { + goto cleanup; + } + + TAOS_SML_DATA_POINT* points = TARRAY_GET_START(lpPoints); + code = tscSmlInsert(taos, points, (int)numPoints, info); + if (code != 0) { + tscError("OTD:0x%"PRIx64" taos_insert_json_payload error: %s", info->id, tstrerror((code))); + } + +cleanup: + tscDebug("OTD:0x%"PRIx64" taos_insert_json_payload finish inserting 1 Point. code: %d", info->id, code); + points = TARRAY_GET_START(lpPoints); + numPoints = taosArrayGetSize(lpPoints); + for (int i = 0; i < numPoints; ++i) { + destroySmlDataPoint(points+i); + } + + taosArrayDestroy(lpPoints); + + tfree(info); + return code; +} diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e4728a410a0a9f0d1f8d0002f35a35fe5fda9f88..9746f79d9ae51845c9b997929916b6f83a0cc140 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -281,6 +281,8 @@ static uint8_t convertRelationalOperator(SStrToken *pToken) { return TSDB_RELATION_LIKE; case TK_MATCH: return TSDB_RELATION_MATCH; + case TK_NMATCH: + return TSDB_RELATION_NMATCH; case TK_ISNULL: return TSDB_RELATION_ISNULL; case TK_NOTNULL: @@ -3782,6 +3784,9 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, case TK_MATCH: pColumnFilter->lowerRelOptr = TSDB_RELATION_MATCH; break; + case TK_NMATCH: + pColumnFilter->lowerRelOptr = TSDB_RELATION_NMATCH; + break; case TK_ISNULL: pColumnFilter->lowerRelOptr = TSDB_RELATION_ISNULL; break; @@ -3846,15 +3851,17 @@ static int32_t tablenameListToString(tSqlExpr* pExpr, SStringBuilder* sb) { } static int32_t tablenameCondToString(tSqlExpr* pExpr, uint32_t opToken, SStringBuilder* sb) { - assert(opToken == TK_LIKE || opToken == TK_MATCH); + assert(opToken == TK_LIKE || opToken == TK_MATCH || opToken == TK_NMATCH); if (opToken == TK_LIKE) { taosStringBuilderAppendStringLen(sb, QUERY_COND_REL_PREFIX_LIKE, QUERY_COND_REL_PREFIX_LIKE_LEN); taosStringBuilderAppendString(sb, pExpr->value.pz); } else if (opToken == TK_MATCH) { taosStringBuilderAppendStringLen(sb, QUERY_COND_REL_PREFIX_MATCH, QUERY_COND_REL_PREFIX_MATCH_LEN); taosStringBuilderAppendString(sb, pExpr->value.pz); + } else if (opToken == TK_NMATCH) { + taosStringBuilderAppendStringLen(sb, QUERY_COND_REL_PREFIX_NMATCH, QUERY_COND_REL_PREFIX_NMATCH_LEN); + taosStringBuilderAppendString(sb, pExpr->value.pz); } - return TSDB_CODE_SUCCESS; } @@ -3903,12 +3910,13 @@ static int32_t checkColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCol && pExpr->tokenId != TK_NOTNULL && pExpr->tokenId != TK_LIKE && pExpr->tokenId != TK_MATCH + && pExpr->tokenId != TK_NMATCH && pExpr->tokenId != TK_IN) { ret = invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); goto _err_ret; } } else { - if (pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH) { + if (pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH || pExpr->tokenId == TK_NMATCH) { ret = invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); goto _err_ret; } @@ -3956,7 +3964,7 @@ static int32_t getTablenameCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* if (pTableCond->tokenId == TK_IN) { ret = tablenameListToString(pRight, sb); - } else if (pTableCond->tokenId == TK_LIKE || pTableCond->tokenId == TK_MATCH) { + } else if (pTableCond->tokenId == TK_LIKE || pTableCond->tokenId == TK_MATCH || pTableCond->tokenId == TK_NMATCH) { if (pRight->tokenId != TK_STRING) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -4410,7 +4418,7 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr } static bool validTableNameOptr(tSqlExpr* pExpr) { - const char nameFilterOptr[] = {TK_IN, TK_LIKE, TK_MATCH}; + const char nameFilterOptr[] = {TK_IN, TK_LIKE, TK_MATCH, TK_NMATCH}; for (int32_t i = 0; i < tListLen(nameFilterOptr); ++i) { if (pExpr->tokenId == nameFilterOptr[i]) { @@ -4505,13 +4513,13 @@ static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t // check for match expression static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t index, char* msgBuf) { const char* msg1 = "regular expression string should be less than %d characters"; - const char* msg2 = "illegal column type for match"; + const char* msg2 = "illegal column type for match/nmatch"; const char* msg3 = "invalid regular expression"; tSqlExpr* pLeft = pExpr->pLeft; tSqlExpr* pRight = pExpr->pRight; - if (pExpr->tokenId == TK_MATCH) { + if (pExpr->tokenId == TK_MATCH || pExpr->tokenId == TK_NMATCH) { if (pRight->value.nLen > tsMaxRegexStringLen) { char tmp[64] = {0}; sprintf(tmp, msg1, tsMaxRegexStringLen); @@ -4519,10 +4527,14 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_ } SSchema* pSchema = tscGetTableSchema(pTableMeta); - if ((!isTablenameToken(&pLeft->columnName)) && !IS_VAR_DATA_TYPE(pSchema[index].type)) { + if ((!isTablenameToken(&pLeft->columnName)) &&(pSchema[index].type != TSDB_DATA_TYPE_BINARY)) { return invalidOperationMsg(msgBuf, msg2); } + if (!(pRight->type == SQL_NODE_VALUE && pRight->value.nType == TSDB_DATA_TYPE_BINARY)) { + return invalidOperationMsg(msgBuf, msg3); + } + int errCode = 0; regex_t regex; char regErrBuf[256] = {0}; @@ -4925,9 +4937,12 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, STagCond* pTagCond = &pQueryInfo->tagCond; pTagCond->tbnameCond.uid = pTableMetaInfo->pTableMeta->id.uid; - assert(pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH || pExpr->tokenId == TK_IN); + assert(pExpr->tokenId == TK_LIKE + || pExpr->tokenId == TK_MATCH + || pExpr->tokenId == TK_NMATCH + || pExpr->tokenId == TK_IN); - if (pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH) { + if (pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH || pExpr->tokenId == TK_NMATCH) { char* str = taosStringBuilderGetResult(sb, NULL); pQueryInfo->tagCond.tbnameCond.cond = strdup(str); pQueryInfo->tagCond.tbnameCond.len = (int32_t) strlen(str); @@ -8224,11 +8239,12 @@ static int32_t handleExprInHavingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, S && pExpr->tokenId != TK_NOTNULL && pExpr->tokenId != TK_LIKE && pExpr->tokenId != TK_MATCH + && pExpr->tokenId != TK_NMATCH ) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } } else { - if (pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH) { + if (pExpr->tokenId == TK_LIKE || pExpr->tokenId == TK_MATCH || pExpr->tokenId == TK_NMATCH) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } diff --git a/src/common/inc/texpr.h b/src/common/inc/texpr.h index db71559df6334ed935a44f3822f78ff671e8dab2..0ede2e1e6f71c69aa6aaed2c05d671840679ce5c 100644 --- a/src/common/inc/texpr.h +++ b/src/common/inc/texpr.h @@ -34,10 +34,12 @@ struct SSchema; #define QUERY_COND_REL_PREFIX_IN "IN|" #define QUERY_COND_REL_PREFIX_LIKE "LIKE|" #define QUERY_COND_REL_PREFIX_MATCH "MATCH|" +#define QUERY_COND_REL_PREFIX_NMATCH "NMATCH|" #define QUERY_COND_REL_PREFIX_IN_LEN 3 #define QUERY_COND_REL_PREFIX_LIKE_LEN 5 #define QUERY_COND_REL_PREFIX_MATCH_LEN 6 +#define QUERY_COND_REL_PREFIX_NMATCH_LEN 7 typedef bool (*__result_filter_fn_t)(const void *, void *); typedef void (*__do_filter_suppl_fn_t)(void *, void *); diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 2c72b7bd591ab4cb2d11d1420ae97e7cc2123272..6823de631fe65a27f527be011def4819dd77c73a 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -440,7 +440,16 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) { memcpy(pVal->pz, tbnameCond + QUERY_COND_REL_PREFIX_MATCH_LEN, len); pVal->nType = TSDB_DATA_TYPE_BINARY; pVal->nLen = (int32_t)len; - + } else if (strncmp(tbnameCond, QUERY_COND_REL_PREFIX_NMATCH, QUERY_COND_REL_PREFIX_NMATCH_LEN) == 0) { + right->nodeType = TSQL_NODE_VALUE; + expr->_node.optr = TSDB_RELATION_NMATCH; + tVariant* pVal = exception_calloc(1, sizeof(tVariant)); + right->pVal = pVal; + size_t len = strlen(tbnameCond + QUERY_COND_REL_PREFIX_NMATCH_LEN) + 1; + pVal->pz = exception_malloc(len); + memcpy(pVal->pz, tbnameCond + QUERY_COND_REL_PREFIX_NMATCH_LEN, len); + pVal->nType = TSDB_DATA_TYPE_BINARY; + pVal->nLen = (int32_t)len; } else if (strncmp(tbnameCond, QUERY_COND_REL_PREFIX_IN, QUERY_COND_REL_PREFIX_IN_LEN) == 0) { right->nodeType = TSQL_NODE_VALUE; expr->_node.optr = TSDB_RELATION_IN; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index fa9162b9e0ae3f9b92113f773eb6b49cfed8e2aa..020a15537b8fcb161aa0467af29cfa27cb8b762b 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -1044,6 +1044,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_BYTE; taosInitConfigOption(cfg); + cfg.option = "maxRegexStringLen"; + cfg.ptr = &tsMaxRegexStringLen; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = 0; + cfg.maxValue = TSDB_MAX_FIELD_LEN; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_BYTE; + taosInitConfigOption(cfg); + cfg.option = "maxNumOfOrderedRes"; cfg.ptr = &tsMaxNumOfOrderedResults; cfg.valType = TAOS_CFG_VTYPE_INT32; diff --git a/src/connector/jdbc/pom.xml b/src/connector/jdbc/pom.xml index 6b9fc9d96ce16700ee1243ef7c148a423a965d0b..256fa614e0bd0a88e0c676a3ae13c9c177eb5215 100644 --- a/src/connector/jdbc/pom.xml +++ b/src/connector/jdbc/pom.xml @@ -113,6 +113,7 @@ **/AppMemoryLeakTest.java + **/JDBCTypeAndTypeCompareTest.java **/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java **/DatetimeBefore1970Test.java **/FailOverTest.java diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java new file mode 100644 index 0000000000000000000000000000000000000000..eb3b2985dfaff1b956909a50ca23470279cb48ca --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java @@ -0,0 +1,34 @@ +package com.taosdata.jdbc.cases; + +import org.junit.Test; + +import java.sql.*; + +public class JDBCTypeAndTypeCompareTest { + + @Test + public void test() throws SQLException { + Connection conn = DriverManager.getConnection("jdbc:TAOS://192.168.17.156:6030/", "root", "taosdata"); + Statement stmt = conn.createStatement(); + + stmt.execute("drop database if exists test"); + stmt.execute("create database if not exists test"); + stmt.execute("use test"); + stmt.execute("create table weather(ts timestamp, f1 int, f2 bigint, f3 float, f4 double, f5 smallint, f6 tinyint, f7 bool, f8 binary(10), f9 nchar(10) )"); + stmt.execute("insert into weather values(now, 1, 2, 3.0, 4.0, 5, 6, true, 'test','test')"); + + ResultSet rs = stmt.executeQuery("select * from weather"); + ResultSetMetaData meta = rs.getMetaData(); + while (rs.next()) { + for (int i = 1; i <= meta.getColumnCount(); i++) { + String columnName = meta.getColumnName(i); + String columnTypeName = meta.getColumnTypeName(i); + Object value = rs.getObject(i); + System.out.printf("columnName : %s, columnTypeName: %s, JDBCType: %s\n", columnName, columnTypeName, value.getClass().getName()); + } + } + + stmt.close(); + conn.close(); + } +} diff --git a/src/connector/python/taos/cinterface.py b/src/connector/python/taos/cinterface.py index aad9d1fdbfd4f900fe2db96dadbf343ea922be22..c5737ea5a07b7678e058307dfe3b47546dd99909 100644 --- a/src/connector/python/taos/cinterface.py +++ b/src/connector/python/taos/cinterface.py @@ -835,8 +835,14 @@ def taos_insert_telnet_lines(connection, lines): p_lines = lines_type(*lines) errno = _libtaos.taos_insert_telnet_lines(connection, p_lines, num_of_lines) if errno != 0: - raise LinesError("insert telnet lines error", errno) + raise TelnetLinesError("insert telnet lines error", errno) +def taos_insert_json_payload(connection, payload): + # type: (c_void_p, list[str] | tuple(str)) -> None + payload = payload.encode("utf-8") + errno = _libtaos.taos_insert_json_payload(connection, payload) + if errno != 0: + raise JsonPayloadError("insert json payload error", errno) class CTaosInterface(object): def __init__(self, config=None): diff --git a/src/connector/python/taos/connection.py b/src/connector/python/taos/connection.py index a8a71ecc3a8a5f2bdc960df364213e80018a70fe..35aca1fb26c1e612c3b3f6b1d8c794495bed0035 100644 --- a/src/connector/python/taos/connection.py +++ b/src/connector/python/taos/connection.py @@ -154,6 +154,25 @@ class TaosConnection(object): """ return taos_insert_telnet_lines(self._conn, lines) + def insert_json_payload(self, payload): + """OpenTSDB HTTP JSON format support + + ## Example + "{ + "metric": "cpu_load_0", + "timestamp": 1626006833610123, + "value": 55.5, + "tags": + { + "host": "ubuntu", + "interface": "eth0", + "Id": "tb0" + } + }" + + """ + return taos_insert_json_payload(self._conn, payload) + def cursor(self): # type: () -> TaosCursor """Return a new Cursor object using the connection.""" diff --git a/src/connector/python/taos/error.py b/src/connector/python/taos/error.py index a30adbb162f1c194bdfcf4cca5c43f01107a9776..f6a9d41f56a3fb071080daaae3bdd840190b154d 100644 --- a/src/connector/python/taos/error.py +++ b/src/connector/python/taos/error.py @@ -83,4 +83,14 @@ class ResultError(DatabaseError): class LinesError(DatabaseError): """taos_insert_lines errors.""" - pass \ No newline at end of file + pass + +class TelnetLinesError(DatabaseError): + """taos_insert_telnet_lines errors.""" + + pass + +class JsonPayloadError(DatabaseError): + """taos_insert_json_payload errors.""" + + pass diff --git a/src/inc/taos.h b/src/inc/taos.h index a71e4bf50c600a8c9963e616c5e79cbfbe164556..edb1552b811a2ff4b8c78c19523cc6f2ad82ba74 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -174,6 +174,8 @@ DLL_EXPORT int taos_insert_lines(TAOS* taos, char* lines[], int numLines); DLL_EXPORT int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines); +DLL_EXPORT int taos_insert_json_payload(TAOS* taos, char* payload); + #ifdef __cplusplus } #endif diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 59135ce68006a91fae7b27ae1ea91f4b628631b1..ef7cd839018c89f605f702540e7a56e047d5126c 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -165,6 +165,7 @@ do { \ #define TSDB_RELATION_NOT 13 #define TSDB_RELATION_MATCH 14 +#define TSDB_RELATION_NMATCH 15 #define TSDB_BINARY_OP_ADD 30 #define TSDB_BINARY_OP_SUBTRACT 31 diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index 5b4657f7a322bb351e4d41711d2960f4ac2b7657..d59b88c7e698b3e965b5923efdc760e0289f7250 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -108,6 +108,9 @@ int32_t* taosGetErrno(); #define TSDB_CODE_TSC_INVALID_TAG_LENGTH TAOS_DEF_ERROR_CODE(0, 0x021E) //"Invalid tag length") #define TSDB_CODE_TSC_INVALID_COLUMN_LENGTH TAOS_DEF_ERROR_CODE(0, 0x021F) //"Invalid column length") #define TSDB_CODE_TSC_DUP_TAG_NAMES TAOS_DEF_ERROR_CODE(0, 0x0220) //"duplicated tag names") +#define TSDB_CODE_TSC_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x0221) //"Invalid JSON format") +#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222) //"Invalid JSON data type") +#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223) //"Value out of range") // mnode #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed") diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 501c7a4c699c94091c4c83b2d8e8c41afcfc8ab7..9b0ad2cf13b6df01bda56906891a4de677ff08a3 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -38,179 +38,180 @@ #define TK_IS 20 #define TK_LIKE 21 #define TK_MATCH 22 -#define TK_GLOB 23 -#define TK_BETWEEN 24 -#define TK_IN 25 -#define TK_GT 26 -#define TK_GE 27 -#define TK_LT 28 -#define TK_LE 29 -#define TK_BITAND 30 -#define TK_BITOR 31 -#define TK_LSHIFT 32 -#define TK_RSHIFT 33 -#define TK_PLUS 34 -#define TK_MINUS 35 -#define TK_DIVIDE 36 -#define TK_TIMES 37 -#define TK_STAR 38 -#define TK_SLASH 39 -#define TK_REM 40 -#define TK_CONCAT 41 -#define TK_UMINUS 42 -#define TK_UPLUS 43 -#define TK_BITNOT 44 -#define TK_SHOW 45 -#define TK_DATABASES 46 -#define TK_TOPICS 47 -#define TK_FUNCTIONS 48 -#define TK_MNODES 49 -#define TK_DNODES 50 -#define TK_ACCOUNTS 51 -#define TK_USERS 52 -#define TK_MODULES 53 -#define TK_QUERIES 54 -#define TK_CONNECTIONS 55 -#define TK_STREAMS 56 -#define TK_VARIABLES 57 -#define TK_SCORES 58 -#define TK_GRANTS 59 -#define TK_VNODES 60 -#define TK_DOT 61 -#define TK_CREATE 62 -#define TK_TABLE 63 -#define TK_STABLE 64 -#define TK_DATABASE 65 -#define TK_TABLES 66 -#define TK_STABLES 67 -#define TK_VGROUPS 68 -#define TK_DROP 69 -#define TK_TOPIC 70 -#define TK_FUNCTION 71 -#define TK_DNODE 72 -#define TK_USER 73 -#define TK_ACCOUNT 74 -#define TK_USE 75 -#define TK_DESCRIBE 76 -#define TK_DESC 77 -#define TK_ALTER 78 -#define TK_PASS 79 -#define TK_PRIVILEGE 80 -#define TK_LOCAL 81 -#define TK_COMPACT 82 -#define TK_LP 83 -#define TK_RP 84 -#define TK_IF 85 -#define TK_EXISTS 86 -#define TK_AS 87 -#define TK_OUTPUTTYPE 88 -#define TK_AGGREGATE 89 -#define TK_BUFSIZE 90 -#define TK_PPS 91 -#define TK_TSERIES 92 -#define TK_DBS 93 -#define TK_STORAGE 94 -#define TK_QTIME 95 -#define TK_CONNS 96 -#define TK_STATE 97 -#define TK_COMMA 98 -#define TK_KEEP 99 -#define TK_CACHE 100 -#define TK_REPLICA 101 -#define TK_QUORUM 102 -#define TK_DAYS 103 -#define TK_MINROWS 104 -#define TK_MAXROWS 105 -#define TK_BLOCKS 106 -#define TK_CTIME 107 -#define TK_WAL 108 -#define TK_FSYNC 109 -#define TK_COMP 110 -#define TK_PRECISION 111 -#define TK_UPDATE 112 -#define TK_CACHELAST 113 -#define TK_PARTITIONS 114 -#define TK_UNSIGNED 115 -#define TK_TAGS 116 -#define TK_USING 117 -#define TK_NULL 118 -#define TK_NOW 119 -#define TK_SELECT 120 -#define TK_UNION 121 -#define TK_ALL 122 -#define TK_DISTINCT 123 -#define TK_FROM 124 -#define TK_VARIABLE 125 -#define TK_INTERVAL 126 -#define TK_EVERY 127 -#define TK_SESSION 128 -#define TK_STATE_WINDOW 129 -#define TK_FILL 130 -#define TK_SLIDING 131 -#define TK_ORDER 132 -#define TK_BY 133 -#define TK_ASC 134 -#define TK_GROUP 135 -#define TK_HAVING 136 -#define TK_LIMIT 137 -#define TK_OFFSET 138 -#define TK_SLIMIT 139 -#define TK_SOFFSET 140 -#define TK_WHERE 141 -#define TK_RESET 142 -#define TK_QUERY 143 -#define TK_SYNCDB 144 -#define TK_ADD 145 -#define TK_COLUMN 146 -#define TK_MODIFY 147 -#define TK_TAG 148 -#define TK_CHANGE 149 -#define TK_SET 150 -#define TK_KILL 151 -#define TK_CONNECTION 152 -#define TK_STREAM 153 -#define TK_COLON 154 -#define TK_ABORT 155 -#define TK_AFTER 156 -#define TK_ATTACH 157 -#define TK_BEFORE 158 -#define TK_BEGIN 159 -#define TK_CASCADE 160 -#define TK_CLUSTER 161 -#define TK_CONFLICT 162 -#define TK_COPY 163 -#define TK_DEFERRED 164 -#define TK_DELIMITERS 165 -#define TK_DETACH 166 -#define TK_EACH 167 -#define TK_END 168 -#define TK_EXPLAIN 169 -#define TK_FAIL 170 -#define TK_FOR 171 -#define TK_IGNORE 172 -#define TK_IMMEDIATE 173 -#define TK_INITIALLY 174 -#define TK_INSTEAD 175 -#define TK_KEY 176 -#define TK_OF 177 -#define TK_RAISE 178 -#define TK_REPLACE 179 -#define TK_RESTRICT 180 -#define TK_ROW 181 -#define TK_STATEMENT 182 -#define TK_TRIGGER 183 -#define TK_VIEW 184 -#define TK_IPTOKEN 185 -#define TK_SEMI 186 -#define TK_NONE 187 -#define TK_PREV 188 -#define TK_LINEAR 189 -#define TK_IMPORT 190 -#define TK_TBNAME 191 -#define TK_JOIN 192 -#define TK_INSERT 193 -#define TK_INTO 194 -#define TK_VALUES 195 +#define TK_NMATCH 23 +#define TK_GLOB 24 +#define TK_BETWEEN 25 +#define TK_IN 26 +#define TK_GT 27 +#define TK_GE 28 +#define TK_LT 29 +#define TK_LE 30 +#define TK_BITAND 31 +#define TK_BITOR 32 +#define TK_LSHIFT 33 +#define TK_RSHIFT 34 +#define TK_PLUS 35 +#define TK_MINUS 36 +#define TK_DIVIDE 37 +#define TK_TIMES 38 +#define TK_STAR 39 +#define TK_SLASH 40 +#define TK_REM 41 +#define TK_CONCAT 42 +#define TK_UMINUS 43 +#define TK_UPLUS 44 +#define TK_BITNOT 45 +#define TK_SHOW 46 +#define TK_DATABASES 47 +#define TK_TOPICS 48 +#define TK_FUNCTIONS 49 +#define TK_MNODES 50 +#define TK_DNODES 51 +#define TK_ACCOUNTS 52 +#define TK_USERS 53 +#define TK_MODULES 54 +#define TK_QUERIES 55 +#define TK_CONNECTIONS 56 +#define TK_STREAMS 57 +#define TK_VARIABLES 58 +#define TK_SCORES 59 +#define TK_GRANTS 60 +#define TK_VNODES 61 +#define TK_DOT 62 +#define TK_CREATE 63 +#define TK_TABLE 64 +#define TK_STABLE 65 +#define TK_DATABASE 66 +#define TK_TABLES 67 +#define TK_STABLES 68 +#define TK_VGROUPS 69 +#define TK_DROP 70 +#define TK_TOPIC 71 +#define TK_FUNCTION 72 +#define TK_DNODE 73 +#define TK_USER 74 +#define TK_ACCOUNT 75 +#define TK_USE 76 +#define TK_DESCRIBE 77 +#define TK_DESC 78 +#define TK_ALTER 79 +#define TK_PASS 80 +#define TK_PRIVILEGE 81 +#define TK_LOCAL 82 +#define TK_COMPACT 83 +#define TK_LP 84 +#define TK_RP 85 +#define TK_IF 86 +#define TK_EXISTS 87 +#define TK_AS 88 +#define TK_OUTPUTTYPE 89 +#define TK_AGGREGATE 90 +#define TK_BUFSIZE 91 +#define TK_PPS 92 +#define TK_TSERIES 93 +#define TK_DBS 94 +#define TK_STORAGE 95 +#define TK_QTIME 96 +#define TK_CONNS 97 +#define TK_STATE 98 +#define TK_COMMA 99 +#define TK_KEEP 100 +#define TK_CACHE 101 +#define TK_REPLICA 102 +#define TK_QUORUM 103 +#define TK_DAYS 104 +#define TK_MINROWS 105 +#define TK_MAXROWS 106 +#define TK_BLOCKS 107 +#define TK_CTIME 108 +#define TK_WAL 109 +#define TK_FSYNC 110 +#define TK_COMP 111 +#define TK_PRECISION 112 +#define TK_UPDATE 113 +#define TK_CACHELAST 114 +#define TK_PARTITIONS 115 +#define TK_UNSIGNED 116 +#define TK_TAGS 117 +#define TK_USING 118 +#define TK_NULL 119 +#define TK_NOW 120 +#define TK_SELECT 121 +#define TK_UNION 122 +#define TK_ALL 123 +#define TK_DISTINCT 124 +#define TK_FROM 125 +#define TK_VARIABLE 126 +#define TK_INTERVAL 127 +#define TK_EVERY 128 +#define TK_SESSION 129 +#define TK_STATE_WINDOW 130 +#define TK_FILL 131 +#define TK_SLIDING 132 +#define TK_ORDER 133 +#define TK_BY 134 +#define TK_ASC 135 +#define TK_GROUP 136 +#define TK_HAVING 137 +#define TK_LIMIT 138 +#define TK_OFFSET 139 +#define TK_SLIMIT 140 +#define TK_SOFFSET 141 +#define TK_WHERE 142 +#define TK_RESET 143 +#define TK_QUERY 144 +#define TK_SYNCDB 145 +#define TK_ADD 146 +#define TK_COLUMN 147 +#define TK_MODIFY 148 +#define TK_TAG 149 +#define TK_CHANGE 150 +#define TK_SET 151 +#define TK_KILL 152 +#define TK_CONNECTION 153 +#define TK_STREAM 154 +#define TK_COLON 155 +#define TK_ABORT 156 +#define TK_AFTER 157 +#define TK_ATTACH 158 +#define TK_BEFORE 159 +#define TK_BEGIN 160 +#define TK_CASCADE 161 +#define TK_CLUSTER 162 +#define TK_CONFLICT 163 +#define TK_COPY 164 +#define TK_DEFERRED 165 +#define TK_DELIMITERS 166 +#define TK_DETACH 167 +#define TK_EACH 168 +#define TK_END 169 +#define TK_EXPLAIN 170 +#define TK_FAIL 171 +#define TK_FOR 172 +#define TK_IGNORE 173 +#define TK_IMMEDIATE 174 +#define TK_INITIALLY 175 +#define TK_INSTEAD 176 +#define TK_KEY 177 +#define TK_OF 178 +#define TK_RAISE 179 +#define TK_REPLACE 180 +#define TK_RESTRICT 181 +#define TK_ROW 182 +#define TK_STATEMENT 183 +#define TK_TRIGGER 184 +#define TK_VIEW 185 +#define TK_IPTOKEN 186 +#define TK_SEMI 187 +#define TK_NONE 188 +#define TK_PREV 189 +#define TK_LINEAR 190 +#define TK_IMPORT 191 +#define TK_TBNAME 192 +#define TK_JOIN 193 +#define TK_INSERT 194 +#define TK_INTO 195 +#define TK_VALUES 196 #define TK_SPACE 300 diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index c9d284828b7e4ab37b1f197c0a0bf869175146af..fb8d88de13767faff230f1d84f22c117a34b1e1d 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -109,8 +109,7 @@ extern char configDir[]; #define DEFAULT_DATATYPE_NUM 1 #define DEFAULT_CHILDTABLES 10000 - -#define STMT_BIND_PARAM_BATCH 0 +#define STMT_BIND_PARAM_BATCH 1 char* g_sampleDataBuf = NULL; #if STMT_BIND_PARAM_BATCH == 1 @@ -3576,10 +3575,8 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos, char* childTblName = *childTblNameOfSuperTbl; - if (offset >= 0) { - snprintf(limitBuf, 100, " limit %"PRId64" offset %"PRIu64"", - limit, offset); - } + snprintf(limitBuf, 100, " limit %"PRId64" offset %"PRIu64"", + limit, offset); //get all child table name use cmd: select tbname from superTblName; snprintf(command, 1024, "select tbname from %s.%s %s", @@ -5432,7 +5429,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { g_Dbs.db[i].superTbls[j].interlaceRows = g_Dbs.db[i].superTbls[j].insertRows; } } else if (!stbInterlaceRows) { - g_Dbs.db[i].superTbls[j].interlaceRows = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req + g_Dbs.db[i].superTbls[j].interlaceRows = g_args.interlaceRows; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req } else { errorPrint( "%s", "failed to read json, interlace rows input mistake\n"); @@ -7450,6 +7447,7 @@ static int32_t prepareStmtWithoutStb( g_args.binwidth, pThreadInfo->time_precision, NULL)) { + free(bindArray); return -1; } } @@ -8104,7 +8102,7 @@ static int parseSampleToStmt( SSuperTable *stbInfo, uint32_t timePrec) { pThreadInfo->sampleBindArray = - calloc(1, sizeof(char *) * MAX_SAMPLES); + (char *)calloc(1, sizeof(char *) * MAX_SAMPLES); if (pThreadInfo->sampleBindArray == NULL) { errorPrint2("%s() LN%d, Failed to allocate %"PRIu64" bind array buffer\n", __func__, __LINE__, @@ -8172,6 +8170,7 @@ static int parseSampleToStmt( timePrec, bindBuffer)) { free(bindBuffer); + free(bindArray); return -1; } free(bindBuffer); @@ -8294,7 +8293,7 @@ static uint32_t execBindParam( } #endif -static int32_t prepareStbStmtWithSample( +static int32_t prepareStbStmt( threadInfo *pThreadInfo, char *tableName, int64_t tableSeq, @@ -8468,21 +8467,18 @@ static void* syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo, uint32_t inter pThreadInfo->threadID, __func__, __LINE__); int64_t insertRows; - uint64_t maxSqlLen; - int64_t nTimeStampStep; + int64_t timeStampStep; uint64_t insert_interval; SSuperTable* stbInfo = pThreadInfo->stbInfo; if (stbInfo) { insertRows = stbInfo->insertRows; - maxSqlLen = stbInfo->maxSqlLen; - nTimeStampStep = stbInfo->timeStampStep; + timeStampStep = stbInfo->timeStampStep; insert_interval = stbInfo->insertInterval; } else { insertRows = g_args.insertRows; - maxSqlLen = g_args.max_sql_len; - nTimeStampStep = g_args.timestamp_step; + timeStampStep = g_args.timestamp_step; insert_interval = g_args.insert_interval; } @@ -8491,18 +8487,14 @@ static void* syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo, uint32_t inter pThreadInfo->start_table_from, pThreadInfo->ntables, insertRows); - uint32_t batchPerTbl = interlaceRows; - uint32_t batchPerTblTimes; + uint64_t timesInterlace = (insertRows / interlaceRows) + 1; + uint32_t precalcBatch = interlaceRows; - if (interlaceRows > g_args.reqPerReq) - interlaceRows = g_args.reqPerReq; + if (precalcBatch > g_args.reqPerReq) + precalcBatch = g_args.reqPerReq; - if ((interlaceRows > 0) && (pThreadInfo->ntables > 1)) { - batchPerTblTimes = - g_args.reqPerReq / interlaceRows; - } else { - batchPerTblTimes = 1; - } + if (precalcBatch > MAX_SAMPLES) + precalcBatch = MAX_SAMPLES; pThreadInfo->totalInsertRows = 0; pThreadInfo->totalAffectedRows = 0; @@ -8515,27 +8507,27 @@ static void* syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo, uint32_t inter uint64_t endTs; uint64_t tableSeq = pThreadInfo->start_table_from; - int64_t startTime = pThreadInfo->start_time; + int64_t startTime; - uint64_t generatedRecPerTbl = 0; bool flagSleep = true; uint64_t sleepTimeTotal = 0; int percentComplete = 0; int64_t totalRows = insertRows * pThreadInfo->ntables; + pThreadInfo->samplePos = 0; - while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) { + for (int64_t interlace = 0; + interlace < timesInterlace; interlace ++) { if ((flagSleep) && (insert_interval)) { st = taosGetTimestampMs(); flagSleep = false; } - uint32_t recOfBatch = 0; + int64_t generated = 0; + int64_t samplePos; - int32_t generated; - for (uint64_t i = 0; i < batchPerTblTimes; i ++) { + for (; tableSeq < pThreadInfo->start_table_from + pThreadInfo->ntables; tableSeq ++) { char tableName[TSDB_TABLE_NAME_LEN]; - getTableName(tableName, pThreadInfo, tableSeq); if (0 == strlen(tableName)) { errorPrint2("[%d] %s() LN%d, getTableName return null\n", @@ -8543,127 +8535,121 @@ static void* syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo, uint32_t inter return NULL; } - if (stbInfo) { - generated = prepareStbStmtWithSample( - pThreadInfo, - tableName, - tableSeq, - batchPerTbl, - insertRows, 0, - startTime, - &(pThreadInfo->samplePos)); - } else { - debugPrint("[%d] %s() LN%d, tableName:%s, batch:%d startTime:%"PRId64"\n", - pThreadInfo->threadID, - __func__, __LINE__, - tableName, batchPerTbl, startTime); - generated = prepareStmtWithoutStb( - pThreadInfo, - tableName, - batchPerTbl, - insertRows, i, - startTime); - } + samplePos = pThreadInfo->samplePos; + startTime = pThreadInfo->start_time + + interlace * interlaceRows * timeStampStep; + uint64_t remainRecPerTbl = + insertRows - interlaceRows * interlace; + uint64_t recPerTbl = 0; - debugPrint("[%d] %s() LN%d, generated records is %d\n", - pThreadInfo->threadID, __func__, __LINE__, generated); - if (generated < 0) { - errorPrint2("[%d] %s() LN%d, generated records is %d\n", - pThreadInfo->threadID, __func__, __LINE__, generated); - goto free_of_interlace_stmt; - } else if (generated == 0) { - break; + uint64_t remainPerInterlace; + if (remainRecPerTbl > interlaceRows) { + remainPerInterlace = interlaceRows; + } else { + remainPerInterlace = remainRecPerTbl; } - tableSeq ++; - recOfBatch += batchPerTbl; + while(remainPerInterlace > 0) { - pThreadInfo->totalInsertRows += batchPerTbl; - - verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", - pThreadInfo->threadID, __func__, __LINE__, - batchPerTbl, recOfBatch); - - if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { - // turn to first table - tableSeq = pThreadInfo->start_table_from; - generatedRecPerTbl += batchPerTbl; + uint32_t batch; + if (remainPerInterlace > precalcBatch) { + batch = precalcBatch; + } else { + batch = remainPerInterlace; + } + debugPrint("[%d] %s() LN%d, tableName:%s, batch:%d startTime:%"PRId64"\n", + pThreadInfo->threadID, + __func__, __LINE__, + tableName, batch, startTime); - startTime = pThreadInfo->start_time - + generatedRecPerTbl * nTimeStampStep; + if (stbInfo) { + generated = prepareStbStmt( + pThreadInfo, + tableName, + tableSeq, + batch, + insertRows, 0, + startTime, + &samplePos); + } else { + generated = prepareStmtWithoutStb( + pThreadInfo, + tableName, + batch, + insertRows, + interlaceRows * interlace + recPerTbl, + startTime); + } - flagSleep = true; - if (generatedRecPerTbl >= insertRows) + debugPrint("[%d] %s() LN%d, generated records is %"PRId64"\n", + pThreadInfo->threadID, __func__, __LINE__, generated); + if (generated < 0) { + errorPrint2("[%d] %s() LN%d, generated records is %"PRId64"\n", + pThreadInfo->threadID, __func__, __LINE__, generated); + goto free_of_interlace_stmt; + } else if (generated == 0) { break; + } - int64_t remainRows = insertRows - generatedRecPerTbl; - if ((remainRows > 0) && (batchPerTbl > remainRows)) - batchPerTbl = remainRows; + recPerTbl += generated; + remainPerInterlace -= generated; + pThreadInfo->totalInsertRows += generated; - if (pThreadInfo->ntables * batchPerTbl < g_args.reqPerReq) - break; - } + verbosePrint("[%d] %s() LN%d totalInsertRows=%"PRIu64"\n", + pThreadInfo->threadID, __func__, __LINE__, + pThreadInfo->totalInsertRows); - verbosePrint("[%d] %s() LN%d generatedRecPerTbl=%"PRId64" insertRows=%"PRId64"\n", - pThreadInfo->threadID, __func__, __LINE__, - generatedRecPerTbl, insertRows); + startTs = taosGetTimestampUs(); - if ((g_args.reqPerReq - recOfBatch) < batchPerTbl) - break; - } + int64_t affectedRows = execInsert(pThreadInfo, generated); - verbosePrint("[%d] %s() LN%d recOfBatch=%d totalInsertRows=%"PRIu64"\n", - pThreadInfo->threadID, __func__, __LINE__, recOfBatch, - pThreadInfo->totalInsertRows); + endTs = taosGetTimestampUs(); + uint64_t delay = endTs - startTs; + performancePrint("%s() LN%d, insert execution time is %10.2f ms\n", + __func__, __LINE__, delay / 1000.0); + verbosePrint("[%d] %s() LN%d affectedRows=%"PRId64"\n", + pThreadInfo->threadID, + __func__, __LINE__, affectedRows); - startTs = taosGetTimestampUs(); + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; - if (recOfBatch == 0) { - errorPrint2("[%d] %s() LN%d Failed to insert records of batch %d\n", - pThreadInfo->threadID, __func__, __LINE__, - batchPerTbl); - if (batchPerTbl > 0) { - errorPrint("\tIf the batch is %d, the length of the SQL to insert a row must be less then %"PRId64"\n", - batchPerTbl, maxSqlLen / batchPerTbl); - } - goto free_of_interlace_stmt; - } - int64_t affectedRows = execInsert(pThreadInfo, recOfBatch); + if (generated != affectedRows) { + errorPrint2("[%d] %s() LN%d execInsert() insert %"PRId64", affected rows: %"PRId64"\n\n", + pThreadInfo->threadID, __func__, __LINE__, + generated, affectedRows); + goto free_of_interlace_stmt; + } - endTs = taosGetTimestampUs(); - uint64_t delay = endTs - startTs; - performancePrint("%s() LN%d, insert execution time is %10.2f ms\n", - __func__, __LINE__, delay / 1000.0); - verbosePrint("[%d] %s() LN%d affectedRows=%"PRId64"\n", - pThreadInfo->threadID, - __func__, __LINE__, affectedRows); + pThreadInfo->totalAffectedRows += affectedRows; - if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; - if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; - pThreadInfo->cntDelay++; - pThreadInfo->totalDelay += delay; + int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows; + if (currentPercent > percentComplete ) { + printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent); + percentComplete = currentPercent; + } + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently inserted rows: %"PRIu64 ", affected rows: %"PRIu64 "\n", + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); + lastPrintTime = currentPrintTime; + } - if (recOfBatch != affectedRows) { - errorPrint2("[%d] %s() LN%d execInsert insert %d, affected rows: %"PRId64"\n\n", - pThreadInfo->threadID, __func__, __LINE__, - recOfBatch, affectedRows); - goto free_of_interlace_stmt; + startTime += (generated * timeStampStep); + } } + pThreadInfo->samplePos = samplePos; - pThreadInfo->totalAffectedRows += affectedRows; + if (tableSeq == pThreadInfo->start_table_from + + pThreadInfo->ntables) { + // turn to first table + tableSeq = pThreadInfo->start_table_from; - int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows; - if (currentPercent > percentComplete ) { - printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent); - percentComplete = currentPercent; - } - int64_t currentPrintTime = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 30*1000) { - printf("thread[%d] has currently inserted rows: %"PRIu64 ", affected rows: %"PRIu64 "\n", - pThreadInfo->threadID, - pThreadInfo->totalInsertRows, - pThreadInfo->totalAffectedRows); - lastPrintTime = currentPrintTime; + flagSleep = true; } if ((insert_interval) && flagSleep) { @@ -8693,7 +8679,7 @@ static void* syncWriteInterlaceStmt(threadInfo *pThreadInfo, uint32_t interlaceR int64_t insertRows; uint64_t maxSqlLen; - int64_t nTimeStampStep; + int64_t timeStampStep; uint64_t insert_interval; SSuperTable* stbInfo = pThreadInfo->stbInfo; @@ -8701,12 +8687,12 @@ static void* syncWriteInterlaceStmt(threadInfo *pThreadInfo, uint32_t interlaceR if (stbInfo) { insertRows = stbInfo->insertRows; maxSqlLen = stbInfo->maxSqlLen; - nTimeStampStep = stbInfo->timeStampStep; + timeStampStep = stbInfo->timeStampStep; insert_interval = stbInfo->insertInterval; } else { insertRows = g_args.insertRows; maxSqlLen = g_args.max_sql_len; - nTimeStampStep = g_args.timestamp_step; + timeStampStep = g_args.timestamp_step; insert_interval = g_args.insert_interval; } @@ -8767,8 +8753,12 @@ static void* syncWriteInterlaceStmt(threadInfo *pThreadInfo, uint32_t interlaceR return NULL; } + debugPrint("[%d] %s() LN%d, tableName:%s, batch:%d startTime:%"PRId64"\n", + pThreadInfo->threadID, + __func__, __LINE__, + tableName, batchPerTbl, startTime); if (stbInfo) { - generated = prepareStbStmtWithSample( + generated = prepareStbStmt( pThreadInfo, tableName, tableSeq, @@ -8777,10 +8767,6 @@ static void* syncWriteInterlaceStmt(threadInfo *pThreadInfo, uint32_t interlaceR startTime, &(pThreadInfo->samplePos)); } else { - debugPrint("[%d] %s() LN%d, tableName:%s, batch:%d startTime:%"PRId64"\n", - pThreadInfo->threadID, - __func__, __LINE__, - tableName, batchPerTbl, startTime); generated = prepareStmtWithoutStb( pThreadInfo, tableName, @@ -8814,7 +8800,7 @@ static void* syncWriteInterlaceStmt(threadInfo *pThreadInfo, uint32_t interlaceR generatedRecPerTbl += batchPerTbl; startTime = pThreadInfo->start_time - + generatedRecPerTbl * nTimeStampStep; + + generatedRecPerTbl * timeStampStep; flagSleep = true; if (generatedRecPerTbl >= insertRows) @@ -8919,7 +8905,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) int64_t insertRows; uint64_t maxSqlLen; - int64_t nTimeStampStep; + int64_t timeStampStep; uint64_t insert_interval; SSuperTable* stbInfo = pThreadInfo->stbInfo; @@ -8927,12 +8913,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) if (stbInfo) { insertRows = stbInfo->insertRows; maxSqlLen = stbInfo->maxSqlLen; - nTimeStampStep = stbInfo->timeStampStep; + timeStampStep = stbInfo->timeStampStep; insert_interval = stbInfo->insertInterval; } else { insertRows = g_args.insertRows; maxSqlLen = g_args.max_sql_len; - nTimeStampStep = g_args.timestamp_step; + timeStampStep = g_args.timestamp_step; insert_interval = g_args.insert_interval; } @@ -9075,7 +9061,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) generatedRecPerTbl += batchPerTbl; startTime = pThreadInfo->start_time - + generatedRecPerTbl * nTimeStampStep; + + generatedRecPerTbl * timeStampStep; flagSleep = true; if (generatedRecPerTbl >= insertRows) @@ -9176,6 +9162,144 @@ free_of_interlace: return NULL; } +static void* syncWriteProgressiveStmt(threadInfo *pThreadInfo) { + debugPrint("%s() LN%d: ### stmt progressive write\n", __func__, __LINE__); + + SSuperTable* stbInfo = pThreadInfo->stbInfo; + int64_t timeStampStep = + stbInfo?stbInfo->timeStampStep:g_args.timestamp_step; + int64_t insertRows = + (stbInfo)?stbInfo->insertRows:g_args.insertRows; + verbosePrint("%s() LN%d insertRows=%"PRId64"\n", + __func__, __LINE__, insertRows); + + uint64_t lastPrintTime = taosGetTimestampMs(); + uint64_t startTs = taosGetTimestampMs(); + uint64_t endTs; + + pThreadInfo->totalInsertRows = 0; + pThreadInfo->totalAffectedRows = 0; + + pThreadInfo->samplePos = 0; + + int percentComplete = 0; + int64_t totalRows = insertRows * pThreadInfo->ntables; + + for (uint64_t tableSeq = pThreadInfo->start_table_from; + tableSeq <= pThreadInfo->end_table_to; + tableSeq ++) { + int64_t start_time = pThreadInfo->start_time; + + for (uint64_t i = 0; i < insertRows;) { + char tableName[TSDB_TABLE_NAME_LEN]; + getTableName(tableName, pThreadInfo, tableSeq); + verbosePrint("%s() LN%d: tid=%d seq=%"PRId64" tableName=%s\n", + __func__, __LINE__, + pThreadInfo->threadID, tableSeq, tableName); + if (0 == strlen(tableName)) { + errorPrint2("[%d] %s() LN%d, getTableName return null\n", + pThreadInfo->threadID, __func__, __LINE__); + return NULL; + } + + // measure prepare + insert + startTs = taosGetTimestampUs(); + + int32_t generated; + if (stbInfo) { + generated = prepareStbStmt( + pThreadInfo, + tableName, + tableSeq, + (g_args.reqPerReq>stbInfo->insertRows)? + stbInfo->insertRows: + g_args.reqPerReq, + insertRows, i, start_time, + &(pThreadInfo->samplePos)); + } else { + generated = prepareStmtWithoutStb( + pThreadInfo, + tableName, + g_args.reqPerReq, + insertRows, i, + start_time); + } + + verbosePrint("[%d] %s() LN%d generated=%d\n", + pThreadInfo->threadID, + __func__, __LINE__, generated); + + if (generated > 0) + i += generated; + else + goto free_of_stmt_progressive; + + start_time += generated * timeStampStep; + pThreadInfo->totalInsertRows += generated; + + // only measure insert + // startTs = taosGetTimestampUs(); + + int32_t affectedRows = execInsert(pThreadInfo, generated); + + endTs = taosGetTimestampUs(); + uint64_t delay = endTs - startTs; + performancePrint("%s() LN%d, insert execution time is %10.f ms\n", + __func__, __LINE__, delay/1000.0); + verbosePrint("[%d] %s() LN%d affectedRows=%d\n", + pThreadInfo->threadID, + __func__, __LINE__, affectedRows); + + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; + + if (affectedRows < 0) { + errorPrint2("%s() LN%d, affected rows: %d\n", + __func__, __LINE__, affectedRows); + goto free_of_stmt_progressive; + } + + pThreadInfo->totalAffectedRows += affectedRows; + + int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows; + if (currentPercent > percentComplete ) { + printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent); + percentComplete = currentPercent; + } + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); + lastPrintTime = currentPrintTime; + } + + if (i >= insertRows) + break; + } // insertRows + + if ((g_args.verbose_print) && + (tableSeq == pThreadInfo->ntables - 1) && (stbInfo) + && (0 == strncasecmp( + stbInfo->dataSource, + "sample", strlen("sample")))) { + verbosePrint("%s() LN%d samplePos=%"PRId64"\n", + __func__, __LINE__, pThreadInfo->samplePos); + } + } // tableSeq + + if (percentComplete < 100) { + printf("[%d]:%d%%\n", pThreadInfo->threadID, percentComplete); + } + +free_of_stmt_progressive: + tmfree(pThreadInfo->buffer); + printStatPerThread(pThreadInfo); + return NULL; +} // sync insertion progressive data static void* syncWriteProgressive(threadInfo *pThreadInfo) { debugPrint("%s() LN%d: ### progressive write\n", __func__, __LINE__); @@ -9242,7 +9366,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { int32_t generated; if (stbInfo) { if (stbInfo->iface == STMT_IFACE) { - generated = prepareStbStmtWithSample( + generated = prepareStbStmt( pThreadInfo, tableName, tableSeq, @@ -9374,20 +9498,28 @@ static void* syncWrite(void *sarg) { if (interlaceRows > 0) { // interlace mode - if (((stbInfo) && (STMT_IFACE == stbInfo->iface)) - || (STMT_IFACE == g_args.iface)) { + if (stbInfo) { + if (STMT_IFACE == stbInfo->iface) { #if STMT_BIND_PARAM_BATCH == 1 - return syncWriteInterlaceStmtBatch(pThreadInfo, interlaceRows); + return syncWriteInterlaceStmtBatch(pThreadInfo, interlaceRows); #else - return syncWriteInterlaceStmt(pThreadInfo, interlaceRows); + return syncWriteInterlaceStmt(pThreadInfo, interlaceRows); #endif - } else { - return syncWriteInterlace(pThreadInfo, interlaceRows); + } else { + return syncWriteInterlace(pThreadInfo, interlaceRows); + } } - }else { - // progressive mode - return syncWriteProgressive(pThreadInfo); + } else { + // progressive mode + if (((stbInfo) && (STMT_IFACE == stbInfo->iface)) + || (STMT_IFACE == g_args.iface)) { + return syncWriteProgressiveStmt(pThreadInfo); + } else { + return syncWriteProgressive(pThreadInfo); + } } + + return NULL; } static void callBack(void *param, TAOS_RES *res, int code) { @@ -9518,24 +9650,24 @@ static void startMultiThreadInsertData(int threads, char* db_name, } } - int64_t start_time; + int64_t startTime; if (stbInfo) { if (0 == strncasecmp(stbInfo->startTimestamp, "now", 3)) { - start_time = taosGetTimestamp(timePrec); + startTime = taosGetTimestamp(timePrec); } else { if (TSDB_CODE_SUCCESS != taosParseTime( stbInfo->startTimestamp, - &start_time, + &startTime, strlen(stbInfo->startTimestamp), timePrec, 0)) { ERROR_EXIT("failed to parse time!\n"); } } } else { - start_time = DEFAULT_START_TIME; + startTime = DEFAULT_START_TIME; } - debugPrint("%s() LN%d, start_time= %"PRId64"\n", - __func__, __LINE__, start_time); + debugPrint("%s() LN%d, startTime= %"PRId64"\n", + __func__, __LINE__, startTime); // read sample data from file first int ret; @@ -9655,14 +9787,10 @@ static void startMultiThreadInsertData(int threads, char* db_name, } pthread_t *pids = calloc(1, threads * sizeof(pthread_t)); - assert(pids != NULL); - threadInfo *infos = calloc(1, threads * sizeof(threadInfo)); + assert(pids != NULL); assert(infos != NULL); - memset(pids, 0, threads * sizeof(pthread_t)); - memset(infos, 0, threads * sizeof(threadInfo)); - char *stmtBuffer = calloc(1, BUFFER_SIZE); assert(stmtBuffer); @@ -9671,18 +9799,8 @@ static void startMultiThreadInsertData(int threads, char* db_name, uint32_t batch; if (stbInfo) { - if ((stbInfo->interlaceRows == 0) - && (g_args.interlaceRows > 0) - ) { - interlaceRows = g_args.interlaceRows; - - } else { + if (stbInfo->interlaceRows < stbInfo->insertRows) interlaceRows = stbInfo->interlaceRows; - } - - if (interlaceRows > stbInfo->insertRows) { - interlaceRows = 0; - } } else { if (g_args.interlaceRows < g_args.insertRows) interlaceRows = g_args.interlaceRows; @@ -9739,7 +9857,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, pThreadInfo->time_precision = timePrec; pThreadInfo->stbInfo = stbInfo; - pThreadInfo->start_time = start_time; + pThreadInfo->start_time = startTime; pThreadInfo->minDelay = UINT64_MAX; if ((NULL == stbInfo) || @@ -9955,7 +10073,7 @@ static void *readTable(void *sarg) { char *command = calloc(1, BUFFER_SIZE); assert(command); - uint64_t sTime = pThreadInfo->start_time; + uint64_t startTime = pThreadInfo->start_time; char *tb_prefix = pThreadInfo->tb_prefix; FILE *fp = fopen(pThreadInfo->filePath, "a"); if (NULL == fp) { @@ -9988,7 +10106,7 @@ static void *readTable(void *sarg) { uint64_t count = 0; for (int64_t i = 0; i < ntables; i++) { sprintf(command, "SELECT %s FROM %s%"PRId64" WHERE ts>= %" PRIu64, - g_aggreFunc[j], tb_prefix, i, sTime); + g_aggreFunc[j], tb_prefix, i, startTime); double t = taosGetTimestampMs(); TAOS_RES *pSql = taos_query(taos, command); diff --git a/src/plugins/http/inc/httpUtil.h b/src/plugins/http/inc/httpUtil.h index 54c95b6980f8241c3ea6c8e563e0e42c7c737286..21690ebca96d35423e126a9e747d8ce6bb5a43a0 100644 --- a/src/plugins/http/inc/httpUtil.h +++ b/src/plugins/http/inc/httpUtil.h @@ -17,6 +17,7 @@ #define TDENGINE_HTTP_UTIL_H bool httpCheckUsedbSql(char *sql); +bool httpCheckAlterSql(char *sql); void httpTimeToString(int32_t t, char *buf, int32_t buflen); bool httpUrlMatch(HttpContext *pContext, int32_t pos, char *cmp); diff --git a/src/plugins/http/src/httpHandle.c b/src/plugins/http/src/httpHandle.c index d51c774ff269d5790868727941a632d133dd6733..9719d93824b50064ec1cf23677c641428434592c 100644 --- a/src/plugins/http/src/httpHandle.c +++ b/src/plugins/http/src/httpHandle.c @@ -35,6 +35,7 @@ bool httpProcessData(HttpContext* pContext) { if (!httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_HANDLING)) { httpTrace("context:%p, fd:%d, state:%s not in ready state, stop process request", pContext, pContext->fd, httpContextStateStr(pContext->state)); + pContext->error = true; httpCloseContextByApp(pContext); return false; } diff --git a/src/plugins/http/src/httpParser.c b/src/plugins/http/src/httpParser.c index 62b1737f6fe7128ee132727b2870fca5f62b737a..7066f19769754e78dffeed6a40b672584c0310f1 100644 --- a/src/plugins/http/src/httpParser.c +++ b/src/plugins/http/src/httpParser.c @@ -1157,10 +1157,6 @@ static int32_t httpParseChar(HttpParser *parser, const char c, int32_t *again) { httpOnError(parser, HTTP_CODE_INTERNAL_SERVER_ERROR, TSDB_CODE_HTTP_PARSE_ERROR_STATE); } - if (ok != 0) { - pContext->error = true; - } - return ok; } diff --git a/src/plugins/http/src/httpResp.c b/src/plugins/http/src/httpResp.c index 79e728dd456fb8a340e50f9d7e9cbd3c409614db..1d05b455cb5c66e4f492140e1f337210da04caef 100644 --- a/src/plugins/http/src/httpResp.c +++ b/src/plugins/http/src/httpResp.c @@ -147,6 +147,8 @@ void httpSendErrorResp(HttpContext *pContext, int32_t errNo) { httpCode = pContext->parser->httpCode; } + pContext->error = true; + char *httpCodeStr = httpGetStatusDesc(httpCode); httpSendErrorRespImp(pContext, httpCode, httpCodeStr, errNo & 0XFFFF, tstrerror(errNo)); } diff --git a/src/plugins/http/src/httpRestJson.c b/src/plugins/http/src/httpRestJson.c index 47f2d4ff5bcc513aafb8ea8f4e2a85db5a35b12a..13596b0e8a4ea4d183cc4bf75917fd08a9dd7290 100644 --- a/src/plugins/http/src/httpRestJson.c +++ b/src/plugins/http/src/httpRestJson.c @@ -16,6 +16,7 @@ #define _DEFAULT_SOURCE #include "os.h" #include "tglobal.h" +#include "tsclient.h" #include "httpLog.h" #include "httpJson.h" #include "httpRestHandle.h" @@ -62,13 +63,21 @@ void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result) httpJsonItemToken(jsonBuf); httpJsonToken(jsonBuf, JsonArrStt); + SSqlObj *pObj = (SSqlObj *) result; + bool isAlterSql = (pObj->sqlstr == NULL) ? false : httpCheckAlterSql(pObj->sqlstr); + if (num_fields == 0) { httpJsonItemToken(jsonBuf); httpJsonString(jsonBuf, REST_JSON_AFFECT_ROWS, REST_JSON_AFFECT_ROWS_LEN); } else { - for (int32_t i = 0; i < num_fields; ++i) { + if (isAlterSql == true) { httpJsonItemToken(jsonBuf); - httpJsonString(jsonBuf, fields[i].name, (int32_t)strlen(fields[i].name)); + httpJsonString(jsonBuf, REST_JSON_AFFECT_ROWS, REST_JSON_AFFECT_ROWS_LEN); + } else { + for (int32_t i = 0; i < num_fields; ++i) { + httpJsonItemToken(jsonBuf); + httpJsonString(jsonBuf, fields[i].name, (int32_t)strlen(fields[i].name)); + } } } @@ -99,8 +108,14 @@ void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result) httpJsonItemToken(jsonBuf); httpJsonToken(jsonBuf, JsonArrStt); - httpJsonItemToken(jsonBuf); - httpJsonString(jsonBuf, fields[i].name, (int32_t)strlen(fields[i].name)); + if (isAlterSql == true) { + httpJsonItemToken(jsonBuf); + httpJsonString(jsonBuf, REST_JSON_AFFECT_ROWS, REST_JSON_AFFECT_ROWS_LEN); + } else { + httpJsonItemToken(jsonBuf); + httpJsonString(jsonBuf, fields[i].name, (int32_t)strlen(fields[i].name)); + } + httpJsonItemToken(jsonBuf); httpJsonInt(jsonBuf, fields[i].type); httpJsonItemToken(jsonBuf); diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index f02859f165499b0c69b095599dd47890e644c604..13a0835c3960333c6d12aa443025de5fb95d565e 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -191,8 +191,6 @@ static void httpProcessHttpData(void *param) { if (httpReadData(pContext)) { (*(pThread->processData))(pContext); atomic_fetch_add_32(&pServer->requestNum, 1); - } else { - httpReleaseContext(pContext/*, false*/); } } } @@ -402,13 +400,17 @@ static bool httpReadData(HttpContext *pContext) { } else if (nread < 0) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { httpDebug("context:%p, fd:%d, read from socket error:%d, wait another event", pContext, pContext->fd, errno); - return false; // later again + continue; // later again } else { httpError("context:%p, fd:%d, read from socket error:%d, close connect", pContext, pContext->fd, errno); + taosCloseSocket(pContext->fd); + httpReleaseContext(pContext/*, false */); return false; } } else { httpError("context:%p, fd:%d, nread:%d, wait another event", pContext, pContext->fd, nread); + taosCloseSocket(pContext->fd); + httpReleaseContext(pContext/*, false */); return false; } } diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c index 0dd451f72dbd78233ac8f73d552b6815e3a3fab8..602767a6563b3ca3430501c0dbcee65333f1d44b 100644 --- a/src/plugins/http/src/httpSql.c +++ b/src/plugins/http/src/httpSql.c @@ -405,7 +405,6 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int32_t code) { if (pContext->session == NULL) { httpSendErrorResp(pContext, TSDB_CODE_HTTP_SESSION_FULL); - httpCloseContextByApp(pContext); } else { httpExecCmd(pContext); } diff --git a/src/plugins/http/src/httpUtil.c b/src/plugins/http/src/httpUtil.c index ade50bdad6bf6b0a7a2d43bb354851d90686be49..f30ac7326eef20f4abf5558b288f16f6ee313b42 100644 --- a/src/plugins/http/src/httpUtil.c +++ b/src/plugins/http/src/httpUtil.c @@ -21,6 +21,7 @@ #include "httpResp.h" #include "httpSql.h" #include "httpUtil.h" +#include "ttoken.h" bool httpCheckUsedbSql(char *sql) { if (strstr(sql, "use ") != NULL) { @@ -29,6 +30,17 @@ bool httpCheckUsedbSql(char *sql) { return false; } +bool httpCheckAlterSql(char *sql) { + int32_t index = 0; + + do { + SStrToken t0 = tStrGetToken(sql, &index, false); + if (t0.type != TK_LP) { + return t0.type == TK_ALTER; + } + } while (1); +} + void httpTimeToString(int32_t t, char *buf, int32_t buflen) { memset(buf, 0, (size_t)buflen); char ts[32] = {0}; diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index d72bcacddcdfe1c9e1a59eff3f94b474a4e4839e..336e8620f210351471bddb9c94d56fcaa7f8a0fc 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -11,7 +11,7 @@ %left OR. %left AND. %right NOT. -%left EQ NE ISNULL NOTNULL IS LIKE MATCH GLOB BETWEEN IN. +%left EQ NE ISNULL NOTNULL IS LIKE MATCH NMATCH GLOB BETWEEN IN. %left GT GE LT LE. %left BITAND BITOR LSHIFT RSHIFT. %left PLUS MINUS. @@ -753,6 +753,7 @@ expr(A) ::= expr(X) LIKE expr(Y). {A = tSqlExprCreate(X, Y, TK_LIKE); } // match expression expr(A) ::= expr(X) MATCH expr(Y). {A = tSqlExprCreate(X, Y, TK_MATCH); } +expr(A) ::= expr(X) NMATCH expr(Y). {A = tSqlExprCreate(X, Y, TK_NMATCH); } //in expression expr(A) ::= expr(X) IN LP exprlist(Y) RP. {A = tSqlExprCreate(X, (tSqlExpr*)Y, TK_IN); } @@ -919,5 +920,5 @@ 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 + LIKE MATCH NMATCH 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. diff --git a/src/query/src/qFilter.c b/src/query/src/qFilter.c index a6988d7adc403cd518e6fce91899a515305ab5c0..5e8ff126d1510cd32446d695d5c8d698aa32d1b9 100644 --- a/src/query/src/qFilter.c +++ b/src/query/src/qFilter.c @@ -29,6 +29,7 @@ OptrStr gOptrStr[] = { {TSDB_RELATION_NOT_EQUAL, "!="}, {TSDB_RELATION_LIKE, "like"}, {TSDB_RELATION_MATCH, "match"}, + {TSDB_RELATION_MATCH, "nmatch"}, {TSDB_RELATION_ISNULL, "is null"}, {TSDB_RELATION_NOTNULL, "not null"}, {TSDB_RELATION_IN, "in"}, @@ -157,7 +158,7 @@ int8_t filterGetRangeCompFuncFromOptrs(uint8_t optr, uint8_t optr2) { __compar_fn_t gDataCompare[] = {compareInt32Val, compareInt8Val, compareInt16Val, compareInt64Val, compareFloatVal, compareDoubleVal, compareLenPrefixedStr, compareStrPatternComp, compareFindItemInSet, compareWStrPatternComp, compareLenPrefixedWStr, compareUint8Val, compareUint16Val, compareUint32Val, compareUint64Val, - setCompareBytes1, setCompareBytes2, setCompareBytes4, setCompareBytes8, compareStrRegexComp, + setCompareBytes1, setCompareBytes2, setCompareBytes4, setCompareBytes8, compareStrRegexCompMatch, compareStrRegexCompNMatch }; int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { @@ -198,6 +199,8 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_BINARY: { if (optr == TSDB_RELATION_MATCH) { comparFn = 19; + } else if (optr == TSDB_RELATION_NMATCH) { + comparFn = 20; } else if (optr == TSDB_RELATION_LIKE) { /* wildcard query using like operator */ comparFn = 7; } else if (optr == TSDB_RELATION_IN) { @@ -212,6 +215,8 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_NCHAR: { if (optr == TSDB_RELATION_MATCH) { comparFn = 19; + } else if (optr == TSDB_RELATION_NMATCH) { + comparFn = 20; } else if (optr == TSDB_RELATION_LIKE) { comparFn = 9; } else if (optr == TSDB_RELATION_IN) { @@ -1879,6 +1884,9 @@ bool filterDoCompare(__compar_fn_t func, uint8_t optr, void *left, void *right) case TSDB_RELATION_MATCH: { return ret == 0; } + case TSDB_RELATION_NMATCH: { + return ret == 0; + } case TSDB_RELATION_IN: { return ret == 1; } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index f66c2968a6cebf805579dc3fe4c123331f9ecfc8..e89b6232f7e42b764df7660f06dcd207bfe6e4de 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -102,29 +102,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,18 +140,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 366 -#define YYNRULE 293 -#define YYNRULE_WITH_ACTION 293 -#define YYNTOKEN 196 -#define YY_MAX_SHIFT 365 -#define YY_MIN_SHIFTREDUCE 574 -#define YY_MAX_SHIFTREDUCE 866 -#define YY_ERROR_ACTION 867 -#define YY_ACCEPT_ACTION 868 -#define YY_NO_ACTION 869 -#define YY_MIN_REDUCE 870 -#define YY_MAX_REDUCE 1162 +#define YYNSTATE 368 +#define YYNRULE 294 +#define YYNRULE_WITH_ACTION 294 +#define YYNTOKEN 197 +#define YY_MAX_SHIFT 367 +#define YY_MIN_SHIFTREDUCE 576 +#define YY_MAX_SHIFTREDUCE 869 +#define YY_ERROR_ACTION 870 +#define YY_ACCEPT_ACTION 871 +#define YY_NO_ACTION 872 +#define YY_MIN_REDUCE 873 +#define YY_MAX_REDUCE 1166 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -218,291 +218,292 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (766) +#define YY_ACTTAB_COUNT (773) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1020, 626, 239, 626, 364, 233, 1026, 1039, 210, 627, - /* 10 */ 662, 627, 38, 58, 59, 38, 62, 63, 1048, 1138, - /* 20 */ 253, 52, 51, 236, 61, 322, 66, 64, 67, 65, - /* 30 */ 1039, 810, 245, 813, 57, 56, 1026, 23, 55, 54, - /* 40 */ 53, 58, 59, 626, 62, 63, 237, 246, 253, 52, - /* 50 */ 51, 627, 61, 322, 66, 64, 67, 65, 868, 365, - /* 60 */ 235, 1022, 57, 56, 1023, 250, 55, 54, 53, 988, - /* 70 */ 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, - /* 80 */ 986, 987, 989, 990, 156, 29, 1045, 81, 575, 576, - /* 90 */ 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, - /* 100 */ 587, 588, 154, 163, 234, 172, 58, 59, 1039, 62, - /* 110 */ 63, 1012, 804, 253, 52, 51, 72, 61, 322, 66, - /* 120 */ 64, 67, 65, 284, 275, 210, 352, 57, 56, 262, - /* 130 */ 163, 55, 54, 53, 58, 60, 1139, 62, 63, 75, - /* 140 */ 177, 253, 52, 51, 626, 61, 322, 66, 64, 67, - /* 150 */ 65, 817, 627, 282, 281, 57, 56, 267, 73, 55, - /* 160 */ 54, 53, 59, 163, 62, 63, 271, 270, 253, 52, - /* 170 */ 51, 320, 61, 322, 66, 64, 67, 65, 1087, 76, - /* 180 */ 294, 247, 57, 56, 207, 1026, 55, 54, 53, 62, - /* 190 */ 63, 38, 249, 253, 52, 51, 320, 61, 322, 66, - /* 200 */ 64, 67, 65, 296, 710, 92, 87, 57, 56, 769, - /* 210 */ 770, 55, 54, 53, 44, 318, 359, 358, 317, 316, - /* 220 */ 315, 357, 314, 313, 312, 356, 311, 355, 354, 24, - /* 230 */ 163, 252, 819, 342, 341, 808, 243, 811, 1086, 814, - /* 240 */ 1023, 252, 819, 45, 208, 808, 213, 811, 254, 814, - /* 250 */ 57, 56, 210, 220, 55, 54, 53, 96, 262, 138, - /* 260 */ 137, 136, 219, 1139, 231, 232, 327, 87, 323, 178, - /* 270 */ 99, 5, 41, 181, 231, 232, 360, 957, 180, 105, - /* 280 */ 110, 101, 109, 363, 362, 147, 66, 64, 67, 65, - /* 290 */ 1009, 1010, 35, 1013, 57, 56, 919, 307, 55, 54, - /* 300 */ 53, 256, 929, 191, 45, 93, 1014, 734, 210, 191, - /* 310 */ 731, 38, 732, 68, 733, 261, 262, 214, 44, 1139, - /* 320 */ 359, 358, 124, 68, 215, 357, 274, 1024, 79, 356, - /* 330 */ 1134, 355, 354, 1133, 352, 227, 122, 116, 127, 258, - /* 340 */ 259, 750, 809, 126, 812, 132, 135, 125, 820, 815, - /* 350 */ 920, 1025, 38, 38, 129, 816, 244, 191, 820, 815, - /* 360 */ 1023, 201, 199, 197, 38, 816, 80, 38, 196, 142, - /* 370 */ 141, 140, 139, 996, 14, 994, 995, 257, 95, 255, - /* 380 */ 997, 330, 329, 786, 998, 38, 999, 1000, 38, 324, - /* 390 */ 38, 263, 84, 260, 85, 337, 336, 331, 332, 38, - /* 400 */ 1011, 1023, 1023, 55, 54, 53, 94, 1132, 98, 333, - /* 410 */ 1, 179, 334, 1023, 3, 192, 1023, 153, 151, 150, - /* 420 */ 82, 747, 276, 735, 736, 34, 754, 766, 776, 278, - /* 430 */ 338, 278, 777, 339, 1023, 340, 39, 1023, 806, 1023, - /* 440 */ 785, 158, 69, 720, 344, 299, 26, 9, 1023, 251, - /* 450 */ 722, 301, 721, 841, 821, 625, 78, 39, 302, 39, - /* 460 */ 229, 16, 818, 15, 69, 97, 69, 25, 25, 25, - /* 470 */ 115, 6, 114, 1158, 18, 807, 17, 739, 737, 740, - /* 480 */ 738, 20, 121, 19, 120, 22, 230, 21, 709, 134, - /* 490 */ 133, 211, 823, 212, 216, 1150, 209, 1097, 217, 218, - /* 500 */ 222, 223, 224, 221, 206, 1096, 241, 1093, 1092, 242, - /* 510 */ 343, 272, 155, 48, 1047, 1058, 1055, 1056, 1060, 157, - /* 520 */ 1040, 279, 1079, 162, 290, 1078, 173, 1021, 174, 1019, - /* 530 */ 175, 176, 934, 283, 238, 152, 167, 165, 304, 305, - /* 540 */ 765, 1037, 164, 306, 309, 310, 285, 46, 204, 42, - /* 550 */ 321, 928, 287, 328, 1157, 112, 1156, 77, 1153, 297, - /* 560 */ 182, 335, 1149, 74, 50, 166, 295, 168, 293, 291, - /* 570 */ 118, 289, 286, 1148, 1145, 183, 954, 43, 40, 47, - /* 580 */ 205, 916, 128, 914, 130, 131, 49, 912, 911, 264, - /* 590 */ 194, 195, 908, 907, 906, 905, 904, 903, 902, 198, - /* 600 */ 200, 899, 897, 895, 893, 202, 890, 203, 308, 886, - /* 610 */ 353, 123, 277, 83, 88, 345, 288, 1080, 346, 347, - /* 620 */ 348, 349, 228, 350, 351, 248, 303, 361, 866, 265, - /* 630 */ 266, 865, 269, 225, 226, 268, 864, 847, 846, 933, - /* 640 */ 932, 106, 107, 273, 278, 10, 298, 742, 280, 86, - /* 650 */ 30, 910, 909, 89, 767, 143, 159, 144, 955, 186, - /* 660 */ 184, 185, 188, 187, 189, 190, 901, 2, 145, 992, - /* 670 */ 900, 892, 171, 169, 33, 170, 956, 146, 891, 4, - /* 680 */ 778, 160, 161, 772, 90, 240, 774, 1002, 91, 292, - /* 690 */ 31, 11, 32, 12, 13, 27, 300, 28, 98, 100, - /* 700 */ 103, 36, 102, 640, 37, 104, 675, 673, 672, 671, - /* 710 */ 669, 668, 667, 664, 630, 319, 108, 7, 824, 822, - /* 720 */ 325, 8, 326, 111, 113, 70, 71, 117, 39, 712, - /* 730 */ 119, 711, 708, 656, 654, 646, 652, 648, 650, 644, - /* 740 */ 642, 678, 677, 676, 674, 670, 666, 665, 193, 628, - /* 750 */ 592, 870, 869, 869, 869, 869, 869, 869, 869, 869, - /* 760 */ 869, 869, 869, 869, 148, 149, + /* 0 */ 23, 628, 366, 235, 1051, 208, 241, 712, 211, 629, + /* 10 */ 1029, 871, 367, 59, 60, 173, 63, 64, 1042, 1142, + /* 20 */ 255, 53, 52, 51, 628, 62, 324, 67, 65, 68, + /* 30 */ 66, 157, 629, 286, 238, 58, 57, 344, 343, 56, + /* 40 */ 55, 54, 59, 60, 247, 63, 64, 252, 1029, 255, + /* 50 */ 53, 52, 51, 209, 62, 324, 67, 65, 68, 66, + /* 60 */ 999, 1042, 997, 998, 58, 57, 664, 1000, 56, 55, + /* 70 */ 54, 1001, 1048, 1002, 1003, 58, 57, 277, 1015, 56, + /* 80 */ 55, 54, 59, 60, 164, 63, 64, 38, 82, 255, + /* 90 */ 53, 52, 51, 88, 62, 324, 67, 65, 68, 66, + /* 100 */ 284, 283, 249, 752, 58, 57, 1029, 211, 56, 55, + /* 110 */ 54, 38, 59, 61, 806, 63, 64, 1042, 1143, 255, + /* 120 */ 53, 52, 51, 628, 62, 324, 67, 65, 68, 66, + /* 130 */ 45, 629, 237, 239, 58, 57, 1026, 164, 56, 55, + /* 140 */ 54, 60, 1023, 63, 64, 771, 772, 255, 53, 52, + /* 150 */ 51, 95, 62, 324, 67, 65, 68, 66, 38, 1090, + /* 160 */ 1025, 296, 58, 57, 322, 83, 56, 55, 54, 577, + /* 170 */ 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, + /* 180 */ 588, 589, 590, 155, 322, 236, 63, 64, 756, 248, + /* 190 */ 255, 53, 52, 51, 628, 62, 324, 67, 65, 68, + /* 200 */ 66, 251, 629, 245, 354, 58, 57, 1026, 215, 56, + /* 210 */ 55, 54, 1089, 44, 320, 361, 360, 319, 318, 317, + /* 220 */ 359, 316, 315, 314, 358, 313, 357, 356, 808, 38, + /* 230 */ 1, 180, 24, 991, 979, 980, 981, 982, 983, 984, + /* 240 */ 985, 986, 987, 988, 989, 990, 992, 993, 256, 214, + /* 250 */ 38, 254, 821, 922, 100, 810, 222, 813, 164, 816, + /* 260 */ 192, 211, 139, 138, 137, 221, 809, 254, 821, 329, + /* 270 */ 88, 810, 1143, 813, 246, 816, 1028, 29, 1026, 67, + /* 280 */ 65, 68, 66, 38, 1162, 233, 234, 58, 57, 325, + /* 290 */ 1017, 56, 55, 54, 38, 333, 56, 55, 54, 1026, + /* 300 */ 269, 233, 234, 258, 5, 41, 182, 45, 211, 273, + /* 310 */ 272, 181, 106, 111, 102, 110, 164, 73, 736, 1143, + /* 320 */ 932, 733, 812, 734, 815, 735, 263, 192, 334, 276, + /* 330 */ 309, 80, 1026, 94, 69, 123, 117, 128, 229, 335, + /* 340 */ 362, 960, 127, 1026, 133, 136, 126, 202, 200, 198, + /* 350 */ 69, 260, 261, 130, 197, 143, 142, 141, 140, 74, + /* 360 */ 44, 97, 361, 360, 788, 923, 38, 359, 38, 822, + /* 370 */ 817, 358, 192, 357, 356, 38, 818, 38, 38, 259, + /* 380 */ 811, 257, 814, 332, 331, 822, 817, 264, 125, 298, + /* 390 */ 264, 93, 818, 326, 1012, 1013, 35, 1016, 178, 14, + /* 400 */ 354, 179, 265, 96, 262, 264, 339, 338, 154, 152, + /* 410 */ 151, 336, 749, 340, 81, 1026, 1027, 1026, 3, 193, + /* 420 */ 341, 787, 342, 346, 1026, 278, 1026, 1026, 365, 364, + /* 430 */ 148, 85, 86, 99, 76, 737, 738, 768, 9, 39, + /* 440 */ 778, 779, 722, 819, 301, 724, 216, 303, 1014, 723, + /* 450 */ 34, 159, 844, 823, 70, 26, 39, 253, 39, 70, + /* 460 */ 79, 98, 627, 70, 135, 134, 25, 25, 280, 280, + /* 470 */ 16, 116, 15, 115, 77, 18, 25, 17, 741, 6, + /* 480 */ 742, 274, 739, 304, 740, 20, 122, 19, 121, 22, + /* 490 */ 217, 21, 711, 1100, 1137, 1136, 1135, 825, 231, 156, + /* 500 */ 232, 820, 212, 213, 218, 210, 1099, 219, 220, 224, + /* 510 */ 225, 226, 223, 207, 1154, 243, 1096, 1095, 244, 345, + /* 520 */ 1050, 1061, 1043, 48, 1058, 1059, 1063, 153, 281, 158, + /* 530 */ 163, 292, 1024, 175, 1082, 174, 1081, 279, 84, 285, + /* 540 */ 1022, 310, 176, 240, 177, 171, 167, 937, 306, 307, + /* 550 */ 308, 767, 311, 312, 1040, 165, 166, 46, 287, 289, + /* 560 */ 297, 299, 205, 168, 42, 78, 75, 50, 323, 931, + /* 570 */ 330, 1161, 113, 1160, 295, 169, 293, 291, 1157, 183, + /* 580 */ 337, 1153, 119, 288, 1152, 1149, 184, 957, 43, 40, + /* 590 */ 47, 206, 919, 129, 49, 917, 131, 132, 915, 914, + /* 600 */ 266, 195, 196, 911, 910, 909, 908, 907, 906, 905, + /* 610 */ 199, 201, 902, 900, 898, 896, 203, 893, 204, 889, + /* 620 */ 355, 124, 89, 290, 1083, 347, 348, 349, 350, 351, + /* 630 */ 352, 353, 363, 869, 230, 250, 305, 267, 268, 868, + /* 640 */ 270, 227, 228, 271, 867, 850, 107, 936, 935, 108, + /* 650 */ 849, 275, 280, 300, 10, 282, 744, 87, 30, 90, + /* 660 */ 913, 912, 904, 186, 958, 190, 185, 187, 144, 191, + /* 670 */ 189, 188, 145, 146, 147, 903, 995, 895, 4, 894, + /* 680 */ 959, 769, 160, 33, 780, 170, 172, 2, 161, 162, + /* 690 */ 774, 91, 242, 776, 92, 1005, 294, 11, 12, 31, + /* 700 */ 32, 13, 27, 302, 28, 99, 101, 104, 36, 103, + /* 710 */ 642, 37, 105, 677, 675, 674, 673, 671, 670, 669, + /* 720 */ 666, 321, 109, 632, 7, 826, 824, 8, 327, 328, + /* 730 */ 112, 114, 71, 72, 118, 714, 39, 120, 713, 710, + /* 740 */ 658, 656, 648, 654, 650, 652, 646, 644, 680, 679, + /* 750 */ 678, 676, 672, 668, 667, 194, 630, 594, 873, 872, + /* 760 */ 872, 872, 872, 872, 872, 872, 872, 872, 872, 872, + /* 770 */ 872, 149, 150, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 198, 1, 244, 1, 198, 199, 248, 246, 265, 9, - /* 10 */ 5, 9, 198, 13, 14, 198, 16, 17, 198, 276, - /* 20 */ 20, 21, 22, 262, 24, 25, 26, 27, 28, 29, - /* 30 */ 246, 5, 244, 7, 34, 35, 248, 265, 38, 39, - /* 40 */ 40, 13, 14, 1, 16, 17, 262, 245, 20, 21, - /* 50 */ 22, 9, 24, 25, 26, 27, 28, 29, 196, 197, - /* 60 */ 243, 247, 34, 35, 247, 205, 38, 39, 40, 222, - /* 70 */ 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - /* 80 */ 233, 234, 235, 236, 198, 83, 266, 87, 46, 47, - /* 90 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 100 */ 58, 59, 60, 198, 62, 252, 13, 14, 246, 16, - /* 110 */ 17, 0, 84, 20, 21, 22, 98, 24, 25, 26, - /* 120 */ 27, 28, 29, 270, 262, 265, 91, 34, 35, 198, - /* 130 */ 198, 38, 39, 40, 13, 14, 276, 16, 17, 98, - /* 140 */ 209, 20, 21, 22, 1, 24, 25, 26, 27, 28, - /* 150 */ 29, 125, 9, 267, 268, 34, 35, 143, 140, 38, - /* 160 */ 39, 40, 14, 198, 16, 17, 152, 153, 20, 21, - /* 170 */ 22, 85, 24, 25, 26, 27, 28, 29, 273, 138, - /* 180 */ 275, 244, 34, 35, 265, 248, 38, 39, 40, 16, - /* 190 */ 17, 198, 205, 20, 21, 22, 85, 24, 25, 26, - /* 200 */ 27, 28, 29, 271, 5, 273, 83, 34, 35, 126, - /* 210 */ 127, 38, 39, 40, 99, 100, 101, 102, 103, 104, - /* 220 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 45, - /* 230 */ 198, 1, 2, 34, 35, 5, 243, 7, 273, 9, - /* 240 */ 247, 1, 2, 120, 265, 5, 62, 7, 205, 9, - /* 250 */ 34, 35, 265, 69, 38, 39, 40, 206, 198, 75, - /* 260 */ 76, 77, 78, 276, 34, 35, 82, 83, 38, 209, - /* 270 */ 206, 63, 64, 65, 34, 35, 220, 221, 70, 71, - /* 280 */ 72, 73, 74, 66, 67, 68, 26, 27, 28, 29, - /* 290 */ 239, 240, 241, 242, 34, 35, 204, 89, 38, 39, - /* 300 */ 40, 69, 204, 211, 120, 273, 242, 2, 265, 211, - /* 310 */ 5, 198, 7, 83, 9, 69, 198, 265, 99, 276, - /* 320 */ 101, 102, 79, 83, 265, 106, 142, 209, 144, 110, - /* 330 */ 265, 112, 113, 265, 91, 151, 63, 64, 65, 34, - /* 340 */ 35, 38, 5, 70, 7, 72, 73, 74, 118, 119, - /* 350 */ 204, 248, 198, 198, 81, 125, 243, 211, 118, 119, - /* 360 */ 247, 63, 64, 65, 198, 125, 206, 198, 70, 71, - /* 370 */ 72, 73, 74, 222, 83, 224, 225, 145, 87, 147, - /* 380 */ 229, 149, 150, 77, 233, 198, 235, 236, 198, 15, - /* 390 */ 198, 145, 84, 147, 84, 149, 150, 243, 243, 198, - /* 400 */ 240, 247, 247, 38, 39, 40, 249, 265, 117, 243, - /* 410 */ 207, 208, 243, 247, 202, 203, 247, 63, 64, 65, - /* 420 */ 263, 98, 84, 118, 119, 83, 123, 84, 84, 121, - /* 430 */ 243, 121, 84, 243, 247, 243, 98, 247, 1, 247, - /* 440 */ 134, 98, 98, 84, 243, 84, 98, 124, 247, 61, - /* 450 */ 84, 84, 84, 84, 84, 84, 83, 98, 116, 98, - /* 460 */ 265, 146, 125, 148, 98, 98, 98, 98, 98, 98, - /* 470 */ 146, 83, 148, 248, 146, 38, 148, 5, 5, 7, - /* 480 */ 7, 146, 146, 148, 148, 146, 265, 148, 115, 79, - /* 490 */ 80, 265, 118, 265, 265, 248, 265, 238, 265, 265, - /* 500 */ 265, 265, 265, 265, 265, 238, 238, 238, 238, 238, - /* 510 */ 238, 198, 198, 264, 198, 198, 198, 198, 198, 198, - /* 520 */ 246, 246, 274, 198, 198, 274, 250, 246, 198, 198, - /* 530 */ 198, 198, 198, 269, 269, 61, 257, 259, 198, 198, - /* 540 */ 125, 261, 260, 198, 198, 198, 269, 198, 198, 198, - /* 550 */ 198, 198, 269, 198, 198, 198, 198, 137, 198, 132, - /* 560 */ 198, 198, 198, 139, 136, 258, 135, 256, 130, 129, - /* 570 */ 198, 128, 131, 198, 198, 198, 198, 198, 198, 198, - /* 580 */ 198, 198, 198, 198, 198, 198, 141, 198, 198, 198, - /* 590 */ 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - /* 600 */ 198, 198, 198, 198, 198, 198, 198, 198, 90, 198, - /* 610 */ 114, 97, 200, 200, 200, 96, 200, 200, 52, 93, - /* 620 */ 95, 56, 200, 94, 92, 200, 200, 85, 5, 154, - /* 630 */ 5, 5, 5, 200, 200, 154, 5, 101, 100, 210, - /* 640 */ 210, 206, 206, 143, 121, 83, 116, 84, 98, 122, - /* 650 */ 83, 200, 200, 98, 84, 201, 83, 201, 219, 213, - /* 660 */ 218, 217, 214, 216, 215, 212, 200, 207, 201, 237, - /* 670 */ 200, 200, 253, 255, 251, 254, 221, 201, 200, 202, - /* 680 */ 84, 83, 98, 84, 83, 1, 84, 237, 83, 83, - /* 690 */ 98, 133, 98, 133, 83, 83, 116, 83, 117, 79, - /* 700 */ 71, 88, 87, 5, 88, 87, 9, 5, 5, 5, - /* 710 */ 5, 5, 5, 5, 86, 15, 79, 83, 118, 84, - /* 720 */ 25, 83, 60, 148, 148, 16, 16, 148, 98, 5, - /* 730 */ 148, 5, 84, 5, 5, 5, 5, 5, 5, 5, - /* 740 */ 5, 5, 5, 5, 5, 5, 5, 5, 98, 86, - /* 750 */ 61, 0, 277, 277, 277, 277, 277, 277, 277, 277, - /* 760 */ 277, 277, 277, 277, 21, 21, 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, 277, 277, 277, 277, 277, 277, 277, - /* 960 */ 277, 277, + /* 0 */ 266, 1, 199, 200, 199, 266, 245, 5, 266, 9, + /* 10 */ 249, 197, 198, 13, 14, 253, 16, 17, 247, 277, + /* 20 */ 20, 21, 22, 23, 1, 25, 26, 27, 28, 29, + /* 30 */ 30, 199, 9, 271, 263, 35, 36, 35, 36, 39, + /* 40 */ 40, 41, 13, 14, 245, 16, 17, 206, 249, 20, + /* 50 */ 21, 22, 23, 266, 25, 26, 27, 28, 29, 30, + /* 60 */ 223, 247, 225, 226, 35, 36, 5, 230, 39, 40, + /* 70 */ 41, 234, 267, 236, 237, 35, 36, 263, 0, 39, + /* 80 */ 40, 41, 13, 14, 199, 16, 17, 199, 88, 20, + /* 90 */ 21, 22, 23, 84, 25, 26, 27, 28, 29, 30, + /* 100 */ 268, 269, 245, 39, 35, 36, 249, 266, 39, 40, + /* 110 */ 41, 199, 13, 14, 85, 16, 17, 247, 277, 20, + /* 120 */ 21, 22, 23, 1, 25, 26, 27, 28, 29, 30, + /* 130 */ 121, 9, 244, 263, 35, 36, 248, 199, 39, 40, + /* 140 */ 41, 14, 199, 16, 17, 127, 128, 20, 21, 22, + /* 150 */ 23, 250, 25, 26, 27, 28, 29, 30, 199, 274, + /* 160 */ 248, 276, 35, 36, 86, 264, 39, 40, 41, 47, + /* 170 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 180 */ 58, 59, 60, 61, 86, 63, 16, 17, 124, 246, + /* 190 */ 20, 21, 22, 23, 1, 25, 26, 27, 28, 29, + /* 200 */ 30, 206, 9, 244, 92, 35, 36, 248, 266, 39, + /* 210 */ 40, 41, 274, 100, 101, 102, 103, 104, 105, 106, + /* 220 */ 107, 108, 109, 110, 111, 112, 113, 114, 1, 199, + /* 230 */ 208, 209, 46, 223, 224, 225, 226, 227, 228, 229, + /* 240 */ 230, 231, 232, 233, 234, 235, 236, 237, 206, 63, + /* 250 */ 199, 1, 2, 205, 207, 5, 70, 7, 199, 9, + /* 260 */ 212, 266, 76, 77, 78, 79, 39, 1, 2, 83, + /* 270 */ 84, 5, 277, 7, 244, 9, 249, 84, 248, 27, + /* 280 */ 28, 29, 30, 199, 249, 35, 36, 35, 36, 39, + /* 290 */ 243, 39, 40, 41, 199, 244, 39, 40, 41, 248, + /* 300 */ 144, 35, 36, 70, 64, 65, 66, 121, 266, 153, + /* 310 */ 154, 71, 72, 73, 74, 75, 199, 99, 2, 277, + /* 320 */ 205, 5, 5, 7, 7, 9, 70, 212, 244, 143, + /* 330 */ 90, 145, 248, 274, 84, 64, 65, 66, 152, 244, + /* 340 */ 221, 222, 71, 248, 73, 74, 75, 64, 65, 66, + /* 350 */ 84, 35, 36, 82, 71, 72, 73, 74, 75, 141, + /* 360 */ 100, 207, 102, 103, 78, 205, 199, 107, 199, 119, + /* 370 */ 120, 111, 212, 113, 114, 199, 126, 199, 199, 146, + /* 380 */ 5, 148, 7, 150, 151, 119, 120, 199, 80, 272, + /* 390 */ 199, 274, 126, 15, 240, 241, 242, 243, 210, 84, + /* 400 */ 92, 210, 146, 88, 148, 199, 150, 151, 64, 65, + /* 410 */ 66, 244, 99, 244, 207, 248, 210, 248, 203, 204, + /* 420 */ 244, 135, 244, 244, 248, 85, 248, 248, 67, 68, + /* 430 */ 69, 85, 85, 118, 99, 119, 120, 85, 125, 99, + /* 440 */ 85, 85, 85, 126, 85, 85, 266, 85, 241, 85, + /* 450 */ 84, 99, 85, 85, 99, 99, 99, 62, 99, 99, + /* 460 */ 84, 99, 85, 99, 80, 81, 99, 99, 122, 122, + /* 470 */ 147, 147, 149, 149, 139, 147, 99, 149, 5, 84, + /* 480 */ 7, 199, 5, 117, 7, 147, 147, 149, 149, 147, + /* 490 */ 266, 149, 116, 239, 266, 266, 266, 119, 266, 199, + /* 500 */ 266, 126, 266, 266, 266, 266, 239, 266, 266, 266, + /* 510 */ 266, 266, 266, 266, 249, 239, 239, 239, 239, 239, + /* 520 */ 199, 199, 247, 265, 199, 199, 199, 62, 247, 199, + /* 530 */ 199, 199, 247, 199, 275, 251, 275, 201, 201, 270, + /* 540 */ 199, 91, 199, 270, 199, 255, 259, 199, 199, 199, + /* 550 */ 199, 126, 199, 199, 262, 261, 260, 199, 270, 270, + /* 560 */ 136, 133, 199, 258, 199, 138, 140, 137, 199, 199, + /* 570 */ 199, 199, 199, 199, 131, 257, 130, 129, 199, 199, + /* 580 */ 199, 199, 199, 132, 199, 199, 199, 199, 199, 199, + /* 590 */ 199, 199, 199, 199, 142, 199, 199, 199, 199, 199, + /* 600 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + /* 610 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + /* 620 */ 115, 98, 201, 201, 201, 97, 53, 94, 96, 57, + /* 630 */ 95, 93, 86, 5, 201, 201, 201, 155, 5, 5, + /* 640 */ 155, 201, 201, 5, 5, 102, 207, 211, 211, 207, + /* 650 */ 101, 144, 122, 117, 84, 99, 85, 123, 84, 99, + /* 660 */ 201, 201, 201, 218, 220, 216, 219, 214, 202, 213, + /* 670 */ 215, 217, 202, 202, 202, 201, 238, 201, 203, 201, + /* 680 */ 222, 85, 84, 252, 85, 256, 254, 208, 84, 99, + /* 690 */ 85, 84, 1, 85, 84, 238, 84, 134, 134, 99, + /* 700 */ 99, 84, 84, 117, 84, 118, 80, 72, 89, 88, + /* 710 */ 5, 89, 88, 9, 5, 5, 5, 5, 5, 5, + /* 720 */ 5, 15, 80, 87, 84, 119, 85, 84, 26, 61, + /* 730 */ 149, 149, 16, 16, 149, 5, 99, 149, 5, 85, + /* 740 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 750 */ 5, 5, 5, 5, 5, 99, 87, 62, 0, 278, + /* 760 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 770 */ 278, 21, 21, 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, 278, 278, 278, 278, 278, 278, + /* 960 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, }; -#define YY_SHIFT_COUNT (365) +#define YY_SHIFT_COUNT (367) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (751) +#define YY_SHIFT_MAX (758) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 184, 115, 115, 219, 219, 86, 230, 240, 240, 2, - /* 10 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - /* 20 */ 143, 143, 143, 0, 42, 240, 305, 305, 305, 123, - /* 30 */ 123, 143, 143, 83, 143, 111, 143, 143, 143, 143, - /* 40 */ 243, 86, 35, 35, 5, 766, 766, 766, 240, 240, - /* 50 */ 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, - /* 60 */ 240, 240, 240, 240, 240, 240, 240, 240, 240, 305, - /* 70 */ 305, 305, 199, 199, 199, 199, 199, 199, 199, 143, - /* 80 */ 143, 143, 303, 143, 143, 143, 123, 123, 143, 143, - /* 90 */ 143, 143, 306, 306, 323, 123, 143, 143, 143, 143, - /* 100 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - /* 110 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - /* 120 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - /* 130 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - /* 140 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - /* 150 */ 143, 143, 143, 143, 143, 474, 474, 474, 415, 415, - /* 160 */ 415, 415, 474, 474, 420, 424, 427, 428, 431, 438, - /* 170 */ 440, 443, 441, 445, 474, 474, 474, 518, 518, 496, - /* 180 */ 86, 86, 474, 474, 514, 519, 566, 526, 525, 565, - /* 190 */ 529, 532, 496, 5, 474, 474, 542, 542, 474, 542, - /* 200 */ 474, 542, 474, 474, 766, 766, 28, 93, 93, 121, - /* 210 */ 93, 148, 173, 208, 260, 260, 260, 260, 260, 273, - /* 220 */ 298, 216, 216, 216, 216, 232, 246, 14, 291, 365, - /* 230 */ 365, 26, 337, 217, 354, 338, 308, 310, 343, 344, - /* 240 */ 348, 18, 41, 359, 361, 366, 367, 368, 342, 369, - /* 250 */ 370, 437, 388, 374, 371, 315, 324, 328, 472, 473, - /* 260 */ 335, 336, 373, 339, 410, 623, 475, 625, 626, 481, - /* 270 */ 627, 631, 536, 538, 500, 523, 530, 562, 527, 563, - /* 280 */ 567, 550, 555, 570, 573, 596, 598, 599, 584, 601, - /* 290 */ 602, 605, 684, 606, 592, 558, 594, 560, 611, 530, - /* 300 */ 612, 580, 614, 581, 620, 613, 615, 629, 698, 616, - /* 310 */ 618, 697, 702, 703, 704, 705, 706, 707, 708, 628, - /* 320 */ 700, 637, 634, 635, 600, 638, 695, 662, 709, 575, - /* 330 */ 576, 630, 630, 630, 630, 710, 579, 582, 630, 630, - /* 340 */ 630, 724, 726, 648, 630, 728, 729, 730, 731, 732, - /* 350 */ 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, - /* 360 */ 650, 663, 743, 744, 689, 751, + /* 0 */ 186, 113, 113, 260, 260, 98, 250, 266, 266, 193, + /* 10 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 20 */ 23, 23, 23, 0, 122, 266, 316, 316, 316, 9, + /* 30 */ 9, 23, 23, 18, 23, 78, 23, 23, 23, 23, + /* 40 */ 308, 98, 112, 112, 61, 773, 773, 773, 266, 266, + /* 50 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + /* 60 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + /* 70 */ 316, 316, 316, 2, 2, 2, 2, 2, 2, 2, + /* 80 */ 23, 23, 23, 64, 23, 23, 23, 9, 9, 23, + /* 90 */ 23, 23, 23, 286, 286, 313, 9, 23, 23, 23, + /* 100 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 110 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 120 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 130 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 140 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 150 */ 23, 23, 23, 23, 23, 23, 465, 465, 465, 425, + /* 160 */ 425, 425, 425, 465, 465, 427, 426, 428, 430, 424, + /* 170 */ 443, 446, 448, 451, 452, 465, 465, 465, 450, 450, + /* 180 */ 505, 98, 98, 465, 465, 523, 528, 573, 533, 532, + /* 190 */ 572, 535, 538, 505, 61, 465, 465, 546, 546, 465, + /* 200 */ 546, 465, 546, 465, 465, 773, 773, 29, 69, 69, + /* 210 */ 99, 69, 127, 170, 240, 252, 252, 252, 252, 252, + /* 220 */ 252, 271, 283, 40, 40, 40, 40, 233, 256, 156, + /* 230 */ 315, 257, 257, 317, 375, 361, 344, 340, 346, 347, + /* 240 */ 352, 355, 356, 218, 335, 357, 359, 360, 362, 364, + /* 250 */ 366, 367, 368, 227, 395, 378, 377, 323, 324, 328, + /* 260 */ 473, 477, 338, 339, 376, 342, 384, 628, 482, 633, + /* 270 */ 634, 485, 638, 639, 543, 549, 507, 530, 536, 570, + /* 280 */ 534, 571, 574, 556, 560, 596, 598, 599, 604, 605, + /* 290 */ 590, 607, 608, 610, 691, 612, 600, 563, 601, 564, + /* 300 */ 617, 536, 618, 586, 620, 587, 626, 619, 621, 635, + /* 310 */ 705, 622, 624, 704, 709, 710, 711, 712, 713, 714, + /* 320 */ 715, 636, 706, 642, 640, 641, 606, 643, 702, 668, + /* 330 */ 716, 581, 582, 637, 637, 637, 637, 717, 585, 588, + /* 340 */ 637, 637, 637, 730, 733, 654, 637, 735, 736, 737, + /* 350 */ 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, + /* 360 */ 748, 749, 656, 669, 750, 751, 695, 758, }; -#define YY_REDUCE_COUNT (205) -#define YY_REDUCE_MIN (-257) -#define YY_REDUCE_MAX (478) +#define YY_REDUCE_COUNT (206) +#define YY_REDUCE_MIN (-266) +#define YY_REDUCE_MAX (479) static const short yy_reduce_ofst[] = { - /* 0 */ -138, -153, -153, 151, 151, 51, -140, -13, 43, -114, - /* 10 */ -183, -95, -68, -7, 113, 154, 155, 166, 169, 187, - /* 20 */ 190, 192, 201, -180, -194, -257, -242, -212, -63, -239, - /* 30 */ -216, -35, 32, -147, -198, 64, -69, 60, 118, -186, - /* 40 */ 92, 160, 98, 146, 56, 157, 203, 212, -228, -81, - /* 50 */ -21, 52, 59, 65, 68, 142, 195, 221, 226, 228, - /* 60 */ 229, 231, 233, 234, 235, 236, 237, 238, 239, 103, - /* 70 */ 225, 247, 259, 267, 268, 269, 270, 271, 272, 313, - /* 80 */ 314, 316, 249, 317, 318, 319, 274, 275, 320, 321, - /* 90 */ 325, 326, 248, 251, 276, 281, 330, 331, 332, 333, - /* 100 */ 334, 340, 341, 345, 346, 347, 349, 350, 351, 352, - /* 110 */ 353, 355, 356, 357, 358, 360, 362, 363, 364, 372, - /* 120 */ 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - /* 130 */ 385, 386, 387, 389, 390, 391, 392, 393, 394, 395, - /* 140 */ 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - /* 150 */ 406, 407, 408, 409, 411, 412, 413, 414, 264, 265, - /* 160 */ 277, 283, 416, 417, 280, 282, 278, 307, 279, 311, - /* 170 */ 418, 421, 419, 423, 422, 425, 426, 429, 430, 432, - /* 180 */ 435, 436, 433, 434, 439, 442, 444, 446, 447, 448, - /* 190 */ 449, 453, 450, 455, 451, 452, 454, 456, 466, 467, - /* 200 */ 470, 476, 471, 478, 460, 477, + /* 0 */ -186, 10, 10, -163, -163, 154, -159, -5, 42, -168, + /* 10 */ -112, -115, 117, -41, 30, 51, 84, 95, 167, 169, + /* 20 */ 176, 178, 179, -195, -197, -258, -239, -201, -143, -229, + /* 30 */ -130, -62, 59, -238, -57, 47, 188, 191, 206, -88, + /* 40 */ 48, 207, 115, 160, 119, -99, 22, 215, -266, -261, + /* 50 */ -213, -58, 180, 224, 228, 229, 230, 232, 234, 236, + /* 60 */ 237, 238, 239, 241, 242, 243, 244, 245, 246, 247, + /* 70 */ 27, 35, 265, 254, 267, 276, 277, 278, 279, 280, + /* 80 */ 282, 300, 321, 258, 322, 325, 326, 275, 281, 327, + /* 90 */ 330, 331, 332, 259, 261, 284, 285, 334, 341, 343, + /* 100 */ 345, 348, 349, 350, 351, 353, 354, 358, 363, 365, + /* 110 */ 369, 370, 371, 372, 373, 374, 379, 380, 381, 382, + /* 120 */ 383, 385, 386, 387, 388, 389, 390, 391, 392, 393, + /* 130 */ 394, 396, 397, 398, 399, 400, 401, 402, 403, 404, + /* 140 */ 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + /* 150 */ 415, 416, 417, 418, 419, 420, 336, 337, 421, 269, + /* 160 */ 273, 288, 289, 422, 423, 292, 294, 296, 287, 305, + /* 170 */ 318, 429, 290, 432, 431, 433, 434, 435, 436, 437, + /* 180 */ 438, 439, 442, 440, 441, 444, 447, 445, 453, 454, + /* 190 */ 455, 449, 456, 457, 458, 459, 460, 466, 470, 461, + /* 200 */ 471, 474, 472, 476, 478, 479, 475, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 867, 991, 930, 1001, 917, 927, 1141, 1141, 1141, 867, - /* 10 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 20 */ 867, 867, 867, 1049, 887, 1141, 867, 867, 867, 867, - /* 30 */ 867, 867, 867, 1064, 867, 927, 867, 867, 867, 867, - /* 40 */ 937, 927, 937, 937, 867, 1044, 975, 993, 867, 867, - /* 50 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 60 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 70 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 80 */ 867, 867, 1051, 1057, 1054, 867, 867, 867, 1059, 867, - /* 90 */ 867, 867, 1083, 1083, 1042, 867, 867, 867, 867, 867, - /* 100 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 110 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 120 */ 867, 867, 867, 867, 867, 867, 867, 867, 915, 867, - /* 130 */ 913, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 140 */ 867, 867, 867, 867, 867, 867, 867, 898, 867, 867, - /* 150 */ 867, 867, 867, 867, 885, 889, 889, 889, 867, 867, - /* 160 */ 867, 867, 889, 889, 1090, 1094, 1076, 1088, 1084, 1071, - /* 170 */ 1069, 1067, 1075, 1098, 889, 889, 889, 935, 935, 931, - /* 180 */ 927, 927, 889, 889, 953, 951, 949, 941, 947, 943, - /* 190 */ 945, 939, 918, 867, 889, 889, 925, 925, 889, 925, - /* 200 */ 889, 925, 889, 889, 975, 993, 867, 1099, 1089, 867, - /* 210 */ 1140, 1129, 1128, 867, 1136, 1135, 1127, 1126, 1125, 867, - /* 220 */ 867, 1121, 1124, 1123, 1122, 867, 867, 867, 867, 1131, - /* 230 */ 1130, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 240 */ 867, 1095, 1091, 867, 867, 867, 867, 867, 867, 867, - /* 250 */ 867, 867, 1101, 867, 867, 867, 867, 867, 867, 867, - /* 260 */ 867, 867, 1003, 867, 867, 867, 867, 867, 867, 867, - /* 270 */ 867, 867, 867, 867, 867, 1041, 867, 867, 867, 867, - /* 280 */ 867, 1053, 1052, 867, 867, 867, 867, 867, 867, 867, - /* 290 */ 867, 867, 867, 867, 1085, 867, 1077, 867, 867, 1015, - /* 300 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 310 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 320 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 330 */ 867, 1159, 1154, 1155, 1152, 867, 867, 867, 1151, 1146, - /* 340 */ 1147, 867, 867, 867, 1144, 867, 867, 867, 867, 867, - /* 350 */ 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, - /* 360 */ 959, 867, 896, 894, 867, 867, + /* 0 */ 870, 994, 933, 1004, 920, 930, 1145, 1145, 1145, 870, + /* 10 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 20 */ 870, 870, 870, 1052, 890, 1145, 870, 870, 870, 870, + /* 30 */ 870, 870, 870, 1067, 870, 930, 870, 870, 870, 870, + /* 40 */ 940, 930, 940, 940, 870, 1047, 978, 996, 870, 870, + /* 50 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 60 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 70 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 80 */ 870, 870, 870, 1054, 1060, 1057, 870, 870, 870, 1062, + /* 90 */ 870, 870, 870, 1086, 1086, 1045, 870, 870, 870, 870, + /* 100 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 110 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 120 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 918, + /* 130 */ 870, 916, 870, 870, 870, 870, 870, 870, 870, 870, + /* 140 */ 870, 870, 870, 870, 870, 870, 870, 870, 901, 870, + /* 150 */ 870, 870, 870, 870, 870, 888, 892, 892, 892, 870, + /* 160 */ 870, 870, 870, 892, 892, 1093, 1097, 1079, 1091, 1087, + /* 170 */ 1074, 1072, 1070, 1078, 1101, 892, 892, 892, 938, 938, + /* 180 */ 934, 930, 930, 892, 892, 956, 954, 952, 944, 950, + /* 190 */ 946, 948, 942, 921, 870, 892, 892, 928, 928, 892, + /* 200 */ 928, 892, 928, 892, 892, 978, 996, 870, 1102, 1092, + /* 210 */ 870, 1144, 1132, 1131, 870, 1140, 1139, 1138, 1130, 1129, + /* 220 */ 1128, 870, 870, 1124, 1127, 1126, 1125, 870, 870, 870, + /* 230 */ 870, 1134, 1133, 870, 870, 870, 870, 870, 870, 870, + /* 240 */ 870, 870, 870, 1098, 1094, 870, 870, 870, 870, 870, + /* 250 */ 870, 870, 870, 870, 1104, 870, 870, 870, 870, 870, + /* 260 */ 870, 870, 870, 870, 1006, 870, 870, 870, 870, 870, + /* 270 */ 870, 870, 870, 870, 870, 870, 870, 1044, 870, 870, + /* 280 */ 870, 870, 870, 1056, 1055, 870, 870, 870, 870, 870, + /* 290 */ 870, 870, 870, 870, 870, 870, 1088, 870, 1080, 870, + /* 300 */ 870, 1018, 870, 870, 870, 870, 870, 870, 870, 870, + /* 310 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 320 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 330 */ 870, 870, 870, 1163, 1158, 1159, 1156, 870, 870, 870, + /* 340 */ 1155, 1150, 1151, 870, 870, 870, 1148, 870, 870, 870, + /* 350 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, + /* 360 */ 870, 870, 962, 870, 899, 897, 870, 870, }; /********** End of lemon-generated parsing tables *****************************/ @@ -545,6 +546,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* IS => nothing */ 1, /* LIKE => ID */ 1, /* MATCH => ID */ + 1, /* NMATCH => ID */ 1, /* GLOB => ID */ 0, /* BETWEEN => nothing */ 0, /* IN => nothing */ @@ -828,260 +830,261 @@ static const char *const yyTokenName[] = { /* 20 */ "IS", /* 21 */ "LIKE", /* 22 */ "MATCH", - /* 23 */ "GLOB", - /* 24 */ "BETWEEN", - /* 25 */ "IN", - /* 26 */ "GT", - /* 27 */ "GE", - /* 28 */ "LT", - /* 29 */ "LE", - /* 30 */ "BITAND", - /* 31 */ "BITOR", - /* 32 */ "LSHIFT", - /* 33 */ "RSHIFT", - /* 34 */ "PLUS", - /* 35 */ "MINUS", - /* 36 */ "DIVIDE", - /* 37 */ "TIMES", - /* 38 */ "STAR", - /* 39 */ "SLASH", - /* 40 */ "REM", - /* 41 */ "CONCAT", - /* 42 */ "UMINUS", - /* 43 */ "UPLUS", - /* 44 */ "BITNOT", - /* 45 */ "SHOW", - /* 46 */ "DATABASES", - /* 47 */ "TOPICS", - /* 48 */ "FUNCTIONS", - /* 49 */ "MNODES", - /* 50 */ "DNODES", - /* 51 */ "ACCOUNTS", - /* 52 */ "USERS", - /* 53 */ "MODULES", - /* 54 */ "QUERIES", - /* 55 */ "CONNECTIONS", - /* 56 */ "STREAMS", - /* 57 */ "VARIABLES", - /* 58 */ "SCORES", - /* 59 */ "GRANTS", - /* 60 */ "VNODES", - /* 61 */ "DOT", - /* 62 */ "CREATE", - /* 63 */ "TABLE", - /* 64 */ "STABLE", - /* 65 */ "DATABASE", - /* 66 */ "TABLES", - /* 67 */ "STABLES", - /* 68 */ "VGROUPS", - /* 69 */ "DROP", - /* 70 */ "TOPIC", - /* 71 */ "FUNCTION", - /* 72 */ "DNODE", - /* 73 */ "USER", - /* 74 */ "ACCOUNT", - /* 75 */ "USE", - /* 76 */ "DESCRIBE", - /* 77 */ "DESC", - /* 78 */ "ALTER", - /* 79 */ "PASS", - /* 80 */ "PRIVILEGE", - /* 81 */ "LOCAL", - /* 82 */ "COMPACT", - /* 83 */ "LP", - /* 84 */ "RP", - /* 85 */ "IF", - /* 86 */ "EXISTS", - /* 87 */ "AS", - /* 88 */ "OUTPUTTYPE", - /* 89 */ "AGGREGATE", - /* 90 */ "BUFSIZE", - /* 91 */ "PPS", - /* 92 */ "TSERIES", - /* 93 */ "DBS", - /* 94 */ "STORAGE", - /* 95 */ "QTIME", - /* 96 */ "CONNS", - /* 97 */ "STATE", - /* 98 */ "COMMA", - /* 99 */ "KEEP", - /* 100 */ "CACHE", - /* 101 */ "REPLICA", - /* 102 */ "QUORUM", - /* 103 */ "DAYS", - /* 104 */ "MINROWS", - /* 105 */ "MAXROWS", - /* 106 */ "BLOCKS", - /* 107 */ "CTIME", - /* 108 */ "WAL", - /* 109 */ "FSYNC", - /* 110 */ "COMP", - /* 111 */ "PRECISION", - /* 112 */ "UPDATE", - /* 113 */ "CACHELAST", - /* 114 */ "PARTITIONS", - /* 115 */ "UNSIGNED", - /* 116 */ "TAGS", - /* 117 */ "USING", - /* 118 */ "NULL", - /* 119 */ "NOW", - /* 120 */ "SELECT", - /* 121 */ "UNION", - /* 122 */ "ALL", - /* 123 */ "DISTINCT", - /* 124 */ "FROM", - /* 125 */ "VARIABLE", - /* 126 */ "INTERVAL", - /* 127 */ "EVERY", - /* 128 */ "SESSION", - /* 129 */ "STATE_WINDOW", - /* 130 */ "FILL", - /* 131 */ "SLIDING", - /* 132 */ "ORDER", - /* 133 */ "BY", - /* 134 */ "ASC", - /* 135 */ "GROUP", - /* 136 */ "HAVING", - /* 137 */ "LIMIT", - /* 138 */ "OFFSET", - /* 139 */ "SLIMIT", - /* 140 */ "SOFFSET", - /* 141 */ "WHERE", - /* 142 */ "RESET", - /* 143 */ "QUERY", - /* 144 */ "SYNCDB", - /* 145 */ "ADD", - /* 146 */ "COLUMN", - /* 147 */ "MODIFY", - /* 148 */ "TAG", - /* 149 */ "CHANGE", - /* 150 */ "SET", - /* 151 */ "KILL", - /* 152 */ "CONNECTION", - /* 153 */ "STREAM", - /* 154 */ "COLON", - /* 155 */ "ABORT", - /* 156 */ "AFTER", - /* 157 */ "ATTACH", - /* 158 */ "BEFORE", - /* 159 */ "BEGIN", - /* 160 */ "CASCADE", - /* 161 */ "CLUSTER", - /* 162 */ "CONFLICT", - /* 163 */ "COPY", - /* 164 */ "DEFERRED", - /* 165 */ "DELIMITERS", - /* 166 */ "DETACH", - /* 167 */ "EACH", - /* 168 */ "END", - /* 169 */ "EXPLAIN", - /* 170 */ "FAIL", - /* 171 */ "FOR", - /* 172 */ "IGNORE", - /* 173 */ "IMMEDIATE", - /* 174 */ "INITIALLY", - /* 175 */ "INSTEAD", - /* 176 */ "KEY", - /* 177 */ "OF", - /* 178 */ "RAISE", - /* 179 */ "REPLACE", - /* 180 */ "RESTRICT", - /* 181 */ "ROW", - /* 182 */ "STATEMENT", - /* 183 */ "TRIGGER", - /* 184 */ "VIEW", - /* 185 */ "IPTOKEN", - /* 186 */ "SEMI", - /* 187 */ "NONE", - /* 188 */ "PREV", - /* 189 */ "LINEAR", - /* 190 */ "IMPORT", - /* 191 */ "TBNAME", - /* 192 */ "JOIN", - /* 193 */ "INSERT", - /* 194 */ "INTO", - /* 195 */ "VALUES", - /* 196 */ "program", - /* 197 */ "cmd", - /* 198 */ "ids", - /* 199 */ "dbPrefix", - /* 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", + /* 23 */ "NMATCH", + /* 24 */ "GLOB", + /* 25 */ "BETWEEN", + /* 26 */ "IN", + /* 27 */ "GT", + /* 28 */ "GE", + /* 29 */ "LT", + /* 30 */ "LE", + /* 31 */ "BITAND", + /* 32 */ "BITOR", + /* 33 */ "LSHIFT", + /* 34 */ "RSHIFT", + /* 35 */ "PLUS", + /* 36 */ "MINUS", + /* 37 */ "DIVIDE", + /* 38 */ "TIMES", + /* 39 */ "STAR", + /* 40 */ "SLASH", + /* 41 */ "REM", + /* 42 */ "CONCAT", + /* 43 */ "UMINUS", + /* 44 */ "UPLUS", + /* 45 */ "BITNOT", + /* 46 */ "SHOW", + /* 47 */ "DATABASES", + /* 48 */ "TOPICS", + /* 49 */ "FUNCTIONS", + /* 50 */ "MNODES", + /* 51 */ "DNODES", + /* 52 */ "ACCOUNTS", + /* 53 */ "USERS", + /* 54 */ "MODULES", + /* 55 */ "QUERIES", + /* 56 */ "CONNECTIONS", + /* 57 */ "STREAMS", + /* 58 */ "VARIABLES", + /* 59 */ "SCORES", + /* 60 */ "GRANTS", + /* 61 */ "VNODES", + /* 62 */ "DOT", + /* 63 */ "CREATE", + /* 64 */ "TABLE", + /* 65 */ "STABLE", + /* 66 */ "DATABASE", + /* 67 */ "TABLES", + /* 68 */ "STABLES", + /* 69 */ "VGROUPS", + /* 70 */ "DROP", + /* 71 */ "TOPIC", + /* 72 */ "FUNCTION", + /* 73 */ "DNODE", + /* 74 */ "USER", + /* 75 */ "ACCOUNT", + /* 76 */ "USE", + /* 77 */ "DESCRIBE", + /* 78 */ "DESC", + /* 79 */ "ALTER", + /* 80 */ "PASS", + /* 81 */ "PRIVILEGE", + /* 82 */ "LOCAL", + /* 83 */ "COMPACT", + /* 84 */ "LP", + /* 85 */ "RP", + /* 86 */ "IF", + /* 87 */ "EXISTS", + /* 88 */ "AS", + /* 89 */ "OUTPUTTYPE", + /* 90 */ "AGGREGATE", + /* 91 */ "BUFSIZE", + /* 92 */ "PPS", + /* 93 */ "TSERIES", + /* 94 */ "DBS", + /* 95 */ "STORAGE", + /* 96 */ "QTIME", + /* 97 */ "CONNS", + /* 98 */ "STATE", + /* 99 */ "COMMA", + /* 100 */ "KEEP", + /* 101 */ "CACHE", + /* 102 */ "REPLICA", + /* 103 */ "QUORUM", + /* 104 */ "DAYS", + /* 105 */ "MINROWS", + /* 106 */ "MAXROWS", + /* 107 */ "BLOCKS", + /* 108 */ "CTIME", + /* 109 */ "WAL", + /* 110 */ "FSYNC", + /* 111 */ "COMP", + /* 112 */ "PRECISION", + /* 113 */ "UPDATE", + /* 114 */ "CACHELAST", + /* 115 */ "PARTITIONS", + /* 116 */ "UNSIGNED", + /* 117 */ "TAGS", + /* 118 */ "USING", + /* 119 */ "NULL", + /* 120 */ "NOW", + /* 121 */ "SELECT", + /* 122 */ "UNION", + /* 123 */ "ALL", + /* 124 */ "DISTINCT", + /* 125 */ "FROM", + /* 126 */ "VARIABLE", + /* 127 */ "INTERVAL", + /* 128 */ "EVERY", + /* 129 */ "SESSION", + /* 130 */ "STATE_WINDOW", + /* 131 */ "FILL", + /* 132 */ "SLIDING", + /* 133 */ "ORDER", + /* 134 */ "BY", + /* 135 */ "ASC", + /* 136 */ "GROUP", + /* 137 */ "HAVING", + /* 138 */ "LIMIT", + /* 139 */ "OFFSET", + /* 140 */ "SLIMIT", + /* 141 */ "SOFFSET", + /* 142 */ "WHERE", + /* 143 */ "RESET", + /* 144 */ "QUERY", + /* 145 */ "SYNCDB", + /* 146 */ "ADD", + /* 147 */ "COLUMN", + /* 148 */ "MODIFY", + /* 149 */ "TAG", + /* 150 */ "CHANGE", + /* 151 */ "SET", + /* 152 */ "KILL", + /* 153 */ "CONNECTION", + /* 154 */ "STREAM", + /* 155 */ "COLON", + /* 156 */ "ABORT", + /* 157 */ "AFTER", + /* 158 */ "ATTACH", + /* 159 */ "BEFORE", + /* 160 */ "BEGIN", + /* 161 */ "CASCADE", + /* 162 */ "CLUSTER", + /* 163 */ "CONFLICT", + /* 164 */ "COPY", + /* 165 */ "DEFERRED", + /* 166 */ "DELIMITERS", + /* 167 */ "DETACH", + /* 168 */ "EACH", + /* 169 */ "END", + /* 170 */ "EXPLAIN", + /* 171 */ "FAIL", + /* 172 */ "FOR", + /* 173 */ "IGNORE", + /* 174 */ "IMMEDIATE", + /* 175 */ "INITIALLY", + /* 176 */ "INSTEAD", + /* 177 */ "KEY", + /* 178 */ "OF", + /* 179 */ "RAISE", + /* 180 */ "REPLACE", + /* 181 */ "RESTRICT", + /* 182 */ "ROW", + /* 183 */ "STATEMENT", + /* 184 */ "TRIGGER", + /* 185 */ "VIEW", + /* 186 */ "IPTOKEN", + /* 187 */ "SEMI", + /* 188 */ "NONE", + /* 189 */ "PREV", + /* 190 */ "LINEAR", + /* 191 */ "IMPORT", + /* 192 */ "TBNAME", + /* 193 */ "JOIN", + /* 194 */ "INSERT", + /* 195 */ "INTO", + /* 196 */ "VALUES", + /* 197 */ "program", + /* 198 */ "cmd", + /* 199 */ "ids", + /* 200 */ "dbPrefix", + /* 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) */ @@ -1356,32 +1359,33 @@ static const char *const yyRuleName[] = { /* 264 */ "expr ::= expr REM expr", /* 265 */ "expr ::= expr LIKE expr", /* 266 */ "expr ::= expr MATCH expr", - /* 267 */ "expr ::= expr IN LP exprlist RP", - /* 268 */ "exprlist ::= exprlist COMMA expritem", - /* 269 */ "exprlist ::= expritem", - /* 270 */ "expritem ::= expr", - /* 271 */ "expritem ::=", - /* 272 */ "cmd ::= RESET QUERY CACHE", - /* 273 */ "cmd ::= SYNCDB ids REPLICA", - /* 274 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 275 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 276 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 277 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 278 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 279 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 280 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 281 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 282 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 283 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 284 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 285 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 286 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 287 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 288 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 289 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 290 */ "cmd ::= KILL CONNECTION INTEGER", - /* 291 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 292 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 267 */ "expr ::= expr NMATCH expr", + /* 268 */ "expr ::= expr IN LP exprlist RP", + /* 269 */ "exprlist ::= exprlist COMMA expritem", + /* 270 */ "exprlist ::= expritem", + /* 271 */ "expritem ::= expr", + /* 272 */ "expritem ::=", + /* 273 */ "cmd ::= RESET QUERY CACHE", + /* 274 */ "cmd ::= SYNCDB ids REPLICA", + /* 275 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 276 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 277 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 278 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 279 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 280 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 281 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 282 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 283 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 284 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 285 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 286 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 287 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 288 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 289 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 290 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 291 */ "cmd ::= KILL CONNECTION INTEGER", + /* 292 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 293 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1507,76 +1511,76 @@ 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 */ { -#line 761 "sql.y" -tSqlExprListDestroy((yypminor->yy403)); -#line 1517 "sql.c" +#line 762 "sql.y" +tSqlExprListDestroy((yypminor->yy421)); +#line 1521 "sql.c" } 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 */ + 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 */ { #line 256 "sql.y" -taosArrayDestroy((yypminor->yy403)); -#line 1533 "sql.c" +taosArrayDestroy((yypminor->yy421)); +#line 1537 "sql.c" } break; - case 241: /* create_table_list */ + case 242: /* create_table_list */ { #line 364 "sql.y" -destroyCreateTableSql((yypminor->yy56)); -#line 1540 "sql.c" +destroyCreateTableSql((yypminor->yy438)); +#line 1544 "sql.c" } break; - case 246: /* select */ + case 247: /* select */ { #line 484 "sql.y" -destroySqlNode((yypminor->yy224)); -#line 1547 "sql.c" +destroySqlNode((yypminor->yy56)); +#line 1551 "sql.c" } break; - case 250: /* from */ - case 267: /* tablelist */ - case 268: /* sub */ + case 251: /* from */ + case 268: /* tablelist */ + case 269: /* sub */ { #line 539 "sql.y" -destroyRelationInfo((yypminor->yy114)); -#line 1556 "sql.c" +destroyRelationInfo((yypminor->yy8)); +#line 1560 "sql.c" } 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 */ { #line 691 "sql.y" -tSqlExprDestroy((yypminor->yy260)); -#line 1566 "sql.c" +tSqlExprDestroy((yypminor->yy439)); +#line 1570 "sql.c" } break; - case 262: /* union */ + case 263: /* union */ { #line 492 "sql.y" -destroyAllSqlNode((yypminor->yy403)); -#line 1573 "sql.c" +destroyAllSqlNode((yypminor->yy421)); +#line 1577 "sql.c" } break; - case 272: /* sortitem */ + case 273: /* sortitem */ { #line 624 "sql.y" -tVariantDestroy(&(yypminor->yy488)); -#line 1580 "sql.c" +tVariantDestroy(&(yypminor->yy430)); +#line 1584 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -1865,299 +1869,300 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 196, /* (0) program ::= cmd */ - 197, /* (1) cmd ::= SHOW DATABASES */ - 197, /* (2) cmd ::= SHOW TOPICS */ - 197, /* (3) cmd ::= SHOW FUNCTIONS */ - 197, /* (4) cmd ::= SHOW MNODES */ - 197, /* (5) cmd ::= SHOW DNODES */ - 197, /* (6) cmd ::= SHOW ACCOUNTS */ - 197, /* (7) cmd ::= SHOW USERS */ - 197, /* (8) cmd ::= SHOW MODULES */ - 197, /* (9) cmd ::= SHOW QUERIES */ - 197, /* (10) cmd ::= SHOW CONNECTIONS */ - 197, /* (11) cmd ::= SHOW STREAMS */ - 197, /* (12) cmd ::= SHOW VARIABLES */ - 197, /* (13) cmd ::= SHOW SCORES */ - 197, /* (14) cmd ::= SHOW GRANTS */ - 197, /* (15) cmd ::= SHOW VNODES */ - 197, /* (16) cmd ::= SHOW VNODES ids */ - 199, /* (17) dbPrefix ::= */ - 199, /* (18) dbPrefix ::= ids DOT */ - 200, /* (19) cpxName ::= */ - 200, /* (20) cpxName ::= DOT ids */ - 197, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ - 197, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ - 197, /* (23) cmd ::= SHOW CREATE DATABASE ids */ - 197, /* (24) cmd ::= SHOW dbPrefix TABLES */ - 197, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - 197, /* (26) cmd ::= SHOW dbPrefix STABLES */ - 197, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - 197, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - 197, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ - 197, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ - 197, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ - 197, /* (32) cmd ::= DROP DATABASE ifexists ids */ - 197, /* (33) cmd ::= DROP TOPIC ifexists ids */ - 197, /* (34) cmd ::= DROP FUNCTION ids */ - 197, /* (35) cmd ::= DROP DNODE ids */ - 197, /* (36) cmd ::= DROP USER ids */ - 197, /* (37) cmd ::= DROP ACCOUNT ids */ - 197, /* (38) cmd ::= USE ids */ - 197, /* (39) cmd ::= DESCRIBE ids cpxName */ - 197, /* (40) cmd ::= DESC ids cpxName */ - 197, /* (41) cmd ::= ALTER USER ids PASS ids */ - 197, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ - 197, /* (43) cmd ::= ALTER DNODE ids ids */ - 197, /* (44) cmd ::= ALTER DNODE ids ids ids */ - 197, /* (45) cmd ::= ALTER LOCAL ids */ - 197, /* (46) cmd ::= ALTER LOCAL ids ids */ - 197, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ - 197, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ - 197, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ - 197, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - 197, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ - 198, /* (52) ids ::= ID */ - 198, /* (53) ids ::= STRING */ - 201, /* (54) ifexists ::= IF EXISTS */ - 201, /* (55) ifexists ::= */ - 206, /* (56) ifnotexists ::= IF NOT EXISTS */ - 206, /* (57) ifnotexists ::= */ - 197, /* (58) cmd ::= CREATE DNODE ids */ - 197, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - 197, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - 197, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - 197, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - 197, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - 197, /* (64) cmd ::= CREATE USER ids PASS ids */ - 210, /* (65) bufsize ::= */ - 210, /* (66) bufsize ::= BUFSIZE INTEGER */ - 211, /* (67) pps ::= */ - 211, /* (68) pps ::= PPS INTEGER */ - 212, /* (69) tseries ::= */ - 212, /* (70) tseries ::= TSERIES INTEGER */ - 213, /* (71) dbs ::= */ - 213, /* (72) dbs ::= DBS INTEGER */ - 214, /* (73) streams ::= */ - 214, /* (74) streams ::= STREAMS INTEGER */ - 215, /* (75) storage ::= */ - 215, /* (76) storage ::= STORAGE INTEGER */ - 216, /* (77) qtime ::= */ - 216, /* (78) qtime ::= QTIME INTEGER */ - 217, /* (79) users ::= */ - 217, /* (80) users ::= USERS INTEGER */ - 218, /* (81) conns ::= */ - 218, /* (82) conns ::= CONNS INTEGER */ - 219, /* (83) state ::= */ - 219, /* (84) state ::= STATE ids */ - 204, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - 220, /* (86) intitemlist ::= intitemlist COMMA intitem */ - 220, /* (87) intitemlist ::= intitem */ - 221, /* (88) intitem ::= INTEGER */ - 222, /* (89) keep ::= KEEP intitemlist */ - 223, /* (90) cache ::= CACHE INTEGER */ - 224, /* (91) replica ::= REPLICA INTEGER */ - 225, /* (92) quorum ::= QUORUM INTEGER */ - 226, /* (93) days ::= DAYS INTEGER */ - 227, /* (94) minrows ::= MINROWS INTEGER */ - 228, /* (95) maxrows ::= MAXROWS INTEGER */ - 229, /* (96) blocks ::= BLOCKS INTEGER */ - 230, /* (97) ctime ::= CTIME INTEGER */ - 231, /* (98) wal ::= WAL INTEGER */ - 232, /* (99) fsync ::= FSYNC INTEGER */ - 233, /* (100) comp ::= COMP INTEGER */ - 234, /* (101) prec ::= PRECISION STRING */ - 235, /* (102) update ::= UPDATE INTEGER */ - 236, /* (103) cachelast ::= CACHELAST INTEGER */ - 237, /* (104) partitions ::= PARTITIONS INTEGER */ - 207, /* (105) db_optr ::= */ - 207, /* (106) db_optr ::= db_optr cache */ - 207, /* (107) db_optr ::= db_optr replica */ - 207, /* (108) db_optr ::= db_optr quorum */ - 207, /* (109) db_optr ::= db_optr days */ - 207, /* (110) db_optr ::= db_optr minrows */ - 207, /* (111) db_optr ::= db_optr maxrows */ - 207, /* (112) db_optr ::= db_optr blocks */ - 207, /* (113) db_optr ::= db_optr ctime */ - 207, /* (114) db_optr ::= db_optr wal */ - 207, /* (115) db_optr ::= db_optr fsync */ - 207, /* (116) db_optr ::= db_optr comp */ - 207, /* (117) db_optr ::= db_optr prec */ - 207, /* (118) db_optr ::= db_optr keep */ - 207, /* (119) db_optr ::= db_optr update */ - 207, /* (120) db_optr ::= db_optr cachelast */ - 208, /* (121) topic_optr ::= db_optr */ - 208, /* (122) topic_optr ::= topic_optr partitions */ - 202, /* (123) alter_db_optr ::= */ - 202, /* (124) alter_db_optr ::= alter_db_optr replica */ - 202, /* (125) alter_db_optr ::= alter_db_optr quorum */ - 202, /* (126) alter_db_optr ::= alter_db_optr keep */ - 202, /* (127) alter_db_optr ::= alter_db_optr blocks */ - 202, /* (128) alter_db_optr ::= alter_db_optr comp */ - 202, /* (129) alter_db_optr ::= alter_db_optr update */ - 202, /* (130) alter_db_optr ::= alter_db_optr cachelast */ - 203, /* (131) alter_topic_optr ::= alter_db_optr */ - 203, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ - 209, /* (133) typename ::= ids */ - 209, /* (134) typename ::= ids LP signed RP */ - 209, /* (135) typename ::= ids UNSIGNED */ - 238, /* (136) signed ::= INTEGER */ - 238, /* (137) signed ::= PLUS INTEGER */ - 238, /* (138) signed ::= MINUS INTEGER */ - 197, /* (139) cmd ::= CREATE TABLE create_table_args */ - 197, /* (140) cmd ::= CREATE TABLE create_stable_args */ - 197, /* (141) cmd ::= CREATE STABLE create_stable_args */ - 197, /* (142) cmd ::= CREATE TABLE create_table_list */ - 241, /* (143) create_table_list ::= create_from_stable */ - 241, /* (144) create_table_list ::= create_table_list create_from_stable */ - 239, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - 240, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - 242, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - 242, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - 245, /* (149) tagNamelist ::= tagNamelist COMMA ids */ - 245, /* (150) tagNamelist ::= ids */ - 239, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ - 243, /* (152) columnlist ::= columnlist COMMA column */ - 243, /* (153) columnlist ::= column */ - 247, /* (154) column ::= ids typename */ - 244, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ - 244, /* (156) tagitemlist ::= tagitem */ - 248, /* (157) tagitem ::= INTEGER */ - 248, /* (158) tagitem ::= FLOAT */ - 248, /* (159) tagitem ::= STRING */ - 248, /* (160) tagitem ::= BOOL */ - 248, /* (161) tagitem ::= NULL */ - 248, /* (162) tagitem ::= NOW */ - 248, /* (163) tagitem ::= MINUS INTEGER */ - 248, /* (164) tagitem ::= MINUS FLOAT */ - 248, /* (165) tagitem ::= PLUS INTEGER */ - 248, /* (166) tagitem ::= PLUS FLOAT */ - 246, /* (167) 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, /* (168) select ::= LP select RP */ - 262, /* (169) union ::= select */ - 262, /* (170) union ::= union UNION ALL select */ - 197, /* (171) cmd ::= union */ - 246, /* (172) select ::= SELECT selcollist */ - 263, /* (173) sclp ::= selcollist COMMA */ - 263, /* (174) sclp ::= */ - 249, /* (175) selcollist ::= sclp distinct expr as */ - 249, /* (176) selcollist ::= sclp STAR */ - 266, /* (177) as ::= AS ids */ - 266, /* (178) as ::= ids */ - 266, /* (179) as ::= */ - 264, /* (180) distinct ::= DISTINCT */ - 264, /* (181) distinct ::= */ - 250, /* (182) from ::= FROM tablelist */ - 250, /* (183) from ::= FROM sub */ - 268, /* (184) sub ::= LP union RP */ - 268, /* (185) sub ::= LP union RP ids */ - 268, /* (186) sub ::= sub COMMA LP union RP ids */ - 267, /* (187) tablelist ::= ids cpxName */ - 267, /* (188) tablelist ::= ids cpxName ids */ - 267, /* (189) tablelist ::= tablelist COMMA ids cpxName */ - 267, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ - 269, /* (191) tmvar ::= VARIABLE */ - 252, /* (192) interval_option ::= intervalKey LP tmvar RP */ - 252, /* (193) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - 252, /* (194) interval_option ::= */ - 270, /* (195) intervalKey ::= INTERVAL */ - 270, /* (196) intervalKey ::= EVERY */ - 254, /* (197) session_option ::= */ - 254, /* (198) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - 255, /* (199) windowstate_option ::= */ - 255, /* (200) windowstate_option ::= STATE_WINDOW LP ids RP */ - 256, /* (201) fill_opt ::= */ - 256, /* (202) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - 256, /* (203) fill_opt ::= FILL LP ID RP */ - 253, /* (204) sliding_opt ::= SLIDING LP tmvar RP */ - 253, /* (205) sliding_opt ::= */ - 259, /* (206) orderby_opt ::= */ - 259, /* (207) orderby_opt ::= ORDER BY sortlist */ - 271, /* (208) sortlist ::= sortlist COMMA item sortorder */ - 271, /* (209) sortlist ::= item sortorder */ - 273, /* (210) item ::= ids cpxName */ - 274, /* (211) sortorder ::= ASC */ - 274, /* (212) sortorder ::= DESC */ - 274, /* (213) sortorder ::= */ - 257, /* (214) groupby_opt ::= */ - 257, /* (215) groupby_opt ::= GROUP BY grouplist */ - 275, /* (216) grouplist ::= grouplist COMMA item */ - 275, /* (217) grouplist ::= item */ - 258, /* (218) having_opt ::= */ - 258, /* (219) having_opt ::= HAVING expr */ - 261, /* (220) limit_opt ::= */ - 261, /* (221) limit_opt ::= LIMIT signed */ - 261, /* (222) limit_opt ::= LIMIT signed OFFSET signed */ - 261, /* (223) limit_opt ::= LIMIT signed COMMA signed */ - 260, /* (224) slimit_opt ::= */ - 260, /* (225) slimit_opt ::= SLIMIT signed */ - 260, /* (226) slimit_opt ::= SLIMIT signed SOFFSET signed */ - 260, /* (227) slimit_opt ::= SLIMIT signed COMMA signed */ - 251, /* (228) where_opt ::= */ - 251, /* (229) where_opt ::= WHERE expr */ - 265, /* (230) expr ::= LP expr RP */ - 265, /* (231) expr ::= ID */ - 265, /* (232) expr ::= ID DOT ID */ - 265, /* (233) expr ::= ID DOT STAR */ - 265, /* (234) expr ::= INTEGER */ - 265, /* (235) expr ::= MINUS INTEGER */ - 265, /* (236) expr ::= PLUS INTEGER */ - 265, /* (237) expr ::= FLOAT */ - 265, /* (238) expr ::= MINUS FLOAT */ - 265, /* (239) expr ::= PLUS FLOAT */ - 265, /* (240) expr ::= STRING */ - 265, /* (241) expr ::= NOW */ - 265, /* (242) expr ::= VARIABLE */ - 265, /* (243) expr ::= PLUS VARIABLE */ - 265, /* (244) expr ::= MINUS VARIABLE */ - 265, /* (245) expr ::= BOOL */ - 265, /* (246) expr ::= NULL */ - 265, /* (247) expr ::= ID LP exprlist RP */ - 265, /* (248) expr ::= ID LP STAR RP */ - 265, /* (249) expr ::= expr IS NULL */ - 265, /* (250) expr ::= expr IS NOT NULL */ - 265, /* (251) expr ::= expr LT expr */ - 265, /* (252) expr ::= expr GT expr */ - 265, /* (253) expr ::= expr LE expr */ - 265, /* (254) expr ::= expr GE expr */ - 265, /* (255) expr ::= expr NE expr */ - 265, /* (256) expr ::= expr EQ expr */ - 265, /* (257) expr ::= expr BETWEEN expr AND expr */ - 265, /* (258) expr ::= expr AND expr */ - 265, /* (259) expr ::= expr OR expr */ - 265, /* (260) expr ::= expr PLUS expr */ - 265, /* (261) expr ::= expr MINUS expr */ - 265, /* (262) expr ::= expr STAR expr */ - 265, /* (263) expr ::= expr SLASH expr */ - 265, /* (264) expr ::= expr REM expr */ - 265, /* (265) expr ::= expr LIKE expr */ - 265, /* (266) expr ::= expr MATCH expr */ - 265, /* (267) expr ::= expr IN LP exprlist RP */ - 205, /* (268) exprlist ::= exprlist COMMA expritem */ - 205, /* (269) exprlist ::= expritem */ - 276, /* (270) expritem ::= expr */ - 276, /* (271) expritem ::= */ - 197, /* (272) cmd ::= RESET QUERY CACHE */ - 197, /* (273) cmd ::= SYNCDB ids REPLICA */ - 197, /* (274) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - 197, /* (275) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 197, /* (276) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - 197, /* (277) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - 197, /* (278) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - 197, /* (279) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - 197, /* (280) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 197, /* (281) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - 197, /* (282) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - 197, /* (283) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 197, /* (284) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - 197, /* (285) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 197, /* (286) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 197, /* (287) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 197, /* (288) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - 197, /* (289) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - 197, /* (290) cmd ::= KILL CONNECTION INTEGER */ - 197, /* (291) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 197, /* (292) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 197, /* (0) program ::= cmd */ + 198, /* (1) cmd ::= SHOW DATABASES */ + 198, /* (2) cmd ::= SHOW TOPICS */ + 198, /* (3) cmd ::= SHOW FUNCTIONS */ + 198, /* (4) cmd ::= SHOW MNODES */ + 198, /* (5) cmd ::= SHOW DNODES */ + 198, /* (6) cmd ::= SHOW ACCOUNTS */ + 198, /* (7) cmd ::= SHOW USERS */ + 198, /* (8) cmd ::= SHOW MODULES */ + 198, /* (9) cmd ::= SHOW QUERIES */ + 198, /* (10) cmd ::= SHOW CONNECTIONS */ + 198, /* (11) cmd ::= SHOW STREAMS */ + 198, /* (12) cmd ::= SHOW VARIABLES */ + 198, /* (13) cmd ::= SHOW SCORES */ + 198, /* (14) cmd ::= SHOW GRANTS */ + 198, /* (15) cmd ::= SHOW VNODES */ + 198, /* (16) cmd ::= SHOW VNODES ids */ + 200, /* (17) dbPrefix ::= */ + 200, /* (18) dbPrefix ::= ids DOT */ + 201, /* (19) cpxName ::= */ + 201, /* (20) cpxName ::= DOT ids */ + 198, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + 198, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + 198, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + 198, /* (24) cmd ::= SHOW dbPrefix TABLES */ + 198, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + 198, /* (26) cmd ::= SHOW dbPrefix STABLES */ + 198, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + 198, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + 198, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ + 198, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ + 198, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ + 198, /* (32) cmd ::= DROP DATABASE ifexists ids */ + 198, /* (33) cmd ::= DROP TOPIC ifexists ids */ + 198, /* (34) cmd ::= DROP FUNCTION ids */ + 198, /* (35) cmd ::= DROP DNODE ids */ + 198, /* (36) cmd ::= DROP USER ids */ + 198, /* (37) cmd ::= DROP ACCOUNT ids */ + 198, /* (38) cmd ::= USE ids */ + 198, /* (39) cmd ::= DESCRIBE ids cpxName */ + 198, /* (40) cmd ::= DESC ids cpxName */ + 198, /* (41) cmd ::= ALTER USER ids PASS ids */ + 198, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ + 198, /* (43) cmd ::= ALTER DNODE ids ids */ + 198, /* (44) cmd ::= ALTER DNODE ids ids ids */ + 198, /* (45) cmd ::= ALTER LOCAL ids */ + 198, /* (46) cmd ::= ALTER LOCAL ids ids */ + 198, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ + 198, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 198, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ + 198, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 198, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ + 199, /* (52) ids ::= ID */ + 199, /* (53) ids ::= STRING */ + 202, /* (54) ifexists ::= IF EXISTS */ + 202, /* (55) ifexists ::= */ + 207, /* (56) ifnotexists ::= IF NOT EXISTS */ + 207, /* (57) ifnotexists ::= */ + 198, /* (58) cmd ::= CREATE DNODE ids */ + 198, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 198, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 198, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 198, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 198, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 198, /* (64) cmd ::= CREATE USER ids PASS ids */ + 211, /* (65) bufsize ::= */ + 211, /* (66) bufsize ::= BUFSIZE INTEGER */ + 212, /* (67) pps ::= */ + 212, /* (68) pps ::= PPS INTEGER */ + 213, /* (69) tseries ::= */ + 213, /* (70) tseries ::= TSERIES INTEGER */ + 214, /* (71) dbs ::= */ + 214, /* (72) dbs ::= DBS INTEGER */ + 215, /* (73) streams ::= */ + 215, /* (74) streams ::= STREAMS INTEGER */ + 216, /* (75) storage ::= */ + 216, /* (76) storage ::= STORAGE INTEGER */ + 217, /* (77) qtime ::= */ + 217, /* (78) qtime ::= QTIME INTEGER */ + 218, /* (79) users ::= */ + 218, /* (80) users ::= USERS INTEGER */ + 219, /* (81) conns ::= */ + 219, /* (82) conns ::= CONNS INTEGER */ + 220, /* (83) state ::= */ + 220, /* (84) state ::= STATE ids */ + 205, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 221, /* (86) intitemlist ::= intitemlist COMMA intitem */ + 221, /* (87) intitemlist ::= intitem */ + 222, /* (88) intitem ::= INTEGER */ + 223, /* (89) keep ::= KEEP intitemlist */ + 224, /* (90) cache ::= CACHE INTEGER */ + 225, /* (91) replica ::= REPLICA INTEGER */ + 226, /* (92) quorum ::= QUORUM INTEGER */ + 227, /* (93) days ::= DAYS INTEGER */ + 228, /* (94) minrows ::= MINROWS INTEGER */ + 229, /* (95) maxrows ::= MAXROWS INTEGER */ + 230, /* (96) blocks ::= BLOCKS INTEGER */ + 231, /* (97) ctime ::= CTIME INTEGER */ + 232, /* (98) wal ::= WAL INTEGER */ + 233, /* (99) fsync ::= FSYNC INTEGER */ + 234, /* (100) comp ::= COMP INTEGER */ + 235, /* (101) prec ::= PRECISION STRING */ + 236, /* (102) update ::= UPDATE INTEGER */ + 237, /* (103) cachelast ::= CACHELAST INTEGER */ + 238, /* (104) partitions ::= PARTITIONS INTEGER */ + 208, /* (105) db_optr ::= */ + 208, /* (106) db_optr ::= db_optr cache */ + 208, /* (107) db_optr ::= db_optr replica */ + 208, /* (108) db_optr ::= db_optr quorum */ + 208, /* (109) db_optr ::= db_optr days */ + 208, /* (110) db_optr ::= db_optr minrows */ + 208, /* (111) db_optr ::= db_optr maxrows */ + 208, /* (112) db_optr ::= db_optr blocks */ + 208, /* (113) db_optr ::= db_optr ctime */ + 208, /* (114) db_optr ::= db_optr wal */ + 208, /* (115) db_optr ::= db_optr fsync */ + 208, /* (116) db_optr ::= db_optr comp */ + 208, /* (117) db_optr ::= db_optr prec */ + 208, /* (118) db_optr ::= db_optr keep */ + 208, /* (119) db_optr ::= db_optr update */ + 208, /* (120) db_optr ::= db_optr cachelast */ + 209, /* (121) topic_optr ::= db_optr */ + 209, /* (122) topic_optr ::= topic_optr partitions */ + 203, /* (123) alter_db_optr ::= */ + 203, /* (124) alter_db_optr ::= alter_db_optr replica */ + 203, /* (125) alter_db_optr ::= alter_db_optr quorum */ + 203, /* (126) alter_db_optr ::= alter_db_optr keep */ + 203, /* (127) alter_db_optr ::= alter_db_optr blocks */ + 203, /* (128) alter_db_optr ::= alter_db_optr comp */ + 203, /* (129) alter_db_optr ::= alter_db_optr update */ + 203, /* (130) alter_db_optr ::= alter_db_optr cachelast */ + 204, /* (131) alter_topic_optr ::= alter_db_optr */ + 204, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ + 210, /* (133) typename ::= ids */ + 210, /* (134) typename ::= ids LP signed RP */ + 210, /* (135) typename ::= ids UNSIGNED */ + 239, /* (136) signed ::= INTEGER */ + 239, /* (137) signed ::= PLUS INTEGER */ + 239, /* (138) signed ::= MINUS INTEGER */ + 198, /* (139) cmd ::= CREATE TABLE create_table_args */ + 198, /* (140) cmd ::= CREATE TABLE create_stable_args */ + 198, /* (141) cmd ::= CREATE STABLE create_stable_args */ + 198, /* (142) cmd ::= CREATE TABLE create_table_list */ + 242, /* (143) create_table_list ::= create_from_stable */ + 242, /* (144) create_table_list ::= create_table_list create_from_stable */ + 240, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 241, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 243, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 243, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 246, /* (149) tagNamelist ::= tagNamelist COMMA ids */ + 246, /* (150) tagNamelist ::= ids */ + 240, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ + 244, /* (152) columnlist ::= columnlist COMMA column */ + 244, /* (153) columnlist ::= column */ + 248, /* (154) column ::= ids typename */ + 245, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ + 245, /* (156) tagitemlist ::= tagitem */ + 249, /* (157) tagitem ::= INTEGER */ + 249, /* (158) tagitem ::= FLOAT */ + 249, /* (159) tagitem ::= STRING */ + 249, /* (160) tagitem ::= BOOL */ + 249, /* (161) tagitem ::= NULL */ + 249, /* (162) tagitem ::= NOW */ + 249, /* (163) tagitem ::= MINUS INTEGER */ + 249, /* (164) tagitem ::= MINUS FLOAT */ + 249, /* (165) tagitem ::= PLUS INTEGER */ + 249, /* (166) tagitem ::= PLUS FLOAT */ + 247, /* (167) 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, /* (168) select ::= LP select RP */ + 263, /* (169) union ::= select */ + 263, /* (170) union ::= union UNION ALL select */ + 198, /* (171) cmd ::= union */ + 247, /* (172) select ::= SELECT selcollist */ + 264, /* (173) sclp ::= selcollist COMMA */ + 264, /* (174) sclp ::= */ + 250, /* (175) selcollist ::= sclp distinct expr as */ + 250, /* (176) selcollist ::= sclp STAR */ + 267, /* (177) as ::= AS ids */ + 267, /* (178) as ::= ids */ + 267, /* (179) as ::= */ + 265, /* (180) distinct ::= DISTINCT */ + 265, /* (181) distinct ::= */ + 251, /* (182) from ::= FROM tablelist */ + 251, /* (183) from ::= FROM sub */ + 269, /* (184) sub ::= LP union RP */ + 269, /* (185) sub ::= LP union RP ids */ + 269, /* (186) sub ::= sub COMMA LP union RP ids */ + 268, /* (187) tablelist ::= ids cpxName */ + 268, /* (188) tablelist ::= ids cpxName ids */ + 268, /* (189) tablelist ::= tablelist COMMA ids cpxName */ + 268, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ + 270, /* (191) tmvar ::= VARIABLE */ + 253, /* (192) interval_option ::= intervalKey LP tmvar RP */ + 253, /* (193) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 253, /* (194) interval_option ::= */ + 271, /* (195) intervalKey ::= INTERVAL */ + 271, /* (196) intervalKey ::= EVERY */ + 255, /* (197) session_option ::= */ + 255, /* (198) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 256, /* (199) windowstate_option ::= */ + 256, /* (200) windowstate_option ::= STATE_WINDOW LP ids RP */ + 257, /* (201) fill_opt ::= */ + 257, /* (202) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 257, /* (203) fill_opt ::= FILL LP ID RP */ + 254, /* (204) sliding_opt ::= SLIDING LP tmvar RP */ + 254, /* (205) sliding_opt ::= */ + 260, /* (206) orderby_opt ::= */ + 260, /* (207) orderby_opt ::= ORDER BY sortlist */ + 272, /* (208) sortlist ::= sortlist COMMA item sortorder */ + 272, /* (209) sortlist ::= item sortorder */ + 274, /* (210) item ::= ids cpxName */ + 275, /* (211) sortorder ::= ASC */ + 275, /* (212) sortorder ::= DESC */ + 275, /* (213) sortorder ::= */ + 258, /* (214) groupby_opt ::= */ + 258, /* (215) groupby_opt ::= GROUP BY grouplist */ + 276, /* (216) grouplist ::= grouplist COMMA item */ + 276, /* (217) grouplist ::= item */ + 259, /* (218) having_opt ::= */ + 259, /* (219) having_opt ::= HAVING expr */ + 262, /* (220) limit_opt ::= */ + 262, /* (221) limit_opt ::= LIMIT signed */ + 262, /* (222) limit_opt ::= LIMIT signed OFFSET signed */ + 262, /* (223) limit_opt ::= LIMIT signed COMMA signed */ + 261, /* (224) slimit_opt ::= */ + 261, /* (225) slimit_opt ::= SLIMIT signed */ + 261, /* (226) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 261, /* (227) slimit_opt ::= SLIMIT signed COMMA signed */ + 252, /* (228) where_opt ::= */ + 252, /* (229) where_opt ::= WHERE expr */ + 266, /* (230) expr ::= LP expr RP */ + 266, /* (231) expr ::= ID */ + 266, /* (232) expr ::= ID DOT ID */ + 266, /* (233) expr ::= ID DOT STAR */ + 266, /* (234) expr ::= INTEGER */ + 266, /* (235) expr ::= MINUS INTEGER */ + 266, /* (236) expr ::= PLUS INTEGER */ + 266, /* (237) expr ::= FLOAT */ + 266, /* (238) expr ::= MINUS FLOAT */ + 266, /* (239) expr ::= PLUS FLOAT */ + 266, /* (240) expr ::= STRING */ + 266, /* (241) expr ::= NOW */ + 266, /* (242) expr ::= VARIABLE */ + 266, /* (243) expr ::= PLUS VARIABLE */ + 266, /* (244) expr ::= MINUS VARIABLE */ + 266, /* (245) expr ::= BOOL */ + 266, /* (246) expr ::= NULL */ + 266, /* (247) expr ::= ID LP exprlist RP */ + 266, /* (248) expr ::= ID LP STAR RP */ + 266, /* (249) expr ::= expr IS NULL */ + 266, /* (250) expr ::= expr IS NOT NULL */ + 266, /* (251) expr ::= expr LT expr */ + 266, /* (252) expr ::= expr GT expr */ + 266, /* (253) expr ::= expr LE expr */ + 266, /* (254) expr ::= expr GE expr */ + 266, /* (255) expr ::= expr NE expr */ + 266, /* (256) expr ::= expr EQ expr */ + 266, /* (257) expr ::= expr BETWEEN expr AND expr */ + 266, /* (258) expr ::= expr AND expr */ + 266, /* (259) expr ::= expr OR expr */ + 266, /* (260) expr ::= expr PLUS expr */ + 266, /* (261) expr ::= expr MINUS expr */ + 266, /* (262) expr ::= expr STAR expr */ + 266, /* (263) expr ::= expr SLASH expr */ + 266, /* (264) expr ::= expr REM expr */ + 266, /* (265) expr ::= expr LIKE expr */ + 266, /* (266) expr ::= expr MATCH expr */ + 266, /* (267) expr ::= expr NMATCH expr */ + 266, /* (268) expr ::= expr IN LP exprlist RP */ + 206, /* (269) exprlist ::= exprlist COMMA expritem */ + 206, /* (270) exprlist ::= expritem */ + 277, /* (271) expritem ::= expr */ + 277, /* (272) expritem ::= */ + 198, /* (273) cmd ::= RESET QUERY CACHE */ + 198, /* (274) cmd ::= SYNCDB ids REPLICA */ + 198, /* (275) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 198, /* (276) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 198, /* (277) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 198, /* (278) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 198, /* (279) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 198, /* (280) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 198, /* (281) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 198, /* (282) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 198, /* (283) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 198, /* (284) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 198, /* (285) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 198, /* (286) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 198, /* (287) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 198, /* (288) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 198, /* (289) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 198, /* (290) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 198, /* (291) cmd ::= KILL CONNECTION INTEGER */ + 198, /* (292) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 198, /* (293) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2430,32 +2435,33 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (264) expr ::= expr REM expr */ -3, /* (265) expr ::= expr LIKE expr */ -3, /* (266) expr ::= expr MATCH expr */ - -5, /* (267) expr ::= expr IN LP exprlist RP */ - -3, /* (268) exprlist ::= exprlist COMMA expritem */ - -1, /* (269) exprlist ::= expritem */ - -1, /* (270) expritem ::= expr */ - 0, /* (271) expritem ::= */ - -3, /* (272) cmd ::= RESET QUERY CACHE */ - -3, /* (273) cmd ::= SYNCDB ids REPLICA */ - -7, /* (274) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (275) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -7, /* (276) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (277) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - -7, /* (278) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - -8, /* (279) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (280) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (281) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - -7, /* (282) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (283) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -7, /* (284) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (285) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (286) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (287) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (288) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (289) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - -3, /* (290) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (291) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (292) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -3, /* (267) expr ::= expr NMATCH expr */ + -5, /* (268) expr ::= expr IN LP exprlist RP */ + -3, /* (269) exprlist ::= exprlist COMMA expritem */ + -1, /* (270) exprlist ::= expritem */ + -1, /* (271) expritem ::= expr */ + 0, /* (272) expritem ::= */ + -3, /* (273) cmd ::= RESET QUERY CACHE */ + -3, /* (274) cmd ::= SYNCDB ids REPLICA */ + -7, /* (275) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (276) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (277) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (278) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (279) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (280) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (281) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (282) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (283) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (284) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (285) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (286) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (287) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (288) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (289) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (290) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (291) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (292) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (293) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2551,108 +2557,108 @@ static YYACTIONTYPE yy_reduce( case 141: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==141); #line 63 "sql.y" {} -#line 2555 "sql.c" +#line 2561 "sql.c" break; case 1: /* cmd ::= SHOW DATABASES */ #line 66 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);} -#line 2560 "sql.c" +#line 2566 "sql.c" break; case 2: /* cmd ::= SHOW TOPICS */ #line 67 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TP, 0, 0);} -#line 2565 "sql.c" +#line 2571 "sql.c" break; case 3: /* cmd ::= SHOW FUNCTIONS */ #line 68 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_FUNCTION, 0, 0);} -#line 2570 "sql.c" +#line 2576 "sql.c" break; case 4: /* cmd ::= SHOW MNODES */ #line 69 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);} -#line 2575 "sql.c" +#line 2581 "sql.c" break; case 5: /* cmd ::= SHOW DNODES */ #line 70 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);} -#line 2580 "sql.c" +#line 2586 "sql.c" break; case 6: /* cmd ::= SHOW ACCOUNTS */ #line 71 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);} -#line 2585 "sql.c" +#line 2591 "sql.c" break; case 7: /* cmd ::= SHOW USERS */ #line 72 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_USER, 0, 0);} -#line 2590 "sql.c" +#line 2596 "sql.c" break; case 8: /* cmd ::= SHOW MODULES */ #line 74 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0); } -#line 2595 "sql.c" +#line 2601 "sql.c" break; case 9: /* cmd ::= SHOW QUERIES */ #line 75 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0); } -#line 2600 "sql.c" +#line 2606 "sql.c" break; case 10: /* cmd ::= SHOW CONNECTIONS */ #line 76 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);} -#line 2605 "sql.c" +#line 2611 "sql.c" break; case 11: /* cmd ::= SHOW STREAMS */ #line 77 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); } -#line 2610 "sql.c" +#line 2616 "sql.c" break; case 12: /* cmd ::= SHOW VARIABLES */ #line 78 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); } -#line 2615 "sql.c" +#line 2621 "sql.c" break; case 13: /* cmd ::= SHOW SCORES */ #line 79 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); } -#line 2620 "sql.c" +#line 2626 "sql.c" break; case 14: /* cmd ::= SHOW GRANTS */ #line 80 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); } -#line 2625 "sql.c" +#line 2631 "sql.c" break; case 15: /* cmd ::= SHOW VNODES */ #line 82 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); } -#line 2630 "sql.c" +#line 2636 "sql.c" break; case 16: /* cmd ::= SHOW VNODES ids */ #line 83 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &yymsp[0].minor.yy0, 0); } -#line 2635 "sql.c" +#line 2641 "sql.c" break; case 17: /* dbPrefix ::= */ #line 87 "sql.y" {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.type = 0;} -#line 2640 "sql.c" +#line 2646 "sql.c" break; case 18: /* dbPrefix ::= ids DOT */ #line 88 "sql.y" {yylhsminor.yy0 = yymsp[-1].minor.yy0; } -#line 2645 "sql.c" +#line 2651 "sql.c" yymsp[-1].minor.yy0 = yylhsminor.yy0; break; case 19: /* cpxName ::= */ #line 91 "sql.y" {yymsp[1].minor.yy0.n = 0; } -#line 2651 "sql.c" +#line 2657 "sql.c" break; case 20: /* cpxName ::= DOT ids */ #line 92 "sql.y" {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1; } -#line 2656 "sql.c" +#line 2662 "sql.c" break; case 21: /* cmd ::= SHOW CREATE TABLE ids cpxName */ #line 94 "sql.y" @@ -2660,7 +2666,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &yymsp[-1].minor.yy0); } -#line 2664 "sql.c" +#line 2670 "sql.c" break; case 22: /* cmd ::= SHOW CREATE STABLE ids cpxName */ #line 98 "sql.y" @@ -2668,35 +2674,35 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_STABLE, 1, &yymsp[-1].minor.yy0); } -#line 2672 "sql.c" +#line 2678 "sql.c" break; case 23: /* cmd ::= SHOW CREATE DATABASE ids */ #line 103 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &yymsp[0].minor.yy0); } -#line 2679 "sql.c" +#line 2685 "sql.c" break; case 24: /* cmd ::= SHOW dbPrefix TABLES */ #line 107 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-1].minor.yy0, 0); } -#line 2686 "sql.c" +#line 2692 "sql.c" break; case 25: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */ #line 111 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); } -#line 2693 "sql.c" +#line 2699 "sql.c" break; case 26: /* cmd ::= SHOW dbPrefix STABLES */ #line 115 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &yymsp[-1].minor.yy0, 0); } -#line 2700 "sql.c" +#line 2706 "sql.c" break; case 27: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */ #line 119 "sql.y" @@ -2705,7 +2711,7 @@ static YYACTIONTYPE yy_reduce( tSetDbName(&token, &yymsp[-3].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &yymsp[0].minor.yy0); } -#line 2709 "sql.c" +#line 2715 "sql.c" break; case 28: /* cmd ::= SHOW dbPrefix VGROUPS */ #line 125 "sql.y" @@ -2714,7 +2720,7 @@ static YYACTIONTYPE yy_reduce( tSetDbName(&token, &yymsp[-1].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } -#line 2718 "sql.c" +#line 2724 "sql.c" break; case 29: /* cmd ::= SHOW dbPrefix VGROUPS ids */ #line 131 "sql.y" @@ -2723,7 +2729,7 @@ static YYACTIONTYPE yy_reduce( tSetDbName(&token, &yymsp[-2].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &yymsp[0].minor.yy0); } -#line 2727 "sql.c" +#line 2733 "sql.c" break; case 30: /* cmd ::= DROP TABLE ifexists ids cpxName */ #line 138 "sql.y" @@ -2731,7 +2737,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1, -1); } -#line 2735 "sql.c" +#line 2741 "sql.c" break; case 31: /* cmd ::= DROP STABLE ifexists ids cpxName */ #line 144 "sql.y" @@ -2739,42 +2745,42 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1, TSDB_SUPER_TABLE); } -#line 2743 "sql.c" +#line 2749 "sql.c" break; case 32: /* cmd ::= DROP DATABASE ifexists ids */ #line 149 "sql.y" { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, TSDB_DB_TYPE_DEFAULT, -1); } -#line 2748 "sql.c" +#line 2754 "sql.c" break; case 33: /* cmd ::= DROP TOPIC ifexists ids */ #line 150 "sql.y" { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, TSDB_DB_TYPE_TOPIC, -1); } -#line 2753 "sql.c" +#line 2759 "sql.c" break; case 34: /* cmd ::= DROP FUNCTION ids */ #line 151 "sql.y" { setDropFuncInfo(pInfo, TSDB_SQL_DROP_FUNCTION, &yymsp[0].minor.yy0); } -#line 2758 "sql.c" +#line 2764 "sql.c" break; case 35: /* cmd ::= DROP DNODE ids */ #line 153 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0); } -#line 2763 "sql.c" +#line 2769 "sql.c" break; case 36: /* cmd ::= DROP USER ids */ #line 154 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0); } -#line 2768 "sql.c" +#line 2774 "sql.c" break; case 37: /* cmd ::= DROP ACCOUNT ids */ #line 155 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0); } -#line 2773 "sql.c" +#line 2779 "sql.c" break; case 38: /* cmd ::= USE ids */ #line 158 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);} -#line 2778 "sql.c" +#line 2784 "sql.c" break; case 39: /* cmd ::= DESCRIBE ids cpxName */ case 40: /* cmd ::= DESC ids cpxName */ yytestcase(yyruleno==40); @@ -2783,113 +2789,113 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSqlElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0); } -#line 2787 "sql.c" +#line 2793 "sql.c" break; case 41: /* cmd ::= ALTER USER ids PASS ids */ #line 170 "sql.y" { setAlterUserSql(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 2792 "sql.c" +#line 2798 "sql.c" break; case 42: /* cmd ::= ALTER USER ids PRIVILEGE ids */ #line 171 "sql.y" { setAlterUserSql(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);} -#line 2797 "sql.c" +#line 2803 "sql.c" break; case 43: /* cmd ::= ALTER DNODE ids ids */ #line 172 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 2802 "sql.c" +#line 2808 "sql.c" break; case 44: /* cmd ::= ALTER DNODE ids ids ids */ #line 173 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 2807 "sql.c" +#line 2813 "sql.c" break; case 45: /* cmd ::= ALTER LOCAL ids */ #line 174 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0); } -#line 2812 "sql.c" +#line 2818 "sql.c" break; case 46: /* cmd ::= ALTER LOCAL ids ids */ #line 175 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 2817 "sql.c" +#line 2823 "sql.c" break; case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 48: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==48); #line 176 "sql.y" -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy246, &t);} -#line 2823 "sql.c" +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy90, &t);} +#line 2829 "sql.c" break; case 49: /* cmd ::= ALTER ACCOUNT ids acct_optr */ #line 179 "sql.y" -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy377);} -#line 2828 "sql.c" +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy171);} +#line 2834 "sql.c" break; case 50: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ #line 180 "sql.y" -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy377);} -#line 2833 "sql.c" +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);} +#line 2839 "sql.c" break; case 51: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ #line 184 "sql.y" -{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy403);} -#line 2838 "sql.c" +{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy421);} +#line 2844 "sql.c" break; case 52: /* ids ::= ID */ case 53: /* ids ::= STRING */ yytestcase(yyruleno==53); #line 190 "sql.y" {yylhsminor.yy0 = yymsp[0].minor.yy0; } -#line 2844 "sql.c" +#line 2850 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 54: /* ifexists ::= IF EXISTS */ #line 194 "sql.y" { yymsp[-1].minor.yy0.n = 1;} -#line 2850 "sql.c" +#line 2856 "sql.c" break; case 55: /* ifexists ::= */ case 57: /* ifnotexists ::= */ yytestcase(yyruleno==57); case 181: /* distinct ::= */ yytestcase(yyruleno==181); #line 195 "sql.y" { yymsp[1].minor.yy0.n = 0;} -#line 2857 "sql.c" +#line 2863 "sql.c" break; case 56: /* ifnotexists ::= IF NOT EXISTS */ #line 198 "sql.y" { yymsp[-2].minor.yy0.n = 1;} -#line 2862 "sql.c" +#line 2868 "sql.c" break; case 58: /* cmd ::= CREATE DNODE ids */ #line 203 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} -#line 2867 "sql.c" +#line 2873 "sql.c" break; case 59: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ #line 205 "sql.y" -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy377);} -#line 2872 "sql.c" +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);} +#line 2878 "sql.c" break; case 60: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 61: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==61); #line 206 "sql.y" -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy246, &yymsp[-2].minor.yy0);} -#line 2878 "sql.c" +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy90, &yymsp[-2].minor.yy0);} +#line 2884 "sql.c" break; case 62: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ #line 208 "sql.y" -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy363, &yymsp[0].minor.yy0, 1);} -#line 2883 "sql.c" +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy183, &yymsp[0].minor.yy0, 1);} +#line 2889 "sql.c" break; case 63: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ #line 209 "sql.y" -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy363, &yymsp[0].minor.yy0, 2);} -#line 2888 "sql.c" +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy183, &yymsp[0].minor.yy0, 2);} +#line 2894 "sql.c" break; case 64: /* cmd ::= CREATE USER ids PASS ids */ #line 210 "sql.y" { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} -#line 2893 "sql.c" +#line 2899 "sql.c" break; case 65: /* bufsize ::= */ case 67: /* pps ::= */ yytestcase(yyruleno==67); @@ -2903,7 +2909,7 @@ static YYACTIONTYPE yy_reduce( case 83: /* state ::= */ yytestcase(yyruleno==83); #line 212 "sql.y" { yymsp[1].minor.yy0.n = 0; } -#line 2907 "sql.c" +#line 2913 "sql.c" break; case 66: /* bufsize ::= BUFSIZE INTEGER */ case 68: /* pps ::= PPS INTEGER */ yytestcase(yyruleno==68); @@ -2917,37 +2923,37 @@ static YYACTIONTYPE yy_reduce( case 84: /* state ::= STATE ids */ yytestcase(yyruleno==84); #line 213 "sql.y" { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } -#line 2921 "sql.c" +#line 2927 "sql.c" break; case 85: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ #line 243 "sql.y" { - 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; } -#line 2936 "sql.c" - yymsp[-8].minor.yy377 = yylhsminor.yy377; +#line 2942 "sql.c" + yymsp[-8].minor.yy171 = yylhsminor.yy171; break; case 86: /* intitemlist ::= intitemlist COMMA intitem */ case 155: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==155); #line 259 "sql.y" -{ yylhsminor.yy403 = tVariantListAppend(yymsp[-2].minor.yy403, &yymsp[0].minor.yy488, -1); } -#line 2943 "sql.c" - yymsp[-2].minor.yy403 = yylhsminor.yy403; +{ yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); } +#line 2949 "sql.c" + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 87: /* intitemlist ::= intitem */ case 156: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==156); #line 260 "sql.y" -{ yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); } -#line 2950 "sql.c" - yymsp[0].minor.yy403 = yylhsminor.yy403; +{ yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); } +#line 2956 "sql.c" + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 88: /* intitem ::= INTEGER */ case 157: /* tagitem ::= INTEGER */ yytestcase(yyruleno==157); @@ -2955,14 +2961,14 @@ static YYACTIONTYPE yy_reduce( case 159: /* tagitem ::= STRING */ yytestcase(yyruleno==159); case 160: /* tagitem ::= BOOL */ yytestcase(yyruleno==160); #line 262 "sql.y" -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); } -#line 2960 "sql.c" - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); } +#line 2966 "sql.c" + yymsp[0].minor.yy430 = yylhsminor.yy430; break; case 89: /* keep ::= KEEP intitemlist */ #line 266 "sql.y" -{ yymsp[-1].minor.yy403 = yymsp[0].minor.yy403; } -#line 2966 "sql.c" +{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; } +#line 2972 "sql.c" break; case 90: /* cache ::= CACHE INTEGER */ case 91: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==91); @@ -2981,182 +2987,182 @@ static YYACTIONTYPE yy_reduce( case 104: /* partitions ::= PARTITIONS INTEGER */ yytestcase(yyruleno==104); #line 268 "sql.y" { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } -#line 2985 "sql.c" +#line 2991 "sql.c" break; case 105: /* db_optr ::= */ #line 285 "sql.y" -{setDefaultCreateDbOption(&yymsp[1].minor.yy246); yymsp[1].minor.yy246.dbType = TSDB_DB_TYPE_DEFAULT;} -#line 2990 "sql.c" +{setDefaultCreateDbOption(&yymsp[1].minor.yy90); yymsp[1].minor.yy90.dbType = TSDB_DB_TYPE_DEFAULT;} +#line 2996 "sql.c" break; case 106: /* db_optr ::= db_optr cache */ #line 287 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 2995 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3001 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 107: /* db_optr ::= db_optr replica */ case 124: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==124); #line 288 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3002 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3008 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 108: /* db_optr ::= db_optr quorum */ case 125: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==125); #line 289 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3009 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3015 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 109: /* db_optr ::= db_optr days */ #line 290 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3015 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3021 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 110: /* db_optr ::= db_optr minrows */ #line 291 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } -#line 3021 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } +#line 3027 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 111: /* db_optr ::= db_optr maxrows */ #line 292 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } -#line 3027 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } +#line 3033 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 112: /* db_optr ::= db_optr blocks */ case 127: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==127); #line 293 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3034 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3040 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 113: /* db_optr ::= db_optr ctime */ #line 294 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3040 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3046 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 114: /* db_optr ::= db_optr wal */ #line 295 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3046 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3052 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 115: /* db_optr ::= db_optr fsync */ #line 296 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3052 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3058 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 116: /* db_optr ::= db_optr comp */ case 128: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==128); #line 297 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3059 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3065 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 117: /* db_optr ::= db_optr prec */ #line 298 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.precision = yymsp[0].minor.yy0; } -#line 3065 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.precision = yymsp[0].minor.yy0; } +#line 3071 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 118: /* db_optr ::= db_optr keep */ case 126: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==126); #line 299 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.keep = yymsp[0].minor.yy403; } -#line 3072 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.keep = yymsp[0].minor.yy421; } +#line 3078 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 119: /* db_optr ::= db_optr update */ case 129: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==129); #line 300 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3079 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3085 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 120: /* db_optr ::= db_optr cachelast */ case 130: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==130); #line 301 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3086 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3092 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 121: /* topic_optr ::= db_optr */ case 131: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==131); #line 305 "sql.y" -{ yylhsminor.yy246 = yymsp[0].minor.yy246; yylhsminor.yy246.dbType = TSDB_DB_TYPE_TOPIC; } -#line 3093 "sql.c" - yymsp[0].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[0].minor.yy90; yylhsminor.yy90.dbType = TSDB_DB_TYPE_TOPIC; } +#line 3099 "sql.c" + yymsp[0].minor.yy90 = yylhsminor.yy90; break; case 122: /* topic_optr ::= topic_optr partitions */ case 132: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==132); #line 306 "sql.y" -{ yylhsminor.yy246 = yymsp[-1].minor.yy246; yylhsminor.yy246.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3100 "sql.c" - yymsp[-1].minor.yy246 = yylhsminor.yy246; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3106 "sql.c" + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 123: /* alter_db_optr ::= */ #line 309 "sql.y" -{ setDefaultCreateDbOption(&yymsp[1].minor.yy246); yymsp[1].minor.yy246.dbType = TSDB_DB_TYPE_DEFAULT;} -#line 3106 "sql.c" +{ setDefaultCreateDbOption(&yymsp[1].minor.yy90); yymsp[1].minor.yy90.dbType = TSDB_DB_TYPE_DEFAULT;} +#line 3112 "sql.c" break; case 133: /* typename ::= ids */ #line 329 "sql.y" { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy363, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy183, &yymsp[0].minor.yy0); } -#line 3114 "sql.c" - yymsp[0].minor.yy363 = yylhsminor.yy363; +#line 3120 "sql.c" + yymsp[0].minor.yy183 = yylhsminor.yy183; break; case 134: /* typename ::= ids LP signed RP */ #line 335 "sql.y" { - 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); } } -#line 3128 "sql.c" - yymsp[-3].minor.yy363 = yylhsminor.yy363; +#line 3134 "sql.c" + yymsp[-3].minor.yy183 = yylhsminor.yy183; break; case 135: /* typename ::= ids UNSIGNED */ #line 346 "sql.y" { 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); } -#line 3138 "sql.c" - yymsp[-1].minor.yy363 = yylhsminor.yy363; +#line 3144 "sql.c" + yymsp[-1].minor.yy183 = yylhsminor.yy183; break; case 136: /* signed ::= INTEGER */ #line 353 "sql.y" -{ yylhsminor.yy387 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3144 "sql.c" - yymsp[0].minor.yy387 = yylhsminor.yy387; +{ yylhsminor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3150 "sql.c" + yymsp[0].minor.yy325 = yylhsminor.yy325; break; case 137: /* signed ::= PLUS INTEGER */ #line 354 "sql.y" -{ yymsp[-1].minor.yy387 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3150 "sql.c" +{ yymsp[-1].minor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +#line 3156 "sql.c" break; case 138: /* signed ::= MINUS INTEGER */ #line 355 "sql.y" -{ yymsp[-1].minor.yy387 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} -#line 3155 "sql.c" +{ yymsp[-1].minor.yy325 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +#line 3161 "sql.c" break; case 142: /* cmd ::= CREATE TABLE create_table_list */ #line 361 "sql.y" -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy56;} -#line 3160 "sql.c" +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy438;} +#line 3166 "sql.c" break; case 143: /* create_table_list ::= create_from_stable */ #line 365 "sql.y" @@ -3164,121 +3170,121 @@ static YYACTIONTYPE yy_reduce( 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; } -#line 3172 "sql.c" - yymsp[0].minor.yy56 = yylhsminor.yy56; +#line 3178 "sql.c" + yymsp[0].minor.yy438 = yylhsminor.yy438; break; case 144: /* create_table_list ::= create_table_list create_from_stable */ #line 374 "sql.y" { - 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; } -#line 3181 "sql.c" - yymsp[-1].minor.yy56 = yylhsminor.yy56; +#line 3187 "sql.c" + yymsp[-1].minor.yy438 = yylhsminor.yy438; break; case 145: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ #line 380 "sql.y" { - 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); } -#line 3193 "sql.c" - yymsp[-5].minor.yy56 = yylhsminor.yy56; +#line 3199 "sql.c" + yymsp[-5].minor.yy438 = yylhsminor.yy438; break; case 146: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ #line 390 "sql.y" { - 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); } -#line 3205 "sql.c" - yymsp[-9].minor.yy56 = yylhsminor.yy56; +#line 3211 "sql.c" + yymsp[-9].minor.yy438 = yylhsminor.yy438; break; case 147: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ #line 401 "sql.y" { 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); } -#line 3215 "sql.c" - yymsp[-9].minor.yy84 = yylhsminor.yy84; +#line 3221 "sql.c" + yymsp[-9].minor.yy152 = yylhsminor.yy152; break; case 148: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ #line 407 "sql.y" { 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); } -#line 3225 "sql.c" - yymsp[-12].minor.yy84 = yylhsminor.yy84; +#line 3231 "sql.c" + yymsp[-12].minor.yy152 = yylhsminor.yy152; break; case 149: /* tagNamelist ::= tagNamelist COMMA ids */ #line 415 "sql.y" -{taosArrayPush(yymsp[-2].minor.yy403, &yymsp[0].minor.yy0); yylhsminor.yy403 = yymsp[-2].minor.yy403; } -#line 3231 "sql.c" - yymsp[-2].minor.yy403 = yylhsminor.yy403; +{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); yylhsminor.yy421 = yymsp[-2].minor.yy421; } +#line 3237 "sql.c" + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 150: /* tagNamelist ::= ids */ #line 416 "sql.y" -{yylhsminor.yy403 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy403, &yymsp[0].minor.yy0);} -#line 3237 "sql.c" - yymsp[0].minor.yy403 = yylhsminor.yy403; +{yylhsminor.yy421 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy0);} +#line 3243 "sql.c" + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 151: /* create_table_args ::= ifnotexists ids cpxName AS select */ #line 420 "sql.y" { - 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); } -#line 3249 "sql.c" - yymsp[-4].minor.yy56 = yylhsminor.yy56; +#line 3255 "sql.c" + yymsp[-4].minor.yy438 = yylhsminor.yy438; break; case 152: /* columnlist ::= columnlist COMMA column */ #line 431 "sql.y" -{taosArrayPush(yymsp[-2].minor.yy403, &yymsp[0].minor.yy363); yylhsminor.yy403 = yymsp[-2].minor.yy403; } -#line 3255 "sql.c" - yymsp[-2].minor.yy403 = yylhsminor.yy403; +{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy183); yylhsminor.yy421 = yymsp[-2].minor.yy421; } +#line 3261 "sql.c" + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 153: /* columnlist ::= column */ #line 432 "sql.y" -{yylhsminor.yy403 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy403, &yymsp[0].minor.yy363);} -#line 3261 "sql.c" - yymsp[0].minor.yy403 = yylhsminor.yy403; +{yylhsminor.yy421 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy183);} +#line 3267 "sql.c" + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 154: /* column ::= ids typename */ #line 436 "sql.y" { - tSetColumnInfo(&yylhsminor.yy363, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy363); + tSetColumnInfo(&yylhsminor.yy183, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183); } -#line 3269 "sql.c" - yymsp[-1].minor.yy363 = yylhsminor.yy363; +#line 3275 "sql.c" + yymsp[-1].minor.yy183 = yylhsminor.yy183; break; case 161: /* tagitem ::= NULL */ #line 451 "sql.y" -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); } -#line 3275 "sql.c" - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); } +#line 3281 "sql.c" + yymsp[0].minor.yy430 = yylhsminor.yy430; break; case 162: /* tagitem ::= NOW */ #line 452 "sql.y" -{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0);} -#line 3281 "sql.c" - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0);} +#line 3287 "sql.c" + yymsp[0].minor.yy430 = yylhsminor.yy430; break; case 163: /* tagitem ::= MINUS INTEGER */ case 164: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==164); @@ -3289,219 +3295,219 @@ 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); } -#line 3295 "sql.c" - yymsp[-1].minor.yy488 = yylhsminor.yy488; +#line 3301 "sql.c" + yymsp[-1].minor.yy430 = yylhsminor.yy430; break; case 167: /* 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 */ #line 485 "sql.y" { - 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); } -#line 3303 "sql.c" - yymsp[-13].minor.yy224 = yylhsminor.yy224; +#line 3309 "sql.c" + yymsp[-13].minor.yy56 = yylhsminor.yy56; break; case 168: /* select ::= LP select RP */ #line 489 "sql.y" -{yymsp[-2].minor.yy224 = yymsp[-1].minor.yy224;} -#line 3309 "sql.c" +{yymsp[-2].minor.yy56 = yymsp[-1].minor.yy56;} +#line 3315 "sql.c" break; case 169: /* union ::= select */ #line 493 "sql.y" -{ yylhsminor.yy403 = setSubclause(NULL, yymsp[0].minor.yy224); } -#line 3314 "sql.c" - yymsp[0].minor.yy403 = yylhsminor.yy403; +{ yylhsminor.yy421 = setSubclause(NULL, yymsp[0].minor.yy56); } +#line 3320 "sql.c" + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 170: /* union ::= union UNION ALL select */ #line 494 "sql.y" -{ yylhsminor.yy403 = appendSelectClause(yymsp[-3].minor.yy403, yymsp[0].minor.yy224); } -#line 3320 "sql.c" - yymsp[-3].minor.yy403 = yylhsminor.yy403; +{ yylhsminor.yy421 = appendSelectClause(yymsp[-3].minor.yy421, yymsp[0].minor.yy56); } +#line 3326 "sql.c" + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; case 171: /* cmd ::= union */ #line 496 "sql.y" -{ setSqlInfo(pInfo, yymsp[0].minor.yy403, NULL, TSDB_SQL_SELECT); } -#line 3326 "sql.c" +{ setSqlInfo(pInfo, yymsp[0].minor.yy421, NULL, TSDB_SQL_SELECT); } +#line 3332 "sql.c" break; case 172: /* select ::= SELECT selcollist */ #line 503 "sql.y" { - 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); } -#line 3333 "sql.c" - yymsp[-1].minor.yy224 = yylhsminor.yy224; +#line 3339 "sql.c" + yymsp[-1].minor.yy56 = yylhsminor.yy56; break; case 173: /* sclp ::= selcollist COMMA */ #line 515 "sql.y" -{yylhsminor.yy403 = yymsp[-1].minor.yy403;} -#line 3339 "sql.c" - yymsp[-1].minor.yy403 = yylhsminor.yy403; +{yylhsminor.yy421 = yymsp[-1].minor.yy421;} +#line 3345 "sql.c" + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; case 174: /* sclp ::= */ case 206: /* orderby_opt ::= */ yytestcase(yyruleno==206); #line 516 "sql.y" -{yymsp[1].minor.yy403 = 0;} -#line 3346 "sql.c" +{yymsp[1].minor.yy421 = 0;} +#line 3352 "sql.c" break; case 175: /* selcollist ::= sclp distinct expr as */ #line 517 "sql.y" { - 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); } -#line 3353 "sql.c" - yymsp[-3].minor.yy403 = yylhsminor.yy403; +#line 3359 "sql.c" + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; case 176: /* selcollist ::= sclp STAR */ #line 521 "sql.y" { 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); } -#line 3362 "sql.c" - yymsp[-1].minor.yy403 = yylhsminor.yy403; +#line 3368 "sql.c" + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; case 177: /* as ::= AS ids */ #line 529 "sql.y" { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } -#line 3368 "sql.c" +#line 3374 "sql.c" break; case 178: /* as ::= ids */ #line 530 "sql.y" { yylhsminor.yy0 = yymsp[0].minor.yy0; } -#line 3373 "sql.c" +#line 3379 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 179: /* as ::= */ #line 531 "sql.y" { yymsp[1].minor.yy0.n = 0; } -#line 3379 "sql.c" +#line 3385 "sql.c" break; case 180: /* distinct ::= DISTINCT */ #line 534 "sql.y" { yylhsminor.yy0 = yymsp[0].minor.yy0; } -#line 3384 "sql.c" +#line 3390 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 182: /* from ::= FROM tablelist */ case 183: /* from ::= FROM sub */ yytestcase(yyruleno==183); #line 540 "sql.y" -{yymsp[-1].minor.yy114 = yymsp[0].minor.yy114;} -#line 3391 "sql.c" +{yymsp[-1].minor.yy8 = yymsp[0].minor.yy8;} +#line 3397 "sql.c" break; case 184: /* sub ::= LP union RP */ #line 545 "sql.y" -{yymsp[-2].minor.yy114 = addSubqueryElem(NULL, yymsp[-1].minor.yy403, NULL);} -#line 3396 "sql.c" +{yymsp[-2].minor.yy8 = addSubqueryElem(NULL, yymsp[-1].minor.yy421, NULL);} +#line 3402 "sql.c" break; case 185: /* sub ::= LP union RP ids */ #line 546 "sql.y" -{yymsp[-3].minor.yy114 = addSubqueryElem(NULL, yymsp[-2].minor.yy403, &yymsp[0].minor.yy0);} -#line 3401 "sql.c" +{yymsp[-3].minor.yy8 = addSubqueryElem(NULL, yymsp[-2].minor.yy421, &yymsp[0].minor.yy0);} +#line 3407 "sql.c" break; case 186: /* sub ::= sub COMMA LP union RP ids */ #line 547 "sql.y" -{yylhsminor.yy114 = addSubqueryElem(yymsp[-5].minor.yy114, yymsp[-2].minor.yy403, &yymsp[0].minor.yy0);} -#line 3406 "sql.c" - yymsp[-5].minor.yy114 = yylhsminor.yy114; +{yylhsminor.yy8 = addSubqueryElem(yymsp[-5].minor.yy8, yymsp[-2].minor.yy421, &yymsp[0].minor.yy0);} +#line 3412 "sql.c" + yymsp[-5].minor.yy8 = yylhsminor.yy8; break; case 187: /* tablelist ::= ids cpxName */ #line 551 "sql.y" { 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); } -#line 3415 "sql.c" - yymsp[-1].minor.yy114 = yylhsminor.yy114; +#line 3421 "sql.c" + yymsp[-1].minor.yy8 = yylhsminor.yy8; break; case 188: /* tablelist ::= ids cpxName ids */ #line 556 "sql.y" { 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); } -#line 3424 "sql.c" - yymsp[-2].minor.yy114 = yylhsminor.yy114; +#line 3430 "sql.c" + yymsp[-2].minor.yy8 = yylhsminor.yy8; break; case 189: /* tablelist ::= tablelist COMMA ids cpxName */ #line 561 "sql.y" { 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); } -#line 3433 "sql.c" - yymsp[-3].minor.yy114 = yylhsminor.yy114; +#line 3439 "sql.c" + yymsp[-3].minor.yy8 = yylhsminor.yy8; break; case 190: /* tablelist ::= tablelist COMMA ids cpxName ids */ #line 566 "sql.y" { 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); } -#line 3442 "sql.c" - yymsp[-4].minor.yy114 = yylhsminor.yy114; +#line 3448 "sql.c" + yymsp[-4].minor.yy8 = yylhsminor.yy8; break; case 191: /* tmvar ::= VARIABLE */ #line 573 "sql.y" {yylhsminor.yy0 = yymsp[0].minor.yy0;} -#line 3448 "sql.c" +#line 3454 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 192: /* interval_option ::= intervalKey LP tmvar RP */ #line 576 "sql.y" -{yylhsminor.yy222.interval = yymsp[-1].minor.yy0; yylhsminor.yy222.offset.n = 0; yylhsminor.yy222.token = yymsp[-3].minor.yy202;} -#line 3454 "sql.c" - 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;} +#line 3460 "sql.c" + yymsp[-3].minor.yy400 = yylhsminor.yy400; break; case 193: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ #line 577 "sql.y" -{yylhsminor.yy222.interval = yymsp[-3].minor.yy0; yylhsminor.yy222.offset = yymsp[-1].minor.yy0; yylhsminor.yy222.token = yymsp[-5].minor.yy202;} -#line 3460 "sql.c" - 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;} +#line 3466 "sql.c" + yymsp[-5].minor.yy400 = yylhsminor.yy400; break; case 194: /* interval_option ::= */ #line 578 "sql.y" -{memset(&yymsp[1].minor.yy222, 0, sizeof(yymsp[1].minor.yy222));} -#line 3466 "sql.c" +{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));} +#line 3472 "sql.c" break; case 195: /* intervalKey ::= INTERVAL */ #line 581 "sql.y" -{yymsp[0].minor.yy202 = TK_INTERVAL;} -#line 3471 "sql.c" +{yymsp[0].minor.yy104 = TK_INTERVAL;} +#line 3477 "sql.c" break; case 196: /* intervalKey ::= EVERY */ #line 582 "sql.y" -{yymsp[0].minor.yy202 = TK_EVERY; } -#line 3476 "sql.c" +{yymsp[0].minor.yy104 = TK_EVERY; } +#line 3482 "sql.c" break; case 197: /* session_option ::= */ #line 585 "sql.y" -{yymsp[1].minor.yy365.col.n = 0; yymsp[1].minor.yy365.gap.n = 0;} -#line 3481 "sql.c" +{yymsp[1].minor.yy147.col.n = 0; yymsp[1].minor.yy147.gap.n = 0;} +#line 3487 "sql.c" break; case 198: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ #line 586 "sql.y" { 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; } -#line 3490 "sql.c" +#line 3496 "sql.c" break; case 199: /* windowstate_option ::= */ #line 593 "sql.y" -{ yymsp[1].minor.yy544.col.n = 0; yymsp[1].minor.yy544.col.z = NULL;} -#line 3495 "sql.c" +{ yymsp[1].minor.yy40.col.n = 0; yymsp[1].minor.yy40.col.z = NULL;} +#line 3501 "sql.c" break; case 200: /* windowstate_option ::= STATE_WINDOW LP ids RP */ #line 594 "sql.y" -{ yymsp[-3].minor.yy544.col = yymsp[-1].minor.yy0; } -#line 3500 "sql.c" +{ yymsp[-3].minor.yy40.col = yymsp[-1].minor.yy0; } +#line 3506 "sql.c" break; case 201: /* fill_opt ::= */ #line 598 "sql.y" -{ yymsp[1].minor.yy403 = 0; } -#line 3505 "sql.c" +{ yymsp[1].minor.yy421 = 0; } +#line 3511 "sql.c" break; case 202: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ #line 599 "sql.y" @@ -3510,49 +3516,49 @@ 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; } -#line 3517 "sql.c" +#line 3523 "sql.c" break; case 203: /* fill_opt ::= FILL LP ID RP */ #line 608 "sql.y" { 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); } -#line 3525 "sql.c" +#line 3531 "sql.c" break; case 204: /* sliding_opt ::= SLIDING LP tmvar RP */ #line 614 "sql.y" {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } -#line 3530 "sql.c" +#line 3536 "sql.c" break; case 205: /* sliding_opt ::= */ #line 615 "sql.y" {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } -#line 3535 "sql.c" +#line 3541 "sql.c" break; case 207: /* orderby_opt ::= ORDER BY sortlist */ #line 627 "sql.y" -{yymsp[-2].minor.yy403 = yymsp[0].minor.yy403;} -#line 3540 "sql.c" +{yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} +#line 3546 "sql.c" break; case 208: /* sortlist ::= sortlist COMMA item sortorder */ #line 629 "sql.y" { - 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); } -#line 3547 "sql.c" - yymsp[-3].minor.yy403 = yylhsminor.yy403; +#line 3553 "sql.c" + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; case 209: /* sortlist ::= item sortorder */ #line 633 "sql.y" { - yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[-1].minor.yy488, yymsp[0].minor.yy70); + yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96); } -#line 3555 "sql.c" - yymsp[-1].minor.yy403 = yylhsminor.yy403; +#line 3561 "sql.c" + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; case 210: /* item ::= ids cpxName */ #line 638 "sql.y" @@ -3560,349 +3566,355 @@ static YYACTIONTYPE yy_reduce( 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); } -#line 3566 "sql.c" - yymsp[-1].minor.yy488 = yylhsminor.yy488; +#line 3572 "sql.c" + yymsp[-1].minor.yy430 = yylhsminor.yy430; break; case 211: /* sortorder ::= ASC */ #line 646 "sql.y" -{ yymsp[0].minor.yy70 = TSDB_ORDER_ASC; } -#line 3572 "sql.c" +{ yymsp[0].minor.yy96 = TSDB_ORDER_ASC; } +#line 3578 "sql.c" break; case 212: /* sortorder ::= DESC */ #line 647 "sql.y" -{ yymsp[0].minor.yy70 = TSDB_ORDER_DESC;} -#line 3577 "sql.c" +{ yymsp[0].minor.yy96 = TSDB_ORDER_DESC;} +#line 3583 "sql.c" break; case 213: /* sortorder ::= */ #line 648 "sql.y" -{ yymsp[1].minor.yy70 = TSDB_ORDER_ASC; } -#line 3582 "sql.c" +{ yymsp[1].minor.yy96 = TSDB_ORDER_ASC; } +#line 3588 "sql.c" break; case 214: /* groupby_opt ::= */ #line 656 "sql.y" -{ yymsp[1].minor.yy403 = 0;} -#line 3587 "sql.c" +{ yymsp[1].minor.yy421 = 0;} +#line 3593 "sql.c" break; case 215: /* groupby_opt ::= GROUP BY grouplist */ #line 657 "sql.y" -{ yymsp[-2].minor.yy403 = yymsp[0].minor.yy403;} -#line 3592 "sql.c" +{ yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} +#line 3598 "sql.c" break; case 216: /* grouplist ::= grouplist COMMA item */ #line 659 "sql.y" { - yylhsminor.yy403 = tVariantListAppend(yymsp[-2].minor.yy403, &yymsp[0].minor.yy488, -1); + yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); } -#line 3599 "sql.c" - yymsp[-2].minor.yy403 = yylhsminor.yy403; +#line 3605 "sql.c" + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 217: /* grouplist ::= item */ #line 663 "sql.y" { - yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); + yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); } -#line 3607 "sql.c" - yymsp[0].minor.yy403 = yylhsminor.yy403; +#line 3613 "sql.c" + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 218: /* having_opt ::= */ case 228: /* where_opt ::= */ yytestcase(yyruleno==228); - case 271: /* expritem ::= */ yytestcase(yyruleno==271); + case 272: /* expritem ::= */ yytestcase(yyruleno==272); #line 670 "sql.y" -{yymsp[1].minor.yy260 = 0;} -#line 3615 "sql.c" +{yymsp[1].minor.yy439 = 0;} +#line 3621 "sql.c" break; case 219: /* having_opt ::= HAVING expr */ case 229: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==229); #line 671 "sql.y" -{yymsp[-1].minor.yy260 = yymsp[0].minor.yy260;} -#line 3621 "sql.c" +{yymsp[-1].minor.yy439 = yymsp[0].minor.yy439;} +#line 3627 "sql.c" break; case 220: /* limit_opt ::= */ case 224: /* slimit_opt ::= */ yytestcase(yyruleno==224); #line 675 "sql.y" -{yymsp[1].minor.yy404.limit = -1; yymsp[1].minor.yy404.offset = 0;} -#line 3627 "sql.c" +{yymsp[1].minor.yy166.limit = -1; yymsp[1].minor.yy166.offset = 0;} +#line 3633 "sql.c" break; case 221: /* limit_opt ::= LIMIT signed */ case 225: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==225); #line 676 "sql.y" -{yymsp[-1].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-1].minor.yy404.offset = 0;} -#line 3633 "sql.c" +{yymsp[-1].minor.yy166.limit = yymsp[0].minor.yy325; yymsp[-1].minor.yy166.offset = 0;} +#line 3639 "sql.c" break; case 222: /* limit_opt ::= LIMIT signed OFFSET signed */ #line 678 "sql.y" -{ yymsp[-3].minor.yy404.limit = yymsp[-2].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[0].minor.yy387;} -#line 3638 "sql.c" +{ yymsp[-3].minor.yy166.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[0].minor.yy325;} +#line 3644 "sql.c" break; case 223: /* limit_opt ::= LIMIT signed COMMA signed */ #line 680 "sql.y" -{ yymsp[-3].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[-2].minor.yy387;} -#line 3643 "sql.c" +{ yymsp[-3].minor.yy166.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[-2].minor.yy325;} +#line 3649 "sql.c" break; case 226: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ #line 686 "sql.y" -{yymsp[-3].minor.yy404.limit = yymsp[-2].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[0].minor.yy387;} -#line 3648 "sql.c" +{yymsp[-3].minor.yy166.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[0].minor.yy325;} +#line 3654 "sql.c" break; case 227: /* slimit_opt ::= SLIMIT signed COMMA signed */ #line 688 "sql.y" -{yymsp[-3].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[-2].minor.yy387;} -#line 3653 "sql.c" +{yymsp[-3].minor.yy166.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy166.offset = yymsp[-2].minor.yy325;} +#line 3659 "sql.c" break; case 230: /* expr ::= LP expr RP */ #line 701 "sql.y" -{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);} -#line 3658 "sql.c" - 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);} +#line 3664 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 231: /* expr ::= ID */ #line 703 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} -#line 3664 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} +#line 3670 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 232: /* expr ::= ID DOT ID */ #line 704 "sql.y" -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} -#line 3670 "sql.c" - 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);} +#line 3676 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 233: /* expr ::= ID DOT STAR */ #line 705 "sql.y" -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} -#line 3676 "sql.c" - 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);} +#line 3682 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 234: /* expr ::= INTEGER */ #line 707 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} -#line 3682 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} +#line 3688 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 235: /* expr ::= MINUS INTEGER */ case 236: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==236); #line 708 "sql.y" -{ 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);} -#line 3689 "sql.c" - 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);} +#line 3695 "sql.c" + yymsp[-1].minor.yy439 = yylhsminor.yy439; break; case 237: /* expr ::= FLOAT */ #line 710 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} -#line 3695 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} +#line 3701 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 238: /* expr ::= MINUS FLOAT */ case 239: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==239); #line 711 "sql.y" -{ 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);} -#line 3702 "sql.c" - 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);} +#line 3708 "sql.c" + yymsp[-1].minor.yy439 = yylhsminor.yy439; break; case 240: /* expr ::= STRING */ #line 713 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} -#line 3708 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} +#line 3714 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 241: /* expr ::= NOW */ #line 714 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } -#line 3714 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } +#line 3720 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 242: /* expr ::= VARIABLE */ #line 715 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} -#line 3720 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} +#line 3726 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 243: /* expr ::= PLUS VARIABLE */ case 244: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==244); #line 716 "sql.y" -{ 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);} -#line 3727 "sql.c" - 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);} +#line 3733 "sql.c" + yymsp[-1].minor.yy439 = yylhsminor.yy439; break; case 245: /* expr ::= BOOL */ #line 718 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} -#line 3733 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} +#line 3739 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 246: /* expr ::= NULL */ #line 719 "sql.y" -{ yylhsminor.yy260 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} -#line 3739 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} +#line 3745 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; break; case 247: /* expr ::= ID LP exprlist RP */ #line 722 "sql.y" -{ 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); } -#line 3745 "sql.c" - 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); } +#line 3751 "sql.c" + yymsp[-3].minor.yy439 = yylhsminor.yy439; break; case 248: /* expr ::= ID LP STAR RP */ #line 725 "sql.y" -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy260 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } -#line 3751 "sql.c" - 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); } +#line 3757 "sql.c" + yymsp[-3].minor.yy439 = yylhsminor.yy439; break; case 249: /* expr ::= expr IS NULL */ #line 728 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, NULL, TK_ISNULL);} -#line 3757 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, NULL, TK_ISNULL);} +#line 3763 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 250: /* expr ::= expr IS NOT NULL */ #line 729 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-3].minor.yy260, NULL, TK_NOTNULL);} -#line 3763 "sql.c" - yymsp[-3].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-3].minor.yy439, NULL, TK_NOTNULL);} +#line 3769 "sql.c" + yymsp[-3].minor.yy439 = yylhsminor.yy439; break; case 251: /* expr ::= expr LT expr */ #line 732 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_LT);} -#line 3769 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LT);} +#line 3775 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 252: /* expr ::= expr GT expr */ #line 733 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_GT);} -#line 3775 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GT);} +#line 3781 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 253: /* expr ::= expr LE expr */ #line 734 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_LE);} -#line 3781 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LE);} +#line 3787 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 254: /* expr ::= expr GE expr */ #line 735 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_GE);} -#line 3787 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GE);} +#line 3793 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 255: /* expr ::= expr NE expr */ #line 736 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_NE);} -#line 3793 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NE);} +#line 3799 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 256: /* expr ::= expr EQ expr */ #line 737 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_EQ);} -#line 3799 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_EQ);} +#line 3805 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 257: /* expr ::= expr BETWEEN expr AND expr */ #line 739 "sql.y" -{ 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);} -#line 3805 "sql.c" - 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);} +#line 3811 "sql.c" + yymsp[-4].minor.yy439 = yylhsminor.yy439; break; case 258: /* expr ::= expr AND expr */ #line 741 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_AND);} -#line 3811 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_AND);} +#line 3817 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 259: /* expr ::= expr OR expr */ #line 742 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_OR); } -#line 3817 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_OR); } +#line 3823 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 260: /* expr ::= expr PLUS expr */ #line 745 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_PLUS); } -#line 3823 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_PLUS); } +#line 3829 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 261: /* expr ::= expr MINUS expr */ #line 746 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_MINUS); } -#line 3829 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MINUS); } +#line 3835 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 262: /* expr ::= expr STAR expr */ #line 747 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_STAR); } -#line 3835 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_STAR); } +#line 3841 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 263: /* expr ::= expr SLASH expr */ #line 748 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_DIVIDE);} -#line 3841 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_DIVIDE);} +#line 3847 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 264: /* expr ::= expr REM expr */ #line 749 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_REM); } -#line 3847 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_REM); } +#line 3853 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 265: /* expr ::= expr LIKE expr */ #line 752 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_LIKE); } -#line 3853 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LIKE); } +#line 3859 "sql.c" + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; case 266: /* expr ::= expr MATCH expr */ #line 755 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-2].minor.yy260, yymsp[0].minor.yy260, TK_MATCH); } -#line 3859 "sql.c" - yymsp[-2].minor.yy260 = yylhsminor.yy260; - break; - case 267: /* expr ::= expr IN LP exprlist RP */ -#line 758 "sql.y" -{yylhsminor.yy260 = tSqlExprCreate(yymsp[-4].minor.yy260, (tSqlExpr*)yymsp[-1].minor.yy403, TK_IN); } +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MATCH); } #line 3865 "sql.c" - yymsp[-4].minor.yy260 = yylhsminor.yy260; + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 268: /* exprlist ::= exprlist COMMA expritem */ -#line 766 "sql.y" -{yylhsminor.yy403 = tSqlExprListAppend(yymsp[-2].minor.yy403,yymsp[0].minor.yy260,0, 0);} + case 267: /* expr ::= expr NMATCH expr */ +#line 756 "sql.y" +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NMATCH); } #line 3871 "sql.c" - yymsp[-2].minor.yy403 = yylhsminor.yy403; + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 269: /* exprlist ::= expritem */ -#line 767 "sql.y" -{yylhsminor.yy403 = tSqlExprListAppend(0,yymsp[0].minor.yy260,0, 0);} + case 268: /* expr ::= expr IN LP exprlist RP */ +#line 759 "sql.y" +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-4].minor.yy439, (tSqlExpr*)yymsp[-1].minor.yy421, TK_IN); } #line 3877 "sql.c" - yymsp[0].minor.yy403 = yylhsminor.yy403; + yymsp[-4].minor.yy439 = yylhsminor.yy439; break; - case 270: /* expritem ::= expr */ -#line 768 "sql.y" -{yylhsminor.yy260 = yymsp[0].minor.yy260;} + case 269: /* exprlist ::= exprlist COMMA expritem */ +#line 767 "sql.y" +{yylhsminor.yy421 = tSqlExprListAppend(yymsp[-2].minor.yy421,yymsp[0].minor.yy439,0, 0);} #line 3883 "sql.c" - yymsp[0].minor.yy260 = yylhsminor.yy260; + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 272: /* cmd ::= RESET QUERY CACHE */ -#line 772 "sql.y" -{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} + case 270: /* exprlist ::= expritem */ +#line 768 "sql.y" +{yylhsminor.yy421 = tSqlExprListAppend(0,yymsp[0].minor.yy439,0, 0);} #line 3889 "sql.c" + yymsp[0].minor.yy421 = yylhsminor.yy421; + break; + case 271: /* expritem ::= expr */ +#line 769 "sql.y" +{yylhsminor.yy439 = yymsp[0].minor.yy439;} +#line 3895 "sql.c" + yymsp[0].minor.yy439 = yylhsminor.yy439; + break; + case 273: /* cmd ::= RESET QUERY CACHE */ +#line 773 "sql.y" +{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} +#line 3901 "sql.c" break; - case 273: /* cmd ::= SYNCDB ids REPLICA */ -#line 775 "sql.y" + case 274: /* cmd ::= SYNCDB ids REPLICA */ +#line 776 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} -#line 3894 "sql.c" +#line 3906 "sql.c" break; - case 274: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ -#line 778 "sql.y" + case 275: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ +#line 779 "sql.y" { 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); } -#line 3903 "sql.c" +#line 3915 "sql.c" break; - case 275: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ -#line 784 "sql.y" + case 276: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ +#line 785 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3912,28 +3924,28 @@ static YYACTIONTYPE yy_reduce( SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 3916 "sql.c" +#line 3928 "sql.c" break; - case 276: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ -#line 794 "sql.y" + case 277: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ +#line 795 "sql.y" { 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); } -#line 3925 "sql.c" +#line 3937 "sql.c" break; - case 277: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ -#line 801 "sql.y" + case 278: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ +#line 802 "sql.y" { 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); } -#line 3934 "sql.c" +#line 3946 "sql.c" break; - case 278: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ -#line 806 "sql.y" + case 279: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ +#line 807 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3943,10 +3955,10 @@ static YYACTIONTYPE yy_reduce( SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 3947 "sql.c" +#line 3959 "sql.c" break; - case 279: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ -#line 816 "sql.y" + case 280: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ +#line 817 "sql.y" { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3959,42 +3971,42 @@ static YYACTIONTYPE yy_reduce( SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 3963 "sql.c" +#line 3975 "sql.c" break; - case 280: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ -#line 829 "sql.y" + case 281: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ +#line 830 "sql.y" { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; 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); } -#line 3977 "sql.c" +#line 3989 "sql.c" break; - case 281: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ -#line 840 "sql.y" + case 282: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ +#line 841 "sql.y" { 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); } -#line 3986 "sql.c" +#line 3998 "sql.c" break; - case 282: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ -#line 847 "sql.y" + case 283: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ +#line 848 "sql.y" { 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); } -#line 3995 "sql.c" +#line 4007 "sql.c" break; - case 283: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ -#line 853 "sql.y" + case 284: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ +#line 854 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -4004,28 +4016,28 @@ static YYACTIONTYPE yy_reduce( SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4008 "sql.c" +#line 4020 "sql.c" break; - case 284: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ -#line 863 "sql.y" + case 285: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ +#line 864 "sql.y" { 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); } -#line 4017 "sql.c" +#line 4029 "sql.c" break; - case 285: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ -#line 870 "sql.y" + case 286: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ +#line 871 "sql.y" { 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); } -#line 4026 "sql.c" +#line 4038 "sql.c" break; - case 286: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ -#line 875 "sql.y" + case 287: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ +#line 876 "sql.y" { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -4035,10 +4047,10 @@ static YYACTIONTYPE yy_reduce( SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4039 "sql.c" +#line 4051 "sql.c" break; - case 287: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ -#line 885 "sql.y" + case 288: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ +#line 886 "sql.y" { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -4051,45 +4063,45 @@ static YYACTIONTYPE yy_reduce( SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4055 "sql.c" +#line 4067 "sql.c" break; - case 288: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ -#line 898 "sql.y" + case 289: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ +#line 899 "sql.y" { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; 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); } -#line 4069 "sql.c" +#line 4081 "sql.c" break; - case 289: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ -#line 909 "sql.y" + case 290: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ +#line 910 "sql.y" { 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); } -#line 4078 "sql.c" +#line 4090 "sql.c" break; - case 290: /* cmd ::= KILL CONNECTION INTEGER */ -#line 916 "sql.y" + case 291: /* cmd ::= KILL CONNECTION INTEGER */ +#line 917 "sql.y" {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} -#line 4083 "sql.c" +#line 4095 "sql.c" break; - case 291: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ -#line 917 "sql.y" + case 292: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ +#line 918 "sql.y" {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} -#line 4088 "sql.c" +#line 4100 "sql.c" break; - case 292: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ -#line 918 "sql.y" + case 293: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ +#line 919 "sql.y" {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} -#line 4093 "sql.c" +#line 4105 "sql.c" break; default: break; @@ -4174,7 +4186,7 @@ static void yy_syntax_error( } assert(len <= outputBufLen); -#line 4178 "sql.c" +#line 4190 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE @@ -4201,7 +4213,7 @@ static void yy_accept( ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ #line 61 "sql.y" -#line 4205 "sql.c" +#line 4217 "sql.c" /*********** End %parse_accept code *******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 631e19f027f09f68d20e70277e47a3a20b17fba2..07a47084e121d7e7faf77dd0214002b4b6115087 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -3710,6 +3710,9 @@ static bool tableFilterFp(const void* pNode, void* param) { case TSDB_RELATION_MATCH: { return ret == 0; } + case TSDB_RELATION_NMATCH: { + return ret == 0; + } case TSDB_RELATION_IN: { return ret == 1; } @@ -4045,6 +4048,8 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) { assert(0); } else if (optr == TSDB_RELATION_MATCH) { assert(0); + } else if (optr == TSDB_RELATION_NMATCH) { + assert(0); } return TSDB_CODE_SUCCESS; @@ -4202,7 +4207,9 @@ static void queryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, S if (pQueryInfo->sch.colId == TSDB_TBNAME_COLUMN_INDEX) { if (pQueryInfo->optr == TSDB_RELATION_IN) { addToResult = pQueryInfo->compare(name, pQueryInfo->q); - } else if (pQueryInfo->optr == TSDB_RELATION_LIKE || pQueryInfo->optr == TSDB_RELATION_MATCH) { + } else if (pQueryInfo->optr == TSDB_RELATION_LIKE || + pQueryInfo->optr == TSDB_RELATION_MATCH || + pQueryInfo->optr == TSDB_RELATION_NMATCH) { addToResult = !pQueryInfo->compare(name, pQueryInfo->q); } } else { @@ -4234,7 +4241,8 @@ void getTableListfromSkipList(tExprNode *pExpr, SSkipList *pSkipList, SArray *re param->setupInfoFn(pExpr, param->pExtInfo); tQueryInfo *pQueryInfo = pExpr->_node.info; - if (pQueryInfo->indexed && (pQueryInfo->optr != TSDB_RELATION_LIKE && pQueryInfo->optr != TSDB_RELATION_MATCH + if (pQueryInfo->indexed && (pQueryInfo->optr != TSDB_RELATION_LIKE + && pQueryInfo->optr != TSDB_RELATION_MATCH && pQueryInfo->optr != TSDB_RELATION_NMATCH && pQueryInfo->optr != TSDB_RELATION_IN)) { queryIndexedColumn(pSkipList, pQueryInfo, result); } else { diff --git a/src/util/inc/tcompare.h b/src/util/inc/tcompare.h index ef4c1096023bd670335603dee6ab274470de3ed7..1125516d34c65da1b5d0c47dadd126aa0b1959fa 100644 --- a/src/util/inc/tcompare.h +++ b/src/util/inc/tcompare.h @@ -84,6 +84,8 @@ int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight); int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight); int32_t compareStrPatternComp(const void* pLeft, const void* pRight); int32_t compareStrRegexComp(const void* pLeft, const void* pRight); +int32_t compareStrRegexCompMatch(const void* pLeft, const void* pRight); +int32_t compareStrRegexCompNMatch(const void* pLeft, const void* pRight); int32_t compareFindItemInSet(const void *pLeft, const void* pRight); int32_t compareWStrPatternComp(const void* pLeft, const void* pRight); diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index 462b23697f91e0c32464764bddeda68c8c6398ee..cf8977ce06c898fcdee8d21eedf5ed8d0f47f263 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define TSDB_CFG_MAX_NUM 122 +#define TSDB_CFG_MAX_NUM 123 #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 4c76724921404b2a799479c86166cd462220a99c..482dd8a6a15d1c7bf6aca76159b95b71ef244dd2 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -350,6 +350,14 @@ int32_t compareStrPatternComp(const void* pLeft, const void* pRight) { return (ret == TSDB_PATTERN_MATCH) ? 0 : 1; } +int32_t compareStrRegexCompMatch(const void* pLeft, const void* pRight) { + return compareStrRegexComp(pLeft, pRight); +} + +int32_t compareStrRegexCompNMatch(const void* pLeft, const void* pRight) { + return compareStrRegexComp(pLeft, pRight) ? 0 : 1; +} + int32_t compareStrRegexComp(const void* pLeft, const void* pRight) { size_t sz = varDataLen(pRight); char *pattern = malloc(sz + 1); @@ -449,7 +457,9 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = compareDoubleVal; break; case TSDB_DATA_TYPE_BINARY: { if (optr == TSDB_RELATION_MATCH) { - comparFn = compareStrRegexComp; + comparFn = compareStrRegexCompMatch; + } else if (optr == TSDB_RELATION_NMATCH) { + comparFn = compareStrRegexCompNMatch; } else if (optr == TSDB_RELATION_LIKE) { /* wildcard query using like operator */ comparFn = compareStrPatternComp; } else if (optr == TSDB_RELATION_IN) { @@ -463,7 +473,9 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_NCHAR: { if (optr == TSDB_RELATION_MATCH) { - comparFn = compareStrRegexComp; + comparFn = compareStrRegexCompMatch; + } else if (optr == TSDB_RELATION_NMATCH) { + comparFn = compareStrRegexCompNMatch; } else if (optr == TSDB_RELATION_LIKE) { comparFn = compareWStrPatternComp; } else if (optr == TSDB_RELATION_IN) { diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 8fb39cd1702fe670e44f2e0db1639a0f48ab5ab0..e3d022a6b0a4a929b6c06b2c305fb71b6980a865 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -116,6 +116,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_DUP_COL_NAMES, "duplicated column nam TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_TAG_LENGTH, "Invalid tag length") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_COLUMN_LENGTH, "Invalid column length") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_DUP_TAG_NAMES, "duplicated tag names") +TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_JSON, "Invalid JSON format") +TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_JSON_TYPE, "Invalid JSON data type") +TAOS_DEFINE_ERROR(TSDB_CODE_TSC_VALUE_OUT_OF_RANGE, "Value out of range") // mnode TAOS_DEFINE_ERROR(TSDB_CODE_MND_MSG_NOT_PROCESSED, "Message not processed") diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 04f2d7fc04cafb5514e4f7df1e6063cad9c096da..289c4a6ef5d5db1a04fdb33985ed4de959375f8d 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -195,6 +195,7 @@ static SKeyword keywordTable[] = { {"INITIALLY", TK_INITIALLY}, {"INSTEAD", TK_INSTEAD}, {"MATCH", TK_MATCH}, + {"NMATCH", TK_NMATCH}, {"KEY", TK_KEY}, {"OF", TK_OF}, {"RAISE", TK_RAISE}, diff --git a/tests/examples/JDBC/JDBCDemo/pom.xml b/tests/examples/JDBC/JDBCDemo/pom.xml index fed00c147b87621c70d60ea206b06f1b0f3e8d8f..8cf0356721f8ffd568e87fa4a77c86eb0f90a62b 100644 --- a/tests/examples/JDBC/JDBCDemo/pom.xml +++ b/tests/examples/JDBC/JDBCDemo/pom.xml @@ -17,7 +17,7 @@ com.taosdata.jdbc taos-jdbcdriver - 2.0.31 + 2.0.34 diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java index d4ea5f919d2882e4f82b817380172eff20d7c611..5bc23403087578c0791b0a5e6fca74a47aad8184 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java @@ -7,6 +7,9 @@ public class JdbcDemo { private static String host; private static final String dbName = "test"; private static final String tbName = "weather"; + private static final String user = "root"; + private static final String password = "taosdata"; + private Connection connection; public static void main(String[] args) { @@ -30,10 +33,9 @@ public class JdbcDemo { } private void init() { - final String url = "jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata"; + final String url = "jdbc:TAOS://" + host + ":6030/?user=" + user + "&password=" + password; // get connection try { - Class.forName("com.taosdata.jdbc.TSDBDriver"); Properties properties = new Properties(); properties.setProperty("charset", "UTF-8"); properties.setProperty("locale", "en_US.UTF-8"); @@ -42,8 +44,7 @@ public class JdbcDemo { connection = DriverManager.getConnection(url, properties); if (connection != null) System.out.println("[ OK ] Connection established."); - } catch (ClassNotFoundException | SQLException e) { - System.out.println("[ ERROR! ] Connection establish failed."); + } catch (SQLException e) { e.printStackTrace(); } } @@ -74,7 +75,7 @@ public class JdbcDemo { } private void select() { - final String sql = "select * from "+ dbName + "." + tbName; + final String sql = "select * from " + dbName + "." + tbName; executeQuery(sql); } @@ -89,8 +90,6 @@ public class JdbcDemo { } } - /************************************************************************/ - private void executeQuery(String sql) { long start = System.currentTimeMillis(); try (Statement statement = connection.createStatement()) { @@ -117,7 +116,6 @@ public class JdbcDemo { } } - private void printSql(String sql, boolean succeed, long cost) { System.out.println("[ " + (succeed ? "OK" : "ERROR!") + " ] time cost: " + cost + " ms, execute statement ====> " + sql); } @@ -132,7 +130,6 @@ public class JdbcDemo { long end = System.currentTimeMillis(); printSql(sql, false, (end - start)); e.printStackTrace(); - } } @@ -141,5 +138,4 @@ public class JdbcDemo { System.exit(0); } - -} \ No newline at end of file +} diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java index 5bf980f6d84e53438573812aa9f07d8d463f08c3..d89476b8ca718dab24202e2320e842366533a763 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java @@ -4,14 +4,15 @@ import java.sql.*; import java.util.Properties; public class JdbcRestfulDemo { - private static final String host = "127.0.0.1"; + private static final String host = "localhost"; + private static final String dbname = "test"; + private static final String user = "root"; + private static final String password = "taosdata"; public static void main(String[] args) { try { - // load JDBC-restful driver - Class.forName("com.taosdata.jdbc.rs.RestfulDriver"); // use port 6041 in url when use JDBC-restful - String url = "jdbc:TAOS-RS://" + host + ":6041/?user=root&password=taosdata"; + String url = "jdbc:TAOS-RS://" + host + ":6041/?user=" + user + "&password=" + password; Properties properties = new Properties(); properties.setProperty("charset", "UTF-8"); @@ -21,12 +22,12 @@ public class JdbcRestfulDemo { Connection conn = DriverManager.getConnection(url, properties); Statement stmt = conn.createStatement(); - stmt.execute("drop database if exists restful_test"); - stmt.execute("create database if not exists restful_test"); - stmt.execute("use restful_test"); - stmt.execute("create table restful_test.weather(ts timestamp, temperature float) tags(location nchar(64))"); - stmt.executeUpdate("insert into t1 using restful_test.weather tags('北京') values(now, 18.2)"); - ResultSet rs = stmt.executeQuery("select * from restful_test.weather"); + stmt.execute("drop database if exists " + dbname); + stmt.execute("create database if not exists " + dbname); + stmt.execute("use " + dbname); + stmt.execute("create table " + dbname + ".weather(ts timestamp, temperature float) tags(location nchar(64))"); + stmt.executeUpdate("insert into t1 using " + dbname + ".weather tags('北京') values(now, 18.2)"); + ResultSet rs = stmt.executeQuery("select * from " + dbname + ".weather"); ResultSetMetaData meta = rs.getMetaData(); while (rs.next()) { for (int i = 1; i <= meta.getColumnCount(); i++) { @@ -38,8 +39,6 @@ public class JdbcRestfulDemo { rs.close(); stmt.close(); conn.close(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java index def4c649027034028d222bfedb71e37d82b99380..4c499b0b3abb518b48b222eca9bbbcb388bd2008 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java @@ -34,9 +34,8 @@ public class SubscribeDemo { System.out.println(usage); return; } - /*********************************************************************************************/ + try { - Class.forName("com.taosdata.jdbc.TSDBDriver"); Properties properties = new Properties(); properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); diff --git a/tests/examples/JDBC/springbootdemo/pom.xml b/tests/examples/JDBC/springbootdemo/pom.xml index 6c83718896cc2e5716f599ba08212d3dc8292133..9126813b67e71691692109920f891a6fb4cc5ab5 100644 --- a/tests/examples/JDBC/springbootdemo/pom.xml +++ b/tests/examples/JDBC/springbootdemo/pom.xml @@ -60,12 +60,15 @@ + + org.springframework.boot + spring-boot-starter-aop + + com.taosdata.jdbc taos-jdbcdriver - 2.0.28 - - + 2.0.34 diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/SpringbootdemoApplication.java b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/SpringbootdemoApplication.java index fa10f3b0929e4c25c1379f489f73fc12ad9c1917..53edaa5796cccc7e4a4f274048c83a9ca7bbc7bb 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/SpringbootdemoApplication.java +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/SpringbootdemoApplication.java @@ -4,7 +4,7 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -@MapperScan(basePackages = {"com.taosdata.example.springbootdemo.dao"}) +@MapperScan(basePackages = {"com.taosdata.example.springbootdemo"}) @SpringBootApplication public class SpringbootdemoApplication { diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/controller/WeatherController.java b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/controller/WeatherController.java index cf14f5d84ace6348f38709ac3d3668ee8d2a0797..ed720fe6c02dd3a7eba6e645ea1e76d704c04d0c 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/controller/WeatherController.java +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/controller/WeatherController.java @@ -15,35 +15,21 @@ public class WeatherController { @Autowired private WeatherService weatherService; - /** - * create database and table - * - * @return - */ + @GetMapping("/lastOne") + public Weather lastOne() { + return weatherService.lastOne(); + } + @GetMapping("/init") public int init() { return weatherService.init(); } - /** - * Pagination Query - * - * @param limit - * @param offset - * @return - */ @GetMapping("/{limit}/{offset}") public List queryWeather(@PathVariable Long limit, @PathVariable Long offset) { return weatherService.query(limit, offset); } - /** - * upload single weather info - * - * @param temperature - * @param humidity - * @return - */ @PostMapping("/{temperature}/{humidity}") public int saveWeather(@PathVariable float temperature, @PathVariable float humidity) { return weatherService.save(temperature, humidity); diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.java b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.java index ad6733558a9d548be196cf8c9c0c63dc96227b39..d9202b45b4cc3dddf8e5a082ac339c1f88d4ec01 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.java +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.java @@ -8,6 +8,8 @@ import java.util.Map; public interface WeatherMapper { + Map lastOne(); + void dropDB(); void createDB(); diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml index 2d3e0540650f35c1018992795ac33fb6cb7c4837..91938ca24e3cf9c3e0f2895cf40f214d484c55d5 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml @@ -9,20 +9,48 @@ + + - drop database if exists test + drop + database if exists test - create database if not exists test + create + database if not exists test - create table if not exists test.weather(ts timestamp, temperature float, humidity float) tags(location nchar(64), groupId int) + create table if not exists test.weather + ( + ts + timestamp, + temperature + float, + humidity + float, + note + binary + ( + 64 + )) tags + ( + location nchar + ( + 64 + ), groupId int) - create table if not exists test.t#{groupId} using test.weather tags(#{location}, #{groupId}) + create table if not exists test.t#{groupId} using test.weather tags + ( + #{location}, + #{groupId} + ) - insert into test.t#{groupId} (ts, temperature, humidity) values (#{ts}, ${temperature}, ${humidity}) + insert into test.t#{groupId} (ts, temperature, humidity, note) + values (#{ts}, ${temperature}, ${humidity}, #{note}) - - - + + + \ No newline at end of file diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/domain/Weather.java b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/domain/Weather.java index c11b9a6f50655788d1e35eb9607a101d2d06c872..e4238127bd32b0f6ad21a514f3a1f07f6069b6d5 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/domain/Weather.java +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/domain/Weather.java @@ -11,6 +11,7 @@ public class Weather { private Float temperature; private Float humidity; private String location; + private String note; private int groupId; public Weather() { @@ -61,4 +62,12 @@ public class Weather { public void setGroupId(int groupId) { this.groupId = groupId; } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } } diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java index 26d09c7d128015739cdb0a87956affa4910b4b4e..2264b200afc3e0c2b7dd8e496e607649f940581d 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java @@ -29,6 +29,7 @@ public class WeatherService { Weather weather = new Weather(new Timestamp(ts + (thirtySec * i)), 30 * random.nextFloat(), random.nextInt(100)); weather.setLocation(locations[random.nextInt(locations.length)]); weather.setGroupId(i % locations.length); + weather.setNote("note-" + i); weatherMapper.createTable(weather); count += weatherMapper.insert(weather); } @@ -58,4 +59,21 @@ public class WeatherService { public List avg() { return weatherMapper.avg(); } + + public Weather lastOne() { + Map result = weatherMapper.lastOne(); + + long ts = (long) result.get("ts"); + float temperature = (float) result.get("temperature"); + float humidity = (float) result.get("humidity"); + String note = (String) result.get("note"); + int groupId = (int) result.get("groupid"); + String location = (String) result.get("location"); + + Weather weather = new Weather(new Timestamp(ts), temperature, humidity); + weather.setNote(note); + weather.setGroupId(groupId); + weather.setLocation(location); + return weather; + } } diff --git a/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/util/TaosAspect.java b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/util/TaosAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..80dad1bd7d669ba6b912c7e5fa816c29b7e37c87 --- /dev/null +++ b/tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/util/TaosAspect.java @@ -0,0 +1,36 @@ +package com.taosdata.example.springbootdemo.util; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.stereotype.Component; + +import java.sql.Timestamp; +import java.util.Map; + +@Aspect +@Component +public class TaosAspect { + + @Around("execution(java.util.Map com.taosdata.example.springbootdemo.dao.*.*(..))") + public Object handleType(ProceedingJoinPoint joinPoint) { + Map result = null; + try { + result = (Map) joinPoint.proceed(); + for (String key : result.keySet()) { + Object obj = result.get(key); + if (obj instanceof byte[]) { + obj = new String((byte[]) obj); + result.put(key, obj); + } + if (obj instanceof Timestamp) { + obj = ((Timestamp) obj).getTime(); + result.put(key, obj); + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties b/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties index 4d7e64d10576388827502a459df9e68da2721dbb..06daa81bbb06450d99ab3f6e640c9795c0ad5d2e 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties +++ b/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties @@ -1,22 +1,20 @@ # datasource config - JDBC-JNI #spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver -#spring.datasource.url=jdbc:TAOS://127.0.0.1:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 +#spring.datasource.url=jdbc:TAOS://localhost:6030/?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 #spring.datasource.username=root #spring.datasource.password=taosdata - # datasource config - JDBC-RESTful spring.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver -spring.datasource.url=jdbc:TAOS-RS://master:6041/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 +spring.datasource.url=jdbc:TAOS-RS://localhsot:6041/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 spring.datasource.username=root spring.datasource.password=taosdata - spring.datasource.druid.initial-size=5 spring.datasource.druid.min-idle=5 spring.datasource.druid.max-active=5 spring.datasource.druid.max-wait=30000 spring.datasource.druid.validation-query=select server_status(); - +spring.aop.auto=true +spring.aop.proxy-target-class=true #mybatis mybatis.mapper-locations=classpath:mapper/*.xml - logging.level.com.taosdata.jdbc.springbootdemo.dao=debug diff --git a/tests/examples/c/apitest.c b/tests/examples/c/apitest.c index 621950a834c515962f35e000279bc91e4c25b5e0..28e8d3f012dd4d6b4b12f2a01132b00a2ae7225c 100644 --- a/tests/examples/c/apitest.c +++ b/tests/examples/c/apitest.c @@ -2,6 +2,7 @@ // to compile: gcc -o apitest apitest.c -ltaos #include "taoserror.h" +#include "cJSON.h" #include #include @@ -1020,7 +1021,7 @@ int32_t verify_schema_less(TAOS* taos) { void verify_telnet_insert(TAOS* taos) { TAOS_RES *result; - result = taos_query(taos, "drop database if exists test;"); + result = taos_query(taos, "drop database if exists db;"); taos_free_result(result); usleep(100000); result = taos_query(taos, "create database db precision 'ms';"); @@ -1038,7 +1039,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines0, 3); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines0 code: %d, %s.\n", code, tstrerror(code)); } /* timestamp */ @@ -1052,7 +1053,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines1, 6); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines1 code: %d, %s.\n", code, tstrerror(code)); } /* metric value */ @@ -1063,7 +1064,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_0, 2); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_0 code: %d, %s.\n", code, tstrerror(code)); } //smallint @@ -1073,7 +1074,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_1, 2); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_1 code: %d, %s.\n", code, tstrerror(code)); } //int @@ -1083,7 +1084,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_2, 2); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_2 code: %d, %s.\n", code, tstrerror(code)); } //bigint @@ -1093,7 +1094,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_3, 2); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_3 code: %d, %s.\n", code, tstrerror(code)); } //float @@ -1112,7 +1113,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_4, 11); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_4 code: %d, %s.\n", code, tstrerror(code)); } //double @@ -1130,7 +1131,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_5, 10); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_5 code: %d, %s.\n", code, tstrerror(code)); } //bool @@ -1148,7 +1149,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_6, 10); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_6 code: %d, %s.\n", code, tstrerror(code)); } //binary @@ -1159,7 +1160,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_7, 3); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_7 code: %d, %s.\n", code, tstrerror(code)); } //nchar @@ -1169,7 +1170,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines2_8, 2); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines2_8 code: %d, %s.\n", code, tstrerror(code)); } /* tags */ @@ -1180,7 +1181,7 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines3_0, 2); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines3_0 code: %d, %s.\n", code, tstrerror(code)); } //tag ID as child table name @@ -1191,12 +1192,745 @@ void verify_telnet_insert(TAOS* taos) { }; code = taos_insert_telnet_lines(taos, lines3_1, 3); if (code) { - printf("code: %d, %s.\n", code, tstrerror(code)); + printf("lines3_1 code: %d, %s.\n", code, tstrerror(code)); } return; } +void verify_json_insert(TAOS* taos) { + TAOS_RES *result; + + result = taos_query(taos, "drop database if exists db;"); + taos_free_result(result); + usleep(100000); + result = taos_query(taos, "create database db precision 'ms';"); + taos_free_result(result); + usleep(100000); + + (void)taos_select_db(taos, "db"); + int32_t code = 0; + + char *message = + "{ \ + \"metric\":\"cpu_load_0\", \ + \"timestamp\": 1626006833610123, \ + \"value\": 55.5, \ + \"tags\": \ + { \ + \"host\": \"ubuntu\", \ + \"interface1\": \"eth0\", \ + \"Id\": \"tb0\" \ + } \ + }"; + + code = taos_insert_json_payload(taos, message); + if (code) { + printf("payload_0 code: %d, %s.\n", code, tstrerror(code)); + } + + char *message1 = + "[ \ + { \ + \"metric\":\"cpu_load_1\", \ + \"timestamp\": 1626006833610123, \ + \"value\": 55.5, \ + \"tags\": \ + { \ + \"host\": \"ubuntu\", \ + \"interface\": \"eth1\", \ + \"Id\": \"tb1\" \ + } \ + }, \ + { \ + \"metric\":\"cpu_load_2\", \ + \"timestamp\": 1626006833610123, \ + \"value\": 55.5, \ + \"tags\": \ + { \ + \"host\": \"ubuntu\", \ + \"interface\": \"eth2\", \ + \"Id\": \"tb2\" \ + } \ + } \ + ]"; + + code = taos_insert_json_payload(taos, message1); + if (code) { + printf("payload_1 code: %d, %s.\n", code, tstrerror(code)); + } + + char *message2 = + "[ \ + { \ + \"metric\":\"cpu_load_3\", \ + \"timestamp\": \ + { \ + \"value\": 1626006833610123, \ + \"type\": \"us\" \ + }, \ + \"value\": \ + { \ + \"value\": 55, \ + \"type\": \"int\" \ + }, \ + \"tags\": \ + { \ + \"host\": \ + { \ + \"value\": \"ubuntu\", \ + \"type\": \"binary\" \ + }, \ + \"interface\": \ + { \ + \"value\": \"eth3\", \ + \"type\": \"nchar\" \ + }, \ + \"ID\": \"tb3\", \ + \"port\": \ + { \ + \"value\": 4040, \ + \"type\": \"int\" \ + } \ + } \ + }, \ + { \ + \"metric\":\"cpu_load_4\", \ + \"timestamp\": 1626006833610123, \ + \"value\": 66.6, \ + \"tags\": \ + { \ + \"host\": \"ubuntu\", \ + \"interface\": \"eth4\", \ + \"Id\": \"tb4\" \ + } \ + } \ + ]"; + code = taos_insert_json_payload(taos, message2); + if (code) { + printf("payload_2 code: %d, %s.\n", code, tstrerror(code)); + } + + + cJSON *payload, *tags; + char *payload_str; + + /* Default format */ + //number + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb0_0"); + cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); + cJSON_AddNumberToObject(payload, "value", 10); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload0_0 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //true + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb0_1"); + cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); + cJSON_AddTrueToObject(payload, "value"); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload0_1 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //false + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb0_2"); + cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); + cJSON_AddFalseToObject(payload, "value"); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload0_2 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //string + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb0_3"); + cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); + cJSON_AddStringToObject(payload, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload0_3 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //timestamp 0 -> current time + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb0_4"); + cJSON_AddNumberToObject(payload, "timestamp", 0); + cJSON_AddNumberToObject(payload, "value", 123); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload0_4 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //ID + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb0_5"); + cJSON_AddNumberToObject(payload, "timestamp", 0); + cJSON_AddNumberToObject(payload, "value", 123); + tags = cJSON_CreateObject(); + cJSON_AddStringToObject(tags, "ID", "tb0_5"); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddStringToObject(tags, "iD", "tb000"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddStringToObject(tags, "id", "tb555"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload0_5 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + /* Nested format */ + //timestamp + cJSON *timestamp; + //seconds + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb1_0"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + cJSON_AddNumberToObject(payload, "value", 10); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload1_0 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //milleseconds + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb1_1"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833610); + cJSON_AddStringToObject(timestamp, "type", "ms"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + cJSON_AddNumberToObject(payload, "value", 10); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload1_1 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //microseconds + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb1_2"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833610123); + cJSON_AddStringToObject(timestamp, "type", "us"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + cJSON_AddNumberToObject(payload, "value", 10); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload1_2 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //nanoseconds + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb1_3"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833610123321); + cJSON_AddStringToObject(timestamp, "type", "ns"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + cJSON_AddNumberToObject(payload, "value", 10); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload1_3 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //now + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb1_4"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 0); + cJSON_AddStringToObject(timestamp, "type", "ns"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + cJSON_AddNumberToObject(payload, "value", 10); + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload1_4 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //metric value + cJSON *metric_val; + //bool + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_0"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddTrueToObject(metric_val, "value"); + cJSON_AddStringToObject(metric_val, "type", "bool"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_0 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //tinyint + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_1"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddNumberToObject(metric_val, "value", 127); + cJSON_AddStringToObject(metric_val, "type", "tinyint"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_1 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //smallint + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_2"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddNumberToObject(metric_val, "value", 32767); + cJSON_AddStringToObject(metric_val, "type", "smallint"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_2 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //int + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_3"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddNumberToObject(metric_val, "value", 2147483647); + cJSON_AddStringToObject(metric_val, "type", "int"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_3 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //bigint + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_4"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddNumberToObject(metric_val, "value", 9223372036854775807); + cJSON_AddStringToObject(metric_val, "type", "bigint"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_4 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //float + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_5"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddNumberToObject(metric_val, "value", 11.12345); + cJSON_AddStringToObject(metric_val, "type", "float"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_5 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //double + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_6"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddNumberToObject(metric_val, "value", 22.123456789); + cJSON_AddStringToObject(metric_val, "type", "double"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_6 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //binary + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_7"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddStringToObject(metric_val, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddStringToObject(metric_val, "type", "binary"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_7 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //nchar + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb2_8"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddStringToObject(metric_val, "value", "你好"); + cJSON_AddStringToObject(metric_val, "type", "nchar"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + cJSON_AddTrueToObject(tags, "t1"); + cJSON_AddFalseToObject(tags, "t2"); + cJSON_AddNumberToObject(tags, "t3", 10); + cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); + cJSON_AddItemToObject(payload, "tags", tags); + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload2_8 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); + + //tag value + cJSON *tag; + + payload = cJSON_CreateObject(); + cJSON_AddStringToObject(payload, "metric", "stb3_0"); + + timestamp = cJSON_CreateObject(); + cJSON_AddNumberToObject(timestamp, "value", 1626006833); + cJSON_AddStringToObject(timestamp, "type", "s"); + cJSON_AddItemToObject(payload, "timestamp", timestamp); + + metric_val = cJSON_CreateObject(); + cJSON_AddStringToObject(metric_val, "value", "hello"); + cJSON_AddStringToObject(metric_val, "type", "nchar"); + cJSON_AddItemToObject(payload, "value", metric_val); + + tags = cJSON_CreateObject(); + + tag = cJSON_CreateObject(); + cJSON_AddTrueToObject(tag, "value"); + cJSON_AddStringToObject(tag, "type", "bool"); + cJSON_AddItemToObject(tags, "t1", tag); + + tag = cJSON_CreateObject(); + cJSON_AddFalseToObject(tag, "value"); + cJSON_AddStringToObject(tag, "type", "bool"); + cJSON_AddItemToObject(tags, "t2", tag); + + tag = cJSON_CreateObject(); + cJSON_AddNumberToObject(tag, "value", 127); + cJSON_AddStringToObject(tag, "type", "tinyint"); + cJSON_AddItemToObject(tags, "t3", tag); + + tag = cJSON_CreateObject(); + cJSON_AddNumberToObject(tag, "value", 32767); + cJSON_AddStringToObject(tag, "type", "smallint"); + cJSON_AddItemToObject(tags, "t4", tag); + + tag = cJSON_CreateObject(); + cJSON_AddNumberToObject(tag, "value", 2147483647); + cJSON_AddStringToObject(tag, "type", "int"); + cJSON_AddItemToObject(tags, "t5", tag); + + tag = cJSON_CreateObject(); + cJSON_AddNumberToObject(tag, "value", 9223372036854775807); + cJSON_AddStringToObject(tag, "type", "bigint"); + cJSON_AddItemToObject(tags, "t6", tag); + + tag = cJSON_CreateObject(); + cJSON_AddNumberToObject(tag, "value", 11.12345); + cJSON_AddStringToObject(tag, "type", "float"); + cJSON_AddItemToObject(tags, "t7", tag); + + tag = cJSON_CreateObject(); + cJSON_AddNumberToObject(tag, "value", 22.1234567890); + cJSON_AddStringToObject(tag, "type", "double"); + cJSON_AddItemToObject(tags, "t8", tag); + + tag = cJSON_CreateObject(); + cJSON_AddStringToObject(tag, "value", "binary_val"); + cJSON_AddStringToObject(tag, "type", "binary"); + cJSON_AddItemToObject(tags, "t9", tag); + + tag = cJSON_CreateObject(); + cJSON_AddStringToObject(tag, "value", "你好"); + cJSON_AddStringToObject(tag, "type", "nchar"); + cJSON_AddItemToObject(tags, "t10", tag); + + cJSON_AddItemToObject(payload, "tags", tags); + + payload_str = cJSON_Print(payload); + //printf("%s\n", payload_str); + + code = taos_insert_json_payload(taos, payload_str); + if (code) { + printf("payload3_0 code: %d, %s.\n", code, tstrerror(code)); + } + free(payload_str); + cJSON_Delete(payload); +} + int main(int argc, char *argv[]) { const char* host = "127.0.0.1"; const char* user = "root"; @@ -1220,6 +1954,9 @@ int main(int argc, char *argv[]) { printf("************ verify telnet-insert *************\n"); verify_telnet_insert(taos); + printf("************ verify json-insert *************\n"); + verify_json_insert(taos); + printf("************ verify query *************\n"); verify_query(taos); diff --git a/tests/examples/c/makefile b/tests/examples/c/makefile index 304623c27af27cd23a301af134647fb3b9746d64..c85eb4adc515e5fb4e875b8e8e955222bc09190e 100644 --- a/tests/examples/c/makefile +++ b/tests/examples/c/makefile @@ -6,8 +6,8 @@ TARGET=exe LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \ -Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \ - -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 - + -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \ + -I../../../deps/cJson/inc all: $(TARGET) exe: diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 06ec3c6bfabfe4d9c378c9d17dda944990f624a8..db846f2bd7a75ce2294df4968c42dc947541b05b 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -183,6 +183,9 @@ python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosub python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdumpTestNanoSupport.py +# +python3 ./test.py -f tsdb/tsdbComp.py + # update python3 ./test.py -f update/allow_update.py python3 ./test.py -f update/allow_update-0.py @@ -267,7 +270,7 @@ python3 ./test.py -f query/queryStateWindow.py # python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py python3 ./test.py -f query/nestquery_last_row.py python3 ./test.py -f query/queryCnameDisplay.py -python3 ./test.py -f query/operator_cost.py +# python3 ./test.py -f query/operator_cost.py # python3 ./test.py -f query/long_where_query.py python3 test.py -f query/nestedQuery/queryWithSpread.py diff --git a/tests/pytest/insert/insertJSONPayload.py b/tests/pytest/insert/insertJSONPayload.py new file mode 100644 index 0000000000000000000000000000000000000000..30f34446a93237f9b7b610efc9b1b5507ba09f4a --- /dev/null +++ b/tests/pytest/insert/insertJSONPayload.py @@ -0,0 +1,568 @@ +################################################################### +# Copyright (c) 2021 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self._conn = conn + + def run(self): + print("running {}".format(__file__)) + tdSql.execute("drop database if exists test") + tdSql.execute("create database if not exists test precision 'us'") + tdSql.execute('use test') + + + ### Default format ### + ### metric value ### + print("============= step1 : test metric value types ================") + payload = ''' + { + "metric": "stb0_0", + "timestamp": 1626006833610123, + "value": 10, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb0_0") + tdSql.checkData(1, 1, "FLOAT") + + payload = ''' + { + "metric": "stb0_1", + "timestamp": 1626006833610123, + "value": true, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb0_1") + tdSql.checkData(1, 1, "BOOL") + + payload = ''' + { + "metric": "stb0_2", + "timestamp": 1626006833610123, + "value": false, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb0_2") + tdSql.checkData(1, 1, "BOOL") + + payload = ''' + { + "metric": "stb0_3", + "timestamp": 1626006833610123, + "value": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>", + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb0_3") + tdSql.checkData(1, 1, "NCHAR") + + ### timestamp 0 ### + payload = ''' + { + "metric": "stb0_4", + "timestamp": 0, + "value": 123, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + + ### ID ### + payload = ''' + { + "metric": "stb0_5", + "timestamp": 0, + "value": 123, + "tags": { + "ID": "tb0_5", + "t1": true, + "iD": "tb000", + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>", + "id": "tb555" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("select tbname from stb0_5") + tdSql.checkData(0, 0, "tb0_5") + + ### Nested format ### + ### timestamp ### + #seconds + payload = ''' + { + "metric": "stb1_0", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": 10, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("select ts from stb1_0") + tdSql.checkData(0, 0, "2021-07-11 20:33:53.000000") + + #milliseconds + payload = ''' + { + "metric": "stb1_1", + "timestamp": { + "value": 1626006833610, + "type": "ms" + }, + "value": 10, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("select ts from stb1_1") + tdSql.checkData(0, 0, "2021-07-11 20:33:53.610000") + + #microseconds + payload = ''' + { + "metric": "stb1_2", + "timestamp": { + "value": 1626006833610123, + "type": "us" + }, + "value": 10, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("select ts from stb1_2") + tdSql.checkData(0, 0, "2021-07-11 20:33:53.610123") + + #nanoseconds + payload = ''' + { + "metric": "stb1_3", + "timestamp": { + "value": 1.6260068336101233e+18, + "type": "ns" + }, + "value": 10, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("select ts from stb1_3") + tdSql.checkData(0, 0, "2021-07-11 20:33:53.610123") + + #now + tdSql.execute('use test') + payload = ''' + { + "metric": "stb1_4", + "timestamp": { + "value": 0, + "type": "ns" + }, + "value": 10, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + ### metric value ### + payload = ''' + { + "metric": "stb2_0", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": true, + "type": "bool" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_0") + tdSql.checkData(1, 1, "BOOL") + + payload = ''' + { + "metric": "stb2_1", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": 127, + "type": "tinyint" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_1") + tdSql.checkData(1, 1, "TINYINT") + + payload = ''' + { + "metric": "stb2_2", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": 32767, + "type": "smallint" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_2") + tdSql.checkData(1, 1, "SMALLINT") + + payload = ''' + { + "metric": "stb2_3", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": 2147483647, + "type": "int" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_3") + tdSql.checkData(1, 1, "INT") + + payload = ''' + { + "metric": "stb2_4", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": 9.2233720368547758e+18, + "type": "bigint" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_4") + tdSql.checkData(1, 1, "BIGINT") + + payload = ''' + { + "metric": "stb2_5", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": 11.12345, + "type": "float" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_5") + tdSql.checkData(1, 1, "FLOAT") + + payload = ''' + { + "metric": "stb2_6", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": 22.123456789, + "type": "double" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_6") + tdSql.checkData(1, 1, "DOUBLE") + + payload = ''' + { + "metric": "stb2_7", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>", + "type": "binary" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_7") + tdSql.checkData(1, 1, "BINARY") + + payload = ''' + { + "metric": "stb2_8", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": "你好", + "type": "nchar" + }, + "tags": { + "t1": true, + "t2": false, + "t3": 10, + "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb2_8") + tdSql.checkData(1, 1, "NCHAR") + + ### tag value ### + + payload = ''' + { + "metric": "stb3_0", + "timestamp": { + "value": 1626006833, + "type": "s" + }, + "value": { + "value": "hello", + "type": "nchar" + }, + "tags": { + "t1": { + "value": true, + "type": "bool" + }, + "t2": { + "value": 127, + "type": "tinyint" + }, + "t3": { + "value": 32767, + "type": "smallint" + }, + "t4": { + "value": 2147483647, + "type": "int" + }, + "t5": { + "value": 9.2233720368547758e+18, + "type": "bigint" + }, + "t6": { + "value": 11.12345, + "type": "float" + }, + "t7": { + "value": 22.123456789, + "type": "double" + }, + "t8": { + "value": "binary_val", + "type": "binary" + }, + "t9": { + "value": "你好", + "type": "nchar" + } + } + } + ''' + code = self._conn.insert_json_payload(payload) + print("insert_json_payload result {}".format(code)) + + tdSql.query("describe stb3_0") + tdSql.checkData(2, 1, "BOOL") + tdSql.checkData(3, 1, "TINYINT") + tdSql.checkData(4, 1, "SMALLINT") + tdSql.checkData(5, 1, "INT") + tdSql.checkData(6, 1, "BIGINT") + tdSql.checkData(7, 1, "FLOAT") + tdSql.checkData(8, 1, "DOUBLE") + tdSql.checkData(9, 1, "BINARY") + tdSql.checkData(10, 1, "NCHAR") + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/openTsdbTelnetLinesInsert.py b/tests/pytest/insert/openTsdbTelnetLinesInsert.py index e0d1c0d9669e77e236d4b1591b302a717c5a93d1..25518437e102c985b4d84887b1806f9e341c86d6 100644 --- a/tests/pytest/insert/openTsdbTelnetLinesInsert.py +++ b/tests/pytest/insert/openTsdbTelnetLinesInsert.py @@ -13,7 +13,6 @@ import traceback import random -import string from taos.error import LinesError import time from copy import deepcopy @@ -24,7 +23,6 @@ from util.sql import * from util.common import tdCom import threading - class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) @@ -191,7 +189,8 @@ class TDTestCase: t4="9223372036854775807i64", t5="11.12345f32", t6="22.123456789f64", t7="\"binaryTagValue\"", t8="L\"ncharTagValue\"", ts="1626006833639000000ns", id_noexist_tag=None, id_change_tag=None, id_upper_tag=None, id_double_tag=None, - t_add_tag=None, t_mul_tag=None, t_multi_tag=None, t_blank_tag=None): + t_add_tag=None, t_mul_tag=None, t_multi_tag=None, c_blank_tag=None, t_blank_tag=None, + chinese_tag=None, multi_field_tag=None): if stb_name == "": stb_name = tdCom.getLongName(len=6, mode="letters") if tb_name == "": @@ -221,8 +220,14 @@ class TDTestCase: sql_seq = f'{stb_name} {ts} {value} t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6}' if t_multi_tag is not None: sql_seq = f'{stb_name} {ts} {value},{value} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6}' - if t_blank_tag is not None: + if c_blank_tag is not None: sql_seq = f'{stb_name} {ts} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8}' + if t_blank_tag is not None: + sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\"' + if chinese_tag is not None: + sql_seq = f'{stb_name} {ts} L"涛思数据" t0={t0},t1=L"涛思数据"' + if multi_field_tag is not None: + sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\",t0={t0} t1={t1}' return sql_seq, stb_name def genMulTagColStr(self, genType, count=1): @@ -259,8 +264,6 @@ class TDTestCase: def resHandle(self, query_sql, query_tag): tdSql.execute('reset query cache') row_info = tdSql.query(query_sql, query_tag) - print(query_sql) - print(row_info) col_info = tdSql.getColNameList(query_sql, query_tag) res_row_list = [] sub_list = [] @@ -277,22 +280,6 @@ class TDTestCase: self._conn.insert_telnet_lines([input_sql]) query_sql = f"{query_sql} {stb_name} {condition}" res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True) - res = tdSql.query(f'select * from {stb_name}', True) - print(res) - - res = tdSql.query(f'select * from {stb_name}', True) - print(res) - time.sleep(2) - res = tdSql.query(f'select * from {stb_name}', True) - print(res) - time.sleep(2) - res = tdSql.query(f'select * from {stb_name}', True) - print(res) - time.sleep(2) - res = tdSql.query(f'select * from {stb_name}', True) - print(res) - - if ts == 0: res_ts = self.dateToTs(res_row_list[0][0]) current_time = time.time() @@ -535,8 +522,8 @@ class TDTestCase: input_sql, stb_name = self.genFullTypeSql(t6=t6) self.resCmp(input_sql, stb_name) # * limit set to 1.797693134862316*(10**308) - for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: - input_sql = self.genFullTypeSql(c6=c6)[0] + for t6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: + input_sql = self.genFullTypeSql(t6=t6)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -574,23 +561,25 @@ class TDTestCase: """ tdCom.cleanTb() # i8 - for c1 in ["-127i8", "127i8"]: - input_sql, stb_name = self.genFullTypeSql(c1=c1) + for value in ["-127i8", "127i8"]: + input_sql, stb_name = self.genFullTypeSql(value=value) self.resCmp(input_sql, stb_name) - - for c1 in ["-128i8", "128i8"]: - input_sql = self.genFullTypeSql(c1=c1)[0] + tdCom.cleanTb() + for value in ["-128i8", "128i8"]: + input_sql = self.genFullTypeSql(value=value)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") except LinesError as err: tdSql.checkNotEqual(err.errno, 0) # i16 - for c2 in ["-32767i16"]: - input_sql, stb_name = self.genFullTypeSql(c2=c2) + tdCom.cleanTb() + for value in ["-32767i16"]: + input_sql, stb_name = self.genFullTypeSql(value=value) self.resCmp(input_sql, stb_name) - for c2 in ["-32768i16", "32768i16"]: - input_sql = self.genFullTypeSql(c2=c2)[0] + tdCom.cleanTb() + for value in ["-32768i16", "32768i16"]: + input_sql = self.genFullTypeSql(value=value)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -598,11 +587,13 @@ class TDTestCase: tdSql.checkNotEqual(err.errno, 0) # i32 - for c3 in ["-2147483647i32"]: - input_sql, stb_name = self.genFullTypeSql(c3=c3) + tdCom.cleanTb() + for value in ["-2147483647i32"]: + input_sql, stb_name = self.genFullTypeSql(value=value) self.resCmp(input_sql, stb_name) - for c3 in ["-2147483648i32", "2147483648i32"]: - input_sql = self.genFullTypeSql(c3=c3)[0] + tdCom.cleanTb() + for value in ["-2147483648i32", "2147483648i32"]: + input_sql = self.genFullTypeSql(value=value)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -610,11 +601,13 @@ class TDTestCase: tdSql.checkNotEqual(err.errno, 0) # i64 - for c4 in ["-9223372036854775807i64"]: - input_sql, stb_name = self.genFullTypeSql(c4=c4) + tdCom.cleanTb() + for value in ["-9223372036854775807i64"]: + input_sql, stb_name = self.genFullTypeSql(value=value) self.resCmp(input_sql, stb_name) - for c4 in ["-9223372036854775808i64", "9223372036854775808i64"]: - input_sql = self.genFullTypeSql(c4=c4)[0] + tdCom.cleanTb() + for value in ["-9223372036854775808i64", "9223372036854775808i64"]: + input_sql = self.genFullTypeSql(value=value)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -622,12 +615,14 @@ class TDTestCase: tdSql.checkNotEqual(err.errno, 0) # f32 - for c5 in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]: - input_sql, stb_name = self.genFullTypeSql(c5=c5) + tdCom.cleanTb() + for value in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]: + input_sql, stb_name = self.genFullTypeSql(value=value) self.resCmp(input_sql, stb_name) # * limit set to 4028234664*(10**38) - for c5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: - input_sql = self.genFullTypeSql(c5=c5)[0] + tdCom.cleanTb() + for value in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: + input_sql = self.genFullTypeSql(value=value)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -635,12 +630,14 @@ class TDTestCase: tdSql.checkNotEqual(err.errno, 0) # f64 - for c6 in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']: - input_sql, stb_name = self.genFullTypeSql(c6=c6) + tdCom.cleanTb() + for value in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']: + input_sql, stb_name = self.genFullTypeSql(value=value) self.resCmp(input_sql, stb_name) # * limit set to 1.797693134862316*(10**308) - for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: - input_sql = self.genFullTypeSql(c6=c6)[0] + tdCom.cleanTb() + for value in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: + input_sql = self.genFullTypeSql(value=value)[0] try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -648,10 +645,12 @@ class TDTestCase: tdSql.checkNotEqual(err.errno, 0) # # binary + tdCom.cleanTb() stb_name = tdCom.getLongName(7, "letters") input_sql = f'{stb_name} 1626006833639000000ns "{tdCom.getLongName(16374, "letters")}" t0=t' self._conn.insert_telnet_lines([input_sql]) + tdCom.cleanTb() input_sql = f'{stb_name} 1626006833639000000ns "{tdCom.getLongName(16375, "letters")}" t0=t' try: self._conn.insert_telnet_lines([input_sql]) @@ -661,10 +660,12 @@ class TDTestCase: # nchar # * legal nchar could not be larger than 16374/4 + tdCom.cleanTb() stb_name = tdCom.getLongName(7, "letters") input_sql = f'{stb_name} 1626006833639000000ns L"{tdCom.getLongName(4093, "letters")}" t0=t' self._conn.insert_telnet_lines([input_sql]) + tdCom.cleanTb() input_sql = f'{stb_name} 1626006833639000000ns L"{tdCom.getLongName(4094, "letters")}" t0=t' try: self._conn.insert_telnet_lines([input_sql]) @@ -709,24 +710,21 @@ class TDTestCase: tdSql.checkNotEqual(err.errno, 0) # check binary and nchar blank - stb_name = tdCom.getLongName(7, "letters") - - input_sql1 = f'{stb_name} 1626006833639000000ns "abc aaa" t0=t' - input_sql2 = f'{stb_name} 1626006833639000000ns L"abc aaa" t0=t' - input_sql3 = f'{stb_name} 1626006833639000000ns t t0="abc aaa"' - input_sql4 = f'{stb_name} 1626006833639000000ns t t0=L"abc aaa"' + input_sql1 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns "abc aaa" t0=t' + input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abc aaa" t0=t' + input_sql3 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0="abc aaa"' + input_sql4 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=L"abc aaa"' for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]: try: self._conn.insert_telnet_lines([input_sql]) - raise Exception("should not reach here") except LinesError as err: - tdSql.checkNotEqual(err.errno, 0) + pass # check accepted binary and nchar symbols # # * ~!@#$¥%^&*()-+={}|[]、「」:; for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'): - input_sql1 = f'{stb_name} 1626006833639000000ns "abc{symbol}aaa" t0=t' - input_sql2 = f'{stb_name} 1626006833639000000ns t t0=t,t1="abc{symbol}aaa"' + input_sql1 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns "abc{symbol}aaa" t0=t' + input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=t,t1="abc{symbol}aaa"' self._conn.insert_telnet_lines([input_sql1]) self._conn.insert_telnet_lines([input_sql2]) @@ -756,6 +754,7 @@ class TDTestCase: """ case no id when stb exist """ + print("noIdStbExistCheckCase") tdCom.cleanTb() input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", value="f") self.resCmp(input_sql, stb_name) @@ -779,22 +778,24 @@ class TDTestCase: """ check length increase """ + print("tagColBinaryNcharLengthCheckCase") tdCom.cleanTb() input_sql, stb_name = self.genFullTypeSql() self.resCmp(input_sql, stb_name) tb_name = tdCom.getLongName(5, "letters") - input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name,t7="\"binaryTagValuebinaryTagValue\"", t8="L\"ncharTagValuencharTagValue\"", c7="\"binaryTagValuebinaryTagValue\"", c8="L\"ncharTagValuencharTagValue\"") + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name,t7="\"binaryTagValuebinaryTagValue\"", t8="L\"ncharTagValuencharTagValue\"") self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"') def tagColAddDupIDCheckCase(self): """ - check column and tag count add, stb and tb duplicate + check tag count add, stb and tb duplicate * tag: alter table ... * col: when update==0 and ts is same, unchange * so this case tag&&value will be added, * col is added without value when update==0 * col is added with value when update==1 """ + print("tagColAddDupIDCheckCase") tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") for db_update_tag in [0, 1]: @@ -802,25 +803,27 @@ class TDTestCase: self.createDb("test_update", db_update_tag=db_update_tag) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", value="f") self.resCmp(input_sql, stb_name) - self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t0="f", value="f", ct_add_tag=True) + self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t0="f", value="f", t_add_tag=True) if db_update_tag == 1 : self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"') else: self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True) + self.createDb() def tagColAddCheckCase(self): """ - check column and tag count add + check tag count add """ + print("tagColAddCheckCase") tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", value="f") self.resCmp(input_sql, stb_name) tb_name_1 = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name_1, t0="f", value="f", ct_add_tag=True) + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name_1, t0="f", value="f", t_add_tag=True) self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name_1}"') - res_row_list = self.resHandle(f"select c10,c11,t10,t11 from {tb_name}", True)[0] - tdSql.checkEqual(res_row_list[0], ['None', 'None', 'None', 'None']) + res_row_list = self.resHandle(f"select t10,t11 from {tb_name}", True)[0] + tdSql.checkEqual(res_row_list[0], ['None', 'None']) self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True) def tagMd5Check(self): @@ -838,7 +841,7 @@ class TDTestCase: tdSql.query(f"select * from {stb_name}") tdSql.checkRows(1) tdSql.checkEqual(tb_name1, tb_name2) - input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", value="f", id_noexist_tag=True, ct_add_tag=True) + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", value="f", id_noexist_tag=True, t_add_tag=True) self._conn.insert_telnet_lines([input_sql]) tb_name3 = self.getNoIdTbName(stb_name) tdSql.query(f"select * from {stb_name}") @@ -853,16 +856,17 @@ class TDTestCase: tdCom.cleanTb() stb_name = tdCom.getLongName(7, "letters") tb_name = f'{stb_name}_1' - input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns' + + input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}",t0=t' self._conn.insert_telnet_lines([input_sql]) # * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2 - input_sql = f'{stb_name},t0=t,t1="{tdCom.getLongName(16374, "letters")}",t2="{tdCom.getLongName(5, "letters")}" c0=f 1626006833639000000ns' + input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1="{tdCom.getLongName(16374, "letters")}",t2="{tdCom.getLongName(5, "letters")}"' self._conn.insert_telnet_lines([input_sql]) tdSql.query(f"select * from {stb_name}") tdSql.checkRows(2) - input_sql = f'{stb_name},t0=t,t1="{tdCom.getLongName(16374, "letters")}",t2="{tdCom.getLongName(6, "letters")}" c0=f 1626006833639000000ns' + input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1="{tdCom.getLongName(16374, "letters")}",t2="{tdCom.getLongName(6, "letters")}"' try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -871,21 +875,6 @@ class TDTestCase: tdSql.query(f"select * from {stb_name}") tdSql.checkRows(2) - # # * check col,col+ts max in describe ---> 16143 - input_sql = f'{stb_name},t0=t c0=f,c1="{tdCom.getLongName(16374, "letters")}",c2="{tdCom.getLongName(16374, "letters")}",c3="{tdCom.getLongName(16374, "letters")}",c4="{tdCom.getLongName(12, "letters")}" 1626006833639000000ns' - self._conn.insert_telnet_lines([input_sql]) - - tdSql.query(f"select * from {stb_name}") - tdSql.checkRows(3) - input_sql = f'{stb_name},t0=t c0=f,c1="{tdCom.getLongName(16374, "letters")}",c2="{tdCom.getLongName(16374, "letters")}",c3="{tdCom.getLongName(16374, "letters")}",c4="{tdCom.getLongName(13, "letters")}" 1626006833639000000ns' - try: - self._conn.insert_telnet_lines([input_sql]) - raise Exception("should not reach here") - except LinesError as err: - tdSql.checkNotEqual(err.errno, 0) - tdSql.query(f"select * from {stb_name}") - tdSql.checkRows(3) - # * tag nchar max is 16374/4, col+ts nchar max 49151 def tagColNcharMaxLengthCheckCase(self): """ @@ -894,15 +883,15 @@ class TDTestCase: tdCom.cleanTb() stb_name = tdCom.getLongName(7, "letters") tb_name = f'{stb_name}_1' - input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns' - code = self._conn.insert_telnet_lines([input_sql]) + input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}",t0=t' + self._conn.insert_telnet_lines([input_sql]) # * legal nchar could not be larger than 16374/4 - input_sql = f'{stb_name},t0=t,t1=L"{tdCom.getLongName(4093, "letters")}",t2=L"{tdCom.getLongName(1, "letters")}" c0=f 1626006833639000000ns' + input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1=L"{tdCom.getLongName(4093, "letters")}",t2=L"{tdCom.getLongName(1, "letters")}"' self._conn.insert_telnet_lines([input_sql]) tdSql.query(f"select * from {stb_name}") tdSql.checkRows(2) - input_sql = f'{stb_name},t0=t,t1=L"{tdCom.getLongName(4093, "letters")}",t2=L"{tdCom.getLongName(2, "letters")}" c0=f 1626006833639000000ns' + input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1=L"{tdCom.getLongName(4093, "letters")}",t2=L"{tdCom.getLongName(2, "letters")}"' try: self._conn.insert_telnet_lines([input_sql]) raise Exception("should not reach here") @@ -911,19 +900,6 @@ class TDTestCase: tdSql.query(f"select * from {stb_name}") tdSql.checkRows(2) - input_sql = f'{stb_name},t0=t c0=f,c1=L"{tdCom.getLongName(4093, "letters")}",c2=L"{tdCom.getLongName(4093, "letters")}",c3=L"{tdCom.getLongName(4093, "letters")}",c4=L"{tdCom.getLongName(4, "letters")}" 1626006833639000000ns' - self._conn.insert_telnet_lines([input_sql]) - tdSql.query(f"select * from {stb_name}") - tdSql.checkRows(3) - input_sql = f'{stb_name},t0=t c0=f,c1=L"{tdCom.getLongName(4093, "letters")}",c2=L"{tdCom.getLongName(4093, "letters")}",c3=L"{tdCom.getLongName(4093, "letters")}",c4=L"{tdCom.getLongName(5, "letters")}" 1626006833639000000ns' - try: - self._conn.insert_telnet_lines([input_sql]) - raise Exception("should not reach here") - except LinesError as err: - tdSql.checkNotEqual(err.errno, 0) - tdSql.query(f"select * from {stb_name}") - tdSql.checkRows(3) - def batchInsertCheckCase(self): """ test batch insert @@ -931,17 +907,24 @@ class TDTestCase: tdCom.cleanTb() stb_name = tdCom.getLongName(8, "letters") tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') - lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", - "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns", - f"{stb_name},t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns", - "stf567890,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", - "st123456,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns", - f"{stb_name},t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns", - f"{stb_name},t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns", - "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", - "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" + + lines = ["st123456 1626006833639000000ns 1i64 t1=3i64,t2=4f64,t3=\"t3\"", + "st123456 1626006833640000000ns 2i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64", + f'{stb_name} 1626056811823316532ns 3i64 t2=5f64,t3=L\"ste\"', + "stf567890 1626006933640000000ns 4i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64", + "st123456 1626006833642000000ns 5i64 t1=4i64,t2=5f64,t3=\"t4\"", + f'{stb_name} 1626056811843316532ns 6i64 t2=5f64,t3=L\"ste2\"', + f'{stb_name} 1626056812843316532ns 7i64 t2=5f64,t3=L\"ste2\"', + "st123456 1626006933640000000ns 8i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64", + "st123456 1626006933641000000ns 9i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64" ] self._conn.insert_telnet_lines(lines) + tdSql.query('show stables') + tdSql.checkRows(3) + tdSql.query('show tables') + tdSql.checkRows(6) + tdSql.query('select * from st123456') + tdSql.checkRows(5) def multiInsertCheckCase(self, count): """ @@ -952,9 +935,11 @@ class TDTestCase: stb_name = tdCom.getLongName(8, "letters") tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') for i in range(count): - input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0] + input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0] sql_list.append(input_sql) self._conn.insert_telnet_lines(sql_list) + tdSql.query('show tables') + tdSql.checkRows(1000) def batchErrorInsertCheckCase(self): """ @@ -962,14 +947,86 @@ class TDTestCase: """ tdCom.cleanTb() stb_name = tdCom.getLongName(8, "letters") - lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", - f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"] + lines = ["st123456 1626006833639000000ns 3i64 t1=3i64,t2=4f64,t3=\"t3\"", + f"{stb_name} 1626056811823316532ns tRue t2=5f64,t3=L\"ste\""] try: self._conn.insert_telnet_lines(lines) raise Exception("should not reach here") except LinesError as err: tdSql.checkNotEqual(err.errno, 0) + def multiColsInsertCheckCase(self): + """ + test multi cols insert + """ + tdCom.cleanTb() + input_sql = self.genFullTypeSql(t_multi_tag=True)[0] + try: + self._conn.insert_telnet_lines([input_sql]) + raise Exception("should not reach here") + except LinesError as err: + tdSql.checkNotEqual(err.errno, 0) + + def blankColInsertCheckCase(self): + """ + test blank col insert + """ + tdCom.cleanTb() + input_sql = self.genFullTypeSql(c_blank_tag=True)[0] + try: + self._conn.insert_telnet_lines([input_sql]) + raise Exception("should not reach here") + except LinesError as err: + tdSql.checkNotEqual(err.errno, 0) + + def blankTagInsertCheckCase(self): + """ + test blank tag insert + """ + tdCom.cleanTb() + input_sql = self.genFullTypeSql(t_blank_tag=True)[0] + try: + self._conn.insert_telnet_lines([input_sql]) + raise Exception("should not reach here") + except LinesError as err: + tdSql.checkNotEqual(err.errno, 0) + + def chineseCheckCase(self): + """ + check nchar ---> chinese + """ + tdCom.cleanTb() + input_sql, stb_name = self.genFullTypeSql(chinese_tag=True) + self.resCmp(input_sql, stb_name) + + def multiFieldCheckCase(self): + ''' + multi_field + ''' + tdCom.cleanTb() + input_sql = self.genFullTypeSql(multi_field_tag=True)[0] + try: + self._conn.insert_telnet_lines([input_sql]) + raise Exception("should not reach here") + except LinesError as err: + tdSql.checkNotEqual(err.errno, 0) + + def errorTypeCheckCase(self): + stb_name = tdCom.getLongName(8, "letters") + input_sql_list = [f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127I8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \ + f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767I16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \ + f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647I32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \ + f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807I64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \ + f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345F32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \ + f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789F64,t7="vozamcts",t8=L"ncharTagValue"', \ + f'{stb_name} 1626006833639000000NS "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"'] + for input_sql in input_sql_list: + try: + self._conn.insert_telnet_lines([input_sql]) + raise Exception("should not reach here") + except LinesError as err: + tdSql.checkNotEqual(err.errno, 0) + def genSqlList(self, count=5, stb_name="", tb_name=""): """ stb --> supertable @@ -984,36 +1041,36 @@ class TDTestCase: """ d_stb_d_tb_list = list() s_stb_s_tb_list = list() - s_stb_s_tb_a_col_a_tag_list = list() - s_stb_s_tb_m_col_m_tag_list = list() + s_stb_s_tb_a_tag_list = list() + s_stb_s_tb_m_tag_list = list() s_stb_d_tb_list = list() - s_stb_d_tb_a_col_m_tag_list = list() - s_stb_d_tb_a_tag_m_col_list = list() + s_stb_d_tb_m_tag_list = list() + s_stb_d_tb_a_tag_list = list() s_stb_s_tb_d_ts_list = list() - s_stb_s_tb_d_ts_a_col_m_tag_list = list() - s_stb_s_tb_d_ts_a_tag_m_col_list = list() + s_stb_s_tb_d_ts_m_tag_list = list() + s_stb_s_tb_d_ts_a_tag_list = list() s_stb_d_tb_d_ts_list = list() - s_stb_d_tb_d_ts_a_col_m_tag_list = list() - s_stb_d_tb_d_ts_a_tag_m_col_list = list() + s_stb_d_tb_d_ts_m_tag_list = list() + s_stb_d_tb_d_ts_a_tag_list = list() for i in range(count): - d_stb_d_tb_list.append(self.genFullTypeSql(t0="f", c0="f")) - s_stb_s_tb_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"')) - s_stb_s_tb_a_col_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', ct_add_tag=True)) - s_stb_s_tb_m_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', ct_min_tag=True)) - s_stb_d_tb_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)) - s_stb_d_tb_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ct_am_tag=True)) - s_stb_d_tb_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ct_ma_tag=True)) - s_stb_s_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', ts=0)) - s_stb_s_tb_d_ts_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', ts=0, ct_am_tag=True)) - s_stb_s_tb_d_ts_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', ts=0, ct_ma_tag=True)) - s_stb_d_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0)) - s_stb_d_tb_d_ts_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, ct_am_tag=True)) - s_stb_d_tb_d_ts_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, ct_ma_tag=True)) - - return d_stb_d_tb_list, s_stb_s_tb_list, s_stb_s_tb_a_col_a_tag_list, s_stb_s_tb_m_col_m_tag_list, \ - s_stb_d_tb_list, s_stb_d_tb_a_col_m_tag_list, s_stb_d_tb_a_tag_m_col_list, s_stb_s_tb_d_ts_list, \ - s_stb_s_tb_d_ts_a_col_m_tag_list, s_stb_s_tb_d_ts_a_tag_m_col_list, s_stb_d_tb_d_ts_list, \ - s_stb_d_tb_d_ts_a_col_m_tag_list, s_stb_d_tb_d_ts_a_tag_m_col_list + d_stb_d_tb_list.append(self.genFullTypeSql(t0="f", value="f")) + s_stb_s_tb_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"')) + s_stb_s_tb_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', t_add_tag=True)) + s_stb_s_tb_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', t_mul_tag=True)) + s_stb_d_tb_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)) + s_stb_d_tb_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, t_mul_tag=True)) + s_stb_d_tb_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, t_add_tag=True)) + s_stb_s_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', ts=0)) + s_stb_s_tb_d_ts_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', ts=0, t_mul_tag=True)) + s_stb_s_tb_d_ts_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', ts=0, t_add_tag=True)) + s_stb_d_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0)) + s_stb_d_tb_d_ts_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, t_mul_tag=True)) + s_stb_d_tb_d_ts_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, t_add_tag=True)) + + return d_stb_d_tb_list, s_stb_s_tb_list, s_stb_s_tb_a_tag_list, s_stb_s_tb_m_tag_list, \ + s_stb_d_tb_list, s_stb_d_tb_m_tag_list, s_stb_d_tb_a_tag_list, s_stb_s_tb_d_ts_list, \ + s_stb_s_tb_d_ts_m_tag_list, s_stb_s_tb_d_ts_a_tag_list, s_stb_d_tb_d_ts_list, \ + s_stb_d_tb_d_ts_m_tag_list, s_stb_d_tb_d_ts_a_tag_list def genMultiThreadSeq(self, sql_list): @@ -1045,7 +1102,7 @@ class TDTestCase: """ tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) s_stb_s_tb_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[1] self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_list)) @@ -1056,16 +1113,16 @@ class TDTestCase: tdSql.query(f"select * from {stb_name};") tdSql.checkRows(1) - def sStbStbDdataAtcInsertMultiThreadCheckCase(self): + def sStbStbDdataAtInsertMultiThreadCheckCase(self): """ thread input same stb tb, different data, add columes and tags, result keep first data """ tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_s_tb_a_col_a_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[2] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_a_col_a_tag_list)) + s_stb_s_tb_a_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[2] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_a_tag_list)) tdSql.query(f"show tables;") tdSql.checkRows(1) expected_tb_name = self.getNoIdTbName(stb_name)[0] @@ -1073,16 +1130,16 @@ class TDTestCase: tdSql.query(f"select * from {stb_name};") tdSql.checkRows(1) - def sStbStbDdataMtcInsertMultiThreadCheckCase(self): + def sStbStbDdataMtInsertMultiThreadCheckCase(self): """ thread input same stb tb, different data, minus columes and tags, result keep first data """ tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_s_tb_m_col_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[3] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_m_col_m_tag_list)) + s_stb_s_tb_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[3] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_m_tag_list)) tdSql.query(f"show tables;") tdSql.checkRows(1) expected_tb_name = self.getNoIdTbName(stb_name)[0] @@ -1095,40 +1152,38 @@ class TDTestCase: thread input same stb, different tb, different data """ tdCom.cleanTb() - input_sql, stb_name = self.genFullTypeSql() + input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4] self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_list)) tdSql.query(f"show tables;") tdSql.checkRows(6) - def sStbDtbDdataAcMtInsertMultiThreadCheckCase(self): - """ - #! concurrency conflict - """ + def sStbDtbDdataMtInsertMultiThreadCheckCase(self): """ thread input same stb, different tb, different data, add col, mul tag """ tdCom.cleanTb() - input_sql, stb_name = self.genFullTypeSql() + input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_d_tb_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[5] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_col_m_tag_list)) + s_stb_d_tb_m_tag_list = [(f'{stb_name} 1626006833639000000ns "omfdhyom" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \ + (f'{stb_name} 1626006833639000000ns "vqowydbc" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \ + (f'{stb_name} 1626006833639000000ns "plgkckpv" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \ + (f'{stb_name} 1626006833639000000ns "cujyqvlj" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \ + (f'{stb_name} 1626006833639000000ns "twjxisat" t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz')] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_m_tag_list)) tdSql.query(f"show tables;") - tdSql.checkRows(6) + tdSql.checkRows(3) - def sStbDtbDdataAtMcInsertMultiThreadCheckCase(self): - """ - #! concurrency conflict - """ + def sStbDtbDdataAtInsertMultiThreadCheckCase(self): """ thread input same stb, different tb, different data, add tag, mul col """ tdCom.cleanTb() - input_sql, stb_name = self.genFullTypeSql() + input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_d_tb_a_tag_m_col_list = self.genSqlList(stb_name=stb_name)[6] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_tag_m_col_list)) + s_stb_d_tb_a_tag_list = self.genSqlList(stb_name=stb_name)[6] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_tag_list)) tdSql.query(f"show tables;") tdSql.checkRows(6) @@ -1138,89 +1193,94 @@ class TDTestCase: """ tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_s_tb_d_ts_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[7] + s_stb_s_tb_d_ts_list = [(f'{stb_name} 0 "hkgjiwdj" id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', 'dwpthv'), \ + (f'{stb_name} 0 "rljjrrul" id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="bmcanhbs",t8=L"ncharTagValue"', 'dwpthv'), \ + (f'{stb_name} 0 "basanglx" id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="enqkyvmb",t8=L"ncharTagValue"', 'dwpthv'), \ + (f'{stb_name} 0 "clsajzpp" id="{tb_name}",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="eivaegjk",t8=L"ncharTagValue"', 'dwpthv'), \ + (f'{stb_name} 0 "jitwseso" id="{tb_name}",t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="yhlwkddq",t8=L"ncharTagValue"', 'dwpthv')] self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_list)) tdSql.query(f"show tables;") tdSql.checkRows(1) tdSql.query(f"select * from {stb_name}") tdSql.checkRows(6) - def sStbStbDdataDtsAcMtInsertMultiThreadCheckCase(self): + def sStbStbDdataDtsMtInsertMultiThreadCheckCase(self): """ thread input same stb tb, different ts, add col, mul tag """ tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_s_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[8] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_col_m_tag_list)) + s_stb_s_tb_d_ts_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[8] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_m_tag_list)) tdSql.query(f"show tables;") tdSql.checkRows(1) tdSql.query(f"select * from {stb_name}") tdSql.checkRows(6) tdSql.query(f"select * from {stb_name} where t8 is not NULL") tdSql.checkRows(6) - tdSql.query(f"select * from {tb_name} where c11 is not NULL;") - tdSql.checkRows(5) - def sStbStbDdataDtsAtMcInsertMultiThreadCheckCase(self): + def sStbStbDdataDtsAtInsertMultiThreadCheckCase(self): """ thread input same stb tb, different ts, add tag, mul col """ tdCom.cleanTb() tb_name = tdCom.getLongName(7, "letters") - input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_s_tb_d_ts_a_tag_m_col_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[9] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_tag_m_col_list)) + s_stb_s_tb_d_ts_a_tag_list = [(f'{stb_name} 0 "clummqfy" id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="hpxzrdiw",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \ + (f'{stb_name} 0 "yqeztggb" id="{tb_name}",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="gdtblmrc",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \ + (f'{stb_name} 0 "gbkinqdk" id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="iqniuvco",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \ + (f'{stb_name} 0 "ldxxejbd" id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vxkipags",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \ + (f'{stb_name} 0 "tlvzwjes" id="{tb_name}",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="enwrlrtj",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl')] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_tag_list)) tdSql.query(f"show tables;") tdSql.checkRows(1) tdSql.query(f"select * from {stb_name}") tdSql.checkRows(6) - for c in ["c7", "c8", "c9"]: - tdSql.query(f"select * from {stb_name} where {c} is NULL") - tdSql.checkRows(5) for t in ["t10", "t11"]: tdSql.query(f"select * from {stb_name} where {t} is not NULL;") - tdSql.checkRows(6) + tdSql.checkRows(0) def sStbDtbDdataDtsInsertMultiThreadCheckCase(self): """ thread input same stb, different tb, data, ts """ tdCom.cleanTb() - input_sql, stb_name = self.genFullTypeSql() + input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10] self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_list)) tdSql.query(f"show tables;") tdSql.checkRows(6) - def sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase(self): - """ - # ! concurrency conflict - """ + def sStbDtbDdataDtsMtInsertMultiThreadCheckCase(self): """ thread input same stb, different tb, data, ts, add col, mul tag """ tdCom.cleanTb() - input_sql, stb_name = self.genFullTypeSql() + input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") self.resCmp(input_sql, stb_name) - s_stb_d_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[11] - self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_a_col_m_tag_list)) + s_stb_d_tb_d_ts_m_tag_list = [(f'{stb_name} 0 "mnpmtzul" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \ + (f'{stb_name} 0 "zbvwckcd" t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \ + (f'{stb_name} 0 "vymcjfwc" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \ + (f'{stb_name} 0 "laumkwfn" t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \ + (f'{stb_name} 0 "nyultzxr" t0=false,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg')] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_m_tag_list)) tdSql.query(f"show tables;") - tdSql.checkRows(6) - + tdSql.checkRows(3) def test(self): # input_sql1 = "stb2_5 1626006833610ms 3f64 host=\"host0\",host2=L\"host2\"" # input_sql2 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 1626006933640000000ns" try: - input_sql, stb_name = self.genFullTypeSql() - self.resCmp(input_sql, stb_name) + input_sql = f'test_nchar 0 L"涛思数据" t0=f,t1=L"涛思数据",t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64' + self._conn.insert_telnet_lines([input_sql]) + # input_sql, stb_name = self.genFullTypeSql() + # self.resCmp(input_sql, stb_name) except LinesError as err: print(err.errno) # self._conn.insert_telnet_lines([input_sql2]) @@ -1232,68 +1292,64 @@ class TDTestCase: # self._conn.insert_telnet_lines([input_sql4]) def runAll(self): - # self.initCheckCase() - # self.boolTypeCheckCase() - self.symbolsCheckCase() - - - - - # self.tsCheckCase() - # self.idSeqCheckCase() - # self.idUpperCheckCase() - # self.noIdCheckCase() - # self.maxColTagCheckCase() - - # self.idIllegalNameCheckCase() - # self.idStartWithNumCheckCase() - # self.nowTsCheckCase() - # self.dateFormatTsCheckCase() - # self.illegalTsCheckCase() - # self.tagValueLengthCheckCase() - # self.colValueLengthCheckCase() - # self.tagColIllegalValueCheckCase() - # self.duplicateIdTagColInsertCheckCase() - # self.noIdStbExistCheckCase() - # self.duplicateInsertExistCheckCase() - # self.tagColBinaryNcharLengthCheckCase() - # self.tagColAddDupIDCheckCase() - # self.tagColAddCheckCase() - # self.tagMd5Check() - # self.tagColBinaryMaxLengthCheckCase() - # # self.tagColNcharMaxLengthCheckCase() - # self.batchInsertCheckCase() - # self.multiInsertCheckCase(1000) - # self.batchErrorInsertCheckCase() - # # MultiThreads + self.initCheckCase() + self.boolTypeCheckCase() + # ! leave a bug + #self.symbolsCheckCase() + self.tsCheckCase() + self.idSeqCheckCase() + self.idUpperCheckCase() + self.noIdCheckCase() + self.maxColTagCheckCase() + + self.idIllegalNameCheckCase() + self.idStartWithNumCheckCase() + self.nowTsCheckCase() + self.dateFormatTsCheckCase() + self.illegalTsCheckCase() + self.tagValueLengthCheckCase() + self.colValueLengthCheckCase() + self.tagColIllegalValueCheckCase() + self.duplicateIdTagColInsertCheckCase() + self.noIdStbExistCheckCase() + self.duplicateInsertExistCheckCase() + self.tagColBinaryNcharLengthCheckCase() + self.tagColAddDupIDCheckCase() + self.tagColAddCheckCase() + self.tagMd5Check() + self.tagColBinaryMaxLengthCheckCase() + self.tagColNcharMaxLengthCheckCase() + + self.batchInsertCheckCase() + self.multiInsertCheckCase(1000) + self.batchErrorInsertCheckCase() + self.multiColsInsertCheckCase() + self.blankColInsertCheckCase() + self.blankTagInsertCheckCase() + self.chineseCheckCase() + self.multiFieldCheckCase() + self.errorTypeCheckCase() + # MultiThreads # self.stbInsertMultiThreadCheckCase() # self.sStbStbDdataInsertMultiThreadCheckCase() - # self.sStbStbDdataAtcInsertMultiThreadCheckCase() - # self.sStbStbDdataMtcInsertMultiThreadCheckCase() + # self.sStbStbDdataAtInsertMultiThreadCheckCase() + # self.sStbStbDdataMtInsertMultiThreadCheckCase() # self.sStbDtbDdataInsertMultiThreadCheckCase() - - # # # ! concurrency conflict - # # self.sStbDtbDdataAcMtInsertMultiThreadCheckCase() - # # self.sStbDtbDdataAtMcInsertMultiThreadCheckCase() - + # self.sStbDtbDdataMtInsertMultiThreadCheckCase() + # self.sStbDtbDdataAtInsertMultiThreadCheckCase() # self.sStbStbDdataDtsInsertMultiThreadCheckCase() - - # # # ! concurrency conflict - # # self.sStbStbDdataDtsAcMtInsertMultiThreadCheckCase() - # # self.sStbStbDdataDtsAtMcInsertMultiThreadCheckCase() - + # self.sStbStbDdataDtsMtInsertMultiThreadCheckCase() + # self.sStbStbDdataDtsAtInsertMultiThreadCheckCase() # self.sStbDtbDdataDtsInsertMultiThreadCheckCase() - - # # ! concurrency conflict - # # self.sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase() - - + # self.sStbDtbDdataDtsMtInsertMultiThreadCheckCase() def run(self): print("running {}".format(__file__)) self.createDb() try: + # self.symbolsCheckCase() self.runAll() + # self.test() except Exception as err: print(''.join(traceback.format_exception(None, err, err.__traceback__))) raise err diff --git a/tests/pytest/manualTest/TD-5114/continueCreateDn.py b/tests/pytest/manualTest/TD-5114/continueCreateDn.py index 4b724f0587a6a2bbe3f477e8a47e283c0924a29e..9494ee5f3685d3ddaeb1848a58878d63fa7a54b6 100644 --- a/tests/pytest/manualTest/TD-5114/continueCreateDn.py +++ b/tests/pytest/manualTest/TD-5114/continueCreateDn.py @@ -42,7 +42,7 @@ class TwoClients: tdSql.execute("drop database if exists db3") - # insert data with taosc + # insert data with c connector for i in range(10): os.system("taosdemo -f manualTest/TD-5114/insertDataDb3Replica2.json -y ") # # check data correct diff --git a/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.json b/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.json index 265f42036bc5a4e13dc0766b66fccf32924d7185..ad85f9607b72c5d4562266508bfdcf68837c33bd 100644 --- a/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.json +++ b/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py b/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py index 7f551bcefd152007ebab7a1bc7d110468b69115a..5477223aad0262cf2874496481bc5d138fb3d2cf 100644 --- a/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py +++ b/tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py @@ -13,6 +13,7 @@ import sys import os +import time from util.log import * from util.cases import * from util.sql import * @@ -24,6 +25,9 @@ class TDTestCase: tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) + now = time.time() + self.ts = int(round(now * 1000)) + def getBuildPath(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -50,6 +54,7 @@ class TDTestCase: # insert: create one or mutiple tables per sql and insert multiple rows per sql # test case for https://jira.taosdata.com:18080/browse/TD-4985 + os.system("rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql") os.system("%staosdemo -f tools/taosdemoAllTest/TD-4985/query-limit-offset.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") @@ -57,25 +62,25 @@ class TDTestCase: for i in range(1000): tdSql.execute('''insert into stb00_9999 values(%d, %d, %d,'test99.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_8888 values(%d, %d, %d,'test98.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_7777 values(%d, %d, %d,'test97.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_6666 values(%d, %d, %d,'test96.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_5555 values(%d, %d, %d,'test95.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_4444 values(%d, %d, %d,'test94.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_3333 values(%d, %d, %d,'test93.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_2222 values(%d, %d, %d,'test92.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_1111 values(%d, %d, %d,'test91.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.execute('''insert into stb00_100 values(%d, %d, %d,'test90.%s')''' - % (1600000000000 + i, i, -10000+i, i)) + % (self.ts + i, i, -10000+i, i)) tdSql.query("select * from stb0 where c2 like 'test99%' ") tdSql.checkRows(1000) tdSql.query("select * from stb0 where tbname like 'stb00_9999' limit 10" ) @@ -176,7 +181,7 @@ class TDTestCase: tdSql.checkData(0, 1, 5) tdSql.checkData(1, 1, 6) tdSql.checkData(2, 1, 7) - os.system("rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql") + def stop(self): tdSql.close() diff --git a/tests/pytest/tsdb/tsdbCompClusterReplica2.py b/tests/pytest/tsdb/tsdbCompClusterReplica2.py index 2e016deea0b78d6cf9f76a917ca49fc2c5744a6e..cfda271497cde59e8dbe60150ddf935ba63fd9be 100644 --- a/tests/pytest/tsdb/tsdbCompClusterReplica2.py +++ b/tests/pytest/tsdb/tsdbCompClusterReplica2.py @@ -24,7 +24,7 @@ from random import choice class TwoClients: def initConnection(self): - self.host = "chenhaoran02" + self.host = "chenhaoran01" self.user = "root" self.password = "taosdata" self.config = "/etc/taos/" @@ -116,8 +116,10 @@ class TwoClients: sleep(3) tdSql.execute(" drop dnode 'chenhaoran02:6030'; ") sleep(20) - os.system("rm -rf /var/lib/taos/*") + # remove data file; + os.system("rm -rf /home/chr/data/data0/*") print("clear dnode chenhaoran02'data files") + sleep(5) os.system("nohup /usr/bin/taosd > /dev/null 2>&1 &") print("start taosd") sleep(10) diff --git a/tests/script/general/parser/regex.sim b/tests/script/general/parser/regex.sim index 5351d914f34004b5bf198fb9e10792306f8ac32b..eed36018d4c04ec5752e64105d025347982bfcb0 100644 --- a/tests/script/general/parser/regex.sim +++ b/tests/script/general/parser/regex.sim @@ -29,13 +29,22 @@ endi sql select tbname from $st_name where tbname match '^ct[[:digit:]]' - if $rows != 2 then return -1 endi +sql select tbname from $st_name where tbname nmatch '^ct[[:digit:]]' +if $rows != 1 then + return -1 +endi + sql select tbname from $st_name where tbname match '.*' -if $rows !=3 then +if $rows != 3 then + return -1 +endi + +sql select tbname from $st_name where tbname nmatch '.*' +if $rows != 0 then return -1 endi @@ -44,6 +53,11 @@ if $rows != 2 then return -1 endi +sql select tbname from $st_name where t1b nmatch '[[:lower:]]+' +if $rows != 1 then + return -1 +endi + sql insert into $ct1_name values(now, 'this is engine') sql insert into $ct2_name values(now, 'this is app egnine') @@ -56,6 +70,52 @@ if $rows != 1 then return -1 endi +sql select c1b from $st_name where c1b nmatch 'engine' +if $data00 != @this is app egnine@ then + return -1 +endi + +if $rows != 1 then + return -1 +endi + +sql_error select c1b from $st_name where c1b match e; +sql_error select c1b from $st_name where c1b nmatch e; + +sql create table wrong_type(ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 float, c5 double, c6 bool, c7 nchar(20)) tags(t0 tinyint, t1 smallint, t2 int, t3 bigint, t4 float, t5 double, t6 bool, t7 nchar(10)) +sql insert into wrong_type_1 using wrong_type tags(1, 2, 3, 4, 5, 6, true, 'notsupport') values(now, 1, 2, 3, 4, 5, 6, false, 'notsupport') +sql_error select * from wrong_type where ts match '.*' +sql_error select * from wrong_type where ts nmatch '.*' +sql_error select * from wrong_type where c0 match '.*' +sql_error select * from wrong_type where c0 nmatch '.*' +sql_error select * from wrong_type where c1 match '.*' +sql_error select * from wrong_type where c1 nmatch '.*' +sql_error select * from wrong_type where c2 match '.*' +sql_error select * from wrong_type where c2 nmatch '.*' +sql_error select * from wrong_type where c3 match '.*' +sql_error select * from wrong_type where c3 nmatch '.*' +sql_error select * from wrong_type where c4 match '.*' +sql_error select * from wrong_type where c4 nmatch '.*' +sql_error select * from wrong_type where c5 match '.*' +sql_error select * from wrong_type where c5 nmatch '.*' +sql_error select * from wrong_type where c6 match '.*' +sql_error select * from wrong_type where c6 nmatch '.*' +sql_error select * from wrong_type where c7 match '.*' +sql_error select * from wrong_type where c7 nmatch '.*' +sql_error select * from wrong_type where t1 match '.*' +sql_error select * from wrong_type where t1 nmatch '.*' +sql_error select * from wrong_type where t2 match '.*' +sql_error select * from wrong_type where t2 nmatch '.*' +sql_error select * from wrong_type where t3 match '.*' +sql_error select * from wrong_type where t3 nmatch '.*' +sql_error select * from wrong_type where t4 match '.*' +sql_error select * from wrong_type where t4 nmatch '.*' +sql_error select * from wrong_type where t5 match '.*' +sql_error select * from wrong_type where t5 nmatch '.*' +sql_error select * from wrong_type where t6 match '.*' +sql_error select * from wrong_type where t6 nmatch '.*' +sql_error select * from wrong_type where t7 match '.*' +sql_error select * from wrong_type where t7 nmatch '.*' system sh/exec.sh -n dnode1 -s stop -x SIGINT