diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index c2961d62415cd7d23b031777082801426b221190..0af8c36f669ea1de988ce200ce11037d85674c26 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -20,20 +20,20 @@ CREATE DATABASE [IF NOT EXISTS] db_name [KEEP keep] [DAYS days] [UPDATE 1]; 3. The maximum length of database name is 33 bytes. 4. The maximum length of a SQL statement is 65,480 bytes. 5. Below are the parameters that can be used when creating a database - - cache: [Description](/reference/config/#cache) - - blocks: [Description](/reference/config/#blocks) - - days: [Description](/reference/config/#days) - - keep: [Description](/reference/config/#keep) - - minRows: [Description](/reference/config/#minrows) - - maxRows: [Description](/reference/config/#maxrows) - - wal: [Description](/reference/config/#wallevel) - - fsync: [Description](/reference/config/#fsync) - - update: [Description](/reference/config/#update) - - cacheLast: [Description](/reference/config/#cachelast) - - replica: [Description](/reference/config/#replica) - - quorum: [Description](/reference/config/#quorum) - - comp: [Description](/reference/config/#comp) - - precision: [Description](/reference/config/#precision) + - cache: [Description](../../reference/config/#cache) + - blocks: [Description](../../reference/config/#blocks) + - days: [Description](../../reference/config/#days) + - keep: [Description](../../reference/config/#keep) + - minRows: [Description](../../reference/config/#minrows) + - maxRows: [Description](../../reference/config/#maxrows) + - wal: [Description](../../reference/config/#wallevel) + - fsync: [Description](../../reference/config/#fsync) + - update: [Description](../../reference/config/#update) + - cacheLast: [Description](../../reference/config/#cachelast) + - replica: [Description](../../reference/config/#replica) + - quorum: [Description](../../reference/config/#quorum) + - comp: [Description](../../reference/config/#comp) + - precision: [Description](../../reference/config/#precision) 6. Please note that all of the parameters mentioned in this section are configured in configuration file `taos.cfg` on the TDengine server. If not specified in the `create database` statement, the values from taos.cfg are used by default. To override default parameters, they must be specified in the `create database` statement. ::: diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index 86ff5a58ce31a357d6e247294ffdac791cb0c032..c49fb428ef0c93f52b5e4048f5e05ad807910adf 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -191,7 +191,7 @@ Query OK, 1 row(s) in set (0.000921s) SELECT MODE(field_name) FROM tb_name [WHERE clause]; ``` -**Description**:The value which has the highest frequency of occurrence. NULL is returned if there are multiple values which have highest frequency of occurrence. It can't be used on timestamp column or tags. +**Description**:The value which has the highest frequency of occurrence. One random value is returned if there are multiple values which have highest frequency of occurrence. It can't be used on timestamp column or tags. **Return value type**:Same as the data type of the column being operated upon diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md index 0951717f5ae5f17676bd4aaefcd24f0da829c12c..61d97f3fc25bb4e49650b2a1ecb46d7bfbd8e7b5 100644 --- a/docs/en/14-reference/05-taosbenchmark.md +++ b/docs/en/14-reference/05-taosbenchmark.md @@ -234,7 +234,7 @@ The parameters related to database creation are configured in `dbinfo` in the js - **name**: specify the name of the database. -- **drop**: indicate whether to delete the database before inserting. The default is true. +- **drop**: indicate whether to delete the database before inserting. The value can be 'yes' or 'no'. No means do not drop. The default is to drop. - **replica**: specify the number of replicas when creating the database. diff --git a/docs/en/14-reference/_telegraf.mdx b/docs/en/14-reference/_telegraf.mdx index e32fb256936a5f2c00bbb3f37529e895d260fc5c..bcf1a0893fff7c06127da9e8117a778a76bfb0d9 100644 --- a/docs/en/14-reference/_telegraf.mdx +++ b/docs/en/14-reference/_telegraf.mdx @@ -22,5 +22,4 @@ An example is as follows. username = "root" password = "taosdata" data_format = "influx" - influx_max_line_bytes = 250 ``` diff --git a/docs/en/25-application/01-telegraf.md b/docs/en/25-application/01-telegraf.md index d30a23fe1b942e1411e8b5f1320e1c54ae2b407f..f535344236415fc44e6246daa62f04d2b5bbc0f5 100644 --- a/docs/en/25-application/01-telegraf.md +++ b/docs/en/25-application/01-telegraf.md @@ -60,7 +60,6 @@ For the configuration method, add the following text to `/etc/telegraf/telegraf. username = "" password = "" data_format = "influx" - influx_max_line_bytes = 250 ``` Then restart telegraf: diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index e3a0aa7c87461fd1621a38093871a1542e3dbf98..ebe6a66a2ab0b36845e39021c9c278599a736c64 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -20,20 +20,20 @@ CREATE DATABASE [IF NOT EXISTS] db_name [KEEP keep] [DAYS days] [UPDATE 1]; 3. 数据库名最大长度为 33; 4. 一条 SQL 语句的最大长度为 65480 个字符; 5. 创建数据库时可用的参数有: - - cache: [详细说明](/reference/config/#cache) - - blocks: [详细说明](/reference/config/#blocks) - - days: [详细说明](/reference/config/#days) - - keep: [详细说明](/reference/config/#keep) - - minRows: [详细说明](/reference/config/#minrows) - - maxRows: [详细说明](/reference/config/#maxrows) - - wal: [详细说明](/reference/config/#wallevel) - - fsync: [详细说明](/reference/config/#fsync) - - update: [详细说明](/reference/config/#update) - - cacheLast: [详细说明](/reference/config/#cachelast) - - replica: [详细说明](/reference/config/#replica) - - quorum: [详细说明](/reference/config/#quorum) - - comp: [详细说明](/reference/config/#comp) - - precision: [详细说明](/reference/config/#precision) + - cache: [详细说明](../../reference/config/#cache) + - blocks: [详细说明](../../reference/config/#blocks) + - days: [详细说明](../../reference/config/#days) + - keep: [详细说明](../../reference/config/#keep) + - minRows: [详细说明](../../reference/config/#minrows) + - maxRows: [详细说明](../../reference/config/#maxrows) + - wal: [详细说明](../../reference/config/#wallevel) + - fsync: [详细说明](../../reference/config/#fsync) + - update: [详细说明](../../reference/config/#update) + - cacheLast: [详细说明](../../reference/config/#cachelast) + - replica: [详细说明](../../reference/config/#replica) + - quorum: [详细说明](../../reference/config/#quorum) + - comp: [详细说明](../../reference/config/#comp) + - precision: [详细说明](../../reference/config/#precision) 6. 请注意上面列出的所有参数都可以配置在配置文件 `taosd.cfg` 中作为创建数据库时使用的默认配置, `create database` 的参数中明确指定的会覆盖配置文件中的设置。 ::: @@ -86,7 +86,7 @@ REPLICA 参数是指修改数据库副本数,取值范围 [1, 3]。在集群 ALTER DATABASE db_name KEEP 365; ``` -KEEP 参数是指修改数据文件保存的天数,缺省值为 3650,取值范围 [days, 365000],必须大于或等于 days 参数值。 +KEEP 参数是指修改数据文件保存的天数,缺省值为 3650,取值范围 [days, 36500],必须大于或等于 days 参数值。 ``` ALTER DATABASE db_name QUORUM 2; diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 2349e6aa3c02eb62fba1fc7e4eef15e08e3924d1..c134a54a532f222e7eb5bb2e5d6969966f49d433 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -193,7 +193,7 @@ Query OK, 1 row(s) in set (0.000921s) SELECT MODE(field_name) FROM tb_name [WHERE clause]; ``` -**功能说明**:返回出现频率最高的值,若存在多个频率相同的最高值,输出空。不能匹配标签、时间戳输出。 +**功能说明**:返回出现频率最高的值,若存在多个频率相同的最高值,则随机输出其中某个值。不能匹配标签、时间戳输出。 **返回数据类型**:同应用的字段。 diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index 6b694543b1db435f507b5e2fb325cebe76261b48..a4d8df6f56be94c0962e1e40f615c0532ed2281f 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -231,7 +231,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **name** : 数据库名。 -- **drop** : 插入前是否删除数据库,默认为 true。 +- **drop** : 插入前是否删除数据库,可选项为 "yes" 或者 "no", 为 "no" 时不创建。默认删除。 - **replica** : 创建数据库时指定的副本数。 diff --git a/docs/zh/14-reference/_telegraf.mdx b/docs/zh/14-reference/_telegraf.mdx index bae46d66062ad7d5bfc2487900c02bd7a19ce4f6..3f92e5dde03ef2d59d4e14cb47e82fbd71f290d2 100644 --- a/docs/zh/14-reference/_telegraf.mdx +++ b/docs/zh/14-reference/_telegraf.mdx @@ -22,6 +22,5 @@ username = "root" password = "taosdata" data_format = "influx" - influx_max_line_bytes = 250 ``` diff --git a/docs/zh/25-application/01-telegraf.md b/docs/zh/25-application/01-telegraf.md index 95df8699ef85b02d6e9dba398c787644fc9089b2..4a15f31af33709844f51f8fd8d297ef7050337d5 100644 --- a/docs/zh/25-application/01-telegraf.md +++ b/docs/zh/25-application/01-telegraf.md @@ -60,7 +60,6 @@ IT 运维监测数据通常都是对时间特性比较敏感的数据,例如 username = "" password = "" data_format = "influx" - influx_max_line_bytes = 250 ``` 然后重启 Telegraf: diff --git a/packaging/docker/bin/entrypoint.sh b/packaging/docker/bin/entrypoint.sh index 5fb441004d8b454de1039eb3f4b23eb51f32be64..27bd25430bffe288591f22a5207307b00193ffa8 100755 --- a/packaging/docker/bin/entrypoint.sh +++ b/packaging/docker/bin/entrypoint.sh @@ -35,6 +35,9 @@ FIRST_EP_PORT=${TAOS_FIRST_EP#*:} SERVER_PORT=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep serverPort | tail -n1 | sed -E 's/.*serverPort\s+//') SERVER_PORT=${SERVER_PORT:-6030} +# parse dataDir from taos.cfg +DATA_DIR=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep dataDir | tail -n1 | sed -E 's/.*dataDir\s+//') + # for other binaries like interpreters if echo $1 | grep -E "taosd$" - >/dev/null; then true # will run taosd diff --git a/packaging/release.sh b/packaging/release.sh index 0ad8d9b1bfaa09a4be51c8448c2494feff2cdbf7..117be9911a74b2ae971e3b45ee759a8981c9773c 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -3,7 +3,7 @@ # Generate the deb package for ubuntu, or rpm package for centos, or tar.gz package for other linux os set -e -#set -x +# set -x # release.sh -v [cluster | edge] # -c [aarch32 | aarch64 | x64 | x86 | mips64 ...] @@ -263,7 +263,7 @@ if [ "$osType" != "Darwin" ]; then if [[ "$pagMode" == "full" ]]; then if [ -d ${top_dir}/src/kit/taos-tools/packaging/deb ]; then cd ${top_dir}/src/kit/taos-tools/packaging/deb - taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}') + taos_tools_ver=$(git tag |grep -v taos | sort | tail -1) [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0" ${csudo}./make-taos-tools-deb.sh ${top_dir} \ @@ -288,7 +288,7 @@ if [ "$osType" != "Darwin" ]; then if [[ "$pagMode" == "full" ]]; then if [ -d ${top_dir}/src/kit/taos-tools/packaging/rpm ]; then cd ${top_dir}/src/kit/taos-tools/packaging/rpm - taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}' | sed -e 's/-/_/g') + taos_tools_ver=$(git tag |grep -v taos | sort | tail -1) [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0" ${csudo}./make-taos-tools-rpm.sh ${top_dir} \ diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index d74a962210318f59f4afc9a369f95503b342bbd2..6e64d77525f33c41b1c0af05ab624f9d15bdbf43 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -105,6 +105,10 @@ elif echo $osinfo | grep -qwi "debian"; then elif echo $osinfo | grep -qwi "Kylin"; then # echo "This is Kylin system" os_type=1 +elif echo $osinfo | grep -qwi "KylinSec"; then + # echo "This is KylinSec system" + os_type=2 + csudo="" elif echo $osinfo | grep -qwi "Red"; then # echo "This is Red Hat system" os_type=1 diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 8c45b0a7d12485d3e95554f7d2223790366f3401..b93ea11f45dfde847970bd4cfe0d5b6685d3a910 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -47,7 +47,7 @@ if [ -d ${top_dir}/src/kit/taos-tools/packaging/deb ]; then cd ${top_dir}/src/kit/taos-tools/packaging/deb [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0" - taostools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}') + taostools_ver=$(git tag |grep -v taos | sort | tail -1) taostools_install_dir="${release_dir}/${clientName}Tools-${taostools_ver}" cd ${curr_dir} diff --git a/src/client/inc/tscParseLine.h b/src/client/inc/tscParseLine.h index 30a316210c3d58539d3f6d0a5fb55fdd24108fad..8e84d0831d2b34f46845c09a5e1e49b68784d37a 100644 --- a/src/client/inc/tscParseLine.h +++ b/src/client/inc/tscParseLine.h @@ -103,11 +103,11 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, void destroySmlDataPoint(TAOS_SML_DATA_POINT* point); -int taos_insert_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType protocol, +int taos_insert_lines(TAOS* taos, char* data, int32_t len, char* lines[], int *numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows); -int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType protocol, +int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[], int *numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows); -int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol, +int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol, int *numLines, SMLTimeStampType tsType, int* affectedRows); diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index c1bdbce91dacd413da79d2ac4ac4af12def2ab06..3d61b9e3fcf2bd74a5e757a6107613ec6fcea5ea 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -577,7 +577,9 @@ static int32_t getSuperTableMetaFromLocalCache(TAOS* taos, char* tableName, STab // Check if the table name available or not if (tscValidateName(&tableToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) { code = TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; - sprintf(pSql->cmd.payload, "table name is invalid"); + if(pSql->cmd.payload){ + sprintf(pSql->cmd.payload, "table name is invalid"); + } taosReleaseRef(tscObjRef, pSql->self); return code; } @@ -755,25 +757,25 @@ static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int nu SHashObj* cname2points, SArray* stableSchemas, SSmlLinesInfo* info) { for (int32_t i = 0; i < numPoints; ++i) { TAOS_SML_DATA_POINT * point = points + i; - SSmlSTableSchema* stableSchema = taosArrayGet(stableSchemas, point->schemaIdx); - - for (int j = 0; j < point->tagNum; ++j) { - TAOS_SML_KV* kv = point->tags + j; - if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { - int64_t ts = *(int64_t*)(kv->value); - ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, stableSchema->precision); - *(int64_t*)(kv->value) = ts; - } - } - - for (int j = 0; j < point->fieldNum; ++j) { - TAOS_SML_KV* kv = point->fields + j; - if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { - int64_t ts = *(int64_t*)(kv->value); - ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, stableSchema->precision); - *(int64_t*)(kv->value) = ts; - } - } +// SSmlSTableSchema* stableSchema = taosArrayGet(stableSchemas, point->schemaIdx); + +// for (int j = 0; j < point->tagNum; ++j) { +// TAOS_SML_KV* kv = point->tags + j; +// if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { +// int64_t ts = *(int64_t*)(kv->value); +// ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, stableSchema->precision); +// *(int64_t*)(kv->value) = ts; +// } +// } +// +// for (int j = 0; j < point->fieldNum; ++j) { +// TAOS_SML_KV* kv = point->fields + j; +// if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { +// int64_t ts = *(int64_t*)(kv->value); +// ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, stableSchema->precision); +// *(int64_t*)(kv->value) = ts; +// } +// } SArray* cTablePoints = NULL; SArray** pCTablePoints = taosHashGet(cname2points, point->childTableName, strlen(point->childTableName)); @@ -858,7 +860,14 @@ static int32_t addChildTableDataPointsToInsertSql(char* cTableName, char* sTable TAOS_SML_KV* kv = tagKVs[i]; size_t beforeLen = totalLen; int32_t len = 0; - converToStr(sql + beforeLen, kv->type, kv->value, kv->length, &len); + + if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { + int64_t ts = *(int64_t*)(kv->value); + ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, sTableSchema->precision); + converToStr(sql + beforeLen, kv->type, &ts, kv->length, &len); + }else{ + converToStr(sql + beforeLen, kv->type, kv->value, kv->length, &len); + } totalLen += len; ret = smlSnprintf(sql, &totalLen, capacity, ","); @@ -912,7 +921,13 @@ static int32_t addChildTableDataPointsToInsertSql(char* cTableName, char* sTable TAOS_SML_KV* kv = colKVs[i]; size_t beforeLen = totalLen; int32_t len = 0; - converToStr(sql + beforeLen, kv->type, kv->value, kv->length, &len); + if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { + int64_t ts = *(int64_t*)(kv->value); + ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, sTableSchema->precision); + converToStr(sql + beforeLen, kv->type, &ts, kv->length, &len); + }else{ + converToStr(sql + beforeLen, kv->type, kv->value, kv->length, &len); + } totalLen += len; ret = smlSnprintf(sql, &totalLen, capacity, ","); if (ret != 0) { @@ -963,7 +978,7 @@ static void insertCallback(void *param, TAOS_RES *res, int32_t notUsedCode) { batch->tryAgain = true; } - if (code == TSDB_CODE_TDB_INVALID_TABLE_ID || code == TSDB_CODE_VND_INVALID_VGROUP_ID) { + if (code == TSDB_CODE_TDB_INVALID_TABLE_ID || code == TSDB_CODE_VND_INVALID_VGROUP_ID || code == TSDB_CODE_MND_INVALID_TABLE_NAME) { batch->resetQueryCache = true; if (batch->tryAgain) { batch->sleep = true; @@ -1103,6 +1118,9 @@ static int32_t applyDataPointsWithSqlInsert(TAOS* taos, TAOS_SML_DATA_POINT* poi SSmlSqlInsertBatch* b = info->batches + i; if (b->code != 0) { code = b->code; + if(code == TSDB_CODE_MND_INVALID_TABLE_NAME){ + break; + } } } @@ -1219,42 +1237,52 @@ int tscSmlInsert(TAOS* taos, TAOS_SML_DATA_POINT* points, int numPoint, SSmlLine info->affectedRows = 0; - if (numPoint == 1) { - TAOS_SML_DATA_POINT* point = points + 0; - code = doSmlInsertOneDataPoint(taos, point, info); - if (code == TSDB_CODE_SUCCESS) { - return code; + int32_t tableNotExistTryTimes = 3; + while(tableNotExistTryTimes){ + if (numPoint == 1) { + TAOS_SML_DATA_POINT* point = points + 0; + code = doSmlInsertOneDataPoint(taos, point, info); + if (code == TSDB_CODE_SUCCESS) { + return code; + } } - } - tscDebug("SML:0x%"PRIx64" build data point schemas", info->id); - SArray* stableSchemas = taosArrayInit(32, sizeof(SSmlSTableSchema)); // SArray - code = buildDataPointSchemas(points, numPoint, stableSchemas, info); - if (code != 0) { - tscError("SML:0x%"PRIx64" error building data point schemas : %s", info->id, tstrerror(code)); - goto clean_up; - } + tscDebug("SML:0x%"PRIx64" build data point schemas", info->id); + SArray* stableSchemas = taosArrayInit(32, sizeof(SSmlSTableSchema)); // SArray + code = buildDataPointSchemas(points, numPoint, stableSchemas, info); + if (code != 0) { + tscError("SML:0x%"PRIx64" error building data point schemas : %s", info->id, tstrerror(code)); + goto clean_up; + } - tscDebug("SML:0x%"PRIx64" modify db schemas", info->id); - code = modifyDBSchemas(taos, stableSchemas, info); - if (code != 0) { - tscError("SML:0x%"PRIx64" error change db schema : %s", info->id, tstrerror(code)); - goto clean_up; - } + tscDebug("SML:0x%"PRIx64" modify db schemas", info->id); + code = modifyDBSchemas(taos, stableSchemas, info); + if (code != 0) { + tscError("SML:0x%"PRIx64" error change db schema : %s", info->id, tstrerror(code)); + goto clean_up; + } - tscDebug("SML:0x%"PRIx64" apply data points", info->id); - code = applyDataPointsWithSqlInsert(taos, points, numPoint, stableSchemas, info); - if (code != 0) { - tscError("SML:0x%"PRIx64" error apply data points : %s", info->id, tstrerror(code)); - } + tscDebug("SML:0x%"PRIx64" apply data points", info->id); + code = applyDataPointsWithSqlInsert(taos, points, numPoint, stableSchemas, info); + if (code != 0) { + tscError("SML:0x%"PRIx64" error apply data points : %s", info->id, tstrerror(code)); + } -clean_up: - for (int i = 0; i < taosArrayGetSize(stableSchemas); ++i) { - SSmlSTableSchema* schema = taosArrayGet(stableSchemas, i); - taosArrayDestroy(&schema->fields); - taosArrayDestroy(&schema->tags); + clean_up: + for (int i = 0; i < taosArrayGetSize(stableSchemas); ++i) { + SSmlSTableSchema* schema = taosArrayGet(stableSchemas, i); + taosArrayDestroy(&schema->fields); + taosArrayDestroy(&schema->tags); + } + taosArrayDestroy(&stableSchemas); + + if(code == TSDB_CODE_MND_INVALID_TABLE_NAME){ + tableNotExistTryTimes--; + }else{ + tableNotExistTryTimes = 0; + } } - taosArrayDestroy(&stableSchemas); + return code; } @@ -1966,24 +1994,19 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, return TSDB_CODE_SUCCESS; } -static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **idx, SSmlLinesInfo* info) { - const char *start, *cur; +static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **idx, int32_t len, SSmlLinesInfo* info) { + const char *start; int32_t ret = TSDB_CODE_SUCCESS; - int len = 0; char key[] = "ts"; char *value = NULL; - start = cur = *idx; + start = *idx; *pTS = calloc(1, sizeof(TAOS_SML_KV)); - while(*cur != '\0') { - cur++; - len++; - } - if (len > 0) { value = calloc(len + 1, 1); memcpy(value, start, len); + len = strtrim(value); } ret = convertSmlTimeStamp(*pTS, value, len, info); @@ -2013,12 +2036,12 @@ bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) { return false; } -static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **idx, SHashObj *pHash, SSmlLinesInfo* info) { +static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen, SHashObj *pHash, SSmlLinesInfo* info) { const char *cur = *idx; char key[TSDB_COL_NAME_LEN + 1]; // +1 to avoid key[len] over write int16_t len = 0; - while (*cur != '\0') { + while (cur - *idx < sqlLen) { if (len > TSDB_COL_NAME_LEN - 1) { tscError("SML:0x%"PRIx64" Key field cannot exceeds %d characters", info->id, TSDB_COL_NAME_LEN - 1); return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; @@ -2053,7 +2076,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **idx, SHashObj *pHash, } -static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, +static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen, bool *is_last_kv, SSmlLinesInfo* info, bool isTag) { const char *start, *cur; int32_t ret = TSDB_CODE_SUCCESS; @@ -2163,13 +2186,13 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, cur++; break; } else if (double_quote == true) { - if (*cur != ' ' && *cur != ',' && *cur != '\0') { + if (*cur != ' ' && *cur != ',' && (cur - *idx < sqlLen)) { tscError("SML:0x%"PRIx64" tag value: state(%d), incorrect character(%c) behind closing \"", info->id, tag_state, *cur); ret = TSDB_CODE_TSC_LINE_SYNTAX_ERROR; goto error; } - if (*cur == ' ' || *cur == '\0') { + if (*cur == ' ' || (cur - *idx == sqlLen)) { *is_last_kv = true; } @@ -2308,13 +2331,13 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, cur++; break; } else if (double_quote == true) { - if (*cur != ' ' && *cur != ',' && *cur != '\0') { + if (*cur != ' ' && *cur != ',' && (cur - *idx < sqlLen)) { tscError("SML:0x%"PRIx64" field value: state(%d), incorrect character(%c) behind closing \"", info->id, val_state, *cur); ret = TSDB_CODE_TSC_LINE_SYNTAX_ERROR; goto error; } - if (*cur == ' ' || *cur == '\0') { + if (*cur == ' ' || (cur - *idx == sqlLen)) { *is_last_kv = true; } @@ -2384,7 +2407,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, } free(value); - *idx = (*cur == '\0') ? cur : cur + 1; + *idx = (cur - *idx == sqlLen) ? cur : cur + 1; return ret; error: @@ -2395,7 +2418,7 @@ error: return ret; } -static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **idx, +static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **idx, int32_t sqlLen, uint8_t *has_tags, SSmlLinesInfo* info) { const char *cur = *idx; int16_t len = 0; @@ -2405,7 +2428,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **idx, return TSDB_CODE_TSC_OUT_OF_MEMORY; } - while (*cur != '\0') { + while (cur - *idx < sqlLen) { if (len > TSDB_TABLE_NAME_LEN - 1) { tscError("SML:0x%"PRIx64" Measurement field cannot exceeds %d characters", info->id, TSDB_TABLE_NAME_LEN - 1); free(pSml->stableName); @@ -2464,7 +2487,7 @@ int32_t isValidChildTableName(const char *pTbName, int16_t len, SSmlLinesInfo* i static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, - const char **idx, bool isField, + const char **idx, int32_t len, bool isField, TAOS_SML_DATA_POINT* smlData, SHashObj *pHash, SSmlLinesInfo* info) { const char *cur = *idx; @@ -2495,13 +2518,13 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, addEscapeCharToString(childTableName, (int32_t)(childTableNameLen)); } - while (*cur != '\0') { - ret = parseSmlKey(pkv, &cur, pHash, info); + while (cur - *idx < len) { + ret = parseSmlKey(pkv, &cur, len - (cur - *idx), pHash, info); if (ret) { tscError("SML:0x%"PRIx64" Unable to parse key", info->id); goto error; } - ret = parseSmlValue(pkv, &cur, &is_last_kv, info, !isField); + ret = parseSmlValue(pkv, &cur, len - (cur - *idx), &is_last_kv, info, !isField); if (ret) { tscError("SML:0x%"PRIx64" Unable to parse value", info->id); goto error; @@ -2574,14 +2597,14 @@ static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *t free(ts); } -int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInfo* info) { +int32_t tscParseLine(const char* sql, int32_t len, TAOS_SML_DATA_POINT* smlData, SSmlLinesInfo* info) { const char* idx = sql; int32_t ret = TSDB_CODE_SUCCESS; uint8_t has_tags = 0; TAOS_SML_KV *timestamp = NULL; SHashObj *keyHashTable = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); - ret = parseSmlMeasurement(smlData, &idx, &has_tags, info); + ret = parseSmlMeasurement(smlData, &idx, len, &has_tags, info); if (ret) { tscError("SML:0x%"PRIx64" Unable to parse measurement", info->id); taosHashCleanup(keyHashTable); @@ -2591,7 +2614,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf //Parse Tags if (has_tags) { - ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &idx, false, smlData, keyHashTable, info); + ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &idx, len - (idx - sql), false, smlData, keyHashTable, info); if (ret) { tscError("SML:0x%"PRIx64" Unable to parse tag", info->id); taosHashCleanup(keyHashTable); @@ -2601,7 +2624,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf tscDebug("SML:0x%"PRIx64" Parse tags finished, num of tags:%d", info->id, smlData->tagNum); //Parse fields - ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &idx, true, smlData, keyHashTable, info); + ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &idx, len - (idx - sql), true, smlData, keyHashTable, info); if (ret) { tscError("SML:0x%"PRIx64" Unable to parse field", info->id); taosHashCleanup(keyHashTable); @@ -2617,7 +2640,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf taosHashCleanup(keyHashTable); //Parse timestamp - ret = parseSmlTimeStamp(×tamp, &idx, info); + ret = parseSmlTimeStamp(×tamp, &idx, len - (idx - sql), info); if (ret) { tscError("SML:0x%"PRIx64" Unable to parse timestamp", info->id); return ret; @@ -2652,24 +2675,58 @@ void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) { free(point->childTableName); } -int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) { - for (int32_t i = 0; i < numLines; ++i) { - TAOS_SML_DATA_POINT point = {0}; - int32_t code = tscParseLine(lines[i], &point, info); - if (code != TSDB_CODE_SUCCESS) { - tscError("SML:0x%"PRIx64" data point line parse failed. line %d : %s", info->id, i, lines[i]); - destroySmlDataPoint(&point); - return code; - } else { - tscDebug("SML:0x%"PRIx64" data point line parse success. line %d", info->id, i); - } - - taosArrayPush(points, &point); +static int32_t tscParseLinesInner(char* line, int32_t len, SArray* points, SSmlLinesInfo* info){ + TAOS_SML_DATA_POINT point = {0}; + int32_t code = tscParseLine(line, len, &point, info); + if (code != TSDB_CODE_SUCCESS) { + tscError("SML:0x%"PRIx64" data point line parse failed.", info->id); + destroySmlDataPoint(&point); + return code; + } else { + tscDebug("SML:0x%"PRIx64" data point line parse success.", info->id); } + + taosArrayPush(points, &point); return TSDB_CODE_SUCCESS; } -int taos_insert_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int *affectedRows) { +int32_t tscParseLines(char* data, int32_t len, char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) { + int32_t code = TSDB_CODE_SUCCESS; + if(!data && lines){ + for (int32_t i = 0; i < numLines; ++i) { + code = tscParseLinesInner(lines[i], strlen(lines[i]), points, info); + if(code != TSDB_CODE_SUCCESS){ + return code; + } + } + }else if(data && !lines){ + char* tmp = data; + int32_t lenTmp = 0; + for(int i = 0; i < len; i++){ + if(data[i] == '\n' || i == len - 1){ + if(data[i] != '\n' && i == len - 1){ + lenTmp ++; + } + if(lenTmp > 0) { + code = tscParseLinesInner(tmp, lenTmp, points, info); + if(code != TSDB_CODE_SUCCESS){ + return code; + } + } + if(i < len - 1) { + tmp = data + i + 1; + } + lenTmp = 0; + }else{ + lenTmp ++; + } + } + } + + return code; +} + +int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int *numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int *affectedRows) { int32_t code = 0; SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo)); @@ -2677,38 +2734,52 @@ int taos_insert_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType p info->tsType = tsType; info->protocol = protocol; - if (numLines <= 0 || numLines > 65536*32) { - tscError("SML:0x%"PRIx64" taos_insert_lines numLines should be between 1 and 65536*32. numLines: %d", info->id, numLines); + if (data){ + *numLines = 0; + for(int i = 0; i < len; i++){ + if(data[i] == '\0'){ + data[i] = '0'; + } + if(data[i] == '\n' || i == len - 1){ + (*numLines)++; + } + } + } + + if (*numLines <= 0 || *numLines > 65536*32) { + tscError("SML:0x%"PRIx64" taos_insert_lines numLines should be between 1 and 65536*32. numLines: %d", info->id, *numLines); tfree(info); code = TSDB_CODE_TSC_APP_ERROR; return code; } - 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); - tfree(info); - code = TSDB_CODE_TSC_APP_ERROR; - return code; + if(lines){ + 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); + tfree(info); + code = TSDB_CODE_TSC_APP_ERROR; + return code; + } } } - SArray* lpPoints = taosArrayInit(numLines, sizeof(TAOS_SML_DATA_POINT)); + 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); tfree(info); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - tscDebug("SML:0x%"PRIx64" taos_insert_lines begin inserting %d lines, first line: %s", info->id, numLines, lines[0]); - code = tscParseLines(lines, numLines, lpPoints, NULL, info); + tscDebug("SML:0x%"PRIx64" taos_insert_lines begin inserting %d lines", info->id, *numLines); + code = tscParseLines(data, len, lines, *numLines, lpPoints, NULL, info); size_t numPoints = taosArrayGetSize(lpPoints); + TAOS_SML_DATA_POINT* points = TARRAY_GET_START(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("SML:0x%"PRIx64" taos_sml_insert error: %s", info->id, tstrerror((code))); @@ -2718,9 +2789,7 @@ int taos_insert_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType p } cleanup: - tscDebug("SML:0x%"PRIx64" taos_insert_lines finish inserting %d lines. code: %d", info->id, numLines, code); - points = TARRAY_GET_START(lpPoints); - numPoints = taosArrayGetSize(lpPoints); + tscDebug("SML:0x%"PRIx64" taos_insert_lines finish inserting %d lines. code: %d", info->id, *numLines, code); for (int i=0; i TSDB_TABLE_NAME_LEN - 1) { tscError("OTD:0x%"PRIx64" Metric cannot exceeds %d characters", info->id, TSDB_TABLE_NAME_LEN - 1); tfree(pSml->stableName); @@ -82,7 +82,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **idx, SS return TSDB_CODE_SUCCESS; } -static int32_t parseTelnetTimeStamp(TAOS_SML_KV **pTS, int *num_kvs, const char **idx, SSmlLinesInfo* info) { +static int32_t parseTelnetTimeStamp(TAOS_SML_KV **pTS, int *num_kvs, const char **idx, int32_t sqlLen, SSmlLinesInfo* info) { //Timestamp must be the first KV to parse assert(*num_kvs == 0); @@ -96,7 +96,7 @@ static int32_t parseTelnetTimeStamp(TAOS_SML_KV **pTS, int *num_kvs, const char //allocate fields for timestamp and value *pTS = tcalloc(OTD_MAX_FIELDS_NUM, sizeof(TAOS_SML_KV)); - while(*cur != '\0') { + while(cur - *idx < sqlLen) { if (*cur == ' ') { if (*(cur + 1) != ' ') { break; @@ -109,7 +109,7 @@ static int32_t parseTelnetTimeStamp(TAOS_SML_KV **pTS, int *num_kvs, const char len++; } - if (len > 0 && *cur != '\0') { + if (len > 0 && cur - *idx < sqlLen) { value = tcalloc(len + 1, 1); memcpy(value, start, len); } else { @@ -135,7 +135,7 @@ static int32_t parseTelnetTimeStamp(TAOS_SML_KV **pTS, int *num_kvs, const char return ret; } -static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const char **idx, SSmlLinesInfo* info) { +static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const char **idx, int32_t sqlLen, SSmlLinesInfo* info) { //skip timestamp TAOS_SML_KV *pVal = *pKVs + 1; const char *start, *cur; @@ -158,7 +158,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch len += 2; } - while(*cur != '\0') { + while(cur - *idx < sqlLen) { if (*cur == ' ') { if (searchQuote == true) { if (*(cur - 1) == '"' && len != 1 && len != 2) { @@ -181,7 +181,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch len++; } - if (len > 0 && *cur != '\0') { + if (len > 0 && cur - *idx < sqlLen) { value = tcalloc(len + 1, 1); memcpy(value, start, len); } else { @@ -205,7 +205,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch return ret; } -static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, SHashObj *pHash, SSmlLinesInfo* info) { +static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen, SHashObj *pHash, SSmlLinesInfo* info) { const char *cur = *idx; char key[TSDB_COL_NAME_LEN]; uint16_t len = 0; @@ -215,7 +215,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, SHashObj *p // tscError("OTD:0x%"PRIx64" Tag key cannot start with digit", info->id); // return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; //} - while (*cur != '\0') { + while (cur - *idx < sqlLen) { if (len > TSDB_COL_NAME_LEN - 1) { tscError("OTD:0x%"PRIx64" Tag key cannot exceeds %d characters", info->id, TSDB_COL_NAME_LEN - 1); return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; @@ -231,7 +231,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, SHashObj *p cur++; len++; } - if (len == 0 || *cur == '\0') { + if (len == 0 || cur - *idx == sqlLen) { return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } key[len] = '\0'; @@ -249,7 +249,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, SHashObj *p } -static int32_t parseTelnetTagValue(TAOS_SML_KV *pKV, const char **idx, +static int32_t parseTelnetTagValue(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen, bool *is_last_kv, SSmlLinesInfo* info) { const char *start, *cur; char *value = NULL; @@ -258,9 +258,9 @@ static int32_t parseTelnetTagValue(TAOS_SML_KV *pKV, const char **idx, while (1) { // whitespace or '\0' identifies a value - if (*cur == ' ' || *cur == '\0') { + if (*cur == ' ' || cur - *idx == sqlLen) { // '\0' indicates end of value - *is_last_kv = (*cur == '\0') ? true : false; + *is_last_kv = (cur - *idx == sqlLen) ? true : false; if (*cur == ' ' && *(cur + 1) == ' ') { cur++; continue; @@ -290,12 +290,12 @@ static int32_t parseTelnetTagValue(TAOS_SML_KV *pKV, const char **idx, } tfree(value); - *idx = (*cur == '\0') ? cur : cur + 1; + *idx = (cur - *idx == sqlLen) ? cur : cur + 1; return TSDB_CODE_SUCCESS; } static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs, - const char **idx, char **childTableName, + const char **idx, int32_t sqlLen, char **childTableName, SHashObj *pHash, SSmlLinesInfo* info) { const char *cur = *idx; int32_t ret = TSDB_CODE_SUCCESS; @@ -312,13 +312,13 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs, memcpy(childTbName, tsSmlChildTableName, childTableNameLen); addEscapeCharToString(childTbName, (int32_t)(childTableNameLen)); } - while (*cur != '\0') { - ret = parseTelnetTagKey(pkv, &cur, pHash, info); + while (cur - *idx < sqlLen) { + ret = parseTelnetTagKey(pkv, &cur, sqlLen - (cur - *idx), pHash, info); if (ret) { tscError("OTD:0x%"PRIx64" Unable to parse key", info->id); return ret; } - ret = parseTelnetTagValue(pkv, &cur, &is_last_kv, info); + ret = parseTelnetTagValue(pkv, &cur, sqlLen - (cur - *idx), &is_last_kv, info); if (ret) { tscError("OTD:0x%"PRIx64" Unable to parse value", info->id); return ret; @@ -356,12 +356,12 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs, return ret; } -static int32_t tscParseTelnetLine(const char* line, TAOS_SML_DATA_POINT* smlData, SSmlLinesInfo* info) { +static int32_t tscParseTelnetLine(const char* line, int32_t len, TAOS_SML_DATA_POINT* smlData, SSmlLinesInfo* info) { const char* idx = line; int32_t ret = TSDB_CODE_SUCCESS; //Parse metric - ret = parseTelnetMetric(smlData, &idx, info); + ret = parseTelnetMetric(smlData, &idx, len, info); if (ret) { tscError("OTD:0x%"PRIx64" Unable to parse metric", info->id); return ret; @@ -369,7 +369,7 @@ static int32_t tscParseTelnetLine(const char* line, TAOS_SML_DATA_POINT* smlData tscDebug("OTD:0x%"PRIx64" Parse metric finished", info->id); //Parse timestamp - ret = parseTelnetTimeStamp(&smlData->fields, &smlData->fieldNum, &idx, info); + ret = parseTelnetTimeStamp(&smlData->fields, &smlData->fieldNum, &idx, len - (idx - line), info); if (ret) { tscError("OTD:0x%"PRIx64" Unable to parse timestamp", info->id); return ret; @@ -377,7 +377,7 @@ static int32_t tscParseTelnetLine(const char* line, TAOS_SML_DATA_POINT* smlData tscDebug("OTD:0x%"PRIx64" Parse timestamp finished", info->id); //Parse value - ret = parseTelnetMetricValue(&smlData->fields, &smlData->fieldNum, &idx, info); + ret = parseTelnetMetricValue(&smlData->fields, &smlData->fieldNum, &idx, len - (idx - line), info); if (ret) { tscError("OTD:0x%"PRIx64" Unable to parse metric value", info->id); return ret; @@ -386,7 +386,7 @@ static int32_t tscParseTelnetLine(const char* line, TAOS_SML_DATA_POINT* smlData //Parse tagKVs SHashObj *keyHashTable = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); - ret = parseTelnetTagKvs(&smlData->tags, &smlData->tagNum, &idx, &smlData->childTableName, keyHashTable, info); + ret = parseTelnetTagKvs(&smlData->tags, &smlData->tagNum, &idx, len - (idx - line), &smlData->childTableName, keyHashTable, info); if (ret) { tscError("OTD:0x%"PRIx64" Unable to parse tags", info->id); taosHashCleanup(keyHashTable); @@ -399,24 +399,58 @@ static int32_t tscParseTelnetLine(const char* line, TAOS_SML_DATA_POINT* smlData return TSDB_CODE_SUCCESS; } -static int32_t tscParseTelnetLines(char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) { - for (int32_t i = 0; i < numLines; ++i) { - TAOS_SML_DATA_POINT point = {0}; - int32_t code = tscParseTelnetLine(lines[i], &point, info); - if (code != TSDB_CODE_SUCCESS) { - tscError("OTD:0x%"PRIx64" data point line parse failed. line %d : %s", info->id, i, lines[i]); - destroySmlDataPoint(&point); - return code; - } else { - tscDebug("OTD:0x%"PRIx64" data point line parse success. line %d", info->id, i); - } - - taosArrayPush(points, &point); +static int32_t tscParseTelnetLinesInner(char* data, int32_t len, SArray* points, SSmlLinesInfo* info) { + TAOS_SML_DATA_POINT point = {0}; + int32_t code = tscParseTelnetLine(data, len, &point, info); + if (code != TSDB_CODE_SUCCESS) { + tscError("OTD:0x%"PRIx64" data point line parse failed.", info->id); + destroySmlDataPoint(&point); + return code; + } else { + tscDebug("OTD:0x%"PRIx64" data point line parse success.", info->id); } + + taosArrayPush(points, &point); return TSDB_CODE_SUCCESS; } -int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows) { +static int32_t tscParseTelnetLines(char* data, int32_t len, char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) { + int32_t code = TSDB_CODE_SUCCESS; + if(!data && lines){ + for (int32_t i = 0; i < numLines; ++i) { + code = tscParseTelnetLinesInner(lines[i], strlen(lines[i]), points, info); + if(code != TSDB_CODE_SUCCESS){ + return code; + } + } + }else if(data && !lines){ + char* tmp = data; + int32_t lenTmp = 0; + for(int i = 0; i < len; i++){ + if(data[i] == '\n' || i == len - 1){ + if(data[i] != '\n' && i == len - 1){ + lenTmp++; + } + if(lenTmp > 0) { + code = tscParseTelnetLinesInner(tmp, lenTmp, points, info); + if(code != TSDB_CODE_SUCCESS){ + return code; + } + } + if(i < len - 1) { + tmp = data + i + 1; + } + lenTmp = 0; + }else{ + lenTmp ++; + } + } + } + + return code; +} + +int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[], int *numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows) { int32_t code = 0; SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo)); @@ -424,38 +458,52 @@ int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtoco info->tsType = tsType; info->protocol = protocol; - if (numLines <= 0 || numLines > 65536) { - tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines numLines should be between 1 and 65536. numLines: %d", info->id, numLines); + if (data && !lines){ + *numLines = 0; + for(int i = 0; i < len; i++){ + if(data[i] == '\0'){ + data[i] = '0'; + } + if(data[i] == '\n' || i == len - 1){ + (*numLines)++; + } + } + } + + if (*numLines <= 0 || *numLines > 65536) { + tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines numLines should be between 1 and 65536. numLines: %d", info->id, *numLines); tfree(info); code = TSDB_CODE_TSC_APP_ERROR; return code; } - for (int i = 0; i < numLines; ++i) { - if (lines[i] == NULL) { - tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines line %d is NULL", info->id, i); - tfree(info); - code = TSDB_CODE_TSC_APP_ERROR; - return code; + if(!data && lines){ + for (int i = 0; i < *numLines; ++i) { + if (lines[i] == NULL) { + tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines line %d is NULL", info->id, i); + tfree(info); + code = TSDB_CODE_TSC_APP_ERROR; + return code; + } } } - SArray* lpPoints = taosArrayInit(numLines, sizeof(TAOS_SML_DATA_POINT)); + SArray* lpPoints = taosArrayInit(*numLines, sizeof(TAOS_SML_DATA_POINT)); if (lpPoints == NULL) { tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines 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 lines, first line: %s", info->id, numLines, lines[0]); - code = tscParseTelnetLines(lines, numLines, lpPoints, NULL, info); + tscDebug("OTD:0x%"PRIx64" taos_insert_telnet_lines begin inserting %d lines, first line: %s", info->id, *numLines, lines[0]); + code = tscParseTelnetLines(data, len, lines, *numLines, lpPoints, NULL, info); size_t numPoints = taosArrayGetSize(lpPoints); + TAOS_SML_DATA_POINT* points = TARRAY_GET_START(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_telnet_lines error: %s", info->id, tstrerror((code))); @@ -465,9 +513,7 @@ int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtoco } 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); + tscDebug("OTD:0x%"PRIx64" taos_insert_telnet_lines finish inserting %d lines. code: %d", info->id, *numLines, code); for (int i = 0; i < numPoints; ++i) { destroySmlDataPoint(points+i); } @@ -1059,8 +1105,9 @@ PARSE_JSON_OVER: return ret; } -int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows) { +int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol, int32_t *totalRows, SMLTimeStampType tsType, int* affectedRows) { int32_t code = 0; + *totalRows = 0; SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo)); info->id = genUID(); @@ -1084,12 +1131,12 @@ int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol 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); + TAOS_SML_DATA_POINT* points = TARRAY_GET_START(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))); @@ -1097,11 +1144,10 @@ int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol if (affectedRows != NULL) { *affectedRows = info->affectedRows; } + *totalRows = numPoints; 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); } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 8cc28bb2ca8a8ce678dceab83c05dd1ff73d250b..b7459b00dace1b3ba44482742e11f1f3d99b4da1 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -3393,7 +3393,7 @@ int tscRenewTableMeta(SSqlObj *pSql) { SSqlCmd* pCmd2 = &pSql->rootObj->cmd; SHashObj *pmap = pCmd2->pTableMetaMap; if (pmap == atomic_val_compare_exchange_ptr(&pCmd2->pTableMetaMap, pmap, NULL)) { - tscCleanupTableMetaMap(pCmd2->pTableMetaMap); + tscCleanupTableMetaMap(pmap); } pCmd2->pTableMetaMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 1f828f8ae06147ad26b3a3c419fb34647ae63244..c0a96c5b3ae0e5345344a1f6968ec4ba37d4a281 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1373,6 +1373,10 @@ void convertQueryResult(SSqlRes* pRes, SQueryInfo* pQueryInfo, uint64_t objId, b // set the correct result SSDataBlock* p = pQueryInfo->pQInfo->runtimeEnv.outputBuf; pRes->numOfRows = (p != NULL)? p->info.rows: 0; + bool completed = pRes->numOfRows == 0; + if (p && pRes->numOfRows == 0 && tsAggAlways) { + pRes->numOfRows = 1; + } if (pRes->code == TSDB_CODE_SUCCESS && pRes->numOfRows > 0) { tscCreateResPointerInfo(pRes, pQueryInfo); @@ -1381,7 +1385,7 @@ void convertQueryResult(SSqlRes* pRes, SQueryInfo* pQueryInfo, uint64_t objId, b tscDebug("0x%"PRIx64" retrieve result in pRes, numOfRows:%d", objId, pRes->numOfRows); pRes->row = 0; - pRes->completed = (pRes->numOfRows == 0); + pRes->completed = completed; } /* @@ -1650,7 +1654,7 @@ void tscResetSqlCmd(SSqlCmd* pCmd, bool clearCachedMeta, uint64_t id) { tscFreeQueryInfo(pCmd, clearCachedMeta, id); SHashObj *pmap = pCmd->pTableMetaMap; if (pmap == atomic_val_compare_exchange_ptr(&pCmd->pTableMetaMap, pmap, NULL)) { - tscCleanupTableMetaMap(pCmd->pTableMetaMap); + tscCleanupTableMetaMap(pmap); } taosReleaseRef(tscObjRef, id); } @@ -5243,6 +5247,8 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt STableMetaInfo* pTableMetaInfo = pQueryInfo->pTableMetaInfo[0]; + pQueryAttr->precision = pTableMetaInfo->pTableMeta->tableInfo.precision; + if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) { pQueryAttr->pGroupbyExpr = calloc(1, sizeof(SGroupbyExpr)); *(pQueryAttr->pGroupbyExpr) = pQueryInfo->groupbyExpr; diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index a149c660daadcd2e09822ceb4d2039767da67b00..a540429236e9dc8757208e99af6dad5d96b3ef6c 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -222,6 +222,7 @@ extern int32_t cqDebugFlag; extern int32_t debugFlag; extern int8_t tsClientMerge; +extern int8_t tsAggAlways; // probe alive connection extern int32_t tsProbeSeconds; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index aaff1865a0abf5ec708a4f6ad9cfa3927a704e81..7dbca7977c8f5cfdf6be25e8de7a5eaffaefb5b4 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -278,6 +278,7 @@ int32_t cqDebugFlag = 131; int32_t fsDebugFlag = 135; int8_t tsClientMerge = 0; +int8_t tsAggAlways = 0; // Agg function always return value even if zero row // probe alive connection int32_t tsProbeSeconds = 5 * 60; // start probe link alive after tsProbeSeconds from starting query @@ -1695,6 +1696,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "aggAlways"; + cfg.ptr = &tsAggAlways; + cfg.valType = TAOS_CFG_VTYPE_INT8; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 0; + cfg.maxValue = 1; + cfg.ptrLength = 1; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + // default JSON string type option "binary"/"nchar" cfg.option = "defaultJSONStrType"; cfg.ptr = tsDefaultJSONStrType; diff --git a/src/inc/taos.h b/src/inc/taos.h index e834ea9f40cc79978134129170f77f0dbeb89377..efb3ce25d678f7af83954c15e0625f697315c714 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -218,6 +218,7 @@ DLL_EXPORT void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress); DLL_EXPORT int taos_load_table_info(TAOS *taos, const char* tableNameList); DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol, int precision); +DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw(TAOS* taos, char* lines, int len, int32_t *totalRows, int protocol, int precision); DLL_EXPORT int32_t taos_parse_time(char* timestr, int64_t* time, int32_t len, int32_t timePrec, int8_t dayligth); diff --git a/src/kit/shell/src/shellAuto.c b/src/kit/shell/src/shellAuto.c index cff639f88546fdd80f7536e564fab8223f5d082b..a96aa3f5810e69bef42242e9d26d9528c8f8ce3e 100644 --- a/src/kit/shell/src/shellAuto.c +++ b/src/kit/shell/src/shellAuto.c @@ -31,7 +31,7 @@ // extern function -void insertChar(Command *cmd, char *c, int size); +void insertStr(Command *cmd, char *str, int size); typedef struct SAutoPtr { @@ -78,6 +78,7 @@ SWords shellCommands[] = { {"alter user privilege read", 0, 0, NULL}, {"alter user privilege write", 0, 0, NULL}, {"create table using tags(", 0, 0, NULL}, + {"create table as select ", 0, 0, NULL}, {"create database ", 0, 0, NULL}, {"create table as ", 0, 0, NULL}, {"create dnode ", 0, 0, NULL}, @@ -126,6 +127,7 @@ SWords shellCommands[] = { {"show vgroups;", 0, 0, NULL}, {"insert into values(", 0, 0, NULL}, {"insert into using tags( ) values(", 0, 0, NULL}, + {"insert into using values(", 0, 0, NULL}, {"use ", 0, 0, NULL}, {"quit", 0, 0, NULL} }; @@ -251,6 +253,9 @@ char * key_tags[] = { "tags(" }; +char * key_select[] = { + "select " +}; // // ------- gobal variant define --------- @@ -278,7 +283,8 @@ bool waitAutoFill = false; #define WT_VAR_DATATYPE 10 #define WT_VAR_KEYTAGS 11 #define WT_VAR_ANYWORD 12 -#define WT_VAR_CNT 13 +#define WT_VAR_KEYSELECT 13 +#define WT_VAR_CNT 14 #define WT_FROM_DB_MAX 4 // max get content from db #define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1) @@ -305,7 +311,8 @@ char varTypes[WT_VAR_CNT][64] = { "", "", "", - "" + "", + "" }; char varSqls[WT_FROM_DB_CNT][64] = { @@ -330,23 +337,23 @@ int cntDel = 0; // delete byte count after next press tab // show auto tab introduction void printfIntroduction() { - printf(" ********************* How to Use TAB in TAOS Shell ******************************\n"); - printf(" * Taos shell supports pressing TAB key to complete word. You can try it. *\n"); - printf(" * Press TAB key anywhere, You'll get surprise. *\n"); - printf(" * KEYBOARD SHORTCUT: *\n"); - printf(" * [ TAB ] ...... Complete the word or show help if no input *\n"); - printf(" * [ Ctrl + A ] ...... move cursor to [A]head of line *\n"); - printf(" * [ Ctrl + E ] ...... move cursor to [E]nd of line *\n"); - printf(" * [ Ctrl + W ] ...... move cursor to line of middle *\n"); - printf(" * [ Ctrl + L ] ...... clean screen *\n"); - printf(" * [ Ctrl + K ] ...... clean after cursor *\n"); - printf(" * [ Ctrl + U ] ...... clean before cursor *\n"); - printf(" * *\n"); - printf(" **********************************************************************************\n\n"); + printf(" ****************************** Tab Completion **********************************\n"); + printf(" * The TDengine CLI supports tab completion for a variety of items, *\n"); + printf(" * including database names, table names, function names and keywords. *\n"); + printf(" * The full list of shortcut keys is as follows: *\n"); + printf(" * [ TAB ] ...... complete the current word *\n"); + printf(" * ...... if used on a blank line, display all valid commands *\n"); + printf(" * [ Ctrl + A ] ...... move cursor to the st[A]rt of the line *\n"); + printf(" * [ Ctrl + E ] ...... move cursor to the [E]nd of the line *\n"); + printf(" * [ Ctrl + W ] ...... move cursor to the middle of the line *\n"); + printf(" * [ Ctrl + L ] ...... clear the entire screen *\n"); + printf(" * [ Ctrl + K ] ...... clear the screen after the cursor *\n"); + printf(" * [ Ctrl + U ] ...... clear the screen before the cursor *\n"); + printf(" **********************************************************************************\n\n"); } void showHelp() { - printf("\nThe following are supported commands for Taos shell:"); + printf("\nFThe TDengine CLI supports the following commands:"); printf("\n\ ----- A ----- \n\ alter database \n\ @@ -526,26 +533,16 @@ void parseCommand(SWords * command, bool pattern) { } // free Command -void freeCommand(SWords * command) { - SWord * word = command->head; - if (word == NULL) { - return ; - } - - // loop - while (word->next) { - SWord * tmp = word; - word = word->next; +void freeCommand(SWords* command) { + SWord* item = command->head; + // loop + while (item) { + SWord* tmp = item; + item = item->next; // if malloc need free - if(tmp->free && tmp->word) - free(tmp->word); + if (tmp->free && tmp->word) free(tmp->word); free(tmp); } - - // if malloc need free - if(word->free && word->word) - free(word->word); - free(word); } void GenerateVarType(int type, char** p, int count) { @@ -586,6 +583,7 @@ bool shellAutoInit() { GenerateVarType(WT_VAR_TBACTION, tb_actions, sizeof(tb_actions) /sizeof(char *)); GenerateVarType(WT_VAR_DATATYPE, data_types, sizeof(data_types) /sizeof(char *)); GenerateVarType(WT_VAR_KEYTAGS, key_tags, sizeof(key_tags) /sizeof(char *)); + GenerateVarType(WT_VAR_KEYSELECT,key_select, sizeof(key_select) /sizeof(char *)); printfIntroduction(); @@ -613,7 +611,7 @@ void shellAutoExit() { pthread_mutex_destroy(&tiresMutex); // free threads - for (int32_t i = 0; i < WT_VAR_CNT; i++) { + for (int32_t i = 0; i < WT_FROM_DB_CNT; i++) { if (threads[i]) { taosDestroyThread(threads[i]); threads[i] = NULL; @@ -1079,7 +1077,7 @@ void printScreen(TAOS * con, Command * cmd, SWords * match) { } // insert new - insertChar(cmd, (char *)str, strLen); + insertStr(cmd, (char *)str, strLen); } @@ -1170,11 +1168,11 @@ bool nextMatchCommand(TAOS * con, Command * cmd, SWords * firstMatch) { printScreen(con, cmd, match); // free + freeCommand(input); if (input->source) { free(input->source); input->source = NULL; } - freeCommand(input); free(input); return true; @@ -1194,7 +1192,7 @@ bool fillWithType(TAOS * con, Command * cmd, char* pre, int type) { // show int count = strlen(part); - insertChar(cmd, part, count); + insertStr(cmd, part, count); cntDel = count; // next press tab delete current append count free(str); @@ -1222,7 +1220,7 @@ bool fillTableName(TAOS * con, Command * cmd, char* pre) { // show int count = strlen(part); - insertChar(cmd, part, count); + insertStr(cmd, part, count); cntDel = count; // next press tab delete current append count free(str); @@ -1242,7 +1240,7 @@ char * lastWord(char * p) { char * p2 = strrchr(p, ','); if (p1 && p2) { - return MAX(p1, p2) + 1; + return p1 > p2 ? p1 + 1 : p2 + 1; } else if (p1) { return p1 + 1; } else if(p2) { @@ -1325,37 +1323,9 @@ bool needInsertFrom(char * sql, int len) { return true; } -bool matchSelectQuery(TAOS * con, Command * cmd) { - // if continue press Tab , delete bytes by previous autofill - if (cntDel > 0) { - deleteCount(cmd, cntDel); - cntDel = 0; - } - - // match select ... - int len = cmd->commandSize; - char * p = cmd->command; - - // remove prefix blank - while (p[0] == ' ' && len > 0) { - p++; - len--; - } - - // special range - if(len < 7 || len > 512) { - return false; - } - - // select and from - if(strncasecmp(p, "select ", 7) != 0) { - // not select query clause - return false; - } - p += 7; - len -= 7; - - char* ps = p = strndup(p, len); +// p is string following select keyword +bool appendAfterSelect(TAOS * con, Command * cmd, char* sql, int32_t len) { + char* p = strndup(sql, len); // union all char * p1; @@ -1374,8 +1344,8 @@ bool matchSelectQuery(TAOS * con, Command * cmd) { bool fieldEnd = fieldsInputEnd(p); // cheeck fields input end then insert from keyword if (fieldEnd && p[len-1] == ' ') { - insertChar(cmd, "from", 4); - free(ps); + insertStr(cmd, "from", 4); + free(p); return true; } @@ -1387,7 +1357,7 @@ bool matchSelectQuery(TAOS * con, Command * cmd) { ret = fillWithType(con, cmd, last, WT_VAR_FUNC); } - free(ps); + free(p); return ret; } @@ -1400,10 +1370,73 @@ bool matchSelectQuery(TAOS * con, Command * cmd) { ret = fillWithType(con, cmd, last, WT_VAR_KEYWORD); } - free(ps); + free(p); return ret; } +int32_t searchAfterSelect(char* p, int32_t len) { + // select * from st; + if(strncasecmp(p, "select ", 7) == 0) { + // check nest query + char *p1 = p + 7; + while(1) { + char *p2 = strstr(p1, "select "); + if(p2 == NULL) + break; + p1 = p2 + 7; + } + + return p1 - p; + } + + char* as_pos_end = strstr(p, " as select "); + if (as_pos_end == NULL) + return -1; + as_pos_end += 11; + + // create table as select + if(strncasecmp(p, "create table ", 13) == 0) { + return as_pos_end - p;; + } + + return -1; +} + +bool matchSelectQuery(TAOS * con, Command * cmd) { + // if continue press Tab , delete bytes by previous autofill + if (cntDel > 0) { + deleteCount(cmd, cntDel); + cntDel = 0; + } + + // match select ... + int len = cmd->commandSize; + char * p = cmd->command; + + // remove prefix blank + while (p[0] == ' ' && len > 0) { + p++; + len--; + } + + // special range + if(len < 7 || len > 512) { + return false; + } + + // search + char* sql_cp = strndup(p, len); + int32_t n = searchAfterSelect(sql_cp, len); + free(sql_cp); + if(n == -1 || n > len) + return false; + p += n; + len -= n; + + // append + return appendAfterSelect(con, cmd, p, len); +} + // if is input create fields or tags area, return true bool isCreateFieldsArea(char * p) { char * left = strrchr(p, '('); @@ -1460,6 +1493,12 @@ bool matchCreateTable(TAOS * con, Command * cmd) { bool ret = false; char * last = lastWord(ps); + // except create table m1 as select .... + if (strstr(ps, " as select")) { + free(ps); + return false; + } + // check in create fields or tags input area if (isCreateFieldsArea(ps)) { ret = fillWithType(con, cmd, last, WT_VAR_DATATYPE); @@ -1484,18 +1523,76 @@ bool matchCreateTable(TAOS * con, Command * cmd) { bool matchOther(TAOS * con, Command * cmd) { int len = cmd->commandSize; char* p = cmd->command; - + // '\\' if (p[len - 1] == '\\') { // append '\G' char a[] = "G;"; - insertChar(cmd, a, 2); + insertStr(cmd, a, 2); return true; } - + + // too small + if(len < 8) + return false; + + // like 'from ( ' + char* sql = strndup(p, len); + char* last = lastWord(sql); + + if (strcmp(last, "from(") == 0) { + fillWithType(con, cmd, "", WT_VAR_KEYSELECT); + free(sql); + return true; + } + if (strncmp(last, "(", 1) == 0) { + last += 1; + } + + char* from = strstr(sql, " from"); + // find last ' from' + while (from) { + char* p1 = strstr(from + 5, " from"); + if (p1 == NULL) + break; + from = p1; + } + + if (from) { + // find next is '(' + char * p2 = from + 5; + bool found = false; // found 'from ... ( ...' ... is any count of blank + bool found1 = false; // found '(' + while (1) { + if ( p2 == last || *p2 == '\0') { + // last word or string end + if (found1) { + found = true; + } + break; + } else if(*p2 == '(') { + found1 = true; + } else if(*p2 == ' ') { + // do nothing + } else { + // have any other char + break; + } + + // move next + p2++; + } + + if (found) { + fillWithType(con, cmd, last, WT_VAR_KEYSELECT); + free(sql); + return true; + } + } + + free(sql); return false; } - // main key press tab void pressTabKey(TAOS * con, Command * cmd) { // check @@ -1761,4 +1858,4 @@ void callbackAutoTab(char* sqlstr, TAOS* pSql, bool usedb) { } return ; -} +} \ No newline at end of file diff --git a/src/kit/shell/src/shellCheck.c b/src/kit/shell/src/shellCheck.c index dfc5d83b9fc820f7c5e08e5a26d2475f82d16040..593bb5caeb0288613c56bf6112ccad484de185c1 100644 --- a/src/kit/shell/src/shellCheck.c +++ b/src/kit/shell/src/shellCheck.c @@ -131,7 +131,7 @@ static void *shellCheckThreadFp(void *arg) { char *tbname = tbNames[t]; if (tbname == NULL) break; - snprintf(sql, SHELL_SQL_LEN, "select count(*) from %s;", tbname); + snprintf(sql, SHELL_SQL_LEN, "select last_row(_c0) from `%s`;", tbname); TAOS_RES *pSql = taos_query(pThread->taos, sql); int32_t code = taos_errno(pSql); diff --git a/src/kit/shell/src/shellCommand.c b/src/kit/shell/src/shellCommand.c index 2fe09691e3285c2e3031672404b0aa6ed7bac244..a14eeb5e9482e804d636e37a2842c8a58b221ee3 100644 --- a/src/kit/shell/src/shellCommand.c +++ b/src/kit/shell/src/shellCommand.c @@ -79,11 +79,22 @@ void insertChar(Command *cmd, char *c, int size) { /* update the values */ cmd->commandSize += size; cmd->cursorOffset += size; - for (int i = 0; i < size; i++) { - mbtowc(&wc, c + i, size); - cmd->screenOffset += wcwidth(wc); - cmd->endOffset += wcwidth(wc); - } + cmd->screenOffset += wcwidth(wc); + cmd->endOffset += wcwidth(wc); + showOnScreen(cmd); +} + +void insertStr(Command *cmd, char *str, int size) { + clearScreen(cmd->endOffset + prompt_size, cmd->screenOffset + prompt_size); + /* update the buffer */ + memmove(cmd->command + cmd->cursorOffset + size, cmd->command + cmd->cursorOffset, + cmd->commandSize - cmd->cursorOffset); + memcpy(cmd->command + cmd->cursorOffset, str, size); + /* update the values */ + cmd->commandSize += size; + cmd->cursorOffset += size; + cmd->screenOffset += size; + cmd->endOffset += size; showOnScreen(cmd); } diff --git a/src/kit/shell/src/shellDarwin.c b/src/kit/shell/src/shellDarwin.c index 0108d92e8f6a73317bc510857e17d8c81a62d512..8d461723faf568af993e179443cd8977fa3186f1 100644 --- a/src/kit/shell/src/shellDarwin.c +++ b/src/kit/shell/src/shellDarwin.c @@ -35,7 +35,7 @@ void insertChar(Command *cmd, char *c, int size); void printHelp() { char indent[10] = " "; - printf("taos shell is used to test the TDengine database\n"); + printf("TDengine Command Line is used to test the TDengine database\n"); printf("%s%s\n", indent, "-h"); printf("%s%s%s\n", indent, indent, "TDengine server IP address to connect. The default host is localhost."); @@ -68,7 +68,7 @@ void printHelp() { exit(EXIT_SUCCESS); } -char DARWINCLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" +char DARWINCLIENT_VERSION[] = "Welcome to the TDengine Command Line Interface from %s, Client Version:%s\n" "Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.\n\n"; char g_password[SHELL_MAX_PASSWORD_LEN]; diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index b0c3f4934d2d7180413b2e5a3463b8eb9da8428a..ecd7d2d31ecf77a5c9e41b24c99b8e68dc7f880a 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -32,7 +32,7 @@ #include /**************** Global variables ****************/ -char CLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" +char CLIENT_VERSION[] = "Welcome to the TDengine Command Line Interface from %s, Client Version:%s\n" "Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.\n\n"; char PROMPT_HEADER[] = "taos> "; char CONTINUE_PROMPT[] = " -> "; @@ -192,9 +192,15 @@ static int32_t shellRunSingleCommand(TAOS *con, char *command) { if (regex_match(command, "^[ \t]*source[\t ]+[^ ]+[ \t;]*$", REG_EXTENDED | REG_ICASE)) { /* If source file. */ char *c_ptr = strtok(command, " ;"); - assert(c_ptr != NULL); + if (c_ptr == NULL) { + shellRunCommandOnServer(con, command); + return 0; + } c_ptr = strtok(NULL, " ;"); - assert(c_ptr != NULL); + if (c_ptr == NULL) { + shellRunCommandOnServer(con, command); + return 0; + } source_file(con, c_ptr); return 0; } diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index fd24a61c7d55c8a91ac9631a7263ca44b81d1606..001ae7bbe0261b7159309fd633e25c9aba6e2158 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -194,7 +194,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { /* Our argp parser. */ static struct argp argp = {options, parse_opt, args_doc, doc}; -char LINUXCLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" +char LINUXCLIENT_VERSION[] = "Welcome to the TDengine Command Line Interface from %s, Client Version:%s\n" "Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.\n\n"; char g_password[SHELL_MAX_PASSWORD_LEN]; diff --git a/src/kit/shell/src/shellWindows.c b/src/kit/shell/src/shellWindows.c index 0133caf997f60a17748a536371479c11b354888d..b5567504edb47d99f4f2b69cf46d2c6d44900e8f 100644 --- a/src/kit/shell/src/shellWindows.c +++ b/src/kit/shell/src/shellWindows.c @@ -21,7 +21,7 @@ extern char configDir[]; -char WINCLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" +char WINCLIENT_VERSION[] = "Welcome to the TDengine Command Line Interface from %s, Client Version:%s\n" "Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.\n\n"; void printVersion() { @@ -30,7 +30,7 @@ void printVersion() { void printHelp() { char indent[10] = " "; - printf("taos shell is used to test the TDengine database\n"); + printf("TDengine Command Line is used to test the TDengine database\n"); printf("%s%s\n", indent, "-h"); printf("%s%s%s\n", indent, indent, "TDengine server FQDN to connect. The default host is localhost."); diff --git a/src/kit/shell/src/tire.c b/src/kit/shell/src/tire.c index b4dc7976bd53f11cccbac2f5db600edeeee861d5..30bb664dcc3b0b63013a68d87de046fc40b02d63 100644 --- a/src/kit/shell/src/tire.c +++ b/src/kit/shell/src/tire.c @@ -325,30 +325,26 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) { } SMatch* matchPrefix(STire* tire, char* prefix, SMatch* match) { - if(match == NULL) { - match = (SMatch* )tmalloc(sizeof(SMatch)); - memset(match, 0, sizeof(SMatch)); - } - - switch (tire->type) { - case TIRE_TREE: - matchPrefixFromTree(tire, prefix, match); - case TIRE_LIST: - matchPrefixFromList(tire, prefix, match); - default: - break; - } - - // return if need - if (match->count == 0) { - freeMatch(match); - match = NULL; - } - - return match; + SMatch* rMatch = match; // define return match + if (rMatch == NULL) { + rMatch = (SMatch*)malloc(sizeof(SMatch)); + memset(rMatch, 0, sizeof(SMatch)); + } + + switch (tire->type) { + case TIRE_TREE: + matchPrefixFromTree(tire, prefix, rMatch); + break; + case TIRE_LIST: + matchPrefixFromList(tire, prefix, rMatch); + break; + default: + break; + } + + return rMatch; } - // get all items from tires tree void enumFromList(STire* tire, SMatch* match) { StrName * item = tire->head; @@ -395,8 +391,10 @@ SMatch* enumAll(STire* tire) { switch (tire->type) { case TIRE_TREE: enumFromTree(tire, match); + break; case TIRE_LIST: enumFromList(tire, match); + break; default: break; } diff --git a/src/kit/taos-tools b/src/kit/taos-tools index f03c09a9f0882949b52f34f11607808ee17bfbc5..cc973e0c2999a739fa2d06c25ab5adb2a7537c8f 160000 --- a/src/kit/taos-tools +++ b/src/kit/taos-tools @@ -1 +1 @@ -Subproject commit f03c09a9f0882949b52f34f11607808ee17bfbc5 +Subproject commit cc973e0c2999a739fa2d06c25ab5adb2a7537c8f diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index cc0b18c9b7047a718f6244cbe20ce76789a21a4c..f7c4ceb0550a18e1366ee2ebae5537dfc994d86e 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -1013,9 +1013,9 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) { newCfg.daysToKeep2 = daysToKeep2; } - if (minRows > 0 && minRows != pDb->cfg.minRowsPerFileBlock) { - mError("db:%s, can't alter minRows option", pDb->name); - terrno = TSDB_CODE_MND_INVALID_DB_OPTION; + if (minRows >= 0 && minRows != pDb->cfg.minRowsPerFileBlock) { + mDebug("db:%s, minRows:%d change to %d", pDb->name, pDb->cfg.minRowsPerFileBlock, minRows); + newCfg.minRowsPerFileBlock = minRows; } if (maxRows > 0 && maxRows != pDb->cfg.maxRowsPerFileBlock) { diff --git a/src/plugins/taosadapter b/src/plugins/taosadapter index 4c8d92596d3c57ebc25e9ce0e0d8582685e6bcda..1e0a02097f8433f557125898c756f293c97da88d 160000 --- a/src/plugins/taosadapter +++ b/src/plugins/taosadapter @@ -1 +1 @@ -Subproject commit 4c8d92596d3c57ebc25e9ce0e0d8582685e6bcda +Subproject commit 1e0a02097f8433f557125898c756f293c97da88d diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 64b22009c34a13c973f3a24fd36e8d992d8d145c..46f94faf189398e879623ff099f210f6bf126f53 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -311,6 +311,7 @@ alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = s alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); } alter_db_optr(Y) ::= alter_db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); } alter_db_optr(Y) ::= alter_db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); } +alter_db_optr(Y) ::= alter_db_optr(Z) minrows(X). { Y = Z; Y.minRowsPerBlock = strtol(X.z, NULL, 10); } // dynamically update the following two parameters are not allowed. //alter_db_optr(Y) ::= alter_db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtol(X.z, NULL, 10); } diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index d12bb28ab819cad0c041828ceeaa72ea924fe4f1..80926e1bb0f3217f3ebff977c1a9634bc573c888 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -30,6 +30,7 @@ #include "qUdf.h" #include "tcompare.h" #include "hashfunc.h" +#include "tglobal.h" #define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput)) #define GET_INPUT_DATA(x, y) (GET_INPUT_DATA_LIST(x) + (y) * (x)->inputBytes) @@ -1952,7 +1953,7 @@ static void stddev_function(SQLFunctionCtx *pCtx) { pStd->avg = GET_DOUBLE_VAL(pCtx->pOutput); assert((isnan(pAvg->sum) && pAvg->num == 0) || (pStd->num == pAvg->num && pStd->avg == pAvg->sum)); } - + if (pStd->stage == 0) { // the first stage is to calculate average value avg_function(pCtx); @@ -1961,7 +1962,7 @@ static void stddev_function(SQLFunctionCtx *pCtx) { // if pStd->num == 0, there are no numbers in the first round check. No need to do the second round double *retVal = &pStd->res; double avg = pStd->avg; - + void *pData = GET_INPUT_DATA_LIST(pCtx); int32_t num = 0; @@ -2015,14 +2016,14 @@ static void stddev_function(SQLFunctionCtx *pCtx) { default: qError("stddev function not support data type:%d", pCtx->inputType); } - + SET_VAL(pCtx, 1, 1); } } static void stddev_finalizer(SQLFunctionCtx *pCtx) { SStddevInfo *pStd = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - + if (pStd->num <= 0) { setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); } else { @@ -2030,7 +2031,7 @@ static void stddev_finalizer(SQLFunctionCtx *pCtx) { SET_DOUBLE_VAL(retValue, sqrt(pStd->res / pStd->num)); SET_VAL(pCtx, 1, 1); } - + doFinalizer(pCtx); } @@ -2183,11 +2184,11 @@ static bool first_last_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* if (!function_setup(pCtx, pResInfo)) { return false; } - + // used to keep the timestamp for comparison pCtx->param[1].nType = 0; pCtx->param[1].i64 = 0; - + return true; } @@ -2216,7 +2217,7 @@ static void first_function(SQLFunctionCtx *pCtx) { if (pCtx->hasNull && isNull(data, pCtx->inputType)) { continue; } - + memcpy(pCtx->pOutput, data, pCtx->inputBytes); if (pCtx->ptsList != NULL) { TSKEY k = GET_TS_DATA(pCtx, i); @@ -2226,7 +2227,7 @@ static void first_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pInfo = GET_RES_INFO(pCtx); pInfo->hasResult = DATA_SET_FLAG; pInfo->complete = true; - + notNullElems++; break; } @@ -2257,14 +2258,14 @@ static void first_function(SQLFunctionCtx *pCtx) { static void first_data_assign_impl(SQLFunctionCtx *pCtx, char *pData, int32_t idx) { int64_t *timestamp = GET_TS_LIST(pCtx); - + SFirstLastInfo *pInfo = (SFirstLastInfo *)(pCtx->pOutput + pCtx->inputBytes); - + if (pInfo->hasResult != DATA_SET_FLAG || timestamp[idx] < pInfo->ts) { memcpy(pCtx->pOutput, pData, pCtx->inputBytes); pInfo->hasResult = DATA_SET_FLAG; pInfo->ts = timestamp[idx]; - + DO_UPDATE_TAG_COLUMNS(pCtx, pInfo->ts); } } @@ -2282,7 +2283,7 @@ static void first_dist_function(SQLFunctionCtx *pCtx) { if (pCtx->order == TSDB_ORDER_DESC/* || pCtx->preAggVals.dataBlockLoaded == false*/) { return; } - + int32_t notNullElems = 0; // find the first not null value @@ -2291,16 +2292,16 @@ static void first_dist_function(SQLFunctionCtx *pCtx) { if (pCtx->hasNull && isNull(data, pCtx->inputType)) { continue; } - + first_data_assign_impl(pCtx, data, i); - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; - + notNullElems++; break; } - + SET_VAL(pCtx, notNullElems, 1); } @@ -2312,16 +2313,16 @@ static void first_dist_func_merge(SQLFunctionCtx *pCtx) { if (pInput->hasResult != DATA_SET_FLAG) { return; } - + // The param[1] is used to keep the initial value of max ts value if (pCtx->param[1].nType != pCtx->outputType || pCtx->param[1].i64 > pInput->ts) { memcpy(pCtx->pOutput, pData, pCtx->outputBytes); pCtx->param[1].i64 = pInput->ts; pCtx->param[1].nType = pCtx->outputType; - + DO_UPDATE_TAG_COLUMNS(pCtx, pInput->ts); } - + SET_VAL(pCtx, 1, 1); GET_RES_INFO(pCtx)->hasResult = DATA_SET_FLAG; } @@ -2395,18 +2396,18 @@ static void last_function(SQLFunctionCtx *pCtx) { static void last_data_assign_impl(SQLFunctionCtx *pCtx, char *pData, int32_t idx) { int64_t *timestamp = GET_TS_LIST(pCtx); - + SFirstLastInfo *pInfo = (SFirstLastInfo *)(pCtx->pOutput + pCtx->inputBytes); - + if (pInfo->hasResult != DATA_SET_FLAG || pInfo->ts < timestamp[idx]) { #if defined(_DEBUG_VIEW) qDebug("assign index:%d, ts:%" PRId64 ", val:%d, ", idx, timestamp[idx], *(int32_t *)pData); #endif - + memcpy(pCtx->pOutput, pData, pCtx->inputBytes); pInfo->hasResult = DATA_SET_FLAG; pInfo->ts = timestamp[idx]; - + DO_UPDATE_TAG_COLUMNS(pCtx, pInfo->ts); } } @@ -2425,19 +2426,19 @@ static void last_dist_function(SQLFunctionCtx *pCtx) { char *data = GET_INPUT_DATA(pCtx, i); if (pCtx->hasNull && isNull(data, pCtx->inputType)) { if (!pCtx->requireNull) { - continue; + continue; } } - + last_data_assign_impl(pCtx, data, i); - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; - + notNullElems++; break; } - + SET_VAL(pCtx, notNullElems, 1); } @@ -2448,12 +2449,12 @@ static void last_dist_function(SQLFunctionCtx *pCtx) { */ static void last_dist_func_merge(SQLFunctionCtx *pCtx) { char *pData = GET_INPUT_DATA_LIST(pCtx); - + SFirstLastInfo *pInput = (SFirstLastInfo*) (pData + pCtx->outputBytes); if (pInput->hasResult != DATA_SET_FLAG) { return; } - + /* * param[1] used to keep the corresponding timestamp to decide if current result is * the true last result @@ -2462,10 +2463,10 @@ static void last_dist_func_merge(SQLFunctionCtx *pCtx) { memcpy(pCtx->pOutput, pData, pCtx->outputBytes); pCtx->param[1].i64 = pInput->ts; pCtx->param[1].nType = pCtx->outputType; - + DO_UPDATE_TAG_COLUMNS(pCtx, pInput->ts); } - + SET_VAL(pCtx, 1, 1); GET_RES_INFO(pCtx)->hasResult = DATA_SET_FLAG; } @@ -2480,16 +2481,16 @@ static void last_row_function(SQLFunctionCtx *pCtx) { // assign the last element in current data block assignVal(pCtx->pOutput, pData + (pCtx->size - 1) * pCtx->inputBytes, pCtx->inputBytes, pCtx->inputType); - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; - + // set the result to final result buffer in case of super table query if (pCtx->stableQuery) { SLastrowInfo *pInfo1 = (SLastrowInfo *)(pCtx->pOutput + pCtx->inputBytes); pInfo1->ts = GET_TS_DATA(pCtx, pCtx->size - 1); pInfo1->hasResult = DATA_SET_FLAG; - + DO_UPDATE_TAG_COLUMNS(pCtx, pInfo1->ts); } else { TSKEY ts = GET_TS_DATA(pCtx, pCtx->size - 1); @@ -2506,7 +2507,7 @@ static void last_row_finalizer(SQLFunctionCtx *pCtx) { setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); return; } - + GET_RES_INFO(pCtx)->numOfRes = 1; doFinalizer(pCtx); } @@ -2517,7 +2518,7 @@ static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int6 dst->v.nType = type; dst->v.i64 = *(int64_t *)val; dst->timestamp = tsKey; - + int32_t size = 0; if (stage == MERGE_STAGE) { memcpy(dst->pTags, pTags, (size_t)pTagInfo->tagsLen); @@ -2528,7 +2529,7 @@ static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int6 ctx->tag.nType = TSDB_DATA_TYPE_BIGINT; ctx->tag.i64 = tsKey; } - + tVariantDump(&ctx->tag, dst->pTags + size, ctx->tag.nType, true); size += pTagInfo->pTagCtxList[i]->outputBytes; } @@ -2589,7 +2590,7 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, SExtTagsInfo *pTagInfo, char *pTags, int16_t stage) { tVariant val = {0}; tVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type); - + tValuePair **pList = pInfo->res; assert(pList != NULL); @@ -2597,7 +2598,7 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, valuePairAssign(pList[pInfo->num], type, (const char *)&val.i64, ts, pTags, pTagInfo, stage); taosheapsort((void *) pList, sizeof(tValuePair **), pInfo->num + 1, (const void *) &type, topBotComparFn, (const void *) &pTagInfo->tagsLen, topBotSwapFn, 0); - + pInfo->num++; } else { if ((IS_SIGNED_NUMERIC_TYPE(type) && val.i64 > pList[0]->v.i64) || @@ -2636,7 +2637,7 @@ static void do_bottom_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pDa static int32_t resAscComparFn(const void *pLeft, const void *pRight) { tValuePair *pLeftElem = *(tValuePair **)pLeft; tValuePair *pRightElem = *(tValuePair **)pRight; - + if (pLeftElem->timestamp == pRightElem->timestamp) { return 0; } else { @@ -2649,7 +2650,7 @@ static int32_t resDescComparFn(const void *pLeft, const void *pRight) { return - static int32_t resDataAscComparFn(const void *pLeft, const void *pRight) { tValuePair *pLeftElem = *(tValuePair **)pLeft; tValuePair *pRightElem = *(tValuePair **)pRight; - + if (IS_FLOAT_TYPE(pLeftElem->v.nType)) { if (pLeftElem->v.dKey == pRightElem->v.dKey) { return 0; @@ -2676,9 +2677,9 @@ static int32_t resDataDescComparFn(const void *pLeft, const void *pRight) { retu static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); STopBotInfo *pRes = GET_ROWCELL_INTERBUF(pResInfo); - + tValuePair **tvp = pRes->res; - + int32_t step = QUERY_ASC_FORWARD_STEP; int32_t len = (int32_t)(GET_RES_INFO(pCtx)->numOfRes); @@ -2734,13 +2735,13 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) { return; } } - + // set the output timestamp of each record. TSKEY *output = pCtx->ptsOutputBuf; for (int32_t i = 0; i < len; ++i, output += step) { *output = tvp[i]->timestamp; } - + // set the corresponding tag data for each record // todo check malloc failure if (pCtx->tagInfo.numOfTagCols == 0) { @@ -2751,7 +2752,7 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) { for (int32_t i = 0; i < pCtx->tagInfo.numOfTagCols; ++i) { pData[i] = pCtx->tagInfo.pTagCtxList[i]->pOutput; } - + for (int32_t i = 0; i < len; ++i, output += step) { int16_t offset = 0; for (int32_t j = 0; j < pCtx->tagInfo.numOfTagCols; ++j) { @@ -2760,7 +2761,7 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) { pData[j] += pCtx->tagInfo.pTagCtxList[j]->outputBytes; } } - + tfree(pData); } @@ -2791,18 +2792,18 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha } STopBotInfo *pTopBotInfo = getOutputInfo(pCtx); - + // required number of results are not reached, continue load data block if (pTopBotInfo->num < pCtx->param[0].i64) { return true; } - + if ((void *)pTopBotInfo->res[0] != (void *)((char *)pTopBotInfo + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) { buildTopBotStruct(pTopBotInfo, pCtx); } tValuePair **pRes = (tValuePair**) pTopBotInfo->res; - + if (pCtx->functionId == TSDB_FUNC_TOP) { switch (pCtx->inputType) { case TSDB_DATA_TYPE_TINYINT: @@ -2844,7 +2845,7 @@ static bool top_bottom_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* if (!function_setup(pCtx, pResInfo)) { return false; } - + STopBotInfo *pInfo = getOutputInfo(pCtx); buildTopBotStruct(pInfo, pCtx); return true; @@ -2859,27 +2860,27 @@ static void top_function(SQLFunctionCtx *pCtx) { if ((void *)pRes->res[0] != (void *)((char *)pRes + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) { buildTopBotStruct(pRes, pCtx); } - + for (int32_t i = 0; i < pCtx->size; ++i) { char *data = GET_INPUT_DATA(pCtx, i); if (pCtx->hasNull && isNull(data, pCtx->inputType)) { continue; } - + notNullElems++; // NOTE: Set the default timestamp if it is missing [todo refactor] TSKEY ts = (pCtx->ptsList != NULL)? GET_TS_DATA(pCtx, i):0; do_top_function_add(pRes, (int32_t)pCtx->param[0].i64, data, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); } - + if (!pCtx->hasNull) { assert(pCtx->size == notNullElems); } - + // treat the result as only one result SET_VAL(pCtx, notNullElems, 1); - + if (notNullElems > 0) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; @@ -2888,21 +2889,21 @@ static void top_function(SQLFunctionCtx *pCtx) { static void top_func_merge(SQLFunctionCtx *pCtx) { STopBotInfo *pInput = (STopBotInfo *)GET_INPUT_DATA_LIST(pCtx); - + // construct the input data struct from binary data buildTopBotStruct(pInput, pCtx); - + STopBotInfo *pOutput = getOutputInfo(pCtx); - + // the intermediate result is binary, we only use the output data type for (int32_t i = 0; i < pInput->num; ++i) { int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT)? TSDB_DATA_TYPE_DOUBLE:pCtx->outputType; do_top_function_add(pOutput, (int32_t)pCtx->param[0].i64, &pInput->res[i]->v.i64, pInput->res[i]->timestamp, type, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); } - + SET_VAL(pCtx, pInput->num, pOutput->num); - + if (pOutput->num > 0) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; @@ -2911,9 +2912,9 @@ static void top_func_merge(SQLFunctionCtx *pCtx) { static void bottom_function(SQLFunctionCtx *pCtx) { int32_t notNullElems = 0; - + STopBotInfo *pRes = getOutputInfo(pCtx); - + if ((void *)pRes->res[0] != (void *)((char *)pRes + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) { buildTopBotStruct(pRes, pCtx); } @@ -2929,14 +2930,14 @@ static void bottom_function(SQLFunctionCtx *pCtx) { TSKEY ts = (pCtx->ptsList != NULL)? GET_TS_DATA(pCtx, i):0; do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64, data, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); } - + if (!pCtx->hasNull) { assert(pCtx->size == notNullElems); } - + // treat the result as only one result SET_VAL(pCtx, notNullElems, 1); - + if (notNullElems > 0) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; @@ -2945,12 +2946,12 @@ static void bottom_function(SQLFunctionCtx *pCtx) { static void bottom_func_merge(SQLFunctionCtx *pCtx) { STopBotInfo *pInput = (STopBotInfo *)GET_INPUT_DATA_LIST(pCtx); - + // construct the input data struct from binary data buildTopBotStruct(pInput, pCtx); - + STopBotInfo *pOutput = getOutputInfo(pCtx); - + // the intermediate result is binary, we only use the output data type for (int32_t i = 0; i < pInput->num; ++i) { int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT) ? TSDB_DATA_TYPE_DOUBLE : pCtx->outputType; @@ -2959,7 +2960,7 @@ static void bottom_func_merge(SQLFunctionCtx *pCtx) { } SET_VAL(pCtx, pInput->num, pOutput->num); - + if (pOutput->num > 0) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; @@ -2968,17 +2969,17 @@ static void bottom_func_merge(SQLFunctionCtx *pCtx) { static void top_bottom_func_finalizer(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); - + // data in temporary list is less than the required number of results, not enough qualified number of results STopBotInfo *pRes = GET_ROWCELL_INTERBUF(pResInfo); if (pRes->num == 0) { // no result assert(pResInfo->hasResult != DATA_SET_FLAG); // TODO: } - + GET_RES_INFO(pCtx)->numOfRes = pRes->num; tValuePair **tvp = pRes->res; - + // user specify the order of output by sort the result according to timestamp if (pCtx->param[2].i64 == PRIMARYKEY_TIMESTAMP_COL_INDEX) { __compar_fn_t comparator = (pCtx->param[3].i64 == TSDB_ORDER_ASC) ? resAscComparFn : resDescComparFn; @@ -2987,10 +2988,10 @@ static void top_bottom_func_finalizer(SQLFunctionCtx *pCtx) { __compar_fn_t comparator = (pCtx->param[3].i64 == TSDB_ORDER_ASC) ? resDataAscComparFn : resDataDescComparFn; qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); } - + GET_TRUE_DATA_TYPE(); copyTopBotRes(pCtx, type); - + doFinalizer(pCtx); } @@ -3011,7 +3012,7 @@ static bool percentile_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* static void percentile_function(SQLFunctionCtx *pCtx) { int32_t notNullElems = 0; - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SPercentileInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); @@ -3021,7 +3022,7 @@ static void percentile_function(SQLFunctionCtx *pCtx) { // all data are null, set it completed if (pInfo->numOfElems == 0) { pResInfo->complete = true; - + return; } else { pInfo->pMemBucket = tMemBucketCreate(pCtx->inputBytes, pCtx->inputType, pInfo->minval, pInfo->maxval); @@ -3085,18 +3086,18 @@ static void percentile_function(SQLFunctionCtx *pCtx) { if (pCtx->hasNull && isNull(data, pCtx->inputType)) { continue; } - + notNullElems += 1; tMemBucketPut(pInfo->pMemBucket, data, 1); } - + SET_VAL(pCtx, notNullElems, 1); pResInfo->hasResult = DATA_SET_FLAG; } static void percentile_finalizer(SQLFunctionCtx *pCtx) { double v = pCtx->param[0].nType == TSDB_DATA_TYPE_INT ? pCtx->param[0].i64 : pCtx->param[0].dKey; - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SPercentileInfo* ppInfo = (SPercentileInfo *) GET_ROWCELL_INTERBUF(pResInfo); @@ -3108,7 +3109,7 @@ static void percentile_finalizer(SQLFunctionCtx *pCtx) { } else { SET_DOUBLE_VAL((double *)pCtx->pOutput, getPercentile(pMemBucket, v)); } - + tMemBucketDestroy(pMemBucket); doFinalizer(pCtx); } @@ -3128,7 +3129,7 @@ static bool tdigest_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo *pResultInfo) if (!function_setup(pCtx, pResultInfo)) { return false; } - + // new TDigest SAPercentileInfo *pInfo = getOutputInfo(pCtx); char *tmp = (char *)pInfo + sizeof(SAPercentileInfo); @@ -3155,7 +3156,7 @@ static void tdigest_do(SQLFunctionCtx *pCtx) { } notNullElems += 1; - double v = 0; // value + double v = 0; // value long long w = 1; // weigth GET_TYPED_DATA(v, double, pCtx->inputType, data); tdigestAdd(pAPerc->pTDigest, v, w); @@ -3189,7 +3190,7 @@ static void tdigest_merge(SQLFunctionCtx *pCtx) { } else { tdigestMerge(pOutput->pTDigest, pInput->pTDigest); } - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; SET_VAL(pCtx, 1, 1); @@ -3242,10 +3243,10 @@ static bool apercentile_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* if (!function_setup(pCtx, pResultInfo)) { return false; } - + SAPercentileInfo *pInfo = getOutputInfo(pCtx); buildHistogramInfo(pInfo); - + char *tmp = (char *)pInfo + sizeof(SAPercentileInfo); pInfo->pHisto = tHistogramCreateFrom(tmp, MAX_HISTOGRAM_BIN); return true; @@ -3258,32 +3259,32 @@ static void apercentile_function(SQLFunctionCtx *pCtx) { } int32_t notNullElems = 0; - + SResultRowCellInfo * pResInfo = GET_RES_INFO(pCtx); SAPercentileInfo *pInfo = getOutputInfo(pCtx); buildHistogramInfo(pInfo); assert(pInfo->pHisto->elems != NULL); - + for (int32_t i = 0; i < pCtx->size; ++i) { char *data = GET_INPUT_DATA(pCtx, i); if (pCtx->hasNull && isNull(data, pCtx->inputType)) { continue; } - + notNullElems += 1; double v = 0; GET_TYPED_DATA(v, double, pCtx->inputType, data); tHistogramAdd(&pInfo->pHisto, v); } - + if (!pCtx->hasNull) { assert(pCtx->size == notNullElems); } - + SET_VAL(pCtx, notNullElems, 1); - + if (notNullElems > 0) { pResInfo->hasResult = DATA_SET_FLAG; } @@ -3296,23 +3297,23 @@ static void apercentile_func_merge(SQLFunctionCtx *pCtx) { } SAPercentileInfo *pInput = (SAPercentileInfo *)GET_INPUT_DATA_LIST(pCtx); - + pInput->pHisto = (SHistogramInfo*) ((char *)pInput + sizeof(SAPercentileInfo)); pInput->pHisto->elems = (SHistBin*) ((char *)pInput->pHisto + sizeof(SHistogramInfo)); if (pInput->pHisto->numOfElems <= 0) { return; } - + SAPercentileInfo *pOutput = getOutputInfo(pCtx); buildHistogramInfo(pOutput); SHistogramInfo *pHisto = pOutput->pHisto; - + if (pHisto->numOfElems <= 0) { memcpy(pHisto, pInput->pHisto, sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo)); } else { - //TODO(dengyihao): avoid memcpy + //TODO(dengyihao): avoid memcpy pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo)); SHistogramInfo *pRes = tHistogramMerge(pHisto, pInput->pHisto, MAX_HISTOGRAM_BIN); memcpy(pHisto, pRes, sizeof(SHistogramInfo) + sizeof(SHistBin) * MAX_HISTOGRAM_BIN); @@ -3332,17 +3333,17 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) { } double v = (pCtx->param[0].nType == TSDB_DATA_TYPE_INT) ? pCtx->param[0].i64 : pCtx->param[0].dKey; - + SResultRowCellInfo * pResInfo = GET_RES_INFO(pCtx); SAPercentileInfo *pOutput = GET_ROWCELL_INTERBUF(pResInfo); if (pCtx->currentStage == MERGE_STAGE) { if (pResInfo->hasResult == DATA_SET_FLAG) { // check for null assert(pOutput->pHisto->numOfElems > 0); - + double ratio[] = {v}; double *res = tHistogramUniform(pOutput->pHisto, ratio, 1); - + memcpy(pCtx->pOutput, res, sizeof(double)); free(res); } else { @@ -3352,7 +3353,7 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) { } else { if (pOutput->pHisto->numOfElems > 0) { double ratio[] = {v}; - + double *res = tHistogramUniform(pOutput->pHisto, ratio, 1); memcpy(pCtx->pOutput, res, sizeof(double)); free(res); @@ -3361,7 +3362,7 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) { return; } } - + doFinalizer(pCtx); } @@ -3372,7 +3373,7 @@ static bool leastsquares_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo } SLeastsquaresInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - + // 2*3 matrix pInfo->startVal = pCtx->param[0].dKey; return true; @@ -3399,12 +3400,12 @@ static bool leastsquares_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo static void leastsquares_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo * pResInfo = GET_RES_INFO(pCtx); SLeastsquaresInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - + double(*param)[3] = pInfo->mat; double x = pInfo->startVal; - + void *pData = GET_INPUT_DATA_LIST(pCtx); - + int32_t numOfElem = 0; switch (pCtx->inputType) { case TSDB_DATA_TYPE_INT: { @@ -3414,12 +3415,12 @@ static void leastsquares_function(SQLFunctionCtx *pCtx) { if (pCtx->hasNull && isNull((const char*) p, pCtx->inputType)) { continue; } - + param[0][0] += x * x; param[0][1] += x; param[0][2] += x * p[i]; param[1][2] += p[i]; - + x += pCtx->param[1].dKey; numOfElem++; } @@ -3471,14 +3472,14 @@ static void leastsquares_function(SQLFunctionCtx *pCtx) { break; } } - + pInfo->startVal = x; pInfo->num += numOfElem; - + if (pInfo->num > 0) { pResInfo->hasResult = DATA_SET_FLAG; } - + SET_VAL(pCtx, numOfElem, 1); } @@ -3486,30 +3487,30 @@ static void leastsquares_finalizer(SQLFunctionCtx *pCtx) { // no data in query SResultRowCellInfo * pResInfo = GET_RES_INFO(pCtx); SLeastsquaresInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - + if (pInfo->num == 0) { setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); return; } - + double(*param)[3] = pInfo->mat; - + param[1][1] = (double)pInfo->num; param[1][0] = param[0][1]; - + param[0][0] -= param[1][0] * (param[0][1] / param[1][1]); param[0][2] -= param[1][2] * (param[0][1] / param[1][1]); param[0][1] = 0; param[1][2] -= param[0][2] * (param[1][0] / param[0][0]); param[1][0] = 0; param[0][2] /= param[0][0]; - + param[1][2] /= param[1][1]; - + int32_t maxOutputSize = TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE - VARSTR_HEADER_SIZE; size_t n = snprintf(varDataVal(pCtx->pOutput), maxOutputSize, "{slop:%.6lf, intercept:%.6lf}", param[0][2], param[1][2]); - + varDataSetLen(pCtx->pOutput, n); doFinalizer(pCtx); } @@ -3562,7 +3563,7 @@ static void col_project_function(SQLFunctionCtx *pCtx) { */ static void tag_project_function(SQLFunctionCtx *pCtx) { INC_INIT_VAL(pCtx, pCtx->size); - + assert(pCtx->inputBytes == pCtx->outputBytes); tVariantDump(&pCtx->tag, pCtx->pOutput, pCtx->outputType, true); @@ -3597,7 +3598,7 @@ static void tag_function(SQLFunctionCtx *pCtx) { static void copy_function(SQLFunctionCtx *pCtx) { SET_VAL(pCtx, pCtx->size, 1); - + char *pData = GET_INPUT_DATA_LIST(pCtx); assignVal(pCtx->pOutput, pData, pCtx->inputBytes, pCtx->inputType); } @@ -3668,7 +3669,7 @@ static void row_copy_function(SQLFunctionCtx *pCtx) { static void full_copy_function(SQLFunctionCtx *pCtx) { copy_function(pCtx); - + for (int t = 0; t < pCtx->tagInfo.numOfTagCols; ++t) { SQLFunctionCtx* tagCtx = pCtx->tagInfo.pTagCtxList[t]; if (tagCtx->functionId == TSDB_FUNC_TAG_DUMMY) { @@ -3682,7 +3683,7 @@ static bool diff_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResIn if (!function_setup(pCtx, pResInfo)) { return false; } - + SDiffFuncInfo* pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo); pDiffInfo->valueAssigned = false; pDiffInfo->i64Prev = 0; @@ -3997,10 +3998,10 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pDiffInfo->valueAssigned) { + if (pDiffInfo->valueAssigned) { float diff = (float)(pData[i] - pDiffInfo->d64Prev); if (diff >= 0 || !pDiffInfo->ignoreNegative) { - *pOutput = diff; + *pOutput = diff; *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; @@ -4084,7 +4085,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { char *getScalarExprColumnData(void *param, const char* name, int32_t colId) { SScalarExprSupport *pSupport = (SScalarExprSupport *)param; - + int32_t idx = -1; for (int32_t i = 0; i < pSupport->numOfCols; ++i) { if (colId == pSupport->colList[i].colId) { @@ -4092,7 +4093,7 @@ char *getScalarExprColumnData(void *param, const char* name, int32_t colId) { break; } } - + assert(idx >= 0); return pSupport->data[idx] + pSupport->offset * pSupport->colList[idx].bytes; } @@ -4127,9 +4128,9 @@ static bool spread_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pRes if (!function_setup(pCtx, pResInfo)) { return false; } - + SSpreadInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - + // this is the server-side setup function in client-side, the secondary merge do not need this procedure if (pCtx->currentStage == MERGE_STAGE) { pCtx->param[0].dKey = DBL_MAX; @@ -4138,21 +4139,21 @@ static bool spread_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pRes pInfo->min = DBL_MAX; pInfo->max = -DBL_MAX; } - + return true; } static void spread_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SSpreadInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - + int32_t numOfElems = 0; // todo : opt with pre-calculated result // column missing cause the hasNull to be true if (pCtx->preAggVals.isSet) { numOfElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; - + // all data are null in current data block, ignore current data block if (numOfElems == 0) { goto _spread_over; @@ -4171,18 +4172,18 @@ static void spread_function(SQLFunctionCtx *pCtx) { if (pInfo->min > GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.min))) { pInfo->min = GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.min)); } - + if (pInfo->max < GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.max))) { pInfo->max = GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.max)); } } - + goto _spread_over; } - + void *pData = GET_INPUT_DATA_LIST(pCtx); numOfElems = 0; - + if (pCtx->inputType == TSDB_DATA_TYPE_TINYINT) { LIST_MINMAX_N(pCtx, pInfo->min, pInfo->max, pCtx->size, pData, int8_t, pCtx->inputType, numOfElems); } else if (pCtx->inputType == TSDB_DATA_TYPE_SMALLINT) { @@ -4204,19 +4205,19 @@ static void spread_function(SQLFunctionCtx *pCtx) { } else if (pCtx->inputType == TSDB_DATA_TYPE_UBIGINT) { LIST_MINMAX_N(pCtx, pInfo->min, pInfo->max, pCtx->size, pData, uint64_t, pCtx->inputType, numOfElems); } - + if (!pCtx->hasNull) { assert(pCtx->size == numOfElems); } - + _spread_over: SET_VAL(pCtx, numOfElems, 1); - + if (numOfElems > 0) { pResInfo->hasResult = DATA_SET_FLAG; pInfo->hasResult = DATA_SET_FLAG; } - + // keep the data into the final output buffer for super table query since this execution may be the last one if (pCtx->stableQuery) { memcpy(pCtx->pOutput, GET_ROWCELL_INTERBUF(pResInfo), sizeof(SSpreadInfo)); @@ -4232,15 +4233,15 @@ void spread_func_merge(SQLFunctionCtx *pCtx) { if (pData->hasResult != DATA_SET_FLAG) { return; } - + if (pCtx->param[0].dKey > pData->min) { pCtx->param[0].dKey = pData->min; } - + if (pCtx->param[3].dKey < pData->max) { pCtx->param[3].dKey = pData->max; } - + GET_RES_INFO(pCtx)->hasResult = DATA_SET_FLAG; } @@ -4253,25 +4254,25 @@ void spread_function_finalizer(SQLFunctionCtx *pCtx) { if (pCtx->currentStage == MERGE_STAGE) { assert(pCtx->inputType == TSDB_DATA_TYPE_BINARY); - + if (pResInfo->hasResult != DATA_SET_FLAG) { setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); return; } - + SET_DOUBLE_VAL((double *)pCtx->pOutput, pCtx->param[3].dKey - pCtx->param[0].dKey); } else { assert(IS_NUMERIC_TYPE(pCtx->inputType) || (pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP)); - + SSpreadInfo *pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); if (pInfo->hasResult != DATA_SET_FLAG) { setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); return; } - + SET_DOUBLE_VAL((double *)pCtx->pOutput, pInfo->max - pInfo->min); } - + GET_RES_INFO(pCtx)->numOfRes = 1; // todo add test case doFinalizer(pCtx); } @@ -4354,7 +4355,7 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4366,14 +4367,14 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size if (pCtx->hasNull && isNull((const char*) &val[i], pCtx->inputType)) { continue; } - + #ifndef _TD_NINGSI_60 SPoint1 st = {.key = tsList[i], .val = val[i]}; #else SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4385,14 +4386,14 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size if (pCtx->hasNull && isNull((const char*) &val[i], pCtx->inputType)) { continue; } - + #ifndef _TD_NINGSI_60 SPoint1 st = {.key = tsList[i], .val = val[i]}; #else SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4404,14 +4405,14 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size if (pCtx->hasNull && isNull((const char*) &val[i], pCtx->inputType)) { continue; } - + #ifndef _TD_NINGSI_60 SPoint1 st = {.key = tsList[i], .val = (double) val[i]}; #else SPoint1 st; st.key = tsList[i]; st.val = (double)val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4423,14 +4424,14 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size if (pCtx->hasNull && isNull((const char*) &val[i], pCtx->inputType)) { continue; } - + #ifndef _TD_NINGSI_60 SPoint1 st = {.key = tsList[i], .val = val[i]}; #else SPoint1 st; st.key = tsList[i]; st.val = (double)val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4442,14 +4443,14 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size if (pCtx->hasNull && isNull((const char*) &val[i], pCtx->inputType)) { continue; } - + #ifndef _TD_NINGSI_60 SPoint1 st = {.key = tsList[i], .val = val[i]}; #else SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4468,7 +4469,7 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4487,7 +4488,7 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4506,7 +4507,7 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size SPoint1 st; st.key = tsList[i]; st.val = val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4518,14 +4519,14 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t idx, int32_t size if (pCtx->hasNull && isNull((const char*) &val[i], pCtx->inputType)) { continue; } - + #ifndef _TD_NINGSI_60 SPoint1 st = {.key = tsList[i], .val = (double) val[i]}; #else SPoint1 st; st.key = tsList[i]; st.val = (double) val[i]; -#endif +#endif pInfo->dOutput += twa_get_area(pInfo->p, st); pInfo->p = st; } @@ -4549,7 +4550,7 @@ static void twa_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); STwaInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - + // skip null value int32_t step = GET_FORWARD_DIRECTION_FACTOR(pCtx->order); int32_t i = (pCtx->order == TSDB_ORDER_ASC)? 0:(pCtx->size - 1); @@ -4563,11 +4564,11 @@ static void twa_function(SQLFunctionCtx *pCtx) { } SET_VAL(pCtx, notNullElems, 1); - + if (notNullElems > 0) { pResInfo->hasResult = DATA_SET_FLAG; } - + if (pCtx->stableQuery) { memcpy(pCtx->pOutput, pInfo, sizeof(STwaInfo)); } @@ -4581,14 +4582,14 @@ static void twa_function(SQLFunctionCtx *pCtx) { void twa_function_copy(SQLFunctionCtx *pCtx) { assert(pCtx->inputType == TSDB_DATA_TYPE_BINARY); SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); - + memcpy(GET_ROWCELL_INTERBUF(pResInfo), pCtx->pInput, (size_t)pCtx->inputBytes); pResInfo->hasResult = ((STwaInfo *)pCtx->pInput)->hasResult; } void twa_function_finalizer(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); - + STwaInfo *pInfo = (STwaInfo *)GET_ROWCELL_INTERBUF(pResInfo); if (pInfo->hasResult != DATA_SET_FLAG) { setNull(pCtx->pOutput, TSDB_DATA_TYPE_DOUBLE, sizeof(double)); @@ -4601,7 +4602,7 @@ void twa_function_finalizer(SQLFunctionCtx *pCtx) { } else { SET_DOUBLE_VAL((double *)pCtx->pOutput , pInfo->dOutput / (pInfo->win.ekey - pInfo->win.skey)); } - + GET_RES_INFO(pCtx)->numOfRes = 1; doFinalizer(pCtx); } @@ -4612,27 +4613,27 @@ static void interp_function(SQLFunctionCtx *pCtx) { if (pCtx->start.key == pCtx->startTs) { assert(pCtx->start.key != INT64_MIN); - + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->start.val); - - goto interp_success_exit; + + goto interp_success_exit; } else if (pCtx->end.key == pCtx->startTs && pCtx->end.key != INT64_MIN && fillType == TSDB_FILL_NEXT) { COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->end.val); - - goto interp_success_exit; + + goto interp_success_exit; } switch (fillType) { case TSDB_FILL_NULL: setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); break; - + case TSDB_FILL_SET_VALUE: tVariantDump(&pCtx->param[1], pCtx->pOutput, pCtx->inputType, true); break; - + case TSDB_FILL_LINEAR: - if (pCtx->start.key == INT64_MIN || pCtx->start.key > pCtx->startTs + if (pCtx->start.key == INT64_MIN || pCtx->start.key > pCtx->startTs || pCtx->end.key == INT64_MIN || pCtx->end.key < pCtx->startTs) { goto interp_exit; } @@ -4640,7 +4641,7 @@ static void interp_function(SQLFunctionCtx *pCtx) { double v1 = -1, v2 = -1; GET_TYPED_DATA(v1, double, pCtx->inputType, &pCtx->start.val); GET_TYPED_DATA(v2, double, pCtx->inputType, &pCtx->end.val); - + SPoint point1 = {.key = pCtx->start.key, .val = &v1}; SPoint point2 = {.key = pCtx->end.key, .val = &v2}; SPoint point = {.key = pCtx->startTs, .val = pCtx->pOutput}; @@ -4653,7 +4654,7 @@ static void interp_function(SQLFunctionCtx *pCtx) { taosGetLinearInterpolationVal(&point, pCtx->outputType, &point1, &point2, TSDB_DATA_TYPE_DOUBLE, &exceedMax, &exceedMin); if (exceedMax || exceedMin) { __compar_fn_t func = getComparFunc((int32_t)pCtx->inputType, 0); - if (func(&pCtx->start.val, &pCtx->end.val) <= 0) { + if (func(&pCtx->start.val, &pCtx->end.val) <= 0) { COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, exceedMax ? &pCtx->start.val : &pCtx->end.val); } else { COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, exceedMax ? &pCtx->end.val : &pCtx->start.val); @@ -4674,7 +4675,7 @@ static void interp_function(SQLFunctionCtx *pCtx) { if (pCtx->end.key == INT64_MIN || pCtx->end.key < pCtx->startTs) { goto interp_exit; } - + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->end.val); break; @@ -4684,7 +4685,7 @@ static void interp_function(SQLFunctionCtx *pCtx) { } -interp_success_exit: +interp_success_exit: *(TSKEY*)pCtx->ptsOutputBuf = pCtx->startTs; @@ -4713,9 +4714,9 @@ static bool ts_comp_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pRe static void ts_comp_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); STSBuf * pTSbuf = ((STSCompInfo *)(GET_ROWCELL_INTERBUF(pResInfo)))->pTSBuf; - + const char *input = GET_INPUT_DATA_LIST(pCtx); - + // primary ts must be existed, so no need to check its existance if (pCtx->order == TSDB_ORDER_ASC) { tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64, &pCtx->tag, input, pCtx->size * TSDB_KEYSIZE); @@ -4725,17 +4726,17 @@ static void ts_comp_function(SQLFunctionCtx *pCtx) { tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64, &pCtx->tag, d, (int32_t)TSDB_KEYSIZE); } } - + SET_VAL(pCtx, pCtx->size, 1); pResInfo->hasResult = DATA_SET_FLAG; } static void ts_comp_finalize(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); - + STSCompInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); STSBuf * pTSbuf = pInfo->pTSBuf; - + tsBufFlush(pTSbuf); qDebug("total timestamp :%"PRId64, pTSbuf->numOfTotal); @@ -4778,7 +4779,7 @@ static double do_calc_rate(const SRateInfo* pRateInfo, double tickPerSec) { return 0; } } - + int64_t duration = pRateInfo->lastKey - pRateInfo->firstKey; if (duration == 0) { return 0; @@ -4791,7 +4792,7 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResIn if (!function_setup(pCtx, pResInfo)) { return false; } - + SRateInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); pInfo->correctionValue = 0; pInfo->firstKey = INT64_MIN; @@ -4806,51 +4807,51 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResIn static void rate_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); - + int32_t notNullElems = 0; SRateInfo *pRateInfo = (SRateInfo *)GET_ROWCELL_INTERBUF(pResInfo); TSKEY *primaryKey = GET_TS_LIST(pCtx); - + qDebug("%p rate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull); - + for (int32_t i = 0; i < pCtx->size; ++i) { char *pData = GET_INPUT_DATA(pCtx, i); if (pCtx->hasNull && isNull(pData, pCtx->inputType)) { qDebug("%p rate_function() index of null data:%d", pCtx, i); continue; } - + notNullElems++; - + double v = 0; GET_TYPED_DATA(v, double, pCtx->inputType, pData); - + if ((INT64_MIN == pRateInfo->firstValue) || (INT64_MIN == pRateInfo->firstKey)) { pRateInfo->firstValue = v; pRateInfo->firstKey = primaryKey[i]; } - + if (INT64_MIN == pRateInfo->lastValue) { pRateInfo->lastValue = v; } else if (v < pRateInfo->lastValue) { pRateInfo->correctionValue += pRateInfo->lastValue; } - + pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[i]; } - + if (!pCtx->hasNull) { assert(pCtx->size == notNullElems); } - + SET_VAL(pCtx, notNullElems, 1); - + if (notNullElems > 0) { pRateInfo->hasResult = DATA_SET_FLAG; pResInfo->hasResult = DATA_SET_FLAG; } - + // keep the data into the final output buffer for super table query since this execution may be the last one if (pCtx->stableQuery) { memcpy(pCtx->pOutput, GET_ROWCELL_INTERBUF(pResInfo), sizeof(SRateInfo)); @@ -4859,7 +4860,7 @@ static void rate_function(SQLFunctionCtx *pCtx) { static void rate_func_copy(SQLFunctionCtx *pCtx) { assert(pCtx->inputType == TSDB_DATA_TYPE_BINARY); - + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); memcpy(GET_ROWCELL_INTERBUF(pResInfo), pCtx->pInput, (size_t)pCtx->inputBytes); pResInfo->hasResult = ((SRateInfo*)pCtx->pInput)->hasResult; @@ -4873,13 +4874,13 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) { setNull(pCtx->pOutput, TSDB_DATA_TYPE_DOUBLE, sizeof(double)); return; } - + SET_DOUBLE_VAL((double*) pCtx->pOutput, do_calc_rate(pRateInfo, (double) TSDB_TICK_PER_SECOND(pCtx->param[0].i64))); // cannot set the numOfIteratedElems again since it is set during previous iteration pResInfo->numOfRes = 1; pResInfo->hasResult = DATA_SET_FLAG; - + doFinalizer(pCtx); } @@ -4895,9 +4896,9 @@ static void irate_function(SQLFunctionCtx *pCtx) { if (pCtx->hasNull && isNull(pData, pCtx->inputType)) { continue; } - + notNullElems++; - + double v = 0; GET_TYPED_DATA(v, double, pCtx->inputType, pData); @@ -4915,24 +4916,24 @@ static void irate_function(SQLFunctionCtx *pCtx) { pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[i]; - + continue; } - + if ((INT64_MIN == pRateInfo->firstKey) || primaryKey[i] > pRateInfo->firstKey) { pRateInfo->firstValue = v; pRateInfo->firstKey = primaryKey[i]; break; } } - + SET_VAL(pCtx, notNullElems, 1); - + if (notNullElems > 0) { pRateInfo->hasResult = DATA_SET_FLAG; pResInfo->hasResult = DATA_SET_FLAG; } - + // keep the data into the final output buffer for super table query since this execution may be the last one if (pCtx->stableQuery) { memcpy(pCtx->pOutput, GET_ROWCELL_INTERBUF(pResInfo), sizeof(SRateInfo)); @@ -5508,7 +5509,7 @@ static void elapsedFunction(SQLFunctionCtx *pCtx) { elapsedOver: SET_VAL(pCtx, pCtx->size, 1); - + if (pCtx->size > 0) { GET_RES_INFO(pCtx)->hasResult = DATA_SET_FLAG; pInfo->hasResult = DATA_SET_FLAG; @@ -5901,16 +5902,21 @@ static void mode_func_finalizer(SQLFunctionCtx *pCtx) { int32_t type = 0; if (pCtx->currentStage == MERGE_STAGE) { bytes = pCtx->outputBytes; - type = pCtx->outputType; + type = pCtx->outputType; assert(pCtx->inputType == TSDB_DATA_TYPE_BINARY); } else { bytes = pCtx->inputBytes; - type = pCtx->inputType; + type = pCtx->inputType; } SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SModeFuncInfo *pRes = GET_ROWCELL_INTERBUF(pResInfo); + if (pRes->num == 0) { + setNull(pCtx->pOutput, type, 0); + goto _mode_over; + } + size_t size = sizeof(ModeUnit) + bytes; char *tvp = pRes->res; @@ -5918,20 +5924,18 @@ static void mode_func_finalizer(SQLFunctionCtx *pCtx) { int64_t maxCount = 0; for (int32_t i = 0; i < pRes->num; ++i) { int64_t count = ((ModeUnit*)tvp)->count; - if (count > maxCount){ + if (count >= maxCount){ maxCount = count; result = tvp; - }else if(count == maxCount){ - result = NULL; } + tvp += size; } - if (result){ - memcpy(pCtx->pOutput, result + sizeof(ModeUnit), bytes); - }else{ - setNull(pCtx->pOutput, type, 0); - } + memcpy(pCtx->pOutput, result + sizeof(ModeUnit), bytes); + +_mode_over: + pResInfo->numOfRes = 1; doFinalizer(pCtx); } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index dca79babce9388d7f2d1750db2c9b8410b23c8d1..c352c9c47a99fa27a5942081b9735bfa3878c067 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -3668,7 +3668,7 @@ int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) { int32_t midPos = -1; int32_t numOfRows; - if (num <= 0) { + if (num <= 0 || pValue == NULL) { return -1; } @@ -5447,7 +5447,8 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr int16_t order = (pQueryAttr->order.order == pRuntimeEnv->pTsBuf->tsOrder) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; tsBufResetPos(pRuntimeEnv->pTsBuf); tsBufSetTraverseOrder(pRuntimeEnv->pTsBuf, order); - tsBufNextPos(pTsBuf); + bool ret = tsBufNextPos(pTsBuf); + UNUSED(ret); } int32_t ps = DEFAULT_PAGE_SIZE; @@ -6154,7 +6155,7 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, goto _clean; } - pInfo->seed = rand(); + pInfo->seed = taosSafeRand(); setDefaultOutputBuf(pRuntimeEnv, &pInfo->binfo, pInfo->seed, MERGE_STAGE); SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); @@ -6329,6 +6330,7 @@ SOperatorInfo* createOrderOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorI pDataBlock->pDataBlock = taosArrayInit(numOfOutput, sizeof(SColumnInfoData)); if (pDataBlock->pDataBlock == NULL) { + free(pDataBlock); goto _clean; } @@ -6623,7 +6625,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { } copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); - return (pInfo->pRes->info.rows > 0) ? pInfo->pRes : NULL; + return pInfo->pRes; } static SSDataBlock* doLimit(void* param, bool* newgroup) { @@ -6872,14 +6874,18 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo break; } } - + + if (pCtx == NULL) { + goto group_finished_exit; + } + TSKEY* tsCols = NULL; if (pBlock && pBlock->pDataBlock != NULL) { SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, 0); tsCols = (int64_t*)pColDataInfo->pData; assert(tsCols[0] == pBlock->info.window.skey && tsCols[pBlock->info.rows - 1] == pBlock->info.window.ekey); } - + if (pCtx->startTs == INT64_MIN) { if (pQueryAttr->range.skey == INT64_MIN) { if (NULL == tsCols) { @@ -6977,8 +6983,8 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo return false; } - - int32_t startPos = binarySearchForKey((char*)tsCols, pBlock->info.rows, pCtx->startTs, pQueryAttr->order.order); + int32_t nRows = pBlock ? pBlock->info.rows : 0; + int32_t startPos = binarySearchForKey((char*) tsCols, nRows, pCtx->startTs, pQueryAttr->order.order); if (ascQuery && pQueryAttr->fillType != TSDB_FILL_NEXT && pCtx->start.key == INT64_MIN) { if (startPos < 0) { @@ -7778,7 +7784,7 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera goto _clean; } - pInfo->seed = rand(); + pInfo->seed = taosSafeRand(); setDefaultOutputBuf(pRuntimeEnv, &pInfo->binfo, pInfo->seed, MASTER_SCAN); SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); @@ -7985,7 +7991,7 @@ SOperatorInfo* createProjectOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato return NULL; } - pInfo->seed = rand(); + pInfo->seed = taosSafeRand(); pInfo->bufCapacity = pRuntimeEnv->resultInfo.capacity; SOptrBasicInfo* pBInfo = &pInfo->binfo; @@ -8171,7 +8177,7 @@ SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - pInfo->seed = rand(); + pInfo->seed = taosSafeRand(); pInfo->bufCapacity = pRuntimeEnv->resultInfo.capacity; pInfo->groupDone = true; pInfo->lastGroupIdx = -1; @@ -8516,15 +8522,18 @@ SOperatorInfo* createSLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperator SColIndex* idx = taosArrayGet(pInfo->orderColumnList, i); offset += pExpr[idx->colIndex].base.resBytes; } - - pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); - + SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); - - if (pInfo->pRes == NULL || pOperator == NULL) { + if (pOperator == NULL) { goto _clean; } - + + pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); + if (pInfo->pRes == NULL) { + tfree(pOperator); + goto _clean; + } + pOperator->name = "SLimitOperator"; pOperator->operatorType = OP_SLimit; pOperator->blockingOptr = false; diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index 7187637b705a0adb39b1da08a90989964139c746..cb89649c3cc93f00021bd9a1c747d44b5e699a23 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -338,6 +338,45 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex return code; } +bool qFitAlwaysValue(SQInfo * pQInfo) { + // must agg query + if (!pQInfo->query.simpleAgg) + return false; + + // must not include ts column + SSDataBlock* pBlock = pQInfo->runtimeEnv.outputBuf; + if (pBlock == NULL || pBlock->pDataBlock == NULL) + return false; + + SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, 0); + if (pColInfoData == NULL) + return false; + // must not first column is timestamp + if (pColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) + return false; + + // fit ok + return true; +} + +bool doFillResultWithNull(SQInfo* pQInfo, char * data, size_t numOfRows) { + SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; + SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; + SSDataBlock* pRes = pRuntimeEnv->outputBuf; + + int32_t numOfCols = pQueryAttr->numOfOutput; + for (int32_t i = 0; i < numOfCols; ++i) { + int16_t functionId = pQueryAttr->pExpr1[i].base.functionId; + // col + SColumnInfoData* pCol = taosArrayGet(pRes->pDataBlock, i); + if (functionId != TSDB_FUNC_COUNT) + setNull(data, pCol->info.type, pCol->info.bytes); + data += pCol->info.bytes * numOfRows; + } + + return true; +} + int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *contLen, bool* continueExec) { SQInfo *pQInfo = (SQInfo *)qinfo; int32_t compLen = 0; @@ -350,6 +389,14 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; int32_t s = GET_NUM_OF_RESULTS(pRuntimeEnv); + bool fillNull = false; + if (s == 0 && tsAggAlways) { + if (qFitAlwaysValue(pQInfo)) { + s = 1; + fillNull = true; + } + } + size_t size = pQueryAttr->resultRowSize * s; size += sizeof(int32_t); size += sizeof(STableIdInfo) * taosHashGetSize(pRuntimeEnv->pTableRetrieveTsMap); @@ -378,6 +425,9 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co if (GET_NUM_OF_RESULTS(&(pQInfo->runtimeEnv)) > 0 && pQInfo->code == TSDB_CODE_SUCCESS) { doDumpQueryResult(pQInfo, (*pRsp)->data, (*pRsp)->compressed, &compLen); } else { + if (fillNull) { + doFillResultWithNull(pQInfo, (*pRsp)->data, 1); + } setQueryStatus(pRuntimeEnv, QUERY_OVER); } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 2ae20c7ae52cd6ce9bafcdebbef97cc578f53116..3beae806b06674a966fa6361d1bd115f24d3dcd0 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -76,8 +76,10 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser +** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -97,51 +99,59 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 294 +#define YYNOCODE 292 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SLimitVal yy24; - SCreateTableSql* yy74; - SCreatedTableInfo yy110; - SWindowStateVal yy204; - SRangeVal yy214; - int yy274; - TAOS_FIELD yy307; - SArray* yy367; - SSessionWindowVal yy373; - tSqlExpr* yy378; - tVariant yy410; - SSqlNode* yy426; - int64_t yy443; - SIntervalVal yy478; - SRelationInfo* yy480; - SCreateAcctInfo yy563; - SCreateDbInfo yy564; - int32_t yy586; + tVariant yy42; + int32_t yy44; + SCreateTableSql* yy78; + SRangeVal yy132; + int yy133; + SSqlNode* yy144; + SLimitVal yy190; + tSqlExpr* yy194; + SIntervalVal yy200; + SSessionWindowVal yy235; + SWindowStateVal yy248; + TAOS_FIELD yy263; + int64_t yy277; + SCreateAcctInfo yy299; + SArray* yy333; + SCreateDbInfo yy342; + SCreatedTableInfo yy400; + SRelationInfo* yy516; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo -#define ParseARG_STORE yypParser->pInfo = pInfo +#define ParseARG_PARAM ,pInfo +#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; +#define ParseARG_STORE yypParser->pInfo=pInfo; +#define ParseCTX_SDECL +#define ParseCTX_PDECL +#define ParseCTX_PARAM +#define ParseCTX_FETCH +#define ParseCTX_STORE #define YYFALLBACK 1 #define YYNSTATE 417 -#define YYNRULE 329 +#define YYNRULE 330 +#define YYNRULE_WITH_ACTION 330 #define YYNTOKEN 206 #define YY_MAX_SHIFT 416 -#define YY_MIN_SHIFTREDUCE 647 -#define YY_MAX_SHIFTREDUCE 975 -#define YY_ERROR_ACTION 976 -#define YY_ACCEPT_ACTION 977 -#define YY_NO_ACTION 978 -#define YY_MIN_REDUCE 979 -#define YY_MAX_REDUCE 1307 +#define YY_MIN_SHIFTREDUCE 648 +#define YY_MAX_SHIFTREDUCE 977 +#define YY_ERROR_ACTION 978 +#define YY_ACCEPT_ACTION 979 +#define YY_NO_ACTION 980 +#define YY_MIN_REDUCE 981 +#define YY_MAX_REDUCE 1310 /************* End control #defines *******************************************/ +#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -206,336 +216,339 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (930) +#define YY_ACTTAB_COUNT (942) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 230, 699, 1139, 175, 1216, 65, 1217, 332, 699, 700, - /* 10 */ 1280, 270, 1282, 1164, 43, 44, 700, 47, 48, 415, - /* 20 */ 261, 283, 32, 31, 30, 736, 65, 46, 366, 51, + /* 0 */ 230, 700, 1142, 175, 1219, 65, 1220, 332, 700, 701, + /* 10 */ 1283, 270, 1285, 1167, 43, 44, 701, 47, 48, 415, + /* 20 */ 261, 283, 32, 31, 30, 737, 65, 46, 365, 51, /* 30 */ 49, 52, 50, 37, 36, 35, 34, 33, 42, 41, - /* 40 */ 268, 24, 40, 39, 38, 43, 44, 1140, 47, 48, - /* 50 */ 263, 1280, 283, 32, 31, 30, 314, 1137, 46, 366, + /* 40 */ 268, 24, 40, 39, 38, 43, 44, 1143, 47, 48, + /* 50 */ 263, 1283, 283, 32, 31, 30, 314, 1140, 46, 365, /* 60 */ 51, 49, 52, 50, 37, 36, 35, 34, 33, 42, - /* 70 */ 41, 273, 228, 40, 39, 38, 313, 312, 1137, 275, - /* 80 */ 43, 44, 1280, 47, 48, 1161, 1140, 283, 32, 31, - /* 90 */ 30, 362, 95, 46, 366, 51, 49, 52, 50, 37, - /* 100 */ 36, 35, 34, 33, 42, 41, 229, 1270, 40, 39, - /* 110 */ 38, 43, 44, 401, 47, 48, 1280, 1280, 283, 32, - /* 120 */ 31, 30, 1122, 64, 46, 366, 51, 49, 52, 50, - /* 130 */ 37, 36, 35, 34, 33, 42, 41, 1302, 234, 40, - /* 140 */ 39, 38, 277, 43, 45, 784, 47, 48, 1280, 1140, - /* 150 */ 283, 32, 31, 30, 65, 898, 46, 366, 51, 49, - /* 160 */ 52, 50, 37, 36, 35, 34, 33, 42, 41, 858, - /* 170 */ 859, 40, 39, 38, 44, 298, 47, 48, 391, 390, - /* 180 */ 283, 32, 31, 30, 302, 301, 46, 366, 51, 49, - /* 190 */ 52, 50, 37, 36, 35, 34, 33, 42, 41, 699, - /* 200 */ 141, 40, 39, 38, 47, 48, 1136, 700, 283, 32, - /* 210 */ 31, 30, 362, 401, 46, 366, 51, 49, 52, 50, - /* 220 */ 37, 36, 35, 34, 33, 42, 41, 371, 190, 40, - /* 230 */ 39, 38, 73, 360, 408, 407, 359, 358, 357, 406, - /* 240 */ 356, 355, 354, 405, 353, 404, 403, 322, 648, 649, - /* 250 */ 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, - /* 260 */ 660, 661, 169, 101, 262, 1098, 1086, 1087, 1088, 1089, - /* 270 */ 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1099, 1100, + /* 70 */ 41, 273, 228, 40, 39, 38, 313, 312, 1140, 275, + /* 80 */ 43, 44, 1283, 47, 48, 1164, 1143, 283, 32, 31, + /* 90 */ 30, 361, 95, 46, 365, 51, 49, 52, 50, 37, + /* 100 */ 36, 35, 34, 33, 42, 41, 229, 1273, 40, 39, + /* 110 */ 38, 43, 44, 400, 47, 48, 1283, 1283, 283, 32, + /* 120 */ 31, 30, 1125, 64, 46, 365, 51, 49, 52, 50, + /* 130 */ 37, 36, 35, 34, 33, 42, 41, 1305, 234, 40, + /* 140 */ 39, 38, 277, 43, 45, 786, 47, 48, 1283, 1143, + /* 150 */ 283, 32, 31, 30, 65, 900, 46, 365, 51, 49, + /* 160 */ 52, 50, 37, 36, 35, 34, 33, 42, 41, 860, + /* 170 */ 861, 40, 39, 38, 44, 298, 47, 48, 390, 389, + /* 180 */ 283, 32, 31, 30, 302, 301, 46, 365, 51, 49, + /* 190 */ 52, 50, 37, 36, 35, 34, 33, 42, 41, 700, + /* 200 */ 141, 40, 39, 38, 47, 48, 1139, 701, 283, 32, + /* 210 */ 31, 30, 361, 400, 46, 365, 51, 49, 52, 50, + /* 220 */ 37, 36, 35, 34, 33, 42, 41, 115, 190, 40, + /* 230 */ 39, 38, 73, 359, 408, 407, 358, 406, 357, 405, + /* 240 */ 356, 355, 354, 404, 353, 403, 402, 322, 649, 650, + /* 250 */ 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, + /* 260 */ 661, 662, 169, 1127, 262, 1100, 1088, 1089, 1090, 1091, + /* 270 */ 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1101, 1102, /* 280 */ 25, 51, 49, 52, 50, 37, 36, 35, 34, 33, - /* 290 */ 42, 41, 115, 699, 40, 39, 38, 244, 235, 254, - /* 300 */ 914, 700, 74, 902, 246, 905, 281, 908, 1280, 1028, - /* 310 */ 156, 155, 154, 245, 1155, 112, 211, 236, 374, 101, - /* 320 */ 37, 36, 35, 34, 33, 42, 41, 1280, 1124, 40, - /* 330 */ 39, 38, 264, 977, 416, 919, 258, 259, 254, 914, - /* 340 */ 368, 1214, 902, 1215, 905, 29, 908, 901, 1119, 1120, - /* 350 */ 61, 1123, 5, 68, 201, 40, 39, 38, 74, 200, - /* 360 */ 122, 127, 118, 126, 247, 812, 336, 107, 809, 106, - /* 370 */ 810, 904, 811, 907, 1280, 258, 259, 409, 1067, 349, - /* 380 */ 57, 305, 280, 91, 29, 1155, 53, 42, 41, 286, - /* 390 */ 255, 40, 39, 38, 295, 248, 292, 139, 133, 144, - /* 400 */ 1294, 288, 289, 306, 143, 1280, 149, 153, 142, 315, - /* 410 */ 221, 219, 217, 82, 65, 279, 146, 216, 160, 159, - /* 420 */ 158, 157, 915, 909, 911, 53, 73, 365, 408, 407, - /* 430 */ 65, 846, 284, 406, 903, 849, 906, 405, 1130, 404, - /* 440 */ 403, 1106, 1155, 1104, 1105, 1227, 226, 910, 1107, 65, - /* 450 */ 364, 830, 1108, 65, 1109, 1110, 1280, 83, 1283, 274, - /* 460 */ 265, 915, 909, 911, 318, 319, 1137, 282, 65, 287, - /* 470 */ 65, 285, 65, 377, 376, 378, 294, 13, 291, 230, - /* 480 */ 386, 385, 1137, 65, 65, 276, 910, 813, 290, 1280, - /* 490 */ 6, 1283, 912, 827, 379, 1226, 230, 249, 380, 250, - /* 500 */ 271, 1137, 152, 151, 150, 1137, 1280, 1280, 1283, 1280, - /* 510 */ 114, 93, 109, 381, 108, 387, 1223, 388, 1, 199, - /* 520 */ 1137, 10, 1137, 251, 1137, 414, 412, 675, 389, 393, - /* 530 */ 168, 166, 165, 1280, 1266, 1137, 1137, 1265, 1264, 834, - /* 540 */ 256, 92, 257, 293, 1280, 878, 232, 1280, 1280, 233, - /* 550 */ 1280, 266, 1280, 237, 197, 913, 1280, 231, 238, 1280, - /* 560 */ 239, 241, 242, 1280, 243, 98, 240, 1280, 1280, 227, - /* 570 */ 1280, 1280, 1280, 293, 1280, 1121, 1280, 293, 293, 1280, - /* 580 */ 1038, 110, 99, 307, 198, 1029, 855, 211, 367, 1138, - /* 590 */ 3, 212, 211, 317, 316, 865, 96, 66, 866, 364, - /* 600 */ 177, 85, 1222, 794, 309, 877, 370, 272, 340, 77, - /* 610 */ 796, 342, 54, 795, 949, 343, 335, 66, 60, 193, - /* 620 */ 916, 309, 66, 698, 77, 113, 89, 77, 9, 369, - /* 630 */ 819, 15, 820, 14, 9, 392, 132, 9, 131, 17, - /* 640 */ 817, 16, 818, 86, 383, 382, 19, 171, 18, 138, - /* 650 */ 303, 137, 173, 21, 174, 20, 1135, 1163, 783, 26, - /* 660 */ 1174, 1171, 1172, 1156, 310, 1176, 176, 181, 328, 194, - /* 670 */ 1206, 1205, 1204, 1203, 192, 1131, 1129, 195, 196, 1044, - /* 680 */ 345, 346, 347, 348, 351, 1307, 167, 352, 75, 224, - /* 690 */ 71, 410, 363, 1037, 845, 375, 1301, 129, 1300, 1297, - /* 700 */ 202, 27, 321, 87, 1153, 384, 267, 323, 325, 1293, - /* 710 */ 135, 1292, 1289, 203, 1064, 84, 72, 67, 337, 76, - /* 720 */ 225, 1025, 145, 183, 1023, 147, 148, 1021, 28, 1020, - /* 730 */ 333, 331, 1019, 186, 184, 260, 214, 215, 1016, 329, - /* 740 */ 182, 1015, 1014, 327, 1013, 1012, 1011, 324, 1010, 218, - /* 750 */ 220, 1002, 222, 999, 223, 995, 320, 94, 170, 350, - /* 760 */ 90, 308, 402, 1133, 140, 97, 394, 102, 326, 395, - /* 770 */ 396, 397, 398, 399, 88, 400, 278, 172, 344, 974, - /* 780 */ 296, 297, 973, 300, 299, 252, 253, 972, 955, 954, - /* 790 */ 123, 1042, 1041, 124, 309, 304, 339, 11, 100, 822, - /* 800 */ 311, 1018, 58, 1017, 1009, 210, 205, 1065, 206, 204, - /* 810 */ 207, 208, 161, 209, 162, 2, 163, 164, 1008, 103, - /* 820 */ 1102, 185, 338, 1066, 1001, 1000, 854, 59, 187, 188, - /* 830 */ 189, 191, 4, 80, 852, 848, 847, 1112, 81, 180, - /* 840 */ 856, 851, 178, 269, 867, 179, 69, 861, 104, 369, - /* 850 */ 863, 105, 330, 334, 111, 70, 12, 22, 23, 55, - /* 860 */ 341, 56, 114, 117, 116, 62, 120, 714, 749, 747, - /* 870 */ 746, 745, 743, 119, 742, 741, 63, 121, 738, 703, - /* 880 */ 125, 946, 7, 944, 361, 918, 947, 917, 945, 920, - /* 890 */ 8, 372, 373, 78, 128, 130, 66, 79, 134, 786, - /* 900 */ 136, 785, 782, 730, 728, 720, 726, 722, 724, 718, - /* 910 */ 816, 716, 815, 752, 751, 750, 748, 744, 740, 739, - /* 920 */ 213, 665, 979, 701, 674, 672, 978, 411, 978, 413, + /* 290 */ 42, 41, 235, 700, 40, 39, 38, 244, 236, 254, + /* 300 */ 916, 701, 1283, 904, 246, 907, 1297, 910, 1283, 92, + /* 310 */ 156, 155, 154, 245, 112, 979, 416, 247, 373, 101, + /* 320 */ 37, 36, 35, 34, 33, 42, 41, 1283, 315, 40, + /* 330 */ 39, 38, 336, 107, 101, 106, 258, 259, 254, 916, + /* 340 */ 367, 248, 904, 1124, 907, 29, 910, 1122, 1123, 61, + /* 350 */ 1126, 1283, 5, 68, 201, 1217, 280, 1218, 74, 200, + /* 360 */ 122, 127, 118, 126, 249, 814, 1133, 1158, 811, 1158, + /* 370 */ 812, 1230, 813, 74, 1283, 258, 259, 293, 848, 349, + /* 380 */ 57, 305, 851, 91, 29, 306, 53, 264, 197, 65, + /* 390 */ 255, 369, 286, 73, 295, 408, 407, 65, 406, 292, + /* 400 */ 405, 288, 289, 65, 404, 293, 403, 402, 139, 133, + /* 410 */ 144, 318, 319, 276, 368, 143, 198, 149, 153, 142, + /* 420 */ 226, 279, 917, 911, 913, 53, 1108, 146, 1106, 1107, + /* 430 */ 1283, 1113, 1286, 1109, 274, 284, 906, 1110, 909, 1111, + /* 440 */ 1112, 1140, 377, 221, 219, 217, 250, 912, 378, 1140, + /* 450 */ 216, 160, 159, 158, 157, 1140, 1283, 1229, 65, 13, + /* 460 */ 271, 917, 911, 913, 42, 41, 364, 65, 40, 39, + /* 470 */ 38, 65, 287, 65, 285, 65, 376, 375, 905, 294, + /* 480 */ 908, 291, 1226, 385, 384, 230, 912, 815, 290, 363, + /* 490 */ 65, 363, 114, 93, 251, 1283, 832, 1286, 266, 230, + /* 500 */ 414, 412, 676, 379, 1283, 109, 282, 108, 335, 1283, + /* 510 */ 1140, 1286, 380, 40, 39, 38, 386, 293, 387, 1140, + /* 520 */ 388, 1, 199, 1140, 1269, 1140, 1158, 1140, 366, 6, + /* 530 */ 1268, 152, 151, 150, 1283, 392, 168, 166, 165, 1267, + /* 540 */ 1283, 256, 1140, 880, 265, 257, 409, 1069, 232, 1283, + /* 550 */ 233, 1283, 237, 231, 238, 1283, 239, 914, 1283, 241, + /* 560 */ 1283, 98, 1283, 1283, 1283, 242, 1283, 243, 293, 1283, + /* 570 */ 240, 1030, 227, 829, 110, 1283, 1040, 1283, 211, 1141, + /* 580 */ 1283, 1031, 1283, 211, 836, 99, 3, 212, 211, 96, + /* 590 */ 307, 317, 316, 857, 867, 868, 82, 85, 796, 915, + /* 600 */ 309, 10, 340, 879, 66, 798, 342, 177, 77, 54, + /* 610 */ 343, 797, 66, 60, 281, 951, 66, 918, 370, 77, + /* 620 */ 113, 699, 382, 381, 309, 77, 89, 1225, 15, 9, + /* 630 */ 14, 9, 132, 272, 131, 9, 17, 193, 16, 86, + /* 640 */ 83, 821, 819, 822, 820, 19, 138, 18, 137, 21, + /* 650 */ 391, 20, 171, 303, 173, 903, 26, 174, 785, 1138, + /* 660 */ 1166, 1177, 1159, 1174, 1175, 310, 1179, 176, 181, 328, + /* 670 */ 1209, 1208, 1207, 192, 1206, 1134, 194, 1310, 410, 167, + /* 680 */ 321, 267, 323, 1132, 195, 196, 325, 1046, 345, 346, + /* 690 */ 847, 347, 348, 351, 352, 75, 224, 71, 362, 1156, + /* 700 */ 184, 182, 183, 87, 27, 1039, 374, 1304, 129, 337, + /* 710 */ 1303, 1300, 84, 185, 28, 202, 383, 333, 1296, 135, + /* 720 */ 1295, 329, 1292, 203, 331, 327, 921, 1066, 72, 67, + /* 730 */ 324, 76, 225, 186, 187, 1027, 320, 145, 1025, 147, + /* 740 */ 94, 148, 1023, 1022, 1021, 260, 350, 214, 215, 1018, + /* 750 */ 1017, 1016, 1015, 1014, 1013, 1012, 218, 220, 1004, 222, + /* 760 */ 1001, 401, 223, 997, 140, 393, 394, 170, 395, 90, + /* 770 */ 308, 1136, 97, 102, 396, 326, 397, 398, 399, 172, + /* 780 */ 976, 297, 975, 88, 278, 296, 188, 344, 300, 299, + /* 790 */ 974, 957, 252, 253, 956, 123, 1044, 124, 1043, 309, + /* 800 */ 304, 11, 339, 824, 100, 311, 58, 103, 856, 1020, + /* 810 */ 80, 1019, 854, 853, 161, 1067, 206, 204, 205, 208, + /* 820 */ 207, 209, 210, 162, 2, 1011, 338, 1104, 1010, 1068, + /* 830 */ 163, 164, 1003, 59, 189, 1002, 191, 850, 4, 849, + /* 840 */ 81, 180, 858, 178, 1115, 869, 179, 269, 863, 104, + /* 850 */ 69, 865, 105, 330, 368, 22, 334, 70, 111, 12, + /* 860 */ 23, 55, 56, 341, 114, 116, 120, 117, 715, 750, + /* 870 */ 748, 747, 62, 119, 746, 63, 744, 742, 121, 739, + /* 880 */ 704, 125, 948, 360, 946, 7, 949, 947, 920, 919, + /* 890 */ 8, 922, 371, 372, 818, 128, 78, 130, 66, 79, + /* 900 */ 134, 136, 788, 787, 784, 731, 729, 721, 727, 723, + /* 910 */ 725, 719, 717, 817, 753, 752, 751, 749, 745, 743, + /* 920 */ 741, 740, 213, 666, 702, 981, 675, 673, 980, 980, + /* 930 */ 411, 980, 980, 980, 980, 980, 980, 980, 980, 980, + /* 940 */ 980, 413, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 280, 1, 262, 209, 288, 209, 290, 291, 1, 9, - /* 10 */ 290, 1, 292, 209, 14, 15, 9, 17, 18, 209, - /* 20 */ 210, 21, 22, 23, 24, 5, 209, 27, 28, 29, + /* 0 */ 279, 1, 261, 208, 287, 208, 289, 290, 1, 9, + /* 10 */ 289, 1, 291, 208, 14, 15, 9, 17, 18, 208, + /* 20 */ 209, 21, 22, 23, 24, 5, 208, 27, 28, 29, /* 30 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - /* 40 */ 255, 280, 42, 43, 44, 14, 15, 262, 17, 18, - /* 50 */ 254, 290, 21, 22, 23, 24, 285, 261, 27, 28, + /* 40 */ 254, 279, 42, 43, 44, 14, 15, 261, 17, 18, + /* 50 */ 253, 289, 21, 22, 23, 24, 284, 260, 27, 28, /* 60 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - /* 70 */ 39, 254, 280, 42, 43, 44, 282, 283, 261, 255, - /* 80 */ 14, 15, 290, 17, 18, 281, 262, 21, 22, 23, + /* 70 */ 39, 253, 279, 42, 43, 44, 281, 282, 260, 254, + /* 80 */ 14, 15, 289, 17, 18, 280, 261, 21, 22, 23, /* 90 */ 24, 90, 92, 27, 28, 29, 30, 31, 32, 33, - /* 100 */ 34, 35, 36, 37, 38, 39, 280, 280, 42, 43, - /* 110 */ 44, 14, 15, 96, 17, 18, 290, 290, 21, 22, + /* 100 */ 34, 35, 36, 37, 38, 39, 279, 279, 42, 43, + /* 110 */ 44, 14, 15, 96, 17, 18, 289, 289, 21, 22, /* 120 */ 23, 24, 0, 92, 27, 28, 29, 30, 31, 32, - /* 130 */ 33, 34, 35, 36, 37, 38, 39, 262, 280, 42, - /* 140 */ 43, 44, 255, 14, 15, 5, 17, 18, 290, 262, - /* 150 */ 21, 22, 23, 24, 209, 89, 27, 28, 29, 30, + /* 130 */ 33, 34, 35, 36, 37, 38, 39, 261, 279, 42, + /* 140 */ 43, 44, 254, 14, 15, 5, 17, 18, 289, 261, + /* 150 */ 21, 22, 23, 24, 208, 89, 27, 28, 29, 30, /* 160 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 133, /* 170 */ 134, 42, 43, 44, 15, 151, 17, 18, 38, 39, /* 180 */ 21, 22, 23, 24, 160, 161, 27, 28, 29, 30, /* 190 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 1, - /* 200 */ 83, 42, 43, 44, 17, 18, 261, 9, 21, 22, + /* 200 */ 83, 42, 43, 44, 17, 18, 260, 9, 21, 22, /* 210 */ 23, 24, 90, 96, 27, 28, 29, 30, 31, 32, - /* 220 */ 33, 34, 35, 36, 37, 38, 39, 16, 267, 42, + /* 220 */ 33, 34, 35, 36, 37, 38, 39, 216, 266, 42, /* 230 */ 43, 44, 104, 105, 106, 107, 108, 109, 110, 111, - /* 240 */ 112, 113, 114, 115, 116, 117, 118, 286, 50, 51, + /* 240 */ 112, 113, 114, 115, 116, 117, 118, 285, 50, 51, /* 250 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - /* 260 */ 62, 63, 64, 88, 66, 233, 234, 235, 236, 237, - /* 270 */ 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + /* 260 */ 62, 63, 64, 252, 66, 232, 233, 234, 235, 236, + /* 270 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, /* 280 */ 49, 29, 30, 31, 32, 33, 34, 35, 36, 37, - /* 290 */ 38, 39, 217, 1, 42, 43, 44, 66, 280, 1, - /* 300 */ 2, 9, 127, 5, 73, 7, 1, 9, 290, 215, - /* 310 */ 79, 80, 81, 82, 259, 217, 222, 280, 87, 88, - /* 320 */ 33, 34, 35, 36, 37, 38, 39, 290, 253, 42, - /* 330 */ 43, 44, 277, 207, 208, 124, 38, 39, 1, 2, - /* 340 */ 42, 288, 5, 290, 7, 47, 9, 42, 250, 251, - /* 350 */ 252, 253, 67, 68, 69, 42, 43, 44, 127, 74, - /* 360 */ 75, 76, 77, 78, 280, 2, 287, 288, 5, 290, - /* 370 */ 7, 5, 9, 7, 290, 38, 39, 231, 232, 94, - /* 380 */ 88, 150, 216, 152, 47, 259, 88, 38, 39, 73, - /* 390 */ 159, 42, 43, 44, 163, 280, 73, 67, 68, 69, - /* 400 */ 262, 38, 39, 277, 74, 290, 76, 77, 78, 285, - /* 410 */ 67, 68, 69, 103, 209, 216, 86, 74, 75, 76, - /* 420 */ 77, 78, 124, 125, 126, 88, 104, 25, 106, 107, - /* 430 */ 209, 5, 216, 111, 5, 9, 7, 115, 209, 117, - /* 440 */ 118, 233, 259, 235, 236, 249, 280, 149, 240, 209, - /* 450 */ 48, 42, 244, 209, 246, 247, 290, 147, 292, 254, - /* 460 */ 277, 124, 125, 126, 38, 39, 261, 65, 209, 153, - /* 470 */ 209, 155, 209, 157, 158, 254, 153, 88, 155, 280, - /* 480 */ 157, 158, 261, 209, 209, 256, 149, 124, 125, 290, - /* 490 */ 88, 292, 126, 103, 254, 249, 280, 280, 254, 280, - /* 500 */ 249, 261, 83, 84, 85, 261, 290, 290, 292, 290, - /* 510 */ 121, 122, 288, 254, 290, 254, 249, 254, 218, 219, - /* 520 */ 261, 131, 261, 280, 261, 70, 71, 72, 254, 254, - /* 530 */ 67, 68, 69, 290, 280, 261, 261, 280, 280, 130, - /* 540 */ 280, 217, 280, 209, 290, 81, 280, 290, 290, 280, - /* 550 */ 290, 125, 290, 280, 220, 126, 290, 280, 280, 290, - /* 560 */ 280, 280, 280, 290, 280, 89, 280, 290, 290, 280, - /* 570 */ 290, 290, 290, 209, 290, 251, 290, 209, 209, 290, - /* 580 */ 215, 263, 89, 89, 220, 215, 89, 222, 220, 220, - /* 590 */ 213, 214, 222, 38, 39, 89, 278, 103, 89, 48, - /* 600 */ 103, 103, 249, 89, 128, 141, 25, 249, 89, 103, - /* 610 */ 89, 89, 103, 89, 89, 85, 65, 103, 88, 257, - /* 620 */ 89, 128, 103, 89, 103, 103, 88, 103, 103, 48, - /* 630 */ 5, 154, 7, 156, 103, 249, 154, 103, 156, 154, - /* 640 */ 5, 156, 7, 145, 38, 39, 154, 209, 156, 154, - /* 650 */ 209, 156, 209, 154, 209, 156, 209, 209, 120, 279, - /* 660 */ 209, 209, 209, 259, 259, 209, 209, 209, 209, 209, - /* 670 */ 289, 289, 289, 289, 264, 259, 209, 209, 209, 209, - /* 680 */ 209, 209, 209, 209, 209, 265, 65, 209, 209, 209, - /* 690 */ 209, 90, 209, 209, 126, 209, 209, 209, 209, 209, - /* 700 */ 209, 148, 284, 144, 276, 209, 284, 284, 284, 209, - /* 710 */ 209, 209, 209, 209, 209, 146, 209, 209, 139, 209, - /* 720 */ 209, 209, 209, 274, 209, 209, 209, 209, 143, 209, - /* 730 */ 142, 137, 209, 271, 273, 209, 209, 209, 209, 136, - /* 740 */ 275, 209, 209, 135, 209, 209, 209, 138, 209, 209, - /* 750 */ 209, 209, 209, 209, 209, 209, 132, 123, 211, 95, - /* 760 */ 212, 211, 119, 211, 102, 211, 101, 211, 211, 56, - /* 770 */ 98, 100, 60, 99, 211, 97, 211, 131, 211, 5, - /* 780 */ 162, 5, 5, 5, 162, 211, 211, 5, 106, 105, - /* 790 */ 217, 221, 221, 217, 128, 151, 85, 88, 129, 89, - /* 800 */ 103, 211, 88, 211, 211, 223, 228, 230, 224, 229, - /* 810 */ 227, 225, 212, 226, 212, 218, 212, 212, 211, 103, - /* 820 */ 248, 272, 258, 232, 211, 211, 89, 266, 270, 269, - /* 830 */ 268, 265, 213, 103, 126, 5, 5, 248, 88, 103, - /* 840 */ 89, 126, 88, 1, 89, 88, 103, 89, 88, 48, - /* 850 */ 89, 88, 88, 1, 92, 103, 88, 140, 140, 88, - /* 860 */ 85, 88, 121, 83, 85, 93, 75, 5, 9, 5, - /* 870 */ 5, 5, 5, 92, 5, 5, 93, 92, 5, 91, - /* 880 */ 83, 9, 88, 9, 16, 89, 9, 89, 9, 124, - /* 890 */ 88, 28, 64, 17, 156, 156, 103, 17, 156, 5, - /* 900 */ 156, 5, 89, 5, 5, 5, 5, 5, 5, 5, - /* 910 */ 126, 5, 126, 5, 5, 5, 5, 5, 5, 5, - /* 920 */ 103, 65, 0, 91, 9, 9, 293, 22, 293, 22, - /* 930 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 940 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 950 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 960 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 970 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 980 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 990 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1000 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1010 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1020 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1030 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1040 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1050 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1060 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1070 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1080 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1090 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1100 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1110 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1120 */ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, - /* 1130 */ 293, 293, 293, 293, 293, 293, + /* 290 */ 38, 39, 279, 1, 42, 43, 44, 66, 279, 1, + /* 300 */ 2, 9, 289, 5, 73, 7, 261, 9, 289, 216, + /* 310 */ 79, 80, 81, 82, 216, 206, 207, 279, 87, 88, + /* 320 */ 33, 34, 35, 36, 37, 38, 39, 289, 284, 42, + /* 330 */ 43, 44, 286, 287, 88, 289, 38, 39, 1, 2, + /* 340 */ 42, 279, 5, 250, 7, 47, 9, 249, 250, 251, + /* 350 */ 252, 289, 67, 68, 69, 287, 215, 289, 127, 74, + /* 360 */ 75, 76, 77, 78, 279, 2, 208, 258, 5, 258, + /* 370 */ 7, 248, 9, 127, 289, 38, 39, 208, 5, 94, + /* 380 */ 88, 150, 9, 152, 47, 276, 88, 276, 219, 208, + /* 390 */ 159, 25, 73, 104, 163, 106, 107, 208, 109, 73, + /* 400 */ 111, 38, 39, 208, 115, 208, 117, 118, 67, 68, + /* 410 */ 69, 38, 39, 255, 48, 74, 219, 76, 77, 78, + /* 420 */ 279, 215, 124, 125, 126, 88, 232, 86, 234, 235, + /* 430 */ 289, 237, 291, 239, 253, 215, 5, 243, 7, 245, + /* 440 */ 246, 260, 253, 67, 68, 69, 279, 149, 253, 260, + /* 450 */ 74, 75, 76, 77, 78, 260, 289, 248, 208, 88, + /* 460 */ 248, 124, 125, 126, 38, 39, 25, 208, 42, 43, + /* 470 */ 44, 208, 153, 208, 155, 208, 157, 158, 5, 153, + /* 480 */ 7, 155, 248, 157, 158, 279, 149, 124, 125, 48, + /* 490 */ 208, 48, 121, 122, 279, 289, 42, 291, 125, 279, + /* 500 */ 70, 71, 72, 253, 289, 287, 65, 289, 65, 289, + /* 510 */ 260, 291, 253, 42, 43, 44, 253, 208, 253, 260, + /* 520 */ 253, 217, 218, 260, 279, 260, 258, 260, 219, 88, + /* 530 */ 279, 83, 84, 85, 289, 253, 67, 68, 69, 279, + /* 540 */ 289, 279, 260, 81, 276, 279, 230, 231, 279, 289, + /* 550 */ 279, 289, 279, 279, 279, 289, 279, 126, 289, 279, + /* 560 */ 289, 89, 289, 289, 289, 279, 289, 279, 208, 289, + /* 570 */ 279, 214, 279, 103, 262, 289, 214, 289, 221, 219, + /* 580 */ 289, 214, 289, 221, 130, 89, 212, 213, 221, 277, + /* 590 */ 89, 38, 39, 89, 89, 89, 103, 103, 89, 126, + /* 600 */ 128, 131, 89, 141, 103, 89, 89, 103, 103, 103, + /* 610 */ 85, 89, 103, 88, 1, 89, 103, 89, 16, 103, + /* 620 */ 103, 89, 38, 39, 128, 103, 88, 248, 154, 103, + /* 630 */ 156, 103, 154, 248, 156, 103, 154, 256, 156, 145, + /* 640 */ 147, 5, 5, 7, 7, 154, 154, 156, 156, 154, + /* 650 */ 248, 156, 208, 208, 208, 42, 278, 208, 120, 208, + /* 660 */ 208, 208, 258, 208, 208, 258, 208, 208, 208, 208, + /* 670 */ 288, 288, 288, 263, 288, 258, 208, 264, 90, 65, + /* 680 */ 283, 283, 283, 208, 208, 208, 283, 208, 208, 208, + /* 690 */ 126, 208, 208, 208, 208, 208, 208, 208, 208, 275, + /* 700 */ 272, 274, 273, 144, 148, 208, 208, 208, 208, 139, + /* 710 */ 208, 208, 146, 271, 143, 208, 208, 142, 208, 208, + /* 720 */ 208, 136, 208, 208, 137, 135, 124, 208, 208, 208, + /* 730 */ 138, 208, 208, 270, 269, 208, 132, 208, 208, 208, + /* 740 */ 123, 208, 208, 208, 208, 208, 95, 208, 208, 208, + /* 750 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 760 */ 208, 119, 208, 208, 102, 101, 56, 210, 98, 211, + /* 770 */ 210, 210, 210, 210, 100, 210, 60, 99, 97, 131, + /* 780 */ 5, 5, 5, 210, 210, 162, 268, 210, 5, 162, + /* 790 */ 5, 106, 210, 210, 105, 216, 220, 216, 220, 128, + /* 800 */ 151, 88, 85, 89, 129, 103, 88, 103, 89, 210, + /* 810 */ 103, 210, 126, 126, 211, 229, 223, 228, 227, 224, + /* 820 */ 226, 225, 222, 211, 217, 210, 257, 247, 210, 231, + /* 830 */ 211, 211, 210, 265, 267, 210, 264, 5, 212, 5, + /* 840 */ 88, 103, 89, 88, 247, 89, 88, 1, 89, 88, + /* 850 */ 103, 89, 88, 88, 48, 140, 1, 103, 92, 88, + /* 860 */ 140, 88, 88, 85, 121, 85, 75, 83, 5, 9, + /* 870 */ 5, 5, 93, 92, 5, 93, 5, 5, 92, 5, + /* 880 */ 91, 83, 9, 16, 9, 88, 9, 9, 89, 89, + /* 890 */ 88, 124, 28, 64, 126, 156, 17, 156, 103, 17, + /* 900 */ 156, 156, 5, 5, 89, 5, 5, 5, 5, 5, + /* 910 */ 5, 5, 5, 126, 5, 5, 5, 5, 5, 5, + /* 920 */ 5, 5, 103, 65, 91, 0, 9, 9, 292, 292, + /* 930 */ 22, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 940 */ 292, 22, 292, 292, 292, 292, 292, 292, 292, 292, + /* 950 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 960 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 970 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 980 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 990 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1000 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1010 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1020 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1030 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1040 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1050 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1060 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1070 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1080 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1090 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1100 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1110 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1120 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1130 */ 292, 292, 292, 292, 292, 292, 292, 292, 292, 292, + /* 1140 */ 292, 292, 292, 292, 292, 292, 292, 292, }; #define YY_SHIFT_COUNT (416) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (922) +#define YY_SHIFT_MAX (925) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 231, 128, 128, 322, 322, 1, 298, 337, 337, 337, + /* 0 */ 231, 128, 128, 289, 289, 1, 298, 337, 337, 337, /* 10 */ 292, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 20 */ 7, 7, 10, 10, 0, 198, 337, 337, 337, 337, /* 30 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, /* 40 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - /* 50 */ 337, 337, 337, 337, 363, 363, 363, 175, 175, 36, + /* 50 */ 337, 337, 337, 337, 363, 363, 363, 246, 246, 36, /* 60 */ 7, 122, 7, 7, 7, 7, 7, 117, 1, 10, - /* 70 */ 10, 17, 17, 20, 930, 930, 930, 363, 363, 363, - /* 80 */ 426, 426, 140, 140, 140, 140, 140, 140, 389, 140, - /* 90 */ 7, 7, 7, 7, 7, 7, 409, 7, 7, 7, - /* 100 */ 175, 175, 7, 7, 7, 7, 464, 464, 464, 464, - /* 110 */ 390, 175, 7, 7, 7, 7, 7, 7, 7, 7, + /* 70 */ 10, 17, 17, 20, 942, 942, 942, 363, 363, 363, + /* 80 */ 373, 373, 140, 140, 140, 140, 140, 140, 371, 140, + /* 90 */ 7, 7, 7, 7, 7, 7, 454, 7, 7, 7, + /* 100 */ 246, 246, 7, 7, 7, 7, 462, 462, 462, 462, + /* 110 */ 470, 246, 7, 7, 7, 7, 7, 7, 7, 7, /* 120 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 130 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 140 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 150 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 160 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - /* 170 */ 553, 621, 601, 621, 621, 621, 621, 568, 568, 568, - /* 180 */ 568, 621, 559, 569, 579, 585, 588, 594, 603, 608, - /* 190 */ 609, 624, 553, 634, 621, 621, 621, 664, 664, 643, - /* 200 */ 1, 1, 621, 621, 662, 665, 713, 672, 671, 712, - /* 210 */ 674, 678, 643, 20, 621, 621, 601, 601, 621, 601, - /* 220 */ 621, 601, 621, 621, 930, 930, 31, 66, 97, 97, + /* 170 */ 556, 614, 588, 614, 614, 614, 614, 564, 564, 564, + /* 180 */ 564, 614, 559, 566, 570, 571, 575, 587, 585, 590, + /* 190 */ 592, 604, 556, 617, 614, 614, 614, 651, 651, 642, + /* 200 */ 1, 1, 614, 614, 662, 664, 710, 670, 674, 716, + /* 210 */ 678, 681, 642, 20, 614, 614, 588, 588, 614, 588, + /* 220 */ 614, 588, 614, 614, 942, 942, 31, 66, 97, 97, /* 230 */ 97, 129, 159, 187, 252, 252, 252, 252, 252, 252, - /* 240 */ 287, 287, 287, 287, 285, 330, 343, 349, 349, 349, - /* 250 */ 349, 349, 316, 323, 402, 24, 313, 313, 366, 429, - /* 260 */ 419, 455, 463, 494, 476, 493, 555, 497, 506, 509, - /* 270 */ 551, 310, 498, 514, 519, 521, 522, 524, 530, 525, - /* 280 */ 531, 581, 305, 211, 534, 477, 482, 485, 625, 635, - /* 290 */ 606, 492, 495, 538, 499, 646, 774, 618, 776, 777, - /* 300 */ 622, 778, 782, 682, 684, 644, 666, 711, 709, 669, - /* 310 */ 710, 714, 697, 716, 737, 730, 708, 715, 830, 831, - /* 320 */ 750, 751, 754, 755, 757, 758, 736, 760, 761, 763, - /* 330 */ 842, 764, 743, 717, 801, 852, 752, 718, 762, 768, - /* 340 */ 711, 771, 775, 773, 741, 779, 780, 772, 781, 791, - /* 350 */ 862, 783, 785, 859, 864, 865, 866, 867, 869, 870, - /* 360 */ 873, 788, 868, 797, 872, 874, 794, 796, 798, 877, - /* 370 */ 879, 765, 802, 863, 828, 876, 738, 739, 793, 793, - /* 380 */ 793, 793, 784, 786, 880, 742, 744, 793, 793, 793, - /* 390 */ 894, 896, 813, 793, 898, 899, 900, 901, 902, 903, - /* 400 */ 904, 906, 908, 909, 910, 911, 912, 913, 914, 817, - /* 410 */ 832, 915, 905, 916, 907, 856, 922, + /* 240 */ 287, 287, 287, 287, 285, 341, 376, 426, 426, 426, + /* 250 */ 426, 426, 319, 326, 441, 24, 471, 471, 431, 473, + /* 260 */ 448, 430, 469, 501, 472, 496, 553, 504, 505, 506, + /* 270 */ 443, 493, 494, 509, 513, 516, 517, 522, 525, 526, + /* 280 */ 528, 366, 613, 602, 532, 474, 478, 482, 636, 637, + /* 290 */ 584, 491, 492, 538, 495, 648, 775, 623, 776, 777, + /* 300 */ 627, 783, 785, 685, 689, 649, 671, 717, 713, 675, + /* 310 */ 714, 718, 702, 704, 719, 707, 686, 687, 832, 834, + /* 320 */ 752, 753, 755, 756, 758, 759, 738, 761, 762, 764, + /* 330 */ 846, 765, 747, 715, 806, 855, 754, 720, 766, 771, + /* 340 */ 717, 773, 778, 774, 743, 780, 784, 779, 781, 791, + /* 350 */ 863, 782, 786, 860, 865, 866, 869, 871, 872, 874, + /* 360 */ 789, 867, 798, 873, 875, 797, 799, 800, 877, 878, + /* 370 */ 767, 802, 864, 829, 879, 739, 741, 795, 795, 795, + /* 380 */ 795, 768, 787, 882, 744, 745, 795, 795, 795, 897, + /* 390 */ 898, 815, 795, 900, 901, 902, 903, 904, 905, 906, + /* 400 */ 907, 909, 910, 911, 912, 913, 914, 915, 916, 819, + /* 410 */ 833, 917, 908, 918, 919, 858, 925, }; #define YY_REDUCE_COUNT (225) -#define YY_REDUCE_MIN (-284) -#define YY_REDUCE_MAX (619) +#define YY_REDUCE_MIN (-283) +#define YY_REDUCE_MAX (626) static const short yy_reduce_ofst[] = { - /* 0 */ 126, 32, 32, 208, 208, 98, 166, 199, 216, -280, - /* 10 */ -206, -204, -183, 205, 221, 240, 244, 259, 261, 263, - /* 20 */ 274, 275, -284, 79, -196, -190, -239, -208, -174, -173, - /* 30 */ -142, 18, 37, 84, 115, 217, 219, 243, 254, 257, - /* 40 */ 258, 260, 262, 266, 269, 273, 277, 278, 280, 281, - /* 50 */ 282, 284, 286, 289, -215, -176, -113, 55, 183, -39, - /* 60 */ 229, 75, 334, 364, 368, 369, -55, 94, 324, 53, - /* 70 */ 224, 365, 370, 146, 318, 300, 377, -260, -125, 138, - /* 80 */ -229, 124, 196, 246, 251, 267, 353, 358, 362, 386, - /* 90 */ 438, 441, 443, 445, 447, 448, 380, 451, 452, 453, - /* 100 */ 404, 405, 456, 457, 458, 459, 381, 382, 383, 384, - /* 110 */ 410, 416, 460, 467, 468, 469, 470, 471, 472, 473, - /* 120 */ 474, 475, 478, 479, 480, 481, 483, 484, 486, 487, - /* 130 */ 488, 489, 490, 491, 496, 500, 501, 502, 503, 504, - /* 140 */ 505, 507, 508, 510, 511, 512, 513, 515, 516, 517, - /* 150 */ 518, 520, 523, 526, 527, 528, 529, 532, 533, 535, - /* 160 */ 536, 537, 539, 540, 541, 542, 543, 544, 545, 546, - /* 170 */ 420, 547, 548, 550, 552, 554, 556, 418, 422, 423, - /* 180 */ 424, 557, 428, 465, 449, 461, 549, 462, 558, 560, - /* 190 */ 562, 561, 566, 564, 563, 565, 567, 570, 571, 572, - /* 200 */ 573, 576, 574, 575, 577, 580, 578, 584, 583, 586, - /* 210 */ 587, 582, 589, 591, 590, 592, 600, 602, 593, 604, - /* 220 */ 607, 605, 613, 614, 597, 619, + /* 0 */ 109, 33, 33, 194, 194, 98, 141, 206, 220, -279, + /* 10 */ -205, -203, -182, 181, 189, 195, 250, 259, 263, 265, + /* 20 */ 267, 282, -283, 46, -195, -189, -238, -207, -173, -172, + /* 30 */ -141, 13, 19, 38, 62, 85, 167, 215, 245, 251, + /* 40 */ 260, 262, 266, 269, 271, 273, 274, 275, 277, 280, + /* 50 */ 286, 288, 291, 293, -214, -175, -112, 111, 268, -38, + /* 60 */ 158, 11, 169, 197, 309, 360, -54, 357, 93, 68, + /* 70 */ 218, 362, 367, 316, 312, 304, 374, -259, -124, 45, + /* 80 */ -228, 44, 123, 209, 212, 234, 379, 385, 381, 402, + /* 90 */ 444, 445, 446, 449, 451, 452, 378, 453, 455, 456, + /* 100 */ 404, 407, 458, 459, 460, 461, 382, 383, 384, 386, + /* 110 */ 410, 417, 468, 475, 476, 477, 479, 480, 481, 483, + /* 120 */ 484, 485, 486, 487, 488, 489, 490, 497, 498, 499, + /* 130 */ 500, 502, 503, 507, 508, 510, 511, 512, 514, 515, + /* 140 */ 519, 520, 521, 523, 524, 527, 529, 530, 531, 533, + /* 150 */ 534, 535, 536, 537, 539, 540, 541, 542, 543, 544, + /* 160 */ 545, 546, 547, 548, 549, 550, 551, 552, 554, 555, + /* 170 */ 413, 557, 558, 560, 561, 562, 563, 397, 398, 399, + /* 180 */ 403, 565, 424, 427, 429, 428, 442, 463, 465, 518, + /* 190 */ 567, 568, 572, 569, 573, 574, 577, 576, 578, 580, + /* 200 */ 579, 581, 582, 583, 586, 589, 591, 593, 594, 595, + /* 210 */ 596, 600, 597, 598, 599, 601, 603, 612, 615, 619, + /* 220 */ 618, 620, 622, 625, 607, 626, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 976, 1101, 1039, 1111, 1026, 1036, 1285, 1285, 1285, 1285, - /* 10 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 20 */ 976, 976, 976, 976, 1165, 996, 976, 976, 976, 976, - /* 30 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 40 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 50 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 1189, - /* 60 */ 976, 1036, 976, 976, 976, 976, 976, 1047, 1036, 976, - /* 70 */ 976, 1047, 1047, 976, 1160, 1085, 1103, 976, 976, 976, - /* 80 */ 976, 976, 976, 976, 976, 976, 976, 976, 1132, 976, - /* 90 */ 976, 976, 976, 976, 976, 976, 1167, 1173, 1170, 976, - /* 100 */ 976, 976, 1175, 976, 976, 976, 1211, 1211, 1211, 1211, - /* 110 */ 1158, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 120 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 130 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 140 */ 976, 976, 976, 976, 976, 1024, 976, 1022, 976, 976, - /* 150 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 160 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 994, - /* 170 */ 1228, 998, 1034, 998, 998, 998, 998, 976, 976, 976, - /* 180 */ 976, 998, 1220, 1224, 1201, 1218, 1212, 1196, 1194, 1192, - /* 190 */ 1200, 1185, 1228, 1134, 998, 998, 998, 1045, 1045, 1040, - /* 200 */ 1036, 1036, 998, 998, 1063, 1061, 1059, 1051, 1057, 1053, - /* 210 */ 1055, 1049, 1027, 976, 998, 998, 1034, 1034, 998, 1034, - /* 220 */ 998, 1034, 998, 998, 1085, 1103, 1284, 976, 1229, 1219, - /* 230 */ 1284, 976, 1261, 1260, 1275, 1274, 1273, 1259, 1258, 1257, - /* 240 */ 1253, 1256, 1255, 1254, 976, 976, 976, 1272, 1271, 1269, - /* 250 */ 1268, 1267, 976, 976, 1231, 976, 1263, 1262, 976, 976, - /* 260 */ 976, 976, 976, 976, 976, 976, 1182, 976, 976, 976, - /* 270 */ 1207, 1225, 1221, 976, 976, 976, 976, 976, 976, 976, - /* 280 */ 976, 1232, 976, 976, 976, 976, 976, 976, 976, 976, - /* 290 */ 1146, 976, 976, 1113, 976, 976, 976, 976, 976, 976, - /* 300 */ 976, 976, 976, 976, 976, 976, 1157, 976, 976, 976, - /* 310 */ 976, 976, 1169, 1168, 976, 976, 976, 976, 976, 976, - /* 320 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 330 */ 976, 976, 1213, 976, 1208, 976, 1202, 976, 976, 976, - /* 340 */ 1125, 976, 976, 976, 976, 1043, 976, 976, 976, 976, - /* 350 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 360 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - /* 370 */ 976, 976, 976, 976, 976, 976, 976, 976, 1303, 1298, - /* 380 */ 1299, 1296, 976, 976, 976, 976, 976, 1295, 1290, 1291, - /* 390 */ 976, 976, 976, 1288, 976, 976, 976, 976, 976, 976, - /* 400 */ 976, 976, 976, 976, 976, 976, 976, 976, 976, 1069, - /* 410 */ 976, 976, 1005, 976, 1003, 976, 976, + /* 0 */ 978, 1103, 1041, 1114, 1028, 1038, 1288, 1288, 1288, 1288, + /* 10 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 20 */ 978, 978, 978, 978, 1168, 998, 978, 978, 978, 978, + /* 30 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 40 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 50 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 1192, + /* 60 */ 978, 1038, 978, 978, 978, 978, 978, 1049, 1038, 978, + /* 70 */ 978, 1049, 1049, 978, 1163, 1087, 1105, 978, 978, 978, + /* 80 */ 978, 978, 978, 978, 978, 978, 978, 978, 1135, 978, + /* 90 */ 978, 978, 978, 978, 978, 978, 1170, 1176, 1173, 978, + /* 100 */ 978, 978, 1178, 978, 978, 978, 1214, 1214, 1214, 1214, + /* 110 */ 1161, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 120 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 130 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 140 */ 978, 978, 978, 978, 978, 1026, 978, 1024, 978, 978, + /* 150 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 160 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 996, + /* 170 */ 1231, 1000, 1036, 1000, 1000, 1000, 1000, 978, 978, 978, + /* 180 */ 978, 1000, 1223, 1227, 1204, 1221, 1215, 1199, 1197, 1195, + /* 190 */ 1203, 1188, 1231, 1137, 1000, 1000, 1000, 1047, 1047, 1042, + /* 200 */ 1038, 1038, 1000, 1000, 1065, 1063, 1061, 1053, 1059, 1055, + /* 210 */ 1057, 1051, 1029, 978, 1000, 1000, 1036, 1036, 1000, 1036, + /* 220 */ 1000, 1036, 1000, 1000, 1087, 1105, 1287, 978, 1232, 1222, + /* 230 */ 1287, 978, 1264, 1263, 1278, 1277, 1276, 1262, 1261, 1260, + /* 240 */ 1256, 1259, 1258, 1257, 978, 978, 978, 1275, 1274, 1272, + /* 250 */ 1271, 1270, 978, 978, 1234, 978, 1266, 1265, 978, 978, + /* 260 */ 978, 978, 978, 978, 978, 978, 1185, 978, 978, 978, + /* 270 */ 1210, 1228, 1224, 978, 978, 978, 978, 978, 978, 978, + /* 280 */ 978, 1235, 978, 978, 978, 978, 978, 978, 978, 978, + /* 290 */ 1149, 978, 978, 1116, 978, 978, 978, 978, 978, 978, + /* 300 */ 978, 978, 978, 978, 978, 978, 1160, 978, 978, 978, + /* 310 */ 978, 978, 1172, 1171, 978, 978, 978, 978, 978, 978, + /* 320 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 330 */ 978, 978, 1216, 978, 1211, 978, 1205, 978, 978, 978, + /* 340 */ 1128, 978, 978, 978, 978, 1045, 978, 978, 978, 978, + /* 350 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 360 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 370 */ 978, 978, 978, 978, 978, 978, 978, 1306, 1301, 1302, + /* 380 */ 1299, 978, 978, 978, 978, 978, 1298, 1293, 1294, 978, + /* 390 */ 978, 978, 1291, 978, 978, 978, 978, 978, 978, 978, + /* 400 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 1071, + /* 410 */ 978, 978, 1007, 978, 1005, 978, 978, }; /********** End of lemon-generated parsing tables *****************************/ @@ -800,6 +813,7 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ + ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -1053,93 +1067,92 @@ static const char *const yyTokenName[] = { /* 203 */ "INTO", /* 204 */ "VALUES", /* 205 */ "FILE", - /* 206 */ "error", - /* 207 */ "program", - /* 208 */ "cmd", - /* 209 */ "ids", - /* 210 */ "dbPrefix", - /* 211 */ "cpxName", - /* 212 */ "ifexists", - /* 213 */ "alter_db_optr", - /* 214 */ "alter_topic_optr", - /* 215 */ "acct_optr", - /* 216 */ "exprlist", - /* 217 */ "ifnotexists", - /* 218 */ "db_optr", - /* 219 */ "topic_optr", - /* 220 */ "typename", - /* 221 */ "bufsize", - /* 222 */ "pps", - /* 223 */ "tseries", - /* 224 */ "dbs", - /* 225 */ "streams", - /* 226 */ "storage", - /* 227 */ "qtime", - /* 228 */ "users", - /* 229 */ "conns", - /* 230 */ "state", - /* 231 */ "intitemlist", - /* 232 */ "intitem", - /* 233 */ "keep", - /* 234 */ "cache", - /* 235 */ "replica", - /* 236 */ "quorum", - /* 237 */ "days", - /* 238 */ "minrows", - /* 239 */ "maxrows", - /* 240 */ "blocks", - /* 241 */ "ctime", - /* 242 */ "wal", - /* 243 */ "fsync", - /* 244 */ "comp", - /* 245 */ "prec", - /* 246 */ "update", - /* 247 */ "cachelast", - /* 248 */ "partitions", - /* 249 */ "signed", - /* 250 */ "create_table_args", - /* 251 */ "create_stable_args", - /* 252 */ "create_table_list", - /* 253 */ "create_from_stable", - /* 254 */ "columnlist", - /* 255 */ "tagitemlist", - /* 256 */ "tagNamelist", - /* 257 */ "to_opt", - /* 258 */ "split_opt", - /* 259 */ "select", - /* 260 */ "to_split", - /* 261 */ "column", - /* 262 */ "tagitem", - /* 263 */ "selcollist", - /* 264 */ "from", - /* 265 */ "where_opt", - /* 266 */ "range_option", - /* 267 */ "interval_option", - /* 268 */ "sliding_opt", - /* 269 */ "session_option", - /* 270 */ "windowstate_option", - /* 271 */ "fill_opt", - /* 272 */ "groupby_opt", - /* 273 */ "having_opt", - /* 274 */ "orderby_opt", - /* 275 */ "slimit_opt", - /* 276 */ "limit_opt", - /* 277 */ "union", - /* 278 */ "sclp", - /* 279 */ "distinct", - /* 280 */ "expr", - /* 281 */ "as", - /* 282 */ "tablelist", - /* 283 */ "sub", - /* 284 */ "tmvar", - /* 285 */ "timestamp", - /* 286 */ "intervalKey", - /* 287 */ "sortlist", - /* 288 */ "item", - /* 289 */ "sortorder", - /* 290 */ "arrow", - /* 291 */ "grouplist", - /* 292 */ "expritem", + /* 206 */ "program", + /* 207 */ "cmd", + /* 208 */ "ids", + /* 209 */ "dbPrefix", + /* 210 */ "cpxName", + /* 211 */ "ifexists", + /* 212 */ "alter_db_optr", + /* 213 */ "alter_topic_optr", + /* 214 */ "acct_optr", + /* 215 */ "exprlist", + /* 216 */ "ifnotexists", + /* 217 */ "db_optr", + /* 218 */ "topic_optr", + /* 219 */ "typename", + /* 220 */ "bufsize", + /* 221 */ "pps", + /* 222 */ "tseries", + /* 223 */ "dbs", + /* 224 */ "streams", + /* 225 */ "storage", + /* 226 */ "qtime", + /* 227 */ "users", + /* 228 */ "conns", + /* 229 */ "state", + /* 230 */ "intitemlist", + /* 231 */ "intitem", + /* 232 */ "keep", + /* 233 */ "cache", + /* 234 */ "replica", + /* 235 */ "quorum", + /* 236 */ "days", + /* 237 */ "minrows", + /* 238 */ "maxrows", + /* 239 */ "blocks", + /* 240 */ "ctime", + /* 241 */ "wal", + /* 242 */ "fsync", + /* 243 */ "comp", + /* 244 */ "prec", + /* 245 */ "update", + /* 246 */ "cachelast", + /* 247 */ "partitions", + /* 248 */ "signed", + /* 249 */ "create_table_args", + /* 250 */ "create_stable_args", + /* 251 */ "create_table_list", + /* 252 */ "create_from_stable", + /* 253 */ "columnlist", + /* 254 */ "tagitemlist", + /* 255 */ "tagNamelist", + /* 256 */ "to_opt", + /* 257 */ "split_opt", + /* 258 */ "select", + /* 259 */ "to_split", + /* 260 */ "column", + /* 261 */ "tagitem", + /* 262 */ "selcollist", + /* 263 */ "from", + /* 264 */ "where_opt", + /* 265 */ "range_option", + /* 266 */ "interval_option", + /* 267 */ "sliding_opt", + /* 268 */ "session_option", + /* 269 */ "windowstate_option", + /* 270 */ "fill_opt", + /* 271 */ "groupby_opt", + /* 272 */ "having_opt", + /* 273 */ "orderby_opt", + /* 274 */ "slimit_opt", + /* 275 */ "limit_opt", + /* 276 */ "union", + /* 277 */ "sclp", + /* 278 */ "distinct", + /* 279 */ "expr", + /* 280 */ "as", + /* 281 */ "tablelist", + /* 282 */ "sub", + /* 283 */ "tmvar", + /* 284 */ "timestamp", + /* 285 */ "intervalKey", + /* 286 */ "sortlist", + /* 287 */ "item", + /* 288 */ "sortorder", + /* 289 */ "arrow", + /* 290 */ "grouplist", + /* 291 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1279,203 +1292,204 @@ static const char *const yyRuleName[] = { /* 129 */ "alter_db_optr ::= alter_db_optr comp", /* 130 */ "alter_db_optr ::= alter_db_optr update", /* 131 */ "alter_db_optr ::= alter_db_optr cachelast", - /* 132 */ "alter_topic_optr ::= alter_db_optr", - /* 133 */ "alter_topic_optr ::= alter_topic_optr partitions", - /* 134 */ "typename ::= ids", - /* 135 */ "typename ::= ids LP signed RP", - /* 136 */ "typename ::= ids UNSIGNED", - /* 137 */ "signed ::= INTEGER", - /* 138 */ "signed ::= PLUS INTEGER", - /* 139 */ "signed ::= MINUS INTEGER", - /* 140 */ "cmd ::= CREATE TABLE create_table_args", - /* 141 */ "cmd ::= CREATE TABLE create_stable_args", - /* 142 */ "cmd ::= CREATE STABLE create_stable_args", - /* 143 */ "cmd ::= CREATE TABLE create_table_list", - /* 144 */ "create_table_list ::= create_from_stable", - /* 145 */ "create_table_list ::= create_table_list create_from_stable", - /* 146 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", - /* 147 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", - /* 148 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", - /* 149 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP", - /* 150 */ "tagNamelist ::= tagNamelist COMMA ids", - /* 151 */ "tagNamelist ::= ids", - /* 152 */ "create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select", - /* 153 */ "to_opt ::=", - /* 154 */ "to_opt ::= TO ids cpxName", - /* 155 */ "split_opt ::=", - /* 156 */ "split_opt ::= SPLIT ids", - /* 157 */ "columnlist ::= columnlist COMMA column", - /* 158 */ "columnlist ::= column", - /* 159 */ "column ::= ids typename", - /* 160 */ "tagitemlist ::= tagitemlist COMMA tagitem", - /* 161 */ "tagitemlist ::= tagitem", - /* 162 */ "tagitem ::= INTEGER", - /* 163 */ "tagitem ::= FLOAT", - /* 164 */ "tagitem ::= STRING", - /* 165 */ "tagitem ::= BOOL", - /* 166 */ "tagitem ::= NULL", - /* 167 */ "tagitem ::= NOW", - /* 168 */ "tagitem ::= NOW PLUS VARIABLE", - /* 169 */ "tagitem ::= NOW MINUS VARIABLE", - /* 170 */ "tagitem ::= MINUS INTEGER", - /* 171 */ "tagitem ::= MINUS FLOAT", - /* 172 */ "tagitem ::= PLUS INTEGER", - /* 173 */ "tagitem ::= PLUS FLOAT", - /* 174 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", - /* 175 */ "select ::= LP select RP", - /* 176 */ "union ::= select", - /* 177 */ "union ::= union UNION ALL select", - /* 178 */ "cmd ::= union", - /* 179 */ "select ::= SELECT selcollist", - /* 180 */ "sclp ::= selcollist COMMA", - /* 181 */ "sclp ::=", - /* 182 */ "selcollist ::= sclp distinct expr as", - /* 183 */ "selcollist ::= sclp STAR", - /* 184 */ "as ::= AS ids", - /* 185 */ "as ::= ids", - /* 186 */ "as ::=", - /* 187 */ "distinct ::= DISTINCT", - /* 188 */ "distinct ::=", - /* 189 */ "from ::= FROM tablelist", - /* 190 */ "from ::= FROM sub", - /* 191 */ "sub ::= LP union RP", - /* 192 */ "sub ::= LP union RP ids", - /* 193 */ "sub ::= sub COMMA LP union RP ids", - /* 194 */ "tablelist ::= ids cpxName", - /* 195 */ "tablelist ::= ids cpxName ids", - /* 196 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 197 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 198 */ "tmvar ::= VARIABLE", - /* 199 */ "timestamp ::= INTEGER", - /* 200 */ "timestamp ::= MINUS INTEGER", - /* 201 */ "timestamp ::= PLUS INTEGER", - /* 202 */ "timestamp ::= STRING", - /* 203 */ "timestamp ::= NOW", - /* 204 */ "timestamp ::= NOW PLUS VARIABLE", - /* 205 */ "timestamp ::= NOW MINUS VARIABLE", - /* 206 */ "range_option ::=", - /* 207 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP", - /* 208 */ "interval_option ::= intervalKey LP tmvar RP", - /* 209 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", - /* 210 */ "interval_option ::=", - /* 211 */ "intervalKey ::= INTERVAL", - /* 212 */ "intervalKey ::= EVERY", - /* 213 */ "session_option ::=", - /* 214 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", - /* 215 */ "windowstate_option ::=", - /* 216 */ "windowstate_option ::= STATE_WINDOW LP ids RP", - /* 217 */ "fill_opt ::=", - /* 218 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 219 */ "fill_opt ::= FILL LP ID RP", - /* 220 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 221 */ "sliding_opt ::=", - /* 222 */ "orderby_opt ::=", - /* 223 */ "orderby_opt ::= ORDER BY sortlist", - /* 224 */ "sortlist ::= sortlist COMMA item sortorder", - /* 225 */ "sortlist ::= sortlist COMMA arrow sortorder", - /* 226 */ "sortlist ::= item sortorder", - /* 227 */ "sortlist ::= arrow sortorder", - /* 228 */ "item ::= ID", - /* 229 */ "item ::= ID DOT ID", - /* 230 */ "sortorder ::= ASC", - /* 231 */ "sortorder ::= DESC", - /* 232 */ "sortorder ::=", - /* 233 */ "groupby_opt ::=", - /* 234 */ "groupby_opt ::= GROUP BY grouplist", - /* 235 */ "grouplist ::= grouplist COMMA item", - /* 236 */ "grouplist ::= grouplist COMMA arrow", - /* 237 */ "grouplist ::= item", - /* 238 */ "grouplist ::= arrow", - /* 239 */ "having_opt ::=", - /* 240 */ "having_opt ::= HAVING expr", - /* 241 */ "limit_opt ::=", - /* 242 */ "limit_opt ::= LIMIT signed", - /* 243 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 244 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 245 */ "slimit_opt ::=", - /* 246 */ "slimit_opt ::= SLIMIT signed", - /* 247 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 248 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 249 */ "where_opt ::=", - /* 250 */ "where_opt ::= WHERE expr", - /* 251 */ "expr ::= LP expr RP", - /* 252 */ "expr ::= ID", - /* 253 */ "expr ::= ID DOT ID", - /* 254 */ "expr ::= ID DOT STAR", - /* 255 */ "expr ::= INTEGER", - /* 256 */ "expr ::= MINUS INTEGER", - /* 257 */ "expr ::= PLUS INTEGER", - /* 258 */ "expr ::= FLOAT", - /* 259 */ "expr ::= MINUS FLOAT", - /* 260 */ "expr ::= PLUS FLOAT", - /* 261 */ "expr ::= STRING", - /* 262 */ "expr ::= NOW", - /* 263 */ "expr ::= TODAY", - /* 264 */ "expr ::= VARIABLE", - /* 265 */ "expr ::= PLUS VARIABLE", - /* 266 */ "expr ::= MINUS VARIABLE", - /* 267 */ "expr ::= BOOL", - /* 268 */ "expr ::= NULL", - /* 269 */ "expr ::= ID LP exprlist RP", - /* 270 */ "expr ::= ID LP STAR RP", - /* 271 */ "expr ::= ID LP expr AS typename RP", - /* 272 */ "expr ::= expr IS NULL", - /* 273 */ "expr ::= expr IS NOT NULL", - /* 274 */ "expr ::= expr LT expr", - /* 275 */ "expr ::= expr GT expr", - /* 276 */ "expr ::= expr LE expr", - /* 277 */ "expr ::= expr GE expr", - /* 278 */ "expr ::= expr NE expr", - /* 279 */ "expr ::= expr EQ expr", - /* 280 */ "expr ::= expr BETWEEN expr AND expr", - /* 281 */ "expr ::= expr AND expr", - /* 282 */ "expr ::= expr OR expr", - /* 283 */ "expr ::= expr PLUS expr", - /* 284 */ "expr ::= expr MINUS expr", - /* 285 */ "expr ::= expr STAR expr", - /* 286 */ "expr ::= expr SLASH expr", - /* 287 */ "expr ::= expr REM expr", - /* 288 */ "expr ::= expr BITAND expr", - /* 289 */ "expr ::= expr BITOR expr", - /* 290 */ "expr ::= expr BITXOR expr", - /* 291 */ "expr ::= BITNOT expr", - /* 292 */ "expr ::= expr LSHIFT expr", - /* 293 */ "expr ::= expr RSHIFT expr", - /* 294 */ "expr ::= expr LIKE expr", - /* 295 */ "expr ::= expr MATCH expr", - /* 296 */ "expr ::= expr NMATCH expr", - /* 297 */ "expr ::= ID CONTAINS STRING", - /* 298 */ "expr ::= ID DOT ID CONTAINS STRING", - /* 299 */ "arrow ::= ID ARROW STRING", - /* 300 */ "arrow ::= ID DOT ID ARROW STRING", - /* 301 */ "expr ::= arrow", - /* 302 */ "expr ::= expr IN LP exprlist RP", - /* 303 */ "exprlist ::= exprlist COMMA expritem", - /* 304 */ "exprlist ::= expritem", - /* 305 */ "expritem ::= expr", - /* 306 */ "expritem ::=", - /* 307 */ "cmd ::= RESET QUERY CACHE", - /* 308 */ "cmd ::= SYNCDB ids REPLICA", - /* 309 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 310 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 311 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 312 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 313 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 314 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 315 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 316 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 317 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 318 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 319 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 320 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 321 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 322 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 323 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 324 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 325 */ "cmd ::= KILL CONNECTION INTEGER", - /* 326 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 327 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", - /* 328 */ "cmd ::= DELETE FROM ifexists ids cpxName where_opt", + /* 132 */ "alter_db_optr ::= alter_db_optr minrows", + /* 133 */ "alter_topic_optr ::= alter_db_optr", + /* 134 */ "alter_topic_optr ::= alter_topic_optr partitions", + /* 135 */ "typename ::= ids", + /* 136 */ "typename ::= ids LP signed RP", + /* 137 */ "typename ::= ids UNSIGNED", + /* 138 */ "signed ::= INTEGER", + /* 139 */ "signed ::= PLUS INTEGER", + /* 140 */ "signed ::= MINUS INTEGER", + /* 141 */ "cmd ::= CREATE TABLE create_table_args", + /* 142 */ "cmd ::= CREATE TABLE create_stable_args", + /* 143 */ "cmd ::= CREATE STABLE create_stable_args", + /* 144 */ "cmd ::= CREATE TABLE create_table_list", + /* 145 */ "create_table_list ::= create_from_stable", + /* 146 */ "create_table_list ::= create_table_list create_from_stable", + /* 147 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", + /* 148 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", + /* 149 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", + /* 150 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP", + /* 151 */ "tagNamelist ::= tagNamelist COMMA ids", + /* 152 */ "tagNamelist ::= ids", + /* 153 */ "create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select", + /* 154 */ "to_opt ::=", + /* 155 */ "to_opt ::= TO ids cpxName", + /* 156 */ "split_opt ::=", + /* 157 */ "split_opt ::= SPLIT ids", + /* 158 */ "columnlist ::= columnlist COMMA column", + /* 159 */ "columnlist ::= column", + /* 160 */ "column ::= ids typename", + /* 161 */ "tagitemlist ::= tagitemlist COMMA tagitem", + /* 162 */ "tagitemlist ::= tagitem", + /* 163 */ "tagitem ::= INTEGER", + /* 164 */ "tagitem ::= FLOAT", + /* 165 */ "tagitem ::= STRING", + /* 166 */ "tagitem ::= BOOL", + /* 167 */ "tagitem ::= NULL", + /* 168 */ "tagitem ::= NOW", + /* 169 */ "tagitem ::= NOW PLUS VARIABLE", + /* 170 */ "tagitem ::= NOW MINUS VARIABLE", + /* 171 */ "tagitem ::= MINUS INTEGER", + /* 172 */ "tagitem ::= MINUS FLOAT", + /* 173 */ "tagitem ::= PLUS INTEGER", + /* 174 */ "tagitem ::= PLUS FLOAT", + /* 175 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", + /* 176 */ "select ::= LP select RP", + /* 177 */ "union ::= select", + /* 178 */ "union ::= union UNION ALL select", + /* 179 */ "cmd ::= union", + /* 180 */ "select ::= SELECT selcollist", + /* 181 */ "sclp ::= selcollist COMMA", + /* 182 */ "sclp ::=", + /* 183 */ "selcollist ::= sclp distinct expr as", + /* 184 */ "selcollist ::= sclp STAR", + /* 185 */ "as ::= AS ids", + /* 186 */ "as ::= ids", + /* 187 */ "as ::=", + /* 188 */ "distinct ::= DISTINCT", + /* 189 */ "distinct ::=", + /* 190 */ "from ::= FROM tablelist", + /* 191 */ "from ::= FROM sub", + /* 192 */ "sub ::= LP union RP", + /* 193 */ "sub ::= LP union RP ids", + /* 194 */ "sub ::= sub COMMA LP union RP ids", + /* 195 */ "tablelist ::= ids cpxName", + /* 196 */ "tablelist ::= ids cpxName ids", + /* 197 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 198 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 199 */ "tmvar ::= VARIABLE", + /* 200 */ "timestamp ::= INTEGER", + /* 201 */ "timestamp ::= MINUS INTEGER", + /* 202 */ "timestamp ::= PLUS INTEGER", + /* 203 */ "timestamp ::= STRING", + /* 204 */ "timestamp ::= NOW", + /* 205 */ "timestamp ::= NOW PLUS VARIABLE", + /* 206 */ "timestamp ::= NOW MINUS VARIABLE", + /* 207 */ "range_option ::=", + /* 208 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP", + /* 209 */ "interval_option ::= intervalKey LP tmvar RP", + /* 210 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", + /* 211 */ "interval_option ::=", + /* 212 */ "intervalKey ::= INTERVAL", + /* 213 */ "intervalKey ::= EVERY", + /* 214 */ "session_option ::=", + /* 215 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", + /* 216 */ "windowstate_option ::=", + /* 217 */ "windowstate_option ::= STATE_WINDOW LP ids RP", + /* 218 */ "fill_opt ::=", + /* 219 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 220 */ "fill_opt ::= FILL LP ID RP", + /* 221 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 222 */ "sliding_opt ::=", + /* 223 */ "orderby_opt ::=", + /* 224 */ "orderby_opt ::= ORDER BY sortlist", + /* 225 */ "sortlist ::= sortlist COMMA item sortorder", + /* 226 */ "sortlist ::= sortlist COMMA arrow sortorder", + /* 227 */ "sortlist ::= item sortorder", + /* 228 */ "sortlist ::= arrow sortorder", + /* 229 */ "item ::= ID", + /* 230 */ "item ::= ID DOT ID", + /* 231 */ "sortorder ::= ASC", + /* 232 */ "sortorder ::= DESC", + /* 233 */ "sortorder ::=", + /* 234 */ "groupby_opt ::=", + /* 235 */ "groupby_opt ::= GROUP BY grouplist", + /* 236 */ "grouplist ::= grouplist COMMA item", + /* 237 */ "grouplist ::= grouplist COMMA arrow", + /* 238 */ "grouplist ::= item", + /* 239 */ "grouplist ::= arrow", + /* 240 */ "having_opt ::=", + /* 241 */ "having_opt ::= HAVING expr", + /* 242 */ "limit_opt ::=", + /* 243 */ "limit_opt ::= LIMIT signed", + /* 244 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 245 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 246 */ "slimit_opt ::=", + /* 247 */ "slimit_opt ::= SLIMIT signed", + /* 248 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 249 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 250 */ "where_opt ::=", + /* 251 */ "where_opt ::= WHERE expr", + /* 252 */ "expr ::= LP expr RP", + /* 253 */ "expr ::= ID", + /* 254 */ "expr ::= ID DOT ID", + /* 255 */ "expr ::= ID DOT STAR", + /* 256 */ "expr ::= INTEGER", + /* 257 */ "expr ::= MINUS INTEGER", + /* 258 */ "expr ::= PLUS INTEGER", + /* 259 */ "expr ::= FLOAT", + /* 260 */ "expr ::= MINUS FLOAT", + /* 261 */ "expr ::= PLUS FLOAT", + /* 262 */ "expr ::= STRING", + /* 263 */ "expr ::= NOW", + /* 264 */ "expr ::= TODAY", + /* 265 */ "expr ::= VARIABLE", + /* 266 */ "expr ::= PLUS VARIABLE", + /* 267 */ "expr ::= MINUS VARIABLE", + /* 268 */ "expr ::= BOOL", + /* 269 */ "expr ::= NULL", + /* 270 */ "expr ::= ID LP exprlist RP", + /* 271 */ "expr ::= ID LP STAR RP", + /* 272 */ "expr ::= ID LP expr AS typename RP", + /* 273 */ "expr ::= expr IS NULL", + /* 274 */ "expr ::= expr IS NOT NULL", + /* 275 */ "expr ::= expr LT expr", + /* 276 */ "expr ::= expr GT expr", + /* 277 */ "expr ::= expr LE expr", + /* 278 */ "expr ::= expr GE expr", + /* 279 */ "expr ::= expr NE expr", + /* 280 */ "expr ::= expr EQ expr", + /* 281 */ "expr ::= expr BETWEEN expr AND expr", + /* 282 */ "expr ::= expr AND expr", + /* 283 */ "expr ::= expr OR expr", + /* 284 */ "expr ::= expr PLUS expr", + /* 285 */ "expr ::= expr MINUS expr", + /* 286 */ "expr ::= expr STAR expr", + /* 287 */ "expr ::= expr SLASH expr", + /* 288 */ "expr ::= expr REM expr", + /* 289 */ "expr ::= expr BITAND expr", + /* 290 */ "expr ::= expr BITOR expr", + /* 291 */ "expr ::= expr BITXOR expr", + /* 292 */ "expr ::= BITNOT expr", + /* 293 */ "expr ::= expr LSHIFT expr", + /* 294 */ "expr ::= expr RSHIFT expr", + /* 295 */ "expr ::= expr LIKE expr", + /* 296 */ "expr ::= expr MATCH expr", + /* 297 */ "expr ::= expr NMATCH expr", + /* 298 */ "expr ::= ID CONTAINS STRING", + /* 299 */ "expr ::= ID DOT ID CONTAINS STRING", + /* 300 */ "arrow ::= ID ARROW STRING", + /* 301 */ "arrow ::= ID DOT ID ARROW STRING", + /* 302 */ "expr ::= arrow", + /* 303 */ "expr ::= expr IN LP exprlist RP", + /* 304 */ "exprlist ::= exprlist COMMA expritem", + /* 305 */ "exprlist ::= expritem", + /* 306 */ "expritem ::= expr", + /* 307 */ "expritem ::=", + /* 308 */ "cmd ::= RESET QUERY CACHE", + /* 309 */ "cmd ::= SYNCDB ids REPLICA", + /* 310 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 311 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 312 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 313 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 314 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 315 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 316 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 317 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 318 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 319 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 320 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 321 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 322 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 323 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 324 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 325 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 326 */ "cmd ::= KILL CONNECTION INTEGER", + /* 327 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 328 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 329 */ "cmd ::= DELETE FROM ifexists ids cpxName where_opt", }; #endif /* NDEBUG */ @@ -1524,28 +1538,29 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypParser){ - yyParser *pParser = (yyParser*)yypParser; +void ParseInit(void *yypRawParser ParseCTX_PDECL){ + yyParser *yypParser = (yyParser*)yypRawParser; + ParseCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; + yypParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - pParser->yytos = NULL; - pParser->yystack = NULL; - pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; + yypParser->yytos = NULL; + yypParser->yystack = NULL; + yypParser->yystksz = 0; + if( yyGrowStack(yypParser) ){ + yypParser->yystack = &yypParser->yystk0; + yypParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; + yypParser->yyerrcnt = -1; #endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; + yypParser->yytos = yypParser->yystack; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1562,11 +1577,14 @@ void ParseInit(void *yypParser){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( pParser ) ParseInit(pParser); - return pParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ + yyParser *yypParser; + yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( yypParser ){ + ParseCTX_STORE + ParseInit(yypParser ParseCTX_PARAM); + } + return (void*)yypParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1583,7 +1601,8 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1596,57 +1615,57 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 216: /* exprlist */ - case 263: /* selcollist */ - case 278: /* sclp */ + case 215: /* exprlist */ + case 262: /* selcollist */ + case 277: /* sclp */ { -tSqlExprListDestroy((yypminor->yy367)); +tSqlExprListDestroy((yypminor->yy333)); } break; - case 231: /* intitemlist */ - case 233: /* keep */ - case 254: /* columnlist */ - case 255: /* tagitemlist */ - case 256: /* tagNamelist */ - case 271: /* fill_opt */ - case 272: /* groupby_opt */ - case 274: /* orderby_opt */ - case 287: /* sortlist */ - case 291: /* grouplist */ -{ -taosArrayDestroy(&(yypminor->yy367)); + case 230: /* intitemlist */ + case 232: /* keep */ + case 253: /* columnlist */ + case 254: /* tagitemlist */ + case 255: /* tagNamelist */ + case 270: /* fill_opt */ + case 271: /* groupby_opt */ + case 273: /* orderby_opt */ + case 286: /* sortlist */ + case 290: /* grouplist */ +{ +taosArrayDestroy(&(yypminor->yy333)); } break; - case 252: /* create_table_list */ + case 251: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy74)); +destroyCreateTableSql((yypminor->yy78)); } break; - case 259: /* select */ + case 258: /* select */ { -destroySqlNode((yypminor->yy426)); +destroySqlNode((yypminor->yy144)); } break; - case 264: /* from */ - case 282: /* tablelist */ - case 283: /* sub */ + case 263: /* from */ + case 281: /* tablelist */ + case 282: /* sub */ { -destroyRelationInfo((yypminor->yy480)); +destroyRelationInfo((yypminor->yy516)); } break; - case 265: /* where_opt */ - case 273: /* having_opt */ - case 280: /* expr */ - case 285: /* timestamp */ - case 290: /* arrow */ - case 292: /* expritem */ + case 264: /* where_opt */ + case 272: /* having_opt */ + case 279: /* expr */ + case 284: /* timestamp */ + case 289: /* arrow */ + case 291: /* expritem */ { -tSqlExprDestroy((yypminor->yy378)); +tSqlExprDestroy((yypminor->yy194)); } break; - case 277: /* union */ + case 276: /* union */ { -destroyAllSqlNode((yypminor->yy367)); +destroyAllSqlNode((yypminor->yy333)); } break; /********* End destructor definitions *****************************************/ @@ -1758,13 +1777,12 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static unsigned int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ +static YYACTIONTYPE yy_find_shift_action( + YYCODETYPE iLookAhead, /* The look-ahead token */ + YYACTIONTYPE stateno /* Current state number */ ){ int i; - int stateno = pParser->yytos->stateno; - + if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) @@ -1772,15 +1790,19 @@ static unsigned int yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); + assert( i>=0 ); + assert( i<=YY_ACTTAB_COUNT ); + assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; + assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", @@ -1795,15 +1817,8 @@ static unsigned int yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j0 - ){ + assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); + if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1817,6 +1832,7 @@ static unsigned int yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ + assert( i>=0 && iyytos; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; + yytos->stateno = yyNewState; + yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - signed char nrhs; /* Negative of the number of RHS symbols in the rule */ -} yyRuleInfo[] = { - { 207, -1 }, /* (0) program ::= cmd */ - { 208, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 208, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 208, -2 }, /* (3) cmd ::= SHOW FUNCTIONS */ - { 208, -2 }, /* (4) cmd ::= SHOW MNODES */ - { 208, -2 }, /* (5) cmd ::= SHOW DNODES */ - { 208, -2 }, /* (6) cmd ::= SHOW ACCOUNTS */ - { 208, -2 }, /* (7) cmd ::= SHOW USERS */ - { 208, -2 }, /* (8) cmd ::= SHOW MODULES */ - { 208, -2 }, /* (9) cmd ::= SHOW QUERIES */ - { 208, -2 }, /* (10) cmd ::= SHOW CONNECTIONS */ - { 208, -2 }, /* (11) cmd ::= SHOW STREAMS */ - { 208, -2 }, /* (12) cmd ::= SHOW VARIABLES */ - { 208, -2 }, /* (13) cmd ::= SHOW SCORES */ - { 208, -2 }, /* (14) cmd ::= SHOW GRANTS */ - { 208, -2 }, /* (15) cmd ::= SHOW VNODES */ - { 208, -3 }, /* (16) cmd ::= SHOW VNODES ids */ - { 210, 0 }, /* (17) dbPrefix ::= */ - { 210, -2 }, /* (18) dbPrefix ::= ids DOT */ - { 211, 0 }, /* (19) cpxName ::= */ - { 211, -2 }, /* (20) cpxName ::= DOT ids */ - { 208, -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 208, -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ - { 208, -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */ - { 208, -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */ - { 208, -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE STRING */ - { 208, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */ - { 208, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE STRING */ - { 208, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - { 208, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ - { 208, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ - { 208, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */ - { 208, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */ - { 208, -3 }, /* (33) cmd ::= DROP FUNCTION ids */ - { 208, -3 }, /* (34) cmd ::= DROP DNODE ids */ - { 208, -3 }, /* (35) cmd ::= DROP USER ids */ - { 208, -3 }, /* (36) cmd ::= DROP ACCOUNT ids */ - { 208, -2 }, /* (37) cmd ::= USE ids */ - { 208, -3 }, /* (38) cmd ::= DESCRIBE ids cpxName */ - { 208, -3 }, /* (39) cmd ::= DESC ids cpxName */ - { 208, -5 }, /* (40) cmd ::= ALTER USER ids PASS ids */ - { 208, -5 }, /* (41) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 208, -5 }, /* (42) cmd ::= ALTER USER ids TAGS ids */ - { 208, -4 }, /* (43) cmd ::= ALTER DNODE ids ids */ - { 208, -5 }, /* (44) cmd ::= ALTER DNODE ids ids ids */ - { 208, -3 }, /* (45) cmd ::= ALTER LOCAL ids */ - { 208, -4 }, /* (46) cmd ::= ALTER LOCAL ids ids */ - { 208, -4 }, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 208, -4 }, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ - { 208, -4 }, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 208, -6 }, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 208, -6 }, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ - { 209, -1 }, /* (52) ids ::= ID */ - { 209, -1 }, /* (53) ids ::= STRING */ - { 212, -2 }, /* (54) ifexists ::= IF EXISTS */ - { 212, 0 }, /* (55) ifexists ::= */ - { 217, -3 }, /* (56) ifnotexists ::= IF NOT EXISTS */ - { 217, 0 }, /* (57) ifnotexists ::= */ - { 208, -3 }, /* (58) cmd ::= CREATE DNODE ids */ - { 208, -6 }, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 208, -5 }, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 208, -5 }, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - { 208, -8 }, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - { 208, -9 }, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - { 208, -5 }, /* (64) cmd ::= CREATE USER ids PASS ids */ - { 208, -7 }, /* (65) cmd ::= CREATE USER ids PASS ids TAGS ids */ - { 221, 0 }, /* (66) bufsize ::= */ - { 221, -2 }, /* (67) bufsize ::= BUFSIZE INTEGER */ - { 222, 0 }, /* (68) pps ::= */ - { 222, -2 }, /* (69) pps ::= PPS INTEGER */ - { 223, 0 }, /* (70) tseries ::= */ - { 223, -2 }, /* (71) tseries ::= TSERIES INTEGER */ - { 224, 0 }, /* (72) dbs ::= */ - { 224, -2 }, /* (73) dbs ::= DBS INTEGER */ - { 225, 0 }, /* (74) streams ::= */ - { 225, -2 }, /* (75) streams ::= STREAMS INTEGER */ - { 226, 0 }, /* (76) storage ::= */ - { 226, -2 }, /* (77) storage ::= STORAGE INTEGER */ - { 227, 0 }, /* (78) qtime ::= */ - { 227, -2 }, /* (79) qtime ::= QTIME INTEGER */ - { 228, 0 }, /* (80) users ::= */ - { 228, -2 }, /* (81) users ::= USERS INTEGER */ - { 229, 0 }, /* (82) conns ::= */ - { 229, -2 }, /* (83) conns ::= CONNS INTEGER */ - { 230, 0 }, /* (84) state ::= */ - { 230, -2 }, /* (85) state ::= STATE ids */ - { 215, -9 }, /* (86) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 231, -3 }, /* (87) intitemlist ::= intitemlist COMMA intitem */ - { 231, -1 }, /* (88) intitemlist ::= intitem */ - { 232, -1 }, /* (89) intitem ::= INTEGER */ - { 233, -2 }, /* (90) keep ::= KEEP intitemlist */ - { 234, -2 }, /* (91) cache ::= CACHE INTEGER */ - { 235, -2 }, /* (92) replica ::= REPLICA INTEGER */ - { 236, -2 }, /* (93) quorum ::= QUORUM INTEGER */ - { 237, -2 }, /* (94) days ::= DAYS INTEGER */ - { 238, -2 }, /* (95) minrows ::= MINROWS INTEGER */ - { 239, -2 }, /* (96) maxrows ::= MAXROWS INTEGER */ - { 240, -2 }, /* (97) blocks ::= BLOCKS INTEGER */ - { 241, -2 }, /* (98) ctime ::= CTIME INTEGER */ - { 242, -2 }, /* (99) wal ::= WAL INTEGER */ - { 243, -2 }, /* (100) fsync ::= FSYNC INTEGER */ - { 244, -2 }, /* (101) comp ::= COMP INTEGER */ - { 245, -2 }, /* (102) prec ::= PRECISION STRING */ - { 246, -2 }, /* (103) update ::= UPDATE INTEGER */ - { 247, -2 }, /* (104) cachelast ::= CACHELAST INTEGER */ - { 248, -2 }, /* (105) partitions ::= PARTITIONS INTEGER */ - { 218, 0 }, /* (106) db_optr ::= */ - { 218, -2 }, /* (107) db_optr ::= db_optr cache */ - { 218, -2 }, /* (108) db_optr ::= db_optr replica */ - { 218, -2 }, /* (109) db_optr ::= db_optr quorum */ - { 218, -2 }, /* (110) db_optr ::= db_optr days */ - { 218, -2 }, /* (111) db_optr ::= db_optr minrows */ - { 218, -2 }, /* (112) db_optr ::= db_optr maxrows */ - { 218, -2 }, /* (113) db_optr ::= db_optr blocks */ - { 218, -2 }, /* (114) db_optr ::= db_optr ctime */ - { 218, -2 }, /* (115) db_optr ::= db_optr wal */ - { 218, -2 }, /* (116) db_optr ::= db_optr fsync */ - { 218, -2 }, /* (117) db_optr ::= db_optr comp */ - { 218, -2 }, /* (118) db_optr ::= db_optr prec */ - { 218, -2 }, /* (119) db_optr ::= db_optr keep */ - { 218, -2 }, /* (120) db_optr ::= db_optr update */ - { 218, -2 }, /* (121) db_optr ::= db_optr cachelast */ - { 219, -1 }, /* (122) topic_optr ::= db_optr */ - { 219, -2 }, /* (123) topic_optr ::= topic_optr partitions */ - { 213, 0 }, /* (124) alter_db_optr ::= */ - { 213, -2 }, /* (125) alter_db_optr ::= alter_db_optr replica */ - { 213, -2 }, /* (126) alter_db_optr ::= alter_db_optr quorum */ - { 213, -2 }, /* (127) alter_db_optr ::= alter_db_optr keep */ - { 213, -2 }, /* (128) alter_db_optr ::= alter_db_optr blocks */ - { 213, -2 }, /* (129) alter_db_optr ::= alter_db_optr comp */ - { 213, -2 }, /* (130) alter_db_optr ::= alter_db_optr update */ - { 213, -2 }, /* (131) alter_db_optr ::= alter_db_optr cachelast */ - { 214, -1 }, /* (132) alter_topic_optr ::= alter_db_optr */ - { 214, -2 }, /* (133) alter_topic_optr ::= alter_topic_optr partitions */ - { 220, -1 }, /* (134) typename ::= ids */ - { 220, -4 }, /* (135) typename ::= ids LP signed RP */ - { 220, -2 }, /* (136) typename ::= ids UNSIGNED */ - { 249, -1 }, /* (137) signed ::= INTEGER */ - { 249, -2 }, /* (138) signed ::= PLUS INTEGER */ - { 249, -2 }, /* (139) signed ::= MINUS INTEGER */ - { 208, -3 }, /* (140) cmd ::= CREATE TABLE create_table_args */ - { 208, -3 }, /* (141) cmd ::= CREATE TABLE create_stable_args */ - { 208, -3 }, /* (142) cmd ::= CREATE STABLE create_stable_args */ - { 208, -3 }, /* (143) cmd ::= CREATE TABLE create_table_list */ - { 252, -1 }, /* (144) create_table_list ::= create_from_stable */ - { 252, -2 }, /* (145) create_table_list ::= create_table_list create_from_stable */ - { 250, -6 }, /* (146) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 251, -10 }, /* (147) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 253, -10 }, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 253, -13 }, /* (149) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 256, -3 }, /* (150) tagNamelist ::= tagNamelist COMMA ids */ - { 256, -1 }, /* (151) tagNamelist ::= ids */ - { 250, -7 }, /* (152) create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select */ - { 257, 0 }, /* (153) to_opt ::= */ - { 257, -3 }, /* (154) to_opt ::= TO ids cpxName */ - { 258, 0 }, /* (155) split_opt ::= */ - { 258, -2 }, /* (156) split_opt ::= SPLIT ids */ - { 254, -3 }, /* (157) columnlist ::= columnlist COMMA column */ - { 254, -1 }, /* (158) columnlist ::= column */ - { 261, -2 }, /* (159) column ::= ids typename */ - { 255, -3 }, /* (160) tagitemlist ::= tagitemlist COMMA tagitem */ - { 255, -1 }, /* (161) tagitemlist ::= tagitem */ - { 262, -1 }, /* (162) tagitem ::= INTEGER */ - { 262, -1 }, /* (163) tagitem ::= FLOAT */ - { 262, -1 }, /* (164) tagitem ::= STRING */ - { 262, -1 }, /* (165) tagitem ::= BOOL */ - { 262, -1 }, /* (166) tagitem ::= NULL */ - { 262, -1 }, /* (167) tagitem ::= NOW */ - { 262, -3 }, /* (168) tagitem ::= NOW PLUS VARIABLE */ - { 262, -3 }, /* (169) tagitem ::= NOW MINUS VARIABLE */ - { 262, -2 }, /* (170) tagitem ::= MINUS INTEGER */ - { 262, -2 }, /* (171) tagitem ::= MINUS FLOAT */ - { 262, -2 }, /* (172) tagitem ::= PLUS INTEGER */ - { 262, -2 }, /* (173) tagitem ::= PLUS FLOAT */ - { 259, -15 }, /* (174) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - { 259, -3 }, /* (175) select ::= LP select RP */ - { 277, -1 }, /* (176) union ::= select */ - { 277, -4 }, /* (177) union ::= union UNION ALL select */ - { 208, -1 }, /* (178) cmd ::= union */ - { 259, -2 }, /* (179) select ::= SELECT selcollist */ - { 278, -2 }, /* (180) sclp ::= selcollist COMMA */ - { 278, 0 }, /* (181) sclp ::= */ - { 263, -4 }, /* (182) selcollist ::= sclp distinct expr as */ - { 263, -2 }, /* (183) selcollist ::= sclp STAR */ - { 281, -2 }, /* (184) as ::= AS ids */ - { 281, -1 }, /* (185) as ::= ids */ - { 281, 0 }, /* (186) as ::= */ - { 279, -1 }, /* (187) distinct ::= DISTINCT */ - { 279, 0 }, /* (188) distinct ::= */ - { 264, -2 }, /* (189) from ::= FROM tablelist */ - { 264, -2 }, /* (190) from ::= FROM sub */ - { 283, -3 }, /* (191) sub ::= LP union RP */ - { 283, -4 }, /* (192) sub ::= LP union RP ids */ - { 283, -6 }, /* (193) sub ::= sub COMMA LP union RP ids */ - { 282, -2 }, /* (194) tablelist ::= ids cpxName */ - { 282, -3 }, /* (195) tablelist ::= ids cpxName ids */ - { 282, -4 }, /* (196) tablelist ::= tablelist COMMA ids cpxName */ - { 282, -5 }, /* (197) tablelist ::= tablelist COMMA ids cpxName ids */ - { 284, -1 }, /* (198) tmvar ::= VARIABLE */ - { 285, -1 }, /* (199) timestamp ::= INTEGER */ - { 285, -2 }, /* (200) timestamp ::= MINUS INTEGER */ - { 285, -2 }, /* (201) timestamp ::= PLUS INTEGER */ - { 285, -1 }, /* (202) timestamp ::= STRING */ - { 285, -1 }, /* (203) timestamp ::= NOW */ - { 285, -3 }, /* (204) timestamp ::= NOW PLUS VARIABLE */ - { 285, -3 }, /* (205) timestamp ::= NOW MINUS VARIABLE */ - { 266, 0 }, /* (206) range_option ::= */ - { 266, -6 }, /* (207) range_option ::= RANGE LP timestamp COMMA timestamp RP */ - { 267, -4 }, /* (208) interval_option ::= intervalKey LP tmvar RP */ - { 267, -6 }, /* (209) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - { 267, 0 }, /* (210) interval_option ::= */ - { 286, -1 }, /* (211) intervalKey ::= INTERVAL */ - { 286, -1 }, /* (212) intervalKey ::= EVERY */ - { 269, 0 }, /* (213) session_option ::= */ - { 269, -7 }, /* (214) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 270, 0 }, /* (215) windowstate_option ::= */ - { 270, -4 }, /* (216) windowstate_option ::= STATE_WINDOW LP ids RP */ - { 271, 0 }, /* (217) fill_opt ::= */ - { 271, -6 }, /* (218) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 271, -4 }, /* (219) fill_opt ::= FILL LP ID RP */ - { 268, -4 }, /* (220) sliding_opt ::= SLIDING LP tmvar RP */ - { 268, 0 }, /* (221) sliding_opt ::= */ - { 274, 0 }, /* (222) orderby_opt ::= */ - { 274, -3 }, /* (223) orderby_opt ::= ORDER BY sortlist */ - { 287, -4 }, /* (224) sortlist ::= sortlist COMMA item sortorder */ - { 287, -4 }, /* (225) sortlist ::= sortlist COMMA arrow sortorder */ - { 287, -2 }, /* (226) sortlist ::= item sortorder */ - { 287, -2 }, /* (227) sortlist ::= arrow sortorder */ - { 288, -1 }, /* (228) item ::= ID */ - { 288, -3 }, /* (229) item ::= ID DOT ID */ - { 289, -1 }, /* (230) sortorder ::= ASC */ - { 289, -1 }, /* (231) sortorder ::= DESC */ - { 289, 0 }, /* (232) sortorder ::= */ - { 272, 0 }, /* (233) groupby_opt ::= */ - { 272, -3 }, /* (234) groupby_opt ::= GROUP BY grouplist */ - { 291, -3 }, /* (235) grouplist ::= grouplist COMMA item */ - { 291, -3 }, /* (236) grouplist ::= grouplist COMMA arrow */ - { 291, -1 }, /* (237) grouplist ::= item */ - { 291, -1 }, /* (238) grouplist ::= arrow */ - { 273, 0 }, /* (239) having_opt ::= */ - { 273, -2 }, /* (240) having_opt ::= HAVING expr */ - { 276, 0 }, /* (241) limit_opt ::= */ - { 276, -2 }, /* (242) limit_opt ::= LIMIT signed */ - { 276, -4 }, /* (243) limit_opt ::= LIMIT signed OFFSET signed */ - { 276, -4 }, /* (244) limit_opt ::= LIMIT signed COMMA signed */ - { 275, 0 }, /* (245) slimit_opt ::= */ - { 275, -2 }, /* (246) slimit_opt ::= SLIMIT signed */ - { 275, -4 }, /* (247) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 275, -4 }, /* (248) slimit_opt ::= SLIMIT signed COMMA signed */ - { 265, 0 }, /* (249) where_opt ::= */ - { 265, -2 }, /* (250) where_opt ::= WHERE expr */ - { 280, -3 }, /* (251) expr ::= LP expr RP */ - { 280, -1 }, /* (252) expr ::= ID */ - { 280, -3 }, /* (253) expr ::= ID DOT ID */ - { 280, -3 }, /* (254) expr ::= ID DOT STAR */ - { 280, -1 }, /* (255) expr ::= INTEGER */ - { 280, -2 }, /* (256) expr ::= MINUS INTEGER */ - { 280, -2 }, /* (257) expr ::= PLUS INTEGER */ - { 280, -1 }, /* (258) expr ::= FLOAT */ - { 280, -2 }, /* (259) expr ::= MINUS FLOAT */ - { 280, -2 }, /* (260) expr ::= PLUS FLOAT */ - { 280, -1 }, /* (261) expr ::= STRING */ - { 280, -1 }, /* (262) expr ::= NOW */ - { 280, -1 }, /* (263) expr ::= TODAY */ - { 280, -1 }, /* (264) expr ::= VARIABLE */ - { 280, -2 }, /* (265) expr ::= PLUS VARIABLE */ - { 280, -2 }, /* (266) expr ::= MINUS VARIABLE */ - { 280, -1 }, /* (267) expr ::= BOOL */ - { 280, -1 }, /* (268) expr ::= NULL */ - { 280, -4 }, /* (269) expr ::= ID LP exprlist RP */ - { 280, -4 }, /* (270) expr ::= ID LP STAR RP */ - { 280, -6 }, /* (271) expr ::= ID LP expr AS typename RP */ - { 280, -3 }, /* (272) expr ::= expr IS NULL */ - { 280, -4 }, /* (273) expr ::= expr IS NOT NULL */ - { 280, -3 }, /* (274) expr ::= expr LT expr */ - { 280, -3 }, /* (275) expr ::= expr GT expr */ - { 280, -3 }, /* (276) expr ::= expr LE expr */ - { 280, -3 }, /* (277) expr ::= expr GE expr */ - { 280, -3 }, /* (278) expr ::= expr NE expr */ - { 280, -3 }, /* (279) expr ::= expr EQ expr */ - { 280, -5 }, /* (280) expr ::= expr BETWEEN expr AND expr */ - { 280, -3 }, /* (281) expr ::= expr AND expr */ - { 280, -3 }, /* (282) expr ::= expr OR expr */ - { 280, -3 }, /* (283) expr ::= expr PLUS expr */ - { 280, -3 }, /* (284) expr ::= expr MINUS expr */ - { 280, -3 }, /* (285) expr ::= expr STAR expr */ - { 280, -3 }, /* (286) expr ::= expr SLASH expr */ - { 280, -3 }, /* (287) expr ::= expr REM expr */ - { 280, -3 }, /* (288) expr ::= expr BITAND expr */ - { 280, -3 }, /* (289) expr ::= expr BITOR expr */ - { 280, -3 }, /* (290) expr ::= expr BITXOR expr */ - { 280, -2 }, /* (291) expr ::= BITNOT expr */ - { 280, -3 }, /* (292) expr ::= expr LSHIFT expr */ - { 280, -3 }, /* (293) expr ::= expr RSHIFT expr */ - { 280, -3 }, /* (294) expr ::= expr LIKE expr */ - { 280, -3 }, /* (295) expr ::= expr MATCH expr */ - { 280, -3 }, /* (296) expr ::= expr NMATCH expr */ - { 280, -3 }, /* (297) expr ::= ID CONTAINS STRING */ - { 280, -5 }, /* (298) expr ::= ID DOT ID CONTAINS STRING */ - { 290, -3 }, /* (299) arrow ::= ID ARROW STRING */ - { 290, -5 }, /* (300) arrow ::= ID DOT ID ARROW STRING */ - { 280, -1 }, /* (301) expr ::= arrow */ - { 280, -5 }, /* (302) expr ::= expr IN LP exprlist RP */ - { 216, -3 }, /* (303) exprlist ::= exprlist COMMA expritem */ - { 216, -1 }, /* (304) exprlist ::= expritem */ - { 292, -1 }, /* (305) expritem ::= expr */ - { 292, 0 }, /* (306) expritem ::= */ - { 208, -3 }, /* (307) cmd ::= RESET QUERY CACHE */ - { 208, -3 }, /* (308) cmd ::= SYNCDB ids REPLICA */ - { 208, -7 }, /* (309) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 208, -7 }, /* (310) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 208, -7 }, /* (311) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - { 208, -7 }, /* (312) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 208, -7 }, /* (313) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 208, -8 }, /* (314) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 208, -9 }, /* (315) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 208, -7 }, /* (316) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - { 208, -7 }, /* (317) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 208, -7 }, /* (318) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 208, -7 }, /* (319) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - { 208, -7 }, /* (320) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 208, -7 }, /* (321) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 208, -8 }, /* (322) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 208, -9 }, /* (323) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - { 208, -7 }, /* (324) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - { 208, -3 }, /* (325) cmd ::= KILL CONNECTION INTEGER */ - { 208, -5 }, /* (326) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 208, -5 }, /* (327) cmd ::= KILL QUERY INTEGER COLON INTEGER */ - { 208, -6 }, /* (328) cmd ::= DELETE FROM ifexists ids cpxName where_opt */ +/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +** of that rule */ +static const YYCODETYPE yyRuleInfoLhs[] = { + 206, /* (0) program ::= cmd */ + 207, /* (1) cmd ::= SHOW DATABASES */ + 207, /* (2) cmd ::= SHOW TOPICS */ + 207, /* (3) cmd ::= SHOW FUNCTIONS */ + 207, /* (4) cmd ::= SHOW MNODES */ + 207, /* (5) cmd ::= SHOW DNODES */ + 207, /* (6) cmd ::= SHOW ACCOUNTS */ + 207, /* (7) cmd ::= SHOW USERS */ + 207, /* (8) cmd ::= SHOW MODULES */ + 207, /* (9) cmd ::= SHOW QUERIES */ + 207, /* (10) cmd ::= SHOW CONNECTIONS */ + 207, /* (11) cmd ::= SHOW STREAMS */ + 207, /* (12) cmd ::= SHOW VARIABLES */ + 207, /* (13) cmd ::= SHOW SCORES */ + 207, /* (14) cmd ::= SHOW GRANTS */ + 207, /* (15) cmd ::= SHOW VNODES */ + 207, /* (16) cmd ::= SHOW VNODES ids */ + 209, /* (17) dbPrefix ::= */ + 209, /* (18) dbPrefix ::= ids DOT */ + 210, /* (19) cpxName ::= */ + 210, /* (20) cpxName ::= DOT ids */ + 207, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + 207, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + 207, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + 207, /* (24) cmd ::= SHOW dbPrefix TABLES */ + 207, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE STRING */ + 207, /* (26) cmd ::= SHOW dbPrefix STABLES */ + 207, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE STRING */ + 207, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + 207, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + 207, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + 207, /* (31) cmd ::= DROP DATABASE ifexists ids */ + 207, /* (32) cmd ::= DROP TOPIC ifexists ids */ + 207, /* (33) cmd ::= DROP FUNCTION ids */ + 207, /* (34) cmd ::= DROP DNODE ids */ + 207, /* (35) cmd ::= DROP USER ids */ + 207, /* (36) cmd ::= DROP ACCOUNT ids */ + 207, /* (37) cmd ::= USE ids */ + 207, /* (38) cmd ::= DESCRIBE ids cpxName */ + 207, /* (39) cmd ::= DESC ids cpxName */ + 207, /* (40) cmd ::= ALTER USER ids PASS ids */ + 207, /* (41) cmd ::= ALTER USER ids PRIVILEGE ids */ + 207, /* (42) cmd ::= ALTER USER ids TAGS ids */ + 207, /* (43) cmd ::= ALTER DNODE ids ids */ + 207, /* (44) cmd ::= ALTER DNODE ids ids ids */ + 207, /* (45) cmd ::= ALTER LOCAL ids */ + 207, /* (46) cmd ::= ALTER LOCAL ids ids */ + 207, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ + 207, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 207, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ + 207, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 207, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ + 208, /* (52) ids ::= ID */ + 208, /* (53) ids ::= STRING */ + 211, /* (54) ifexists ::= IF EXISTS */ + 211, /* (55) ifexists ::= */ + 216, /* (56) ifnotexists ::= IF NOT EXISTS */ + 216, /* (57) ifnotexists ::= */ + 207, /* (58) cmd ::= CREATE DNODE ids */ + 207, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 207, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 207, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 207, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 207, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 207, /* (64) cmd ::= CREATE USER ids PASS ids */ + 207, /* (65) cmd ::= CREATE USER ids PASS ids TAGS ids */ + 220, /* (66) bufsize ::= */ + 220, /* (67) bufsize ::= BUFSIZE INTEGER */ + 221, /* (68) pps ::= */ + 221, /* (69) pps ::= PPS INTEGER */ + 222, /* (70) tseries ::= */ + 222, /* (71) tseries ::= TSERIES INTEGER */ + 223, /* (72) dbs ::= */ + 223, /* (73) dbs ::= DBS INTEGER */ + 224, /* (74) streams ::= */ + 224, /* (75) streams ::= STREAMS INTEGER */ + 225, /* (76) storage ::= */ + 225, /* (77) storage ::= STORAGE INTEGER */ + 226, /* (78) qtime ::= */ + 226, /* (79) qtime ::= QTIME INTEGER */ + 227, /* (80) users ::= */ + 227, /* (81) users ::= USERS INTEGER */ + 228, /* (82) conns ::= */ + 228, /* (83) conns ::= CONNS INTEGER */ + 229, /* (84) state ::= */ + 229, /* (85) state ::= STATE ids */ + 214, /* (86) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 230, /* (87) intitemlist ::= intitemlist COMMA intitem */ + 230, /* (88) intitemlist ::= intitem */ + 231, /* (89) intitem ::= INTEGER */ + 232, /* (90) keep ::= KEEP intitemlist */ + 233, /* (91) cache ::= CACHE INTEGER */ + 234, /* (92) replica ::= REPLICA INTEGER */ + 235, /* (93) quorum ::= QUORUM INTEGER */ + 236, /* (94) days ::= DAYS INTEGER */ + 237, /* (95) minrows ::= MINROWS INTEGER */ + 238, /* (96) maxrows ::= MAXROWS INTEGER */ + 239, /* (97) blocks ::= BLOCKS INTEGER */ + 240, /* (98) ctime ::= CTIME INTEGER */ + 241, /* (99) wal ::= WAL INTEGER */ + 242, /* (100) fsync ::= FSYNC INTEGER */ + 243, /* (101) comp ::= COMP INTEGER */ + 244, /* (102) prec ::= PRECISION STRING */ + 245, /* (103) update ::= UPDATE INTEGER */ + 246, /* (104) cachelast ::= CACHELAST INTEGER */ + 247, /* (105) partitions ::= PARTITIONS INTEGER */ + 217, /* (106) db_optr ::= */ + 217, /* (107) db_optr ::= db_optr cache */ + 217, /* (108) db_optr ::= db_optr replica */ + 217, /* (109) db_optr ::= db_optr quorum */ + 217, /* (110) db_optr ::= db_optr days */ + 217, /* (111) db_optr ::= db_optr minrows */ + 217, /* (112) db_optr ::= db_optr maxrows */ + 217, /* (113) db_optr ::= db_optr blocks */ + 217, /* (114) db_optr ::= db_optr ctime */ + 217, /* (115) db_optr ::= db_optr wal */ + 217, /* (116) db_optr ::= db_optr fsync */ + 217, /* (117) db_optr ::= db_optr comp */ + 217, /* (118) db_optr ::= db_optr prec */ + 217, /* (119) db_optr ::= db_optr keep */ + 217, /* (120) db_optr ::= db_optr update */ + 217, /* (121) db_optr ::= db_optr cachelast */ + 218, /* (122) topic_optr ::= db_optr */ + 218, /* (123) topic_optr ::= topic_optr partitions */ + 212, /* (124) alter_db_optr ::= */ + 212, /* (125) alter_db_optr ::= alter_db_optr replica */ + 212, /* (126) alter_db_optr ::= alter_db_optr quorum */ + 212, /* (127) alter_db_optr ::= alter_db_optr keep */ + 212, /* (128) alter_db_optr ::= alter_db_optr blocks */ + 212, /* (129) alter_db_optr ::= alter_db_optr comp */ + 212, /* (130) alter_db_optr ::= alter_db_optr update */ + 212, /* (131) alter_db_optr ::= alter_db_optr cachelast */ + 212, /* (132) alter_db_optr ::= alter_db_optr minrows */ + 213, /* (133) alter_topic_optr ::= alter_db_optr */ + 213, /* (134) alter_topic_optr ::= alter_topic_optr partitions */ + 219, /* (135) typename ::= ids */ + 219, /* (136) typename ::= ids LP signed RP */ + 219, /* (137) typename ::= ids UNSIGNED */ + 248, /* (138) signed ::= INTEGER */ + 248, /* (139) signed ::= PLUS INTEGER */ + 248, /* (140) signed ::= MINUS INTEGER */ + 207, /* (141) cmd ::= CREATE TABLE create_table_args */ + 207, /* (142) cmd ::= CREATE TABLE create_stable_args */ + 207, /* (143) cmd ::= CREATE STABLE create_stable_args */ + 207, /* (144) cmd ::= CREATE TABLE create_table_list */ + 251, /* (145) create_table_list ::= create_from_stable */ + 251, /* (146) create_table_list ::= create_table_list create_from_stable */ + 249, /* (147) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 250, /* (148) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 252, /* (149) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 252, /* (150) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 255, /* (151) tagNamelist ::= tagNamelist COMMA ids */ + 255, /* (152) tagNamelist ::= ids */ + 249, /* (153) create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select */ + 256, /* (154) to_opt ::= */ + 256, /* (155) to_opt ::= TO ids cpxName */ + 257, /* (156) split_opt ::= */ + 257, /* (157) split_opt ::= SPLIT ids */ + 253, /* (158) columnlist ::= columnlist COMMA column */ + 253, /* (159) columnlist ::= column */ + 260, /* (160) column ::= ids typename */ + 254, /* (161) tagitemlist ::= tagitemlist COMMA tagitem */ + 254, /* (162) tagitemlist ::= tagitem */ + 261, /* (163) tagitem ::= INTEGER */ + 261, /* (164) tagitem ::= FLOAT */ + 261, /* (165) tagitem ::= STRING */ + 261, /* (166) tagitem ::= BOOL */ + 261, /* (167) tagitem ::= NULL */ + 261, /* (168) tagitem ::= NOW */ + 261, /* (169) tagitem ::= NOW PLUS VARIABLE */ + 261, /* (170) tagitem ::= NOW MINUS VARIABLE */ + 261, /* (171) tagitem ::= MINUS INTEGER */ + 261, /* (172) tagitem ::= MINUS FLOAT */ + 261, /* (173) tagitem ::= PLUS INTEGER */ + 261, /* (174) tagitem ::= PLUS FLOAT */ + 258, /* (175) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + 258, /* (176) select ::= LP select RP */ + 276, /* (177) union ::= select */ + 276, /* (178) union ::= union UNION ALL select */ + 207, /* (179) cmd ::= union */ + 258, /* (180) select ::= SELECT selcollist */ + 277, /* (181) sclp ::= selcollist COMMA */ + 277, /* (182) sclp ::= */ + 262, /* (183) selcollist ::= sclp distinct expr as */ + 262, /* (184) selcollist ::= sclp STAR */ + 280, /* (185) as ::= AS ids */ + 280, /* (186) as ::= ids */ + 280, /* (187) as ::= */ + 278, /* (188) distinct ::= DISTINCT */ + 278, /* (189) distinct ::= */ + 263, /* (190) from ::= FROM tablelist */ + 263, /* (191) from ::= FROM sub */ + 282, /* (192) sub ::= LP union RP */ + 282, /* (193) sub ::= LP union RP ids */ + 282, /* (194) sub ::= sub COMMA LP union RP ids */ + 281, /* (195) tablelist ::= ids cpxName */ + 281, /* (196) tablelist ::= ids cpxName ids */ + 281, /* (197) tablelist ::= tablelist COMMA ids cpxName */ + 281, /* (198) tablelist ::= tablelist COMMA ids cpxName ids */ + 283, /* (199) tmvar ::= VARIABLE */ + 284, /* (200) timestamp ::= INTEGER */ + 284, /* (201) timestamp ::= MINUS INTEGER */ + 284, /* (202) timestamp ::= PLUS INTEGER */ + 284, /* (203) timestamp ::= STRING */ + 284, /* (204) timestamp ::= NOW */ + 284, /* (205) timestamp ::= NOW PLUS VARIABLE */ + 284, /* (206) timestamp ::= NOW MINUS VARIABLE */ + 265, /* (207) range_option ::= */ + 265, /* (208) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + 266, /* (209) interval_option ::= intervalKey LP tmvar RP */ + 266, /* (210) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 266, /* (211) interval_option ::= */ + 285, /* (212) intervalKey ::= INTERVAL */ + 285, /* (213) intervalKey ::= EVERY */ + 268, /* (214) session_option ::= */ + 268, /* (215) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 269, /* (216) windowstate_option ::= */ + 269, /* (217) windowstate_option ::= STATE_WINDOW LP ids RP */ + 270, /* (218) fill_opt ::= */ + 270, /* (219) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 270, /* (220) fill_opt ::= FILL LP ID RP */ + 267, /* (221) sliding_opt ::= SLIDING LP tmvar RP */ + 267, /* (222) sliding_opt ::= */ + 273, /* (223) orderby_opt ::= */ + 273, /* (224) orderby_opt ::= ORDER BY sortlist */ + 286, /* (225) sortlist ::= sortlist COMMA item sortorder */ + 286, /* (226) sortlist ::= sortlist COMMA arrow sortorder */ + 286, /* (227) sortlist ::= item sortorder */ + 286, /* (228) sortlist ::= arrow sortorder */ + 287, /* (229) item ::= ID */ + 287, /* (230) item ::= ID DOT ID */ + 288, /* (231) sortorder ::= ASC */ + 288, /* (232) sortorder ::= DESC */ + 288, /* (233) sortorder ::= */ + 271, /* (234) groupby_opt ::= */ + 271, /* (235) groupby_opt ::= GROUP BY grouplist */ + 290, /* (236) grouplist ::= grouplist COMMA item */ + 290, /* (237) grouplist ::= grouplist COMMA arrow */ + 290, /* (238) grouplist ::= item */ + 290, /* (239) grouplist ::= arrow */ + 272, /* (240) having_opt ::= */ + 272, /* (241) having_opt ::= HAVING expr */ + 275, /* (242) limit_opt ::= */ + 275, /* (243) limit_opt ::= LIMIT signed */ + 275, /* (244) limit_opt ::= LIMIT signed OFFSET signed */ + 275, /* (245) limit_opt ::= LIMIT signed COMMA signed */ + 274, /* (246) slimit_opt ::= */ + 274, /* (247) slimit_opt ::= SLIMIT signed */ + 274, /* (248) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 274, /* (249) slimit_opt ::= SLIMIT signed COMMA signed */ + 264, /* (250) where_opt ::= */ + 264, /* (251) where_opt ::= WHERE expr */ + 279, /* (252) expr ::= LP expr RP */ + 279, /* (253) expr ::= ID */ + 279, /* (254) expr ::= ID DOT ID */ + 279, /* (255) expr ::= ID DOT STAR */ + 279, /* (256) expr ::= INTEGER */ + 279, /* (257) expr ::= MINUS INTEGER */ + 279, /* (258) expr ::= PLUS INTEGER */ + 279, /* (259) expr ::= FLOAT */ + 279, /* (260) expr ::= MINUS FLOAT */ + 279, /* (261) expr ::= PLUS FLOAT */ + 279, /* (262) expr ::= STRING */ + 279, /* (263) expr ::= NOW */ + 279, /* (264) expr ::= TODAY */ + 279, /* (265) expr ::= VARIABLE */ + 279, /* (266) expr ::= PLUS VARIABLE */ + 279, /* (267) expr ::= MINUS VARIABLE */ + 279, /* (268) expr ::= BOOL */ + 279, /* (269) expr ::= NULL */ + 279, /* (270) expr ::= ID LP exprlist RP */ + 279, /* (271) expr ::= ID LP STAR RP */ + 279, /* (272) expr ::= ID LP expr AS typename RP */ + 279, /* (273) expr ::= expr IS NULL */ + 279, /* (274) expr ::= expr IS NOT NULL */ + 279, /* (275) expr ::= expr LT expr */ + 279, /* (276) expr ::= expr GT expr */ + 279, /* (277) expr ::= expr LE expr */ + 279, /* (278) expr ::= expr GE expr */ + 279, /* (279) expr ::= expr NE expr */ + 279, /* (280) expr ::= expr EQ expr */ + 279, /* (281) expr ::= expr BETWEEN expr AND expr */ + 279, /* (282) expr ::= expr AND expr */ + 279, /* (283) expr ::= expr OR expr */ + 279, /* (284) expr ::= expr PLUS expr */ + 279, /* (285) expr ::= expr MINUS expr */ + 279, /* (286) expr ::= expr STAR expr */ + 279, /* (287) expr ::= expr SLASH expr */ + 279, /* (288) expr ::= expr REM expr */ + 279, /* (289) expr ::= expr BITAND expr */ + 279, /* (290) expr ::= expr BITOR expr */ + 279, /* (291) expr ::= expr BITXOR expr */ + 279, /* (292) expr ::= BITNOT expr */ + 279, /* (293) expr ::= expr LSHIFT expr */ + 279, /* (294) expr ::= expr RSHIFT expr */ + 279, /* (295) expr ::= expr LIKE expr */ + 279, /* (296) expr ::= expr MATCH expr */ + 279, /* (297) expr ::= expr NMATCH expr */ + 279, /* (298) expr ::= ID CONTAINS STRING */ + 279, /* (299) expr ::= ID DOT ID CONTAINS STRING */ + 289, /* (300) arrow ::= ID ARROW STRING */ + 289, /* (301) arrow ::= ID DOT ID ARROW STRING */ + 279, /* (302) expr ::= arrow */ + 279, /* (303) expr ::= expr IN LP exprlist RP */ + 215, /* (304) exprlist ::= exprlist COMMA expritem */ + 215, /* (305) exprlist ::= expritem */ + 291, /* (306) expritem ::= expr */ + 291, /* (307) expritem ::= */ + 207, /* (308) cmd ::= RESET QUERY CACHE */ + 207, /* (309) cmd ::= SYNCDB ids REPLICA */ + 207, /* (310) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 207, /* (311) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 207, /* (312) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 207, /* (313) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 207, /* (314) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 207, /* (315) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 207, /* (316) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 207, /* (317) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 207, /* (318) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 207, /* (319) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 207, /* (320) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 207, /* (321) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 207, /* (322) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 207, /* (323) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 207, /* (324) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 207, /* (325) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 207, /* (326) cmd ::= KILL CONNECTION INTEGER */ + 207, /* (327) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 207, /* (328) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 207, /* (329) cmd ::= DELETE FROM ifexists ids cpxName where_opt */ +}; + +/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +** of symbols on the right-hand side of that rule. */ +static const signed char yyRuleInfoNRhs[] = { + -1, /* (0) program ::= cmd */ + -2, /* (1) cmd ::= SHOW DATABASES */ + -2, /* (2) cmd ::= SHOW TOPICS */ + -2, /* (3) cmd ::= SHOW FUNCTIONS */ + -2, /* (4) cmd ::= SHOW MNODES */ + -2, /* (5) cmd ::= SHOW DNODES */ + -2, /* (6) cmd ::= SHOW ACCOUNTS */ + -2, /* (7) cmd ::= SHOW USERS */ + -2, /* (8) cmd ::= SHOW MODULES */ + -2, /* (9) cmd ::= SHOW QUERIES */ + -2, /* (10) cmd ::= SHOW CONNECTIONS */ + -2, /* (11) cmd ::= SHOW STREAMS */ + -2, /* (12) cmd ::= SHOW VARIABLES */ + -2, /* (13) cmd ::= SHOW SCORES */ + -2, /* (14) cmd ::= SHOW GRANTS */ + -2, /* (15) cmd ::= SHOW VNODES */ + -3, /* (16) cmd ::= SHOW VNODES ids */ + 0, /* (17) dbPrefix ::= */ + -2, /* (18) dbPrefix ::= ids DOT */ + 0, /* (19) cpxName ::= */ + -2, /* (20) cpxName ::= DOT ids */ + -5, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + -5, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + -4, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + -3, /* (24) cmd ::= SHOW dbPrefix TABLES */ + -5, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE STRING */ + -3, /* (26) cmd ::= SHOW dbPrefix STABLES */ + -5, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE STRING */ + -3, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + -5, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + -5, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + -4, /* (31) cmd ::= DROP DATABASE ifexists ids */ + -4, /* (32) cmd ::= DROP TOPIC ifexists ids */ + -3, /* (33) cmd ::= DROP FUNCTION ids */ + -3, /* (34) cmd ::= DROP DNODE ids */ + -3, /* (35) cmd ::= DROP USER ids */ + -3, /* (36) cmd ::= DROP ACCOUNT ids */ + -2, /* (37) cmd ::= USE ids */ + -3, /* (38) cmd ::= DESCRIBE ids cpxName */ + -3, /* (39) cmd ::= DESC ids cpxName */ + -5, /* (40) cmd ::= ALTER USER ids PASS ids */ + -5, /* (41) cmd ::= ALTER USER ids PRIVILEGE ids */ + -5, /* (42) cmd ::= ALTER USER ids TAGS ids */ + -4, /* (43) cmd ::= ALTER DNODE ids ids */ + -5, /* (44) cmd ::= ALTER DNODE ids ids ids */ + -3, /* (45) cmd ::= ALTER LOCAL ids */ + -4, /* (46) cmd ::= ALTER LOCAL ids ids */ + -4, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ + -4, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ + -4, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ + -6, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + -6, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ + -1, /* (52) ids ::= ID */ + -1, /* (53) ids ::= STRING */ + -2, /* (54) ifexists ::= IF EXISTS */ + 0, /* (55) ifexists ::= */ + -3, /* (56) ifnotexists ::= IF NOT EXISTS */ + 0, /* (57) ifnotexists ::= */ + -3, /* (58) cmd ::= CREATE DNODE ids */ + -6, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + -5, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + -5, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + -8, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + -9, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + -5, /* (64) cmd ::= CREATE USER ids PASS ids */ + -7, /* (65) cmd ::= CREATE USER ids PASS ids TAGS ids */ + 0, /* (66) bufsize ::= */ + -2, /* (67) bufsize ::= BUFSIZE INTEGER */ + 0, /* (68) pps ::= */ + -2, /* (69) pps ::= PPS INTEGER */ + 0, /* (70) tseries ::= */ + -2, /* (71) tseries ::= TSERIES INTEGER */ + 0, /* (72) dbs ::= */ + -2, /* (73) dbs ::= DBS INTEGER */ + 0, /* (74) streams ::= */ + -2, /* (75) streams ::= STREAMS INTEGER */ + 0, /* (76) storage ::= */ + -2, /* (77) storage ::= STORAGE INTEGER */ + 0, /* (78) qtime ::= */ + -2, /* (79) qtime ::= QTIME INTEGER */ + 0, /* (80) users ::= */ + -2, /* (81) users ::= USERS INTEGER */ + 0, /* (82) conns ::= */ + -2, /* (83) conns ::= CONNS INTEGER */ + 0, /* (84) state ::= */ + -2, /* (85) state ::= STATE ids */ + -9, /* (86) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + -3, /* (87) intitemlist ::= intitemlist COMMA intitem */ + -1, /* (88) intitemlist ::= intitem */ + -1, /* (89) intitem ::= INTEGER */ + -2, /* (90) keep ::= KEEP intitemlist */ + -2, /* (91) cache ::= CACHE INTEGER */ + -2, /* (92) replica ::= REPLICA INTEGER */ + -2, /* (93) quorum ::= QUORUM INTEGER */ + -2, /* (94) days ::= DAYS INTEGER */ + -2, /* (95) minrows ::= MINROWS INTEGER */ + -2, /* (96) maxrows ::= MAXROWS INTEGER */ + -2, /* (97) blocks ::= BLOCKS INTEGER */ + -2, /* (98) ctime ::= CTIME INTEGER */ + -2, /* (99) wal ::= WAL INTEGER */ + -2, /* (100) fsync ::= FSYNC INTEGER */ + -2, /* (101) comp ::= COMP INTEGER */ + -2, /* (102) prec ::= PRECISION STRING */ + -2, /* (103) update ::= UPDATE INTEGER */ + -2, /* (104) cachelast ::= CACHELAST INTEGER */ + -2, /* (105) partitions ::= PARTITIONS INTEGER */ + 0, /* (106) db_optr ::= */ + -2, /* (107) db_optr ::= db_optr cache */ + -2, /* (108) db_optr ::= db_optr replica */ + -2, /* (109) db_optr ::= db_optr quorum */ + -2, /* (110) db_optr ::= db_optr days */ + -2, /* (111) db_optr ::= db_optr minrows */ + -2, /* (112) db_optr ::= db_optr maxrows */ + -2, /* (113) db_optr ::= db_optr blocks */ + -2, /* (114) db_optr ::= db_optr ctime */ + -2, /* (115) db_optr ::= db_optr wal */ + -2, /* (116) db_optr ::= db_optr fsync */ + -2, /* (117) db_optr ::= db_optr comp */ + -2, /* (118) db_optr ::= db_optr prec */ + -2, /* (119) db_optr ::= db_optr keep */ + -2, /* (120) db_optr ::= db_optr update */ + -2, /* (121) db_optr ::= db_optr cachelast */ + -1, /* (122) topic_optr ::= db_optr */ + -2, /* (123) topic_optr ::= topic_optr partitions */ + 0, /* (124) alter_db_optr ::= */ + -2, /* (125) alter_db_optr ::= alter_db_optr replica */ + -2, /* (126) alter_db_optr ::= alter_db_optr quorum */ + -2, /* (127) alter_db_optr ::= alter_db_optr keep */ + -2, /* (128) alter_db_optr ::= alter_db_optr blocks */ + -2, /* (129) alter_db_optr ::= alter_db_optr comp */ + -2, /* (130) alter_db_optr ::= alter_db_optr update */ + -2, /* (131) alter_db_optr ::= alter_db_optr cachelast */ + -2, /* (132) alter_db_optr ::= alter_db_optr minrows */ + -1, /* (133) alter_topic_optr ::= alter_db_optr */ + -2, /* (134) alter_topic_optr ::= alter_topic_optr partitions */ + -1, /* (135) typename ::= ids */ + -4, /* (136) typename ::= ids LP signed RP */ + -2, /* (137) typename ::= ids UNSIGNED */ + -1, /* (138) signed ::= INTEGER */ + -2, /* (139) signed ::= PLUS INTEGER */ + -2, /* (140) signed ::= MINUS INTEGER */ + -3, /* (141) cmd ::= CREATE TABLE create_table_args */ + -3, /* (142) cmd ::= CREATE TABLE create_stable_args */ + -3, /* (143) cmd ::= CREATE STABLE create_stable_args */ + -3, /* (144) cmd ::= CREATE TABLE create_table_list */ + -1, /* (145) create_table_list ::= create_from_stable */ + -2, /* (146) create_table_list ::= create_table_list create_from_stable */ + -6, /* (147) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + -10, /* (148) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + -10, /* (149) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + -13, /* (150) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + -3, /* (151) tagNamelist ::= tagNamelist COMMA ids */ + -1, /* (152) tagNamelist ::= ids */ + -7, /* (153) create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select */ + 0, /* (154) to_opt ::= */ + -3, /* (155) to_opt ::= TO ids cpxName */ + 0, /* (156) split_opt ::= */ + -2, /* (157) split_opt ::= SPLIT ids */ + -3, /* (158) columnlist ::= columnlist COMMA column */ + -1, /* (159) columnlist ::= column */ + -2, /* (160) column ::= ids typename */ + -3, /* (161) tagitemlist ::= tagitemlist COMMA tagitem */ + -1, /* (162) tagitemlist ::= tagitem */ + -1, /* (163) tagitem ::= INTEGER */ + -1, /* (164) tagitem ::= FLOAT */ + -1, /* (165) tagitem ::= STRING */ + -1, /* (166) tagitem ::= BOOL */ + -1, /* (167) tagitem ::= NULL */ + -1, /* (168) tagitem ::= NOW */ + -3, /* (169) tagitem ::= NOW PLUS VARIABLE */ + -3, /* (170) tagitem ::= NOW MINUS VARIABLE */ + -2, /* (171) tagitem ::= MINUS INTEGER */ + -2, /* (172) tagitem ::= MINUS FLOAT */ + -2, /* (173) tagitem ::= PLUS INTEGER */ + -2, /* (174) tagitem ::= PLUS FLOAT */ + -15, /* (175) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + -3, /* (176) select ::= LP select RP */ + -1, /* (177) union ::= select */ + -4, /* (178) union ::= union UNION ALL select */ + -1, /* (179) cmd ::= union */ + -2, /* (180) select ::= SELECT selcollist */ + -2, /* (181) sclp ::= selcollist COMMA */ + 0, /* (182) sclp ::= */ + -4, /* (183) selcollist ::= sclp distinct expr as */ + -2, /* (184) selcollist ::= sclp STAR */ + -2, /* (185) as ::= AS ids */ + -1, /* (186) as ::= ids */ + 0, /* (187) as ::= */ + -1, /* (188) distinct ::= DISTINCT */ + 0, /* (189) distinct ::= */ + -2, /* (190) from ::= FROM tablelist */ + -2, /* (191) from ::= FROM sub */ + -3, /* (192) sub ::= LP union RP */ + -4, /* (193) sub ::= LP union RP ids */ + -6, /* (194) sub ::= sub COMMA LP union RP ids */ + -2, /* (195) tablelist ::= ids cpxName */ + -3, /* (196) tablelist ::= ids cpxName ids */ + -4, /* (197) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (198) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (199) tmvar ::= VARIABLE */ + -1, /* (200) timestamp ::= INTEGER */ + -2, /* (201) timestamp ::= MINUS INTEGER */ + -2, /* (202) timestamp ::= PLUS INTEGER */ + -1, /* (203) timestamp ::= STRING */ + -1, /* (204) timestamp ::= NOW */ + -3, /* (205) timestamp ::= NOW PLUS VARIABLE */ + -3, /* (206) timestamp ::= NOW MINUS VARIABLE */ + 0, /* (207) range_option ::= */ + -6, /* (208) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + -4, /* (209) interval_option ::= intervalKey LP tmvar RP */ + -6, /* (210) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 0, /* (211) interval_option ::= */ + -1, /* (212) intervalKey ::= INTERVAL */ + -1, /* (213) intervalKey ::= EVERY */ + 0, /* (214) session_option ::= */ + -7, /* (215) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (216) windowstate_option ::= */ + -4, /* (217) windowstate_option ::= STATE_WINDOW LP ids RP */ + 0, /* (218) fill_opt ::= */ + -6, /* (219) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (220) fill_opt ::= FILL LP ID RP */ + -4, /* (221) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (222) sliding_opt ::= */ + 0, /* (223) orderby_opt ::= */ + -3, /* (224) orderby_opt ::= ORDER BY sortlist */ + -4, /* (225) sortlist ::= sortlist COMMA item sortorder */ + -4, /* (226) sortlist ::= sortlist COMMA arrow sortorder */ + -2, /* (227) sortlist ::= item sortorder */ + -2, /* (228) sortlist ::= arrow sortorder */ + -1, /* (229) item ::= ID */ + -3, /* (230) item ::= ID DOT ID */ + -1, /* (231) sortorder ::= ASC */ + -1, /* (232) sortorder ::= DESC */ + 0, /* (233) sortorder ::= */ + 0, /* (234) groupby_opt ::= */ + -3, /* (235) groupby_opt ::= GROUP BY grouplist */ + -3, /* (236) grouplist ::= grouplist COMMA item */ + -3, /* (237) grouplist ::= grouplist COMMA arrow */ + -1, /* (238) grouplist ::= item */ + -1, /* (239) grouplist ::= arrow */ + 0, /* (240) having_opt ::= */ + -2, /* (241) having_opt ::= HAVING expr */ + 0, /* (242) limit_opt ::= */ + -2, /* (243) limit_opt ::= LIMIT signed */ + -4, /* (244) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (245) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (246) slimit_opt ::= */ + -2, /* (247) slimit_opt ::= SLIMIT signed */ + -4, /* (248) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (249) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (250) where_opt ::= */ + -2, /* (251) where_opt ::= WHERE expr */ + -3, /* (252) expr ::= LP expr RP */ + -1, /* (253) expr ::= ID */ + -3, /* (254) expr ::= ID DOT ID */ + -3, /* (255) expr ::= ID DOT STAR */ + -1, /* (256) expr ::= INTEGER */ + -2, /* (257) expr ::= MINUS INTEGER */ + -2, /* (258) expr ::= PLUS INTEGER */ + -1, /* (259) expr ::= FLOAT */ + -2, /* (260) expr ::= MINUS FLOAT */ + -2, /* (261) expr ::= PLUS FLOAT */ + -1, /* (262) expr ::= STRING */ + -1, /* (263) expr ::= NOW */ + -1, /* (264) expr ::= TODAY */ + -1, /* (265) expr ::= VARIABLE */ + -2, /* (266) expr ::= PLUS VARIABLE */ + -2, /* (267) expr ::= MINUS VARIABLE */ + -1, /* (268) expr ::= BOOL */ + -1, /* (269) expr ::= NULL */ + -4, /* (270) expr ::= ID LP exprlist RP */ + -4, /* (271) expr ::= ID LP STAR RP */ + -6, /* (272) expr ::= ID LP expr AS typename RP */ + -3, /* (273) expr ::= expr IS NULL */ + -4, /* (274) expr ::= expr IS NOT NULL */ + -3, /* (275) expr ::= expr LT expr */ + -3, /* (276) expr ::= expr GT expr */ + -3, /* (277) expr ::= expr LE expr */ + -3, /* (278) expr ::= expr GE expr */ + -3, /* (279) expr ::= expr NE expr */ + -3, /* (280) expr ::= expr EQ expr */ + -5, /* (281) expr ::= expr BETWEEN expr AND expr */ + -3, /* (282) expr ::= expr AND expr */ + -3, /* (283) expr ::= expr OR expr */ + -3, /* (284) expr ::= expr PLUS expr */ + -3, /* (285) expr ::= expr MINUS expr */ + -3, /* (286) expr ::= expr STAR expr */ + -3, /* (287) expr ::= expr SLASH expr */ + -3, /* (288) expr ::= expr REM expr */ + -3, /* (289) expr ::= expr BITAND expr */ + -3, /* (290) expr ::= expr BITOR expr */ + -3, /* (291) expr ::= expr BITXOR expr */ + -2, /* (292) expr ::= BITNOT expr */ + -3, /* (293) expr ::= expr LSHIFT expr */ + -3, /* (294) expr ::= expr RSHIFT expr */ + -3, /* (295) expr ::= expr LIKE expr */ + -3, /* (296) expr ::= expr MATCH expr */ + -3, /* (297) expr ::= expr NMATCH expr */ + -3, /* (298) expr ::= ID CONTAINS STRING */ + -5, /* (299) expr ::= ID DOT ID CONTAINS STRING */ + -3, /* (300) arrow ::= ID ARROW STRING */ + -5, /* (301) arrow ::= ID DOT ID ARROW STRING */ + -1, /* (302) expr ::= arrow */ + -5, /* (303) expr ::= expr IN LP exprlist RP */ + -3, /* (304) exprlist ::= exprlist COMMA expritem */ + -1, /* (305) exprlist ::= expritem */ + -1, /* (306) expritem ::= expr */ + 0, /* (307) expritem ::= */ + -3, /* (308) cmd ::= RESET QUERY CACHE */ + -3, /* (309) cmd ::= SYNCDB ids REPLICA */ + -7, /* (310) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (311) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (312) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (313) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (314) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (315) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (316) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (317) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (318) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (319) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (320) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (321) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (322) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (323) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (324) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (325) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (326) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (327) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (328) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -6, /* (329) cmd ::= DELETE FROM ifexists ids cpxName where_opt */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2283,30 +2633,34 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static void yy_reduce( +static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - int yyact; /* The next action */ + YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; + ParseARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfo[yyruleno].nrhs; + yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno); + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2324,13 +2678,19 @@ static void yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } yymsp = yypParser->yytos; } @@ -2349,9 +2709,9 @@ static void yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* program ::= cmd */ - case 140: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==140); - case 141: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==141); - case 142: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==142); + case 141: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==141); + case 142: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==142); + case 143: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==143); {} break; case 1: /* cmd ::= SHOW DATABASES */ @@ -2524,16 +2884,16 @@ static void yy_reduce( break; case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 48: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==48); -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy564, &t);} +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy342, &t);} break; case 49: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy563);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy299);} break; case 50: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy563);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy299);} break; case 51: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ -{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy367);} +{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy333);} break; case 52: /* ids ::= ID */ case 53: /* ids ::= STRING */ yytestcase(yyruleno==53); @@ -2545,7 +2905,7 @@ static void yy_reduce( break; case 55: /* ifexists ::= */ case 57: /* ifnotexists ::= */ yytestcase(yyruleno==57); - case 188: /* distinct ::= */ yytestcase(yyruleno==188); + case 189: /* distinct ::= */ yytestcase(yyruleno==189); { yymsp[1].minor.yy0.n = 0;} break; case 56: /* ifnotexists ::= IF NOT EXISTS */ @@ -2555,17 +2915,17 @@ static void yy_reduce( { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 59: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy563);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy299);} break; case 60: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 61: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==61); -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy564, &yymsp[-2].minor.yy0);} +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy342, &yymsp[-2].minor.yy0);} break; case 62: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy307, &yymsp[0].minor.yy0, 1);} +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy263, &yymsp[0].minor.yy0, 1);} break; case 63: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy307, &yymsp[0].minor.yy0, 2);} +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy263, &yymsp[0].minor.yy0, 2);} break; case 64: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL);} @@ -2599,38 +2959,38 @@ static void yy_reduce( break; case 86: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy563.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy563.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy563.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy563.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy563.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy563.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy563.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy563.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy563.stat = yymsp[0].minor.yy0; + yylhsminor.yy299.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy299.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy299.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy299.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy299.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy299.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy299.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy299.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy299.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy563 = yylhsminor.yy563; + yymsp[-8].minor.yy299 = yylhsminor.yy299; break; case 87: /* intitemlist ::= intitemlist COMMA intitem */ - case 160: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==160); -{ yylhsminor.yy367 = tVariantListAppend(yymsp[-2].minor.yy367, &yymsp[0].minor.yy410, -1); } - yymsp[-2].minor.yy367 = yylhsminor.yy367; + case 161: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==161); +{ yylhsminor.yy333 = tVariantListAppend(yymsp[-2].minor.yy333, &yymsp[0].minor.yy42, -1); } + yymsp[-2].minor.yy333 = yylhsminor.yy333; break; case 88: /* intitemlist ::= intitem */ - case 161: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==161); -{ yylhsminor.yy367 = tVariantListAppend(NULL, &yymsp[0].minor.yy410, -1); } - yymsp[0].minor.yy367 = yylhsminor.yy367; + case 162: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==162); +{ yylhsminor.yy333 = tVariantListAppend(NULL, &yymsp[0].minor.yy42, -1); } + yymsp[0].minor.yy333 = yylhsminor.yy333; break; case 89: /* intitem ::= INTEGER */ - case 162: /* tagitem ::= INTEGER */ yytestcase(yyruleno==162); - case 163: /* tagitem ::= FLOAT */ yytestcase(yyruleno==163); - case 164: /* tagitem ::= STRING */ yytestcase(yyruleno==164); - case 165: /* tagitem ::= BOOL */ yytestcase(yyruleno==165); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy410, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy410 = yylhsminor.yy410; + case 163: /* tagitem ::= INTEGER */ yytestcase(yyruleno==163); + case 164: /* tagitem ::= FLOAT */ yytestcase(yyruleno==164); + case 165: /* tagitem ::= STRING */ yytestcase(yyruleno==165); + case 166: /* tagitem ::= BOOL */ yytestcase(yyruleno==166); +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy42, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; case 90: /* keep ::= KEEP intitemlist */ -{ yymsp[-1].minor.yy367 = yymsp[0].minor.yy367; } +{ yymsp[-1].minor.yy333 = yymsp[0].minor.yy333; } break; case 91: /* cache ::= CACHE INTEGER */ case 92: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==92); @@ -2650,785 +3010,789 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 106: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy564); yymsp[1].minor.yy564.dbType = TSDB_DB_TYPE_DEFAULT;} +{setDefaultCreateDbOption(&yymsp[1].minor.yy342); yymsp[1].minor.yy342.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 107: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 108: /* db_optr ::= db_optr replica */ case 125: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==125); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 109: /* db_optr ::= db_optr quorum */ case 126: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==126); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 110: /* db_optr ::= db_optr days */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 111: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 112: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 113: /* db_optr ::= db_optr blocks */ case 128: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==128); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 114: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 115: /* db_optr ::= db_optr wal */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 116: /* db_optr ::= db_optr fsync */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 117: /* db_optr ::= db_optr comp */ case 129: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==129); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 118: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 119: /* db_optr ::= db_optr keep */ case 127: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==127); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.keep = yymsp[0].minor.yy367; } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.keep = yymsp[0].minor.yy333; } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 120: /* db_optr ::= db_optr update */ case 130: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==130); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 121: /* db_optr ::= db_optr cachelast */ case 131: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==131); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 122: /* topic_optr ::= db_optr */ - case 132: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==132); -{ yylhsminor.yy564 = yymsp[0].minor.yy564; yylhsminor.yy564.dbType = TSDB_DB_TYPE_TOPIC; } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 133: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==133); +{ yylhsminor.yy342 = yymsp[0].minor.yy342; yylhsminor.yy342.dbType = TSDB_DB_TYPE_TOPIC; } + yymsp[0].minor.yy342 = yylhsminor.yy342; break; case 123: /* topic_optr ::= topic_optr partitions */ - case 133: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==133); -{ yylhsminor.yy564 = yymsp[-1].minor.yy564; yylhsminor.yy564.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + case 134: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==134); +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; break; case 124: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy564); yymsp[1].minor.yy564.dbType = TSDB_DB_TYPE_DEFAULT;} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy342); yymsp[1].minor.yy342.dbType = TSDB_DB_TYPE_DEFAULT;} break; - case 134: /* typename ::= ids */ + case 132: /* alter_db_optr ::= alter_db_optr minrows */ +{ yylhsminor.yy342 = yymsp[-1].minor.yy342; yylhsminor.yy342.minRowsPerBlock = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy342 = yylhsminor.yy342; + break; + case 135: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy307, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy263, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy307 = yylhsminor.yy307; + yymsp[0].minor.yy263 = yylhsminor.yy263; break; - case 135: /* typename ::= ids LP signed RP */ + case 136: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy443 <= 0) { + if (yymsp[-1].minor.yy277 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSetColumnType(&yylhsminor.yy307, &yymsp[-3].minor.yy0); + tSetColumnType(&yylhsminor.yy263, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy443; // negative value of name length - tSetColumnType(&yylhsminor.yy307, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy277; // negative value of name length + tSetColumnType(&yylhsminor.yy263, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy307 = yylhsminor.yy307; + yymsp[-3].minor.yy263 = yylhsminor.yy263; break; - case 136: /* typename ::= ids UNSIGNED */ + case 137: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSetColumnType (&yylhsminor.yy307, &yymsp[-1].minor.yy0); + tSetColumnType (&yylhsminor.yy263, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy307 = yylhsminor.yy307; + yymsp[-1].minor.yy263 = yylhsminor.yy263; break; - case 137: /* signed ::= INTEGER */ -{ yylhsminor.yy443 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy443 = yylhsminor.yy443; + case 138: /* signed ::= INTEGER */ +{ yylhsminor.yy277 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy277 = yylhsminor.yy277; break; - case 138: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy443 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 139: /* signed ::= PLUS INTEGER */ +{ yymsp[-1].minor.yy277 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 139: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy443 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} + case 140: /* signed ::= MINUS INTEGER */ +{ yymsp[-1].minor.yy277 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; - case 143: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy74;} + case 144: /* cmd ::= CREATE TABLE create_table_list */ +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy78;} break; - case 144: /* create_table_list ::= create_from_stable */ + case 145: /* create_table_list ::= create_from_stable */ { SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy110); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy400); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy74 = pCreateTable; + yylhsminor.yy78 = pCreateTable; } - yymsp[0].minor.yy74 = yylhsminor.yy74; + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 145: /* create_table_list ::= create_table_list create_from_stable */ + case 146: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy74->childTableInfo, &yymsp[0].minor.yy110); - yylhsminor.yy74 = yymsp[-1].minor.yy74; + taosArrayPush(yymsp[-1].minor.yy78->childTableInfo, &yymsp[0].minor.yy400); + yylhsminor.yy78 = yymsp[-1].minor.yy78; } - yymsp[-1].minor.yy74 = yylhsminor.yy74; + yymsp[-1].minor.yy78 = yylhsminor.yy78; break; - case 146: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + case 147: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy74 = tSetCreateTableInfo(yymsp[-1].minor.yy367, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy74, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy78 = tSetCreateTableInfo(yymsp[-1].minor.yy333, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy78, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy74 = yylhsminor.yy74; + yymsp[-5].minor.yy78 = yylhsminor.yy78; break; - case 147: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + case 148: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy74 = tSetCreateTableInfo(yymsp[-5].minor.yy367, yymsp[-1].minor.yy367, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy74, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy78 = tSetCreateTableInfo(yymsp[-5].minor.yy333, yymsp[-1].minor.yy333, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy78, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy74 = yylhsminor.yy74; + yymsp[-9].minor.yy78 = yylhsminor.yy78; break; - case 148: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + case 149: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy110 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy367, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy400 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy333, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy110 = yylhsminor.yy110; + yymsp[-9].minor.yy400 = yylhsminor.yy400; break; - case 149: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + case 150: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ { yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; - yylhsminor.yy110 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy367, yymsp[-1].minor.yy367, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); + yylhsminor.yy400 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy333, yymsp[-1].minor.yy333, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); } - yymsp[-12].minor.yy110 = yylhsminor.yy110; + yymsp[-12].minor.yy400 = yylhsminor.yy400; break; - case 150: /* tagNamelist ::= tagNamelist COMMA ids */ -{taosArrayPush(yymsp[-2].minor.yy367, &yymsp[0].minor.yy0); yylhsminor.yy367 = yymsp[-2].minor.yy367; } - yymsp[-2].minor.yy367 = yylhsminor.yy367; + case 151: /* tagNamelist ::= tagNamelist COMMA ids */ +{taosArrayPush(yymsp[-2].minor.yy333, &yymsp[0].minor.yy0); yylhsminor.yy333 = yymsp[-2].minor.yy333; } + yymsp[-2].minor.yy333 = yylhsminor.yy333; break; - case 151: /* tagNamelist ::= ids */ -{yylhsminor.yy367 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy367, &yymsp[0].minor.yy0);} - yymsp[0].minor.yy367 = yylhsminor.yy367; + case 152: /* tagNamelist ::= ids */ +{yylhsminor.yy333 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy333, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy333 = yylhsminor.yy333; break; - case 152: /* create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select */ + case 153: /* create_table_args ::= ifnotexists ids cpxName to_opt split_opt AS select */ { - yylhsminor.yy74 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy426, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy74, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy78 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy144, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy78, NULL, TSDB_SQL_CREATE_TABLE); setCreatedStreamOpt(pInfo, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0); yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-5].minor.yy0, &yymsp[-6].minor.yy0); } - yymsp[-6].minor.yy74 = yylhsminor.yy74; + yymsp[-6].minor.yy78 = yylhsminor.yy78; break; - case 153: /* to_opt ::= */ - case 155: /* split_opt ::= */ yytestcase(yyruleno==155); + case 154: /* to_opt ::= */ + case 156: /* split_opt ::= */ yytestcase(yyruleno==156); {yymsp[1].minor.yy0.n = 0;} break; - case 154: /* to_opt ::= TO ids cpxName */ + case 155: /* to_opt ::= TO ids cpxName */ { yymsp[-2].minor.yy0 = yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.n += yymsp[0].minor.yy0.n; } break; - case 156: /* split_opt ::= SPLIT ids */ + case 157: /* split_opt ::= SPLIT ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; - case 157: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy367, &yymsp[0].minor.yy307); yylhsminor.yy367 = yymsp[-2].minor.yy367; } - yymsp[-2].minor.yy367 = yylhsminor.yy367; + case 158: /* columnlist ::= columnlist COMMA column */ +{taosArrayPush(yymsp[-2].minor.yy333, &yymsp[0].minor.yy263); yylhsminor.yy333 = yymsp[-2].minor.yy333; } + yymsp[-2].minor.yy333 = yylhsminor.yy333; break; - case 158: /* columnlist ::= column */ -{yylhsminor.yy367 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy367, &yymsp[0].minor.yy307);} - yymsp[0].minor.yy367 = yylhsminor.yy367; + case 159: /* columnlist ::= column */ +{yylhsminor.yy333 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy333, &yymsp[0].minor.yy263);} + yymsp[0].minor.yy333 = yylhsminor.yy333; break; - case 159: /* column ::= ids typename */ + case 160: /* column ::= ids typename */ { - tSetColumnInfo(&yylhsminor.yy307, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy307); + tSetColumnInfo(&yylhsminor.yy263, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy263); } - yymsp[-1].minor.yy307 = yylhsminor.yy307; + yymsp[-1].minor.yy263 = yylhsminor.yy263; break; - case 166: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy410, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy410 = yylhsminor.yy410; + case 167: /* tagitem ::= NULL */ +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy42, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 167: /* tagitem ::= NOW */ -{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreateExt(&yylhsminor.yy410, &yymsp[0].minor.yy0, TK_NOW, true);} - yymsp[0].minor.yy410 = yylhsminor.yy410; + case 168: /* tagitem ::= NOW */ +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreateExt(&yylhsminor.yy42, &yymsp[0].minor.yy0, TK_NOW, true);} + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 168: /* tagitem ::= NOW PLUS VARIABLE */ + case 169: /* tagitem ::= NOW PLUS VARIABLE */ { yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; - tVariantCreateExt(&yymsp[-2].minor.yy410, &yymsp[0].minor.yy0, TK_PLUS, true); + tVariantCreateExt(&yymsp[-2].minor.yy42, &yymsp[0].minor.yy0, TK_PLUS, true); } break; - case 169: /* tagitem ::= NOW MINUS VARIABLE */ + case 170: /* tagitem ::= NOW MINUS VARIABLE */ { yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; - tVariantCreateExt(&yymsp[-2].minor.yy410, &yymsp[0].minor.yy0, TK_MINUS, true); + tVariantCreateExt(&yymsp[-2].minor.yy42, &yymsp[0].minor.yy0, TK_MINUS, true); } break; - case 170: /* tagitem ::= MINUS INTEGER */ - case 171: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==171); - case 172: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==172); - case 173: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==173); + case 171: /* tagitem ::= MINUS INTEGER */ + case 172: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==172); + case 173: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==173); + case 174: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==174); { 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.yy410, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy42, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy410 = yylhsminor.yy410; + yymsp[-1].minor.yy42 = yylhsminor.yy42; break; - case 174: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + case 175: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { - yylhsminor.yy426 = tSetQuerySqlNode(&yymsp[-14].minor.yy0, yymsp[-13].minor.yy367, yymsp[-12].minor.yy480, yymsp[-11].minor.yy378, yymsp[-4].minor.yy367, yymsp[-2].minor.yy367, &yymsp[-9].minor.yy478, &yymsp[-7].minor.yy373, &yymsp[-6].minor.yy204, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy367, &yymsp[0].minor.yy24, &yymsp[-1].minor.yy24, yymsp[-3].minor.yy378, &yymsp[-10].minor.yy214); + yylhsminor.yy144 = tSetQuerySqlNode(&yymsp[-14].minor.yy0, yymsp[-13].minor.yy333, yymsp[-12].minor.yy516, yymsp[-11].minor.yy194, yymsp[-4].minor.yy333, yymsp[-2].minor.yy333, &yymsp[-9].minor.yy200, &yymsp[-7].minor.yy235, &yymsp[-6].minor.yy248, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy333, &yymsp[0].minor.yy190, &yymsp[-1].minor.yy190, yymsp[-3].minor.yy194, &yymsp[-10].minor.yy132); } - yymsp[-14].minor.yy426 = yylhsminor.yy426; + yymsp[-14].minor.yy144 = yylhsminor.yy144; break; - case 175: /* select ::= LP select RP */ -{yymsp[-2].minor.yy426 = yymsp[-1].minor.yy426;} + case 176: /* select ::= LP select RP */ +{yymsp[-2].minor.yy144 = yymsp[-1].minor.yy144;} break; - case 176: /* union ::= select */ -{ yylhsminor.yy367 = setSubclause(NULL, yymsp[0].minor.yy426); } - yymsp[0].minor.yy367 = yylhsminor.yy367; + case 177: /* union ::= select */ +{ yylhsminor.yy333 = setSubclause(NULL, yymsp[0].minor.yy144); } + yymsp[0].minor.yy333 = yylhsminor.yy333; break; - case 177: /* union ::= union UNION ALL select */ -{ yylhsminor.yy367 = appendSelectClause(yymsp[-3].minor.yy367, yymsp[0].minor.yy426); } - yymsp[-3].minor.yy367 = yylhsminor.yy367; + case 178: /* union ::= union UNION ALL select */ +{ yylhsminor.yy333 = appendSelectClause(yymsp[-3].minor.yy333, yymsp[0].minor.yy144); } + yymsp[-3].minor.yy333 = yylhsminor.yy333; break; - case 178: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy367, NULL, TSDB_SQL_SELECT); } + case 179: /* cmd ::= union */ +{ setSqlInfo(pInfo, yymsp[0].minor.yy333, NULL, TSDB_SQL_SELECT); } break; - case 179: /* select ::= SELECT selcollist */ + case 180: /* select ::= SELECT selcollist */ { - yylhsminor.yy426 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy367, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy144 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy333, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy426 = yylhsminor.yy426; + yymsp[-1].minor.yy144 = yylhsminor.yy144; break; - case 180: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy367 = yymsp[-1].minor.yy367;} - yymsp[-1].minor.yy367 = yylhsminor.yy367; + case 181: /* sclp ::= selcollist COMMA */ +{yylhsminor.yy333 = yymsp[-1].minor.yy333;} + yymsp[-1].minor.yy333 = yylhsminor.yy333; break; - case 181: /* sclp ::= */ - case 222: /* orderby_opt ::= */ yytestcase(yyruleno==222); -{yymsp[1].minor.yy367 = 0;} + case 182: /* sclp ::= */ + case 223: /* orderby_opt ::= */ yytestcase(yyruleno==223); +{yymsp[1].minor.yy333 = 0;} break; - case 182: /* selcollist ::= sclp distinct expr as */ + case 183: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy367 = tSqlExprListAppend(yymsp[-3].minor.yy367, yymsp[-1].minor.yy378, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy333 = tSqlExprListAppend(yymsp[-3].minor.yy333, yymsp[-1].minor.yy194, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-3].minor.yy367 = yylhsminor.yy367; + yymsp[-3].minor.yy333 = yylhsminor.yy333; break; - case 183: /* selcollist ::= sclp STAR */ + case 184: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(pInfo, NULL, TK_ALL); - yylhsminor.yy367 = tSqlExprListAppend(yymsp[-1].minor.yy367, pNode, 0, 0); + yylhsminor.yy333 = tSqlExprListAppend(yymsp[-1].minor.yy333, pNode, 0, 0); } - yymsp[-1].minor.yy367 = yylhsminor.yy367; + yymsp[-1].minor.yy333 = yylhsminor.yy333; break; - case 184: /* as ::= AS ids */ + case 185: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 185: /* as ::= ids */ + case 186: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 186: /* as ::= */ + case 187: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 187: /* distinct ::= DISTINCT */ + case 188: /* distinct ::= DISTINCT */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 189: /* from ::= FROM tablelist */ - case 190: /* from ::= FROM sub */ yytestcase(yyruleno==190); -{yymsp[-1].minor.yy480 = yymsp[0].minor.yy480;} + case 190: /* from ::= FROM tablelist */ + case 191: /* from ::= FROM sub */ yytestcase(yyruleno==191); +{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} break; - case 191: /* sub ::= LP union RP */ -{yymsp[-2].minor.yy480 = addSubqueryElem(NULL, yymsp[-1].minor.yy367, NULL);} + case 192: /* sub ::= LP union RP */ +{yymsp[-2].minor.yy516 = addSubqueryElem(NULL, yymsp[-1].minor.yy333, NULL);} break; - case 192: /* sub ::= LP union RP ids */ -{yymsp[-3].minor.yy480 = addSubqueryElem(NULL, yymsp[-2].minor.yy367, &yymsp[0].minor.yy0);} + case 193: /* sub ::= LP union RP ids */ +{yymsp[-3].minor.yy516 = addSubqueryElem(NULL, yymsp[-2].minor.yy333, &yymsp[0].minor.yy0);} break; - case 193: /* sub ::= sub COMMA LP union RP ids */ -{yylhsminor.yy480 = addSubqueryElem(yymsp[-5].minor.yy480, yymsp[-2].minor.yy367, &yymsp[0].minor.yy0);} - yymsp[-5].minor.yy480 = yylhsminor.yy480; + case 194: /* sub ::= sub COMMA LP union RP ids */ +{yylhsminor.yy516 = addSubqueryElem(yymsp[-5].minor.yy516, yymsp[-2].minor.yy333, &yymsp[0].minor.yy0);} + yymsp[-5].minor.yy516 = yylhsminor.yy516; break; - case 194: /* tablelist ::= ids cpxName */ + case 195: /* tablelist ::= ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy480 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy516 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } - yymsp[-1].minor.yy480 = yylhsminor.yy480; + yymsp[-1].minor.yy516 = yylhsminor.yy516; break; - case 195: /* tablelist ::= ids cpxName ids */ + case 196: /* tablelist ::= ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy480 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy516 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy480 = yylhsminor.yy480; + yymsp[-2].minor.yy516 = yylhsminor.yy516; break; - case 196: /* tablelist ::= tablelist COMMA ids cpxName */ + case 197: /* tablelist ::= tablelist COMMA ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy480 = setTableNameList(yymsp[-3].minor.yy480, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy516 = setTableNameList(yymsp[-3].minor.yy516, &yymsp[-1].minor.yy0, NULL); } - yymsp[-3].minor.yy480 = yylhsminor.yy480; + yymsp[-3].minor.yy516 = yylhsminor.yy516; break; - case 197: /* tablelist ::= tablelist COMMA ids cpxName ids */ + case 198: /* tablelist ::= tablelist COMMA ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy480 = setTableNameList(yymsp[-4].minor.yy480, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy516 = setTableNameList(yymsp[-4].minor.yy516, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-4].minor.yy480 = yylhsminor.yy480; + yymsp[-4].minor.yy516 = yylhsminor.yy516; break; - case 198: /* tmvar ::= VARIABLE */ + case 199: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 199: /* timestamp ::= INTEGER */ -{ yylhsminor.yy378 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 200: /* timestamp ::= INTEGER */ +{ yylhsminor.yy194 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 200: /* timestamp ::= MINUS INTEGER */ - case 201: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==201); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy378 = tSqlExprCreateTimestamp(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy378 = yylhsminor.yy378; + case 201: /* timestamp ::= MINUS INTEGER */ + case 202: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==202); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy194 = tSqlExprCreateTimestamp(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; - case 202: /* timestamp ::= STRING */ -{ yylhsminor.yy378 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 203: /* timestamp ::= STRING */ +{ yylhsminor.yy194 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 203: /* timestamp ::= NOW */ -{ yylhsminor.yy378 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 204: /* timestamp ::= NOW */ +{ yylhsminor.yy194 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 204: /* timestamp ::= NOW PLUS VARIABLE */ -{yymsp[-2].minor.yy378 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_PLUS); } + case 205: /* timestamp ::= NOW PLUS VARIABLE */ +{yymsp[-2].minor.yy194 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_PLUS); } break; - case 205: /* timestamp ::= NOW MINUS VARIABLE */ -{yymsp[-2].minor.yy378 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_MINUS); } + case 206: /* timestamp ::= NOW MINUS VARIABLE */ +{yymsp[-2].minor.yy194 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_MINUS); } break; - case 206: /* range_option ::= */ -{yymsp[1].minor.yy214.start = 0; yymsp[1].minor.yy214.end = 0;} + case 207: /* range_option ::= */ +{yymsp[1].minor.yy132.start = 0; yymsp[1].minor.yy132.end = 0;} break; - case 207: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */ -{yymsp[-5].minor.yy214.start = yymsp[-3].minor.yy378; yymsp[-5].minor.yy214.end = yymsp[-1].minor.yy378;} + case 208: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */ +{yymsp[-5].minor.yy132.start = yymsp[-3].minor.yy194; yymsp[-5].minor.yy132.end = yymsp[-1].minor.yy194;} break; - case 208: /* interval_option ::= intervalKey LP tmvar RP */ -{yylhsminor.yy478.interval = yymsp[-1].minor.yy0; yylhsminor.yy478.offset.n = 0; yylhsminor.yy478.token = yymsp[-3].minor.yy586;} - yymsp[-3].minor.yy478 = yylhsminor.yy478; + case 209: /* interval_option ::= intervalKey LP tmvar RP */ +{yylhsminor.yy200.interval = yymsp[-1].minor.yy0; yylhsminor.yy200.offset.n = 0; yylhsminor.yy200.token = yymsp[-3].minor.yy44;} + yymsp[-3].minor.yy200 = yylhsminor.yy200; break; - case 209: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ -{yylhsminor.yy478.interval = yymsp[-3].minor.yy0; yylhsminor.yy478.offset = yymsp[-1].minor.yy0; yylhsminor.yy478.token = yymsp[-5].minor.yy586;} - yymsp[-5].minor.yy478 = yylhsminor.yy478; + case 210: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ +{yylhsminor.yy200.interval = yymsp[-3].minor.yy0; yylhsminor.yy200.offset = yymsp[-1].minor.yy0; yylhsminor.yy200.token = yymsp[-5].minor.yy44;} + yymsp[-5].minor.yy200 = yylhsminor.yy200; break; - case 210: /* interval_option ::= */ -{memset(&yymsp[1].minor.yy478, 0, sizeof(yymsp[1].minor.yy478));} + case 211: /* interval_option ::= */ +{memset(&yymsp[1].minor.yy200, 0, sizeof(yymsp[1].minor.yy200));} break; - case 211: /* intervalKey ::= INTERVAL */ -{yymsp[0].minor.yy586 = TK_INTERVAL;} + case 212: /* intervalKey ::= INTERVAL */ +{yymsp[0].minor.yy44 = TK_INTERVAL;} break; - case 212: /* intervalKey ::= EVERY */ -{yymsp[0].minor.yy586 = TK_EVERY; } + case 213: /* intervalKey ::= EVERY */ +{yymsp[0].minor.yy44 = TK_EVERY; } break; - case 213: /* session_option ::= */ -{yymsp[1].minor.yy373.col.n = 0; yymsp[1].minor.yy373.gap.n = 0;} + case 214: /* session_option ::= */ +{yymsp[1].minor.yy235.col.n = 0; yymsp[1].minor.yy235.gap.n = 0;} break; - case 214: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + case 215: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - yymsp[-6].minor.yy373.col = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy373.gap = yymsp[-1].minor.yy0; + yymsp[-6].minor.yy235.col = yymsp[-4].minor.yy0; + yymsp[-6].minor.yy235.gap = yymsp[-1].minor.yy0; } break; - case 215: /* windowstate_option ::= */ -{ yymsp[1].minor.yy204.col.n = 0; yymsp[1].minor.yy204.col.z = NULL;} + case 216: /* windowstate_option ::= */ +{ yymsp[1].minor.yy248.col.n = 0; yymsp[1].minor.yy248.col.z = NULL;} break; - case 216: /* windowstate_option ::= STATE_WINDOW LP ids RP */ -{ yymsp[-3].minor.yy204.col = yymsp[-1].minor.yy0; } + case 217: /* windowstate_option ::= STATE_WINDOW LP ids RP */ +{ yymsp[-3].minor.yy248.col = yymsp[-1].minor.yy0; } break; - case 217: /* fill_opt ::= */ -{ yymsp[1].minor.yy367 = 0; } + case 218: /* fill_opt ::= */ +{ yymsp[1].minor.yy333 = 0; } break; - case 218: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 219: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy367, &A, -1, 0); - yymsp[-5].minor.yy367 = yymsp[-1].minor.yy367; + tVariantListInsert(yymsp[-1].minor.yy333, &A, -1, 0); + yymsp[-5].minor.yy333 = yymsp[-1].minor.yy333; } break; - case 219: /* fill_opt ::= FILL LP ID RP */ + case 220: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy367 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true); + yymsp[-3].minor.yy333 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true); } break; - case 220: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 221: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 221: /* sliding_opt ::= */ + case 222: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 223: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy367 = yymsp[0].minor.yy367;} + case 224: /* orderby_opt ::= ORDER BY sortlist */ +{yymsp[-2].minor.yy333 = yymsp[0].minor.yy333;} break; - case 224: /* sortlist ::= sortlist COMMA item sortorder */ + case 225: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy367 = commonItemAppend(yymsp[-3].minor.yy367, &yymsp[-1].minor.yy410, NULL, false, yymsp[0].minor.yy274); + yylhsminor.yy333 = commonItemAppend(yymsp[-3].minor.yy333, &yymsp[-1].minor.yy42, NULL, false, yymsp[0].minor.yy133); } - yymsp[-3].minor.yy367 = yylhsminor.yy367; + yymsp[-3].minor.yy333 = yylhsminor.yy333; break; - case 225: /* sortlist ::= sortlist COMMA arrow sortorder */ + case 226: /* sortlist ::= sortlist COMMA arrow sortorder */ { - yylhsminor.yy367 = commonItemAppend(yymsp[-3].minor.yy367, NULL, yymsp[-1].minor.yy378, true, yymsp[0].minor.yy274); + yylhsminor.yy333 = commonItemAppend(yymsp[-3].minor.yy333, NULL, yymsp[-1].minor.yy194, true, yymsp[0].minor.yy133); } - yymsp[-3].minor.yy367 = yylhsminor.yy367; + yymsp[-3].minor.yy333 = yylhsminor.yy333; break; - case 226: /* sortlist ::= item sortorder */ + case 227: /* sortlist ::= item sortorder */ { - yylhsminor.yy367 = commonItemAppend(NULL, &yymsp[-1].minor.yy410, NULL, false, yymsp[0].minor.yy274); + yylhsminor.yy333 = commonItemAppend(NULL, &yymsp[-1].minor.yy42, NULL, false, yymsp[0].minor.yy133); } - yymsp[-1].minor.yy367 = yylhsminor.yy367; + yymsp[-1].minor.yy333 = yylhsminor.yy333; break; - case 227: /* sortlist ::= arrow sortorder */ + case 228: /* sortlist ::= arrow sortorder */ { - yylhsminor.yy367 = commonItemAppend(NULL, NULL, yymsp[-1].minor.yy378, true, yymsp[0].minor.yy274); + yylhsminor.yy333 = commonItemAppend(NULL, NULL, yymsp[-1].minor.yy194, true, yymsp[0].minor.yy133); } - yymsp[-1].minor.yy367 = yylhsminor.yy367; + yymsp[-1].minor.yy333 = yylhsminor.yy333; break; - case 228: /* item ::= ID */ + case 229: /* item ::= ID */ { toTSDBType(yymsp[0].minor.yy0.type); - tVariantCreate(&yylhsminor.yy410, &yymsp[0].minor.yy0); + tVariantCreate(&yylhsminor.yy42, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy410 = yylhsminor.yy410; + yymsp[0].minor.yy42 = yylhsminor.yy42; break; - case 229: /* item ::= ID DOT ID */ + case 230: /* item ::= ID DOT ID */ { toTSDBType(yymsp[-2].minor.yy0.type); yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); - tVariantCreate(&yylhsminor.yy410, &yymsp[-2].minor.yy0); + tVariantCreate(&yylhsminor.yy42, &yymsp[-2].minor.yy0); } - yymsp[-2].minor.yy410 = yylhsminor.yy410; + yymsp[-2].minor.yy42 = yylhsminor.yy42; break; - case 230: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy274 = TSDB_ORDER_ASC; } + case 231: /* sortorder ::= ASC */ +{ yymsp[0].minor.yy133 = TSDB_ORDER_ASC; } break; - case 231: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy274 = TSDB_ORDER_DESC;} + case 232: /* sortorder ::= DESC */ +{ yymsp[0].minor.yy133 = TSDB_ORDER_DESC;} break; - case 232: /* sortorder ::= */ -{ yymsp[1].minor.yy274 = TSDB_ORDER_ASC; } + case 233: /* sortorder ::= */ +{ yymsp[1].minor.yy133 = TSDB_ORDER_ASC; } break; - case 233: /* groupby_opt ::= */ -{ yymsp[1].minor.yy367 = 0;} + case 234: /* groupby_opt ::= */ +{ yymsp[1].minor.yy333 = 0;} break; - case 234: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy367 = yymsp[0].minor.yy367;} + case 235: /* groupby_opt ::= GROUP BY grouplist */ +{ yymsp[-2].minor.yy333 = yymsp[0].minor.yy333;} break; - case 235: /* grouplist ::= grouplist COMMA item */ + case 236: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy367 = commonItemAppend(yymsp[-2].minor.yy367, &yymsp[0].minor.yy410, NULL, false, -1); + yylhsminor.yy333 = commonItemAppend(yymsp[-2].minor.yy333, &yymsp[0].minor.yy42, NULL, false, -1); } - yymsp[-2].minor.yy367 = yylhsminor.yy367; + yymsp[-2].minor.yy333 = yylhsminor.yy333; break; - case 236: /* grouplist ::= grouplist COMMA arrow */ + case 237: /* grouplist ::= grouplist COMMA arrow */ { - yylhsminor.yy367 = commonItemAppend(yymsp[-2].minor.yy367, NULL, yymsp[0].minor.yy378, true, -1); + yylhsminor.yy333 = commonItemAppend(yymsp[-2].minor.yy333, NULL, yymsp[0].minor.yy194, true, -1); } - yymsp[-2].minor.yy367 = yylhsminor.yy367; + yymsp[-2].minor.yy333 = yylhsminor.yy333; break; - case 237: /* grouplist ::= item */ + case 238: /* grouplist ::= item */ { - yylhsminor.yy367 = commonItemAppend(NULL, &yymsp[0].minor.yy410, NULL, false, -1); + yylhsminor.yy333 = commonItemAppend(NULL, &yymsp[0].minor.yy42, NULL, false, -1); } - yymsp[0].minor.yy367 = yylhsminor.yy367; + yymsp[0].minor.yy333 = yylhsminor.yy333; break; - case 238: /* grouplist ::= arrow */ + case 239: /* grouplist ::= arrow */ { - yylhsminor.yy367 = commonItemAppend(NULL, NULL, yymsp[0].minor.yy378, true, -1); + yylhsminor.yy333 = commonItemAppend(NULL, NULL, yymsp[0].minor.yy194, true, -1); } - yymsp[0].minor.yy367 = yylhsminor.yy367; + yymsp[0].minor.yy333 = yylhsminor.yy333; break; - case 239: /* having_opt ::= */ - case 249: /* where_opt ::= */ yytestcase(yyruleno==249); - case 306: /* expritem ::= */ yytestcase(yyruleno==306); -{yymsp[1].minor.yy378 = 0;} + case 240: /* having_opt ::= */ + case 250: /* where_opt ::= */ yytestcase(yyruleno==250); + case 307: /* expritem ::= */ yytestcase(yyruleno==307); +{yymsp[1].minor.yy194 = 0;} break; - case 240: /* having_opt ::= HAVING expr */ - case 250: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==250); -{yymsp[-1].minor.yy378 = yymsp[0].minor.yy378;} + case 241: /* having_opt ::= HAVING expr */ + case 251: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==251); +{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;} break; - case 241: /* limit_opt ::= */ - case 245: /* slimit_opt ::= */ yytestcase(yyruleno==245); -{yymsp[1].minor.yy24.limit = -1; yymsp[1].minor.yy24.offset = 0;} + case 242: /* limit_opt ::= */ + case 246: /* slimit_opt ::= */ yytestcase(yyruleno==246); +{yymsp[1].minor.yy190.limit = -1; yymsp[1].minor.yy190.offset = 0;} break; - case 242: /* limit_opt ::= LIMIT signed */ - case 246: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==246); -{yymsp[-1].minor.yy24.limit = yymsp[0].minor.yy443; yymsp[-1].minor.yy24.offset = 0;} + case 243: /* limit_opt ::= LIMIT signed */ + case 247: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==247); +{yymsp[-1].minor.yy190.limit = yymsp[0].minor.yy277; yymsp[-1].minor.yy190.offset = 0;} break; - case 243: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy24.limit = yymsp[-2].minor.yy443; yymsp[-3].minor.yy24.offset = yymsp[0].minor.yy443;} + case 244: /* limit_opt ::= LIMIT signed OFFSET signed */ +{ yymsp[-3].minor.yy190.limit = yymsp[-2].minor.yy277; yymsp[-3].minor.yy190.offset = yymsp[0].minor.yy277;} break; - case 244: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy24.limit = yymsp[0].minor.yy443; yymsp[-3].minor.yy24.offset = yymsp[-2].minor.yy443;} + case 245: /* limit_opt ::= LIMIT signed COMMA signed */ +{ yymsp[-3].minor.yy190.limit = yymsp[0].minor.yy277; yymsp[-3].minor.yy190.offset = yymsp[-2].minor.yy277;} break; - case 247: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy24.limit = yymsp[-2].minor.yy443; yymsp[-3].minor.yy24.offset = yymsp[0].minor.yy443;} + case 248: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ +{yymsp[-3].minor.yy190.limit = yymsp[-2].minor.yy277; yymsp[-3].minor.yy190.offset = yymsp[0].minor.yy277;} break; - case 248: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy24.limit = yymsp[0].minor.yy443; yymsp[-3].minor.yy24.offset = yymsp[-2].minor.yy443;} + case 249: /* slimit_opt ::= SLIMIT signed COMMA signed */ +{yymsp[-3].minor.yy190.limit = yymsp[0].minor.yy277; yymsp[-3].minor.yy190.offset = yymsp[-2].minor.yy277;} break; - case 251: /* expr ::= LP expr RP */ -{yylhsminor.yy378 = yymsp[-1].minor.yy378; yylhsminor.yy378->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy378->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 252: /* expr ::= LP expr RP */ +{yylhsminor.yy194 = yymsp[-1].minor.yy194; yylhsminor.yy194->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy194->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 252: /* expr ::= ID */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 253: /* expr ::= ID */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 253: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 254: /* expr ::= ID DOT ID */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 254: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 255: /* expr ::= ID DOT STAR */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 255: /* expr ::= INTEGER */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 256: /* expr ::= INTEGER */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 256: /* expr ::= MINUS INTEGER */ - case 257: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==257); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy378 = yylhsminor.yy378; + case 257: /* expr ::= MINUS INTEGER */ + case 258: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==258); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; - case 258: /* expr ::= FLOAT */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 259: /* expr ::= FLOAT */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 259: /* expr ::= MINUS FLOAT */ - case 260: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==260); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy378 = yylhsminor.yy378; + case 260: /* expr ::= MINUS FLOAT */ + case 261: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==261); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; - case 261: /* expr ::= STRING */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 262: /* expr ::= STRING */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 262: /* expr ::= NOW */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 263: /* expr ::= NOW */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 263: /* expr ::= TODAY */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_TODAY); } - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 264: /* expr ::= TODAY */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_TODAY); } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 264: /* expr ::= VARIABLE */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 265: /* expr ::= VARIABLE */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 265: /* expr ::= PLUS VARIABLE */ - case 266: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==266); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} - yymsp[-1].minor.yy378 = yylhsminor.yy378; + case 266: /* expr ::= PLUS VARIABLE */ + case 267: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==267); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; - case 267: /* expr ::= BOOL */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 268: /* expr ::= BOOL */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 268: /* expr ::= NULL */ -{ yylhsminor.yy378 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 269: /* expr ::= NULL */ +{ yylhsminor.yy194 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 269: /* expr ::= ID LP exprlist RP */ -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy378 = tSqlExprCreateFunction(yymsp[-1].minor.yy367, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy378 = yylhsminor.yy378; + case 270: /* expr ::= ID LP exprlist RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy194 = tSqlExprCreateFunction(yymsp[-1].minor.yy333, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy194 = yylhsminor.yy194; break; - case 270: /* expr ::= ID LP STAR RP */ -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy378 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy378 = yylhsminor.yy378; + case 271: /* expr ::= ID LP STAR RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy194 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy194 = yylhsminor.yy194; break; - case 271: /* expr ::= ID LP expr AS typename RP */ -{ tStrTokenAppend(pInfo->funcs, &yymsp[-5].minor.yy0); yylhsminor.yy378 = tSqlExprCreateFuncWithParams(pInfo, yymsp[-3].minor.yy378, &yymsp[-1].minor.yy307, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, yymsp[-5].minor.yy0.type); } - yymsp[-5].minor.yy378 = yylhsminor.yy378; + case 272: /* expr ::= ID LP expr AS typename RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-5].minor.yy0); yylhsminor.yy194 = tSqlExprCreateFuncWithParams(pInfo, yymsp[-3].minor.yy194, &yymsp[-1].minor.yy263, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, yymsp[-5].minor.yy0.type); } + yymsp[-5].minor.yy194 = yylhsminor.yy194; break; - case 272: /* expr ::= expr IS NULL */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, NULL, TK_ISNULL);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 273: /* expr ::= expr IS NULL */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, NULL, TK_ISNULL);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 273: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-3].minor.yy378, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy378 = yylhsminor.yy378; + case 274: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-3].minor.yy194, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy194 = yylhsminor.yy194; break; - case 274: /* expr ::= expr LT expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_LT);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 275: /* expr ::= expr LT expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_LT);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 275: /* expr ::= expr GT expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_GT);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 276: /* expr ::= expr GT expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_GT);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 276: /* expr ::= expr LE expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_LE);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 277: /* expr ::= expr LE expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_LE);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 277: /* expr ::= expr GE expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_GE);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 278: /* expr ::= expr GE expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_GE);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 278: /* expr ::= expr NE expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_NE);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 279: /* expr ::= expr NE expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_NE);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 279: /* expr ::= expr EQ expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_EQ);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 280: /* expr ::= expr EQ expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_EQ);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 280: /* expr ::= expr BETWEEN expr AND expr */ -{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy378); yylhsminor.yy378 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy378, yymsp[-2].minor.yy378, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy378, TK_LE), TK_AND);} - yymsp[-4].minor.yy378 = yylhsminor.yy378; + case 281: /* expr ::= expr BETWEEN expr AND expr */ +{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy194); yylhsminor.yy194 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy194, yymsp[-2].minor.yy194, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy194, TK_LE), TK_AND);} + yymsp[-4].minor.yy194 = yylhsminor.yy194; break; - case 281: /* expr ::= expr AND expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_AND);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 282: /* expr ::= expr AND expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_AND);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 282: /* expr ::= expr OR expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_OR); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 283: /* expr ::= expr OR expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_OR); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 283: /* expr ::= expr PLUS expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_PLUS); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 284: /* expr ::= expr PLUS expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_PLUS); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 284: /* expr ::= expr MINUS expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_MINUS); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 285: /* expr ::= expr MINUS expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_MINUS); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 285: /* expr ::= expr STAR expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_STAR); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 286: /* expr ::= expr STAR expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_STAR); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 286: /* expr ::= expr SLASH expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_DIVIDE);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 287: /* expr ::= expr SLASH expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_DIVIDE);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 287: /* expr ::= expr REM expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_REM); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 288: /* expr ::= expr REM expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_REM); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 288: /* expr ::= expr BITAND expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_BITAND);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 289: /* expr ::= expr BITAND expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_BITAND);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 289: /* expr ::= expr BITOR expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_BITOR); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 290: /* expr ::= expr BITOR expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_BITOR); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 290: /* expr ::= expr BITXOR expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_BITXOR);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 291: /* expr ::= expr BITXOR expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_BITXOR);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 291: /* expr ::= BITNOT expr */ -{yymsp[-1].minor.yy378 = tSqlExprCreate(yymsp[0].minor.yy378, NULL, TK_BITNOT);} + case 292: /* expr ::= BITNOT expr */ +{yymsp[-1].minor.yy194 = tSqlExprCreate(yymsp[0].minor.yy194, NULL, TK_BITNOT);} break; - case 292: /* expr ::= expr LSHIFT expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_LSHIFT);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 293: /* expr ::= expr LSHIFT expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_LSHIFT);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 293: /* expr ::= expr RSHIFT expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_RSHIFT);} - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 294: /* expr ::= expr RSHIFT expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_RSHIFT);} + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 294: /* expr ::= expr LIKE expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_LIKE); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 295: /* expr ::= expr LIKE expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_LIKE); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 295: /* expr ::= expr MATCH expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_MATCH); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 296: /* expr ::= expr MATCH expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_MATCH); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 296: /* expr ::= expr NMATCH expr */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-2].minor.yy378, yymsp[0].minor.yy378, TK_NMATCH); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 297: /* expr ::= expr NMATCH expr */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-2].minor.yy194, yymsp[0].minor.yy194, TK_NMATCH); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 297: /* expr ::= ID CONTAINS STRING */ -{ tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy378 = tSqlExprCreate(S, M, TK_CONTAINS); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 298: /* expr ::= ID CONTAINS STRING */ +{ tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy194 = tSqlExprCreate(S, M, TK_CONTAINS); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 298: /* expr ::= ID DOT ID CONTAINS STRING */ -{ yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy378 = tSqlExprCreate(S, M, TK_CONTAINS); } - yymsp[-4].minor.yy378 = yylhsminor.yy378; + case 299: /* expr ::= ID DOT ID CONTAINS STRING */ +{ yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy194 = tSqlExprCreate(S, M, TK_CONTAINS); } + yymsp[-4].minor.yy194 = yylhsminor.yy194; break; - case 299: /* arrow ::= ID ARROW STRING */ -{tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy378 = tSqlExprCreate(S, M, TK_ARROW); } - yymsp[-2].minor.yy378 = yylhsminor.yy378; + case 300: /* arrow ::= ID ARROW STRING */ +{tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy194 = tSqlExprCreate(S, M, TK_ARROW); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 300: /* arrow ::= ID DOT ID ARROW STRING */ -{yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy378 = tSqlExprCreate(S, M, TK_ARROW); } - yymsp[-4].minor.yy378 = yylhsminor.yy378; + case 301: /* arrow ::= ID DOT ID ARROW STRING */ +{yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy194 = tSqlExprCreate(S, M, TK_ARROW); } + yymsp[-4].minor.yy194 = yylhsminor.yy194; break; - case 301: /* expr ::= arrow */ - case 305: /* expritem ::= expr */ yytestcase(yyruleno==305); -{yylhsminor.yy378 = yymsp[0].minor.yy378;} - yymsp[0].minor.yy378 = yylhsminor.yy378; + case 302: /* expr ::= arrow */ + case 306: /* expritem ::= expr */ yytestcase(yyruleno==306); +{yylhsminor.yy194 = yymsp[0].minor.yy194;} + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 302: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy378 = tSqlExprCreate(yymsp[-4].minor.yy378, (tSqlExpr*)yymsp[-1].minor.yy367, TK_IN); } - yymsp[-4].minor.yy378 = yylhsminor.yy378; + case 303: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy194 = tSqlExprCreate(yymsp[-4].minor.yy194, (tSqlExpr*)yymsp[-1].minor.yy333, TK_IN); } + yymsp[-4].minor.yy194 = yylhsminor.yy194; break; - case 303: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy367 = tSqlExprListAppend(yymsp[-2].minor.yy367,yymsp[0].minor.yy378,0, 0);} - yymsp[-2].minor.yy367 = yylhsminor.yy367; + case 304: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy333 = tSqlExprListAppend(yymsp[-2].minor.yy333,yymsp[0].minor.yy194,0, 0);} + yymsp[-2].minor.yy333 = yylhsminor.yy333; break; - case 304: /* exprlist ::= expritem */ -{yylhsminor.yy367 = tSqlExprListAppend(0,yymsp[0].minor.yy378,0, 0);} - yymsp[0].minor.yy367 = yylhsminor.yy367; + case 305: /* exprlist ::= expritem */ +{yylhsminor.yy333 = tSqlExprListAppend(0,yymsp[0].minor.yy194,0, 0);} + yymsp[0].minor.yy333 = yylhsminor.yy333; break; - case 307: /* cmd ::= RESET QUERY CACHE */ + case 308: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 308: /* cmd ::= SYNCDB ids REPLICA */ + case 309: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 309: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 310: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 310: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 311: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3439,21 +3803,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 311: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + case 312: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 312: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 313: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 313: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 314: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3464,7 +3828,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 314: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 315: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3478,33 +3842,33 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 315: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 316: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { 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, false); - A = tVariantListAppend(A, &yymsp[0].minor.yy410, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy42, -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); } break; - case 316: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + case 317: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 317: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 318: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 318: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 319: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3515,21 +3879,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 319: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + case 320: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 320: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 321: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 321: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 322: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3540,7 +3904,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 322: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 323: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3554,38 +3918,38 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 323: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + case 324: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { 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, false); - A = tVariantListAppend(A, &yymsp[0].minor.yy410, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy42, -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); } break; - case 324: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + case 325: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy367, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy333, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 325: /* cmd ::= KILL CONNECTION INTEGER */ + case 326: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 326: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 327: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 327: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 328: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; - case 328: /* cmd ::= DELETE FROM ifexists ids cpxName where_opt */ + case 329: /* cmd ::= DELETE FROM ifexists ids cpxName where_opt */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - SDelData * pDelData = tGetDelData(&yymsp[-2].minor.yy0, &yymsp[-3].minor.yy0, yymsp[0].minor.yy378); + SDelData * pDelData = tGetDelData(&yymsp[-2].minor.yy0, &yymsp[-3].minor.yy0, yymsp[0].minor.yy194); setSqlInfo(pInfo, pDelData, NULL, TSDB_SQL_DELETE_DATA); } break; @@ -3593,9 +3957,9 @@ static void yy_reduce( break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); + return yyact; } /* @@ -3619,7 +3984,8 @@ static void yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3630,7 +3996,8 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -3642,7 +4009,8 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ @@ -3668,7 +4036,8 @@ static void yy_syntax_error( assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* @@ -3677,7 +4046,8 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3692,7 +4062,8 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* The main parser program. @@ -3721,45 +4092,47 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - unsigned int yyact; /* The parser action. */ + YYACTIONTYPE yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif - yyParser *yypParser; /* The parser */ + yyParser *yypParser = (yyParser*)yyp; /* The parser */ + ParseCTX_FETCH + ParseARG_STORE - yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif - ParseARG_STORE; + yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - int stateno = yypParser->yytos->stateno; - if( stateno < YY_MIN_REDUCE ){ + if( yyact < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno); + yyTracePrompt,yyTokenName[yymajor],yyact); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); } } #endif do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + assert( yyact==yypParser->yytos->stateno ); + yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,yymajor,yyminor); + yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - yymajor = YYNOCODE; + break; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3810,10 +4183,9 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack - && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) >= YY_MIN_REDUCE + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3830,6 +4202,8 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; + if( yymajor==YYNOCODE ) break; + yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3840,8 +4214,7 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - + break; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3863,10 +4236,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - yymajor = YYNOCODE; + break; #endif } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3880,4 +4253,18 @@ void Parse( } #endif return; -} \ No newline at end of file +} + +/* +** Return the fallback token corresponding to canonical token iToken, or +** 0 if iToken has no fallback. +*/ +int ParseFallback(int iToken){ +#ifdef YYFALLBACK + assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); + return yyFallback[iToken]; +#else + (void)iToken; + return 0; +#endif +} diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 6566bf9e79f3f58557a80c037e99027cd19753ba..5c385410080f62b94dc481c597f7a6e847cc4d46 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1080,7 +1080,9 @@ static void rpcProcessBrokenLink(SRpcConn *pConn) { pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; pContext->pConn = NULL; pConn->pReqMsg = NULL; - taosTmrStart(rpcProcessConnError, 0, pContext, pRpc->tmrCtrl); + int64_t *rid = malloc(sizeof(int64_t)); + *rid = pContext->rid; + taosTmrStart(rpcProcessConnError, 0, rid, pRpc->tmrCtrl); } if (pConn->inType) rpcReportBrokenLinkToServer(pConn); @@ -1293,7 +1295,9 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte rpcFreeCont(rpcMsg.pCont); } else if (pHead->code == TSDB_CODE_RPC_NOT_READY || pHead->code == TSDB_CODE_APP_NOT_READY || pHead->code == TSDB_CODE_DND_EXITING) { pContext->code = pHead->code; - rpcProcessConnError(pContext, NULL); + int64_t *rid = malloc(sizeof(int64_t)); + *rid = pContext->rid; + rpcProcessConnError(rid, NULL); rpcFreeCont(rpcMsg.pCont); } else { rpcNotifyClient(pContext, &rpcMsg); @@ -1395,7 +1399,9 @@ static TBOOL rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) { if (pConn == NULL) { pContext->code = terrno; // in rpcProcessConnError if numOfTry over limit, could call rpcNotifyClient to stop query - taosTmrStart(rpcProcessConnError, 1, pContext, pRpc->tmrCtrl); + int64_t *rid = malloc(sizeof(int64_t)); + *rid = pContext->rid; + taosTmrStart(rpcProcessConnError, 1, rid, pRpc->tmrCtrl); return BOOL_ASYNC; } @@ -1442,7 +1448,9 @@ static TBOOL rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) { // try next ip again pContext->code = terrno; // in rpcProcessConnError if numOfTry over limit, could call rpcNotifyClient to stop query - taosTmrStart(rpcProcessConnError, 1, pContext, pRpc->tmrCtrl); + int64_t *rid = malloc(sizeof(int64_t)); + *rid = pContext->rid; + taosTmrStart(rpcProcessConnError, 1, rid, pRpc->tmrCtrl); return BOOL_ASYNC; } @@ -1480,11 +1488,23 @@ static bool rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) { } static void rpcProcessConnError(void *param, void *id) { - SRpcReqContext *pContext = (SRpcReqContext *)param; + if (NULL == param) { + return; + } + + int64_t *rid = (int64_t*)param; + SRpcReqContext *pContext = (SRpcReqContext *)taosAcquireRef(tsRpcRefId, *rid); + if (NULL == pContext) { + free(param); + return; + } + SRpcInfo *pRpc = pContext->pRpc; SRpcMsg rpcMsg; if (pRpc == NULL) { + taosReleaseRef(tsRpcRefId, *rid); + free(param); return; } @@ -1504,6 +1524,9 @@ static void rpcProcessConnError(void *param, void *id) { pContext->epSet.inUse = pContext->epSet.inUse % pContext->epSet.numOfEps; rpcSendReqToServer(pRpc, pContext); } + + taosReleaseRef(tsRpcRefId, *rid); + free(param); } static void rpcProcessRetryTimer(void *param, void *tmrId) { @@ -1528,7 +1551,9 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) { pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; pConn->pContext->pConn = NULL; pConn->pReqMsg = NULL; - taosTmrStart(rpcProcessConnError, 1, pConn->pContext, pRpc->tmrCtrl); + int64_t *rid = malloc(sizeof(int64_t)); + *rid = pConn->pContext->rid; + taosTmrStart(rpcProcessConnError, 1, rid, pRpc->tmrCtrl); rpcReleaseConn(pConn); } } @@ -1892,4 +1917,4 @@ bool rpcSaveSendInfo(int64_t rpcRid, void** ppContext) { taosReleaseRef(tsRpcRefId, rpcRid); return true; -} \ No newline at end of file +} diff --git a/src/tsdb/src/tsdbCommitQueue.c b/src/tsdb/src/tsdbCommitQueue.c index 6ca097fbe968beef731229da14677006d0841439..9aff21cac39d7a1b407a0df263f9d903ce540161 100644 --- a/src/tsdb/src/tsdbCommitQueue.c +++ b/src/tsdb/src/tsdbCommitQueue.c @@ -132,13 +132,16 @@ static void tsdbApplyRepoConfig(STsdbRepo *pRepo) { pRepo->config.keep2 = pRepo->save_config.keep2; pRepo->config.cacheLastRow = pRepo->save_config.cacheLastRow; pRepo->config.totalBlocks = pRepo->save_config.totalBlocks; + pRepo->config.minRowsPerFileBlock = pRepo->save_config.minRowsPerFileBlock; pthread_mutex_unlock(&pRepo->save_mutex); - tsdbInfo("vgId:%d apply new config: compression(%d), keep(%d,%d,%d), totalBlocks(%d), cacheLastRow(%d->%d),totalBlocks(%d->%d)", - REPO_ID(pRepo), - pSaveCfg->compression, pSaveCfg->keep,pSaveCfg->keep1, pSaveCfg->keep2, - pSaveCfg->totalBlocks, oldCfg.cacheLastRow, pSaveCfg->cacheLastRow, oldTotalBlocks, pSaveCfg->totalBlocks); + tsdbInfo( + "vgId:%d apply new config: " + "compression(%d),keep(%d,%d,%d),totalBlocks(%d),cacheLastRow(%d->%d),totalBlocks(%d->%d),minRows(%d->%d)", + REPO_ID(pRepo), pSaveCfg->compression, pSaveCfg->keep, pSaveCfg->keep1, pSaveCfg->keep2, pSaveCfg->totalBlocks, + oldCfg.cacheLastRow, pSaveCfg->cacheLastRow, oldTotalBlocks, pSaveCfg->totalBlocks, oldCfg.minRowsPerFileBlock, + pSaveCfg->minRowsPerFileBlock); int err = tsdbExpandPool(pRepo, oldTotalBlocks); if (!TAOS_SUCCEEDED(err)) { diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 63ea4ab6df0e84e81a9308de509ccd24c933c54e..ec4b9a5d49ab1183017453b2bab15be4884ab268 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -233,7 +233,7 @@ int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg) { ASSERT(pRCfg->tsdbId == pCfg->tsdbId); ASSERT(pRCfg->cacheBlockSize == pCfg->cacheBlockSize); ASSERT(pRCfg->daysPerFile == pCfg->daysPerFile); - ASSERT(pRCfg->minRowsPerFileBlock == pCfg->minRowsPerFileBlock); + // ASSERT(pRCfg->minRowsPerFileBlock == pCfg->minRowsPerFileBlock); ASSERT(pRCfg->maxRowsPerFileBlock == pCfg->maxRowsPerFileBlock); ASSERT(pRCfg->precision == pCfg->precision); @@ -256,6 +256,9 @@ int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg) { if (pRCfg->totalBlocks != pCfg->totalBlocks) { configChanged = true; } + if (pRCfg->minRowsPerFileBlock != pCfg->minRowsPerFileBlock) { + configChanged = true; + } if (!configChanged) { tsdbError("vgId:%d no config changed", REPO_ID(repo)); @@ -277,15 +280,16 @@ int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg) { pSaveCfg->keep2 = pCfg->keep2; pSaveCfg->cacheLastRow = pCfg->cacheLastRow; pSaveCfg->totalBlocks = pCfg->totalBlocks; + pSaveCfg->minRowsPerFileBlock = pCfg->minRowsPerFileBlock; - tsdbInfo("vgId:%d old config: compression(%d), keep(%d,%d,%d), cacheLastRow(%d),totalBlocks(%d)", + tsdbInfo("vgId:%d old config: compression(%d),keep(%d,%d,%d),cacheLastRow(%d),totalBlocks(%d),minRows(%d)", REPO_ID(repo), pRCfg->compression, pRCfg->keep, pRCfg->keep1,pRCfg->keep2, - pRCfg->cacheLastRow, pRCfg->totalBlocks); - tsdbInfo("vgId:%d new config: compression(%d), keep(%d,%d,%d), cacheLastRow(%d),totalBlocks(%d)", + pRCfg->cacheLastRow, pRCfg->totalBlocks, pRCfg->minRowsPerFileBlock); + tsdbInfo("vgId:%d new config: compression(%d),keep(%d,%d,%d),cacheLastRow(%d),totalBlocks(%d),minRows(%d)", REPO_ID(repo), pSaveCfg->compression, pSaveCfg->keep,pSaveCfg->keep1, pSaveCfg->keep2, - pSaveCfg->cacheLastRow,pSaveCfg->totalBlocks); + pSaveCfg->cacheLastRow,pSaveCfg->totalBlocks,pSaveCfg->minRowsPerFileBlock); repo->config_changed = true; @@ -641,6 +645,7 @@ static void tsdbFreeRepo(STsdbRepo *pRepo) { // tsdbFreeMemTable(pRepo->imem); tsem_destroy(&(pRepo->readyToCommit)); pthread_mutex_destroy(&pRepo->mutex); + pthread_mutex_destroy(&pRepo->save_mutex); free(pRepo); } } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 3d72a7bde3bb87eca567819503ceb9746968768b..2126597e4291dffb4425a826c4270f2a832ec1b0 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -836,9 +836,11 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh if (ASCENDING_TRAVERSE(order)) { assert(pCheckInfo->lastKey <= key); - } else { - assert(pCheckInfo->lastKey >= key); } + // mem data tskey maybe large than pCheckInfo->lastKey + //} else { + // assert(pCheckInfo->lastKey >= key); + //} } else { tsdbDebug("%p uid:%"PRId64", tid:%d no data in mem, 0x%"PRIx64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, @@ -858,9 +860,11 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh if (ASCENDING_TRAVERSE(order)) { assert(pCheckInfo->lastKey <= key); - } else { - assert(pCheckInfo->lastKey >= key); } + // imem data tskey maybe large than pCheckInfo->lastKey + //} else { + // assert(pCheckInfo->lastKey >= key); + //} } else { tsdbDebug("%p uid:%"PRId64", tid:%d no data in imem, 0x%"PRIx64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, pHandle->qId); diff --git a/src/util/inc/tarray.h b/src/util/inc/tarray.h index 10aebe2b8fbebd56d40a0727bb56be5922fa2f39..be2afef4f5382671feaf6495c9dfcea380bd2225 100644 --- a/src/util/inc/tarray.h +++ b/src/util/inc/tarray.h @@ -36,10 +36,10 @@ typedef struct SArray { } SArray; /** - * - * @param size - * @param elemSize - * @return + * Initializes a heap-allocated array with `size` elements, the size of element is `elemSize`. + * @param size the number of element. + * @param elemSize the size of element. + * @return the pointer points to the array. */ void* taosArrayInit(size_t size, size_t elemSize); diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index 1a791c51b56748f57d6a6437db2e0235f295f631..1ccaa48e7204a0a455e3c0d5fc73f2dfeecc6cc3 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 139 +#define TSDB_CFG_MAX_NUM 140 #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 diff --git a/tests/develop-test/2-query/function_mode.py b/tests/develop-test/2-query/function_mode.py index 910ebbb2c574573722b1f840b2400f6e124d6f7c..e757434632fc1f8fdef654856d7bc99faa66317c 100644 --- a/tests/develop-test/2-query/function_mode.py +++ b/tests/develop-test/2-query/function_mode.py @@ -57,10 +57,10 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdSql.query('select mode(num) from d001') tdSql.checkRows(1) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, -32767) tdSql.query('select mode(dbool) from d001') tdSql.checkRows(1) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, False) tdSql.query('select mode(dtiny) from d001') tdSql.checkRows(1) tdSql.checkData(0, 0, None) @@ -87,7 +87,7 @@ class TDTestCase: tdSql.checkData(0, 0, 1) tdSql.query('select mode(num),mode(voltage) from smode') tdSql.checkRows(1) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, 3276) tdSql.checkData(0, 1, 1) tdSql.query('select mode(dbool) from smode') tdSql.checkRows(1) @@ -97,7 +97,7 @@ class TDTestCase: tdSql.checkData(0, 0, None) tdSql.query('select mode(dfloat) from smode') tdSql.checkRows(1) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, 3.3232219219207764) tdSql.query('select mode(ddouble) from smode') tdSql.checkRows(1) tdSql.checkData(0, 0, 4.982392323) @@ -112,16 +112,16 @@ class TDTestCase: #group by column tdSql.query('select mode(num) from d002 group by dbinary') tdSql.checkRows(2) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, 3276) tdSql.checkData(1, 0, None) tdSql.execute('insert into D002 values("2021-11-17 20:31:31", 1, 3276, true, NULL, 3.32322, 4.982392323, "你好吗", "sdf", 333)') tdSql.query('select mode(num) from d002 group by dbinary') tdSql.checkRows(2) tdSql.checkData(1, 0, 3276) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, 3276) tdSql.query('select mode(dfloat) from d002 group by dbinary') tdSql.checkRows(2) - tdSql.checkData(1, 0, None) + tdSql.checkData(1, 0, 3.3232200145721436) tdSql.query('select mode(dchar) from d002 group by dbinary') tdSql.checkRows(2) tdSql.checkData(1, 0, "你好吗") @@ -138,7 +138,7 @@ class TDTestCase: #group by tbname tdSql.query('select mode(dchar) from smode group by tbname') tdSql.checkRows(2) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, "你好吗") tdSql.checkData(0, 1, "d001") tdSql.checkData(1, 0, "你好吗") tdSql.checkData(1, 1, "d002") @@ -148,7 +148,7 @@ class TDTestCase: tdSql.checkRows(2) tdSql.checkData(0, 0, 4.982392323) tdSql.checkData(0, 1, "Beijing.haidian") - tdSql.checkData(1, 0, None) + tdSql.checkData(1, 0, 4.982392323) tdSql.checkData(1, 1, "Beijing.Chaoyang") #group by tag,column @@ -169,7 +169,7 @@ class TDTestCase: tdSql.checkRows(2) tdSql.checkData(0, 0, "你好吗") tdSql.checkData(0, 1, "d002") - tdSql.checkData(1, 0, None) + tdSql.checkData(1, 0, "你好吗") tdSql.checkData(1, 1, "d001") #where @@ -178,7 +178,7 @@ class TDTestCase: tdSql.checkData(0, 0, 19) tdSql.query('select mode(voltage) from smode where num > 9') tdSql.checkRows(1) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, 19) #interval tdSql.query('select mode(voltage) from smode interval(1s)') @@ -188,7 +188,7 @@ class TDTestCase: tdSql.checkData(0, 0, "2021-01-01 00:00:00") tdSql.checkData(0, 1, 1) tdSql.checkData(1, 0, "2022-01-01 00:00:00") - tdSql.checkData(1, 1, None) + tdSql.checkData(1, 1, 19) tdSql.query('select mode(voltage) from smode interval(1n)') tdSql.checkRows(4) tdSql.checkData(0, 0, "2021-10-01 00:00:00") @@ -198,7 +198,7 @@ class TDTestCase: tdSql.checkData(2, 0, "2021-12-01 00:00:00") tdSql.checkData(2, 1, 2) tdSql.checkData(3, 0, "2022-01-01 00:00:00") - tdSql.checkData(3, 1, None) + tdSql.checkData(3, 1, 19) tdSql.query('select mode(voltage) from smode where ts > "2021-09-01 00:00:00" and ts <"2022-02-02 00:00:00" interval(1n) fill(prev)') tdSql.checkRows(6) @@ -207,7 +207,7 @@ class TDTestCase: tdSql.checkData(3, 0, "2021-12-01 00:00:00") tdSql.checkData(3, 1, 2) tdSql.checkData(5, 0, "2022-02-01 00:00:00") - tdSql.checkData(5, 1, 2) + tdSql.checkData(5, 1, 19) #session tdSql.query('select mode(voltage) from d002 session(ts,1w)') @@ -222,7 +222,7 @@ class TDTestCase: #state_window tdSql.query('select mode(dfloat) from d002 state_window(voltage)') tdSql.checkRows(3) - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, 3.3232200145721436) tdSql.checkData(1, 0, None) #slimit/soffset @@ -237,9 +237,9 @@ class TDTestCase: #having tdSql.query('select mode(ddouble) from smode group by location having mode(ddouble)>3') - tdSql.checkRows(1) + tdSql.checkRows(2) tdSql.checkData(0, 0, 4.982392323) - tdSql.checkData(0, 1, "Beijing.haidian") + tdSql.checkData(0, 1, "Beijing.Chaoyang") #subquery tdSql.query('select mode(ddouble) from (select * from smode where voltage = 1)') diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py index a84fe0627484d594ffd0d32bcc4d4ea581ab66ec..c68375894c6f34bdccc33789384f6113aeb6e105 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py @@ -19,10 +19,9 @@ from util.dnodes import * class TDTestCase: def caseDescription(self): - ''' + """ [TD-11510] taosBenchmark test cases - ''' - return + """ def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) @@ -31,19 +30,23 @@ class TDTestCase: def getPath(self, tool="taosBenchmark"): selfPath = os.path.dirname(os.path.realpath(__file__)) - if ("community" in selfPath): - projPath = selfPath[:selfPath.find("community")] + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] else: - projPath = selfPath[:selfPath.find("tests")] + projPath = selfPath[: selfPath.find("tests")] paths = [] for root, dirs, files in os.walk(projPath): - if ((tool) in files): + if (tool) in files: rootRealPath = os.path.dirname(os.path.realpath(root)) - if ("packaging" not in rootRealPath): + if "packaging" not in rootRealPath: paths.append(os.path.join(root, tool)) break - if (len(paths) == 0): + if len(paths) == 0: tdLog.exit("taosBenchmark not found!") return else: @@ -52,12 +55,12 @@ class TDTestCase: def run(self): binPath = self.getPath() - cmd = "%s -f ./5-taos-tools/taosbenchmark/json/default.json" %binPath + cmd = "%s -f ./5-taos-tools/taosbenchmark/json/default.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") - tdSql.query("select count(tbname) from db.stb") - tdSql.checkData(0, 0, 10) + tdSql.query("show db.tables") + tdSql.checkRows(10) tdSql.query("select count(*) from db.stb") tdSql.checkData(0, 0, 100) @@ -67,4 +70,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json index d4b2aae2fb7bf1a3612e60f395a1c5ed26ceca8f..da22ef75e2a648e897341338bb762e4fedc6662b 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json @@ -20,8 +20,10 @@ "super_tables": [{ "name": "stb", "childtable_prefix": "stb_", + "childtable_count": 10, + "insert_rows": 10, "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] }] -} \ No newline at end of file +} diff --git a/tests/perftest-scripts/coverage_test.sh b/tests/perftest-scripts/coverage_test.sh index 1be2053f24f28dd825c040912783675b1eab94f9..b58fac21c9050b71781c4a06d26ce7c3437f6cc5 100755 --- a/tests/perftest-scripts/coverage_test.sh +++ b/tests/perftest-scripts/coverage_test.sh @@ -64,6 +64,21 @@ function runGeneralCaseOneByOne { done < $1 } +function runTestNGCaseOneByOne { + while read -r line; do + if [[ $line =~ ^./taostest* ]]; then + case=`echo $line | cut -d' ' -f 3 | cut -d'=' -f 2` + yaml=`echo $line | cut -d' ' -f 2` + + if [ -n "$case" ]; then + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && ./taostest $yaml --case=$case --keep > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ + || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + fi + fi + done < $1 +} + function runTest { echo "run Test" @@ -87,6 +102,13 @@ function runTest { else sed -i '3i\\n' $TDENGINE_COVERAGE_REPORT fi + + # run TestNG cases + stopTaosd + $TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null & + sleep 10 + cd $TDENGINE_DIR/../TestNG/cases + runTestNGCaseOneByOne ../scripts/cases.txt cd $TDENGINE_DIR/tests rm -rf ../sim diff --git a/tests/pytest/query/query1970YearsAf.py b/tests/pytest/query/query1970YearsAf.py index 62b435fbef9cb132e349e0f8da91eb5c795f3b0b..82b26682427b2d5439c9932f3c2b1d2804459ce0 100644 --- a/tests/pytest/query/query1970YearsAf.py +++ b/tests/pytest/query/query1970YearsAf.py @@ -25,8 +25,8 @@ from util.cases import * from util.dnodes import * from util.dnodes import TDDnode -class TDTestCase: +class TDTestCase: def __init__(self): self.path = "" @@ -68,7 +68,7 @@ class TDTestCase: "cachelast": 0, "quorum": 1, "fsync": 3000, - "update": 0 + "update": 0, } # set stable schema @@ -99,8 +99,7 @@ class TDTestCase: {"type": "TINYINT", "count": 2}, {"type": "BOOL", "count": 2}, {"type": "NCHAR", "len": 3, "count": 1}, - {"type": "BINARY", "len": 8, "count": 1} - + {"type": "BINARY", "len": 8, "count": 1}, ], "tags": [ {"type": "INT", "count": 2}, @@ -111,17 +110,14 @@ class TDTestCase: {"type": "TINYINT", "count": 2}, {"type": "BOOL", "count": 2}, {"type": "NCHAR", "len": 3, "count": 1}, - {"type": "BINARY", "len": 8, "count": 1} - ] + {"type": "BINARY", "len": 8, "count": 1}, + ], } # create different stables like stable1 and add to list super_tables super_tables = [] super_tables.append(stable1) - database = { - "dbinfo": dbinfo, - "super_tables": super_tables - } + database = {"dbinfo": dbinfo, "super_tables": super_tables} cfgdir = self.getCfgDir() create_table = { @@ -137,33 +133,60 @@ class TDTestCase: "confirm_parameter_prompt": "no", "insert_interval": 0, "num_of_records_per_req": 100, - "databases": [database] + "databases": [database], } return create_table + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.exit("path: %s is not supported" % selfPath) + + paths = [] + for root, dirs, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + def createinsertfile(self): create_table = self.creatcfg() date = datetime.datetime.now().strftime("%Y%m%d%H%M") file_create_table = f"/tmp/insert_{date}.json" - with open(file_create_table, 'w') as f: + with open(file_create_table, "w") as f: json.dump(create_table, f) return file_create_table def inserttable(self, filepath): - create_table_cmd = f"taosdemo -f {filepath} > /dev/null 2>&1" + binPath = self.getPath("taosBenchmark") + if binPath == "": + tdLog.exit("taosBenchmark not found!") + else: + tdLog.info("taosBenchmark found in %s" % binPath) + + create_table_cmd = "%s -f %s > /dev/null 2>&1" % (binPath, filepath) _ = subprocess.check_output(create_table_cmd, shell=True).decode("utf-8") def sqlsquery(self): # stable query - tdSql.query( - "select * from stb2 where stb2.ts < '1970-01-01 00:00:00.000' " - ) + tdSql.query("select * from stb2 where stb2.ts < '1970-01-01 00:00:00.000' ") tdSql.checkRows(43200) - tdSql.query( - "select * from stb2 where stb2.ts >= '1970-01-01 00:00:00.000' " - ) + tdSql.query("select * from stb2 where stb2.ts >= '1970-01-01 00:00:00.000' ") tdSql.checkRows(6800) tdSql.query( @@ -172,14 +195,10 @@ class TDTestCase: tdSql.checkRows(3590) # child-tables query - tdSql.query( - "select * from t0 where t0.ts < '1970-01-01 00:00:00.000' " - ) + tdSql.query("select * from t0 where t0.ts < '1970-01-01 00:00:00.000' ") tdSql.checkRows(4320) - tdSql.query( - "select * from t1 where t1.ts >= '1970-01-01 00:00:00.000' " - ) + tdSql.query("select * from t1 where t1.ts >= '1970-01-01 00:00:00.000' ") tdSql.checkRows(680) tdSql.query( @@ -192,9 +211,7 @@ class TDTestCase: ) tdSql.checkRows(680) - tdSql.query( - "select diff(c1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' " - ) + tdSql.query("select diff(c1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' ") tdSql.checkRows(679) tdSql.query( @@ -203,9 +220,7 @@ class TDTestCase: tdSql.checkRows(43200) # query with timestamp in 'where ...' - tdSql.query( - "select * from stb2 where stb2.ts > -28800000 " - ) + tdSql.query("select * from stb2 where stb2.ts > -28800000 ") tdSql.checkRows(6790) tdSql.query( @@ -219,14 +234,16 @@ class TDTestCase: tdSql.checkRows(3590) def run(self): - s = 'reset query cache' + s = "reset query cache" tdSql.execute(s) - s = 'create database if not exists db' + s = "create database if not exists db" tdSql.execute(s) - s = 'use db' + s = "use db" tdSql.execute(s) - tdLog.info("==========step1:create table stable and child table,then insert data automatically") + tdLog.info( + "==========step1:create table stable and child table,then insert data automatically" + ) insertfile = self.createinsertfile() self.inserttable(insertfile) diff --git a/tests/pytest/query/queryInterval.py b/tests/pytest/query/queryInterval.py index 2c0ae56de4d996846694da03de6ea0056804441d..0579489ee7709c00d7cc4cf6ce5ff79485557d29 100644 --- a/tests/pytest/query/queryInterval.py +++ b/tests/pytest/query/queryInterval.py @@ -197,6 +197,25 @@ class TDTestCase: else: tdLog.exit("sql:%s, column : ts is not sorted in accending order as expected" % (tdSql.sql)) + # TS-1582 + tdSql.execute("create table stb1(ts timestamp, c1 int) tags(t1 int)") + tdSql.execute("insert into tb1 using stb1 tags(1) values(%d, 1)(%d, 5)(%d, 10)" % (self.ts, self.ts + 1000, self.ts + 2000)) + tdSql.execute("insert into tb2 using stb1 tags(2) values(%d, 1)(%d, 5)(%d, 10)" % (self.ts, self.ts + 1000, self.ts + 2000)) + + tdSql.query("select t1, last(c1) from stb1 where ts between 1593548685000 and 1593548688000 interval(2s) fill(NULL) group by tbname") + tdSql.checkRows(6) + tdSql.checkData(2, 2, None) + tdSql.checkData(2, 3, "tb1") + tdSql.checkData(5, 2, None) + tdSql.checkData(5, 3, "tb2") + + tdSql.query("select t1, last(c1) - 1 from stb1 where ts between 1593548685000 and 1593548688000 interval(2s) fill(NULL) group by tbname") + tdSql.checkRows(6) + tdSql.checkData(2, 2, None) + tdSql.checkData(2, 3, "tb1") + tdSql.checkData(5, 2, None) + tdSql.checkData(5, 3, "tb2") + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/tools/taosdumpTestBenchmark.py b/tests/pytest/tools/taosdumpTestBenchmark.py deleted file mode 100644 index d3ac7347b3ad237e29ca5c30a918d4b0f7d649c3..0000000000000000000000000000000000000000 --- a/tests/pytest/tools/taosdumpTestBenchmark.py +++ /dev/null @@ -1,442 +0,0 @@ -################################################################### -# Copyright (c) 2016 by TAOS Technologies, Inc. -# All rights reserved. -# -# This file is proprietary and confidential to TAOS Technologies. -# No part of this file may be reproduced, stored, transmitted, -# disclosed or used in any form or by any means other than as -# expressly provided by the written permission from Jianhui Tao -# -################################################################### - -# -*- coding: utf-8 -*- - -import sys -import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * - - -class TDTestCase: - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - - self.ts = 1538548685000 - self.numberOfTables = 10000 - self.numberOfRecords = 100 - - def checkCommunity(self): - selfPath = os.path.dirname(os.path.realpath(__file__)) - if ("community" in selfPath): - return False - else: - return True - - def getPath(self, tool="taosdump"): - selfPath = os.path.dirname(os.path.realpath(__file__)) - - if ("community" in selfPath): - projPath = selfPath[:selfPath.find("community")] - else: - projPath = selfPath[:selfPath.find("tests")] - - paths = [] - for root, dirs, files in os.walk(projPath): - if ((tool) in files): - rootRealPath = os.path.dirname(os.path.realpath(root)) - if ("packaging" not in rootRealPath): - paths.append(os.path.join(root, tool)) - break - if (len(paths) == 0): - return "" - return paths[0] - - def insert_data(self, tbname, ts_start, count): - pre_insert = "insert into %s values" % tbname - sql = pre_insert - tdLog.debug("doing insert table %s rows=%d ..." % (tbname, count)) - for i in range(count): - sql += " (%d,%d)" % (ts_start + i * 1000, i) - if i > 0 and i % 30000 == 0: - tdSql.execute(sql) - sql = pre_insert - # end sql - if sql != pre_insert: - tdSql.execute(sql) - - tdLog.debug("INSERT TABLE DATA ............ [OK]") - return - - def run(self): - if not os.path.exists("./taosdumptest"): - os.makedirs("./taosdumptest") - else: - os.system("rm -rf ./taosdumptest") - os.makedirs("./taosdumptest") - - for i in range(2): - if not os.path.exists("./taosdumptest/tmp%d" % i): - os.makedirs("./taosdumptest/tmp%d" % i) - else: - os.system("rm -rf ./taosdumptest/tmp%d" % i) - os.makedirs("./taosdumptest/tmp%d" % i) - - binPath = self.getPath("taosdump") - if (binPath == ""): - tdLog.exit("taosdump not found!") - else: - tdLog.info("taosdump found: %s" % binPath) - - # create db1 , one stables and one table ; create general tables - tdSql.execute("drop database if exists dp1") - tdSql.execute("drop database if exists dp2") - tdSql.execute("create database if not exists dp1") - tdSql.execute("use dp1") - tdSql.execute( - '''create table st0(ts timestamp, c1 tinyint, c2 smallint, c3 int, c4 bigint, c5 float, c6 double, - c7 bool, c8 binary(20), c9 nchar(20), c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned, c15 timestamp ) - tags(t1 tinyint, t2 smallint, t3 int, t4 bigint, t5 float, t6 double, t7 bool, t8 binary(20), t9 nchar(20), t11 tinyint unsigned, - t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned, t15 timestamp)''') - tdSql.execute( - '''create table st1(ts timestamp, c1 tinyint, c2 smallint, c3 int, c4 bigint, c5 float, c6 double, - c7 bool, c8 binary(20), c9 nchar(20), c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned, c15 timestamp ) tags(jtag json)''') - - intData = [] - floatData = [] - rowNum = 10 - tabNum = 10 - ts = 1537146000000 - for j in range(tabNum): - tdSql.execute( - "create table st0_%d using st0 tags( %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d, %d);" % - (j, - j + - 1, - j + - 1, - j + - 1, - j + - 1, - j + - 0.1, - j + - 0.1, - j % - 2, - j + - 1, - j + - 1, - j + - 1, - j + - 1, - j + - 1, - j + - 1, - ts)) - for i in range(rowNum): - tdSql.execute( - "insert into st0_%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d, %d)" % - (j, ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % - 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, ts)) - intData.append(i + 1) - floatData.append(i + 0.1) - rowNum = 20 - tabNum = 20 - for j in range(tabNum): - tdSql.execute( - "create table st1_%d using st1 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123%d,\"tea\":false}');" % - (j, j + 1)) - for i in range(rowNum): - tdSql.execute( - "insert into st1_%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d, %d)" % - (j, self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % - 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, self.ts)) - intData.append(i + 1) - floatData.append(i + 0.1) - # os.system("%staosBenchmark -f tools/taosdump-insert-dp1.json -y " % benchBinPath) - - # create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1 - # \stb3,include ctables stb3_0 and stb3_1 - # create general three tables gt0 gt1 gt2 - tdSql.execute("create database if not exists dp2") - tdSql.execute("use dp2") - tdSql.execute( - "create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)") - tdSql.execute( - "create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) ") - tdSql.execute( - "insert into st0_0 values(1614218412000,8600,'R')(1614218422000,8600,'E')") - tdSql.execute( - "insert into st0_1 values(1614218413000,8601,'A')(1614218423000,8601,'D')") - tdSql.execute( - "create stable st1(ts timestamp, c11 float, c12 nchar(10)) tags(t1 int)") - tdSql.execute( - "create table st1_0 using st1 tags(0) st1_1 using st1 tags(1) ") - tdSql.execute( - "insert into st1_0 values(1614218412000,8610.1,'R')(1614218422000,8610.1,'E')") - tdSql.execute( - "insert into st1_1 values(1614218413000,8611.2,'A')(1614218423000,8611.1,'D')") - tdSql.execute( - "create stable st2(ts timestamp, c21 float, c22 nchar(10)) tags(t1 int)") - tdSql.execute( - "create table st20 using st2 tags(0) st21 using st2 tags(1) ") - tdSql.execute( - "insert into st20 values(1614218412000,8620.3,'R')(1614218422000,8620.3,'E')") - tdSql.execute( - "insert into st21 values(1614218413000,8621.4,'A')(1614218423000,8621.4,'D')") - tdSql.execute( - "create table if not exists gt0 (ts timestamp, c00 int, c01 float) ") - tdSql.execute( - "create table if not exists gt1 (ts timestamp, c10 int, c11 double) ") - tdSql.execute( - "create table if not exists gt2 (ts timestamp, c20 int, c21 float) ") - tdSql.execute("insert into gt0 values(1614218412700,8637,78.86155)") - tdSql.execute( - "insert into gt1 values(1614218413800,8638,78.862020199)") - tdSql.execute("insert into gt2 values(1614218413900,8639,78.863)") - # self.insert_data("t", self.ts, 300*10000); - # os.system("%staosBenchmark -f tools/taosdump-insert-dp2.json -y " % benchBinPath) - - # # taosdump data - # os.system("%s -o ./taosdumptest/tmp1 taosdump -h -ptaosdata -P 6030 -u root -o taosdumptest \ - # -D dp1,dp3 -N -c /home/chr/TDinternal/community/sim/dnode1/cfg/taos.cfg -s -d deflate" % binPath) - os.system( - "%s -o ./taosdumptest/tmp0 -D dp2,dp1 -T 8" % - binPath) - os.system( - "%s -o ./taosdumptest/tmp1 dp2 st0 st1_0 gt0 -T 8" % - binPath) - - # check taosdumptest/tmp0 - tdSql.execute("drop database dp1") - tdSql.execute("drop database dp2") - os.system("%s -i ./taosdumptest/tmp0 -T 8 " % binPath) - tdSql.execute("reset query cache") - - tdSql.execute("use dp1") - tdSql.query("show stables") - tdSql.checkRows(3) - for i in range(3): - for j in range(3): - if j < 2: - if tdSql.queryResult[i][0] == 'st%d' % j: - tdSql.checkData(i, 4, (j + 1) * 10) - else: - if tdSql.queryResult[i][0] == 'st%d' % j: - tdSql.checkData(i, 4, 100002) - - tdSql.query("select count(*) from st0") - tdSql.checkData(0, 0, 100) - tdSql.query("select count(*) from st1") - tdSql.checkData(0, 0, 400) - tdSql.query("select count(*) from st2") - tdSql.checkData(0, 0, 1000020) - - tdSql.execute("use dp2") - tdSql.query("show stables") - tdSql.checkRows(3) - for i in range(3): - for j in range(3): - if j < 2: - if tdSql.queryResult[i][0] == 'st%d' % j: - # print(i,"stb%d"%j) - tdSql.checkData(i, 4, 2) - else: - if tdSql.queryResult[i][0] == 'st%d' % j: - tdSql.checkData(i, 4, 100002) - tdSql.query("select count(*) from st0") - tdSql.checkData(0, 0, 4) - tdSql.query("select count(*) from st1") - tdSql.checkData(0, 0, 4) - tdSql.query("select count(*) from st2") - tdSql.checkData(0, 0, 1000024) - tdSql.query("select ts from gt0") - tdSql.checkData(0, 0, '2021-02-25 10:00:12.700') - tdSql.query("select c10 from gt1") - tdSql.checkData(0, 0, 8638) - tdSql.query("select c20 from gt2") - tdSql.checkData(0, 0, 8639) - - # check taosdumptest/tmp1 - tdSql.execute("drop database dp1") - tdSql.execute("drop database dp2") - os.system("%s -i ./taosdumptest/tmp1 -T 8 " % binPath) - tdSql.execute("reset query cache") - tdSql.execute("use dp2") - tdSql.query("show stables") - tdSql.checkRows(2) - tdSql.query("show tables") - tdSql.checkRows(4) - tdSql.query("select count(*) from st1_0") - tdSql.checkData(0, 0, 2) - tdSql.query("select ts from gt0") - tdSql.checkData(0, 0, '2021-02-25 10:00:12.700') - tdSql.error("use dp1") - tdSql.error("select count(*) from st2_0") - tdSql.error("select count(*) from gt2") - - # #check taosdumptest/tmp2 - # tdSql.execute("drop database dp1") - # tdSql.execute("drop database dp2") - # os.system("%s -i ./taosdumptest/tmp2 -T 8 " % binPath) - # tdSql.execute("use dp1") - # tdSql.query("show stables") - # tdSql.checkRows(1) - # tdSql.query("show tables") - # tdSql.checkRows(3) - # tdSql.query("select c1 from st0_0 order by ts") - # tdSql.checkData(0,0,8537) - # tdSql.query("select c2 from st0_1 order by ts") - # tdSql.checkData(1,0,"D") - # tdSql.query("select * from gt0") - # tdSql.checkData(0,0,'2021-02-25 10:00:12.000') - # tdSql.checkData(0,1,637) - # tdSql.error("select count(*) from gt1") - # tdSql.error("use dp2") - - # #check taosdumptest/tmp3 - # tdSql.execute("drop database dp1") - # os.system("%s -i ./taosdumptest/tmp3 -T 8 " % binPath) - # tdSql.execute("use dp2") - # tdSql.query("show stables") - # tdSql.checkRows(2) - # tdSql.query("show tables") - # tdSql.checkRows(4) - # tdSql.query("select count(*) from st1_0") - # tdSql.checkData(0,0,2) - # tdSql.query("select ts from gt0") - # tdSql.checkData(0,0,'2021-02-25 10:00:12.700') - # tdSql.error("use dp1") - # tdSql.error("select count(*) from st2_0") - # tdSql.error("select count(*) from gt2") - - # #check taosdumptest/tmp4 - # tdSql.execute("drop database dp2") - # os.system("%s -i ./taosdumptest/tmp4 -T 8 " % binPath) - # tdSql.execute("use dp2") - # tdSql.query("show stables") - # tdSql.checkRows(2) - # tdSql.query("show tables") - # tdSql.checkRows(6) - # tdSql.query("select c20 from gt2") - # tdSql.checkData(0, 0, 8639) - # tdSql.query("select count(*) from st0_0") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st0_1") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st2_1") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st2_0") - # tdSql.checkData(0, 0, 2) - # tdSql.error("use dp1") - # tdSql.error("select count(*) from st1_0") - # tdSql.error("select count(*) from st1_1") - # tdSql.error("select count(*) from gt3") - - # #check taosdumptest/tmp5 - # tdSql.execute("drop database dp2") - # os.system("%s -i ./taosdumptest/tmp5 -T 8 " % binPath) - # tdSql.execute("use dp2") - # tdSql.query("show stables") - # tdSql.checkRows(3) - # tdSql.query("show tables") - # tdSql.checkRows(9) - # tdSql.query("select c20 from gt2") - # tdSql.checkData(0, 0, 8639) - # tdSql.query("select count(*) from st0_0") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st0_1") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st2_1") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st2_0") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st1_1") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select count(*) from st1_0") - # tdSql.checkData(0, 0, 2) - # tdSql.execute("use dp1") - # tdSql.query("show stables") - # tdSql.checkRows(1) - # tdSql.query("show tables") - # tdSql.checkRows(4) - # tdSql.query("select c1 from st0_0 order by ts") - # tdSql.checkData(0,0,8537) - # tdSql.query("select c2 from st0_1 order by ts") - # tdSql.checkData(1,0,"D") - # tdSql.query("select * from gt0") - # tdSql.checkData(0,0,'2021-02-25 10:00:12.000') - # tdSql.checkData(0,1,637) - - # # check taosdumptest/tmp6 - # tdSql.execute("drop database dp1") - # tdSql.execute("drop database dp2") - # tdSql.execute("drop database dp3") - # os.system("%s -i ./taosdumptest/tmp6 -T 8 " % binPath) - # tdSql.execute("use dp3") - # tdSql.query("show databases") - # tdSql.checkRows(1) - # tdSql.checkData(0,16,'ns') - # tdSql.query("show stables") - # tdSql.checkRows(1) - # tdSql.query("show tables") - # tdSql.checkRows(1) - # tdSql.query("select count(*) from st0_0") - # tdSql.checkData(0, 0, 2) - # tdSql.query("select * from st0 order by ts") - # tdSql.checkData(0,0,'2021-02-25 10:00:12.000000001') - # tdSql.checkData(0,1,8600) - - # # check taosdumptest/tmp7 - # tdSql.execute("drop database dp3") - # os.system("%s -i ./taosdumptest/tmp7 -T 8 " % binPath) - # tdSql.execute("use dp3") - # tdSql.query("show databases") - # tdSql.checkRows(1) - # tdSql.checkData(0,16,'ms') - # tdSql.query("show stables") - # tdSql.checkRows(1) - # tdSql.query("show tables") - # tdSql.checkRows(1) - # tdSql.query("select count(*) from st0_0") - # tdSql.checkRows(0) - # # tdSql.query("select * from st0 order by ts") - # # tdSql.checkData(0,0,'2021-02-25 10:00:12.000000001') - # # tdSql.checkData(0,1,8600) - - # # check taosdumptest/tmp8 - # tdSql.execute("drop database dp3") - # os.system("%s -i ./taosdumptest/tmp8 -T 8 " % binPath) - # tdSql.execute("use dp3") - # tdSql.query("show stables") - # tdSql.checkRows(1) - # tdSql.query("show tables") - # tdSql.checkRows(1) - # tdSql.query("select count(*) from st0_0") - # tdSql.checkRows(0) - # # tdSql.query("select * from st0 order by ts") - # # tdSql.checkData(0,0,'2021-02-25 10:00:12.000000001') - # # tdSql.checkData(0,1,8600) - - # os.system("rm -rf ./taosdumptest/tmp1") - # os.system("rm -rf ./taosdumptest/tmp2") - # os.system("rm -rf ./taosdumptest/tmp3") - # os.system("rm -rf ./taosdumptest/tmp4") - # os.system("rm -rf ./taosdumptest/tmp5") - # os.system("rm -rf ./dump_result.txt") - # os.system("rm -rf ./db.csv") - - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - - -tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index 36f4c0e7dcfca27f77b0e701adff47e06f9d1bb0..52777dc08c75b44a1f3a5b713940c386f854aa81 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -9,7 +9,7 @@ sleep 2000 sql connect print ============= create database -sql create database db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 +sql create database db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 1200 ctime 120 precision 'ms' comp 2 wal 1 replica 1 sql show databases if $data00 != db then return -1 @@ -182,9 +182,13 @@ sql_error alter database db blocks -1 sql_error alter database db blocks 10001 print ============== step minrows +sql_error alter database db minrows 0 sql_error alter database db minrows 1 -sql_error alter database db minrows 100 -sql_error alter database db minrows 1000 +sql_error alter database db minrows -1 +sql_error alter database db minrows 9 +sql_error alter database db minrows 1001 +sql alter database db minrows 100 +sql alter database db minrows 1000 print ============== step maxrows sql_error alter database db maxrows 1 diff --git a/tests/script/general/db/topic1.sim b/tests/script/general/db/topic1.sim index 16399731208915602fea6dcd123fb85edf2e085b..ecf3c13f70b0e5957ef031a5e40c10b3dcf5145f 100644 --- a/tests/script/general/db/topic1.sim +++ b/tests/script/general/db/topic1.sim @@ -471,8 +471,9 @@ sql_error alter topic db blocks 10001 print ============== step minrows sql_error alter database db minrows 1 -sql_error alter database db minrows 100 -sql_error alter database db minrows 1000 +sql alter database db minrows 100 +sql alter database db minrows 399 +sql_error alter database db minrows 1001 sql_error alter topic db minrows 1 sql_error alter topic db minrows 100 diff --git a/tests/system-test/5-taos-tools/TD-12478.py b/tests/system-test/5-taos-tools/TD-12478.py index 69849d3c7a7962955619a2674367402b5352376e..4328d65ba0883865bc7ed63b7acfddd659f5ea06 100644 --- a/tests/system-test/5-taos-tools/TD-12478.py +++ b/tests/system-test/5-taos-tools/TD-12478.py @@ -28,13 +28,13 @@ from itertools import combinations from faker import Faker import subprocess + class TDTestCase: def caseDescription(self): - ''' - case1[TD-12434]:taosdump null nchar/binary length can cause core:taos-tools/src/taosdump.c - case2[TD-12478]:taos_stmt_execute() failed! reason: WAL size exceeds limit - ''' - return + """ + case1[TD-12434]:taosdump null nchar/binary length can cause core:taos-tools/src/taosdump.c + case2[TD-12478]:taos_stmt_execute() failed! reason: WAL size exceeds limit + """ def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) @@ -43,104 +43,184 @@ class TDTestCase: os.system("rm -rf 5-taos-tools/TD-12478.py.sql") os.system("rm db*") os.system("rm dump_result.txt*") - + os.system("rm -rf taosdump.*") + def restartDnodes(self): tdDnodes.stop(1) tdDnodes.start(1) - def dropandcreateDB_random(self,n): + def dropandcreateDB_random(self, n): self.ts = 1630000000000 - - fake = Faker('zh_CN') + + fake = Faker("zh_CN") self.num_random = fake.random_int(min=1000, max=5000, step=1) print(self.num_random) for i in range(n): - tdSql.execute('''drop database if exists db ;''') - tdSql.execute('''create database db keep 36500;''') - tdSql.execute('''use db;''') + tdSql.execute("""drop database if exists db ;""") + tdSql.execute("""create database db keep 36500;""") + tdSql.execute("""use db;""") - tdSql.execute('''create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ + tdSql.execute( + """create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \ - tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''') - tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ + tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);""" + ) + tdSql.execute( + """create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \ - tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''') - - tdSql.execute('''create table table_1 using stable_1 tags('table_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''') - tdSql.execute('''create table table_2 using stable_1 tags('table_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\')''') - tdSql.execute('''create table table_3 using stable_1 tags('table_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\')''') - tdSql.execute('''create table table_21 using stable_2 tags('table_21' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''') - - #regular table - tdSql.execute('''create table regular_table_1 \ + tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);""" + ) + + tdSql.execute( + """create table table_1 using stable_1 tags('table_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')""" + ) + tdSql.execute( + """create table table_2 using stable_1 tags('table_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\')""" + ) + tdSql.execute( + """create table table_3 using stable_1 tags('table_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\')""" + ) + tdSql.execute( + """create table table_21 using stable_2 tags('table_21' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')""" + ) + + # regular table + tdSql.execute( + """create table regular_table_1 \ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ - q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''') - tdSql.execute('''create table regular_table_2 \ + q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;""" + ) + tdSql.execute( + """create table regular_table_2 \ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ - q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''') - tdSql.execute('''create table regular_table_3 \ + q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;""" + ) + tdSql.execute( + """create table regular_table_3 \ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ - q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''') - - - for i in range(self.num_random): - tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)''' - % (self.ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1), - fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i)) - tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)''' - % (self.ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1) , - fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1) , - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i)) - - tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)''' - % (self.ts + i*1000, fake.random_int(min=0, max=2147483647, step=1), - fake.random_int(min=0, max=9223372036854775807, step=1), - fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i)) - tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)''' - % (self.ts + i*1000, fake.random_int(min=0, max=2147483647, step=1), - fake.random_int(min=0, max=9223372036854775807, step=1), - fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i)) - - tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)''' - % (self.ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1), - fake.random_int(min=-9223372036854775807, max=0, step=1), - fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i)) - tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)''' - % (self.ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1), - fake.random_int(min=-9223372036854775807, max=0, step=1), - fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i)) + q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;""" + ) + + for i in range(self.num_random): + tdSql.execute( + """insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)""" + % ( + self.ts + i * 1000, + fake.random_int(min=-2147483647, max=2147483647, step=1), + fake.random_int( + min=-9223372036854775807, max=9223372036854775807, step=1 + ), + fake.random_int(min=-32767, max=32767, step=1), + fake.random_int(min=-127, max=127, step=1), + fake.pyfloat(), + fake.pyfloat(), + fake.pystr(), + fake.address(), + self.ts + i, + ) + ) + tdSql.execute( + """insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)""" + % ( + self.ts + i * 1000, + fake.random_int(min=-2147483647, max=2147483647, step=1), + fake.random_int( + min=-9223372036854775807, max=9223372036854775807, step=1 + ), + fake.random_int(min=-32767, max=32767, step=1), + fake.random_int(min=-127, max=127, step=1), + fake.pyfloat(), + fake.pyfloat(), + fake.pystr(), + fake.address(), + self.ts + i, + ) + ) + + tdSql.execute( + """insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)""" + % ( + self.ts + i * 1000, + fake.random_int(min=0, max=2147483647, step=1), + fake.random_int(min=0, max=9223372036854775807, step=1), + fake.random_int(min=0, max=32767, step=1), + fake.random_int(min=0, max=127, step=1), + fake.pyfloat(), + fake.pyfloat(), + fake.pystr(), + fake.address(), + self.ts + i, + ) + ) + tdSql.execute( + """insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)""" + % ( + self.ts + i * 1000, + fake.random_int(min=0, max=2147483647, step=1), + fake.random_int(min=0, max=9223372036854775807, step=1), + fake.random_int(min=0, max=32767, step=1), + fake.random_int(min=0, max=127, step=1), + fake.pyfloat(), + fake.pyfloat(), + fake.pystr(), + fake.address(), + self.ts + i, + ) + ) + + tdSql.execute( + """insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)""" + % ( + self.ts + i * 1000, + fake.random_int(min=-2147483647, max=0, step=1), + fake.random_int(min=-9223372036854775807, max=0, step=1), + fake.random_int(min=-32767, max=0, step=1), + fake.random_int(min=-127, max=0, step=1), + fake.pyfloat(), + fake.pyfloat(), + fake.pystr(), + fake.address(), + self.ts + i, + ) + ) + tdSql.execute( + """insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)""" + % ( + self.ts + i * 1000, + fake.random_int(min=-2147483647, max=0, step=1), + fake.random_int(min=-9223372036854775807, max=0, step=1), + fake.random_int(min=-32767, max=0, step=1), + fake.random_int(min=-127, max=0, step=1), + fake.pyfloat(), + fake.pyfloat(), + fake.pystr(), + fake.address(), + self.ts + i, + ) + ) tdSql.query("select count(*) from stable_1;") - tdSql.checkData(0,0,3*self.num_random) + tdSql.checkData(0, 0, 3 * self.num_random) tdSql.query("select count(*) from regular_table_1;") - tdSql.checkData(0,0,self.num_random) + tdSql.checkData(0, 0, self.num_random) def run(self): tdSql.prepare() dcDB = self.dropandcreateDB_random(1) - + assert os.system("taosdump -D db") == 0 assert os.system("taosdump -i . -g") == 0 tdSql.query("select count(*) from stable_1;") - tdSql.checkData(0,0,3*self.num_random) + tdSql.checkData(0, 0, 3 * self.num_random) tdSql.query("select count(*) from regular_table_1;") - tdSql.checkData(0,0,self.num_random) + tdSql.checkData(0, 0, self.num_random) tdSql.query("select count(*) from regular_table_2;") - tdSql.checkData(0,0,self.num_random) + tdSql.checkData(0, 0, self.num_random) tdSql.query("select count(*) from regular_table_3;") - tdSql.checkData(0,0,self.num_random) - - + tdSql.checkData(0, 0, self.num_random) def stop(self): tdSql.close() @@ -148,4 +228,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson.py b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson.py index 6fbb6464a4b88041bed0191fdb637cf27f6d2947..0c903c7d2a3405433942073c4695c58de3487ceb 100644 --- a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson.py +++ b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson.py @@ -24,36 +24,44 @@ class TDTestCase: tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) - def getBuildPath(self): + def getPath(self, tool="taosBenchmark"): selfPath = os.path.dirname(os.path.realpath(__file__)) - if ("community" in selfPath): - projPath = selfPath[:selfPath.find("community")] + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] else: - projPath = selfPath[:selfPath.find("tests")] + tdLog.exit("path: %s is not supported" % selfPath) + paths = [] for root, dirs, files in os.walk(projPath): - if ("taosd" in files): + if (tool) in files: rootRealPath = os.path.dirname(os.path.realpath(root)) - if ("packaging" not in rootRealPath): - buildPath = root[:len(root)-len("/build/bin")] + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) break - return buildPath + if len(paths) == 0: + return "" + return paths[0] def run(self): - buildPath = self.getBuildPath() - if (buildPath == ""): - tdLog.exit("taosd not found!") + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosBenchmark not found!") else: - tdLog.info("taosd found in %s" % buildPath) - binPath = buildPath+ "/build/bin/" + tdLog.info("taosBenchmark found in %s" % binPath) testcaseFilename = os.path.split(__file__)[-1] os.system("rm -rf ./insert*_res.txt*") - os.system("rm -rf 5-taos-tools/taosbenchmark/%s.sql" % testcaseFilename ) + os.system("rm -rf 5-taos-tools/taosbenchmark/%s.sql" % testcaseFilename) # insert: create one or mutiple tables per sql and insert multiple rows per sql - os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-1s1tnt1r.json -y " % binPath) + os.system("%s -f 5-taos-tools/taosbenchmark/insert-1s1tnt1r.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") tdSql.checkData(0, 0, 11) @@ -69,7 +77,7 @@ class TDTestCase: tdSql.checkData(0, 0, 2000) # restful connector insert data - os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insertRestful.json -y " % binPath) + os.system("%s -f 5-taos-tools/taosbenchmark/insertRestful.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") tdSql.checkData(0, 0, 10) @@ -84,19 +92,19 @@ class TDTestCase: tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 200) - # default values json files - tdSql.execute("drop database if exists db") - os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-default.json -y " % binPath) + # default values json files + tdSql.execute("drop database if exists db") + os.system("%s -f 5-taos-tools/taosbenchmark/insert-default.json -y " % binPath) tdSql.query("show databases;") for i in range(tdSql.queryRows): - if tdSql.queryResult[i][0] == 'db': - tdSql.checkData(i, 2, 100) - tdSql.checkData(i, 4, 1) - tdSql.checkData(i, 6, 10) - tdSql.checkData(i, 16, 'ms') - + if tdSql.queryResult[i][0] == "db": + tdSql.checkData(i, 2, 100) + tdSql.checkData(i, 4, 1) + tdSql.checkData(i, 6, 10) + tdSql.checkData(i, 16, "ms") + # insert: create mutiple tables per sql and insert one rows per sql . - os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-1s1tntmr.json -y " % binPath) + os.system("%s -f 5-taos-tools/taosbenchmark/insert-1s1tntmr.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") tdSql.checkData(0, 0, 10) @@ -113,7 +121,9 @@ class TDTestCase: # insert: using parament "insert_interval to controls spped of insert. # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 - os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-interval-speed.json -y" % binPath) + os.system( + "%s -f 5-taos-tools/taosbenchmark/insert-interval-speed.json -y" % binPath + ) tdSql.execute("use db") tdSql.query("show stables") tdSql.checkData(0, 4, 10) @@ -131,11 +141,6 @@ class TDTestCase: # rm useless files os.system("rm -rf ./insert*_res.txt*") - - - - - def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__)