diff --git a/.gitignore b/.gitignore index 2c37aa92f77dd14bd274be94568dfe904f48c5f4..0458aa3415dc61005fe77b38c7c3366b1fcf461c 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,10 @@ tests/comparisonTest/opentsdb/opentsdbtest/.settings/ tests/examples/JDBC/JDBCDemo/.classpath tests/examples/JDBC/JDBCDemo/.project tests/examples/JDBC/JDBCDemo/.settings/ +tests/script/api/batchprepare +tests/script/api/stmt +tests/script/api/stmtBatchTest +tests/script/api/stmtTest # Emacs # -*- mode: gitignore; -*- diff --git a/cmake/define.inc b/cmake/define.inc index 92044b8c2dd3710c5a1808abcecd7d2358230e7a..21b517e197fbb8ee568d3017cd5e78a8750644e2 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -152,6 +152,17 @@ IF (TD_BUILD_HTTP) ADD_DEFINITIONS(-DHTTP_EMBEDDED) ENDIF () +IF (${BUILD_LUA} MATCHES "false") + SET(TD_BUILD_LUA FALSE) +ENDIF () + +IF (TD_BUILD_LUA) + MESSAGE("Enable lua") + ADD_DEFINITIONS(-DLUA_EMBEDDED) +ELSE () + MESSAGE("Disable lua") +ENDIF () + IF ("${AVRO_SUPPORT}" MATCHES "true") SET(TD_AVRO_SUPPORT TRUE) ELSEIF ("${AVRO_SUPPORT}" MATCHES "false") diff --git a/cmake/input.inc b/cmake/input.inc index 0812711a5824ce0b328374fcdd04fc5f229ad01c..4273f576b4bfb292e946fa8086527a48389b9908 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -92,6 +92,8 @@ ENDIF () SET(TD_BUILD_HTTP FALSE) +SET(TD_BUILD_LUA TRUE) + SET(TD_AVRO_SUPPORT FALSE) SET(TD_MEMORY_SANITIZER FALSE) diff --git a/cmake/version.inc b/cmake/version.inc index 94ff39f5e655d89b16b57a4b8c8fbe275c82a49a..ee3d1e356d15ba6484aa67df9d8dc09625b777d7 100755 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -4,7 +4,7 @@ PROJECT(TDengine) IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "2.3.1.0") + SET(TD_VER_NUMBER "2.3.2.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 38f36c4ed6678675cecfa9c0da1a3d065b58da86..45eaf6495d0f20c512d175c880af9bc1ed8f0ba6 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -15,7 +15,10 @@ ADD_SUBDIRECTORY(cJson) ADD_SUBDIRECTORY(wepoll) ADD_SUBDIRECTORY(MsvcLibX) ADD_SUBDIRECTORY(rmonotonic) -ADD_SUBDIRECTORY(lua) + +IF (TD_BUILD_LUA) + ADD_SUBDIRECTORY(lua) +ENDIF () IF (TD_LINUX AND TD_MQTT) ADD_SUBDIRECTORY(MQTT-C) diff --git a/documentation20/cn/02.getting-started/02.taosdemo/docs.md b/documentation20/cn/02.getting-started/02.taosdemo/docs.md index 3f91dbb35130a2ff78e5ef23219b79433af33ce3..4e43eac069465a092ab3f48b4069d5630da5fba9 100644 --- a/documentation20/cn/02.getting-started/02.taosdemo/docs.md +++ b/documentation20/cn/02.getting-started/02.taosdemo/docs.md @@ -4,7 +4,7 @@ 自从 TDengine 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。其中写入和查询性能往往令刚接触 TDengine 的用户称叹不已。为了便于用户在最短时间内就可以体验到 TDengine 的高性能特点,我们专门开发了一个应用程序 taosdemo 用于对 TDengine 进行写入和查询的性能测试,用户可以通过 taosdemo 轻松模拟大量设备产生海量数据的场景,并且可以通过 taosdemo 参数灵活控制表的列数、数据类型、乱序比例以及并发线程数量。 -运行 taosdemo 很简单,通过下载 TDengine 安装包(https://www.taosdata.com/cn/all-downloads/)或者自行下载 TDengine 代码(https://github.com/taosdata/TDengine)编译都可以在安装目录或者编译结果目录中找到并运行。 +运行 taosdemo 很简单,通过下载 TDengine 安装包( https://www.taosdata.com/cn/all-downloads/ )或者自行下载 TDengine 代码( https://github.com/taosdata/TDengine )编译都可以在安装目录或者编译结果目录中找到并运行。 接下来本文为大家讲解 taosdemo 的使用介绍及注意事项。 diff --git a/documentation20/cn/02.getting-started/docs.md b/documentation20/cn/02.getting-started/docs.md index adbba4603b94c689cab2e0aaaedf0e232ae3d1f4..5f887df914ef06d40f3b3b8bf6ef8dfe18fe6ecf 100644 --- a/documentation20/cn/02.getting-started/docs.md +++ b/documentation20/cn/02.getting-started/docs.md @@ -178,7 +178,7 @@ taos> select avg(current), max(voltage), min(phase) from test.d10 interval(10s); ## taosdemo 详细功能列表 taosdemo 命令本身带有很多选项,配置表的数目、记录条数等等,请执行 `taosdemo --help` 详细列出。您可以设置不同参数进行体验。 -taosdemo 详细使用方法请参照 [如何使用taosdemo对TDengine进行性能测试?](https://www.taosdata.com/cn/documentation/getting-started/taosdemo )。 +taosdemo 详细使用方法请参照 [如何使用taosdemo对TDengine进行性能测试](https://www.taosdata.com/cn/documentation/getting-started/taosdemo )。 ## 客户端和报警模块 @@ -190,7 +190,7 @@ taosdemo 详细使用方法请参照 [如何使用taosdemo对TDengine进行性 ### TDengine 服务器支持的平台列表 -| | **CentOS 6/7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | **华为 EulerOS** | +| | **CentOS 7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | **华为 EulerOS** | | -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- | --------------------- | | X64 | ● | ● | | ○ | ● | ● | ● | | 龙芯 MIPS64 | | | ● | | | | | diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md index b4543111b22008467ba749018fa2c19321f4f18e..a1689151aabd82b93821a11cb6de107090db0fae 100644 --- a/documentation20/cn/08.connector/docs.md +++ b/documentation20/cn/08.connector/docs.md @@ -328,7 +328,7 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线 除 C/C++ 语言外,TDengine 的 Java 语言 JNI Connector 也提供参数绑定接口支持,具体请另外参见:[参数绑定接口的 Java 用法](https://www.taosdata.com/cn/documentation/connector/java#stmt-java)。 -接口相关的具体函数如下(也可以参考 [apitest.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/apitest.c) 文件中使用对应函数的方式): +接口相关的具体函数如下(也可以参考 [prepare.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/prepare.c) 文件中使用对应函数的方式): - `TAOS_STMT* taos_stmt_init(TAOS *taos)` diff --git a/importSampleData/app/main.go b/importSampleData/app/main.go index e45e33e159f8636f8bdc5156b3b9b0947453bab4..3589c8c2a98f31e78c4dac3496f804605a0b2314 100644 --- a/importSampleData/app/main.go +++ b/importSampleData/app/main.go @@ -628,7 +628,7 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []i buffer.WriteString(",") for _, field := range subTableInfo.config.Fields { - buffer.WriteString(getFieldValue(currentRow[strings.ToLower(field.Name)])) + buffer.WriteString(getFieldValue(currentRow[strings.ToLower(field.Name)],field.Type)) buffer.WriteString(",") } @@ -708,7 +708,10 @@ func executeBatchInsert(insertSql string, connection *sql.DB) int64 { return affected } -func getFieldValue(fieldValue interface{}) string { +func getFieldValue(fieldValue interface{},fieldtype interface{}) string { + if fieldtype == "timestamp" || fieldtype == "bigint" { + return fmt.Sprintf("%v", fieldValue) + } return fmt.Sprintf("'%v'", fieldValue) } diff --git a/importSampleData/config/cfg.toml b/importSampleData/config/cfg.toml index 52a5d5f3169d21ce17039ead956250a636b37a01..545bab071ad66af2f59447b3449c6606e2ff1078 100644 --- a/importSampleData/config/cfg.toml +++ b/importSampleData/config/cfg.toml @@ -18,6 +18,8 @@ tags = [ fields = [ # 字段列表,name 为字段名称,type 为字段类型 + # 除主键外,其他field如果也要设置为timestamp,可以是type ="timestamp" 类型,此时value可同时支持'2006-01-02 15:04:05.000'和millisecond格式 + # 也可以是type = "bigint",此时value只支持millisecond格式 { name = "ts", type = "timestamp" }, { name = "temperature", type = "int" }, { name = "humidity", type = "float" }, diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index e42212ff0f55420dfa5f23638a69439be795e43a..59f87b0a1f8d3aa192383457a85e1d53b1a3bf54 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -299,8 +299,8 @@ keepColumnName 1 # percent of redundant data in tsdb meta will compact meta data,0 means donot compact # tsdbMetaCompactRatio 0 -# default string type used for storing JSON String, options can be binary/nchar, default is binary -# defaultJSONStrType binary +# default string type used for storing JSON String, options can be binary/nchar, default is nchar +# defaultJSONStrType nchar # force TCP transmission # rpcForceTcp 0 diff --git a/packaging/release.sh b/packaging/release.sh index 490188826d130a930d250f9425dc2e0c5ad61961..c82d5704ac5c4d89837f5afe4b1f6e27419279cc 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -194,6 +194,7 @@ fi if [[ "$dbName" == "pro" ]]; then sed -i "s/taos config/prodb config/g" ${top_dir}/src/util/src/tconfig.c + sed -i "s/TDengine/ProDB/g" ${top_dir}/src/dnode/src/dnodeSystem.c fi echo "build ${pagMode} package ..." diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 2f4b07067fd08ee3a9591f97e7291305307ff498..20ef425f56fb5d8f5d90b7a8cc4ef4a6da7a1b9c 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -468,8 +468,8 @@ function install_service_on_systemd() { function install_taosadapter_service() { if ((${service_mod}==0)); then - [ -f ${script_dir}/cfg/taosadapter.service ] &&\ - ${csudo} cp ${script_dir}/cfg/taosadapter.service \ + [ -f ${script_dir}/../cfg/taosadapter.service ] &&\ + ${csudo} cp ${script_dir}/../cfg/taosadapter.service \ ${service_config_dir}/ || : ${csudo} systemctl daemon-reload fi diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 64e3af498cedd25dea90055426110522bc4a4086..66ec851dc945d4897ef40d6a361468dd1d16a5a2 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: tdengine base: core20 -version: '2.3.1.0' +version: '2.3.2.0' icon: snap/gui/t-dengine.svg summary: an open-source big data platform designed and optimized for IoT. description: | diff --git a/src/client/inc/tscGlobalmerge.h b/src/client/inc/tscGlobalmerge.h index 875bb5e178d1d0f50b78b4b6c0cf6ae29b884a1a..6b3bf03316c64143ddb1aaab1d7b0a48a427381e 100644 --- a/src/client/inc/tscGlobalmerge.h +++ b/src/client/inc/tscGlobalmerge.h @@ -62,7 +62,7 @@ typedef struct SRetrieveSupport { uint32_t numOfRetry; // record the number of retry times } SRetrieveSupport; -int32_t tscCreateGlobalMergerEnv(SQueryInfo* pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub, tOrderDescriptor **pDesc, uint32_t nBufferSize, int64_t id); +int32_t tscCreateGlobalMergerEnv(SQueryInfo* pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub, tOrderDescriptor **pDesc, uint32_t* nBufferSize, int64_t id); void tscDestroyGlobalMergerEnv(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDesc, int32_t numOfVnodes); diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index a5e47f2436ee372d8434e1908348233f3e4320d8..bc05f5021e9e0fdea071511de9b1b21ab761c5dd 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -85,6 +85,11 @@ typedef struct SJoinSupporter { int32_t totalLen; int32_t num; SArray* pVgroupTables; + + int16_t fillType; // final result fill type + int64_t * fillVal; // default value for fill + int32_t numOfFillVal; // fill value size + } SJoinSupporter; @@ -121,7 +126,8 @@ typedef struct SBlockKeyInfo { int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *len); int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, SName* name, STableMeta* pTableMeta, STableDataBlocks** dataBlocks); -void tscDestroyDataBlock(SSqlObj *pSql, STableDataBlocks* pDataBlock, bool removeMeta); +int32_t tscCreateDataBlockData(STableDataBlocks* dataBuf, size_t defaultSize, int32_t rowSize, int32_t startOffset); +void tscDestroyDataBlock(SSqlObj *pSql, STableDataBlocks* pDataBlock, bool removeMeta); void tscSortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf); int tscSortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo); int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_t numOfRows); @@ -149,6 +155,7 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i * @return */ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo); +bool tscGetPointInterpQuery(SQueryInfo* pQueryInfo); bool tscIsTWAQuery(SQueryInfo* pQueryInfo); bool tscIsIrateQuery(SQueryInfo* pQueryInfo); bool tscQueryContainsFunction(SQueryInfo* pQueryInfo, int16_t functionId); diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 08e08cc6599efd0a2f0fe6de0ef52b1fbdfb6d88..2ddae0f903a6c42235343a6dd526d37e53147734 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -237,7 +237,7 @@ void taos_fetch_rows_a(TAOS_RES *tres, __async_cb_func_t fp, void *param) { return; } - if (pRes->qId == 0) { + if (pRes->qId == 0 && pSql->cmd.command != TSDB_SQL_RETRIEVE_EMPTY_RESULT) { tscError("qhandle is invalid"); pRes->code = TSDB_CODE_TSC_INVALID_QHANDLE; tscAsyncResultOnError(pSql); diff --git a/src/client/src/tscGlobalmerge.c b/src/client/src/tscGlobalmerge.c index 8e0ca0ab328de6f1b765e3e1f7ea457438cb9cae..db25a0b09c9b88855bbaa44ebaa9340f4f5264b3 100644 --- a/src/client/src/tscGlobalmerge.c +++ b/src/client/src/tscGlobalmerge.c @@ -233,7 +233,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor // sort before flush to disk, the data must be consecutively put on tFilePage. if (pDesc->orderInfo.numOfCols > 0) { - tColDataQSort(pDesc, (int32_t)pPage->num, 0, (int32_t)pPage->num - 1, pPage->data, orderType); + tColDataMergeSort(pDesc, (int32_t)pPage->num, 0, (int32_t)pPage->num - 1, pPage->data, orderType); } #ifdef _DEBUG_VIEW @@ -364,7 +364,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo* SExprInfo* pExprInfo = tscExprGet(pQueryInfo, j); int32_t functionId = pExprInfo->base.functionId; - if (pColIndex->colId == pExprInfo->base.colInfo.colId && (functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TAG)) { + if (pColIndex->colId == pExprInfo->base.colInfo.colId && (functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TAGPRJ)) { orderColIndexList[i] = j; break; } @@ -407,8 +407,8 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo* } int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub, - tOrderDescriptor **pOrderDesc, uint32_t nBufferSizes, int64_t id) { - SSchema *pSchema = NULL; + tOrderDescriptor **pOrderDesc, uint32_t* nBufferSizes, int64_t id) { + SSchema1 *pSchema = NULL; SColumnModel *pModel = NULL; STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -421,7 +421,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu size_t size = tscNumOfExprs(pQueryInfo); - pSchema = (SSchema *)calloc(1, sizeof(SSchema) * size); + pSchema = (SSchema1 *)calloc(1, sizeof(SSchema1) * size); if (pSchema == NULL) { tscError("0x%"PRIx64" failed to allocate memory", id); return TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -440,7 +440,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu int32_t capacity = 0; if (rlen != 0) { - capacity = nBufferSizes / rlen; + if ((*nBufferSizes) < rlen) { + (*nBufferSizes) = rlen * 2; + } + capacity = (*nBufferSizes) / rlen; } pModel = createColumnModel(pSchema, (int32_t)size, capacity); @@ -457,7 +460,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu assert(numOfSub <= pTableMetaInfo->vgroupList->numOfVgroups); for (int32_t i = 0; i < numOfSub; ++i) { - (*pMemBuffer)[i] = createExtMemBuffer(nBufferSizes, rlen, pg, pModel); + (*pMemBuffer)[i] = createExtMemBuffer(*nBufferSizes, rlen, pg, pModel); (*pMemBuffer)[i]->flushModel = MULTIPLE_APPEND_MODEL; } diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 25e1513b473059dbe8b61aab6adaa9203e226fb4..12a6187fc2207ea48ee32ab4cf4a817d325d1b76 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -440,7 +440,7 @@ static int32_t tscSCreateSetValueToResObj(SSqlObj *pSql, int32_t rowLen, const c SQueryInfo* pQueryInfo = tscGetQueryInfo(&pSql->cmd); int32_t numOfRows = 1; if (strlen(ddl) == 0) { - + } pSql->res.pMerger = tscInitResObjForLocalQuery(numOfRows, rowLen, pSql->self); tscInitResForMerge(&pSql->res); @@ -459,7 +459,7 @@ static int32_t tscSCreateBuildResult(SSqlObj *pSql, BuildType type, const char * int32_t rowLen = tscSCreateBuildResultFields(pSql, type, result); tscFieldInfoUpdateOffset(pQueryInfo); - return tscSCreateSetValueToResObj(pSql, rowLen, str, result); + return tscSCreateSetValueToResObj(pSql, rowLen, str, result); } int32_t tscRebuildCreateTableStatement(void *param,char *result) { SCreateBuilder *builder = (SCreateBuilder *)param; @@ -473,8 +473,8 @@ int32_t tscRebuildCreateTableStatement(void *param,char *result) { code = tscGetTableTagValue(builder, buf); if (code == TSDB_CODE_SUCCESS) { snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE TABLE `%s` USING `%s` TAGS %s", builder->buf, builder->sTableName, buf); - code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_TABLE, builder->buf, result); - } + code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_TABLE, builder->buf, result); + } free(buf); return code; } @@ -490,27 +490,27 @@ static int32_t tscGetDBInfo(SCreateBuilder *builder, char *result) { TAOS_FIELD *fields = taos_fetch_fields(pSql); int num_fields = taos_num_fields(pSql); - char buf[TSDB_DB_NAME_LEN + 64] = {0}; + char buf[TSDB_DB_NAME_LEN + 64] = {0}; do { memset(buf, 0, sizeof(buf)); - int32_t* lengths = taos_fetch_lengths(pSql); + int32_t* lengths = taos_fetch_lengths(pSql); int32_t ret = tscGetNthFieldResult(row, fields, lengths, 0, buf); if (0 == ret && STR_NOCASE_EQUAL(buf, strlen(buf), builder->buf, strlen(builder->buf))) { - snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE DATABASE %s", buf); + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE DATABASE %s", buf); for (int i = 1; i < num_fields; i++) { for (int j = 0; showColumns[j] != NULL; j++) { if (STR_NOCASE_EQUAL(fields[i].name, strlen(fields[i].name), showColumns[j], strlen(showColumns[j]))) { memset(buf, 0, sizeof(buf)); ret = tscGetNthFieldResult(row, fields, lengths, i, buf); if (ret == 0) { - snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), " %s %s", showColumns[j], buf); + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), " %s %s", showColumns[j], buf); } } } } break; - } - + } + row = tscFetchRow(builder); } while (row != NULL); @@ -528,9 +528,9 @@ int32_t tscRebuildCreateDBStatement(void *param,char *result) { if (buf == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } - code = tscGetDBInfo(param, buf); + code = tscGetDBInfo(param, buf); if (code == TSDB_CODE_SUCCESS) { - code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_DB, builder->buf, buf); + code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_DB, builder->buf, buf); } free(buf); return code; @@ -539,7 +539,7 @@ int32_t tscRebuildCreateDBStatement(void *param,char *result) { static int32_t tscGetTableTagColumnName(SSqlObj *pSql, char **result) { char *buf = (char *)malloc(TSDB_MAX_BINARY_LEN); if (buf == NULL) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; + return TSDB_CODE_TSC_OUT_OF_MEMORY; } buf[0] = 0; @@ -548,33 +548,33 @@ static int32_t tscGetTableTagColumnName(SSqlObj *pSql, char **result) { pMeta->tableType == TSDB_STREAM_TABLE) { free(buf); return TSDB_CODE_TSC_INVALID_VALUE; - } + } - SSchema *pTagsSchema = tscGetTableTagSchema(pMeta); + SSchema *pTagsSchema = tscGetTableTagSchema(pMeta); int32_t numOfTags = tscGetNumOfTags(pMeta); for (int32_t i = 0; i < numOfTags; i++) { if (i != numOfTags - 1) { - snprintf(buf + strlen(buf), TSDB_MAX_BINARY_LEN - strlen(buf), "%s,", pTagsSchema[i].name); + snprintf(buf + strlen(buf), TSDB_MAX_BINARY_LEN - strlen(buf), "`%s`,", pTagsSchema[i].name); } else { - snprintf(buf + strlen(buf), TSDB_MAX_BINARY_LEN - strlen(buf), "%s", pTagsSchema[i].name); + snprintf(buf + strlen(buf), TSDB_MAX_BINARY_LEN - strlen(buf), "`%s`", pTagsSchema[i].name); } - } + } *result = buf; return TSDB_CODE_SUCCESS; -} +} static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, char *ddl) { SQueryInfo* pQueryInfo = tscGetQueryInfo(&pSql->cmd); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableMeta * pMeta = pTableMetaInfo->pTableMeta; - SSqlObj *pInterSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); + SSqlObj *pInterSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); if (pInterSql == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; - } + } - SCreateBuilder *param = (SCreateBuilder *)malloc(sizeof(SCreateBuilder)); + SCreateBuilder *param = (SCreateBuilder *)malloc(sizeof(SCreateBuilder)); if (param == NULL) { free(pInterSql); return TSDB_CODE_TSC_OUT_OF_MEMORY; diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index af57f7ec8c6c192bf84915abd86728ab8f195835..58f7c7e7d6a25f95292268d2ff5393c120bb3f97 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -156,13 +156,15 @@ static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableNa SStringBuilder sb; memset(&sb, 0, sizeof(sb)); char sTableName[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; - strtolower(sTableName, point->stableName); + strncpy(sTableName, point->stableName, strlen(point->stableName)); + //strtolower(sTableName, point->stableName); taosStringBuilderAppendString(&sb, sTableName); for (int j = 0; j < point->tagNum; ++j) { taosStringBuilderAppendChar(&sb, ','); TAOS_SML_KV* tagKv = point->tags + j; char tagName[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; - strtolower(tagName, tagKv->key); + strncpy(tagName, tagKv->key, strlen(tagKv->key)); + //strtolower(tagName, tagKv->key); taosStringBuilderAppendString(&sb, tagName); taosStringBuilderAppendChar(&sb, '='); taosStringBuilderAppend(&sb, tagKv->value, tagKv->length); @@ -261,10 +263,10 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash, SArray* dbAttrArray, bool isTag, char sTableName[], SSchemaAction* action, bool* actionNeeded, SSmlLinesInfo* info) { - char fieldNameLowerCase[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; - strtolower(fieldNameLowerCase, pointColField->name); + char fieldName[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; + strcpy(fieldName, pointColField->name); - size_t* pDbIndex = taosHashGet(dbAttrHash, fieldNameLowerCase, strlen(fieldNameLowerCase)); + size_t* pDbIndex = taosHashGet(dbAttrHash, fieldName, strlen(fieldName)); if (pDbIndex) { SSchema* dbAttr = taosArrayGet(dbAttrArray, *pDbIndex); assert(strcasecmp(dbAttr->name, pointColField->name) == 0); @@ -297,7 +299,7 @@ static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash *actionNeeded = true; } if (*actionNeeded) { - tscDebug("SML:0x%" PRIx64 " generate schema action. column name: %s, action: %d", info->id, fieldNameLowerCase, + tscDebug("SML:0x%" PRIx64 " generate schema action. column name: %s, action: %d", info->id, fieldName, action->action); } return 0; @@ -536,11 +538,8 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl tscDebug("SML:0x%" PRIx64 " retrieve table meta. super table name: %s", info->id, tableName); - char tableNameLowerCase[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE]; - strtolower(tableNameLowerCase, tableName); - char sql[256]; - snprintf(sql, 256, "describe %s", tableNameLowerCase); + snprintf(sql, 256, "describe %s", tableName); TAOS_RES* res = taos_query(taos, sql); code = taos_errno(res); if (code != 0) { @@ -561,8 +560,10 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl pSql->fp = NULL; registerSqlObj(pSql); - SStrToken tableToken = {.z = tableNameLowerCase, .n = (uint32_t)strlen(tableNameLowerCase), .type = TK_ID}; - tGetToken(tableNameLowerCase, &tableToken.type); + char tableNameBuf[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; + memcpy(tableNameBuf, tableName, strlen(tableName)); + SStrToken tableToken = {.z = tableNameBuf, .n = (uint32_t)strlen(tableName), .type = TK_ID}; + tGetToken(tableNameBuf, &tableToken.type); bool dbIncluded = false; // Check if the table name available or not if (tscValidateName(&tableToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) { @@ -1839,7 +1840,7 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLine const char *start, *cur; int32_t ret = TSDB_CODE_SUCCESS; int len = 0; - char key[] = "_ts"; + char key[] = "ts"; char *value = NULL; start = cur = *index; @@ -1870,24 +1871,14 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLine bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) { char *val = NULL; - char *cur = key; - char keyLower[TSDB_COL_NAME_LEN]; - size_t keyLen = 0; - while(*cur != '\0') { - keyLower[keyLen] = tolower(*cur); - keyLen++; - cur++; - } - keyLower[keyLen] = '\0'; - - val = taosHashGet(pHash, keyLower, keyLen); + val = taosHashGet(pHash, key, strlen(key)); if (val) { - tscError("SML:0x%"PRIx64" Duplicate key detected:%s", info->id, keyLower); + tscError("SML:0x%"PRIx64" Duplicate key detected:%s", info->id, key); return true; } uint8_t dummy_val = 0; - taosHashPut(pHash, keyLower, strlen(key), &dummy_val, sizeof(uint8_t)); + taosHashPut(pHash, key, strlen(key), &dummy_val, sizeof(uint8_t)); return false; } @@ -1925,7 +1916,6 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash pKV->key = calloc(len + TS_ESCAPE_CHAR_SIZE + 1, 1); memcpy(pKV->key, key, len + 1); - strntolower_s(pKV->key, pKV->key, (int32_t)len); addEscapeCharToString(pKV->key, len); tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len); *index = cur + 1; @@ -2053,7 +2043,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index if (*cur == '\\') { escapeSpecialCharacter(1, &cur); } - pSml->stableName[len] = tolower(*cur); + pSml->stableName[len] = *cur; cur++; len++; } @@ -2129,7 +2119,6 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, if (!isField && childTableNameLen != 0 && strcasecmp(pkv->key, childTableName) == 0) { smlData->childTableName = malloc(pkv->length + TS_ESCAPE_CHAR_SIZE + 1); memcpy(smlData->childTableName, pkv->value, pkv->length); - strntolower_s(smlData->childTableName, smlData->childTableName, (int32_t)pkv->length); addEscapeCharToString(smlData->childTableName, (int32_t)pkv->length); free(pkv->key); free(pkv->value); diff --git a/src/client/src/tscParseOpenTSDB.c b/src/client/src/tscParseOpenTSDB.c index e78abf0596447df0ee58db88ca87b19011293c6c..d064ede134129d796928768910c56573712319d1 100644 --- a/src/client/src/tscParseOpenTSDB.c +++ b/src/client/src/tscParseOpenTSDB.c @@ -65,7 +65,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index, } } - pSml->stableName[len] = tolower(*cur); + pSml->stableName[len] = *cur; cur++; len++; @@ -195,8 +195,9 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch } tfree(value); - pVal->key = tcalloc(sizeof(key), 1); + pVal->key = tcalloc(sizeof(key) + TS_ESCAPE_CHAR_SIZE, 1); memcpy(pVal->key, key, sizeof(key)); + addEscapeCharToString(pVal->key, (int32_t)strlen(pVal->key)); *num_kvs += 1; *index = cur + 1; @@ -240,7 +241,6 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj pKV->key = tcalloc(len + TS_ESCAPE_CHAR_SIZE + 1, 1); memcpy(pKV->key, key, len + 1); - strntolower_s(pKV->key, pKV->key, (int32_t)len); addEscapeCharToString(pKV->key, len); //tscDebug("OTD:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len); *index = cur + 1; @@ -326,7 +326,6 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs, *childTableName = tcalloc(pkv->length + TS_ESCAPE_CHAR_SIZE + 1, 1); memcpy(*childTableName, pkv->value, pkv->length); (*childTableName)[pkv->length] = '\0'; - strntolower_s(*childTableName, *childTableName, (int32_t)pkv->length); addEscapeCharToString(*childTableName, pkv->length); tfree(pkv->key); tfree(pkv->value); @@ -514,7 +513,6 @@ static int32_t parseMetricFromJSON(cJSON *root, TAOS_SML_DATA_POINT* pSml, SSmlL */ tstrncpy(pSml->stableName, metric->valuestring, stableLen + 1); - strntolower_s(pSml->stableName, pSml->stableName, (int32_t)stableLen); addEscapeCharToString(pSml->stableName, (int32_t)stableLen); return TSDB_CODE_SUCCESS; @@ -545,7 +543,6 @@ static int32_t parseTimestampFromJSONObj(cJSON *root, int64_t *tsVal, SSmlLinesI } size_t typeLen = strlen(type->valuestring); - strntolower_s(type->valuestring, type->valuestring, (int32_t)typeLen); if (typeLen == 1 && type->valuestring[0] == 's') { //seconds *tsVal = (int64_t)(*tsVal * 1e9); @@ -881,8 +878,9 @@ static int32_t parseMetricValueFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *nu return ret; } - pVal->key = tcalloc(sizeof(key), 1); + pVal->key = tcalloc(sizeof(key) + TS_ESCAPE_CHAR_SIZE, 1); memcpy(pVal->key, key, sizeof(key)); + addEscapeCharToString(pVal->key, (int32_t)strlen(pVal->key)); *num_kvs += 1; return TSDB_CODE_SUCCESS; @@ -913,7 +911,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, size_t idLen = strlen(id->valuestring); *childTableName = tcalloc(idLen + TS_ESCAPE_CHAR_SIZE + 1, sizeof(char)); memcpy(*childTableName, id->valuestring, idLen); - strntolower_s(*childTableName, *childTableName, (int32_t)idLen); addEscapeCharToString(*childTableName, (int32_t)idLen); //check duplicate IDs @@ -952,7 +949,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, } pkv->key = tcalloc(keyLen + TS_ESCAPE_CHAR_SIZE + 1, sizeof(char)); strncpy(pkv->key, tag->string, keyLen); - strntolower_s(pkv->key, pkv->key, (int32_t)keyLen); addEscapeCharToString(pkv->key, (int32_t)keyLen); //value ret = parseValueFromJSON(tag, pkv, info); diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 04dd7f57cabe8f01ade992cfe1d4a3122a26d130..215861295fa0ff94352956fa3fd740ace9e90766 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -48,12 +48,14 @@ typedef struct SMultiTbStmt { bool nameSet; bool tagSet; bool subSet; + bool tagColSet; uint64_t currentUid; char *sqlstr; uint32_t tbNum; SStrToken tbname; SStrToken stbname; SStrToken values; + SStrToken tagCols; SArray *tags; STableDataBlocks *lastBlock; SHashObj *pTableHash; @@ -1250,6 +1252,12 @@ static void insertBatchClean(STscStmt* pStmt) { pCmd->insertParam.pDataBlocks = tscDestroyBlockArrayList(pSql, pCmd->insertParam.pDataBlocks); pCmd->insertParam.numOfTables = 0; + STableDataBlocks** p = taosHashIterate(pCmd->insertParam.pTableBlockHashList, NULL); + while(p) { + tfree((*p)->pData); + p = taosHashIterate(pCmd->insertParam.pTableBlockHashList, p); + } + taosHashClear(pCmd->insertParam.pTableBlockHashList); tscFreeSqlResult(pSql); tscFreeSubobj(pSql); @@ -1343,9 +1351,40 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { pStmt->mtb.stbname = sToken; sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); - if (sToken.n <= 0 || sToken.type != TK_TAGS) { - tscError("keyword TAGS expected, sql:%s", pCmd->insertParam.sql); - return tscSQLSyntaxErrMsg(pCmd->payload, "keyword TAGS expected", sToken.z ? sToken.z : pCmd->insertParam.sql); + if (sToken.n <= 0 || ((sToken.type != TK_TAGS) && (sToken.type != TK_LP))) { + tscError("invalid token, sql:%s", pCmd->insertParam.sql); + return tscSQLSyntaxErrMsg(pCmd->payload, "invalid token", sToken.z ? sToken.z : pCmd->insertParam.sql); + } + + // ... (tag_col_list) TAGS(tag_val_list) ... + int32_t tagColsCnt = 0; + if (sToken.type == TK_LP) { + pStmt->mtb.tagColSet = true; + pStmt->mtb.tagCols = sToken; + int32_t tagColsStart = index; + while (1) { + sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); + if (sToken.type == TK_ILLEGAL) { + return tscSQLSyntaxErrMsg(pCmd->payload, "unrecognized token", sToken.z); + } + if (sToken.type == TK_ID) { + ++tagColsCnt; + } + if (sToken.type == TK_RP) { + break; + } + } + if (tagColsCnt == 0) { + tscError("tag column list expected, sql:%s", pCmd->insertParam.sql); + return tscSQLSyntaxErrMsg(pCmd->payload, "tag column list expected", pCmd->insertParam.sql); + } + pStmt->mtb.tagCols.n = index - tagColsStart + 1; + + sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); + if (sToken.n <= 0 || sToken.type != TK_TAGS) { + tscError("keyword TAGS expected, sql:%s", pCmd->insertParam.sql); + return tscSQLSyntaxErrMsg(pCmd->payload, "keyword TAGS expected", sToken.z ? sToken.z : pCmd->insertParam.sql); + } } sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); @@ -1385,6 +1424,11 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { return tscSQLSyntaxErrMsg(pCmd->payload, "no tags", pCmd->insertParam.sql); } + if (tagColsCnt > 0 && taosArrayGetSize(pStmt->mtb.tags) != tagColsCnt) { + tscError("not match tags, sql:%s", pCmd->insertParam.sql); + return tscSQLSyntaxErrMsg(pCmd->payload, "not match tags", pCmd->insertParam.sql); + } + sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); if (sToken.n <= 0 || (sToken.type != TK_VALUES && sToken.type != TK_LP)) { tscError("sql error, sql:%s", pCmd->insertParam.sql); @@ -1407,7 +1451,13 @@ int stmtGenInsertStatement(SSqlObj* pSql, STscStmt* pStmt, const char* name, TAO int32_t j = 0; while (1) { - len = (size_t)snprintf(str, size - 1, "insert into %s using %.*s tags(", name, pStmt->mtb.stbname.n, pStmt->mtb.stbname.z); + if (pStmt->mtb.tagColSet) { + len = (size_t)snprintf(str, size - 1, "insert into %s using %.*s %.*s tags(", + name, pStmt->mtb.stbname.n, pStmt->mtb.stbname.z, pStmt->mtb.tagCols.n, pStmt->mtb.tagCols.z); + } else { + len = (size_t)snprintf(str, size - 1, "insert into %s using %.*s tags(", name, pStmt->mtb.stbname.n, pStmt->mtb.stbname.z); + } + if (len >= (size -1)) { size *= 2; free(str); @@ -1573,7 +1623,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { pRes->qId = 0; pRes->numOfRows = 0; - strtolower(pSql->sqlstr, sql); + strcpy(pSql->sqlstr, sql); tscDebugL("0x%"PRIx64" SQL: %s", pSql->self, pSql->sqlstr); if (tscIsInsertData(pSql->sqlstr)) { @@ -1659,6 +1709,13 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags STMT_RET(TSDB_CODE_TSC_APP_ERROR); } + if ((*t1)->pData == NULL) { + code = tscCreateDataBlockData(*t1, TSDB_PAYLOAD_SIZE, (*t1)->pTableMeta->tableInfo.rowSize, sizeof(SSubmitBlk)); + if (code != TSDB_CODE_SUCCESS) { + STMT_RET(code); + } + } + SSubmitBlk* pBlk = (SSubmitBlk*) (*t1)->pData; pCmd->batchSize = pBlk->numOfRows; if (pBlk->numOfRows == 0) { @@ -1784,7 +1841,6 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags STMT_RET(code); } - int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name) { STscStmt* pStmt = (STscStmt*)stmt; STMT_CHECK @@ -1792,8 +1848,6 @@ int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name) { return taos_stmt_set_tbname_tags(stmt, name, NULL); } - - int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) { STscStmt* pStmt = (STscStmt*)stmt; STMT_CHECK @@ -1801,7 +1855,6 @@ int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) { return taos_stmt_set_tbname_tags(stmt, name, NULL); } - int taos_stmt_close(TAOS_STMT* stmt) { STscStmt* pStmt = (STscStmt*)stmt; if (pStmt == NULL || pStmt->taos == NULL) { @@ -1868,7 +1921,6 @@ int taos_stmt_bind_param(TAOS_STMT* stmt, TAOS_BIND* bind) { } } - int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind) { STscStmt* pStmt = (STscStmt*)stmt; @@ -1932,8 +1984,6 @@ int taos_stmt_bind_single_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, in STMT_RET(insertStmtBindParamBatch(pStmt, bind, colIdx)); } - - int taos_stmt_add_batch(TAOS_STMT* stmt) { STscStmt* pStmt = (STscStmt*)stmt; STMT_CHECK @@ -2086,7 +2136,6 @@ int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) { } } - char *taos_stmt_errstr(TAOS_STMT *stmt) { STscStmt* pStmt = (STscStmt*)stmt; @@ -2097,8 +2146,6 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) { return taos_errstr(pStmt->pSql); } - - const char *taos_data_type(int type) { switch (type) { case TSDB_DATA_TYPE_NULL: return "TSDB_DATA_TYPE_NULL"; @@ -2115,4 +2162,3 @@ const char *taos_data_type(int type) { default: return "UNKNOWN"; } } - diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index a9770febf7e0aefbba6f9c2e5569529c12f10a7c..1ea9efb98afee63ef701e527b01bbb3a737a1db2 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -102,6 +102,7 @@ static int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQuery static int32_t validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql); static int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode); +static int32_t validateRangeNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode); static int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSchema* pSchema); static int32_t tsRewriteFieldNameIfNecessary(SSqlCmd* pCmd, SQueryInfo* pQueryInfo); @@ -117,7 +118,6 @@ static int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo, int32_t killTy static int32_t setCompactVnodeInfo(SSqlObj* pSql, struct SSqlInfo* pInfo); static int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField); -static bool hasTimestampForPointInterpQuery(SQueryInfo* pQueryInfo); static bool hasNormalColumnFilter(SQueryInfo* pQueryInfo); static int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSqlObj* pSql); @@ -442,10 +442,12 @@ int32_t readFromFile(char *name, uint32_t *len, void **buf) { int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) { - const char *msg1 = "invalidate function name"; + const char *msg1 = "invalid function name or length"; const char *msg2 = "path is too long"; const char *msg3 = "invalid outputtype"; + #ifdef LUA_EMBEDDED const char *msg4 = "invalid script"; + #endif const char *msg5 = "invalid dyn lib"; SSqlCmd *pCmd = &pSql->cmd; @@ -484,9 +486,12 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) { } //validate *.lua or .so int32_t pathLen = (int32_t)strlen(createInfo->path.z); +#ifdef LUA_EMBEDDED if ((pathLen > 4) && (0 == strncmp(createInfo->path.z + pathLen - 4, ".lua", 4)) && !isValidScript(buf, len)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); - } else if (pathLen > 3 && (0 == strncmp(createInfo->path.z + pathLen - 3, ".so", 3))) { + } else +#endif + if (pathLen > 3 && (0 == strncmp(createInfo->path.z + pathLen - 3, ".so", 3))) { void *handle = taosLoadDll(createInfo->path.z); taosCloseDll(handle); if (handle == NULL) { @@ -1126,7 +1131,8 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS const char* msg1 = "sliding cannot be used without interval"; const char* msg2 = "interval cannot be less than 1 us"; const char* msg3 = "interval value is too small"; - const char* msg4 = "only point interpolation query requires keyword EVERY"; + const char* msg4 = "invalid usage of EVERY"; + const char* msg5 = "EVERY instead of INTERVAL required for interp clause"; SSqlCmd* pCmd = &pSql->cmd; @@ -1138,6 +1144,12 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + + if (interpQuery) { + return addPrimaryTsColumnForTimeWindowQuery(pQueryInfo, pCmd); + } + return TSDB_CODE_SUCCESS; } @@ -1172,11 +1184,15 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS return TSDB_CODE_TSC_INVALID_OPERATION; } - bool interpQuery = tscIsPointInterpQuery(pQueryInfo); - if ((pSqlNode->interval.token == TK_EVERY && (!interpQuery)) || (pSqlNode->interval.token == TK_INTERVAL && interpQuery)) { + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + if (pSqlNode->interval.token == TK_EVERY && (!interpQuery)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); } + if (pSqlNode->interval.token == TK_INTERVAL && interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); + } + // The following part is used to check for the invalid query expression. return checkInvalidExprForTimeWindow(pCmd, pQueryInfo); } @@ -1188,6 +1204,7 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS const char* msg3 = "not support state_window with group by "; const char* msg4 = "function not support for super table query"; const char* msg5 = "not support state_window on tag column"; + const char* msg6 = "function not support for state_window"; SStrToken *col = &(pSqlNode->windowstateVal.col) ; if (col->z == NULL || col->n <= 0) { @@ -1233,6 +1250,11 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); + } + tscColumnListInsert(pQueryInfo->colList, index.columnIndex, pTableMeta->id.uid, pSchema); SColIndex colIndex = { .colIndex = index.columnIndex, .flag = TSDB_COL_NORMAL, .colId = pSchema->colId }; taosArrayPush(pGroupExpr->columnInfo, &colIndex); @@ -1246,6 +1268,7 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS const char* msg2 = "only one type time window allowed"; const char* msg3 = "invalid column name"; const char* msg4 = "invalid time window"; + const char* msg5 = "function not support for session"; STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); @@ -1281,6 +1304,11 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); + } + pQueryInfo->sessionWindow.primaryColId = PRIMARYKEY_TIMESTAMP_COL_INDEX; // The following part is used to check for the invalid query expression. @@ -1291,6 +1319,7 @@ int32_t parseIntervalOffset(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* of const char* msg1 = "interval offset cannot be negative"; const char* msg2 = "interval offset should be shorter than interval"; const char* msg3 = "cannot use 'year' as offset when interval is 'month'"; + const char* msg4 = "wrong every format"; STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); @@ -1302,6 +1331,11 @@ int32_t parseIntervalOffset(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* of return TSDB_CODE_SUCCESS; } + bool interpQuery = tscIsPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } + if (parseNatualDuration(t->z, t->n, &pQueryInfo->interval.offset, &pQueryInfo->interval.offsetUnit, tinfo.precision) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_OPERATION; @@ -1340,6 +1374,7 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl const char* msg1 = "sliding value no larger than the interval value"; const char* msg2 = "sliding value can not less than 1% of interval value"; const char* msg3 = "does not support sliding when interval is natural month/year"; + const char* msg4 = "sliding not support for interp query"; const static int32_t INTERVAL_SLIDING_FACTOR = 100; @@ -1353,6 +1388,11 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl return TSDB_CODE_SUCCESS; } + bool interpQuery = tscIsPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } + if (pInterval->intervalUnit == 'n' || pInterval->intervalUnit == 'y') { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } @@ -1454,7 +1494,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) { const char* msg3 = "duplicated column names"; const char* msg4 = "invalid data type"; const char* msg5 = "invalid binary/nchar column length"; - const char* msg6 = "invalid column name"; + const char* msg6 = "invalid column name or length"; const char* msg7 = "too many columns"; // number of fields no less than 2 @@ -1524,7 +1564,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC const char* msg3 = "duplicated column names"; //const char* msg4 = "timestamp not allowed in tags"; const char* msg5 = "invalid data type in tags"; - const char* msg6 = "invalid tag name"; + const char* msg6 = "invalid tag name or length"; const char* msg7 = "invalid binary/nchar tag length"; const char* msg8 = "only support one tag if include json type"; @@ -1602,7 +1642,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC */ int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField) { const char* msg3 = "tag length too long"; - const char* msg4 = "invalid tag name"; + const char* msg4 = "invalid tag name or length"; const char* msg5 = "invalid binary/nchar tag length"; const char* msg6 = "invalid data type in tags"; const char* msg7 = "too many columns"; @@ -1683,7 +1723,7 @@ int32_t validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) { const char* msg1 = "too many columns"; const char* msg3 = "column length too long"; const char* msg4 = "invalid data type"; - const char* msg5 = "invalid column name"; + const char* msg5 = "invalid column name or length"; const char* msg6 = "invalid column length"; // assert(pCmd->numOfClause == 1); @@ -2058,7 +2098,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS const char* msg8 = "not support distinct in nest query"; const char* msg9 = "_block_dist not support subquery, only support stable/table"; const char* msg10 = "not support group by in block func"; - const char* msg11 = "invalid alias name"; + const char* msg11 = "invalid alias name or length"; // too many result columns not support order by in query if (taosArrayGetSize(pSelNodeList) > TSDB_MAX_COLUMNS) { @@ -2078,9 +2118,12 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS int32_t outputIndex = (int32_t)tscNumOfExprs(pQueryInfo); tSqlExprItem* pItem = taosArrayGet(pSelNodeList, i); if (hasDistinct == false) { - hasDistinct = (pItem->distinct == true); - distIdx = hasDistinct ? i : -1; - } + hasDistinct = (pItem->distinct == true); + distIdx = hasDistinct ? i : -1; + } + if(pItem->aliasName != NULL && validateColumnName(pItem->aliasName) != TSDB_CODE_SUCCESS){ + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg11); + } if(pItem->aliasName != NULL && validateColumnName(pItem->aliasName) != TSDB_CODE_SUCCESS){ return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg11); @@ -2413,10 +2456,16 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return -1; } + } else if (f == TSDB_FUNC_INTERP) { + int32_t t1 = pSchema->type; + if (!IS_NUMERIC_TYPE(t1)) { + invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + return -1; + } } int16_t resType = 0; - int16_t resBytes = 0; + int32_t resBytes = 0; int32_t interBufSize = 0; getResultDataInfo(pSchema->type, pSchema->bytes, f, 0, &resType, &resBytes, &interBufSize, 0, false, pUdfInfo); @@ -2655,7 +2704,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col } int16_t resultType = 0; - int16_t resultSize = 0; + int32_t resultSize = 0; int32_t intermediateResSize = 0; if (getResultDataInfo(pSchema->type, pSchema->bytes, functionId, 0, &resultType, &resultSize, @@ -2914,7 +2963,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col tVariant* pVariant = &pParamElem[1].pNode->value; int16_t resultType = pSchema->type; - int16_t resultSize = pSchema->bytes; + int32_t resultSize = pSchema->bytes; int32_t interResult = 0; char val[8] = {0}; @@ -3096,7 +3145,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col s = pTagSchema[index.columnIndex]; } - int16_t bytes = 0; + int32_t bytes = 0; int16_t type = 0; int32_t inter = 0; @@ -3123,7 +3172,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col int32_t inter = 0; int16_t resType = 0; - int16_t bytes = 0; + int32_t bytes = 0; getResultDataInfo(TSDB_DATA_TYPE_INT, 4, TSDB_FUNC_BLKINFO, 0, &resType, &bytes, &inter, 0, 0, NULL); @@ -3176,7 +3225,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col int32_t inter = 0; int16_t resType = 0; - int16_t bytes = 0; + int32_t bytes = 0; getResultDataInfo(TSDB_DATA_TYPE_INT, 4, functionId, 0, &resType, &bytes, &inter, 0, false, pUdfInfo); SExprInfo* pExpr = tscExprAppend(pQueryInfo, functionId, &index, resType, bytes, getNewResColId(pCmd), inter, false); @@ -3248,6 +3297,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // create tmp buf to avoid alter orginal sqlstr strncpy(tmpTokenBuf, pToken->z, pToken->n); + pToken->z = tmpTokenBuf; if (pToken->type == TK_ID) { @@ -3495,7 +3545,7 @@ int32_t tscTansformFuncForSTableQuery(SQueryInfo* pQueryInfo) { assert(tscGetNumOfTags(pTableMetaInfo->pTableMeta) >= 0); - int16_t bytes = 0; + int32_t bytes = 0; int16_t type = 0; int32_t interBytes = 0; @@ -3565,8 +3615,8 @@ void tscRestoreFuncForSTableQuery(SQueryInfo* pQueryInfo) { } bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { - const char* msg1 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE are not allowed to apply to super table directly"; - const char* msg2 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE only support group by tbname for super table query"; + const char* msg1 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE/INTERP are not allowed to apply to super table directly"; + const char* msg2 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE/INTERP only support group by tbname for super table query"; const char* msg3 = "functions not support for super table query"; // filter sql function not supported by metric query yet. @@ -3584,7 +3634,7 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) } if (tscIsTWAQuery(pQueryInfo) || tscIsDiffDerivLikeQuery(pQueryInfo) || tscIsIrateQuery(pQueryInfo) || - tscQueryContainsFunction(pQueryInfo, TSDB_FUNC_SAMPLE)) { + tscQueryContainsFunction(pQueryInfo, TSDB_FUNC_SAMPLE) || tscGetPointInterpQuery(pQueryInfo)) { if (pQueryInfo->groupbyExpr.numOfGroupCols == 0) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return true; @@ -3595,6 +3645,11 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return true; } + + if (tscGetPointInterpQuery(pQueryInfo) && taosArrayGetSize(pQueryInfo->groupbyExpr.columnInfo) > 1) { + invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); + return true; + } } else if (tscIsSessionWindowQuery(pQueryInfo)) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return true; @@ -5603,7 +5658,7 @@ validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql) { if (taosArrayGetSize(pQueryInfo->pUpstream) > 0 && condExpr.pTimewindow != NULL) { setNormalExprToCond(&condExpr.pColumnCond, condExpr.pTimewindow, TK_AND); - condExpr.pTimewindow = NULL; + condExpr.pTimewindow = tSqlExprClone(condExpr.pTimewindow); } tSqlExprCompact(pExpr); @@ -5786,13 +5841,14 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo const char* msg3 = "top/bottom/sample not support fill"; const char* msg4 = "illegal value or data overflow"; const char* msg5 = "fill only available for interval query"; - const char* msg6 = "not supported function now"; const char* msg7 = "join query not supported fill operation"; - if ((!isTimeWindowQuery(pQueryInfo)) && (!tscIsPointInterpQuery(pQueryInfo))) { + bool pointInterp = tscIsPointInterpQuery(pQueryInfo); + if ((!isTimeWindowQuery(pQueryInfo)) && (!pointInterp)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); } - if(QUERY_IS_JOIN_QUERY(pQueryInfo->type)) { + + if (QUERY_IS_JOIN_QUERY(pQueryInfo->type) && (!pointInterp)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); } @@ -5800,11 +5856,10 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo * fill options are set at the end position, when all columns are set properly * the columns may be increased due to group by operation */ - if (checkQueryRangeForFill(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS) { + if ((!pointInterp) && checkQueryRangeForFill(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_OPERATION; } - if (pItem->pVar.nType != TSDB_DATA_TYPE_BINARY) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -5829,9 +5884,6 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo } } else if (strncasecmp(pItem->pVar.pz, "prev", 4) == 0 && pItem->pVar.nLen == 4) { pQueryInfo->fillType = TSDB_FILL_PREV; - if (tscIsPointInterpQuery(pQueryInfo) && pQueryInfo->order.order == TSDB_ORDER_DESC) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); - } } else if (strncasecmp(pItem->pVar.pz, "next", 4) == 0 && pItem->pVar.nLen == 4) { pQueryInfo->fillType = TSDB_FILL_NEXT; } else if (strncasecmp(pItem->pVar.pz, "linear", 6) == 0 && pItem->pVar.nLen == 6) { @@ -5848,7 +5900,7 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo int32_t numOfFillVal = (int32_t)(num - 1); /* for point interpolation query, we do not have the timestamp column */ - if (tscIsPointInterpQuery(pQueryInfo)) { + if (pointInterp) { startPos = 0; if (numOfFillVal > numOfFields) { @@ -5875,7 +5927,7 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo } } - if ((num < numOfFields) || ((num - 1 < numOfFields) && (tscIsPointInterpQuery(pQueryInfo)))) { + if ((num < numOfFields) || ((num - 1 < numOfFields) && pointInterp)) { tVariantListItem* lastItem = taosArrayGetLast(pFillToken); for (int32_t i = numOfFillVal; i < numOfFields; ++i) { @@ -5904,6 +5956,55 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo return TSDB_CODE_SUCCESS; } + + +int32_t validateRangeNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode) { + const char *msg0 = "invalid usage of range clause"; + const char* msg1 = "invalid timestamp in range"; + SSqlCmd* pCmd = &pSql->cmd; + + bool interpQuery = tscIsPointInterpQuery(pQueryInfo); + + if ((!interpQuery) && (pSqlNode->pRange.start || pSqlNode->pRange.end)) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0); + } + + if (pSqlNode->pRange.start == NULL || pSqlNode->pRange.end == NULL) { + pQueryInfo->range.skey = INT64_MIN; + pQueryInfo->range.ekey = INT64_MIN; + + tscDebug("0x%"PRIx64" range [%"PRId64",%"PRId64"], ts [%"PRId64",%"PRId64"]", pSql->self, pQueryInfo->range.skey, pQueryInfo->range.ekey, pQueryInfo->window.skey, pQueryInfo->window.ekey); + return TSDB_CODE_SUCCESS; + } + + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); + + if (getTimeRange(&pQueryInfo->range, pSqlNode->pRange.start, TK_GE, tinfo.precision) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (getTimeRange(&pQueryInfo->range, pSqlNode->pRange.end, TK_LE, tinfo.precision) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pQueryInfo->range.ekey < pQueryInfo->range.skey) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if ((pQueryInfo->range.skey > pQueryInfo->window.ekey && (pQueryInfo->fillType == TSDB_FILL_NONE || pQueryInfo->fillType == TSDB_FILL_LINEAR || pQueryInfo->fillType == TSDB_FILL_NEXT)) + || (pQueryInfo->range.ekey < pQueryInfo->window.skey && (pQueryInfo->fillType == TSDB_FILL_NONE || pQueryInfo->fillType == TSDB_FILL_LINEAR || pQueryInfo->fillType == TSDB_FILL_PREV))) { + tscDebug("0x%"PRIx64" range [%"PRId64",%"PRId64"], ts [%"PRId64",%"PRId64"], no output result", pSql->self, pQueryInfo->range.skey, pQueryInfo->range.ekey, pQueryInfo->window.skey, pQueryInfo->window.ekey); + pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; + return TSDB_CODE_SUCCESS; + } + + tscDebug("0x%"PRIx64" range [%"PRId64",%"PRId64"], ts [%"PRId64",%"PRId64"]", pSql->self, pQueryInfo->range.skey, pQueryInfo->range.ekey, pQueryInfo->window.skey, pQueryInfo->window.ekey); + + return TSDB_CODE_SUCCESS; +} + + static void setDefaultOrderInfo(SQueryInfo* pQueryInfo) { /* set default timestamp order information for all queries */ STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -6285,14 +6386,19 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, DEFAULT_TABLE_INDEX); bool dbIncluded = false; - if (tscValidateName(&(pAlterSQL->name), true, &dbIncluded) != TSDB_CODE_SUCCESS) { + SStrToken tmpToken = pAlterSQL->name; + tmpToken.z= strndup(pAlterSQL->name.z, pAlterSQL->name.n); + if (tscValidateName(&tmpToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) { + free(tmpToken.z); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } - code = tscSetTableFullName(&pTableMetaInfo->name, &(pAlterSQL->name), pSql, dbIncluded); + code = tscSetTableFullName(&pTableMetaInfo->name, &tmpToken, pSql, dbIncluded); if (code != TSDB_CODE_SUCCESS) { + free(tmpToken.z); return code; } + free(tmpToken.z); code = tscGetTableMeta(pSql, pTableMetaInfo); if (code != TSDB_CODE_SUCCESS) { @@ -6482,6 +6588,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { // the schema is located after the pMsg body, then followed by true tag value char* d = pUpdateMsg->data; SSchema* pTagCols = tscGetTableTagSchema(pTableMeta); + for (int i = 0; i < numOfTags; ++i) { STColumn* pCol = (STColumn*) d; pCol->colId = htons(pTagCols[i].colId); @@ -6550,6 +6657,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen}; + + //handle Escape character backstick + bool inEscape = false; + if (name.z[0] == TS_ESCAPE_CHAR && name.z[name.n - 1] == TS_ESCAPE_CHAR) { + inEscape = true; + name.type = TK_ID; + } + if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(pMsg, msg17); } @@ -6560,6 +6675,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char name1[TSDB_COL_NAME_LEN] = {0}; tstrncpy(name1, pItem->pVar.pz, sizeof(name1)); + + int32_t nameLen = pItem->pVar.nLen; + if (inEscape) { + memmove(name1, name1 + 1, nameLen); + name1[nameLen - TS_ESCAPE_CHAR_SIZE] = '\0'; + } + TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); } else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { @@ -6575,11 +6697,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)}; + //handle Escape character backstick + bool inEscape = false; if (name.z[0] == TS_ESCAPE_CHAR && name.z[name.n - 1] == TS_ESCAPE_CHAR) { - memmove(name.z, name.z + 1, name.n); - name.z[name.n - TS_ESCAPE_CHAR_SIZE] = '\0'; - name.n -= TS_ESCAPE_CHAR_SIZE; + inEscape = true; + name.type = TK_ID; } if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) { @@ -6615,6 +6738,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { if (nLen >= TSDB_MAX_BYTES_PER_ROW) { return invalidOperationMsg(pMsg, msg24); } + + if (inEscape) { + memmove(name.z, name.z + 1, name.n); + name.z[name.n - TS_ESCAPE_CHAR_SIZE] = '\0'; + name.n -= TS_ESCAPE_CHAR_SIZE; + } + TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); }else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { @@ -6898,6 +7028,10 @@ int32_t validateLocalConfig(SMiscInfo* pOptions) { } int32_t validateColumnName(char* name) { + if (strlen(name) == 0) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + bool ret = taosIsKeyWordToken(name, (int32_t)strlen(name)); if (ret) { return TSDB_CODE_TSC_INVALID_OPERATION; @@ -6933,18 +7067,6 @@ int32_t validateColumnName(char* name) { return TSDB_CODE_SUCCESS; } -bool hasTimestampForPointInterpQuery(SQueryInfo* pQueryInfo) { - if (!tscIsPointInterpQuery(pQueryInfo)) { - return true; - } - - if (pQueryInfo->window.skey == INT64_MIN || pQueryInfo->window.ekey == INT64_MAX) { - return false; - } - - return !(pQueryInfo->window.skey != pQueryInfo->window.ekey && pQueryInfo->interval.interval == 0); -} - int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSqlObj* pSql) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -7432,7 +7554,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) { continue; } - if ((functionId == TSDB_FUNC_LAST_ROW) || + if ((functionId == TSDB_FUNC_LAST_ROW) || (functionId == TSDB_FUNC_INTERP) || (functionId == TSDB_FUNC_LAST_DST && (pExpr->base.colInfo.flag & TSDB_COL_NULL) != 0)) { // do nothing } else { @@ -7691,6 +7813,10 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) { const char* msg1 = "TWA/Diff/Derivative/Irate are not allowed to apply to super table without group by tbname"; + const char* msg2 = "group by not supported in nested interp query"; + const char* msg3 = "order by not supported in nested interp query"; + const char* msg4 = "first column should be timestamp for interp query"; + const char* msg5 = "interp input may be invalid"; int32_t numOfExprs = (int32_t)tscNumOfExprs(pQueryInfo); size_t upNum = taosArrayGetSize(pQueryInfo->pUpstream); @@ -7710,6 +7836,54 @@ int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) { } return invalidOperationMsg(msg, msg1); + } else if (f == TSDB_FUNC_INTERP) { + if (pQueryInfo->groupbyExpr.columnInfo) { + return invalidOperationMsg(msg, msg2); + } + + if (pQueryInfo->order.order == TSDB_ORDER_DESC || (pQueryInfo->order.orderColId != INT32_MIN && pQueryInfo->order.orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX)) { + return invalidOperationMsg(msg, msg3); + } + + for (int32_t j = 0; j < upNum; ++j) { + SQueryInfo* pUp = taosArrayGetP(pQueryInfo->pUpstream, j); + if (pUp->groupbyExpr.columnInfo) { + return invalidOperationMsg(msg, msg2); + } + + if (pUp->order.order == TSDB_ORDER_DESC || (pUp->order.orderColId != INT32_MIN && pUp->order.orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX)) { + return invalidOperationMsg(msg, msg3); + } + + int32_t exprNum = (int32_t)taosArrayGetSize(pUp->exprList); + if (exprNum > 0) { + SSqlExpr* expr = taosArrayGetP(pUp->exprList, 0); + if (expr->resType != TSDB_DATA_TYPE_TIMESTAMP) { + return invalidOperationMsg(msg, msg4); + } + + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pUp, 0); + bool isSTable = UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo); + if (!isSTable) { + continue; + } + + if (TSDB_QUERY_HAS_TYPE(pUp->type, TSDB_QUERY_TYPE_PROJECTION_QUERY)) { + return invalidOperationMsg(msg, msg5); + } + + for (int32_t n = 0; n < exprNum; ++n) { + expr = taosArrayGetP(pUp->exprList, n); + if (expr->functionId == TSDB_FUNC_TOP || + expr->functionId == TSDB_FUNC_BOTTOM || + expr->functionId == TSDB_FUNC_SAMPLE) { + if (expr->param[0].i64 > 1) { + return invalidOperationMsg(msg, msg5); + } + } + } + } + } } } @@ -9191,7 +9365,6 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInfo) { assert(pSqlNode != NULL && (pSqlNode->from == NULL || taosArrayGetSize(pSqlNode->from->list) > 0)); - const char* msg1 = "point interpolation query needs timestamp"; const char* msg2 = "too many tables in from clause"; const char* msg3 = "start(end) time of query range required or time range too large"; const char* msg4 = "interval query not supported, since the result of sub query not include valid timestamp column"; @@ -9261,7 +9434,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf for (int32_t i = 0; i < tscNumOfExprs(pQueryInfo); ++i) { SExprInfo* pExpr = tscExprGet(pQueryInfo, i); int32_t f = pExpr->base.functionId; - if (f == TSDB_FUNC_STDDEV || f == TSDB_FUNC_PERCT || f == TSDB_FUNC_INTERP) { + if (f == TSDB_FUNC_STDDEV || f == TSDB_FUNC_PERCT) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); } @@ -9364,6 +9537,10 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf if ((code = validateFillNode(pCmd, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { return code; } + + if ((code = validateRangeNode(pSql, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { + return code; + } } else { pQueryInfo->command = TSDB_SQL_SELECT; @@ -9471,10 +9648,6 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf return TSDB_CODE_SUCCESS; } - if (!hasTimestampForPointInterpQuery(pQueryInfo)) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); - } - // in case of join query, time range is required. if (QUERY_IS_JOIN_QUERY(pQueryInfo->type)) { uint64_t timeRange = (uint64_t)pQueryInfo->window.ekey - pQueryInfo->window.skey; @@ -9498,6 +9671,11 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf if ((code = validateFillNode(pCmd, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { return code; } + + if ((code = validateRangeNode(pSql, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { + return code; + } + } { // set the query info diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 2e1b480fb15eb72a7b6d228a7d72737b65f61156..6eaa5467f69c882066d4a62bbdb710c9df08e37e 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -916,7 +916,9 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pQueryMsg->window.skey = htobe64(query.window.skey); pQueryMsg->window.ekey = htobe64(query.window.ekey); - + pQueryMsg->range.skey = htobe64(query.range.skey); + pQueryMsg->range.ekey = htobe64(query.range.ekey); + pQueryMsg->order = htons(query.order.order); pQueryMsg->orderColId = htons(query.order.orderColId); pQueryMsg->fillType = htons(query.fillType); @@ -975,7 +977,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { if (pQueryInfo->colCond && taosArrayGetSize(pQueryInfo->colCond) > 0 && !onlyQueryTags(&query) ) { STblCond *pCond = tsGetTableFilter(pQueryInfo->colCond, pTableMeta->id.uid, 0); if (pCond != NULL && pCond->cond != NULL) { - pQueryMsg->colCondLen = htons(pCond->len); + pQueryMsg->colCondLen = htonl(pCond->len); memcpy(pMsg, pCond->cond, pCond->len); pMsg += pCond->len; @@ -1056,7 +1058,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCond *pCond = tsGetSTableQueryCond(pTagCond, pTableMeta->id.uid); if (pCond != NULL && pCond->cond != NULL) { - pQueryMsg->tagCondLen = htons(pCond->len); + pQueryMsg->tagCondLen = htonl(pCond->len); memcpy(pMsg, pCond->cond, pCond->len); pMsg += pCond->len; @@ -1535,7 +1537,17 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pMsg += sizeof(SCreateTableMsg); SCreatedTableInfo* p = taosArrayGet(list, i); - strcpy(pCreate->tableName, p->fullname); + //what pCreate->tableName point is a fixed char array which size is 237 + //what p->fullname point is a char* + //before the time we copy p->fullname to pCreate->tableName , we need to check the length of p->fullname + if (strlen(p->fullname) > 237) { + tscError("failed to write this name, which is over 237, just save the first 237 char here"); + strncpy(pCreate->tableName, p->fullname,237); + pCreate->tableName[236]='\0';//I don't know if this line is working properly + }else{ + strcpy(pCreate->tableName, p->fullname); + } + pCreate->igExists = (p->igExist)? 1 : 0; // use dbinfo from table id without modifying current db info @@ -3065,12 +3077,16 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) { pSql->rootObj->retryReason = pSql->retryReason; + SSqlObj *tmpSql = pSql->rootObj; + tscFreeSubobj(pSql->rootObj); + tfree(tmpSql->pSubs); + SArray* pNameList = taosArrayInit(1, POINTER_BYTES); SArray* vgroupList = taosArrayInit(1, POINTER_BYTES); char* n = strdup(name); taosArrayPush(pNameList, &n); - code = getMultiTableMetaFromMnode(pSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true); + code = getMultiTableMetaFromMnode(tmpSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true); taosArrayDestroyEx(pNameList, freeElem); taosArrayDestroyEx(vgroupList, freeElem); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 6b43eacd83c1cffac84d30c8c05c57d84688bcbb..d27fa15bf13b0f7ca15e4cb92b447f8d51b842ef 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -29,6 +29,7 @@ #include "ttimer.h" #include "tscProfile.h" +static char clusterDefaultId[] = "clusterDefaultId"; static bool validImpl(const char* str, size_t maxsize) { if (str == NULL) { return false; @@ -193,7 +194,9 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, tscBuildAndSendRequest(pSql, NULL); tsem_wait(&pSql->rspSem); - + if (0 == strlen(pSql->pTscObj->clusterId)) { + memcpy(pSql->pTscObj->clusterId, clusterDefaultId, strlen(clusterDefaultId)); + } pSql->pTscObj->pClusterInfo = (SClusterInfo *)tscAcquireClusterInfo(pSql->pTscObj->clusterId); if (pSql->res.code != TSDB_CODE_SUCCESS) { terrno = pSql->res.code; diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 5e70c814133fd93b7619022a1d564050c3c0502a..5a26397c5a260f8ee527a05bbfc700b53a23951c 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -468,7 +468,7 @@ SSqlObj* recreateSqlObj(SSub* pSub) { } registerSqlObj(pSql); - + pSql->rootObj = pSql; code = tsParseSql(pSql, true); if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) { tsem_wait(&pSub->sem); diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 15119281e289485bac5c146de170767174407f6b..381756679eda2205795617077642b0aece3f003d 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -397,6 +397,12 @@ SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index) { memcpy(&pSupporter->interval, &pQueryInfo->interval, sizeof(pSupporter->interval)); pSupporter->limit = pQueryInfo->limit; + if (tscIsPointInterpQuery(pQueryInfo)) { + pSupporter->fillType = pQueryInfo->fillType; + pSupporter->fillVal = pQueryInfo->fillVal; + pSupporter->numOfFillVal = pQueryInfo->numOfFillVal; + } + STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, index); pSupporter->uid = pTableMetaInfo->pTableMeta->id.uid; assert (pSupporter->uid != 0); @@ -582,6 +588,13 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { pQueryInfo->fieldsInfo = pSupporter->fieldsInfo; pQueryInfo->groupbyExpr = pSupporter->groupInfo; pQueryInfo->pUpstream = taosArrayInit(4, sizeof(POINTER_BYTES)); + + if (tscIsPointInterpQuery(pQueryInfo)) { + pQueryInfo->fillType = pSupporter->fillType; + pQueryInfo->numOfFillVal = pSupporter->numOfFillVal; + pQueryInfo->fillVal = malloc(pQueryInfo->numOfFillVal * sizeof(*pSupporter->fillVal)); + memcpy(pQueryInfo->fillVal, pSupporter->fillVal, sizeof(*pSupporter->fillVal) * pQueryInfo->numOfFillVal); + } assert(pNew->subState.numOfSub == 0 && pQueryInfo->numOfTables == 1); @@ -2014,7 +2027,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter colIndex.columnIndex = tscGetTagColIndexById(pTableMetaInfo->pTableMeta, tagColId); - int16_t bytes = 0; + int32_t bytes = 0; int16_t type = 0; int32_t inter = 0; @@ -2650,7 +2663,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { pRes->qId = 0x1; // hack the qhandle check - const uint32_t nBufferSize = (1u << 18u); // 256KB, default buffer size + uint32_t nBufferSize = (1u << 18u); // 256KB, default buffer size SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -2666,7 +2679,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { return ret; } - ret = tscCreateGlobalMergerEnv(pQueryInfo, &pMemoryBuf, pSql->subState.numOfSub, &pDesc, nBufferSize, pSql->self); + ret = tscCreateGlobalMergerEnv(pQueryInfo, &pMemoryBuf, pSql->subState.numOfSub, &pDesc, &nBufferSize, pSql->self); if (ret != 0) { pRes->code = ret; tscAsyncResultOnError(pSql); diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index edb8169f761e2b5aaba1ddfd7cda8a9008298948..3b3770dae978f079576799190771b9c628cafb31 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -133,8 +133,8 @@ void tscClusterInfoDestroy(SClusterInfo *pObj) { void *tscAcquireClusterInfo(const char *clusterId) { pthread_mutex_lock(&clusterMutex); - size_t len = strlen(clusterId); + SClusterInfo *pObj = NULL; SClusterInfo **ppObj = taosHashGet(tscClusterMap, clusterId, len); if (ppObj == NULL || *ppObj == NULL) { @@ -210,9 +210,9 @@ void taos_init_imp(void) { taosInitNotes(); rpcInit(); - +#ifdef LUA_EMBEDDED scriptEnvPoolInit(); - +#endif tscDebug("starting to initialize TAOS client ..."); tscDebug("Local End Point is:%s", tsLocalEp); } @@ -276,7 +276,9 @@ void taos_cleanup(void) { } if (tscEmbedded == 0) { + #ifdef LUA_EMBEDDED scriptEnvPoolCleanup(); + #endif } int32_t id = tscObjRef; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 8a92a982a706887b3de43098f200a8a5757f5108..0018d9459a0fd25e0d11aa5f9530d13589769962 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -189,7 +189,7 @@ bool tscQueryTags(SQueryInfo* pQueryInfo) { continue; } - if (functId != TSDB_FUNC_TAGPRJ && functId != TSDB_FUNC_TID_TAG) { + if (functId != TSDB_FUNC_TAGPRJ && functId != TSDB_FUNC_TID_TAG && functId != TSDB_FUNC_BLKINFO) { return false; } } @@ -270,10 +270,6 @@ bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex) { functionId != TSDB_FUNC_TS && functionId != TSDB_FUNC_ARITHM && functionId != TSDB_FUNC_TS_COMP && - functionId != TSDB_FUNC_DIFF && - functionId != TSDB_FUNC_DERIVATIVE && - functionId != TSDB_FUNC_MAVG && - functionId != TSDB_FUNC_CSUM && functionId != TSDB_FUNC_TS_DUMMY && functionId != TSDB_FUNC_TID_TAG && functionId != TSDB_FUNC_CEIL && @@ -369,7 +365,7 @@ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo) { assert(pExpr != NULL); int32_t functionId = pExpr->base.functionId; - if (functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TS) { + if (functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS || functionId == TSDB_FUNC_TS_DUMMY) { continue; } @@ -381,6 +377,23 @@ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo) { return true; } +bool tscGetPointInterpQuery(SQueryInfo* pQueryInfo) { + size_t size = tscNumOfExprs(pQueryInfo); + for (int32_t i = 0; i < size; ++i) { + SExprInfo* pExpr = tscExprGet(pQueryInfo, i); + assert(pExpr != NULL); + + int32_t functionId = pExpr->base.functionId; + + if (functionId == TSDB_FUNC_INTERP) { + return true; + } + } + + return false; +} + + bool tsIsArithmeticQueryOnAggResult(SQueryInfo* pQueryInfo) { if (tscIsProjectionQuery(pQueryInfo)) { return false; @@ -994,23 +1007,30 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) { pBlock->info.rows = pRes->numOfRows; if (pRes->numOfRows != 0) { doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo); - *newgroup = false; - return pBlock; + if (pBlock->info.rows > 0) { + *newgroup = false; + return pBlock; + } } - // No data block exists. So retrieve and transfer it into to SSDataBlock - TAOS_ROW pRow = NULL; - taos_fetch_block(pSql, &pRow); + SSDataBlock* result = NULL; + do { + // No data block exists. So retrieve and transfer it into to SSDataBlock + TAOS_ROW pRow = NULL; + taos_fetch_block(pSql, &pRow); - if (pRes->numOfRows == 0) { - pOperator->status = OP_EXEC_DONE; - return NULL; - } + if (pRes->numOfRows == 0) { + pOperator->status = OP_EXEC_DONE; + result = NULL; + break; + } + pBlock->info.rows = pRes->numOfRows; + doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo); + *newgroup = false; + result = pBlock; + } while (result->info.rows == 0); - pBlock->info.rows = pRes->numOfRows; - doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo); - *newgroup = false; - return pBlock; + return result; } static void fetchNextBlockIfCompleted(SOperatorInfo* pOperator, bool* newgroup) { @@ -1890,6 +1910,32 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff return TSDB_CODE_TSC_OUT_OF_MEMORY; } + int32_t code = tscCreateDataBlockData(dataBuf, defaultSize, rowSize, startOffset); + if (code != TSDB_CODE_SUCCESS) { + tfree(dataBuf); + return code; + } + + //Here we keep the tableMeta to avoid it to be remove by other threads. + dataBuf->pTableMeta = tscTableMetaDup(pTableMeta); + + SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo; + SSchema* pSchema = tscGetTableSchema(dataBuf->pTableMeta); + tscSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns); + + dataBuf->vgId = dataBuf->pTableMeta->vgId; + + tNameAssign(&dataBuf->tableName, name); + + assert(defaultSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL); + + *dataBlocks = dataBuf; + return TSDB_CODE_SUCCESS; +} + +int32_t tscCreateDataBlockData(STableDataBlocks* dataBuf, size_t defaultSize, int32_t rowSize, int32_t startOffset) { + assert(dataBuf != NULL); + dataBuf->nAllocSize = (uint32_t)defaultSize; dataBuf->headerSize = startOffset; @@ -1902,30 +1948,16 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff dataBuf->pData = malloc(dataBuf->nAllocSize); if (dataBuf->pData == NULL) { tscError("failed to allocated memory, reason:%s", strerror(errno)); - tfree(dataBuf); return TSDB_CODE_TSC_OUT_OF_MEMORY; } memset(dataBuf->pData, 0, sizeof(SSubmitBlk)); - //Here we keep the tableMeta to avoid it to be remove by other threads. - dataBuf->pTableMeta = tscTableMetaDup(pTableMeta); - - SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo; - SSchema* pSchema = tscGetTableSchema(dataBuf->pTableMeta); - tscSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns); - dataBuf->ordered = true; dataBuf->prevTS = INT64_MIN; dataBuf->rowSize = rowSize; dataBuf->size = startOffset; dataBuf->tsSource = -1; - dataBuf->vgId = dataBuf->pTableMeta->vgId; - - tNameAssign(&dataBuf->tableName, name); - assert(defaultSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL); - - *dataBlocks = dataBuf; return TSDB_CODE_SUCCESS; } @@ -3474,10 +3506,11 @@ int32_t tscQueryInfoCopy(SQueryInfo* pQueryInfo, const SQueryInfo* pSrc) { pQueryInfo->clauseLimit = pSrc->clauseLimit; pQueryInfo->prjOffset = pSrc->prjOffset; pQueryInfo->numOfTables = 0; - pQueryInfo->window = pSrc->window; + pQueryInfo->range = pSrc->range; pQueryInfo->sessionWindow = pSrc->sessionWindow; pQueryInfo->pTableMetaInfo = NULL; pQueryInfo->multigroupResult = pSrc->multigroupResult; + pQueryInfo->stateWindow = pSrc->stateWindow; pQueryInfo->bufLen = pSrc->bufLen; pQueryInfo->orderProjectQuery = pSrc->orderProjectQuery; @@ -3867,6 +3900,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t memcpy(&pNewQueryInfo->interval, &pQueryInfo->interval, sizeof(pNewQueryInfo->interval)); pNewQueryInfo->type = pQueryInfo->type; pNewQueryInfo->window = pQueryInfo->window; + pNewQueryInfo->range = pQueryInfo->range; pNewQueryInfo->limit = pQueryInfo->limit; pNewQueryInfo->slimit = pQueryInfo->slimit; pNewQueryInfo->order = pQueryInfo->order; @@ -4881,7 +4915,7 @@ int32_t createProjectionExpr(SQueryInfo* pQueryInfo, STableMetaInfo* pTableMetaI } } - pse->colInfo.flag = TSDB_COL_NORMAL; + pse->colInfo.flag = pSource->base.colInfo.flag; //TSDB_COL_NORMAL; pse->resType = pSource->base.resType; pse->resBytes = pSource->base.resBytes; strncpy(pse->colInfo.name, pSource->base.aliasName, tListLen(pse->colInfo.name)); @@ -5086,6 +5120,7 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt pQueryAttr->fillType = pQueryInfo->fillType; pQueryAttr->havingNum = pQueryInfo->havingFieldNum; pQueryAttr->pUdfInfo = pQueryInfo->pUdfInfo; + pQueryAttr->range = pQueryInfo->range; if (pQueryInfo->order.order == TSDB_ORDER_ASC) { // TODO refactor pQueryAttr->window = pQueryInfo->window; diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index bd201d980017522d0e32f6124290305d5b136f8d..317d48ea5987935c5d53af6ad578834071643f26 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -148,6 +148,7 @@ extern char tsMqttTopic[]; // monitor extern int8_t tsEnableMonitorModule; +extern int8_t tsMonitorReplica; extern char tsMonitorDbName[]; extern char tsInternalPass[]; extern int32_t tsMonitorInterval; diff --git a/src/common/inc/tname.h b/src/common/inc/tname.h index 22a6955026f4ff9adaf0cd8d262652ef75f534db..7a401d8a7f71c094654d06a2ed37ae3fd7fc9c94 100644 --- a/src/common/inc/tname.h +++ b/src/common/inc/tname.h @@ -51,7 +51,7 @@ typedef struct SSqlExpr { int16_t functionId; // function id in aAgg array int16_t resType; // return value type - int16_t resBytes; // length of return value + int32_t resBytes; // length of return value int32_t interBytes; // inter result buffer size int16_t colType; // table column type diff --git a/src/common/inc/tvariant.h b/src/common/inc/tvariant.h index 99485e1ef16b40ddda68712edd8e9834f14c9923..03b17bdc463d6b5d0f812eafa723c886964d35fc 100644 --- a/src/common/inc/tvariant.h +++ b/src/common/inc/tvariant.h @@ -39,9 +39,7 @@ typedef struct tVariant { bool tVariantIsValid(tVariant *pVar); -bool tVariantTypeMatch(tVariant *pVar, int8_t dbType); - -void tVariantCreate(tVariant *pVar, SStrToken *token); +void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape); void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32_t type); diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index bdb4e743a0db92074bdfd45431619019725be2c7..bce9474b6d4fb9f783947ba2e27382d8c1d46429 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -253,9 +253,10 @@ int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPo } if(tdAllocMemForCol(pCol, maxPoints) < 0) return -1; - if (numOfRows > 0) { + + if (((rowOffset == 0) && (numOfRows > 0)) || ((rowOffset == -1) && (numOfRows >= 0))) { // Find the first not null value, fill all previouse values as NULL - dataColSetNEleNull(pCol, numOfRows); + dataColSetNEleNull(pCol, numOfRows - rowOffset); } } @@ -463,9 +464,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols int rcol = 0; int dcol = 0; - while (dcol < pCols->numOfCols) { - bool setCol = 0; SDataCol *pDataCol = &(pCols->cols[dcol]); if (rcol >= schemaNCols(pSchema)) { dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset); @@ -476,14 +475,22 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols STColumn *pRowCol = schemaColAt(pSchema, rcol); if (pRowCol->colId == pDataCol->colId) { void *value = tdGetRowDataOfCol(row, pRowCol->type, pRowCol->offset + TD_DATA_ROW_HEAD_SIZE); - if(!isNull(value, pDataCol->type)) setCol = 1; - dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset); + if (rowOffset == 0) { + dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset); + } else if (rowOffset == -1) { + // for update 2 + if (!isNull(value, pDataCol->type)) { + dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset); + } + } else { + ASSERT(0); + } dcol++; rcol++; } else if (pRowCol->colId < pDataCol->colId) { rcol++; } else { - if(forceSetNull || setCol) { + if(forceSetNull) { dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset); } dcol++; @@ -501,7 +508,6 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo int nRowCols = kvRowNCols(row); while (dcol < pCols->numOfCols) { - bool setCol = 0; SDataCol *pDataCol = &(pCols->cols[dcol]); if (rcol >= nRowCols || rcol >= schemaNCols(pSchema)) { dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset); @@ -513,14 +519,22 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo if (colIdx->colId == pDataCol->colId) { void *value = tdGetKvRowDataOfCol(row, colIdx->offset); - if(!isNull(value, pDataCol->type)) setCol = 1; - dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset); + if (rowOffset == 0) { + dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset); + } else if (rowOffset == -1) { + // for update 2 + if (!isNull(value, pDataCol->type)) { + dataColAppendVal(pDataCol, value, pCols->numOfRows, pCols->maxPoints, rowOffset); + } + } else { + ASSERT(0); + } ++dcol; ++rcol; } else if (colIdx->colId < pDataCol->colId) { ++rcol; } else { - if(forceSetNull || setCol) { + if (forceSetNull) { dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints, rowOffset); } ++dcol; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index c1a254b4ebd5fdfe1d29e02ab7cacbe3195058f1..62baaadbac2596bc66bf5955262a3d5ff35fcfc1 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -73,7 +73,7 @@ int32_t tsMaxBinaryDisplayWidth = 30; * -1: all data are not compressed * other values: if the message payload size is greater than the tsCompressMsgSize, the message will be compressed. */ -int32_t tsCompressMsgSize = -1; +int32_t tsCompressMsgSize = 512 * 1024; /* denote if server needs to compress the retrieved column data before adding to the rpc response message body. * 0: all data are compressed @@ -193,6 +193,7 @@ char tsMqttTopic[TSDB_MQTT_TOPIC_LEN] = "/test"; // # // monitor int8_t tsEnableMonitorModule = 1; +int8_t tsMonitorReplica = 1; char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log"; char tsInternalPass[] = "secretkey"; int32_t tsMonitorInterval = 30; // seconds @@ -289,7 +290,7 @@ char Compressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRES int8_t tsDeadLockKillQuery = 0; // default JSON string type -char tsDefaultJSONStrType[7] = "binary"; +char tsDefaultJSONStrType[7] = "nchar"; char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; //user defined child table name can be specified in tag value. If set to empty system will generate table name using MD5 hash. int32_t (*monStartSystemFp)() = NULL; @@ -669,6 +670,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_SECOND; taosInitConfigOption(cfg); + cfg.option = "monitorReplica"; + cfg.ptr = &tsMonitorReplica; + cfg.valType = TAOS_CFG_VTYPE_INT8; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = 1; + cfg.maxValue = 3; + cfg.ptrLength = 1; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "offlineThreshold"; cfg.ptr = &tsOfflineThreshold; cfg.valType = TAOS_CFG_VTYPE_INT32; diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 511b03f65b57204acdd60a48f9da329cdf251d5f..72659368e5338926103ef19a1ac9d2f6a72c9595 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -30,7 +30,7 @@ assert(0); \ } while (0) -void tVariantCreate(tVariant *pVar, SStrToken *token) { +void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) { int32_t ret = 0; int32_t type = token->type; @@ -81,7 +81,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) { case TSDB_DATA_TYPE_BINARY: { pVar->pz = strndup(token->z, token->n); - pVar->nLen = strRmquoteEscape(pVar->pz, token->n); + pVar->nLen = needRmquoteEscape ? strRmquoteEscape(pVar->pz, token->n) : token->n; break; } case TSDB_DATA_TYPE_TIMESTAMP: { diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java index fc116b32c2a154c9479e4933d887ac7ddcedbe9f..cdadcd2d28a03d3db4b490049a4e84f2fc38ea02 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java @@ -5,6 +5,7 @@ import com.taosdata.jdbc.TSDBErrorNumbers; import org.apache.http.HeaderElement; import org.apache.http.HeaderElementIterator; import org.apache.http.HttpEntity; +import org.apache.http.NoHttpResponseException; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.*; diff --git a/src/dnode/inc/dnodeInt.h b/src/dnode/inc/dnodeInt.h index 1327cd4433fd2e2157becaaf5cb52e2ca0ffe6ef..7abff373834a2f2ddf39dbffb1ebcaadc6991dc9 100644 --- a/src/dnode/inc/dnodeInt.h +++ b/src/dnode/inc/dnodeInt.h @@ -29,8 +29,8 @@ extern "C" { extern int32_t dDebugFlag; -#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); }} -#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); }} +#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); dnodeIncDnodeError(); }} +#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); dnodeIncDnodeError(); }} #define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", 255, __VA_ARGS__); }} #define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", 255, __VA_ARGS__); }} #define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }} diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 3704e34f26b23a673e80d9c4c37966d13bf6aa39..ad4707bbb6e4f39941d0bf3c33e49c329226b2e8 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -54,6 +54,7 @@ void moduleStop() {} void *tsDnodeTmr = NULL; static SRunStatus tsRunStatus = TSDB_RUN_STATUS_STOPPED; +static int64_t tsDnodeErrors = 0; static int32_t dnodeInitStorage(); static void dnodeCleanupStorage(); @@ -88,7 +89,9 @@ static SStep tsDnodeSteps[] = { {"dnode-shell", dnodeInitShell, dnodeCleanupShell}, {"dnode-statustmr", dnodeInitStatusTimer,dnodeCleanupStatusTimer}, {"dnode-telemetry", dnodeInitTelemetry, dnodeCleanupTelemetry}, +#ifdef LUA_EMBEDDED {"dnode-script", scriptEnvPoolInit, scriptEnvPoolCleanup}, +#endif {"dnode-grant", grantInit, grantCleanUp}, }; @@ -225,6 +228,14 @@ static void dnodeSetRunStatus(SRunStatus status) { tsRunStatus = status; } +int64_t dnodeGetDnodeError() { + return tsDnodeErrors; +} + +void dnodeIncDnodeError() { + atomic_add_fetch_64(&tsDnodeErrors, 1); +} + static void dnodeCheckDataDirOpenned(char *dir) { char filepath[256] = {0}; sprintf(filepath, "%s/.running", dir); diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 98bbbf8f73b26535030c5096f128a7f84c2b9f61..f62e0c0df41f2fe399d0f4c1c8e661fcd0ef91b9 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -28,8 +28,8 @@ static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *); static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey); static void * tsShellRpc = NULL; -static int32_t tsQueryReqNum = 0; -static int32_t tsSubmitReqNum = 0; +static int64_t tsQueryReqNum = 0; +static int64_t tsSubmitReqNum = 0; int32_t dnodeInitShell() { dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeDispatchToVWriteQueue; @@ -136,9 +136,9 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) { } if (pMsg->msgType == TSDB_MSG_TYPE_QUERY) { - atomic_fetch_add_32(&tsQueryReqNum, 1); + atomic_fetch_add_64(&tsQueryReqNum, 1); } else if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) { - atomic_fetch_add_32(&tsSubmitReqNum, 1); + atomic_fetch_add_64(&tsSubmitReqNum, 1); } else {} if ( dnodeProcessShellMsgFp[pMsg->msgType] ) { @@ -237,15 +237,31 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid) { } } -SStatisInfo dnodeGetStatisInfo() { - SStatisInfo info = {0}; +SDnodeStatisInfo dnodeGetStatisInfo() { + SDnodeStatisInfo info = {0}; if (dnodeGetRunStatus() == TSDB_RUN_STATUS_RUNING) { #ifdef HTTP_EMBEDDED info.httpReqNum = httpGetReqCount(); #endif - info.queryReqNum = atomic_exchange_32(&tsQueryReqNum, 0); - info.submitReqNum = atomic_exchange_32(&tsSubmitReqNum, 0); + info.queryReqNum = atomic_exchange_64(&tsQueryReqNum, 0); + info.submitReqNum = atomic_exchange_64(&tsSubmitReqNum, 0); } return info; } + +int32_t dnodeGetHttpStatusInfo(int32_t index) { + int32_t httpStatus = 0; +#ifdef HTTP_EMBEDDED + httpStatus = httpGetStatusCodeCount(index); +#endif + return httpStatus; +} + +void dnodeClearHttpStatusInfo() { +#ifdef HTTP_EMBEDDED + for (int i = 0; i < MAX_HTTP_STATUS_CODE_NUM; ++i) { + httpClearStatusCodeCount(i); + } +#endif +} diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 5ecaf19f61a022bae849c2f946acb0ee693aeb59..117b8a5657046abb6412144b352fca79b9d590da 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -23,13 +23,16 @@ extern "C" { #include "trpc.h" #include "taosmsg.h" +#define MAX_HTTP_STATUS_CODE_NUM 63 typedef struct { - int32_t queryReqNum; - int32_t submitReqNum; - int32_t httpReqNum; -} SStatisInfo; + int64_t queryReqNum; + int64_t submitReqNum; + int64_t httpReqNum; +} SDnodeStatisInfo; -SStatisInfo dnodeGetStatisInfo(); +SDnodeStatisInfo dnodeGetStatisInfo(); +int32_t dnodeGetHttpStatusInfo(int32_t index); +void dnodeClearHttpStatusInfo(); bool dnodeIsFirstDeploy(); bool dnodeIsMasterEp(char *ep); @@ -37,6 +40,8 @@ void dnodeGetEpSetForPeer(SRpcEpSet *epSet); void dnodeGetEpSetForShell(SRpcEpSet *epSet); int32_t dnodeGetDnodeId(); void dnodeGetClusterId(char *clusterId); +int64_t dnodeGetDnodeError(); +void dnodeIncDnodeError(); void dnodeUpdateEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port); bool dnodeCheckEpChanged(int32_t dnodeId, char *epstr); diff --git a/src/inc/http.h b/src/inc/http.h index 0d4c386cbf1e784834019c5d75847ab20b7ce8e9..7333042641a8f7bda1574e77e373c7e9a258751d 100644 --- a/src/inc/http.h +++ b/src/inc/http.h @@ -22,7 +22,9 @@ extern "C" { #include -int32_t httpGetReqCount(); +int64_t httpGetReqCount(); +int32_t httpGetStatusCodeCount(int index); +int32_t httpClearStatusCodeCount(int index); int32_t httpInitSystem(); int32_t httpStartSystem(); void httpStopSystem(); diff --git a/src/inc/monitor.h b/src/inc/monitor.h index d2e5e06487dbdf311cef6da125d7ba3050b53a4d..6033f91ee72acb09f23f07fc32e6a40cf0136d76 100644 --- a/src/inc/monitor.h +++ b/src/inc/monitor.h @@ -22,6 +22,17 @@ extern "C" { #include +#define monSaveLogs(level, ...) { \ + monSaveLog(level, __VA_ARGS__); \ + monSaveDnodeLog(level, __VA_ARGS__); \ +} + +typedef struct { + const char * name; + int32_t code; + int32_t index; +} SMonHttpStatus; + typedef struct { char * acctId; int64_t currentPointsPerSecond; @@ -53,9 +64,16 @@ void monStopSystem(); void monCleanupSystem(); void monSaveAcctLog(SAcctMonitorObj *pMonObj); void monSaveLog(int32_t level, const char *const format, ...); +void monSaveDnodeLog(int32_t level, const char *const format, ...); void monExecuteSQL(char *sql); typedef void (*MonExecuteSQLCbFP)(void *param, TAOS_RES *, int code); void monExecuteSQLWithResultCallback(char *sql, MonExecuteSQLCbFP callback, void* param); +void monIncQueryReqCnt(); +void monIncSubmitReqCnt(); +int32_t monFetchQueryReqCnt(); +int32_t monFetchSubmitReqCnt(); +SMonHttpStatus *monGetHttpStatusHashTableEntry(int32_t code); + #ifdef __cplusplus } #endif diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index da38925764faa32a9a71f3e5aefaa8fa16ec81da..de08eb84112ba7d16cc495c5b28349e4e1e17492 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -438,7 +438,7 @@ typedef struct SColumnFilterList { typedef struct SColumnInfo { int16_t colId; int16_t type; - int16_t bytes; + int32_t bytes; SColumnFilterList flist; } SColumnInfo; @@ -479,14 +479,15 @@ typedef struct { bool stateWindow; // state window flag STimeWindow window; + STimeWindow range; // result range for interp query int32_t numOfTables; int16_t order; int16_t orderColId; int16_t numOfCols; // the number of columns will be load from vnode SInterval interval; SSessionWindow sw; // session window - uint16_t tagCondLen; // tag length in current query - uint16_t colCondLen; // column length in current query + uint32_t tagCondLen; // tag length in current query + int32_t colCondLen; // column length in current query int16_t numOfGroupCols; // num of group by columns int16_t orderByIdx; int16_t orderType; // used in group by xx order by xxx diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index a90780b202c6a88ab4f6ced3b5896f48ffc2538b..a3d7b4a18470494a3329f90f3d004b4eb52e9665 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -405,6 +405,7 @@ void tsdbDestroyCommitQueue(); int tsdbSyncCommit(STsdbRepo *repo); void tsdbIncCommitRef(int vgId); void tsdbDecCommitRef(int vgId); +void tsdbSwitchTable(TsdbQueryHandleT pQueryHandle); // For TSDB file sync int tsdbSyncSend(void *pRepo, SOCKET socketFd); diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index e3f6568c81d7ca1e46ef1846624138a7cd768288..a92d257e0107a274f4936e2e5f9d3a620889feab 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -145,77 +145,79 @@ #define TK_DISTINCT 127 #define TK_FROM 128 #define TK_VARIABLE 129 -#define TK_INTERVAL 130 -#define TK_EVERY 131 -#define TK_SESSION 132 -#define TK_STATE_WINDOW 133 -#define TK_FILL 134 -#define TK_SLIDING 135 -#define TK_ORDER 136 -#define TK_BY 137 -#define TK_ASC 138 -#define TK_GROUP 139 -#define TK_HAVING 140 -#define TK_LIMIT 141 -#define TK_OFFSET 142 -#define TK_SLIMIT 143 -#define TK_SOFFSET 144 -#define TK_WHERE 145 -#define TK_RESET 146 -#define TK_QUERY 147 -#define TK_SYNCDB 148 -#define TK_ADD 149 -#define TK_COLUMN 150 -#define TK_MODIFY 151 -#define TK_TAG 152 -#define TK_CHANGE 153 -#define TK_SET 154 -#define TK_KILL 155 -#define TK_CONNECTION 156 -#define TK_STREAM 157 -#define TK_COLON 158 -#define TK_ABORT 159 -#define TK_AFTER 160 -#define TK_ATTACH 161 -#define TK_BEFORE 162 -#define TK_BEGIN 163 -#define TK_CASCADE 164 -#define TK_CLUSTER 165 -#define TK_CONFLICT 166 -#define TK_COPY 167 -#define TK_DEFERRED 168 -#define TK_DELIMITERS 169 -#define TK_DETACH 170 -#define TK_EACH 171 -#define TK_END 172 -#define TK_EXPLAIN 173 -#define TK_FAIL 174 -#define TK_FOR 175 -#define TK_IGNORE 176 -#define TK_IMMEDIATE 177 -#define TK_INITIALLY 178 -#define TK_INSTEAD 179 -#define TK_KEY 180 -#define TK_OF 181 -#define TK_RAISE 182 -#define TK_REPLACE 183 -#define TK_RESTRICT 184 -#define TK_ROW 185 -#define TK_STATEMENT 186 -#define TK_TRIGGER 187 -#define TK_VIEW 188 -#define TK_IPTOKEN 189 -#define TK_SEMI 190 -#define TK_NONE 191 -#define TK_PREV 192 -#define TK_LINEAR 193 -#define TK_IMPORT 194 -#define TK_TBNAME 195 -#define TK_JOIN 196 -#define TK_INSERT 197 -#define TK_INTO 198 -#define TK_VALUES 199 -#define TK_FILE 200 +#define TK_RANGE 130 +#define TK_INTERVAL 131 +#define TK_EVERY 132 +#define TK_SESSION 133 +#define TK_STATE_WINDOW 134 +#define TK_FILL 135 +#define TK_SLIDING 136 +#define TK_ORDER 137 +#define TK_BY 138 +#define TK_ASC 139 +#define TK_GROUP 140 +#define TK_HAVING 141 +#define TK_LIMIT 142 +#define TK_OFFSET 143 +#define TK_SLIMIT 144 +#define TK_SOFFSET 145 +#define TK_WHERE 146 +#define TK_RESET 147 +#define TK_QUERY 148 +#define TK_SYNCDB 149 +#define TK_ADD 150 +#define TK_COLUMN 151 +#define TK_MODIFY 152 +#define TK_TAG 153 +#define TK_CHANGE 154 +#define TK_SET 155 +#define TK_KILL 156 +#define TK_CONNECTION 157 +#define TK_STREAM 158 +#define TK_COLON 159 +#define TK_ABORT 160 +#define TK_AFTER 161 +#define TK_ATTACH 162 +#define TK_BEFORE 163 +#define TK_BEGIN 164 +#define TK_CASCADE 165 +#define TK_CLUSTER 166 +#define TK_CONFLICT 167 +#define TK_COPY 168 +#define TK_DEFERRED 169 +#define TK_DELIMITERS 170 +#define TK_DETACH 171 +#define TK_EACH 172 +#define TK_END 173 +#define TK_EXPLAIN 174 +#define TK_FAIL 175 +#define TK_FOR 176 +#define TK_IGNORE 177 +#define TK_IMMEDIATE 178 +#define TK_INITIALLY 179 +#define TK_INSTEAD 180 +#define TK_KEY 181 +#define TK_OF 182 +#define TK_RAISE 183 +#define TK_REPLACE 184 +#define TK_RESTRICT 185 +#define TK_ROW 186 +#define TK_STATEMENT 187 +#define TK_TRIGGER 188 +#define TK_VIEW 189 +#define TK_IPTOKEN 190 +#define TK_SEMI 191 +#define TK_NONE 192 +#define TK_PREV 193 +#define TK_LINEAR 194 +#define TK_IMPORT 195 +#define TK_TBNAME 196 +#define TK_JOIN 197 +#define TK_INSERT 198 +#define TK_INTO 199 +#define TK_VALUES 200 +#define TK_FILE 201 + #define TK_SPACE 300 #define TK_COMMENT 301 diff --git a/src/inc/ttype.h b/src/inc/ttype.h index fc5998a6c934b6bf70ec689126172414abcee4f4..ff2fac5b72d9181a3cb0cd8afaf3ea5053da5484 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -50,6 +50,47 @@ typedef struct { #define TSDB_DATA_TYPE_POINTER_ARRAY (1000) #define TSDB_DATA_TYPE_VALUE_ARRAY (1001) +#define COPY_DATA(dst, src) *((int64_t *)(dst)) = *((int64_t *)(src)) + +#define COPY_TYPED_DATA(_v, _type, _data) \ + do { \ + switch (_type) { \ + case TSDB_DATA_TYPE_BOOL: \ + case TSDB_DATA_TYPE_TINYINT: \ + (*(int8_t *)_v) = GET_INT8_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_UTINYINT: \ + (*(uint8_t *)_v) = GET_UINT8_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_SMALLINT: \ + (*(int16_t *)_v) = GET_INT16_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_USMALLINT: \ + (*(uint16_t *)_v) = GET_UINT16_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_TIMESTAMP: \ + case TSDB_DATA_TYPE_BIGINT: \ + (*(int64_t *)_v) = (GET_INT64_VAL(_data)); \ + break; \ + case TSDB_DATA_TYPE_UBIGINT: \ + (*(uint64_t *)_v) = (GET_UINT64_VAL(_data)); \ + break; \ + case TSDB_DATA_TYPE_FLOAT: \ + (*(float *)_v) = GET_FLOAT_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_DOUBLE: \ + (*(double *)_v) = GET_DOUBLE_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_UINT: \ + (*(uint32_t *)_v) = GET_UINT32_VAL(_data); \ + break; \ + default: \ + (*(int32_t *)_v) = GET_INT32_VAL(_data); \ + break; \ + } \ + } while (0) + + #define GET_TYPED_DATA(_v, _finalType, _type, _data) \ do { \ switch (_type) { \ diff --git a/src/inc/vnode.h b/src/inc/vnode.h index b3291645c00be17283f7d078acb2d4c9a2629ece..29766e39842e9b53243e4d367116c8bc9ed35f7a 100644 --- a/src/inc/vnode.h +++ b/src/inc/vnode.h @@ -22,6 +22,12 @@ extern "C" { #include "trpc.h" #include "twal.h" +typedef struct { + int64_t submitReqSucNum; + int64_t submitRowNum; + int64_t submitRowSucNum; +} SVnodeStatisInfo; + typedef struct { int32_t len; void * rsp; @@ -62,7 +68,7 @@ int32_t vnodeOpen(int32_t vgId); int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg); int32_t vnodeSync(int32_t vgId); int32_t vnodeClose(int32_t vgId); -int32_t vnodeCompact(int32_t vgId); +int32_t vnodeCompact(int32_t vgId); // vnodeMgmt int32_t vnodeInitMgmt(); @@ -80,6 +86,8 @@ int32_t vnodeWriteToWQueue(void *pVnode, void *pHead, int32_t qtype, void *pRpcM void vnodeFreeFromWQueue(void *pVnode, SVWriteMsg *pWrite); int32_t vnodeProcessWrite(void *pVnode, void *pHead, int32_t qtype, void *pRspRet); +SVnodeStatisInfo vnodeGetStatisInfo(); + // vnodeSync void vnodeConfirmForward(void *pVnode, uint64_t version, int32_t code, bool force); diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index a6cc5a76cba02d3564ea917e7be9906349ee28d3..d1013bf6e6f0cf1a59330e6065d5ddccafe6722e 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -262,7 +262,7 @@ int32_t shellRunCommand(TAOS* con, char* command) { } if (c == '\\') { - if (quote != 0 && (*command == '_' || *command == '\\')) { + if (quote != 0 && (*command == '_' || *command == '%' || *command == '\\')) { //DO nothing } else { esc = true; diff --git a/src/kit/taosdemo/CMakeLists.txt b/src/kit/taosdemo/CMakeLists.txt index 4e9a6914ab001506dcaf7f81c1ec5f723217efe1..57d6242d5343ad727b1706ab614ad0add844ddb6 100644 --- a/src/kit/taosdemo/CMakeLists.txt +++ b/src/kit/taosdemo/CMakeLists.txt @@ -77,6 +77,14 @@ ELSEIF (TD_WINDOWS) AUX_SOURCE_DIRECTORY(./src SRC) ADD_EXECUTABLE(taosdemo ${SRC}) SET_SOURCE_FILES_PROPERTIES(./src/demoUtil.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoData.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoInsert.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoCommandOpt.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoQuery.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoMain.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoSubscribe.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoOutput.c PROPERTIES COMPILE_FLAGS -w) + SET_SOURCE_FILES_PROPERTIES(./src/demoJsonOpt.c PROPERTIES COMPILE_FLAGS -w) IF (TD_SOMODE_STATIC) TARGET_LINK_LIBRARIES(taosdemo taos_static cJson lua) ELSE () diff --git a/src/kit/taosdemo/inc/demo.h b/src/kit/taosdemo/inc/demo.h index ff605afcbb05d2c27abd382a249456b52763f673..9208c8f0c25fe4ab2672a1d42660fc42eb2b781d 100644 --- a/src/kit/taosdemo/inc/demo.h +++ b/src/kit/taosdemo/inc/demo.h @@ -141,6 +141,8 @@ extern char configDir[]; { TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT } #define DEFAULT_DATATYPE \ { "FLOAT", "INT", "FLOAT" } +#define DEFAULT_DATALENGTH \ + { 4, 4, 4 } #define DEFAULT_BINWIDTH 64 #define DEFAULT_COL_COUNT 4 #define DEFAULT_LEN_ONE_ROW 76 @@ -306,6 +308,7 @@ typedef struct SArguments_S { bool async_mode; char data_type[MAX_NUM_COLUMNS + 1]; char * dataType[MAX_NUM_COLUMNS + 1]; + int32_t data_length[MAX_NUM_COLUMNS + 1]; uint32_t binwidth; uint32_t columnCount; uint64_t lenOfOneRow; diff --git a/src/kit/taosdemo/src/demoCommandOpt.c b/src/kit/taosdemo/src/demoCommandOpt.c index ede4c71d1de7376c85d681299d35ca2f2075d45b..7c002715df5c899cb3f239ef7a3431357941a9bc 100644 --- a/src/kit/taosdemo/src/demoCommandOpt.c +++ b/src/kit/taosdemo/src/demoCommandOpt.c @@ -1338,9 +1338,10 @@ void setParaFromArg() { g_args.prepared_rand = min(g_args.insertRows, MAX_PREPARED_RAND); g_Dbs.aggr_func = g_args.aggr_func; - char dataString[TSDB_MAX_BYTES_PER_ROW]; - char * data_type = g_args.data_type; - char **dataType = g_args.dataType; + char dataString[TSDB_MAX_BYTES_PER_ROW]; + char * data_type = g_args.data_type; + char ** dataType = g_args.dataType; + int32_t *data_length = g_args.data_length; memset(dataString, 0, TSDB_MAX_BYTES_PER_ROW); @@ -1469,6 +1470,47 @@ void setParaFromArg() { } else { g_Dbs.threadCountForCreateTbl = g_args.nthreads; g_Dbs.db[0].superTbls[0].tagCount = 0; + for (int i = 0; i < MAX_NUM_COLUMNS; i++) { + if (data_type[i] == TSDB_DATA_TYPE_NULL) { + break; + } + if (1 == regexMatch(dataType[i], + "^(NCHAR|BINARY)(\\([1-9][0-9]*\\))$", + REG_ICASE | REG_EXTENDED)) { + sscanf(dataType[i], "%[^(](%[^)]", type, length); + data_length[i] = atoi(length); + } else { + switch (data_type[i]) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_TINYINT: + data_length[i] = sizeof(char); + break; + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_USMALLINT: + data_length[i] = sizeof(int16_t); + break; + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_UINT: + data_length[i] = sizeof(int32_t); + break; + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_UBIGINT: + data_length[i] = sizeof(int64_t); + break; + case TSDB_DATA_TYPE_FLOAT: + data_length[i] = sizeof(float); + break; + case TSDB_DATA_TYPE_DOUBLE: + data_length[i] = sizeof(double); + break; + default: + data_length[i] = g_args.binwidth; + break; + } + } + } } } @@ -1698,8 +1740,15 @@ void *queryNtableAggrFunc(void *sarg) { double totalT = 0; uint64_t count = 0; for (int64_t i = 0; i < ntables; i++) { - sprintf(command, "SELECT %s FROM %s%" PRId64 " WHERE ts>= %" PRIu64, - aggreFunc[j], tb_prefix, i, startTime); + if (g_args.escapeChar) { + sprintf(command, + "SELECT %s FROM `%s%" PRId64 "` WHERE ts>= %" PRIu64, + aggreFunc[j], tb_prefix, i, startTime); + } else { + sprintf(command, + "SELECT %s FROM %s%" PRId64 " WHERE ts>= %" PRIu64, + aggreFunc[j], tb_prefix, i, startTime); + } double t = (double)taosGetTimestampUs(); debugPrint("%s() LN%d, sql command: %s\n", __func__, __LINE__, @@ -1708,9 +1757,9 @@ void *queryNtableAggrFunc(void *sarg) { int32_t code = taos_errno(pSql); if (code != 0) { - errorPrint("Failed to query:%s\n", taos_errstr(pSql)); + errorPrint("Failed to query <%s>, reason:%s\n", command, + taos_errstr(pSql)); taos_free_result(pSql); - taos_close(taos); fclose(fp); free(command); return NULL; diff --git a/src/kit/taosdemo/src/demoData.c b/src/kit/taosdemo/src/demoData.c index 39d7954a2488621cf3fdee859777484a1f38601b..ae796a111cb0aa30e78cca20bab6929fe9a56557 100644 --- a/src/kit/taosdemo/src/demoData.c +++ b/src/kit/taosdemo/src/demoData.c @@ -868,8 +868,8 @@ int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf, return strlen(recBuf); } -static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp, - int lenOfBinary) { +static int64_t generateData(char *recBuf, char *data_type, int32_t *data_length, + int64_t timestamp) { memset(recBuf, 0, MAX_DATA_SIZE); char *pstr = recBuf; pstr += sprintf(pstr, "(%" PRId64 "", timestamp); @@ -915,13 +915,13 @@ static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp, case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - s = calloc(1, lenOfBinary + 1); + s = calloc(1, data_length[i] + 1); if (NULL == s) { errorPrint("%s", "failed to allocate memory\n"); return -1; } - rand_string(s, lenOfBinary); + rand_string(s, data_length[i]); pstr += sprintf(pstr, ",\"%s\"", s); free(s); break; @@ -1156,20 +1156,18 @@ static int32_t generateDataTailWithoutStb( int64_t retLen = 0; - char *data_type = g_args.data_type; - int lenOfBinary = g_args.binwidth; + char * data_type = g_args.data_type; + int32_t *data_length = g_args.data_length; if (g_args.disorderRatio) { retLen = - generateData(data, data_type, + generateData(data, data_type, data_length, startTime + getTSRandTail(g_args.timestamp_step, k, g_args.disorderRatio, - g_args.disorderRange), - lenOfBinary); + g_args.disorderRange)); } else { - retLen = generateData(data, data_type, - startTime + g_args.timestamp_step * k, - lenOfBinary); + retLen = generateData(data, data_type, data_length, + startTime + g_args.timestamp_step * k); } if (len > remainderBufLen) break; diff --git a/src/kit/taosdemo/src/demoInsert.c b/src/kit/taosdemo/src/demoInsert.c index 4dac128f33a3a9dc4723254f27378a98c90ebf1a..965f5750834ba5b2f0dafdd0f709d3489ebf14bb 100644 --- a/src/kit/taosdemo/src/demoInsert.c +++ b/src/kit/taosdemo/src/demoInsert.c @@ -1043,10 +1043,8 @@ int createChildTables() { // normal table len = snprintf(tblColsBuf, TSDB_MAX_BYTES_PER_ROW, "(TS TIMESTAMP"); for (int j = 0; j < g_args.columnCount; j++) { - if ((strncasecmp(g_args.dataType[j], "BINARY", - strlen("BINARY")) == 0) || - (strncasecmp(g_args.dataType[j], "NCHAR", - strlen("NCHAR")) == 0)) { + if ((strcasecmp(g_args.dataType[j], "BINARY") == 0) || + (strcasecmp(g_args.dataType[j], "NCHAR") == 0)) { snprintf(tblColsBuf + len, TSDB_MAX_BYTES_PER_ROW - len, ",C%d %s(%d)", j, g_args.dataType[j], g_args.binwidth); diff --git a/src/kit/taosdemo/src/demoJsonOpt.c b/src/kit/taosdemo/src/demoJsonOpt.c index c751021ff6d9e3d887184784a03cc41f6f4fd108..e74d2906c8f3294f0531145c8f13e5ce776e444f 100644 --- a/src/kit/taosdemo/src/demoJsonOpt.c +++ b/src/kit/taosdemo/src/demoJsonOpt.c @@ -854,6 +854,7 @@ int getMetaFromInsertJsonFile(cJSON *root) { g_Dbs.db[i].superTbls[j].iface = STMT_IFACE; } else if (0 == strcasecmp(stbIface->valuestring, "sml")) { g_Dbs.db[i].superTbls[j].iface = SML_IFACE; + g_args.iface = SML_IFACE; } else { errorPrint( "failed to read json, insert_mode %s not recognized\n", diff --git a/src/kit/taosdemo/src/demoMain.c b/src/kit/taosdemo/src/demoMain.c index 4940d7188c999f03da0d021327c58d8a7c1a1b9f..9251dc2ada07aa7b2708afa8280e4eadde117fe3 100644 --- a/src/kit/taosdemo/src/demoMain.c +++ b/src/kit/taosdemo/src/demoMain.c @@ -45,6 +45,7 @@ SArguments g_args = { DEFAULT_SYNC_MODE, // mode : sync or async DEFAULT_DATA_TYPE, // data_type DEFAULT_DATATYPE, // dataType + DEFAULT_DATALENGTH, // data_length DEFAULT_BINWIDTH, // binwidth DEFAULT_COL_COUNT, // columnCount, timestamp + float + int + float DEFAULT_LEN_ONE_ROW, // lenOfOneRow diff --git a/src/kit/taosdemo/src/demoUtil.c b/src/kit/taosdemo/src/demoUtil.c index bf06bbfb3ec51fb7bf6e7571e1bc943b0e73842c..bae2e30f53db95df6024eee4f7c48d601b5240e3 100644 --- a/src/kit/taosdemo/src/demoUtil.c +++ b/src/kit/taosdemo/src/demoUtil.c @@ -204,13 +204,14 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName, int64_t childTblCount = (limit < 0) ? DEFAULT_CHILDTABLES : limit; int64_t count = 0; char * childTblName = *childTblNameOfSuperTbl; - char * pTblName = childTblName; + if (childTblName == NULL) { childTblName = (char *)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN); if (childTblName == NULL) { errorPrint("%s", "failed to allocate memory\n"); } } + char *pTblName = childTblName; snprintf(limitBuf, 100, " limit %" PRId64 " offset %" PRIu64 "", limit, offset); diff --git a/src/mnode/inc/mnodeInt.h b/src/mnode/inc/mnodeInt.h index 7a791d76e6796cfed22657f1bc7ffdb26890ea40..aefdf23bdadaed47e56435ca8e8c0d049bec3ea4 100644 --- a/src/mnode/inc/mnodeInt.h +++ b/src/mnode/inc/mnodeInt.h @@ -41,9 +41,9 @@ extern int32_t sdbDebugFlag; #define sdbDebug(...) { if (sdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }} #define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }} -#define mLError(...) { monSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) } -#define mLWarn(...) { monSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) } -#define mLInfo(...) { monSaveLog(0, __VA_ARGS__); mInfo(__VA_ARGS__) } +#define mLError(...) { monSaveLogs(2, __VA_ARGS__); mError(__VA_ARGS__) } +#define mLWarn(...) { monSaveLogs(1, __VA_ARGS__); mWarn(__VA_ARGS__) } +#define mLInfo(...) { monSaveLogs(0, __VA_ARGS__); mInfo(__VA_ARGS__) } #ifdef __cplusplus } diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 00471bbf042e147a210fb575e7372d9696c33617..13afd1c29894fea07e5c269eee53b36a386ee442 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -1139,7 +1139,7 @@ static int32_t mnodeAlterDbFp(SMnodeMsg *pMsg) { return sdbUpdateRow(&row); } - //bnNotify(); + bnNotify(); return TSDB_CODE_MND_ACTION_IN_PROGRESS; } diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 7dd199cca4248e5467017e1b6247f3b534c45711..168995916553dc8b1d02f9cd05563cfb4c5319de 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -1177,8 +1177,8 @@ static int32_t mnodeGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC int32_t cols = 0; SUserObj *pUser = mnodeGetUserFromConn(pConn); if (pUser == NULL) return 0; - - if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) { + + if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0 ) { mnodeDecUserRef(pUser); return TSDB_CODE_MND_NO_RIGHTS; } @@ -1256,10 +1256,10 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo STR_TO_VARSTR(pWrite, syncRole[pVgid->role]); cols++; numOfRows++; - } } if (numOfRows >= rows) { + mnodeDecVgroupRef(pVgroup); break; } diff --git a/src/mnode/src/mnodeProfile.c b/src/mnode/src/mnodeProfile.c index 15438fc234bb60089e9d0f52fe92eb5bf8b3eeae..70532d2216a9ad4ecb8e3ceca94367a535796a9e 100644 --- a/src/mnode/src/mnodeProfile.c +++ b/src/mnode/src/mnodeProfile.c @@ -166,7 +166,7 @@ static void mnodeCancelGetNextConn(void *pIter) { static int32_t mnodeGetConnsMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { SUserObj *pUser = mnodeGetUserFromConn(pConn); if (pUser == NULL) return 0; - if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS; + if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS; int32_t cols = 0; SSchema *pSchema = pMeta->schema; @@ -322,7 +322,7 @@ int32_t mnodeSaveQueryStreamList(SConnObj *pConn, SHeartBeatMsg *pHBMsg) { static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { SUserObj *pUser = mnodeGetUserFromConn(pConn); if (pUser == NULL) return 0; - if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS; + if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS; int32_t cols = 0; SSchema *pSchema = pMeta->schema; diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index bbfdb52e058c9e8c4ce3d3fe9d06715e9c0483aa..960987e7ad3b570548d9f8eb93a64ed963a5956b 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -121,7 +121,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) { } if (!tsMnodeShowMetaFp[pShowMsg->type] || !tsMnodeShowRetrieveFp[pShowMsg->type]) { - mError("show type:%s is not support", mnodeGetShowType(pShowMsg->type)); + mWarn("show type:%s is not support", mnodeGetShowType(pShowMsg->type)); return TSDB_CODE_COM_OPS_NOT_SUPPORT; } diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index a32da29124016424ce5fe1436f29cca91da3e546..838aa577ae0fe396f3e80d2fca9066de10d3bc7a 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -742,19 +742,6 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p return 0; } -static bool mnodeFilterVgroups(SVgObj *pVgroup, STableObj *pTable) { - if (NULL == pTable || pTable->type == TSDB_SUPER_TABLE) { - return true; - } - - SCTableObj *pCTable = (SCTableObj *)pTable; - if (pVgroup->vgId == pCTable->vgId) { - return true; - } else { - return false; - } -} - static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn) { int32_t numOfRows = 0; SVgObj *pVgroup = NULL; @@ -770,11 +757,6 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v return 0; } - STableObj *pTable = NULL; - if (pShow->payloadLen > 0 ) { - pTable = mnodeGetTable(pShow->payload); - } - while (numOfRows < rows) { pShow->pIter = mnodeGetNextVgroup(pShow->pIter, &pVgroup); if (pVgroup == NULL) break; @@ -784,11 +766,6 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v continue; } - if (!mnodeFilterVgroups(pVgroup, pTable)) { - mnodeDecVgroupRef(pVgroup); - continue; - } - cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -842,7 +819,6 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; - mnodeDecTableRef(pTable); mnodeDecDbRef(pDb); return numOfRows; diff --git a/src/os/inc/osSysinfo.h b/src/os/inc/osSysinfo.h index 0320ab0f7fe5f72e70fd6d12d8d2b0a27dec3754..e2408058f068165506c7e6ffbc6e4ec3dee9a93c 100644 --- a/src/os/inc/osSysinfo.h +++ b/src/os/inc/osSysinfo.h @@ -30,10 +30,11 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize); int32_t taosGetCpuCores(); void taosGetSystemInfo(); -bool taosReadProcIO(int64_t* rchars, int64_t* wchars); -bool taosGetProcIO(float *readKB, float *writeKB); +bool taosReadProcIO(int64_t* rchars, int64_t* wchars, int64_t* rbytes, int64_t* wbytes); +bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float* wbyteKB); bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes); bool taosGetBandSpeed(float *bandSpeedKb); +bool taosGetNetworkIO(float *netInKb, float *netOutKb); void taosGetDisk(); bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) ; bool taosGetProcMemory(float *memoryUsedMB) ; diff --git a/src/os/inc/osTime.h b/src/os/inc/osTime.h index dcb0e4c9b630216600c4f8f017b8154e9bb9dac4..798a08e3e6e16470a750cbd8bfed429539b44d8d 100644 --- a/src/os/inc/osTime.h +++ b/src/os/inc/osTime.h @@ -94,6 +94,8 @@ typedef struct SSessionWindow { } SSessionWindow; int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision); +int64_t taosTimeSub(int64_t t, int64_t duration, char unit, int32_t precision); + int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision); int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision); diff --git a/src/os/src/darwin/dwSysInfo.c b/src/os/src/darwin/dwSysInfo.c index a87a15a3f211768ecce747c7bc6ff236bad2f3ee..8cfba775688b221a85667df86dea0c46f54e02cc 100644 --- a/src/os/src/darwin/dwSysInfo.c +++ b/src/os/src/darwin/dwSysInfo.c @@ -191,15 +191,19 @@ void taosGetSystemInfo() { taosGetSystemLocale(); } -bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { +bool taosReadProcIO(int64_t *rchars, int64_t *wchars, int64_t *rbytes, int64_t *wbytes) { if (rchars) *rchars = 0; if (wchars) *wchars = 0; + if (rbytes) *rbytes = 0; + if (wbytes) *wbytes = 0; return true; } -bool taosGetProcIO(float *readKB, float *writeKB) { - *readKB = 0; - *writeKB = 0; +bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float *wbyteKB) { + *rcharKB = 0; + *wcharKB = 0; + *rbyteKB = 0; + *wbyteKB = 0; return true; } @@ -215,6 +219,12 @@ bool taosGetBandSpeed(float *bandSpeedKb) { return true; } +bool taosGetNetworkIO(float *netInKb, float *netOutKb) { + *netInKb = 0; + *netOutKb = 0; + return true; +} + bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) { *sysCpuUsage = 0; *procCpuUsage = 0; diff --git a/src/os/src/detail/osSysinfo.c b/src/os/src/detail/osSysinfo.c index 64d33be40ed09b2783b4c7e08b6c20618a43cf8a..af8f2dcdaf1568ba5e10656aacb7d0958155dde2 100644 --- a/src/os/src/detail/osSysinfo.c +++ b/src/os/src/detail/osSysinfo.c @@ -335,7 +335,9 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) { } bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) { - *bytes = 0; + if (bytes) *bytes = 0; + if (rbytes) *rbytes = 0; + if (tbytes) *tbytes = 0; FILE *fp = fopen(tsSysNetFile, "r"); if (fp == NULL) { uError("open file:%s failed", tsSysNetFile); @@ -350,7 +352,7 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) { memset(line, 0, len); int64_t o_rbytes = 0; - int64_t rpackts = 0; + int64_t rpackets = 0; int64_t o_tbytes = 0; int64_t tpackets = 0; int64_t nouse1 = 0; @@ -376,10 +378,10 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) { sscanf(line, "%s %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64, - nouse0, &o_rbytes, &rpackts, &nouse1, &nouse2, &nouse3, &nouse4, &nouse5, &nouse6, &o_tbytes, &tpackets); + nouse0, &o_rbytes, &rpackets, &nouse1, &nouse2, &nouse3, &nouse4, &nouse5, &nouse6, &o_tbytes, &tpackets); if (rbytes) *rbytes = o_rbytes; if (tbytes) *tbytes = o_tbytes; - *bytes += (o_rbytes + o_tbytes); + if (bytes) *bytes += (o_rbytes + o_tbytes); } tfree(line); @@ -424,7 +426,46 @@ bool taosGetBandSpeed(float *bandSpeedKb) { return true; } -bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { +bool taosGetNetworkIO(float *netInKb, float *netOutKb) { + static int64_t lastBytesIn = 0, lastBytesOut = 0; + static time_t lastTimeIO = 0; + int64_t curBytesIn = 0, curBytesOut = 0; + time_t curTime = time(NULL); + + if (!taosGetCardInfo(NULL, &curBytesIn, &curBytesOut)) { + return false; + } + + if (lastTimeIO == 0 || lastBytesIn == 0 || lastBytesOut == 0) { + lastTimeIO = curTime; + lastBytesIn = curBytesIn; lastBytesOut = curBytesOut; + *netInKb = 0; + *netOutKb = 0; + return true; + } + + if (lastTimeIO >= curTime || lastBytesIn > curBytesIn || lastBytesOut > curBytesOut) { + lastTimeIO = curTime; + lastBytesIn = curBytesIn; lastBytesOut = curBytesOut; + *netInKb = 0; + *netOutKb = 0; + return true; + } + + double totalBytesIn = (double)(curBytesIn - lastBytesIn) / 1024 * 8; // Kb + *netInKb = (float)(totalBytesIn / (double)(curTime - lastTimeIO)); + + double totalBytesOut = (double)(curBytesOut - lastBytesOut) / 1024 * 8; // Kb + *netOutKb = (float)(totalBytesOut / (double)(curTime - lastTimeIO)); + + lastTimeIO = curTime; + lastBytesIn = curBytesIn; + lastBytesOut = curBytesOut; + + return true; +} + +bool taosReadProcIO(int64_t *rchars, int64_t *wchars, int64_t *rbytes, int64_t *wbytes) { FILE *fp = fopen(tsProcIOFile, "r"); if (fp == NULL) { uError("open file:%s failed", tsProcIOFile); @@ -434,7 +475,7 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { ssize_t _bytes = 0; size_t len; char * line = NULL; - char tmp[10]; + char tmp[15]; int readIndex = 0; while (!feof(fp)) { @@ -450,16 +491,21 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { } else if (strstr(line, "wchar:") != NULL) { sscanf(line, "%s %" PRId64, tmp, wchars); readIndex++; - } else { + } else if (strstr(line, "read_bytes:") != NULL){ + sscanf(line, "%s %" PRId64, tmp, rbytes); + readIndex++; + } else if (strstr(line, "write_bytes:") != NULL){ + sscanf(line, "%s %" PRId64, tmp, wbytes); + readIndex++; } - if (readIndex >= 2) break; + if (readIndex >= 4) break; } tfree(line); fclose(fp); - if (readIndex < 2) { + if (readIndex < 4) { uError("read file:%s failed", tsProcIOFile); return false; } @@ -467,30 +513,43 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { return true; } -bool taosGetProcIO(float *readKB, float *writeKB) { - static int64_t lastReadbyte = -1; - static int64_t lastWritebyte = -1; +bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float *wbyteKB) { + static int64_t lastRchar = -1, lastRbyte = -1; + static int64_t lastWchar = -1, lastWbyte = -1; + static time_t lastTime = 0; + time_t curTime = time(NULL); - int64_t curReadbyte = 0; - int64_t curWritebyte = 0; + int64_t curRchar = 0, curRbyte = 0; + int64_t curWchar = 0, curWbyte = 0; - if (!taosReadProcIO(&curReadbyte, &curWritebyte)) { + if (!taosReadProcIO(&curRchar, &curWchar, &curRbyte, &curWbyte)) { return false; } - if (lastReadbyte == -1 || lastWritebyte == -1) { - lastReadbyte = curReadbyte; - lastWritebyte = curWritebyte; + if (lastTime == 0 || lastRchar == -1 || lastWchar == -1 || lastRbyte == -1 || lastWbyte == -1) { + lastTime = curTime; + lastRchar = curRchar; + lastWchar = curWchar; + lastRbyte = curRbyte; + lastWbyte = curWbyte; return false; } - *readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024); - *writeKB = (float)((double)(curWritebyte - lastWritebyte) / 1024); - if (*readKB < 0) *readKB = 0; - if (*writeKB < 0) *writeKB = 0; + *rcharKB = (float)((double)(curRchar - lastRchar) / 1024 / (double)(curTime - lastTime)); + *wcharKB = (float)((double)(curWchar - lastWchar) / 1024 / (double)(curTime - lastTime)); + if (*rcharKB < 0) *rcharKB = 0; + if (*wcharKB < 0) *wcharKB = 0; + + *rbyteKB = (float)((double)(curRbyte - lastRbyte) / 1024 / (double)(curTime - lastTime)); + *wbyteKB = (float)((double)(curWbyte - lastWbyte) / 1024 / (double)(curTime - lastTime)); + if (*rbyteKB < 0) *rbyteKB = 0; + if (*wbyteKB < 0) *wbyteKB = 0; - lastReadbyte = curReadbyte; - lastWritebyte = curWritebyte; + lastRchar = curRchar; + lastWchar = curWchar; + lastRbyte = curRbyte; + lastWbyte = curWbyte; + lastTime = curTime; return true; } @@ -501,13 +560,13 @@ void taosGetSystemInfo() { tsNumOfCores = taosGetCpuCores(); tsTotalMemoryMB = taosGetTotalMemory(); - float tmp1, tmp2; + float tmp1, tmp2, tmp3, tmp4; taosGetSysMemory(&tmp1); taosGetProcMemory(&tmp2); // taosGetDisk(); taosGetBandSpeed(&tmp1); taosGetCpuUsage(&tmp1, &tmp2); - taosGetProcIO(&tmp1, &tmp2); + taosGetProcIO(&tmp1, &tmp2, &tmp3, &tmp4); taosGetSystemTimezone(); taosGetSystemLocale(); diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index ec442f42a64b30611137a66b6993fd7309ea0cab..73345426c9a266c57ac286efac716f5c5490b8bf 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -548,6 +548,27 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { return (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision)); } +int64_t taosTimeSub(int64_t t, int64_t duration, char unit, int32_t precision) { + if (duration == 0) { + return t; + } + if (unit == 'y') { + duration *= 12; + } else if (unit != 'n') { + return t - duration; + } + + struct tm tm; + time_t tt = (time_t)(t / TSDB_TICK_PER_SECOND(precision)); + localtime_r(&tt, &tm); + int mon = tm.tm_year * 12 + tm.tm_mon - (int)duration; + tm.tm_year = mon / 12; + tm.tm_mon = mon % 12; + + return (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision)); +} + + int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision) { if (ekey < skey) { int64_t tmp = ekey; diff --git a/src/os/src/windows/wSysinfo.c b/src/os/src/windows/wSysinfo.c index 831a6bdaf09c32e0e1a35bb240200de437b36ae4..193a83d7d73ee904204fa6ce1a5a1b562c92d17a 100644 --- a/src/os/src/windows/wSysinfo.c +++ b/src/os/src/windows/wSysinfo.c @@ -169,40 +169,59 @@ bool taosGetBandSpeed(float *bandSpeedKb) { return true; } -bool taosReadProcIO(int64_t *readbyte, int64_t *writebyte) { +bool taosGetNetworkIO(float *netInKb, float *netOutKb) { + *netInKb = 0; + *netOutKb = 0; + return true; +} + +bool taosReadProcIO(int64_t *rchars, int64_t *wchars, int64_t *rbytes, int64_t *wbytes) { IO_COUNTERS io_counter; if (GetProcessIoCounters(GetCurrentProcess(), &io_counter)) { - if (readbyte) *readbyte = io_counter.ReadTransferCount; - if (writebyte) *writebyte = io_counter.WriteTransferCount; + if (rchars) *rchars = io_counter.ReadTransferCount; + if (wchars) *wchars = io_counter.WriteTransferCount; return true; } return false; } -bool taosGetProcIO(float *readKB, float *writeKB) { - static int64_t lastReadbyte = -1; - static int64_t lastWritebyte = -1; +bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float *wbyteKB) { + static int64_t lastRchar = -1, lastRbyte = -1; + static int64_t lastWchar = -1, lastWbyte = -1; + static time_t lastTime = 0; + time_t curTime = time(NULL); - int64_t curReadbyte = 0; - int64_t curWritebyte = 0; + int64_t curRchar = 0, curRbyte = 0; + int64_t curWchar = 0, curWbyte = 0; - if (!taosReadProcIO(&curReadbyte, &curWritebyte)) { + if (!taosReadProcIO(&curRchar, &curWchar, &curRbyte, &curWbyte)) { return false; } - if (lastReadbyte == -1 || lastWritebyte == -1) { - lastReadbyte = curReadbyte; - lastWritebyte = curWritebyte; + if (lastTime == 0 || lastRchar == -1 || lastWchar == -1 || lastRbyte == -1 || lastWbyte == -1) { + lastTime = curTime; + lastRchar = curRchar; + lastWchar = curWchar; + lastRbyte = curRbyte; + lastWbyte = curWbyte; return false; } - *readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024); - *writeKB = (float)((double)(curWritebyte - lastWritebyte) / 1024); - if (*readKB < 0) *readKB = 0; - if (*writeKB < 0) *writeKB = 0; + *rcharKB = (float)((double)(curRchar - lastRchar) / 1024 / (double)(curTime - lastTime)); + *wcharKB = (float)((double)(curWchar - lastWchar) / 1024 / (double)(curTime - lastTime)); + if (*rcharKB < 0) *rcharKB = 0; + if (*wcharKB < 0) *wcharKB = 0; + + *rbyteKB = (float)((double)(curRbyte - lastRbyte) / 1024 / (double)(curTime - lastTime)); + *wbyteKB = (float)((double)(curWbyte - lastWbyte) / 1024 / (double)(curTime - lastTime)); + if (*rbyteKB < 0) *rbyteKB = 0; + if (*wbyteKB < 0) *wbyteKB = 0; - lastReadbyte = curReadbyte; - lastWritebyte = curWritebyte; + lastRchar = curRchar; + lastWchar = curWchar; + lastRbyte = curRbyte; + lastWbyte = curWbyte; + lastTime = curTime; return true; } @@ -211,11 +230,11 @@ void taosGetSystemInfo() { tsNumOfCores = taosGetCpuCores(); tsTotalMemoryMB = taosGetTotalMemory(); - float tmp1, tmp2; + float tmp1, tmp2, tmp3, tmp4; // taosGetDisk(); taosGetBandSpeed(&tmp1); taosGetCpuUsage(&tmp1, &tmp2); - taosGetProcIO(&tmp1, &tmp2); + taosGetProcIO(&tmp1, &tmp2, &tmp3, &tmp4); taosGetSystemTimezone(); taosGetSystemLocale(); diff --git a/src/plugins/http/inc/httpInt.h b/src/plugins/http/inc/httpInt.h index af0f4c579557d1bd919847ef858af8dc1616bb6f..de595907659ffc84c42afb7802b1a7902b126ea1 100644 --- a/src/plugins/http/inc/httpInt.h +++ b/src/plugins/http/inc/httpInt.h @@ -42,6 +42,7 @@ #define HTTP_WRITE_WAIT_TIME_MS 5 #define HTTP_PASSWORD_LEN TSDB_UNI_LEN #define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + HTTP_PASSWORD_LEN) +#define HTTP_STATUS_CODE_NUM 63 typedef enum HttpReqType { HTTP_REQTYPE_OTHERS = 0, @@ -187,8 +188,9 @@ typedef struct HttpServer { SOCKET fd; int32_t numOfThreads; int32_t methodScannerLen; - int32_t requestNum; + int64_t requestNum; int32_t status; + int32_t statusCodeErrs[HTTP_STATUS_CODE_NUM]; pthread_t thread; HttpThread * pThreads; void * contextCache; diff --git a/src/plugins/http/src/httpMetricsHandle.c b/src/plugins/http/src/httpMetricsHandle.c index dbabd48774aa077b1b4f842b4bc47dfd5de67ce4..2031c2a6db2630b8a944cdb582d07e46c1f9313e 100644 --- a/src/plugins/http/src/httpMetricsHandle.c +++ b/src/plugins/http/src/httpMetricsHandle.c @@ -123,9 +123,9 @@ bool metricsProcessRequest(HttpContext* pContext) { } { - int64_t rchars = 0; - int64_t wchars = 0; - bool succeeded = taosReadProcIO(&rchars, &wchars); + int64_t rchars = 0, rbytes = 0; + int64_t wchars = 0, wbytes = 0; + bool succeeded = taosReadProcIO(&rchars, &wchars, &rbytes, &wbytes); if (!succeeded) { httpError("failed to get io info"); } else { @@ -164,7 +164,7 @@ bool metricsProcessRequest(HttpContext* pContext) { } { - SStatisInfo info = dnodeGetStatisInfo(); + SDnodeStatisInfo info = dnodeGetStatisInfo(); { char* keyReqHttp = "req_http"; char* keyReqSelect = "req_select"; @@ -181,4 +181,4 @@ bool metricsProcessRequest(HttpContext* pContext) { pContext->reqType = HTTP_REQTYPE_OTHERS; httpFreeJsonBuf(pContext); return false; -} \ No newline at end of file +} diff --git a/src/plugins/http/src/httpResp.c b/src/plugins/http/src/httpResp.c index 824ce746704b477ee482d82fc617ce37af307a59..a2452a16b94fea060a370c86518bb36c1da45070 100644 --- a/src/plugins/http/src/httpResp.c +++ b/src/plugins/http/src/httpResp.c @@ -21,6 +21,7 @@ #include "httpResp.h" #include "httpJson.h" #include "httpContext.h" +#include "monitor.h" const char *httpKeepAliveStr[] = {"", "Connection: Keep-Alive\r\n", "Connection: Close\r\n"}; @@ -153,6 +154,10 @@ void httpSendErrorResp(HttpContext *pContext, int32_t errNo) { httpCode = pContext->parser->httpCode; } + HttpServer *pServer = &tsHttpServer; + SMonHttpStatus *httpStatus = monGetHttpStatusHashTableEntry(httpCode); + pServer->statusCodeErrs[httpStatus->index] += 1; + pContext->error = true; char *httpCodeStr = httpGetStatusDesc(httpCode); diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 13a0835c3960333c6d12aa443025de5fb95d565e..7f350a6f1599ba857a4249f500ffcb59bd50985e 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -53,7 +53,7 @@ static void httpStopThread(HttpThread *pThread) { break; } } while (0); - if (r) { + if (r && taosCheckPthreadValid(pThread->thread)) { pthread_cancel(pThread->thread); } #else @@ -63,15 +63,21 @@ static void httpStopThread(HttpThread *pThread) { httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); pThread->stop = true; - pthread_cancel(pThread->thread); + if (taosCheckPthreadValid(pThread->thread)) { + pthread_cancel(pThread->thread); + } } else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); - pthread_cancel(pThread->thread); + if (taosCheckPthreadValid(pThread->thread)) { + pthread_cancel(pThread->thread); + } } #endif // __APPLE__ - pthread_join(pThread->thread, NULL); + if (taosCheckPthreadValid(pThread->thread)) { + pthread_join(pThread->thread, NULL); + } #ifdef __APPLE__ if (sv[0] != -1) { @@ -190,7 +196,7 @@ static void httpProcessHttpData(void *param) { } else { if (httpReadData(pContext)) { (*(pThread->processData))(pContext); - atomic_fetch_add_32(&pServer->requestNum, 1); + atomic_fetch_add_64(&pServer->requestNum, 1); } } } @@ -398,9 +404,12 @@ static bool httpReadData(HttpContext *pContext) { return true; } } else if (nread < 0) { - if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { + if (errno == EINTR) { + httpDebug("context:%p, fd:%d, read from socket error:%d, continue", pContext, pContext->fd, errno); + continue; + } else if (errno == EAGAIN || errno == EWOULDBLOCK) { httpDebug("context:%p, fd:%d, read from socket error:%d, wait another event", pContext, pContext->fd, errno); - continue; // later again + return false; } else { httpError("context:%p, fd:%d, read from socket error:%d, close connect", pContext, pContext->fd, errno); taosCloseSocket(pContext->fd); diff --git a/src/plugins/http/src/httpSystem.c b/src/plugins/http/src/httpSystem.c index 085863f4e410ec7f80e531db6045594fbed37201..1e388541acf825e4852443bd385c08832b03147a 100644 --- a/src/plugins/http/src/httpSystem.c +++ b/src/plugins/http/src/httpSystem.c @@ -120,4 +120,10 @@ void httpCleanUpSystem() { tsHttpServer.status = HTTP_SERVER_CLOSED; } -int32_t httpGetReqCount() { return atomic_exchange_32(&tsHttpServer.requestNum, 0); } +int64_t httpGetReqCount() { return atomic_exchange_64(&tsHttpServer.requestNum, 0); } +int32_t httpGetStatusCodeCount(int index) { + return atomic_load_32(&tsHttpServer.statusCodeErrs[index]); +} +int32_t httpClearStatusCodeCount(int index) { + return atomic_exchange_32(&tsHttpServer.statusCodeErrs[index], 0); +} diff --git a/src/plugins/monitor/src/monMain.c b/src/plugins/monitor/src/monMain.c index d67f35b4a27215bcb92d2be1711d0868795f4b53..8675d577175723345cec473a9f42267047053040 100644 --- a/src/plugins/monitor/src/monMain.c +++ b/src/plugins/monitor/src/monMain.c @@ -17,11 +17,13 @@ #include "os.h" #include "taosdef.h" #include "taoserror.h" +#include "tfs.h" #include "tlog.h" #include "ttimer.h" #include "tutil.h" #include "tsclient.h" #include "dnode.h" +#include "vnode.h" #include "monitor.h" #include "taoserror.h" @@ -32,10 +34,79 @@ #define monDebug(...) { if (monDebugFlag & DEBUG_DEBUG) { taosPrintLog("MON ", monDebugFlag, __VA_ARGS__); }} #define monTrace(...) { if (monDebugFlag & DEBUG_TRACE) { taosPrintLog("MON ", monDebugFlag, __VA_ARGS__); }} -#define SQL_LENGTH 1030 -#define LOG_LEN_STR 512 -#define IP_LEN_STR TSDB_EP_LEN -#define CHECK_INTERVAL 1000 +#define SQL_LENGTH 4096 +#define LOG_LEN_STR 512 +#define IP_LEN_STR TSDB_EP_LEN +#define VGROUP_STATUS_LEN 512 +#define DNODE_INFO_LEN 128 +#define QUERY_ID_LEN 24 +#define CHECK_INTERVAL 1000 + +static SMonHttpStatus monHttpStatusTable[] = { + {"HTTP_CODE_CONTINUE", 100}, + {"HTTP_CODE_SWITCHING_PROTOCOL", 101}, + {"HTTP_CODE_PROCESSING", 102}, + {"HTTP_CODE_EARLY_HINTS", 103}, + {"HTTP_CODE_OK", 200}, + {"HTTP_CODE_CREATED", 201}, + {"HTTP_CODE_ACCEPTED", 202}, + {"HTTP_CODE_NON_AUTHORITATIVE_INFO", 203}, + {"HTTP_CODE_NO_CONTENT", 204}, + {"HTTP_CODE_RESET_CONTENT", 205}, + {"HTTP_CODE_PARTIAL_CONTENT", 206}, + {"HTTP_CODE_MULTI_STATUS", 207}, + {"HTTP_CODE_ALREADY_REPORTED", 208}, + {"HTTP_CODE_IM_USED", 226}, + {"HTTP_CODE_MULTIPLE_CHOICE", 300}, + {"HTTP_CODE_MOVED_PERMANENTLY", 301}, + {"HTTP_CODE_FOUND", 302}, + {"HTTP_CODE_SEE_OTHER", 303}, + {"HTTP_CODE_NOT_MODIFIED", 304}, + {"HTTP_CODE_USE_PROXY", 305}, + {"HTTP_CODE_UNUSED", 306}, + {"HTTP_CODE_TEMPORARY_REDIRECT", 307}, + {"HTTP_CODE_PERMANENT_REDIRECT", 308}, + {"HTTP_CODE_BAD_REQUEST", 400}, + {"HTTP_CODE_UNAUTHORIZED", 401}, + {"HTTP_CODE_PAYMENT_REQUIRED", 402}, + {"HTTP_CODE_FORBIDDEN", 403}, + {"HTTP_CODE_NOT_FOUND", 404}, + {"HTTP_CODE_METHOD_NOT_ALLOWED", 405}, + {"HTTP_CODE_NOT_ACCEPTABLE", 406}, + {"HTTP_CODE_PROXY_AUTH_REQUIRED", 407}, + {"HTTP_CODE_REQUEST_TIMEOUT", 408}, + {"HTTP_CODE_CONFLICT", 409}, + {"HTTP_CODE_GONE", 410}, + {"HTTP_CODE_LENGTH_REQUIRED", 411}, + {"HTTP_CODE_PRECONDITION_FAILED", 412}, + {"HTTP_CODE_PAYLOAD_TOO_LARGE", 413}, + {"HTTP_CODE_URI_TOO_LARGE", 414}, + {"HTTP_CODE_UNSUPPORTED_MEDIA_TYPE", 415}, + {"HTTP_CODE_RANGE_NOT_SATISFIABLE", 416}, + {"HTTP_CODE_EXPECTATION_FAILED", 417}, + {"HTTP_CODE_IM_A_TEAPOT", 418}, + {"HTTP_CODE_MISDIRECTED_REQUEST", 421}, + {"HTTP_CODE_UNPROCESSABLE_ENTITY", 422}, + {"HTTP_CODE_LOCKED", 423}, + {"HTTP_CODE_FAILED_DEPENDENCY", 424}, + {"HTTP_CODE_TOO_EARLY", 425}, + {"HTTP_CODE_UPGRADE_REQUIRED", 426}, + {"HTTP_CODE_PRECONDITION_REQUIRED", 428}, + {"HTTP_CODE_TOO_MANY_REQUESTS", 429}, + {"HTTP_CODE_REQ_HDR_FIELDS_TOO_LARGE",431}, + {"HTTP_CODE_UNAVAIL_4_LEGAL_REASONS", 451}, + {"HTTP_CODE_INTERNAL_SERVER_ERROR", 500}, + {"HTTP_CODE_NOT_IMPLEMENTED", 501}, + {"HTTP_CODE_BAD_GATEWAY", 502}, + {"HTTP_CODE_SERVICE_UNAVAILABLE", 503}, + {"HTTP_CODE_GATEWAY_TIMEOUT", 504}, + {"HTTP_CODE_HTTP_VER_NOT_SUPPORTED", 505}, + {"HTTP_CODE_VARIANT_ALSO_NEGOTIATES", 506}, + {"HTTP_CODE_INSUFFICIENT_STORAGE", 507}, + {"HTTP_CODE_LOOP_DETECTED", 508}, + {"HTTP_CODE_NOT_EXTENDED", 510}, + {"HTTP_CODE_NETWORK_AUTH_REQUIRED", 511} +}; typedef enum { MON_CMD_CREATE_DB, @@ -45,6 +116,18 @@ typedef enum { MON_CMD_CREATE_TB_DN, MON_CMD_CREATE_TB_ACCT_ROOT, MON_CMD_CREATE_TB_SLOWQUERY, + //followings are extension for taoskeeper + MON_CMD_CREATE_TB_CLUSTER, + MON_CMD_CREATE_MT_DNODES, + MON_CMD_CREATE_TB_DNODE, + MON_CMD_CREATE_MT_DISKS, + MON_CMD_CREATE_TB_DISKS, + MON_CMD_CREATE_MT_VGROUPS, + MON_CMD_CREATE_MT_LOGS, + MON_CMD_CREATE_TB_DNODE_LOG, + MON_CMD_CREATE_TB_GRANTS, + MON_CMD_CREATE_MT_RESTFUL, + MON_CMD_CREATE_TB_RESTFUL, MON_CMD_MAX } EMonCmd; @@ -60,17 +143,46 @@ typedef struct { int8_t cmdIndex; int8_t state; int8_t start; // enable/disable by mnode - int8_t quiting; // taosd is quiting + int8_t quiting; // taosd is quiting char sql[SQL_LENGTH + 1]; } SMonConn; +typedef struct { + SDnodeStatisInfo dInfo; + SVnodeStatisInfo vInfo; + float io_read; + float io_write; + float io_read_disk; + float io_write_disk; + int32_t monQueryReqCnt; + int32_t monSubmitReqCnt; +} SMonStat; + +static void *monHttpStatusHashTable; + static SMonConn tsMonitor = {0}; +static SMonStat tsMonStat = {{0}}; +static int32_t monQueryReqNum = 0, monSubmitReqNum = 0; +static bool monHasMnodeMaster = false; + static void monSaveSystemInfo(); +static void monSaveClusterInfo(); +static void monSaveDnodesInfo(); +static void monSaveVgroupsInfo(); +static void monSaveSlowQueryInfo(); +static void monSaveDisksInfo(); +static void monSaveGrantsInfo(); +static void monSaveHttpReqInfo(); +static void monGetSysStats(); static void *monThreadFunc(void *param); static void monBuildMonitorSql(char *sql, int32_t cmd); +static void monInitHttpStatusHashTable(); +static void monCleanupHttpStatusHashTable(); + extern int32_t (*monStartSystemFp)(); extern void (*monStopSystemFp)(); extern void (*monExecuteSQLFp)(char *sql); +extern char * strptime(const char *buf, const char *fmt, struct tm *tm); //make the compilation pass int32_t monInitSystem() { if (tsMonitor.ep[0] == 0) { @@ -83,6 +195,7 @@ int32_t monInitSystem() { tsMonitor.ep[i] = '_'; } } + monInitHttpStatusHashTable(); pthread_attr_t thAttr; pthread_attr_init(&thAttr); @@ -111,6 +224,31 @@ int32_t monStartSystem() { return 0; } +static void monInitHttpStatusHashTable() { + int32_t numOfEntries = tListLen(monHttpStatusTable); + monHttpStatusHashTable = taosHashInit(numOfEntries, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false); + for (int32_t i = 0; i < numOfEntries; ++i) { + monHttpStatusTable[i].index = i; + SMonHttpStatus* pEntry = &monHttpStatusTable[i]; + taosHashPut(monHttpStatusHashTable, &monHttpStatusTable[i].code, sizeof(int32_t), + &pEntry, POINTER_BYTES); + } +} + +static void monCleanupHttpStatusHashTable() { + void* m = monHttpStatusHashTable; + if (m != NULL && atomic_val_compare_exchange_ptr(&monHttpStatusHashTable, m, 0) == m) { + taosHashCleanup(m); + } +} + +SMonHttpStatus *monGetHttpStatusHashTableEntry(int32_t code) { + if (monHttpStatusHashTable == NULL) { + return NULL; + } + return (SMonHttpStatus*)taosHashGet(monHttpStatusHashTable, &code, sizeof(int32_t)); +} + static void *monThreadFunc(void *param) { monDebug("starting to initialize monitor module ..."); setThreadName("monitor"); @@ -131,7 +269,7 @@ static void *monThreadFunc(void *param) { if (tsMonitor.start == 0) { continue; } - + if (dnodeGetDnodeId() <= 0) { monDebug("dnode not initialized, waiting for 3000 ms to start monitor module"); continue; @@ -172,6 +310,19 @@ static void *monThreadFunc(void *param) { if (tsMonitor.state == MON_STATE_INITED) { if (accessTimes % tsMonitorInterval == 0) { + monGetSysStats(); + //monSaveDnodesInfo has to be the first, as it calculates + //stats using monSubmitReqNum before any insertion from monitor + monSaveDnodesInfo(); + if (monHasMnodeMaster) { + //only mnode master will write cluster info + monSaveClusterInfo(); + } + monSaveVgroupsInfo(); + monSaveSlowQueryInfo(); + monSaveDisksInfo(); + monSaveGrantsInfo(); + monSaveHttpReqInfo(); monSaveSystemInfo(); } } @@ -192,9 +343,9 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) { if (cmd == MON_CMD_CREATE_DB) { snprintf(sql, SQL_LENGTH, - "create database if not exists %s replica 1 days 10 keep %s cache %d " + "create database if not exists %s replica %d days 10 keep %s cache %d " "blocks %d precision 'us'", - tsMonitorDbName, keepValue, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MIN_TOTAL_BLOCKS); + tsMonitorDbName, tsMonitorReplica, keepValue, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MIN_TOTAL_BLOCKS); } else if (cmd == MON_CMD_CREATE_MT_DN) { snprintf(sql, SQL_LENGTH, "create table if not exists %s.dn(ts timestamp" @@ -203,7 +354,7 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) { ", disk_used float, disk_total int" ", band_speed float" ", io_read float, io_write float" - ", req_http int, req_select int, req_insert int" + ", req_http bigint, req_select bigint, req_insert bigint" ") tags (dnodeid int, fqdn binary(%d))", tsMonitorDbName, TSDB_FQDN_LEN); } else if (cmd == MON_CMD_CREATE_TB_DN) { @@ -230,14 +381,96 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) { tsMonitorDbName, TSDB_DEFAULT_USER); } else if (cmd == MON_CMD_CREATE_TB_SLOWQUERY) { snprintf(sql, SQL_LENGTH, - "create table if not exists %s.slowquery(ts timestamp, username " - "binary(%d), created_time timestamp, time bigint, sql binary(%d))", - tsMonitorDbName, TSDB_TABLE_FNAME_LEN - 1, TSDB_SLOW_QUERY_SQL_LEN); + "create table if not exists %s.slowquery(ts timestamp, query_id " + "binary(%d), username binary(%d), qid binary(%d), created_time timestamp, time bigint, end_point binary(%d), sql binary(%d))", + tsMonitorDbName, QUERY_ID_LEN, TSDB_TABLE_FNAME_LEN - 1, QUERY_ID_LEN, TSDB_EP_LEN, TSDB_SLOW_QUERY_SQL_LEN); } else if (cmd == MON_CMD_CREATE_TB_LOG) { snprintf(sql, SQL_LENGTH, "create table if not exists %s.log(ts timestamp, level tinyint, " "content binary(%d), ipaddr binary(%d))", tsMonitorDbName, LOG_LEN_STR, IP_LEN_STR); + } else if (cmd == MON_CMD_CREATE_TB_CLUSTER) { + snprintf(sql, SQL_LENGTH, + "create table if not exists %s.cluster_info(ts timestamp" + ", first_ep binary(%d), version binary(%d)" + ", master_uptime float, monitor_interval int" + ", dnodes_total int, dnodes_alive int" + ", mnodes_total int, mnodes_alive int" + ", vgroups_total int, vgroups_alive int" + ", vnodes_total int, vnodes_alive int" + ", connections_total int)", + tsMonitorDbName, TSDB_EP_LEN, TSDB_VERSION_LEN); + } else if (cmd == MON_CMD_CREATE_MT_DNODES) { + snprintf(sql, SQL_LENGTH, + "create table if not exists %s.dnodes_info(ts timestamp" + ", uptime float" + ", cpu_engine float, cpu_system float, cpu_cores int" + ", mem_engine float, mem_system float, mem_total float" + ", disk_engine float, disk_used float, disk_total float" + ", net_in float, net_out float" + ", io_read float, io_write float" + ", io_read_disk float, io_write_disk float" + ", req_http bigint, req_http_rate float" + ", req_select bigint, req_select_rate float" + ", req_insert bigint, req_insert_success bigint, req_insert_rate float" + ", req_insert_batch bigint, req_insert_batch_success bigint, req_insert_batch_rate float" + ", errors bigint" + ", vnodes_num int" + ", masters int" + ", has_mnode bool" + ") tags (dnode_id int, dnode_ep binary(%d))", + tsMonitorDbName, TSDB_EP_LEN); + } else if (cmd == MON_CMD_CREATE_TB_DNODE) { + snprintf(sql, SQL_LENGTH, "create table if not exists %s.dnode_%d using %s.dnodes_info tags(%d, '%s')", tsMonitorDbName, + dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp); + } else if (cmd == MON_CMD_CREATE_MT_DISKS) { + snprintf(sql, SQL_LENGTH, + "create table if not exists %s.disks_info(ts timestamp" + ", datadir_l0_used float, datadir_l0_total float" + ", datadir_l1_used float, datadir_l1_total float" + ", datadir_l2_used float, datadir_l2_total float" + ") tags (dnode_id int, dnode_ep binary(%d))", + tsMonitorDbName, TSDB_EP_LEN); + } else if (cmd == MON_CMD_CREATE_TB_DISKS) { + snprintf(sql, SQL_LENGTH, "create table if not exists %s.disks_%d using %s.disks_info tags(%d, '%s')", tsMonitorDbName, + dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp); + } else if (cmd == MON_CMD_CREATE_MT_VGROUPS) { + snprintf(sql, SQL_LENGTH, + "create table if not exists %s.vgroups_info(ts timestamp" + ", database_name binary(%d)" + ", tables_num int, status binary(%d)" + ", online_vnodes tinyint" + ", dnode_ids binary(%d), dnode_roles binary(%d)" + ") tags (vgroup_id int)", + tsMonitorDbName, TSDB_DB_NAME_LEN, VGROUP_STATUS_LEN, + DNODE_INFO_LEN, DNODE_INFO_LEN); + } else if (cmd == MON_CMD_CREATE_MT_LOGS) { + snprintf(sql, SQL_LENGTH, + "create table if not exists %s.logs(ts timestamp, level tinyint, " + "content binary(%d)) tags (dnode_id int, dnode_ep binary(%d))", + tsMonitorDbName, LOG_LEN_STR, TSDB_EP_LEN); + } else if (cmd == MON_CMD_CREATE_TB_DNODE_LOG) { + snprintf(sql, SQL_LENGTH, "create table if not exists %s.dnode_%d_log using %s.logs tags(%d, '%s')", tsMonitorDbName, + dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp); + } else if (cmd == MON_CMD_CREATE_TB_GRANTS) { + snprintf(sql, SQL_LENGTH, + "create table if not exists %s.grants_info(ts timestamp" + ", expire_time int, timeseries_used int, timeseries_total int)", + tsMonitorDbName); + } else if (cmd == MON_CMD_CREATE_MT_RESTFUL) { + int pos = snprintf(sql, SQL_LENGTH, + "create table if not exists %s.restful_info(ts timestamp", tsMonitorDbName); + for (int i = 0; i < tListLen(monHttpStatusTable); ++i) { + pos += snprintf(sql + pos, SQL_LENGTH, ", `%s(%d)` int", + monHttpStatusTable[i].name, + monHttpStatusTable[i].code); + } + snprintf(sql + pos, SQL_LENGTH, + ") tags (dnode_id int, dnode_ep binary(%d))", + TSDB_EP_LEN); + } else if (cmd == MON_CMD_CREATE_TB_RESTFUL) { + snprintf(sql, SQL_LENGTH, "create table if not exists %s.restful_%d using %s.restful_info tags(%d, '%s')", tsMonitorDbName, + dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp); } sql[SQL_LENGTH] = 0; @@ -261,9 +494,25 @@ void monCleanupSystem() { taos_close(tsMonitor.conn); tsMonitor.conn = NULL; } + monCleanupHttpStatusHashTable(); monInfo("monitor module is cleaned up"); } +static void monGetSysStats() { + memset(&tsMonStat, 0, sizeof(SMonStat)); + bool suc = taosGetProcIO(&tsMonStat.io_read, &tsMonStat.io_write, + &tsMonStat.io_read_disk, &tsMonStat.io_write_disk); + if (!suc) { + monDebug("failed to get io info"); + } + + tsMonStat.dInfo = dnodeGetStatisInfo(); + tsMonStat.vInfo = vnodeGetStatisInfo(); + + tsMonStat.monQueryReqCnt = monFetchQueryReqCnt(); + tsMonStat.monSubmitReqCnt = monFetchSubmitReqCnt(); +} + // unit is MB static int32_t monBuildMemorySql(char *sql) { float sysMemoryUsedMB = 0; @@ -278,7 +527,7 @@ static int32_t monBuildMemorySql(char *sql) { monDebug("failed to get proc memory info"); } - return sprintf(sql, ", %f, %f, %d", procMemoryUsedMB, sysMemoryUsedMB, tsTotalMemoryMB); + return snprintf(sql, SQL_LENGTH, ", %f, %f, %d", procMemoryUsedMB, sysMemoryUsedMB, tsTotalMemoryMB); } // unit is % @@ -293,12 +542,12 @@ static int32_t monBuildCpuSql(char *sql) { sysCpuUsage = procCpuUsage + 0.1f; } - return sprintf(sql, ", %f, %f, %d", procCpuUsage, sysCpuUsage, tsNumOfCores); + return snprintf(sql, SQL_LENGTH, ", %f, %f, %d", procCpuUsage, sysCpuUsage, tsNumOfCores); } // unit is GB static int32_t monBuildDiskSql(char *sql) { - return sprintf(sql, ", %f, %d", tsUsedDataDirGB, (int32_t)tsTotalDataDirGB); + return snprintf(sql, SQL_LENGTH, ", %f, %d", tsUsedDataDirGB, (int32_t)tsTotalDataDirGB); } // unit is Kb @@ -309,22 +558,20 @@ static int32_t monBuildBandSql(char *sql) { monDebug("failed to get bandwidth speed"); } - return sprintf(sql, ", %f", bandSpeedKb); + return snprintf(sql, SQL_LENGTH, ", %f", bandSpeedKb); } static int32_t monBuildReqSql(char *sql) { - SStatisInfo info = dnodeGetStatisInfo(); - return sprintf(sql, ", %d, %d, %d)", info.httpReqNum, info.queryReqNum, info.submitReqNum); + SDnodeStatisInfo info = tsMonStat.dInfo; + return snprintf(sql, SQL_LENGTH, ", %"PRId64", %"PRId64", %"PRId64")", info.httpReqNum, info.queryReqNum, info.submitReqNum); } static int32_t monBuildIoSql(char *sql) { float readKB = 0, writeKB = 0; - bool suc = taosGetProcIO(&readKB, &writeKB); - if (!suc) { - monDebug("failed to get io info"); - } + readKB = tsMonStat.io_read; + writeKB = tsMonStat.io_write; - return sprintf(sql, ", %f, %f", readKB, writeKB); + return snprintf(sql, SQL_LENGTH, ", %f, %f", readKB, writeKB); } static void monSaveSystemInfo() { @@ -346,15 +593,773 @@ static void monSaveSystemInfo() { if (code != 0) { monError("failed to save system info, reason:%s, sql:%s", tstrerror(code), tsMonitor.sql); } else { + monIncSubmitReqCnt(); monDebug("successfully to save system info, sql:%s", tsMonitor.sql); } } +static int32_t monGetRowElemCharLen(TAOS_FIELD field, char *rowElem) { + int32_t charLen = varDataLen(rowElem - VARSTR_HEADER_SIZE); + if (field.type == TSDB_DATA_TYPE_BINARY) { + assert(charLen <= field.bytes && charLen >= 0); + } else { + assert(charLen <= field.bytes * TSDB_NCHAR_SIZE && charLen >= 0); + } + + return charLen; +} + +static int32_t monBuildFirstEpSql(char *sql) { + return snprintf(sql, SQL_LENGTH, ", \"%s\"", tsFirst); +} + +static int32_t monBuildVersionSql(char *sql) { + return snprintf(sql, SQL_LENGTH, ", \"%s\"", version); +} + +static int32_t monBuildMasterUptimeSql(char *sql) { + int64_t masterUptime = 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show mnodes"); + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "role") == 0 && strcmp((char *)row[i], "master") == 0) { + if (strcmp(fields[i + 1].name, "role_time") == 0) { + int64_t now = taosGetTimestamp(TSDB_TIME_PRECISION_MILLI); + //master uptime in seconds + masterUptime = (now - *(int64_t *)row[i + 1]) / 1000; + } + } + } + } + + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %" PRId64, masterUptime); +} + +static int32_t monBuildMonIntervalSql(char *sql) { + return snprintf(sql, SQL_LENGTH, ", %d", tsMonitorInterval); +} + +static int32_t monBuildDnodesTotalSql(char *sql) { + int32_t totalDnodes = 0, totalDnodesAlive = 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show dnodes"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show dnodes, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + totalDnodes++; + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "status") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], "ready", charLen) == 0) { + totalDnodesAlive++; + } + } + } + } + + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %d, %d", totalDnodes, totalDnodesAlive); +} + +static int32_t monBuildMnodesTotalSql(char *sql) { + int32_t totalMnodes = 0, totalMnodesAlive= 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show mnodes"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show mnodes, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + totalMnodes++; + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "role") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], "master", charLen) == 0 || + strncmp((char *)row[i], "slave", charLen) == 0) { + totalMnodesAlive += 1; + } + } + } + } + + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %d, %d", totalMnodes, totalMnodesAlive); +} + + +static int32_t monGetVgroupsTotalStats(char *dbName, int32_t *totalVgroups, + int32_t *totalVgroupsAlive) { + char subsql[TSDB_DB_NAME_LEN + 14]; + memset(subsql, 0, sizeof(subsql)); + snprintf(subsql, TSDB_DB_NAME_LEN + 13, "show %s.vgroups", dbName); + TAOS_RES *result = taos_query(tsMonitor.conn, subsql); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show %s.vgroups, reason:%s", dbName, tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + *totalVgroups += 1; + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "status") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], "ready", charLen) == 0) { + *totalVgroupsAlive += 1; + } + } + } + } + taos_free_result(result); + + return 0; +} + +static int32_t monBuildVgroupsTotalSql(char *sql) { + int32_t totalVgroups = 0, totalVgroupsAlive = 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show databases"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show databases, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + for (int i = 0; i < num_fields; ++i) { + //database name + if (strcmp(fields[i].name, "name") == 0) { + monGetVgroupsTotalStats((char *)row[i], &totalVgroups, &totalVgroupsAlive); + } + } + } + + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %d, %d", totalVgroups, totalVgroupsAlive); +} + +static int32_t monGetVnodesTotalStats(char *ep, int32_t *totalVnodes, + int32_t *totalVnodesAlive) { + char subsql[TSDB_EP_LEN + 15]; + memset(subsql, 0, sizeof(subsql)); + snprintf(subsql, TSDB_EP_LEN, "show vnodes \"%s\"", ep); + TAOS_RES *result = taos_query(tsMonitor.conn, subsql); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show vnodes \"%s\", reason:%s", ep, tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + *totalVnodes += 1; + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "status") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], "master", charLen) == 0 || + strncmp((char *)row[i], "slave", charLen) == 0) { + *totalVnodesAlive += 1; + } + } + } + } + taos_free_result(result); + + return 0; +} + +static int32_t monBuildVnodesTotalSql(char *sql) { + int32_t totalVnodes = 0, totalVnodesAlive = 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show dnodes"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show dnodes, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + for (int i = 0; i < num_fields; ++i) { + //database name + if (strcmp(fields[i].name, "end_point") == 0) { + monGetVnodesTotalStats((char *)row[i], &totalVnodes, &totalVnodesAlive); + } + } + } + + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %d, %d", totalVnodes, totalVnodesAlive); +} + +static int32_t monBuildConnsTotalSql(char *sql) { + int32_t totalConns = 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show connections"); + TAOS_ROW row; + + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show connections, reason:%s", tstrerror(code)); + } + + while ((row = taos_fetch_row(result))) { + totalConns++; + } + + taos_free_result(result); + return snprintf(sql, SQL_LENGTH, ", %d)", totalConns); +} + +static int32_t monBuildDnodeUptimeSql(char *sql) { + int64_t dnodeUptime = 0; + TAOS_RES *result = taos_query(tsMonitor.conn, "show dnodes"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show dnodes, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + bool is_self_ep = false; + while ((row = taos_fetch_row(result))) { + if (is_self_ep) { + break; + } + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "end_point") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], tsLocalEp, charLen) == 0) { + is_self_ep = true; + } + } + if (strcmp(fields[i].name, "create_time") == 0) { + if (is_self_ep) { + int64_t now = taosGetTimestamp(TSDB_TIME_PRECISION_MILLI); + //dnodes uptime in seconds + dnodeUptime = (now - *(int64_t *)row[i]) / 1000; + } + } + } + } + + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %" PRId64, dnodeUptime); +} + +static int32_t monBuildDnodeIoSql(char *sql) { + float rcharKB = 0, wcharKB = 0; + float rbyteKB = 0, wbyteKB = 0; + rcharKB = tsMonStat.io_read; + wcharKB = tsMonStat.io_write; + rbyteKB = tsMonStat.io_read_disk; + wbyteKB = tsMonStat.io_write_disk; + + return snprintf(sql, SQL_LENGTH, ", %f, %f, %f, %f", rcharKB / 1024, wcharKB / 1024, + rbyteKB / 1024, wbyteKB / 1024); +} + +static int32_t monBuildNetworkIOSql(char *sql) { + float netInKb = 0, netOutKb = 0; + bool suc = taosGetNetworkIO(&netInKb, &netOutKb); + if (!suc) { + monDebug("failed to get network I/O info"); + } + + return snprintf(sql, SQL_LENGTH, ", %f, %f", netInKb / 1024, + netOutKb / 1024); +} + +static int32_t monBuildDnodeReqSql(char *sql) { + int64_t queryReqNum = tsMonStat.dInfo.queryReqNum - tsMonStat.monQueryReqCnt; + int64_t submitReqNum = tsMonStat.dInfo.submitReqNum; + int64_t submitRowNum = tsMonStat.vInfo.submitRowNum; + int64_t submitReqSucNum = tsMonStat.vInfo.submitReqSucNum; + int64_t submitRowSucNum = tsMonStat.vInfo.submitRowSucNum; + + float interval = (float)(tsMonitorInterval * 1.0); + float httpReqRate = tsMonStat.dInfo.httpReqNum / interval; + float queryReqRate = queryReqNum / interval; + float submitReqRate = submitReqNum / interval; + float submitRowRate = submitRowNum / interval; + + return snprintf(sql, SQL_LENGTH, ", %"PRId64", %f, %"PRId64", %f, %"PRId64", %"PRId64", %f, %"PRId64", %"PRId64", %f", + tsMonStat.dInfo.httpReqNum, httpReqRate, + queryReqNum, queryReqRate, + submitRowNum, submitRowSucNum, submitRowRate, + submitReqNum, submitReqSucNum, submitReqRate); +} + +static int32_t monBuildDnodeErrorsSql(char *sql) { + int64_t dnode_err = dnodeGetDnodeError(); + return snprintf(sql, SQL_LENGTH, ", %"PRId64, dnode_err); +} + +static int32_t monBuildDnodeVnodesSql(char *sql) { + int32_t vnodeNum = 0, masterNum = 0; + char sqlStr[TSDB_EP_LEN + 15]; + memset(sqlStr, 0, sizeof(sqlStr)); + snprintf(sqlStr, TSDB_EP_LEN + 14, "show vnodes \"%s\"", tsLocalEp); + TAOS_RES *result = taos_query(tsMonitor.conn, sqlStr); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show vnodes \"%s\", reason:%s", tsLocalEp, tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + vnodeNum += 1; + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "status") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], "master", charLen) == 0) { + masterNum += 1; + } + } + } + } + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %d, %d", vnodeNum, masterNum); +} + +static int32_t monBuildDnodeMnodeSql(char *sql) { + bool has_mnode = false, has_mnode_row; + TAOS_RES *result = taos_query(tsMonitor.conn, "show mnodes"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show mnodes, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + has_mnode_row = false; + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "end_point") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], tsLocalEp, charLen) == 0) { + has_mnode = true; + has_mnode_row = true; + } + } else if (strcmp(fields[i].name, "role") == 0) { + int32_t charLen = monGetRowElemCharLen(fields[i], (char *)row[i]); + if (strncmp((char *)row[i], "master", charLen) == 0) { + if (has_mnode_row) { + monHasMnodeMaster = true; + } + } + } + } + } + taos_free_result(result); + + return snprintf(sql, SQL_LENGTH, ", %s)", has_mnode ? "true" : "false"); +} + +static int32_t monBuildDnodeDiskSql(char *sql) { + float taosdDataDirGB = 0; + return snprintf(sql, SQL_LENGTH, ", %f, %f, %f", taosdDataDirGB, tsUsedDataDirGB, tsTotalDataDirGB); +} + +static int32_t monBuildDiskTierSql(char *sql) { + const int8_t numTiers = 3; + const double unit = 1024 * 1024 * 1024; + SFSMeta fsMeta; + STierMeta* tierMetas = calloc(numTiers, sizeof(STierMeta)); + tfsUpdateInfo(&fsMeta, tierMetas, numTiers); + int32_t pos = 0; + + for (int i = 0; i < numTiers; ++i) { + pos += snprintf(sql + pos, SQL_LENGTH, ", %f, %f", (float)(tierMetas[i].used / unit), (float)(tierMetas[i].size / unit)); + } + pos += snprintf(sql + pos, SQL_LENGTH, ")"); + + free(tierMetas); + + return pos; +} + +static void monSaveClusterInfo() { + int64_t ts = taosGetTimestampUs(); + char * sql = tsMonitor.sql; + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.cluster_info values(%" PRId64, tsMonitorDbName, ts); + + pos += monBuildFirstEpSql(sql + pos); + pos += monBuildVersionSql(sql + pos); + pos += monBuildMasterUptimeSql(sql + pos); + pos += monBuildMonIntervalSql(sql + pos); + pos += monBuildDnodesTotalSql(sql + pos); + pos += monBuildMnodesTotalSql(sql + pos); + pos += monBuildVgroupsTotalSql(sql + pos); + pos += monBuildVnodesTotalSql(sql + pos); + pos += monBuildConnsTotalSql(sql + pos); + + monDebug("save cluster, sql:%s", sql); + + void *res = taos_query(tsMonitor.conn, tsMonitor.sql); + int32_t code = taos_errno(res); + taos_free_result(res); + + if (code != 0) { + monError("failed to save cluster info, reason:%s, sql:%s", tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save cluster info, sql:%s", tsMonitor.sql); + } +} + +static void monSaveDnodesInfo() { + int64_t ts = taosGetTimestampUs(); + char * sql = tsMonitor.sql; + int64_t intervalUs = tsMonitorInterval * 1000000; + ts = ts / intervalUs * intervalUs; //To align timestamp to integer multiples of monitor interval + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.dnode_%d values(%" PRId64, tsMonitorDbName, dnodeGetDnodeId(), ts); + + pos += monBuildDnodeUptimeSql(sql + pos); + pos += monBuildCpuSql(sql + pos); + pos += monBuildMemorySql(sql + pos); + pos += monBuildDnodeDiskSql(sql + pos); + pos += monBuildNetworkIOSql(sql + pos); + pos += monBuildDnodeIoSql(sql + pos); + pos += monBuildDnodeReqSql(sql + pos); + pos += monBuildDnodeErrorsSql(sql + pos); + pos += monBuildDnodeVnodesSql(sql + pos); + pos += monBuildDnodeMnodeSql(sql + pos); + + monDebug("save dnodes, sql:%s", sql); + + void *res = taos_query(tsMonitor.conn, tsMonitor.sql); + int32_t code = taos_errno(res); + taos_free_result(res); + + if (code != 0) { + monError("failed to save dnode_%d info, reason:%s, sql:%s", dnodeGetDnodeId(), tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save dnode_%d info, sql:%s", dnodeGetDnodeId(), tsMonitor.sql); + } +} + + +static int32_t checkCreateVgroupTable(int32_t vgId) { + char subsql[256]; + bool create_table = false; + int32_t code = TSDB_CODE_SUCCESS; + + memset(subsql, 0, sizeof(subsql)); + snprintf(subsql, 255, "describe %s.vgroup_%d", tsMonitorDbName, vgId); + + TAOS_RES *result = taos_query(tsMonitor.conn, subsql); + code = taos_errno(result); + if (code != 0) { + create_table = true; + snprintf(subsql, sizeof(subsql), "create table if not exists %s.vgroup_%d using %s.vgroups_info tags(%d)", + tsMonitorDbName, vgId, tsMonitorDbName, vgId); + monError("table vgroup_%d not exist, create table vgroup_%d", vgId, vgId); + } + taos_free_result(result); + + if (create_table == true) { + result = taos_query(tsMonitor.conn, subsql); + code = taos_errno(result); + taos_free_result(result); + } + + return code; +} + +static uint32_t monBuildVgroupsInfoSql(char *sql, char *dbName) { + char v_dnode_ids[256], v_dnode_status[1024]; + int64_t ts = taosGetTimestampUs(); + + memset(sql, 0, SQL_LENGTH + 1); + snprintf(sql, SQL_LENGTH, "show %s.vgroups", dbName); + TAOS_RES *result = taos_query(tsMonitor.conn, sql); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show %s.vgroups, reason:%s", dbName, tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + int32_t vgId; + int32_t pos = 0; + + for (int i = 0; i < num_fields; ++i) { + const char *v_dnode_str = strchr(fields[i].name, '_'); + if (strcmp(fields[i].name, "vgId") == 0) { + vgId = *(int32_t *)row[i]; + if (checkCreateVgroupTable(vgId) == TSDB_CODE_SUCCESS) { + memset(sql, 0, SQL_LENGTH + 1); + pos += snprintf(sql, SQL_LENGTH, "insert into %s.vgroup_%d values(%" PRId64 ", \"%s\"", + tsMonitorDbName, vgId, ts, dbName); + } else { + return TSDB_CODE_SUCCESS; + } + } else if (strcmp(fields[i].name, "tables") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", %d", *(int32_t *)row[i]); + + } else if (strcmp(fields[i].name, "status") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\"", (char *)row[i]); + } else if (strcmp(fields[i].name, "onlines") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", %d", *(int32_t *)row[i]); + } else if (v_dnode_str && strcmp(v_dnode_str, "_dnode") == 0) { + snprintf(v_dnode_ids, sizeof(v_dnode_ids), "%d;", *(int16_t *)row[i]); + } else if (v_dnode_str && strcmp(v_dnode_str, "_status") == 0) { + snprintf(v_dnode_status, sizeof(v_dnode_status), "%s;", (char *)row[i]); + } else if (strcmp(fields[i].name, "compacting") == 0) { + //flush dnode_ids and dnode_role in to sql + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\", \"%s\")", v_dnode_ids, v_dnode_status); + } + } + monDebug("save vgroups, sql:%s", sql); + TAOS_RES *res = taos_query(tsMonitor.conn, sql); + code = taos_errno(res); + taos_free_result(res); + if (code != 0) { + monError("failed to save vgroup_%d info, reason:%s, sql:%s", vgId, tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save vgroup_%d info, sql:%s", vgId, tsMonitor.sql); + } + } + taos_free_result(result); + + return TSDB_CODE_SUCCESS; +} + +static void monSaveVgroupsInfo() { + char * sql = tsMonitor.sql; + TAOS_RES *result = taos_query(tsMonitor.conn, "show databases"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show databases, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + for (int i = 0; i < num_fields; ++i) { + //database name + if (strcmp(fields[i].name, "name") == 0) { + monBuildVgroupsInfoSql(sql, (char *)row[i]); + } + } + } + + taos_free_result(result); +} + +static void monSaveSlowQueryInfo() { + int64_t ts = taosGetTimestampUs(); + char * sql = tsMonitor.sql; + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.slowquery values(%" PRId64, tsMonitorDbName, ts); + bool has_slowquery = false; + + TAOS_RES *result = taos_query(tsMonitor.conn, "show queries"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + monError("failed to execute cmd: show queries, reason:%s", tstrerror(code)); + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "query_id") == 0) { + has_slowquery = true; + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\"", (char *)row[i]); + } else if (strcmp(fields[i].name, "user") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\"", (char *)row[i]); + } else if (strcmp(fields[i].name, "qid") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\"", (char *)row[i]); + } else if (strcmp(fields[i].name, "created_time") == 0) { + int64_t create_time = *(int64_t *)row[i]; + create_time = convertTimePrecision(create_time, TSDB_TIME_PRECISION_MILLI, TSDB_TIME_PRECISION_MICRO); + pos += snprintf(sql + pos, SQL_LENGTH, ", %" PRId64 "", create_time); + } else if (strcmp(fields[i].name, "time") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", %" PRId64 "", *(int64_t *)row[i]); + } else if (strcmp(fields[i].name, "ep") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\"", (char *)row[i]); + } else if (strcmp(fields[i].name, "sql") == 0) { + pos += snprintf(sql + pos, SQL_LENGTH, ", \"%s\")", (char *)row[i]); + } + } + } + + monDebug("save slow query, sql:%s", sql); + taos_free_result(result); + if (!has_slowquery) { + return; + } + void *res = taos_query(tsMonitor.conn, tsMonitor.sql); + code = taos_errno(res); + taos_free_result(res); + + if (code != 0) { + monError("failed to save slowquery info, reason:%s, sql:%s", tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save slowquery info, sql:%s", tsMonitor.sql); + } + +} + +static void monSaveDisksInfo() { + int64_t ts = taosGetTimestampUs(); + char * sql = tsMonitor.sql; + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.disks_%d values(%" PRId64, tsMonitorDbName, dnodeGetDnodeId(), ts); + + monBuildDiskTierSql(sql + pos); + + monDebug("save disk, sql:%s", sql); + + void *res = taos_query(tsMonitor.conn, tsMonitor.sql); + int32_t code = taos_errno(res); + taos_free_result(res); + + if (code != 0) { + monError("failed to save disks_%d info, reason:%s, sql:%s", dnodeGetDnodeId(), tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save disks_%d info, sql:%s", dnodeGetDnodeId(), tsMonitor.sql); + } +} + +static void monSaveGrantsInfo() { + int64_t ts = taosGetTimestampUs(); + char * sql = tsMonitor.sql; + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.grants_info values(%" PRId64, tsMonitorDbName, ts); + + TAOS_RES *result = taos_query(tsMonitor.conn, "show grants"); + int32_t code = taos_errno(result); + if (code != TSDB_CODE_SUCCESS) { + taos_free_result(result); + return; + } + + TAOS_ROW row; + int32_t num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + while ((row = taos_fetch_row(result))) { + for (int i = 0; i < num_fields; ++i) { + if (strcmp(fields[i].name, "expire time") == 0) { + char *expStr = (char *)row[i]; + if (expStr[0] == 'u') { + pos += snprintf(sql + pos, SQL_LENGTH, ", NULL"); + } else { + struct tm expTime = {0}; + strptime((char *)row[i], "%Y-%m-%d %H:%M:%S", &expTime); + int32_t expTimeSec = (int32_t)mktime(&expTime); + pos += snprintf(sql + pos, SQL_LENGTH, ", %d", expTimeSec - taosGetTimestampSec()); + } + } else if (strcmp(fields[i].name, "timeseries") == 0) { + char *timeseries = (char *)row[i]; + if (timeseries[0] == 'u') { + pos += snprintf(sql + pos, SQL_LENGTH, ", NULL, NULL)"); + } else { + int32_t timeseries_used = strtol(timeseries, NULL, 10); + timeseries = strchr(timeseries, '/'); + int32_t timeseries_total = strtol(timeseries + 1, NULL, 10); + pos += snprintf(sql + pos, SQL_LENGTH, ", %d, %d)", timeseries_used, timeseries_total); + } + } + } + } + + monDebug("save grants, sql:%s", sql); + taos_free_result(result); + + void *res = taos_query(tsMonitor.conn, tsMonitor.sql); + code = taos_errno(res); + taos_free_result(res); + + if (code != 0) { + monError("failed to save grants info, reason:%s, sql:%s", tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save grants info, sql:%s", tsMonitor.sql); + } + +} + +static void monSaveHttpReqInfo() { + int64_t ts = taosGetTimestampUs(); + char * sql = tsMonitor.sql; + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.restful_%d values(%" PRId64, tsMonitorDbName, dnodeGetDnodeId(), ts); + + for (int32_t i = 0; i < tListLen(monHttpStatusTable); ++i) { + int32_t status = dnodeGetHttpStatusInfo(i); + pos += snprintf(sql + pos, SQL_LENGTH, ", %d", status); + } + pos += snprintf(sql + pos, SQL_LENGTH, ")"); + dnodeClearHttpStatusInfo(); + + monDebug("save http req, sql:%s", sql); + + void *res = taos_query(tsMonitor.conn, tsMonitor.sql); + int32_t code = taos_errno(res); + taos_free_result(res); + + if (code != 0) { + monError("failed to save restful_%d info, reason:%s, sql:%s", dnodeGetDnodeId(), tstrerror(code), tsMonitor.sql); + } else { + monIncSubmitReqCnt(); + monDebug("successfully to save restful_%d info, sql:%s", dnodeGetDnodeId(), tsMonitor.sql); + } +} + static void monExecSqlCb(void *param, TAOS_RES *result, int32_t code) { int32_t c = taos_errno(result); if (c != TSDB_CODE_SUCCESS) { monError("save %s failed, reason:%s", (char *)param, tstrerror(c)); } else { + monIncSubmitReqCnt(); int32_t rows = taos_affected_rows(result); monDebug("save %s succ, rows:%d", (char *)param, rows); } @@ -366,7 +1371,7 @@ void monSaveAcctLog(SAcctMonitorObj *pMon) { if (tsMonitor.state != MON_STATE_INITED) return; char sql[1024] = {0}; - sprintf(sql, + snprintf(sql, 1023, "insert into %s.acct_%s using %s.acct tags('%s') values(now" ", %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 @@ -410,13 +1415,34 @@ void monSaveLog(int32_t level, const char *const format, ...) { va_end(argpointer); if (len > max_length) len = max_length; - len += sprintf(sql + len, "', '%s')", tsLocalEp); + len += snprintf(sql + len, SQL_LENGTH, "', '%s')", tsLocalEp); sql[len++] = 0; monDebug("save log, sql: %s", sql); taos_query_a(tsMonitor.conn, sql, monExecSqlCb, "log"); } +void monSaveDnodeLog(int32_t level, const char *const format, ...) { + if (tsMonitor.state != MON_STATE_INITED) return; + + va_list argpointer; + char sql[SQL_LENGTH] = {0}; + int32_t max_length = SQL_LENGTH - 30; + int32_t len = snprintf(sql, (size_t)max_length, "insert into %s.dnode_%d_log values(%" PRId64 ", %d,'", tsMonitorDbName, + dnodeGetDnodeId(), taosGetTimestampUs(), level); + + va_start(argpointer, format); + len += vsnprintf(sql + len, (size_t)(max_length - len), format, argpointer); + va_end(argpointer); + if (len > max_length) len = max_length; + + len += snprintf(sql + len, SQL_LENGTH, "')"); + sql[len++] = 0; + + monDebug("save dnode log, sql: %s", sql); + taos_query_a(tsMonitor.conn, sql, monExecSqlCb, "log"); +} + void monExecuteSQL(char *sql) { if (tsMonitor.state != MON_STATE_INITED) return; @@ -433,3 +1459,19 @@ void monExecuteSQLWithResultCallback(char *sql, MonExecuteSQLCbFP callback, void monDebug("execute sql:%s", sql); taos_query_a(tsMonitor.conn, sql, callback, param); } + +void monIncQueryReqCnt() { + atomic_fetch_add_32(&monQueryReqNum, 1); +} + +void monIncSubmitReqCnt() { + atomic_fetch_add_32(&monSubmitReqNum, 1); +} + +int32_t monFetchQueryReqCnt() { + return atomic_exchange_32(&monQueryReqNum, 0); +} + +int32_t monFetchSubmitReqCnt() { + return atomic_exchange_32(&monSubmitReqNum, 0); +} diff --git a/src/query/CMakeLists.txt b/src/query/CMakeLists.txt index 4b57843708ac8d1c24c69e68fe406b0edbeeabd2..a815942fbedb4f3b99e3595c3960d931ddde192a 100644 --- a/src/query/CMakeLists.txt +++ b/src/query/CMakeLists.txt @@ -11,11 +11,19 @@ SET_SOURCE_FILES_PROPERTIES(src/sql.c PROPERTIES COMPILE_FLAGS -w) TARGET_LINK_LIBRARIES(query tsdb tutil lua) IF (TD_LINUX) - TARGET_LINK_LIBRARIES(query m rt lua) + IF (TD_BUILD_LUA) + TARGET_LINK_LIBRARIES(query m rt lua) + ELSE () + TARGET_LINK_LIBRARIES(query m rt) + ENDIF () ADD_SUBDIRECTORY(tests) ENDIF () IF (TD_DARWIN) - TARGET_LINK_LIBRARIES(query m lua) + IF (TD_BUILD_LUA) + TARGET_LINK_LIBRARIES(query m lua) + ELSE () + TARGET_LINK_LIBRARIES(query m) + ENDIF () ADD_SUBDIRECTORY(tests) ENDIF () diff --git a/src/query/inc/qAggMain.h b/src/query/inc/qAggMain.h index 79196280bc10c2779a7def017e20ac00af2266a7..69bc1d47c3f332baa932685fab60d20b09f0f618 100644 --- a/src/query/inc/qAggMain.h +++ b/src/query/inc/qAggMain.h @@ -183,7 +183,7 @@ typedef struct SQLFunctionCtx { int16_t inputBytes; int16_t outputType; - int16_t outputBytes; // size of results, determined by function and input column data type + int32_t outputBytes; // size of results, determined by function and input column data type int32_t interBufBytes; // internal buffer size bool hasNull; // null value exist in current block bool requireNull; // require null in some function @@ -192,6 +192,7 @@ typedef struct SQLFunctionCtx { char * pOutput; // final result output buffer, point to sdata->data uint8_t currentStage; // record current running step, default: 0 int64_t startTs; // timestamp range of current query when function is executed on a specific data block + int64_t endTs; int32_t numOfParams; tVariant param[4]; // input parameter, e.g., top(k, 20), the number of results for top query is kept in param int64_t *ptsList; // corresponding timestamp array list @@ -226,7 +227,7 @@ typedef struct SAggFunctionInfo { #define GET_RES_INFO(ctx) ((ctx)->resultInfo) int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, - int16_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo); + int32_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo); int32_t isValidFunction(const char* name, int32_t len); #define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0) diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index ed54723adeafdcd3cdff8b438d2f823a73a04a33..fe4fb6c950d4f3e0186668d957900934ba243e5d 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -63,6 +63,10 @@ enum { QUERY_OVER = 0x4u, }; +enum { + OPTION_SWITCH_TABLE = 1, +}; + typedef struct SResultRowPool { int32_t elemSize; int32_t blockSize; @@ -241,6 +245,7 @@ typedef struct SQueryAttr { int16_t numOfTags; STimeWindow window; + STimeWindow range; SInterval interval; SSessionWindow sw; int16_t precision; @@ -277,6 +282,7 @@ typedef struct SQueryAttr { } SQueryAttr; typedef SSDataBlock* (*__operator_fn_t)(void* param, bool* newgroup); +typedef void (*__operator_notify_fn_t)(void* param, int32_t option); typedef void (*__optr_cleanup_fn_t)(void* param, int32_t num); struct SOperatorInfo; @@ -348,7 +354,7 @@ enum OPERATOR_TYPE_E { OP_Distinct = 20, OP_Join = 21, OP_StateWindow = 22, - OP_AllTimeWindow = 23, + OP_TimeEvery = 23, OP_AllMultiTableTimeInterval = 24, OP_Order = 25, }; @@ -363,10 +369,11 @@ typedef struct SOperatorInfo { SExprInfo *pExpr; SQueryRuntimeEnv *pRuntimeEnv; - struct SOperatorInfo **upstream; // upstream pointer list - int32_t numOfUpstream; // number of upstream. The value is always ONE expect for join operator - __operator_fn_t exec; - __optr_cleanup_fn_t cleanup; + struct SOperatorInfo **upstream; // upstream pointer list + int32_t numOfUpstream; // number of upstream. The value is always ONE expect for join operator + __operator_fn_t exec; + __operator_notify_fn_t notify; + __optr_cleanup_fn_t cleanup; } SOperatorInfo; enum { @@ -479,6 +486,21 @@ typedef struct SProjectOperatorInfo { SSDataBlock *existDataBlock; } SProjectOperatorInfo; +typedef struct STimeEveryOperatorInfo { + SOptrBasicInfo binfo; + int32_t bufCapacity; + uint32_t seed; + + int64_t tableEndKey; + SSDataBlock *lastBlock; + SHashObj *rangeStart; + int32_t lastGroupIdx; + + bool groupDone; + bool allDone; + SSDataBlock *existDataBlock; +} STimeEveryOperatorInfo; + typedef struct SLimitOperatorInfo { int64_t limit; int64_t total; @@ -599,13 +621,12 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera SOperatorInfo* createProjectOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream); SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); -SOperatorInfo* createAllTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createFillOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput, bool multigroupResult); SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); -SOperatorInfo* createAllMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); +SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createTagScanOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createDistinctOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createTableBlockInfoScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv* pRuntimeEnv); @@ -649,7 +670,7 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp int32_t createIndirectQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t numOfOutput, SExprInfo **pExprInfo, SSqlExpr **pExpr, SExprInfo *prevExpr, SUdfInfo *pUdfInfo); -int32_t createQueryFilter(char *data, uint16_t len, void** pFilters); +int32_t createQueryFilter(char *data, int32_t len, void** pFilters); SGroupbyExpr *createGroupbyExprFromMsg(SQueryTableMsg *pQueryMsg, SColIndex *pColIndex, int32_t *code); SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SGroupbyExpr *pGroupbyExpr, SExprInfo *pExprs, diff --git a/src/query/inc/qExtbuffer.h b/src/query/inc/qExtbuffer.h index d4a9ed0cbcef0a52085dcd60569270037fb57908..ccdfd5c05994b71bd911c3a66d02dc1ffa58a474 100644 --- a/src/query/inc/qExtbuffer.h +++ b/src/query/inc/qExtbuffer.h @@ -75,8 +75,15 @@ typedef struct tFilePagesItem { tFilePage item; } tFilePagesItem; +typedef struct SSchema1 { + uint8_t type; + char name[TSDB_COL_NAME_LEN]; + int16_t colId; + int32_t bytes; +} SSchema1; + typedef struct SSchemaEx { - struct SSchema field; + SSchema1 field; int32_t offset; } SSchemaEx; @@ -178,7 +185,7 @@ bool tExtMemBufferIsAllDataInMem(tExtMemBuffer *pMemBuffer); * @param blockCapacity * @return */ -SColumnModel *createColumnModel(SSchema *fields, int32_t numOfCols, int32_t blockCapacity); +SColumnModel *createColumnModel(SSchema1 *fields, int32_t numOfCols, int32_t blockCapacity); /** * @@ -199,7 +206,7 @@ void destroyColumnModel(SColumnModel *pModel); void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxElemsCapacity); void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxCapacity, int32_t s, int32_t e); -SSchema *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index); +SSchema1 *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index); int16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t index); @@ -229,6 +236,9 @@ typedef int (*__col_compar_fn_t)(tOrderDescriptor *, int32_t numOfRows, int32_t void tColDataQSort(tOrderDescriptor *, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType); +void tColDataMergeSort(tOrderDescriptor *, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType); + + void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOfRows, int32_t index, __compar_fn_t compareFn); int32_t compare_sa(tOrderDescriptor *, int32_t numOfRows, int32_t idx1, int32_t idx2, char *data); diff --git a/src/query/inc/qFill.h b/src/query/inc/qFill.h index caa0c55b3ff1a805975a6258ca360e5099f4894e..2bf0ca8b556468b18ca0a71071c747f20441a93f 100644 --- a/src/query/inc/qFill.h +++ b/src/query/inc/qFill.h @@ -86,7 +86,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo); int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows); -int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType); +int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType, bool *exceedMax, bool *exceedMin); int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, void** output, int32_t capacity); diff --git a/src/query/inc/qFilter.h b/src/query/inc/qFilter.h index 35750ac2a78c7c119dfe300155f96d408afb7b9d..d290930ce4631569b77542152c02b5d4e558c46c 100644 --- a/src/query/inc/qFilter.h +++ b/src/query/inc/qFilter.h @@ -101,14 +101,6 @@ typedef struct SFilterRange { char eflag; } SFilterRange; -typedef struct SFilterColRange { - uint16_t idx; //column field idx - bool isNull; - bool notNull; - bool isRange; - SFilterRange ra; -} SFilterColRange; - typedef bool (*rangeCompFunc) (const void *, const void *, const void *, const void *, __compar_fn_t); typedef int32_t(*filter_desc_compare_func)(const void *, const void *); typedef bool(*filter_exec_func)(void *, int32_t, int8_t**, SDataStatis *, int16_t); @@ -161,20 +153,20 @@ typedef struct SFilterField { } SFilterField; typedef struct SFilterFields { - uint16_t size; - uint16_t num; + uint32_t size; + uint32_t num; SFilterField *fields; } SFilterFields; typedef struct SFilterFieldId { uint16_t type; - uint16_t idx; + uint32_t idx; } SFilterFieldId; typedef struct SFilterGroup { - uint16_t unitSize; - uint16_t unitNum; - uint16_t *unitIdxs; + uint32_t unitSize; + uint32_t unitNum; + uint32_t *unitIdxs; uint8_t *unitFlags; // !unit result } SFilterGroup; @@ -187,13 +179,13 @@ typedef struct SFilterColInfo { } SFilterColInfo; typedef struct SFilterGroupCtx { - uint16_t colNum; - uint16_t *colIdx; + uint32_t colNum; + uint32_t *colIdx; SFilterColInfo *colInfo; } SFilterGroupCtx; typedef struct SFilterColCtx { - uint16_t colIdx; + uint32_t colIdx; void* ctx; } SFilterColCtx; @@ -230,13 +222,12 @@ typedef struct SFilterPCtx { typedef struct SFilterInfo { uint32_t options; uint32_t status; - uint16_t unitSize; - uint16_t unitNum; - uint16_t groupNum; - uint16_t colRangeNum; + uint32_t unitSize; + uint32_t unitNum; + uint32_t groupNum; + uint32_t colRangeNum; SFilterFields fields[FLD_TYPE_MAX]; SFilterGroup *groups; - uint16_t *cgroups; SFilterUnit *units; SFilterComUnit *cunits; uint8_t *unitRes; // result @@ -244,16 +235,14 @@ typedef struct SFilterInfo { SFilterRangeCtx **colRange; filter_exec_func func; uint8_t blkFlag; - uint16_t blkGroupNum; - uint16_t *blkUnits; + uint32_t blkGroupNum; + uint32_t *blkUnits; int8_t *blkUnitRes; void *pTable; SFilterPCtx pctx; } SFilterInfo; -#define COL_FIELD_SIZE (sizeof(SFilterField) + 2 * sizeof(int64_t)) - #define FILTER_NO_MERGE_DATA_TYPE(t) ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON) #define FILTER_NO_MERGE_OPTR(o) ((o) == TSDB_RELATION_ISNULL || (o) == TSDB_RELATION_NOTNULL || (o) == FILTER_DUMMY_EMPTY_OPTR) @@ -270,7 +259,7 @@ typedef struct SFilterInfo { #define FILTER_CLR_FLAG(st, f) st &= (~f) #define SIMPLE_COPY_VALUES(dst, src) *((int64_t *)dst) = *((int64_t *)src) -#define FILTER_PACKAGE_UNIT_HASH_KEY(v, optr, idx1, idx2) do { char *_t = (char *)v; _t[0] = optr; *(uint16_t *)(_t + 1) = idx1; *(uint16_t *)(_t + 3) = idx2; } while (0) +#define FILTER_PACKAGE_UNIT_HASH_KEY(v, optr, idx1, idx2) do { char *_t = (char *)v; _t[0] = optr; *(uint32_t *)(_t + 1) = idx1; *(uint32_t *)(_t + 3) = idx2; } while (0) #define FILTER_GREATER(cr,sflag,eflag) ((cr > 0) || ((cr == 0) && (FILTER_GET_FLAG(sflag,RANGE_FLG_EXCLUDE) || FILTER_GET_FLAG(eflag,RANGE_FLG_EXCLUDE)))) #define FILTER_COPY_RA(dst, src) do { (dst)->sflag = (src)->sflag; (dst)->eflag = (src)->eflag; (dst)->s = (src)->s; (dst)->e = (src)->e; } while (0) @@ -325,7 +314,7 @@ typedef struct SFilterInfo { #define FILTER_PUSH_VAR_HASH(colInfo, ha) do { (colInfo).type = RANGE_TYPE_VAR_HASH; (colInfo).info = ha;} while (0) #define FILTER_PUSH_CTX(colInfo, ctx) do { (colInfo).type = RANGE_TYPE_MR_CTX; (colInfo).info = ctx;} while (0) -#define FILTER_COPY_IDX(dst, src, n) do { *(dst) = malloc(sizeof(uint16_t) * n); memcpy(*(dst), src, sizeof(uint16_t) * n);} while (0) +#define FILTER_COPY_IDX(dst, src, n) do { *(dst) = malloc(sizeof(uint32_t) * n); memcpy(*(dst), src, sizeof(uint32_t) * n);} while (0) #define FILTER_ADD_CTX_TO_GRES(gres, idx, ctx) do { if ((gres)->colCtxs == NULL) { (gres)->colCtxs = taosArrayInit(gres->colNum, sizeof(SFilterColCtx)); } SFilterColCtx cCtx = {idx, ctx}; taosArrayPush((gres)->colCtxs, &cCtx); } while (0) diff --git a/src/query/inc/qScript.h b/src/query/inc/qScript.h index 574bb51368afeaeddef5fbd5c5bd8469fbe0cdef..2dc9b5812bbfa34dcebdde5438516d3be42a51d2 100644 --- a/src/query/inc/qScript.h +++ b/src/query/inc/qScript.h @@ -15,7 +15,7 @@ #ifndef TDENGINE_QSCRIPT_H #define TDENGINE_QSCRIPT_H - +#ifdef LUA_EMBEDDED #include #include #include @@ -78,5 +78,5 @@ void destroyScriptCtx(void *pScriptCtx); int32_t scriptEnvPoolInit(); void scriptEnvPoolCleanup(); bool isValidScript(char *script, int32_t len); - +#endif //LUA_EMBEDDED #endif //TDENGINE_QSCRIPT_H diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index 363240636c81fe3698e58d95842ffb02f64cda33..2c70767aba7e9b8d6822663b96538d4ff83da87c 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -94,6 +94,11 @@ typedef struct SIntervalVal { SStrToken offset; } SIntervalVal; +typedef struct SRangeVal { + void *start; + void *end; +} SRangeVal; + typedef struct SSessionWindowVal { SStrToken col; SStrToken gap; @@ -120,6 +125,7 @@ typedef struct SSqlNode { SLimitVal slimit; // group limit offset [optional] SStrToken sqlstr; // sql string in select clause struct tSqlExpr *pHaving; // having clause [optional] + SRangeVal pRange; // range clause [optional] } SSqlNode; typedef struct SRelElementPair { @@ -281,15 +287,17 @@ typedef struct tSqlExprItem { } tSqlExprItem; SArray *commonItemAppend(SArray *pList, tVariant *pVar, tSqlExpr *jsonExp, bool isJsonExp, uint8_t sortOrder); + SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder); SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int32_t index); -SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t sortOrder); +SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t sortOrder, bool needRmquoteEscape); SRelationInfo *setTableNameList(SRelationInfo* pFromInfo, SStrToken *pName, SStrToken* pAlias); void *destroyRelationInfo(SRelationInfo* pFromInfo); SRelationInfo *addSubqueryElem(SRelationInfo* pRelationInfo, SArray* pSub, SStrToken* pAlias); // sql expr leaf node +tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType); tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optrType); tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToken *endToken, int32_t optType); SArray *tStrTokenAppend(SArray *pList, SStrToken *pToken); @@ -305,7 +313,7 @@ void tSqlExprListDestroy(SArray *pList); SSqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelNodeList, SRelationInfo *pFrom, tSqlExpr *pWhere, SArray *pGroupby, SArray *pSortOrder, SIntervalVal *pInterval, SSessionWindowVal *ps, SWindowStateVal *pw, - SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, SLimitVal *pgLimit, tSqlExpr *pHaving); + SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, SLimitVal *pgLimit, tSqlExpr *pHaving, SRangeVal *pRange); int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right); SCreateTableSql *tSetCreateTableInfo(SArray *pCols, SArray *pTags, SSqlNode *pSelect, int32_t type); diff --git a/src/query/inc/qTableMeta.h b/src/query/inc/qTableMeta.h index 16b4be2e2ad4c92e6ce7c2240324f83a3b21d087..87143117813c795a2ea0f052779cff171eb3d8f0 100644 --- a/src/query/inc/qTableMeta.h +++ b/src/query/inc/qTableMeta.h @@ -145,6 +145,8 @@ typedef struct SQueryInfo { bool udfCopy; SArray *pUdfInfo; + STimeWindow range; // range for interp + struct SQInfo *pQInfo; // global merge operator struct SQueryAttr *pQueryAttr; // query object diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index c2dd61dbe220c3837a0bfc21a864894a62d0aabf..f34445a692b4ae279a6550b3796fdfbbd47aa8a8 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -128,12 +128,6 @@ cmd ::= SHOW dbPrefix(X) VGROUPS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } -cmd ::= SHOW dbPrefix(X) VGROUPS ids(Y). { - SStrToken token; - tSetDbName(&token, &X); - setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &Y); -} - //drop configure for tables cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). { X.n += Z.n; @@ -260,7 +254,7 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); } intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); } -intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } +intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } %type keep {SArray*} %destructor keep {taosArrayDestroy($$);} @@ -445,46 +439,46 @@ column(A) ::= ids(X) typename(Y). { tagitemlist(A) ::= tagitemlist(X) COMMA tagitem(Y). { A = tVariantListAppend(X, &Y, -1); } tagitemlist(A) ::= tagitem(X). { A = tVariantListAppend(NULL, &X, -1); } -tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } -tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } -tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } -tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } -tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); } -tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X);} +tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } +tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } +tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } +tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } +tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X, true); } +tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X, true);} tagitem(A) ::= MINUS(X) INTEGER(Y).{ X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X); + tVariantCreate(&A, &X, true); } tagitem(A) ::= MINUS(X) FLOAT(Y). { X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X); + tVariantCreate(&A, &X, true); } tagitem(A) ::= PLUS(X) INTEGER(Y). { X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X); + tVariantCreate(&A, &X, true); } tagitem(A) ::= PLUS(X) FLOAT(Y). { X.n += Y.n; X.type = Y.type; toTSDBType(X.type); - tVariantCreate(&A, &X); + tVariantCreate(&A, &X, true); } //////////////////////// The SELECT statement ///////////////////////////////// %type select {SSqlNode*} %destructor select {destroySqlNode($$);} -select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_option(K) sliding_opt(S) session_option(H) windowstate_option(D) fill_opt(F)groupby_opt(P) having_opt(N) orderby_opt(Z) slimit_opt(G) limit_opt(L). { - A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &D, &S, F, &L, &G, N); +select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) range_option(R) interval_option(K) sliding_opt(S) session_option(H) windowstate_option(D) fill_opt(F)groupby_opt(P) having_opt(N) orderby_opt(Z) slimit_opt(G) limit_opt(L). { + A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &D, &S, F, &L, &G, N, &R); } select(A) ::= LP select(B) RP. {A = B;} @@ -502,7 +496,7 @@ cmd ::= union(X). { setSqlInfo(pInfo, X, NULL, TSDB_SQL_SELECT); } // select client_version() // select server_state() select(A) ::= SELECT(T) selcollist(W). { - A = tSetQuerySqlNode(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + A = tSetQuerySqlNode(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } // selcollist is a list of expressions that are to become the return @@ -573,6 +567,22 @@ tablelist(A) ::= tablelist(Y) COMMA ids(X) cpxName(Z) ids(F). { %type tmvar {SStrToken} tmvar(A) ::= VARIABLE(X). {A = X;} + +%type timestamp {tSqlExpr*} +%destructor timestamp {tSqlExprDestroy($$);} + +timestamp(A) ::= INTEGER(X). { A = tSqlExprCreateTimestamp(&X, TK_INTEGER);} +timestamp(A) ::= MINUS(X) INTEGER(Y). { X.n += Y.n; X.type = TK_INTEGER; A = tSqlExprCreateTimestamp(&X, TK_INTEGER);} +timestamp(A) ::= PLUS(X) INTEGER(Y). { X.n += Y.n; X.type = TK_INTEGER; A = tSqlExprCreateTimestamp(&X, TK_INTEGER);} +timestamp(A) ::= STRING(X). { A = tSqlExprCreateTimestamp(&X, TK_STRING);} +timestamp(A) ::= NOW(X). { A = tSqlExprCreateTimestamp(&X, TK_NOW); } +timestamp(A) ::= NOW PLUS VARIABLE(Y). {A = tSqlExprCreateTimestamp(&Y, TK_PLUS); } +timestamp(A) ::= NOW MINUS VARIABLE(Y). {A = tSqlExprCreateTimestamp(&Y, TK_MINUS); } + +%type range_option {SRangeVal} +range_option(N) ::= . {N.start = 0; N.end = 0;} +range_option(N) ::= RANGE LP timestamp(E) COMMA timestamp(X) RP. {N.start = E; N.end = X;} + %type interval_option {SIntervalVal} interval_option(N) ::= intervalKey(A) LP tmvar(E) RP. {N.interval = E; N.offset.n = 0; N.token = A;} interval_option(N) ::= intervalKey(A) LP tmvar(E) COMMA tmvar(X) RP. {N.interval = E; N.offset = X; N.token = A;} @@ -600,7 +610,7 @@ fill_opt(N) ::= . { N = 0; } fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. { tVariant A = {0}; toTSDBType(Y.type); - tVariantCreate(&A, &Y); + tVariantCreate(&A, &Y, true); tVariantListInsert(X, &A, -1, 0); N = X; @@ -608,7 +618,7 @@ fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. { fill_opt(N) ::= FILL LP ID(Y) RP. { toTSDBType(Y.type); - N = tVariantListAppendToken(NULL, &Y, -1); + N = tVariantListAppendToken(NULL, &Y, -1, true); } %type sliding_opt {SStrToken} @@ -641,11 +651,11 @@ sortlist(A) ::= arrow(Y) sortorder(Z). { } %type item {tVariant} -item(A) ::= ID(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } +item(A) ::= ID(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); } item(A) ::= ID(X) DOT ID(Y). { toTSDBType(X.type); X.n += Y.n; - tVariantCreate(&A, &X); + tVariantCreate(&A, &X, true); } %type sortorder {int} @@ -811,7 +821,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). { X.n += F.n; toTSDBType(A.type); - SArray* K = tVariantListAppendToken(NULL, &A, -1); + SArray* K = tVariantListAppendToken(NULL, &A, -1, false); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -833,7 +843,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). { X.n += Z.n; toTSDBType(Y.type); - SArray* A = tVariantListAppendToken(NULL, &Y, -1); + SArray* A = tVariantListAppendToken(NULL, &Y, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -843,10 +853,10 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { X.n += F.n; toTSDBType(Y.type); - SArray* A = tVariantListAppendToken(NULL, &Y, -1); + SArray* A = tVariantListAppendToken(NULL, &Y, -1, true); toTSDBType(Z.type); - A = tVariantListAppendToken(A, &Z, -1); + A = tVariantListAppendToken(A, &Z, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -856,7 +866,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { X.n += F.n; toTSDBType(Y.type); - SArray* A = tVariantListAppendToken(NULL, &Y, -1); + SArray* A = tVariantListAppendToken(NULL, &Y, -1, true); A = tVariantListAppend(A, &Z, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); @@ -880,7 +890,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). { X.n += F.n; toTSDBType(A.type); - SArray* K = tVariantListAppendToken(NULL, &A, -1); + SArray* K = tVariantListAppendToken(NULL, &A, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -902,7 +912,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). { X.n += Z.n; toTSDBType(Y.type); - SArray* A = tVariantListAppendToken(NULL, &Y, -1); + SArray* A = tVariantListAppendToken(NULL, &Y, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -912,10 +922,10 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { X.n += F.n; toTSDBType(Y.type); - SArray* A = tVariantListAppendToken(NULL, &Y, -1); + SArray* A = tVariantListAppendToken(NULL, &Y, -1, true); toTSDBType(Z.type); - A = tVariantListAppendToken(A, &Z, -1); + A = tVariantListAppendToken(A, &Z, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -925,7 +935,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { X.n += F.n; toTSDBType(Y.type); - SArray* A = tVariantListAppendToken(NULL, &Y, -1); + SArray* A = tVariantListAppendToken(NULL, &Y, -1, true); A = tVariantListAppend(A, &Z, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index d7320fab3b4d77180810a63db5e3155e8c090799..3da400403f017969948e86c1376dff3a56865359 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -28,6 +28,7 @@ #include "qTsbuf.h" #include "queryLog.h" #include "qUdf.h" +#include "tcompare.h" #define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput)) #define GET_INPUT_DATA(x, y) (GET_INPUT_DATA_LIST(x) + (y) * (x)->inputBytes) @@ -195,8 +196,16 @@ typedef struct { char *taglists; } SSampleFuncInfo; +typedef struct { + bool valueAssigned; + union { + int64_t i64Prev; + double d64Prev; + }; +} SDiffFuncInfo; + int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, - int16_t *bytes, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo) { + int32_t *bytes, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo) { if (!isValidDataType(dataType)) { qError("Illegal data type %d or data type length %d", dataType, dataBytes); return TSDB_CODE_TSC_INVALID_OPERATION; @@ -209,21 +218,24 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI functionId == TSDB_FUNC_FLOOR || functionId == TSDB_FUNC_ROUND) { *type = (int16_t)dataType; - *bytes = (int16_t)dataBytes; + *bytes = dataBytes; if (functionId == TSDB_FUNC_INTERP) { *interBytes = sizeof(SInterpInfoDetail); + } else if (functionId == TSDB_FUNC_DIFF) { + *interBytes = sizeof(SDiffFuncInfo); } else { *interBytes = 0; } + return TSDB_CODE_SUCCESS; } // (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE if (functionId == TSDB_FUNC_TID_TAG) { // todo use struct *type = TSDB_DATA_TYPE_BINARY; - *bytes = (int16_t)(dataBytes + sizeof(int16_t) + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE); + *bytes = (dataBytes + sizeof(int16_t) + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE); *interBytes = 0; return TSDB_CODE_SUCCESS; } @@ -301,7 +313,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) { *type = TSDB_DATA_TYPE_BINARY; - *bytes = (int16_t)(dataBytes + DATA_SET_FLAG_SIZE); + *bytes = (dataBytes + DATA_SET_FLAG_SIZE); *interBytes = *bytes; return TSDB_CODE_SUCCESS; @@ -324,13 +336,13 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { *type = TSDB_DATA_TYPE_BINARY; - *bytes = (int16_t)(sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param); + *bytes = (sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param); *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_SAMPLE) { *type = TSDB_DATA_TYPE_BINARY; - *bytes = (int16_t)(sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param); + *bytes = (sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param); *interBytes = *bytes; return TSDB_CODE_SUCCESS; @@ -343,14 +355,14 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI } else if (functionId == TSDB_FUNC_APERCT) { *type = TSDB_DATA_TYPE_BINARY; int16_t bytesHist = sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1) + sizeof(SHistogramInfo) + sizeof(SAPercentileInfo); - int16_t bytesDigest = (int16_t)(sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); + int32_t bytesDigest = (int32_t) (sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); *bytes = MAX(bytesHist, bytesDigest); *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_LAST_ROW) { *type = TSDB_DATA_TYPE_BINARY; - *bytes = (int16_t)(sizeof(SLastrowInfo) + dataBytes); + *bytes = (sizeof(SLastrowInfo) + dataBytes); *interBytes = *bytes; return TSDB_CODE_SUCCESS; @@ -378,7 +390,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); int16_t bytesHist = sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1); - int16_t bytesDigest = (int16_t)(sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); + int32_t bytesDigest = (int32_t) (sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); *interBytes = MAX(bytesHist, bytesDigest); return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_TWA) { @@ -415,31 +427,31 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI *interBytes = sizeof(SStddevInfo); } else if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) { *type = (int16_t)dataType; - *bytes = (int16_t)dataBytes; + *bytes = dataBytes; *interBytes = dataBytes + DATA_SET_FLAG_SIZE; } else if (functionId == TSDB_FUNC_FIRST || functionId == TSDB_FUNC_LAST) { *type = (int16_t)dataType; - *bytes = (int16_t)dataBytes; - *interBytes = (int16_t)(dataBytes + sizeof(SFirstLastInfo)); + *bytes = dataBytes; + *interBytes = (dataBytes + sizeof(SFirstLastInfo)); } else if (functionId == TSDB_FUNC_SPREAD) { *type = (int16_t)TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); *interBytes = sizeof(SSpreadInfo); } else if (functionId == TSDB_FUNC_PERCT) { *type = (int16_t)TSDB_DATA_TYPE_DOUBLE; - *bytes = (int16_t)sizeof(double); - *interBytes = (int16_t)sizeof(SPercentileInfo); + *bytes = sizeof(double); + *interBytes = sizeof(SPercentileInfo); } else if (functionId == TSDB_FUNC_LEASTSQR) { *type = TSDB_DATA_TYPE_BINARY; *bytes = MAX(TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE, sizeof(SLeastsquaresInfo)); // string *interBytes = *bytes; } else if (functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_LAST_DST) { *type = TSDB_DATA_TYPE_BINARY; - *bytes = (int16_t)(dataBytes + sizeof(SFirstLastInfo)); + *bytes = (dataBytes + sizeof(SFirstLastInfo)); *interBytes = *bytes; } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { *type = (int16_t)dataType; - *bytes = (int16_t)dataBytes; + *bytes = dataBytes; size_t size = sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param; @@ -447,12 +459,12 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI *interBytes = (int32_t)size; } else if (functionId == TSDB_FUNC_SAMPLE) { *type = (int16_t)dataType; - *bytes = (int16_t)dataBytes; + *bytes = dataBytes; size_t size = sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param; *interBytes = (int32_t)size; } else if (functionId == TSDB_FUNC_LAST_ROW) { *type = (int16_t)dataType; - *bytes = (int16_t)dataBytes; + *bytes = dataBytes; *interBytes = dataBytes; } else if (functionId == TSDB_FUNC_STDDEV_DST) { *type = TSDB_DATA_TYPE_BINARY; @@ -821,7 +833,7 @@ static int32_t lastDistFuncRequired(SQLFunctionCtx *pCtx, STimeWindow* w, int32_ if (pInfo->hasResult != DATA_SET_FLAG) { return BLK_DATA_ALL_NEEDED; } else { - return (pInfo->ts > w->ekey) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED; + return (pInfo->ts >= w->ekey) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED; } } @@ -2972,18 +2984,27 @@ static void copy_function(SQLFunctionCtx *pCtx) { assignVal(pCtx->pOutput, pData, pCtx->inputBytes, pCtx->inputType); } -enum { - INITIAL_VALUE_NOT_ASSIGNED = 0, -}; +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) { + aAggs[TSDB_FUNC_TAG].xFunction(tagCtx); + } + } +} + static bool diff_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) { if (!function_setup(pCtx, pResInfo)) { return false; } - // diff function require the value is set to -1 - pCtx->param[1].nType = INITIAL_VALUE_NOT_ASSIGNED; - return false; + SDiffFuncInfo* pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo); + pDiffInfo->valueAssigned = false; + pDiffInfo->i64Prev = 0; + return true; } static bool deriv_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResultInfo) { @@ -3189,22 +3210,14 @@ static void deriv_function(SQLFunctionCtx *pCtx) { GET_RES_INFO(pCtx)->numOfRes += notNullElems; } -#define DIFF_IMPL(ctx, d, type) \ - do { \ - if ((ctx)->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { \ - (ctx)->param[1].nType = (ctx)->inputType; \ - *(type *)&(ctx)->param[1].i64 = *(type *)(d); \ - } else { \ - *(type *)(ctx)->pOutput = *(type *)(d) - (*(type *)(&(ctx)->param[1].i64)); \ - *(type *)(&(ctx)->param[1].i64) = *(type *)(d); \ - *(int64_t *)(ctx)->ptsOutputBuf = GET_TS_DATA(ctx, index); \ - } \ - } while (0); // TODO difference in date column static void diff_function(SQLFunctionCtx *pCtx) { + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); + SDiffFuncInfo *pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo); + void *data = GET_INPUT_DATA_LIST(pCtx); - bool isFirstBlock = (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED); + bool isFirstBlock = (pDiffInfo->valueAssigned == false); int32_t notNullElems = 0; @@ -3224,15 +3237,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null + if (pDiffInfo->valueAssigned) { + *pOutput = (int32_t)(pData[i] - pDiffInfo->i64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3246,15 +3259,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = pData[i] - pCtx->param[1].i64; // direct previous may be null + if (pDiffInfo->valueAssigned) { + *pOutput = pData[i] - pDiffInfo->i64Prev; // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3268,15 +3281,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - SET_DOUBLE_VAL(pOutput, pData[i] - pCtx->param[1].dKey); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + SET_DOUBLE_VAL(pOutput, pData[i] - pDiffInfo->d64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].dKey = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->d64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3290,15 +3303,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (float)(pData[i] - pCtx->param[1].dKey); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + *pOutput = (float)(pData[i] - pDiffInfo->d64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].dKey = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->d64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3312,15 +3325,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + *pOutput = (int16_t)(pData[i] - pDiffInfo->i64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3335,15 +3348,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + *pOutput = (int8_t)(pData[i] - pDiffInfo->i64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3353,7 +3366,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { } // initial value is not set yet - if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED || notNullElems <= 0) { + if (!pDiffInfo->valueAssigned || notNullElems <= 0) { /* * 1. current block and blocks before are full of null * 2. current block may be null value @@ -3895,183 +3908,97 @@ void twa_function_finalizer(SQLFunctionCtx *pCtx) { doFinalizer(pCtx); } -/** - * - * @param pCtx - */ +static void interp_function(SQLFunctionCtx *pCtx) { + int32_t fillType = (int32_t) pCtx->param[2].i64; + //bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); -static void interp_function_impl(SQLFunctionCtx *pCtx) { - int32_t type = (int32_t) pCtx->param[2].i64; - if (type == TSDB_FILL_NONE) { - return; + 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; + } 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; } - bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); + 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 + || pCtx->end.key == INT64_MIN || pCtx->end.key < pCtx->startTs) { + goto interp_exit; + } - if (pCtx->colId == 0 && pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP) { - *(TSKEY *)pCtx->pOutput = pCtx->startTs; - } else if (type == TSDB_FILL_NULL) { - setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); - } else if (type == TSDB_FILL_SET_VALUE) { - tVariantDump(&pCtx->param[1], pCtx->pOutput, pCtx->inputType, true); - } else { - if (pCtx->start.key != INT64_MIN && ((ascQuery && pCtx->start.key <= pCtx->startTs && pCtx->end.key >= pCtx->startTs) || ((!ascQuery) && pCtx->start.key >= pCtx->startTs && pCtx->end.key <= pCtx->startTs))) { - if (type == TSDB_FILL_PREV) { - if (IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL) { - SET_TYPED_DATA(pCtx->pOutput, pCtx->inputType, pCtx->start.val); - } else { - assignVal(pCtx->pOutput, pCtx->start.ptr, pCtx->outputBytes, pCtx->inputType); - } - } else if (type == TSDB_FILL_NEXT) { - if (IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL) { - SET_TYPED_DATA(pCtx->pOutput, pCtx->inputType, pCtx->end.val); - } else { - assignVal(pCtx->pOutput, pCtx->end.ptr, pCtx->outputBytes, pCtx->inputType); - } - } else if (type == TSDB_FILL_LINEAR) { - SPoint point1 = {.key = pCtx->start.key, .val = &pCtx->start.val}; - SPoint point2 = {.key = pCtx->end.key, .val = &pCtx->end.val}; - SPoint point = {.key = pCtx->startTs, .val = pCtx->pOutput}; - - int32_t srcType = pCtx->inputType; - if (IS_NUMERIC_TYPE(srcType)) { // TODO should find the not null data? - if (isNull((char *)&pCtx->start.val, srcType) || isNull((char *)&pCtx->end.val, srcType)) { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); + 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}; + + int32_t srcType = pCtx->inputType; + if (isNull((char *)&pCtx->start.val, srcType) || isNull((char *)&pCtx->end.val, srcType)) { + setNull(pCtx->pOutput, srcType, pCtx->inputBytes); + } else { + bool exceedMax = false, exceedMin = false; + 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) { + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, exceedMax ? &pCtx->start.val : &pCtx->end.val); } else { - taosGetLinearInterpolationVal(&point, pCtx->outputType, &point1, &point2, TSDB_DATA_TYPE_DOUBLE); + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, exceedMax ? &pCtx->end.val : &pCtx->start.val); } - } else { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); } } - } else { - if (GET_RES_INFO(pCtx)->numOfRes > 0) { - return; + break; + + case TSDB_FILL_PREV: + if (pCtx->start.key == INT64_MIN || pCtx->start.key > pCtx->startTs) { + goto interp_exit; } - - // no data generated yet - if (pCtx->size < 1) { - return; + + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->start.val); + break; + + case TSDB_FILL_NEXT: + 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; - // check the timestamp in input buffer - TSKEY skey = GET_TS_DATA(pCtx, 0); + case TSDB_FILL_NONE: + default: + goto interp_exit; + } - if (type == TSDB_FILL_PREV) { - if ((ascQuery && skey > pCtx->startTs) || ((!ascQuery) && skey < pCtx->startTs)) { - return; - } - if (pCtx->size > 1) { - TSKEY ekey = GET_TS_DATA(pCtx, 1); - if ((ascQuery && ekey > skey && ekey <= pCtx->startTs) || - ((!ascQuery) && ekey < skey && ekey >= pCtx->startTs)){ - skey = ekey; - } - } - assignVal(pCtx->pOutput, pCtx->pInput, pCtx->outputBytes, pCtx->inputType); - } else if (type == TSDB_FILL_NEXT) { - TSKEY ekey = skey; - char* val = NULL; - - if ((ascQuery && ekey < pCtx->startTs) || ((!ascQuery) && ekey > pCtx->startTs)) { - if (pCtx->size > 1) { - ekey = GET_TS_DATA(pCtx, 1); - if ((ascQuery && ekey < pCtx->startTs) || ((!ascQuery) && ekey > pCtx->startTs)) { - setNull(pCtx->pOutput, pCtx->inputType, pCtx->inputBytes); - SET_VAL(pCtx, 1, 1); - return; - } +interp_success_exit: - val = ((char*)pCtx->pInput) + pCtx->inputBytes; - } else { - setNull(pCtx->pOutput, pCtx->inputType, pCtx->inputBytes); - SET_VAL(pCtx, 1, 1); - return; - } - } else { - val = (char*)pCtx->pInput; - } - - assignVal(pCtx->pOutput, val, pCtx->outputBytes, pCtx->inputType); - } else if (type == TSDB_FILL_LINEAR) { - if (pCtx->size <= 1) { - return; - } - - TSKEY ekey = GET_TS_DATA(pCtx, 1); - - // no data generated yet - if ((ascQuery && !(skey <= pCtx->startTs && ekey >= pCtx->startTs)) - || ((!ascQuery) && !(skey >= pCtx->startTs && ekey <= pCtx->startTs))) { - return; - } - - char *start = GET_INPUT_DATA(pCtx, 0); - char *end = GET_INPUT_DATA(pCtx, 1); + *(TSKEY*)pCtx->ptsOutputBuf = pCtx->startTs; - SPoint point1 = {.key = skey, .val = start}; - SPoint point2 = {.key = ekey, .val = end}; - SPoint point = {.key = pCtx->startTs, .val = pCtx->pOutput}; + INC_INIT_VAL(pCtx, 1); - int32_t srcType = pCtx->inputType; - if (IS_NUMERIC_TYPE(srcType)) { // TODO should find the not null data? - if (isNull(start, srcType) || isNull(end, srcType)) { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); - } else { - taosGetLinearInterpolationVal(&point, pCtx->outputType, &point1, &point2, srcType); - } - } else { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); - } - } - } - } +interp_exit: - SET_VAL(pCtx, 1, 1); -} + pCtx->start.key = INT64_MIN; + pCtx->end.key = INT64_MIN; + pCtx->endTs = pCtx->startTs; -static void interp_function(SQLFunctionCtx *pCtx) { - // at this point, the value is existed, return directly - if (pCtx->size > 0) { - bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); - TSKEY key; - char *pData; - int32_t typedData = 0; - - if (ascQuery) { - key = GET_TS_DATA(pCtx, 0); - pData = GET_INPUT_DATA(pCtx, 0); - } else { - key = pCtx->start.key; - if (key == INT64_MIN) { - key = GET_TS_DATA(pCtx, 0); - pData = GET_INPUT_DATA(pCtx, 0); - } else { - if (!(IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL)) { - pData = pCtx->start.ptr; - } else { - typedData = 1; - pData = (char *)&pCtx->start.val; - } - } - } - - //if (key == pCtx->startTs && (ascQuery || !(IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL))) { - if (key == pCtx->startTs) { - if (typedData) { - SET_TYPED_DATA(pCtx->pOutput, pCtx->inputType, *(double *)pData); - } else { - assignVal(pCtx->pOutput, pData, pCtx->inputBytes, pCtx->inputType); - } - - SET_VAL(pCtx, 1, 1); - } else { - interp_function_impl(pCtx); - } - } else { //no qualified data rows and interpolation is required - interp_function_impl(pCtx); - } + return; } static bool ts_comp_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) { @@ -4459,7 +4386,7 @@ void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) { "5th=[%d], 10th=[%d], 20th=[%d], 30th=[%d], 40th=[%d], 50th=[%d]\n\t " "60th=[%d], 70th=[%d], 80th=[%d], 90th=[%d], 95th=[%d], 99th=[%d]\n\t " "Min=[%"PRId64"(Rows)] Max=[%"PRId64"(Rows)] Avg=[%"PRId64"(Rows)] Stddev=[%.2f] \n\t " - "Rows=[%"PRIu64"], Blocks=[%"PRId64"], SmallBlocks=[%d], Size=[%.3f(Kb)] Comp=[%.2f]\n\t " + "Rows=[%"PRIu64"], Blocks=[%"PRId64"], SmallBlocks=[%d], Size=[%.3f(Kb)] Comp=[%.5g]\n\t " "RowsInMem=[%d] \n\t", percentiles[0], percentiles[1], percentiles[2], percentiles[3], percentiles[4], percentiles[5], percentiles[6], percentiles[7], percentiles[8], percentiles[9], percentiles[10], percentiles[11], @@ -5364,11 +5291,11 @@ SAggFunctionInfo aAggs[] = {{ "interp", TSDB_FUNC_INTERP, TSDB_FUNC_INTERP, - TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_OF | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS , + TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_OF | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS | TSDB_FUNCSTATE_SELECTIVITY, function_setup, interp_function, doFinalizer, - copy_function, + full_copy_function, dataBlockRequired, }, { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index be274700e3c817c8547a91644a9aa6a71c89ee83..96e6e17340c52fd675df3921caa0859647e10ca5 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -288,7 +288,7 @@ static int compareRowData(const void *a, const void *b, const void *userData) { return (in1 != NULL && in2 != NULL) ? supporter->comFunc(in1, in2) : 0; } -static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv *pRuntimeEnv, SSDataBlock* pDataBlock) { +static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv *pRuntimeEnv, SSDataBlock* pDataBlock, SQLFunctionCtx *pCtx) { SArray *columnOrderList = getOrderCheckColumns(pRuntimeEnv->pQueryAttr); size_t size = taosArrayGetSize(columnOrderList); taosArrayDestroy(columnOrderList); @@ -302,12 +302,23 @@ static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeE return; } + int32_t orderIndex = -1; + for (int32_t j = 0; j < pDataBlock->info.numOfCols; ++j) { + if (pCtx[j].colId == orderId) { + orderIndex = j; + break; + } + } + if (orderIndex < 0) { + return; + } + bool found = false; int16_t dataOffset = 0; for (int32_t j = 0; j < pDataBlock->info.numOfCols; ++j) { SColumnInfoData* pColInfoData = (SColumnInfoData *)taosArrayGet(pDataBlock->pDataBlock, j); - if (orderId == j) { + if (orderIndex == j) { found = true; break; } @@ -319,8 +330,7 @@ static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeE return; } - int16_t type = pRuntimeEnv->pQueryAttr->pExpr1[orderId].base.resType; - + int16_t type = pRuntimeEnv->pQueryAttr->pExpr1[orderIndex].base.resType; SRowCompSupporter support = {.pRuntimeEnv = pRuntimeEnv, .dataOffset = dataOffset, .comFunc = getComparFunc(type, 0)}; taosArraySortPWithExt(pGroupResInfo->pRows, compareRowData, &support); } @@ -485,44 +495,6 @@ static void prepareResultListBuffer(SResultRowInfo* pResultRowInfo, SQueryRuntim pResultRowInfo->capacity = (int32_t)newCapacity; } -static bool chkResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, char *pData, - int16_t bytes, bool masterscan, uint64_t uid) { - bool existed = false; - SET_RES_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, uid); - - SResultRow **p1 = - (SResultRow **)taosHashGet(pRuntimeEnv->pResultRowHashTable, pRuntimeEnv->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes)); - - // in case of repeat scan/reverse scan, no new time window added. - if (QUERY_IS_INTERVAL_QUERY(pRuntimeEnv->pQueryAttr)) { - if (!masterscan) { // the *p1 may be NULL in case of sliding+offset exists. - return p1 != NULL; - } - - if (p1 != NULL) { - if (pResultRowInfo->size == 0) { - existed = false; - assert(pResultRowInfo->curPos == -1); - } else if (pResultRowInfo->size == 1) { - existed = (pResultRowInfo->pResult[0] == (*p1)); - } else { // check if current pResultRowInfo contains the existed pResultRow - SET_RES_EXT_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, uid, pResultRowInfo); - int64_t* index = taosHashGet(pRuntimeEnv->pResultRowListSet, pRuntimeEnv->keyBuf, GET_RES_EXT_WINDOW_KEY_LEN(bytes)); - if (index != NULL) { - existed = true; - } else { - existed = false; - } - } - } - - return existed; - } - - return p1 != NULL; -} - - static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResultRowInfo* pResultRowInfo, int64_t tid, char* pData, int16_t bytes, bool masterscan, uint64_t tableGroupId) { bool existed = false; @@ -669,34 +641,6 @@ static STimeWindow getActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t return w; } -// get the correct time window according to the handled timestamp -static STimeWindow getCurrentActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t ts, SQueryAttr *pQueryAttr) { - STimeWindow w = {0}; - - if (pResultRowInfo->curPos == -1) { // the first window, from the previous stored value - getInitialStartTimeWindow(pQueryAttr, ts, &w); - - if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') { - w.ekey = taosTimeAdd(w.skey, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision) - 1; - } else { - w.ekey = w.skey + pQueryAttr->interval.interval - 1; - } - } else { - w = getResultRow(pResultRowInfo, pResultRowInfo->curPos)->win; - } - - /* - * query border check, skey should not be bounded by the query time range, since the value skey will - * be used as the time window index value. So we only change ekey of time window accordingly. - */ - if (w.ekey > pQueryAttr->window.ekey && QUERY_IS_ASC_QUERY(pQueryAttr)) { - w.ekey = pQueryAttr->window.ekey; - } - - return w; -} - - // a new buffer page for each table. Needs to opt this design static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf *pResultBuf, int32_t tid, uint32_t size) { @@ -743,13 +687,6 @@ static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf return 0; } -static bool chkWindowOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, STimeWindow *win, - bool masterscan, SResultRow **pResult, int64_t groupId, SQLFunctionCtx* pCtx, - int32_t numOfOutput, int32_t* rowCellInfoOffset) { - assert(win->skey <= win->ekey); - - return chkResultRowFromKey(pRuntimeEnv, pResultRowInfo, (char *)&win->skey, TSDB_KEYSIZE, masterscan, groupId); -} static int32_t setResultOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, int64_t tid, STimeWindow *win, bool masterscan, SResultRow **pResult, int64_t tableGroupId, SQLFunctionCtx* pCtx, @@ -788,15 +725,6 @@ static void setResultRowInterpo(SResultRow* pResult, SResultTsInterpType type) { } } -static void unsetResultRowInterpo(SResultRow* pResult, SResultTsInterpType type) { - assert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); - if (type == RESULT_ROW_START_INTERP) { - pResult->startInterp = false; - } else { - pResult->endInterp = false; - } -} - static bool resultRowInterpolated(SResultRow* pResult, SResultTsInterpType type) { assert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); @@ -1096,11 +1024,6 @@ static int32_t getNextQualifiedWindow(SQueryAttr* pQueryAttr, STimeWindow *pNext } } - /* interp query with fill should not skip time window */ - if (pQueryAttr->pointInterpQuery && pQueryAttr->fillType != TSDB_FILL_NONE) { - return startPos; - } - /* * This time window does not cover any data, try next time window, * this case may happen when the time window is too small @@ -1355,24 +1278,18 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, int16_t index = pColIndex->colIndex; SColumnInfoData *pColInfo = taosArrayGet(pDataBlock, index); - assert(pColInfo->info.colId == pColIndex->colId && curTs != windowKey); + assert(pColInfo->info.colId <= TSDB_RES_COL_ID || (pColInfo->info.colId >= 0 && pColInfo->info.colId == pColIndex->colId)); double v1 = 0, v2 = 0, v = 0; - if (prevRowIndex == -1) { - GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pRuntimeEnv->prevRow[index]); - } else { - GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes); - } - - GET_TYPED_DATA(v2, double, pColInfo->info.type, (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes); - if (functionId == TSDB_FUNC_INTERP) { if (type == RESULT_ROW_START_INTERP) { + if (prevRowIndex == -1) { + COPY_DATA(&pCtx[k].start.val, (char *)pRuntimeEnv->prevRow[index]); + } else { + COPY_DATA(&pCtx[k].start.val, (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes); + } + pCtx[k].start.key = prevTs; - pCtx[k].start.val = v1; - - pCtx[k].end.key = curTs; - pCtx[k].end.val = v2; if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { if (prevRowIndex == -1) { @@ -1380,16 +1297,38 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, } else { pCtx[k].start.ptr = (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes; } + } + } else { + if (curRowIndex == -1) { + COPY_DATA(&pCtx[k].end.val, pRuntimeEnv->prevRow[index]); + } else { + COPY_DATA(&pCtx[k].end.val, (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes); + } + + pCtx[k].end.key = curTs; + + if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { pCtx[k].end.ptr = (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes; } } } else if (functionId == TSDB_FUNC_TWA) { + assert(curTs != windowKey); + + if (prevRowIndex == -1) { + GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pRuntimeEnv->prevRow[index]); + } else { + GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes); + } + + GET_TYPED_DATA(v2, double, pColInfo->info.type, (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes); + SPoint point1 = (SPoint){.key = prevTs, .val = &v1}; SPoint point2 = (SPoint){.key = curTs, .val = &v2}; SPoint point = (SPoint){.key = windowKey, .val = &v }; - taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE); + bool exceedMax = false, exceedMin = false; + taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE, &exceedMax, &exceedMin); if (type == RESULT_ROW_START_INTERP) { pCtx[k].start.key = point.key; @@ -1500,11 +1439,6 @@ static void doWindowBorderInterpolation(SOperatorInfo* pOperatorInfo, SSDataBloc setNotInterpoWindowKey(pCtx, pQueryAttr->numOfOutput, RESULT_ROW_START_INTERP); } - // point interpolation does not require the end key time window interpolation. - if (pQueryAttr->pointInterpQuery) { - return; - } - // interpolation query does not generate the time window end interpolation done = resultRowInterpolated(pResult, RESULT_ROW_END_INTERP); if (!done) { @@ -1630,93 +1564,6 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul } -static void hashAllIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResultRowInfo, SSDataBlock* pSDataBlock, int32_t tableGroupId) { - STableIntervalOperatorInfo* pInfo = (STableIntervalOperatorInfo*) pOperatorInfo->info; - - SQueryRuntimeEnv* pRuntimeEnv = pOperatorInfo->pRuntimeEnv; - int32_t numOfOutput = pOperatorInfo->numOfOutput; - SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - - int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQueryAttr->order.order); - bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); - - TSKEY* tsCols = NULL; - if (pSDataBlock->pDataBlock != NULL) { - SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, 0); - tsCols = (int64_t*) pColDataInfo->pData; - assert(tsCols[0] == pSDataBlock->info.window.skey && - tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey); - } - - int32_t startPos = ascQuery? 0 : (pSDataBlock->info.rows - 1); - int32_t ostartPos = 0; - TSKEY ts = getStartTsKey(pQueryAttr, &pSDataBlock->info.window, tsCols, pSDataBlock->info.rows); - - STimeWindow win = getCurrentActiveTimeWindow(pResultRowInfo, ts, pQueryAttr); - bool masterScan = IS_MASTER_SCAN(pRuntimeEnv); - - SResultRow* pResult = NULL; - int32_t forwardStep = 0; - int32_t ret = 0; - //STimeWindow preWin = win; - - while (1) { - // null data, failed to allocate more memory buffer - ret = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, - tableGroupId, pInfo->pCtx, numOfOutput, pInfo->rowCellInfoOffset); - if (ret != TSDB_CODE_SUCCESS) { - longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - TSKEY ekey = reviseWindowEkey(pQueryAttr, &win); - forwardStep = getNumOfRowsInTimeWindow(pRuntimeEnv, &pSDataBlock->info, tsCols, startPos, ekey, binarySearchForKey, true); - - // window start(end) key interpolation - unsetResultRowInterpo(pResult, RESULT_ROW_START_INTERP); - ostartPos = startPos; - - if (!ascQuery) { - startPos += forwardStep * step; - } - - doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->pCtx, pResult, &win, startPos, forwardStep); - doApplyFunctions(pRuntimeEnv, pInfo->pCtx, &win, ostartPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); - - int32_t prevEndPos = (!ascQuery) ? startPos - step : (forwardStep - 1) * step + startPos; - startPos = getNextQualifiedWindow(pQueryAttr, &win, &pSDataBlock->info, tsCols, binarySearchForKey, prevEndPos); - if (startPos < 0) { - if ((ascQuery && win.skey <= pQueryAttr->window.ekey) || ((!ascQuery) && win.ekey >= pQueryAttr->window.ekey)) { - int32_t code = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, tableGroupId, - pInfo->pCtx, numOfOutput, pInfo->rowCellInfoOffset); - if (code != TSDB_CODE_SUCCESS || pResult == NULL) { - longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - if (ascQuery) { - startPos = pSDataBlock->info.rows - 1; - } else { - startPos = 0; - } - - forwardStep = 1; - unsetResultRowInterpo(pResult, RESULT_ROW_START_INTERP); - setNotInterpoWindowKey(pInfo->pCtx, pQueryAttr->numOfOutput, RESULT_ROW_START_INTERP); - doApplyFunctions(pRuntimeEnv, pInfo->pCtx, &win, startPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); - } - - break; - } - setResultRowInterpo(pResult, RESULT_ROW_END_INTERP); - } - - if (pQueryAttr->timeWindowInterpo) { - int32_t rowIndex = ascQuery? (pSDataBlock->info.rows-1):0; - saveDataBlockLastRow(pRuntimeEnv, &pSDataBlock->info, pSDataBlock->pDataBlock, rowIndex); - } - - updateResultRowInfoActiveIndex(pResultRowInfo, pQueryAttr, pRuntimeEnv->current->lastKey); -} - static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pInfo, SSDataBlock *pSDataBlock) { @@ -1742,9 +1589,6 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn int32_t num = 0; for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) { char* val = ((char*)pColInfoData->pData) + bytes * j; - if (isNull(val, type)) { - continue; - } // Compare with the previous row of this column, and do not set the output buffer again if they are identical. if (pInfo->prevData == NULL) { @@ -2080,6 +1924,7 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr pCtx->interBufBytes = pSqlExpr->interBytes; pCtx->start.key = INT64_MIN; pCtx->end.key = INT64_MIN; + pCtx->startTs = INT64_MIN; pCtx->numOfParams = pSqlExpr->numOfParams; for (int32_t j = 0; j < pCtx->numOfParams; ++j) { @@ -2217,12 +2062,6 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf setTableScanFilterOperatorInfo(pRuntimeEnv->proot->upstream[0]->info, pRuntimeEnv->proot); break; } - case OP_AllMultiTableTimeInterval: { - pRuntimeEnv->proot = - createAllMultiTableTimeIntervalOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); - setTableScanFilterOperatorInfo(pRuntimeEnv->proot->upstream[0]->info, pRuntimeEnv->proot); - break; - } case OP_TimeWindow: { pRuntimeEnv->proot = createTimeIntervalOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); @@ -2232,9 +2071,9 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf } break; } - case OP_AllTimeWindow: { + case OP_TimeEvery: { pRuntimeEnv->proot = - createAllTimeIntervalOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); + createTimeEveryOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); int32_t opType = pRuntimeEnv->proot->upstream[0]->operatorType; if (opType != OP_DummyInput && opType != OP_Join) { setTableScanFilterOperatorInfo(pRuntimeEnv->proot->upstream[0]->info, pRuntimeEnv->proot); @@ -2726,12 +2565,23 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); + doUpdateLastKey(pQueryAttr); } pQueryAttr->order.order = TSDB_ORDER_ASC; return; } + if (pQueryAttr->pointInterpQuery && pQueryAttr->interval.interval > 0 && (!QUERY_IS_ASC_QUERY(pQueryAttr)) && pQueryAttr->range.skey == INT64_MIN) { + qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); + SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); + + pQueryAttr->order.order = TSDB_ORDER_ASC; + doUpdateLastKey(pQueryAttr); + pQueryAttr->needReverseScan = true; + return; + } + if (pQueryAttr->interval.interval == 0) { if (onlyFirstQuery(pQueryAttr)) { if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { @@ -2798,6 +2648,14 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i while(((*rowsize) * MIN_ROWS_PER_PAGE) > (*ps) - overhead) { *ps = ((*ps) << 1u); } + + if (*ps > 5 * 1024 * 1024) { + MIN_ROWS_PER_PAGE = 2; + *ps = DEFAULT_INTERN_BUF_PAGE_SIZE; + while(((*rowsize) * MIN_ROWS_PER_PAGE) > (*ps) - overhead) { + *ps = ((*ps) << 1u); + } + } } #define IS_PREFILTER_TYPE(_t) ((_t) != TSDB_DATA_TYPE_BINARY && (_t) != TSDB_DATA_TYPE_NCHAR) @@ -3189,39 +3047,27 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa // check if this data block is required to load if ((*status) != BLK_DATA_ALL_NEEDED) { - bool needFilter = true; - // the pCtx[i] result is belonged to previous time window since the outputBuf has not been set yet, // the filter result may be incorrect. So in case of interval query, we need to set the correct time output buffer - if (QUERY_IS_INTERVAL_QUERY(pQueryAttr)) { + if (QUERY_IS_INTERVAL_QUERY(pQueryAttr) && (!pQueryAttr->pointInterpQuery)) { SResultRow* pResult = NULL; bool masterScan = IS_MASTER_SCAN(pRuntimeEnv); TSKEY k = ascQuery? pBlock->info.window.skey : pBlock->info.window.ekey; STimeWindow win = getActiveTimeWindow(pTableScanInfo->pResultRowInfo, k, pQueryAttr); - if (pQueryAttr->pointInterpQuery) { - needFilter = chkWindowOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, &win, masterScan, &pResult, groupId, - pTableScanInfo->pCtx, pTableScanInfo->numOfOutput, - pTableScanInfo->rowCellInfoOffset); - } else { - if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId, - pTableScanInfo->pCtx, pTableScanInfo->numOfOutput, - pTableScanInfo->rowCellInfoOffset) != TSDB_CODE_SUCCESS) { - longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } + if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId, + pTableScanInfo->pCtx, pTableScanInfo->numOfOutput, + pTableScanInfo->rowCellInfoOffset) != TSDB_CODE_SUCCESS) { + longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); } - } else if (pQueryAttr->stableQuery && (!pQueryAttr->tsCompQuery) && (!pQueryAttr->diffQuery)) { // stable aggregate, not interval aggregate or normal column aggregate + } else if (pQueryAttr->stableQuery && (!pQueryAttr->tsCompQuery) && (!pQueryAttr->diffQuery) && (!pQueryAttr->pointInterpQuery)) { // stable aggregate, not interval aggregate or normal column aggregate doSetTableGroupOutputBuf(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pTableScanInfo->pCtx, pTableScanInfo->rowCellInfoOffset, pTableScanInfo->numOfOutput, pRuntimeEnv->current->groupIndex); } - if (needFilter) { - (*status) = doFilterByBlockTimeWindow(pTableScanInfo, pBlock); - } else { - (*status) = BLK_DATA_ALL_NEEDED; - } + (*status) = doFilterByBlockTimeWindow(pTableScanInfo, pBlock); } SDataBlockInfo* pBlockInfo = &pBlock->info; @@ -3711,6 +3557,9 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i if (fid == TSDB_FUNC_TOP || fid == TSDB_FUNC_BOTTOM || fid == TSDB_FUNC_DIFF || fid == TSDB_FUNC_DERIVATIVE || fid == TSDB_FUNC_SAMPLE || fid == TSDB_FUNC_MAVG || fid == TSDB_FUNC_CSUM) { if (i > 0) pCtx[i].ptsOutputBuf = pCtx[i-1].pOutput; + } else if (fid == TSDB_FUNC_INTERP) { + assert(pCtx[0].functionId == TSDB_FUNC_TS_DUMMY || pCtx[0].functionId == TSDB_FUNC_TS); + pCtx[i].ptsOutputBuf = pCtx[0].pOutput; } } @@ -3751,12 +3600,15 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf functionId == TSDB_FUNC_CSUM || functionId == TSDB_FUNC_MAVG || functionId == TSDB_FUNC_SAMPLE ) { if (i > 0) pBInfo->pCtx[i].ptsOutputBuf = pBInfo->pCtx[i-1].pOutput; + } else if (functionId == TSDB_FUNC_INTERP) { + assert(pBInfo->pCtx[0].functionId == TSDB_FUNC_TS_DUMMY || pBInfo->pCtx[0].functionId == TSDB_FUNC_TS); + pBInfo->pCtx[i].ptsOutputBuf = pBInfo->pCtx[0].pOutput; } } } void copyTsColoum(SSDataBlock* pRes, SQLFunctionCtx* pCtx, int32_t numOfOutput) { - bool needCopyTs = false; + bool interpQuery = false; int32_t tsNum = 0; char *src = NULL; for (int32_t i = 0; i < numOfOutput; i++) { @@ -3764,18 +3616,21 @@ void copyTsColoum(SSDataBlock* pRes, SQLFunctionCtx* pCtx, int32_t numOfOutput) if (functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_DERIVATIVE || functionId == TSDB_FUNC_MAVG || functionId == TSDB_FUNC_CSUM || functionId == TSDB_FUNC_SAMPLE) { - needCopyTs = true; if (i > 0 && pCtx[i-1].functionId == TSDB_FUNC_TS_DUMMY){ SColumnInfoData* pColRes = taosArrayGet(pRes->pDataBlock, i - 1); // find ts data src = pColRes->pData; } - }else if(functionId == TSDB_FUNC_TS_DUMMY) { + } else if(functionId == TSDB_FUNC_INTERP) { + assert(pCtx[0].functionId == TSDB_FUNC_TS); + SColumnInfoData* pColRes = taosArrayGet(pRes->pDataBlock, 0); // find ts data + src = pColRes->pData; + interpQuery = true; + } else if(functionId == TSDB_FUNC_TS_DUMMY) { tsNum++; } } - if (!needCopyTs) return; - if (tsNum < 2) return; + if ((interpQuery == false && tsNum < 2) || (interpQuery && tsNum <= 0)) return; if (src == NULL) return; for (int32_t i = 0; i < numOfOutput; i++) { @@ -4830,7 +4685,7 @@ static int32_t setupQueryHandle(void* tsdb, SQueryRuntimeEnv* pRuntimeEnv, int64 STsdbQueryCond cond = createTsdbQueryCond(pQueryAttr, &pQueryAttr->window); if (pQueryAttr->tsCompQuery || pQueryAttr->pointInterpQuery) { - cond.type = BLOCK_LOAD_TABLE_SEQ_ORDER; + cond.type = BLOCK_LOAD_TABLE_SEQ_ORDER; } if (!isSTableQuery @@ -4957,14 +4812,16 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr if (pTsBuf != NULL) { int16_t order = (pQueryAttr->order.order == pRuntimeEnv->pTsBuf->tsOrder) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; + tsBufResetPos(pRuntimeEnv->pTsBuf); tsBufSetTraverseOrder(pRuntimeEnv->pTsBuf, order); + tsBufNextPos(pTsBuf); } int32_t ps = DEFAULT_PAGE_SIZE; getIntermediateBufInfo(pRuntimeEnv, &ps, &pQueryAttr->intermediateResultRowSize); - int32_t TENMB = 1024*1024*10; - int32_t code = createDiskbasedResultBuffer(&pRuntimeEnv->pResultBuf, ps, TENMB, pQInfo->qId); + int32_t TWENTYMB = 1024*1024*20; + int32_t code = createDiskbasedResultBuffer(&pRuntimeEnv->pResultBuf, ps, TWENTYMB, pQInfo->qId); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -5062,6 +4919,17 @@ static void doCloseAllTimeWindow(SQueryRuntimeEnv* pRuntimeEnv) { } } +static void notifyTableScan(void* param, int32_t option) { + SOperatorInfo *pOperator = (SOperatorInfo*) param; + STableScanInfo *pTableScanInfo = pOperator->info; + + if (option == OPTION_SWITCH_TABLE) { + tsdbSwitchTable(pTableScanInfo->pQueryHandle); + } + + return; +} + static SSDataBlock* doTableScanImpl(void* param, bool* newgroup) { SOperatorInfo *pOperator = (SOperatorInfo*) param; @@ -5321,13 +5189,18 @@ void setTableScanFilterOperatorInfo(STableScanInfo* pTableScanInfo, SOperatorInf pTableScanInfo->pCtx = pAggInfo->binfo.pCtx; pTableScanInfo->pResultRowInfo = &pAggInfo->binfo.resultRowInfo; pTableScanInfo->rowCellInfoOffset = pAggInfo->binfo.rowCellInfoOffset; - } else if (pDownstream->operatorType == OP_TimeWindow || pDownstream->operatorType == OP_AllTimeWindow) { + } else if (pDownstream->operatorType == OP_TimeWindow) { STableIntervalOperatorInfo *pIntervalInfo = pDownstream->info; pTableScanInfo->pCtx = pIntervalInfo->pCtx; pTableScanInfo->pResultRowInfo = &pIntervalInfo->resultRowInfo; pTableScanInfo->rowCellInfoOffset = pIntervalInfo->rowCellInfoOffset; - + } else if (pDownstream->operatorType == OP_TimeEvery) { + STimeEveryOperatorInfo *pEveryInfo = pDownstream->info; + + pTableScanInfo->pCtx = pEveryInfo->binfo.pCtx; + pTableScanInfo->pResultRowInfo = &pEveryInfo->binfo.resultRowInfo; + pTableScanInfo->rowCellInfoOffset = pEveryInfo->binfo.rowCellInfoOffset; } else if (pDownstream->operatorType == OP_Groupby) { SGroupbyOperatorInfo *pGroupbyInfo = pDownstream->info; @@ -5375,6 +5248,10 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime pInfo->current = 0; pInfo->order = pRuntimeEnv->pQueryAttr->order.order; + if (pRuntimeEnv->pQueryAttr->pointInterpQuery) { + pRuntimeEnv->enableGroupData = true; + } + SOperatorInfo* pOptr = calloc(1, sizeof(SOperatorInfo)); pOptr->name = "DataBlocksOptimizedScanOperator"; pOptr->operatorType = OP_DataBlocksOptScan; @@ -5382,6 +5259,7 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime pOptr->blockingOptr = false; pOptr->info = pInfo; pOptr->exec = doTableScan; + pOptr->notify = notifyTableScan; return pOptr; } @@ -5860,6 +5738,11 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { } } + if (pOperator->status == OP_EXEC_DONE) { + *newgroup = false; + return NULL; + } + while(1) { bool prevVal = *newgroup; @@ -5872,7 +5755,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { //assert(*newgroup == false); *newgroup = prevVal; - setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); + doSetOperatorCompleted(pOperator); break; } @@ -6073,127 +5956,477 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) { return pIntervalInfo->pRes->info.rows == 0? NULL:pIntervalInfo->pRes; } -static SSDataBlock* doAllIntervalAgg(void* param, bool* newgroup) { - SOperatorInfo* pOperator = (SOperatorInfo*) param; - if (pOperator->status == OP_EXEC_DONE) { - return NULL; +static void everyApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx *pCtx, int32_t numOfOutput) { + for (int32_t k = 0; k < numOfOutput; ++k) { + if (pCtx[k].functionId < 0) { + // load the script and exec + SUdfInfo* pUdfInfo = pRuntimeEnv->pUdfInfo; + doInvokeUdf(pUdfInfo, &pCtx[k], 0, TSDB_UDF_FUNC_NORMAL); + } else { + aAggs[pCtx[k].functionId].xFunction(&pCtx[k]); + } } +} - STableIntervalOperatorInfo* pIntervalInfo = pOperator->info; +static int64_t getEveryStartTs(bool ascQuery, STimeWindow *range, STimeWindow *blockWin, SQueryAttr *pQueryAttr) { + int64_t startTs = range->skey, ekey = 0; + + assert(range->skey != INT64_MIN); - SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; - if (pOperator->status == OP_RES_TO_RETURN) { - toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); + if (ascQuery) { + return startTs; + } - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { - doSetOperatorCompleted(pOperator); - } + if (range->ekey != INT64_MIN) { + ekey = range->ekey; + } else { + ekey = blockWin->ekey; + } - return pIntervalInfo->pRes; + if (pQueryAttr->interval.interval > 0) { + if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') { + int64_t lastTs = startTs; + while (startTs < ekey) { + lastTs = startTs; + startTs = taosTimeAdd(startTs, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision); + } + startTs = lastTs; + } else { + startTs = startTs + (ekey - startTs)/pQueryAttr->interval.interval * pQueryAttr->interval.interval; + } } + return startTs; +} + +static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlock, bool *needApply) { + SQueryRuntimeEnv* pRuntimeEnv = pOperatorInfo->pRuntimeEnv; + STimeEveryOperatorInfo* pEveryInfo = (STimeEveryOperatorInfo*)pOperatorInfo->info; SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - int32_t order = pQueryAttr->order.order; - STimeWindow win = pQueryAttr->window; + bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); + int32_t gidx = pRuntimeEnv->current->groupIndex; + SQLFunctionCtx* pCtx = NULL; - SOperatorInfo* upstream = pOperator->upstream[0]; + *needApply = false; + + if (!pQueryAttr->pointInterpQuery) { + goto group_finished_exit; + } - while(1) { - publishOperatorProfEvent(upstream, QUERY_PROF_BEFORE_OPERATOR_EXEC); - SSDataBlock* pBlock = upstream->exec(upstream, newgroup); - publishOperatorProfEvent(upstream, QUERY_PROF_AFTER_OPERATOR_EXEC); + assert(pOperatorInfo->numOfOutput > 1); + + for (int32_t i = 1; i < pOperatorInfo->numOfOutput; ++i) { + assert(pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP + || pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TS_DUMMY + || pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TAG_DUMMY); - if (pBlock == NULL) { + if (pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP) { + pCtx = &pEveryInfo->binfo.pCtx[i]; break; } - - setTagValue(pOperator, pRuntimeEnv->current->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput); - - // the pDataBlock are always the same one, no need to call this again - setInputDataBlock(pOperator, pIntervalInfo->pCtx, pBlock, pQueryAttr->order.order); - hashAllIntervalAgg(pOperator, &pIntervalInfo->resultRowInfo, pBlock, 0); + } + + 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); } - // restore the value - pQueryAttr->order.order = order; - pQueryAttr->window = win; - - pOperator->status = OP_RES_TO_RETURN; - closeAllResultRows(&pIntervalInfo->resultRowInfo); - setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); - finalizeQueryResult(pOperator, pIntervalInfo->pCtx, &pIntervalInfo->resultRowInfo, pIntervalInfo->rowCellInfoOffset); + if (pCtx->startTs == INT64_MIN) { + if (pQueryAttr->range.skey == INT64_MIN) { + if (NULL == tsCols) { + goto group_finished_exit; + } - initGroupResInfo(&pRuntimeEnv->groupResInfo, &pIntervalInfo->resultRowInfo); - toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); + if (ascQuery) { + if (pQueryAttr->needReverseScan) { + assert(pEveryInfo->rangeStart); + taosHashPut(pEveryInfo->rangeStart, &pBlock->info.tid, sizeof(pBlock->info.tid), tsCols, sizeof(*tsCols)); + goto group_finished_exit; + } else { + pCtx->startTs = tsCols[0]; + } + } else { + assert(pEveryInfo->rangeStart); + TSKEY * rstart = taosHashGet(pEveryInfo->rangeStart, &pBlock->info.tid, sizeof(pBlock->info.tid)); + if (rstart) { + pQueryAttr->range.skey = *rstart; - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; + pCtx->startTs = getEveryStartTs(ascQuery, &pQueryAttr->range, &pBlock->info.window, pQueryAttr); + } else { + goto group_finished_exit; + } + } + } else { + pCtx->startTs = getEveryStartTs(ascQuery, &pQueryAttr->range, &pBlock->info.window, pQueryAttr); + } + + pCtx->endTs = INT64_MIN; + } else if (pCtx->endTs == pCtx->startTs) { + if (pQueryAttr->interval.interval > 0) { + if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') { + if (ascQuery) { + pCtx->startTs = taosTimeAdd(pCtx->startTs, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision); + } else { + pCtx->startTs = taosTimeSub(pCtx->startTs, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision); + } + } else { + pCtx->startTs = ascQuery ? pCtx->startTs + pQueryAttr->interval.interval : pCtx->startTs - pQueryAttr->interval.interval; + } + + if (ascQuery && pQueryAttr->range.ekey != INT64_MIN && pCtx->startTs > pQueryAttr->range.ekey) { + goto group_finished_exit; + } + + if ((!ascQuery) && pQueryAttr->range.skey != INT64_MIN && pCtx->startTs < pQueryAttr->range.skey) { + goto group_finished_exit; + } + } else { + goto group_finished_exit; + } + + pCtx->endTs = INT64_MIN; } - return pIntervalInfo->pRes->info.rows == 0? NULL:pIntervalInfo->pRes; + if (tsCols == NULL && ((ascQuery && pCtx->startTs > pEveryInfo->tableEndKey) || ((!ascQuery) && pCtx->startTs < pEveryInfo->tableEndKey))) { + if ((ascQuery && pQueryAttr->range.ekey == INT64_MIN) || ((!ascQuery) && pQueryAttr->range.skey == INT64_MIN)) { + goto group_finished_exit; + } + + if (pQueryAttr->fillType == TSDB_FILL_NONE || pQueryAttr->fillType == TSDB_FILL_LINEAR + || ((ascQuery && pQueryAttr->fillType == TSDB_FILL_NEXT) || ((!ascQuery) && pQueryAttr->fillType == TSDB_FILL_PREV))) { + goto group_finished_exit; + } + + if (ascQuery && pQueryAttr->fillType == TSDB_FILL_PREV) { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pEveryInfo->binfo.pRes->pDataBlock, lastTs, -1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } else { + goto group_finished_exit; + } + } else if ((!ascQuery) && pQueryAttr->fillType == TSDB_FILL_NEXT) { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pEveryInfo->binfo.pRes->pDataBlock, INT64_MIN, 0, lastTs, -1, 0, RESULT_ROW_END_INTERP); + } else { + goto group_finished_exit; + } + } + + *needApply = true; + + for (int32_t i = 0; i < pOperatorInfo->numOfOutput; ++i) { + pEveryInfo->binfo.pCtx[i].startTs = pCtx->startTs; + } + + return false; + } + + + int32_t startPos = binarySearchForKey((char *)tsCols, pBlock->info.rows, pCtx->startTs, pQueryAttr->order.order); + + if (ascQuery && pQueryAttr->fillType != TSDB_FILL_NEXT && pCtx->start.key == INT64_MIN) { + if (startPos < 0) { + saveDataBlockLastRow(pRuntimeEnv, &pBlock->info, pBlock->pDataBlock, pBlock->info.rows - 1); + return true; + } else if (startPos == 0) { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, pCtx->startTs, startPos, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } else { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, lastTs, -1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } + } + } else { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, pCtx->startTs, startPos, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } else { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, tsCols[startPos - 1], startPos - 1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } + } + + if (pQueryAttr->fillType != TSDB_FILL_LINEAR) { + *needApply = true; + } + } + + if ((!ascQuery) && (pQueryAttr->fillType == TSDB_FILL_LINEAR || pQueryAttr->fillType == TSDB_FILL_NEXT) && pCtx->end.key == INT64_MIN) { + if (startPos < 0) { + saveDataBlockLastRow(pRuntimeEnv, &pBlock->info, pBlock->pDataBlock, 0); + return true; + } else if (startPos == (pBlock->info.rows - 1)) { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, pCtx->startTs, startPos, 0, RESULT_ROW_END_INTERP); + } else { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, lastTs, -1, 0, RESULT_ROW_END_INTERP); + } + } + } else { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, pCtx->startTs, startPos, 0, RESULT_ROW_END_INTERP); + } else { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, tsCols[startPos + 1], startPos + 1, 0, RESULT_ROW_END_INTERP); + } + } + + if (pQueryAttr->fillType != TSDB_FILL_LINEAR) { + *needApply = true; + } + } + + if (ascQuery && (pQueryAttr->fillType == TSDB_FILL_LINEAR || pQueryAttr->fillType == TSDB_FILL_NEXT) && pCtx->end.key == INT64_MIN) { + if (startPos < 0) { + return true; + } + + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, tsCols[startPos], startPos, 0, RESULT_ROW_END_INTERP); + + *needApply = true; + } + + if ((!ascQuery) && pQueryAttr->fillType != TSDB_FILL_NEXT && pCtx->start.key == INT64_MIN) { + if (startPos < 0) { + return true; + } + + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, tsCols[startPos], startPos, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + + *needApply = true; + } + + if (*needApply) { + for (int32_t i = 0; i < pOperatorInfo->numOfOutput; ++i) { + pEveryInfo->binfo.pCtx[i].startTs = pCtx->startTs; + } + } + + return false; + +group_finished_exit: + + qDebug("group idx[%d] interp finished", gidx); + + if (pQueryAttr->needReverseScan) { + pQueryAttr->range.skey = INT64_MIN; + } + + pEveryInfo->groupDone = true; + + if (pCtx) { + pCtx->startTs = INT64_MIN; + pCtx->start.key = INT64_MIN; + pCtx->end.key = INT64_MIN; + } + + return true; } -static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) { + + +static void doTimeEveryImpl(SOperatorInfo* pOperator, SQLFunctionCtx *pCtx, SSDataBlock* pBlock, bool newgroup) { + STimeEveryOperatorInfo* pEveryInfo = (STimeEveryOperatorInfo*) pOperator->info; + SQueryRuntimeEnv *pRuntimeEnv = pOperator->pRuntimeEnv; + int32_t numOfOutput = pOperator->numOfOutput; + SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; + bool finished = false, needApply = false; + bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); + SSDataBlock* pRes = pEveryInfo->binfo.pRes; + TSKEY* tsCols = NULL; + + if (pBlock && pBlock->pDataBlock != NULL) { + SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, 0); + if (pColDataInfo->info.type != TSDB_DATA_TYPE_TIMESTAMP) { + qError("no ts input for interp, error quit"); + pEveryInfo->allDone = true; + pEveryInfo->groupDone = true; + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); + return; + } + + tsCols = (int64_t*) pColDataInfo->pData; + assert(tsCols[0] == pBlock->info.window.skey && + tsCols[pBlock->info.rows - 1] == pBlock->info.window.ekey); + + pEveryInfo->tableEndKey = tsCols[ascQuery ? pBlock->info.rows - 1 : 0]; + } + + while (!finished) { + needApply = false; + finished = doEveryInterpolation(pOperator, pBlock, &needApply); + + if (needApply) { + everyApplyFunctions(pRuntimeEnv, pEveryInfo->binfo.pCtx, numOfOutput); + + pRes->info.rows = getNumOfResult(pRuntimeEnv, pEveryInfo->binfo.pCtx, pOperator->numOfOutput); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + pEveryInfo->lastBlock = pBlock; + break; + } + + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + } + } +} + + + +static SSDataBlock* doTimeEvery(void* param, bool* newgroup) { SOperatorInfo* pOperator = (SOperatorInfo*) param; - if (pOperator->status == OP_EXEC_DONE) { + + STimeEveryOperatorInfo* pEveryInfo = pOperator->info; + SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; + SOptrBasicInfo *pInfo = &pEveryInfo->binfo; + + SSDataBlock* pRes = pInfo->pRes; + int32_t order = pRuntimeEnv->pQueryAttr->order.order; + + pRes->info.rows = 0; + + if (!pEveryInfo->groupDone) { + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + doTimeEveryImpl(pOperator, pInfo->pCtx, pEveryInfo->lastBlock, false); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return pInfo->pRes; + } + + if (pRes->info.rows > 0) { + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return pInfo->pRes; + } + } + + if (pEveryInfo->allDone) { + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); return NULL; } - STableIntervalOperatorInfo* pIntervalInfo = pOperator->info; - SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; - if (pOperator->status == OP_RES_TO_RETURN) { - int64_t st = taosGetTimestampUs(); + if (pEveryInfo->existDataBlock) { // TODO refactor + STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current; - copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { - doSetOperatorCompleted(pOperator); + SSDataBlock* pBlock = pEveryInfo->existDataBlock; + pEveryInfo->existDataBlock = NULL; + *newgroup = true; + pEveryInfo->groupDone = false; + + // todo dynamic set tags + if (pTableQueryInfo != NULL) { + setTagValue(pOperator, pTableQueryInfo->pTable, pInfo->pCtx, pOperator->numOfOutput); } - SQInfo* pQInfo = pRuntimeEnv->qinfo; - pQInfo->summary.firstStageMergeTime += (taosGetTimestampUs() - st); + // the pDataBlock are always the same one, no need to call this again + setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order); + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows); - return pIntervalInfo->pRes; - } + doTimeEveryImpl(pOperator, pInfo->pCtx, pBlock, *newgroup); + if (pEveryInfo->groupDone && pOperator->upstream[0]->notify) { + pOperator->upstream[0]->notify(pOperator->upstream[0], OPTION_SWITCH_TABLE); + } - SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - int32_t order = pQueryAttr->order.order; + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return pRes; + } + } - SOperatorInfo* upstream = pOperator->upstream[0]; + while(!pEveryInfo->allDone) { + bool prevVal = *newgroup; - while(1) { - publishOperatorProfEvent(upstream, QUERY_PROF_BEFORE_OPERATOR_EXEC); - SSDataBlock* pBlock = upstream->exec(upstream, newgroup); - publishOperatorProfEvent(upstream, QUERY_PROF_AFTER_OPERATOR_EXEC); + // The upstream exec may change the value of the newgroup, so use a local variable instead. + publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_BEFORE_OPERATOR_EXEC); + SSDataBlock* pBlock = pOperator->upstream[0]->exec(pOperator->upstream[0], newgroup); + publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_AFTER_OPERATOR_EXEC); if (pBlock == NULL) { + if (!pEveryInfo->groupDone) { + pEveryInfo->allDone = true; + + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + doTimeEveryImpl(pOperator, pInfo->pCtx, NULL, false); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + break; + } + + assert(pEveryInfo->groupDone); + + if (pRes->info.rows > 0) { + break; + } + } + + *newgroup = prevVal; + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); break; } - // the pDataBlock are always the same one, no need to call this again + // Return result of the previous group in the firstly. + if (*newgroup) { + if (!pEveryInfo->groupDone) { + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + doTimeEveryImpl(pOperator, pInfo->pCtx, NULL, false); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + pEveryInfo->existDataBlock = pBlock; + break; + } + + assert(pEveryInfo->groupDone); + } + + if (pRes->info.rows > 0) { + pEveryInfo->existDataBlock = pBlock; + break; + } else { // init output buffer for a new group data + for (int32_t j = 0; j < pOperator->numOfOutput; ++j) { + aAggs[pInfo->pCtx[j].functionId].xFinalize(&pInfo->pCtx[j]); + } + initCtxOutputBuffer(pInfo->pCtx, pOperator->numOfOutput); + pEveryInfo->groupDone = false; + } + } + STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current; - setTagValue(pOperator, pTableQueryInfo->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput); - setInputDataBlock(pOperator, pIntervalInfo->pCtx, pBlock, pQueryAttr->order.order); - setIntervalQueryRange(pRuntimeEnv, &pBlock->info.window, pBlock->info.tid); + if (pEveryInfo->groupDone && pTableQueryInfo->groupIndex == pEveryInfo->lastGroupIdx) { + assert(pOperator->upstream[0]->notify == NULL); + continue; + } - hashIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex); - } + // todo dynamic set tags + if (pTableQueryInfo != NULL) { + setTagValue(pOperator, pTableQueryInfo->pTable, pInfo->pCtx, pOperator->numOfOutput); + } - pOperator->status = OP_RES_TO_RETURN; - pQueryAttr->order.order = order; // TODO : restore the order - doCloseAllTimeWindow(pRuntimeEnv); - setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); + // the pDataBlock are always the same one, no need to call this again + setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order); + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows); - copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; + pEveryInfo->groupDone = false; + + doTimeEveryImpl(pOperator, pInfo->pCtx, pBlock, *newgroup); + if (pEveryInfo->groupDone && pOperator->upstream[0]->notify) { + pOperator->upstream[0]->notify(pOperator->upstream[0], OPTION_SWITCH_TABLE); + } + + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + break; + } } - return pIntervalInfo->pRes; + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return (pInfo->pRes->info.rows > 0)? pInfo->pRes:NULL; } -static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { +static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) { SOperatorInfo* pOperator = (SOperatorInfo*) param; if (pOperator->status == OP_EXEC_DONE) { return NULL; @@ -6203,11 +6436,16 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; if (pOperator->status == OP_RES_TO_RETURN) { + int64_t st = taosGetTimestampUs(); + copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; + doSetOperatorCompleted(pOperator); } + SQInfo* pQInfo = pRuntimeEnv->qinfo; + pQInfo->summary.firstStageMergeTime += (taosGetTimestampUs() - st); + return pIntervalInfo->pRes; } @@ -6230,10 +6468,9 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { setTagValue(pOperator, pTableQueryInfo->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput); setInputDataBlock(pOperator, pIntervalInfo->pCtx, pBlock, pQueryAttr->order.order); - setIntervalQueryRange(pRuntimeEnv, &pBlock->info.window, pBlock->info.tid); - hashAllIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex); + hashIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex); } pOperator->status = OP_RES_TO_RETURN; @@ -6241,15 +6478,11 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { doCloseAllTimeWindow(pRuntimeEnv); setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); - int64_t st = taosGetTimestampUs(); copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { pOperator->status = OP_EXEC_DONE; } - SQInfo* pQInfo = pRuntimeEnv->qinfo; - pQInfo->summary.firstStageMergeTime += (taosGetTimestampUs() - st); - return pIntervalInfo->pRes; } @@ -6497,7 +6730,7 @@ static SSDataBlock* hashGroupbyAggregate(void* param, bool* newgroup) { initGroupResInfo(&pRuntimeEnv->groupResInfo, &pInfo->binfo.resultRowInfo); if (!pRuntimeEnv->pQueryAttr->stableQuery) { - sortGroupResByOrderList(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pInfo->binfo.pRes); + sortGroupResByOrderList(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pInfo->binfo.pRes, pInfo->binfo.pCtx); } toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pInfo->binfo.pRes); @@ -6722,6 +6955,13 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) { doDestroyBasicInfo(&pInfo->binfo, numOfOutput); } +static void destroyTimeEveryOperatorInfo(void* param, int32_t numOfOutput) { + STimeEveryOperatorInfo* pInfo = (STimeEveryOperatorInfo*) param; + doDestroyBasicInfo(&pInfo->binfo, numOfOutput); + taosHashCleanup(pInfo->rangeStart); +} + + static void destroyTagScanOperatorInfo(void* param, int32_t numOfOutput) { STagScanInfo* pInfo = (STagScanInfo*) param; pInfo->pRes = destroyOutputBuf(pInfo->pRes); @@ -6898,30 +7138,44 @@ SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOp } -SOperatorInfo* createAllTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { - STableIntervalOperatorInfo* pInfo = calloc(1, sizeof(STableIntervalOperatorInfo)); +SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { + STimeEveryOperatorInfo* pInfo = calloc(1, sizeof(STimeEveryOperatorInfo)); + SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset); - pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); - initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); + pInfo->seed = rand(); + pInfo->bufCapacity = pRuntimeEnv->resultInfo.capacity; + pInfo->groupDone = true; + pInfo->lastGroupIdx = -1; - SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); + SOptrBasicInfo* pBInfo = &pInfo->binfo; + pBInfo->pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity); + pBInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pBInfo->rowCellInfoOffset); - pOperator->name = "AllTimeIntervalAggOperator"; - pOperator->operatorType = OP_AllTimeWindow; - pOperator->blockingOptr = true; + if (pQueryAttr->needReverseScan) { + pInfo->rangeStart = taosHashInit(256, taosGetDefaultHashFunction(TSDB_DATA_TYPE_TIMESTAMP), false, false); + } + + initResultRowInfo(&pBInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); + setDefaultOutputBuf(pRuntimeEnv, pBInfo, pInfo->seed, MASTER_SCAN); + + SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); + pOperator->name = "TimeEveryOperator"; + pOperator->operatorType = OP_TimeEvery; + pOperator->blockingOptr = false; pOperator->status = OP_IN_EXECUTING; + pOperator->info = pInfo; pOperator->pExpr = pExpr; pOperator->numOfOutput = numOfOutput; - pOperator->info = pInfo; pOperator->pRuntimeEnv = pRuntimeEnv; - pOperator->exec = doAllIntervalAgg; - pOperator->cleanup = destroyBasicOperatorInfo; + pOperator->exec = doTimeEvery; + pOperator->cleanup = destroyTimeEveryOperatorInfo; appendUpstream(pOperator, upstream); + return pOperator; } + SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { SStateWindowOperatorInfo* pInfo = calloc(1, sizeof(SStateWindowOperatorInfo)); pInfo->colIndex = -1; @@ -6995,31 +7249,6 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRunti return pOperator; } -SOperatorInfo* createAllMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { - STableIntervalOperatorInfo* pInfo = calloc(1, sizeof(STableIntervalOperatorInfo)); - - pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset); - pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); - initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); - - SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); - pOperator->name = "AllMultiTableTimeIntervalOperator"; - pOperator->operatorType = OP_AllMultiTableTimeInterval; - pOperator->blockingOptr = true; - pOperator->status = OP_IN_EXECUTING; - pOperator->pExpr = pExpr; - pOperator->numOfOutput = numOfOutput; - pOperator->info = pInfo; - pOperator->pRuntimeEnv = pRuntimeEnv; - - pOperator->exec = doAllSTableIntervalAgg; - pOperator->cleanup = destroyBasicOperatorInfo; - - appendUpstream(pOperator, upstream); - - return pOperator; -} - SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { SGroupbyOperatorInfo* pInfo = calloc(1, sizeof(SGroupbyOperatorInfo)); @@ -7621,6 +7850,9 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { pQueryMsg->numOfTables = htonl(pQueryMsg->numOfTables); pQueryMsg->window.skey = htobe64(pQueryMsg->window.skey); pQueryMsg->window.ekey = htobe64(pQueryMsg->window.ekey); + pQueryMsg->range.skey = htobe64(pQueryMsg->range.skey); + pQueryMsg->range.ekey = htobe64(pQueryMsg->range.ekey); + pQueryMsg->interval.interval = htobe64(pQueryMsg->interval.interval); pQueryMsg->interval.sliding = htobe64(pQueryMsg->interval.sliding); pQueryMsg->interval.offset = htobe64(pQueryMsg->interval.offset); @@ -7636,8 +7868,8 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { pQueryMsg->numOfOutput = htons(pQueryMsg->numOfOutput); pQueryMsg->numOfGroupCols = htons(pQueryMsg->numOfGroupCols); - pQueryMsg->tagCondLen = htons(pQueryMsg->tagCondLen); - pQueryMsg->colCondLen = htons(pQueryMsg->colCondLen); + pQueryMsg->tagCondLen = htonl(pQueryMsg->tagCondLen); + pQueryMsg->colCondLen = htonl(pQueryMsg->colCondLen); pQueryMsg->tsBuf.tsOffset = htonl(pQueryMsg->tsBuf.tsOffset); pQueryMsg->tsBuf.tsLen = htonl(pQueryMsg->tsBuf.tsLen); @@ -8052,7 +8284,7 @@ void destroyUdfInfo(SUdfInfo* pUdfInfo) { taosCloseDll(pUdfInfo->handle); tfree(pUdfInfo); } - +#ifdef LUA_EMBEDDED static char* getUdfFuncName(char* funcname, char* name, int type) { switch (type) { case TSDB_UDF_FUNC_NORMAL: @@ -8077,8 +8309,9 @@ static char* getUdfFuncName(char* funcname, char* name, int type) { return funcname; } - +#endif int32_t initUdfInfo(SUdfInfo* pUdfInfo) { +#ifdef LUA_EMBEDDED if (pUdfInfo == NULL || pUdfInfo->handle) { return TSDB_CODE_SUCCESS; } @@ -8162,7 +8395,7 @@ int32_t initUdfInfo(SUdfInfo* pUdfInfo) { return (*(udfInitFunc)pUdfInfo->funcs[TSDB_UDF_FUNC_INIT])(&pUdfInfo->init); } } - +#endif //LUA_EMBEDDED return TSDB_CODE_SUCCESS; } @@ -8287,7 +8520,7 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp return TSDB_CODE_SUCCESS; } -int32_t createQueryFilter(char *data, uint16_t len, void** pFilters) { +int32_t createQueryFilter(char *data, int32_t len, void** pFilters) { tExprNode* expr = NULL; TRY(TSDB_MAX_TAG_CONDITIONS) { @@ -8595,6 +8828,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S pQueryAttr->stateWindow = pQueryMsg->stateWindow; pQueryAttr->vgId = vgId; pQueryAttr->pFilters = pFilters; + pQueryAttr->range = pQueryMsg->range; pQueryAttr->tableCols = calloc(numOfCols, sizeof(SSingleColumnFilterInfo)); if (pQueryAttr->tableCols == NULL) { diff --git a/src/query/src/qExtbuffer.c b/src/query/src/qExtbuffer.c index c11e90b0dafb5d440a0d212a1d14f70f76c04534..29eb389529a7f7ca32a09bffd0bc74744863becb 100644 --- a/src/query/src/qExtbuffer.c +++ b/src/query/src/qExtbuffer.c @@ -537,7 +537,7 @@ static void swap(SColumnModel *pColumnModel, int32_t count, int32_t s1, char *da void *first = COLMODEL_GET_VAL(data1, pColumnModel, count, s1, i); void *second = COLMODEL_GET_VAL(data1, pColumnModel, count, s2, i); - SSchema* pSchema = &pColumnModel->pFields[i].field; + SSchema1* pSchema = &pColumnModel->pFields[i].field; tsDataSwap(first, second, pSchema->type, pSchema->bytes, buf); } } @@ -657,6 +657,89 @@ static UNUSED_FUNC void tRowModelDisplay(tOrderDescriptor *pDescriptor, int32_t printf("\n"); } +static void mergeSortIndicesByOrderColumns(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, + int32_t orderType, __col_compar_fn_t compareFn, int32_t* indices, int32_t* aux) { + if (end <= start) { + return; + } + + + int32_t mid = start + (end-start)/2; + mergeSortIndicesByOrderColumns(pDescriptor, numOfRows, start, mid, data, orderType, compareFn, indices, aux); + mergeSortIndicesByOrderColumns(pDescriptor, numOfRows, mid+1, end, data, orderType, compareFn, indices, aux); + int32_t left = start; + int32_t right = mid + 1; + int32_t k; + for (k = start; k <= end; ++k) { + if (left == mid+1) { + aux[k] = indices[right]; + ++right; + } else if (right == end+1) { + aux[k] = indices[left]; + ++left; + } else { + int32_t ret = compareFn(pDescriptor, numOfRows, indices[left], indices[right], data); + if (ret <= 0) { + aux[k] = indices[left]; + ++left; + } else { + aux[k] = indices[right]; + ++right; + } + } + } + + for (k = start; k <= end; ++k) { + indices[k] = aux[k]; + } +} + +static void columnwiseMergeSortImpl(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char* data, + int32_t orderType, __col_compar_fn_t compareFn) { + int32_t* indices = malloc(numOfRows * sizeof(int32_t)); + int32_t* aux = malloc(numOfRows * sizeof(int32_t)); + + for (int32_t i = 0; i < numOfRows; ++i) { + indices[i] = i; + } + + mergeSortIndicesByOrderColumns(pDescriptor, numOfRows, 0, numOfRows-1, data, orderType, compareFn, indices, aux); + + int32_t numOfCols = pDescriptor->pColumnModel->numOfCols; + + int32_t prevLength = 0; + char* p = NULL; + + for(int32_t i = 0; i < numOfCols; ++i) { + int16_t colOffset = getColumnModelOffset(pDescriptor->pColumnModel, i); + int32_t colBytes = pDescriptor->pColumnModel->pFields[i].field.bytes; + // make sure memory buffer is enough + if (prevLength < colBytes) { + char *tmp = realloc(p, colBytes * numOfRows); + assert(tmp); + + p = tmp; + prevLength = colBytes; + } + + char* colData = data + colOffset * numOfRows; + memcpy(p, colData, colBytes * numOfRows); + + for(int32_t j = 0; j < numOfRows; ++j){ + char* dest = colData + colBytes * j; + + int32_t newPos = indices[j]; + char* src = p + (newPos * colBytes); + memcpy(dest, src, colBytes); + } + + } + + tfree(p); + tfree(aux); + tfree(indices); +} + static void columnwiseQSortImpl(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType, __col_compar_fn_t compareFn, void* buf) { #ifdef _DEBUG_VIEW @@ -758,15 +841,15 @@ static void columnwiseQSortImpl(tOrderDescriptor *pDescriptor, int32_t numOfRows } } -void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t order) { +void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType) { // short array sort, incur another sort procedure instead of quick sort process - __col_compar_fn_t compareFn = (order == TSDB_ORDER_ASC) ? compare_sa : compare_sd; + __col_compar_fn_t compareFn = (orderType == TSDB_ORDER_ASC) ? compare_sa : compare_sd; SColumnModel* pModel = pDescriptor->pColumnModel; size_t width = 0; for(int32_t i = 0; i < pModel->numOfCols; ++i) { - SSchema* pSchema = &pModel->pFields[i].field; + SSchema1* pSchema = &pModel->pFields[i].field; if (width < pSchema->bytes) { width = pSchema->bytes; } @@ -778,16 +861,44 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta if (end - start + 1 <= 8) { tColDataInsertSort(pDescriptor, numOfRows, start, end, data, compareFn, buf); } else { - columnwiseQSortImpl(pDescriptor, numOfRows, start, end, data, order, compareFn, buf); + columnwiseQSortImpl(pDescriptor, numOfRows, start, end, data, orderType, compareFn, buf); } free(buf); } +void tColDataMergeSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType) { + // short array sort, incur another sort procedure instead of quick sort process + __col_compar_fn_t compareFn = (orderType == TSDB_ORDER_ASC) ? compare_sa : compare_sd; + + SColumnModel* pModel = pDescriptor->pColumnModel; + + size_t width = 0; + for(int32_t i = 0; i < pModel->numOfCols; ++i) { + SSchema1* pSchema = &pModel->pFields[i].field; + if (width < pSchema->bytes) { + width = pSchema->bytes; + } + } + + char* buf = malloc(width); + assert(width > 0 && buf != NULL); + + if (end - start + 1 <= 8) { + tColDataInsertSort(pDescriptor, numOfRows, start, end, data, compareFn, buf); + } else { + columnwiseMergeSortImpl(pDescriptor, numOfRows, start, end, data, orderType, compareFn); + } + + free(buf); +} + + + /* * deep copy of sschema */ -SColumnModel *createColumnModel(SSchema *fields, int32_t numOfCols, int32_t blockCapacity) { +SColumnModel *createColumnModel(SSchema1 *fields, int32_t numOfCols, int32_t blockCapacity) { SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + numOfCols * sizeof(SSchemaEx)); if (pColumnModel == NULL) { return NULL; @@ -1039,7 +1150,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE } } -SSchema* getColumnModelSchema(SColumnModel *pColumnModel, int32_t index) { +SSchema1* getColumnModelSchema(SColumnModel *pColumnModel, int32_t index) { assert(pColumnModel != NULL && index >= 0 && index < pColumnModel->numOfCols); return &pColumnModel->pFields[index].field; } @@ -1061,7 +1172,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC /* start from the second column */ for (int32_t i = 0; i < pModel->numOfCols; ++i) { int16_t offset = getColumnModelOffset(pModel, i); - SSchema* pSchema = getColumnModelSchema(pModel, i); + SSchema1* pSchema = getColumnModelSchema(pModel, i); char *startPos = inputBuffer->data + offset * blockCapacity + s * pSchema->bytes; char *endPos = startPos + pSchema->bytes * removed; diff --git a/src/query/src/qFill.c b/src/query/src/qFill.c index 144ca4dd794975a161d85c68e8058e3ca105d9c8..b0015e39b96e0754377abece6e12045b0f36a901 100644 --- a/src/query/src/qFill.c +++ b/src/query/src/qFill.c @@ -118,10 +118,11 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData continue; } + bool exceedMax = false, exceedMin = false; point1 = (SPoint){.key = *(TSKEY*)(prev), .val = prev + pCol->col.offset}; point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->index * bytes}; point = (SPoint){.key = pFillInfo->currentKey, .val = val1}; - taosGetLinearInterpolationVal(&point, type, &point1, &point2, type); + taosGetLinearInterpolationVal(&point, type, &point1, &point2, type, &exceedMax, &exceedMin); } } else { setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index); @@ -493,12 +494,20 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma return (numOfRes > maxNumOfRows) ? maxNumOfRows : numOfRes; } -int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType) { - double v1 = -1, v2 = -1; +int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType, bool *exceedMax, bool *exceedMin) { + double v1 = -1, v2 = -1, vmax = -1, vmin = -1; GET_TYPED_DATA(v1, double, inputType, point1->val); GET_TYPED_DATA(v2, double, inputType, point2->val); - + GET_TYPED_DATA(vmax, double, outputType, getDataMax(outputType)); + GET_TYPED_DATA(vmin, double, outputType, getDataMin(outputType)); + double r = DO_INTERPOLATION(v1, v2, point1->key, point2->key, point->key); + if (r >= vmax) { + *exceedMax = true; + } else if (r <= vmin) { + *exceedMin = true; + } + SET_TYPED_DATA(point->val, outputType, r); return TSDB_CODE_SUCCESS; diff --git a/src/query/src/qFilter.c b/src/query/src/qFilter.c index 098bf1b0820d9ba04d56bb69fc0011ffd285da94..ee4b30cb577e9a4bb34cb18a419cf02d1d6d5349 100644 --- a/src/query/src/qFilter.c +++ b/src/query/src/qFilter.c @@ -262,7 +262,7 @@ int32_t filterInitUnitsFields(SFilterInfo *info) { info->fields[FLD_TYPE_COLUMN].num = 0; info->fields[FLD_TYPE_COLUMN].size = FILTER_DEFAULT_FIELD_SIZE; - info->fields[FLD_TYPE_COLUMN].fields = calloc(info->fields[FLD_TYPE_COLUMN].size, COL_FIELD_SIZE); + info->fields[FLD_TYPE_COLUMN].fields = calloc(info->fields[FLD_TYPE_COLUMN].size, sizeof(SFilterField)); info->fields[FLD_TYPE_VALUE].num = 0; info->fields[FLD_TYPE_VALUE].size = FILTER_DEFAULT_FIELD_SIZE; info->fields[FLD_TYPE_VALUE].fields = calloc(info->fields[FLD_TYPE_VALUE].size, sizeof(SFilterField)); @@ -764,7 +764,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) { } int32_t filterGetFiledByDesc(SFilterFields* fields, int32_t type, void *v) { - for (uint16_t i = 0; i < fields->num; ++i) { + for (uint32_t i = 0; i < fields->num; ++i) { if (0 == gDescCompare[type](fields->fields[i].desc, v)) { return i; } @@ -793,7 +793,7 @@ int32_t filterGetFiledByData(SFilterInfo *info, int32_t type, void *v, int32_t d int32_t filterAddField(SFilterInfo *info, void *desc, void **data, int32_t type, SFilterFieldId *fid, int32_t dataLen, bool freeIfExists) { int32_t idx = -1; - uint16_t *num; + uint32_t *num; num = &info->fields[type].num; @@ -876,7 +876,7 @@ int32_t filterAddFieldFromNode(SFilterInfo *info, tExprNode *node, SFilterFieldI return TSDB_CODE_SUCCESS; } -int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFilterFieldId *right, uint16_t *uidx) { +int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFilterFieldId *right, uint32_t *uidx) { if (FILTER_GET_FLAG(info->options, FI_OPTION_NEED_UNIQE)) { if (info->pctx.unitHash == NULL) { info->pctx.unitHash = taosHashInit(FILTER_DEFAULT_GROUP_SIZE * FILTER_DEFAULT_UNIT_SIZE, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, false); @@ -885,14 +885,14 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi FILTER_PACKAGE_UNIT_HASH_KEY(&v, optr, left->idx, right ? right->idx : -1); void *hu = taosHashGet(info->pctx.unitHash, &v, sizeof(v)); if (hu) { - *uidx = *(uint16_t *)hu; + *uidx = *(uint32_t *)hu; return TSDB_CODE_SUCCESS; } } } if (info->unitNum >= info->unitSize) { - uint16_t psize = info->unitSize; + uint32_t psize = info->unitSize; info->unitSize += FILTER_DEFAULT_UNIT_SIZE; info->units = realloc(info->units, info->unitSize * sizeof(SFilterUnit)); memset(info->units + psize, 0, sizeof(*info->units) * FILTER_DEFAULT_UNIT_SIZE); @@ -933,7 +933,7 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi -int32_t filterAddUnitToGroup(SFilterGroup *group, uint16_t unitIdx) { +int32_t filterAddUnitToGroup(SFilterGroup *group, uint32_t unitIdx) { if (group->unitNum >= group->unitSize) { group->unitSize += FILTER_DEFAULT_UNIT_SIZE; group->unitIdxs = realloc(group->unitIdxs, group->unitSize * sizeof(*group->unitIdxs)); @@ -1224,7 +1224,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g tVariant* var = tree->_node.pRight->pVal; uint8_t type = FILTER_GET_COL_FIELD_TYPE(FILTER_GET_FIELD(info, left)); int32_t len = 0; - uint16_t uidx = 0; + uint32_t uidx = 0; if (tree->_node.optr == TSDB_RELATION_IN && (!IS_VAR_DATA_TYPE(type))) { void *data = NULL; @@ -1251,7 +1251,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g fdata = malloc(sizeof(int64_t)); SIMPLE_COPY_VALUES(fdata, key); len = tDataTypes[type].bytes; - + filterAddField(info, NULL, &fdata, FLD_TYPE_VALUE, &right, len, true); filterAddUnit(info, TSDB_RELATION_EQUAL, &left, &right, &uidx); @@ -1280,7 +1280,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g } -int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u, uint16_t *uidx) { +int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u, uint32_t *uidx) { SFilterFieldId left, right, *pright = &right; int32_t type = FILTER_UNIT_DATA_TYPE(u); uint16_t flag = FLD_DESC_NO_FREE; @@ -1315,7 +1315,7 @@ int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u return filterAddUnit(dst, FILTER_UNIT_OPTR(u), &left, pright, uidx); } -int32_t filterAddUnitRight(SFilterInfo *info, uint8_t optr, SFilterFieldId *right, uint16_t uidx) { +int32_t filterAddUnitRight(SFilterInfo *info, uint8_t optr, SFilterFieldId *right, uint32_t uidx) { SFilterUnit *u = &info->units[uidx]; u->compare.optr2 = optr; @@ -1325,9 +1325,9 @@ int32_t filterAddUnitRight(SFilterInfo *info, uint8_t optr, SFilterFieldId *righ } -int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRangeCtx *ctx, uint16_t cidx, SFilterGroup *g, int32_t optr, SArray *res) { +int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRangeCtx *ctx, uint32_t cidx, SFilterGroup *g, int32_t optr, SArray *res) { SFilterFieldId left, right, right2; - uint16_t uidx = 0; + uint32_t uidx = 0; SFilterField *col = FILTER_GET_COL_FIELD(src, cidx); @@ -1554,14 +1554,14 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) if (options == 0) { qDebug("%s - FilterInfo:", msg); qDebug("COLUMN Field Num:%u", info->fields[FLD_TYPE_COLUMN].num); - for (uint16_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { + for (uint32_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { SFilterField *field = &info->fields[FLD_TYPE_COLUMN].fields[i]; SSchema *sch = field->desc; qDebug("COL%d => [%d][%s]", i, sch->colId, sch->name); } qDebug("VALUE Field Num:%u", info->fields[FLD_TYPE_VALUE].num); - for (uint16_t i = 0; i < info->fields[FLD_TYPE_VALUE].num; ++i) { + for (uint32_t i = 0; i < info->fields[FLD_TYPE_VALUE].num; ++i) { SFilterField *field = &info->fields[FLD_TYPE_VALUE].fields[i]; if (field->desc) { tVariant *var = field->desc; @@ -1576,7 +1576,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) } qDebug("UNIT Num:%u", info->unitNum); - for (uint16_t i = 0; i < info->unitNum; ++i) { + for (uint32_t i = 0; i < info->unitNum; ++i) { SFilterUnit *unit = &info->units[i]; int32_t type = FILTER_UNIT_DATA_TYPE(unit); int32_t len = 0; @@ -1622,11 +1622,11 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) } qDebug("GROUP Num:%u", info->groupNum); - for (uint16_t i = 0; i < info->groupNum; ++i) { + for (uint32_t i = 0; i < info->groupNum; ++i) { SFilterGroup *group = &info->groups[i]; qDebug("Group%d : unit num[%u]", i, group->unitNum); - for (uint16_t u = 0; u < group->unitNum; ++u) { + for (uint32_t u = 0; u < group->unitNum; ++u) { qDebug("unit id:%u", group->unitIdxs[u]); } } @@ -1638,7 +1638,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) qDebug("%s - RANGE info:", msg); qDebug("RANGE Num:%u", info->colRangeNum); - for (uint16_t i = 0; i < info->colRangeNum; ++i) { + for (uint32_t i = 0; i < info->colRangeNum; ++i) { SFilterRangeCtx *ctx = info->colRange[i]; qDebug("Column ID[%d] RANGE: isnull[%d],notnull[%d],range[%d]", ctx->colId, ctx->isnull, ctx->notnull, ctx->isrange); if (ctx->isrange) { @@ -1684,11 +1684,11 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) } qDebug("GroupNum:%d", info->blkGroupNum); - uint16_t *unitIdx = info->blkUnits; - for (uint16_t i = 0; i < info->blkGroupNum; ++i) { + uint32_t *unitIdx = info->blkUnits; + for (uint32_t i = 0; i < info->blkGroupNum; ++i) { qDebug("Group[%d] UnitNum: %d:", i, *unitIdx); - uint16_t unitNum = *(unitIdx++); - for (uint16_t m = 0; m < unitNum; ++m) { + uint32_t unitNum = *(unitIdx++); + for (uint32_t m = 0; m < unitNum; ++m) { qDebug("uidx[%d]", *(unitIdx++)); } } @@ -1782,14 +1782,14 @@ void filterFreeInfo(SFilterInfo *info) { tfree(info->blkUnits); for (int32_t i = 0; i < FLD_TYPE_MAX; ++i) { - for (uint16_t f = 0; f < info->fields[i].num; ++f) { + for (uint32_t f = 0; f < info->fields[i].num; ++f) { filterFreeField(&info->fields[i].fields[f], i); } tfree(info->fields[i].fields); } - for (int32_t i = 0; i < info->groupNum; ++i) { + for (uint32_t i = 0; i < info->groupNum; ++i) { filterFreeGroup(&info->groups[i]); } @@ -1801,7 +1801,7 @@ void filterFreeInfo(SFilterInfo *info) { tfree(info->unitFlags); - for (uint16_t i = 0; i < info->colRangeNum; ++i) { + for (uint32_t i = 0; i < info->colRangeNum; ++i) { filterFreeRangeCtx(info->colRange[i]); } @@ -1839,7 +1839,7 @@ int32_t filterHandleValueExtInfo(SFilterUnit* unit, char extInfo) { int32_t filterInitValFieldData(SFilterInfo *info) { - for (uint16_t i = 0; i < info->unitNum; ++i) { + for (uint32_t i = 0; i < info->unitNum; ++i) { SFilterUnit* unit = &info->units[i]; if (unit->right.type != FLD_TYPE_VALUE) { assert(unit->compare.optr == TSDB_RELATION_ISNULL || unit->compare.optr == TSDB_RELATION_NOTNULL || unit->compare.optr == FILTER_DUMMY_EMPTY_OPTR); @@ -2042,7 +2042,7 @@ _return: } -int32_t filterMergeUnits(SFilterInfo *info, SFilterGroupCtx* gRes, uint16_t colIdx, bool *empty) { +int32_t filterMergeUnits(SFilterInfo *info, SFilterGroupCtx* gRes, uint32_t colIdx, bool *empty) { SArray* colArray = (SArray *)gRes->colInfo[colIdx].info; int32_t size = (int32_t)taosArrayGetSize(colArray); int32_t type = gRes->colInfo[colIdx].dataType; @@ -2083,11 +2083,11 @@ _return: int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t* gResNum) { bool empty = false; - uint16_t *colIdx = malloc(info->fields[FLD_TYPE_COLUMN].num * sizeof(uint16_t)); - uint16_t colIdxi = 0; - uint16_t gResIdx = 0; + uint32_t *colIdx = malloc(info->fields[FLD_TYPE_COLUMN].num * sizeof(uint32_t)); + uint32_t colIdxi = 0; + uint32_t gResIdx = 0; - for (uint16_t i = 0; i < info->groupNum; ++i) { + for (uint32_t i = 0; i < info->groupNum; ++i) { SFilterGroup* g = info->groups + i; gRes[gResIdx] = calloc(1, sizeof(SFilterGroupCtx)); @@ -2095,9 +2095,9 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t colIdxi = 0; empty = false; - for (uint16_t j = 0; j < g->unitNum; ++j) { + for (uint32_t j = 0; j < g->unitNum; ++j) { SFilterUnit* u = FILTER_GROUP_UNIT(info, g, j); - uint16_t cidx = FILTER_UNIT_COL_IDX(u); + uint32_t cidx = FILTER_UNIT_COL_IDX(u); if (gRes[gResIdx]->colInfo[cidx].info == NULL) { gRes[gResIdx]->colInfo[cidx].info = (SArray *)taosArrayInit(4, POINTER_BYTES); @@ -2113,10 +2113,10 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t } if (colIdxi > 1) { - qsort(colIdx, colIdxi, sizeof(uint16_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0)); + qsort(colIdx, colIdxi, sizeof(uint32_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0)); } - for (uint16_t l = 0; l < colIdxi; ++l) { + for (uint32_t l = 0; l < colIdxi; ++l) { int32_t type = gRes[gResIdx]->colInfo[colIdx[l]].dataType; if (FILTER_NO_MERGE_DATA_TYPE(type)) { @@ -2155,7 +2155,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t } void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool *conflict) { - uint16_t idx1 = 0, idx2 = 0, m = 0, n = 0; + uint32_t idx1 = 0, idx2 = 0, m = 0, n = 0; bool equal = false; for (; m < gRes1->colNum; ++m) { @@ -2204,7 +2204,7 @@ void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool } -int32_t filterMergeTwoGroupsImpl(SFilterInfo *info, SFilterRangeCtx **ctx, int32_t optr, uint16_t cidx, SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool *empty, bool *all) { +int32_t filterMergeTwoGroupsImpl(SFilterInfo *info, SFilterRangeCtx **ctx, int32_t optr, uint32_t cidx, SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool *empty, bool *all) { SFilterField *fi = FILTER_GET_COL_FIELD(info, cidx); int32_t type = FILTER_GET_COL_FIELD_TYPE(fi); @@ -2234,10 +2234,10 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilter FILTER_SET_FLAG(info->status, FI_STATUS_REWRITE); - uint16_t idx1 = 0, idx2 = 0, m = 0, n = 0; + uint32_t idx1 = 0, idx2 = 0, m = 0, n = 0; bool numEqual = (*gRes1)->colNum == (*gRes2)->colNum; bool equal = false; - uint16_t equal1 = 0, equal2 = 0, merNum = 0; + uint32_t equal1 = 0, equal2 = 0, merNum = 0; SFilterRangeCtx *ctx = NULL; SFilterColCtx colCtx = {0}; SArray* colCtxs = taosArrayInit((*gRes2)->colNum, sizeof(SFilterColCtx)); @@ -2351,7 +2351,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR qsort(gRes, *gResNum, POINTER_BYTES, filterCompareGroupCtx); int32_t pEnd = 0, cStart = 0, cEnd = 0; - uint16_t pColNum = 0, cColNum = 0; + uint32_t pColNum = 0, cColNum = 0; int32_t movedNum = 0; bool all = false; @@ -2417,7 +2417,6 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR } cStart = i; - cEnd = i; cColNum = gRes[i]->colNum; } @@ -2433,7 +2432,7 @@ _return: int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray* group) { size_t groupSize = taosArrayGetSize(group); - info->groupNum = (uint16_t)groupSize; + info->groupNum = (uint32_t)groupSize; if (info->groupNum > 0) { info->groups = calloc(info->groupNum, sizeof(*info->groups)); @@ -2462,7 +2461,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum SFilterGroupCtx *res = NULL; SFilterColInfo *colInfo = NULL; int32_t optr = 0; - uint16_t uidx = 0; + uint32_t uidx = 0; memset(info, 0, sizeof(*info)); @@ -2482,7 +2481,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum SFilterGroup ng = {0}; - for (uint16_t m = 0; m < res->colNum; ++m) { + for (uint32_t m = 0; m < res->colNum; ++m) { colInfo = &res->colInfo[res->colIdx[m]]; if (FILTER_NO_MERGE_DATA_TYPE(colInfo->dataType)) { assert(colInfo->type == RANGE_TYPE_UNIT); @@ -2518,13 +2517,13 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum } int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum) { - uint16_t *idxs = NULL; - uint16_t colNum = 0; + uint32_t *idxs = NULL; + uint32_t colNum = 0; SFilterGroupCtx *res = NULL; - uint16_t *idxNum = calloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxNum)); + uint32_t *idxNum = calloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxNum)); for (int32_t i = 0; i < gResNum; ++i) { - for (uint16_t m = 0; m < gRes[i]->colNum; ++m) { + for (uint32_t m = 0; m < gRes[i]->colNum; ++m) { SFilterColInfo *colInfo = &gRes[i]->colInfo[gRes[i]->colIdx[m]]; if (FILTER_NO_MERGE_DATA_TYPE(colInfo->dataType)) { continue; @@ -2534,7 +2533,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx** gRes, int32_ } } - for (uint16_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { + for (uint32_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { if (idxNum[i] < gResNum) { continue; } @@ -2555,9 +2554,9 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx** gRes, int32_ for (int32_t i = 0; i < gResNum; ++i) { res = gRes[i]; - uint16_t n = 0; + uint32_t n = 0; - for (uint16_t m = 0; m < info->colRangeNum; ++m) { + for (uint32_t m = 0; m < info->colRangeNum; ++m) { for (; n < res->colNum; ++n) { if (res->colIdx[n] < idxs[m]) { continue; @@ -2605,7 +2604,7 @@ _return: } int32_t filterPostProcessRange(SFilterInfo *info) { - for (uint16_t i = 0; i < info->colRangeNum; ++i) { + for (uint32_t i = 0; i < info->colRangeNum; ++i) { SFilterRangeCtx* ctx = info->colRange[i]; SFilterRangeNode *r = ctx->rs; while (r) { @@ -2623,7 +2622,7 @@ int32_t filterGenerateComInfo(SFilterInfo *info) { info->blkUnitRes = malloc(sizeof(*info->blkUnitRes) * info->unitNum); info->blkUnits = malloc(sizeof(*info->blkUnits) * (info->unitNum + 1) * info->groupNum); - for (uint16_t i = 0; i < info->unitNum; ++i) { + for (uint32_t i = 0; i < info->unitNum; ++i) { SFilterUnit *unit = &info->units[i]; info->cunits[i].func = filterGetCompFuncIdx(FILTER_UNIT_DATA_TYPE(unit), unit->compare.optr); @@ -2651,7 +2650,7 @@ int32_t filterGenerateComInfo(SFilterInfo *info) { } int32_t filterUpdateComUnits(SFilterInfo *info) { - for (uint16_t i = 0; i < info->unitNum; ++i) { + for (uint32_t i = 0; i < info->unitNum; ++i) { SFilterUnit *unit = &info->units[i]; info->cunits[i].colData = FILTER_UNIT_COL_DATA(info, unit, 0); @@ -2666,7 +2665,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SDataStatis *pDataStatis, int32_t memset(info->blkUnitRes, 0, sizeof(*info->blkUnitRes) * info->unitNum); - for (int32_t k = 0; k < info->unitNum; ++k) { + for (uint32_t k = 0; k < info->unitNum; ++k) { int32_t index = -1; SFilterComUnit *cunit = &info->cunits[k]; @@ -2783,8 +2782,8 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SDataStatis *pDataStatis, int32_t info->blkGroupNum = info->groupNum; - uint16_t *unitNum = info->blkUnits; - uint16_t *unitIdx = unitNum + 1; + uint32_t *unitNum = info->blkUnits; + uint32_t *unitIdx = unitNum + 1; int32_t all = 0, empty = 0; for (uint32_t g = 0; g < info->groupNum; ++g) { @@ -2794,7 +2793,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SDataStatis *pDataStatis, int32_t empty = 0; for (uint32_t u = 0; u < group->unitNum; ++u) { - uint16_t uidx = group->unitIdxs[u]; + uint32_t uidx = group->unitIdxs[u]; if (info->blkUnitRes[uidx] == 1) { --(*unitNum); all = 1; @@ -2841,7 +2840,7 @@ _return: bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, SDataStatis *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; - uint16_t *unitIdx = NULL; + uint32_t *unitIdx = NULL; if (*p == NULL) { *p = calloc(numOfRows, sizeof(int8_t)); @@ -2853,7 +2852,7 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, unitIdx = info->blkUnits; for (uint32_t g = 0; g < info->blkGroupNum; ++g) { - uint16_t unitNum = *(unitIdx++); + uint32_t unitNum = *(unitIdx++); for (uint32_t u = 0; u < unitNum; ++u) { SFilterComUnit *cunit = &info->cunits[*(unitIdx + u)]; void *colData = (char *)cunit->colData + cunit->dataSize * i; @@ -2953,7 +2952,7 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, } for (int32_t i = 0; i < numOfRows; ++i) { - uint16_t uidx = info->groups[0].unitIdxs[0]; + uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i; (*p)[i] = ((colData == NULL) || isNull(colData, info->cunits[uidx].dataType)); if ((*p)[i] == 0) { @@ -2976,7 +2975,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows } for (int32_t i = 0; i < numOfRows; ++i) { - uint16_t uidx = info->groups[0].unitIdxs[0]; + uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i; (*p)[i] = ((colData != NULL) && !isNull(colData, info->cunits[uidx].dataType)); if ((*p)[i] == 0) { @@ -3037,7 +3036,7 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SDataStat } for (int32_t i = 0; i < numOfRows; ++i) { - uint16_t uidx = info->groups[0].unitIdxs[0]; + uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i; if (colData == NULL || isNull(colData, info->cunits[uidx].dataType)) { (*p)[i] = 0; @@ -3083,7 +3082,7 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SDataStatis * for (uint32_t g = 0; g < info->groupNum; ++g) { SFilterGroup *group = &info->groups[g]; for (uint32_t u = 0; u < group->unitNum; ++u) { - uint16_t uidx = group->unitIdxs[u]; + uint32_t uidx = group->unitIdxs[u]; SFilterComUnit *cunit = &info->cunits[uidx]; void *colData = (char *)cunit->colData + cunit->dataSize * i; @@ -3227,7 +3226,7 @@ int32_t filterSetColFieldData(SFilterInfo *info, void *param, filer_get_col_from return TSDB_CODE_SUCCESS; } - for (uint16_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { + for (uint32_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { SFilterField* fi = &info->fields[FLD_TYPE_COLUMN].fields[i]; SSchema* sch = fi->desc; @@ -3333,7 +3332,7 @@ bool filterRangeExecute(SFilterInfo *info, SDataStatis *pDataStatis, int32_t num bool ret = true; void *minVal, *maxVal; - for (int32_t k = 0; k < info->colRangeNum; ++k) { + for (uint32_t k = 0; k < info->colRangeNum; ++k) { int32_t index = -1; SFilterRangeCtx *ctx = info->colRange[k]; for(int32_t i = 0; i < numOfCols; ++i) { @@ -3416,7 +3415,7 @@ int32_t filterGetTimeRange(SFilterInfo *info, STimeWindow *win) { int32_t code = 0; bool empty = false, all = false; - for (int32_t i = 0; i < info->groupNum; ++i) { + for (uint32_t i = 0; i < info->groupNum; ++i) { SFilterGroup *group = &info->groups[i]; if (group->unitNum > 1) { cur = tmpc; @@ -3426,8 +3425,8 @@ int32_t filterGetTimeRange(SFilterInfo *info, STimeWindow *win) { optr = TSDB_RELATION_OR; } - for (int32_t u = 0; u < group->unitNum; ++u) { - uint16_t uidx = group->unitIdxs[u]; + for (uint32_t u = 0; u < group->unitNum; ++u) { + uint32_t uidx = group->unitIdxs[u]; SFilterUnit *unit = &info->units[uidx]; uint8_t raOptr = FILTER_UNIT_OPTR(unit); @@ -3500,7 +3499,7 @@ _return: int32_t filterConverNcharColumns(SFilterInfo* info, int32_t rows, bool *gotNchar) { - for (uint16_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { + for (uint32_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { SFilterField* fi = &info->fields[FLD_TYPE_COLUMN].fields[i]; int32_t type = FILTER_GET_COL_FIELD_TYPE(fi); if (type == TSDB_DATA_TYPE_NCHAR) { @@ -3531,7 +3530,7 @@ int32_t filterConverNcharColumns(SFilterInfo* info, int32_t rows, bool *gotNchar } int32_t filterFreeNcharColumns(SFilterInfo* info) { - for (uint16_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { + for (uint32_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { SFilterField* fi = &info->fields[FLD_TYPE_COLUMN].fields[i]; int32_t type = FILTER_GET_COL_FIELD_TYPE(fi); if (type == TSDB_DATA_TYPE_NCHAR) { diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index abfa20714b333754478e5c48b9265f839b05a4b1..27a22f70832dc9669aa473b03820d84d4736b497 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -538,9 +538,9 @@ SArray* createTableScanPlan(SQueryAttr* pQueryAttr) { } else { if (pQueryAttr->queryBlockDist) { op = OP_TableBlockInfoScan; - } else if (pQueryAttr->tsCompQuery || pQueryAttr->pointInterpQuery || pQueryAttr->diffQuery) { + } else if (pQueryAttr->tsCompQuery || pQueryAttr->diffQuery) { op = OP_TableSeqScan; - } else if (pQueryAttr->needReverseScan) { + } else if (pQueryAttr->needReverseScan || pQueryAttr->pointInterpQuery) { op = OP_DataBlocksOptScan; } else { op = OP_TableScan; @@ -564,20 +564,15 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { op = OP_Distinct; taosArrayPush(plan, &op); } + } else if (pQueryAttr->pointInterpQuery) { + op = OP_TimeEvery; + taosArrayPush(plan, &op); } else if (pQueryAttr->interval.interval > 0) { if (pQueryAttr->stableQuery) { - if (pQueryAttr->pointInterpQuery) { - op = OP_AllMultiTableTimeInterval; - } else { - op = OP_MultiTableTimeInterval; - } + op = OP_MultiTableTimeInterval; taosArrayPush(plan, &op); } else { - if (pQueryAttr->pointInterpQuery) { - op = OP_AllTimeWindow; - } else { - op = OP_TimeWindow; - } + op = OP_TimeWindow; taosArrayPush(plan, &op); if (pQueryAttr->pExpr2 != NULL) { @@ -704,7 +699,7 @@ SArray* createGlobalMergePlan(SQueryAttr* pQueryAttr) { } // fill operator - if (pQueryAttr->fillType != TSDB_FILL_NONE && pQueryAttr->interval.interval > 0) { + if (pQueryAttr->fillType != TSDB_FILL_NONE && pQueryAttr->interval.interval > 0 && !pQueryAttr->pointInterpQuery) { op = OP_Fill; taosArrayPush(plan, &op); } diff --git a/src/query/src/qScript.c b/src/query/src/qScript.c index c43b0b3435b2073d4711bbb8a0ec0d9e347b0d13..a8a6f6732b7eef33cad040c2aadc4b3e1848bde2 100644 --- a/src/query/src/qScript.c +++ b/src/query/src/qScript.c @@ -12,7 +12,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ - +#ifdef LUA_EMBEDDED #include "os.h" #include "qScript.h" #include "ttype.h" @@ -444,3 +444,4 @@ bool isValidScript(char *script, int32_t len) { return ret; } +#endif diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index 03a2a6666ed5164ca0d71e04c7ba3e77afed6714..fbfa87a254c674134e5d6f249281f2349b4d338d 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -143,14 +143,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr if (optrType == TK_NULL) { if (pToken){ pToken->type = TSDB_DATA_TYPE_NULL; - tVariantCreate(&pSqlExpr->value, pToken); + tVariantCreate(&pSqlExpr->value, pToken, true); } pSqlExpr->tokenId = optrType; pSqlExpr->type = SQL_NODE_VALUE; } else if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) { if (pToken) { toTSDBType(pToken->type); - tVariantCreate(&pSqlExpr->value, pToken); + tVariantCreate(&pSqlExpr->value, pToken, true); } pSqlExpr->tokenId = optrType; pSqlExpr->type = SQL_NODE_VALUE; @@ -192,6 +192,65 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr return pSqlExpr; } + +tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType) { + tSqlExpr *pSqlExpr = calloc(1, sizeof(tSqlExpr)); + + if (pToken != NULL) { + pSqlExpr->exprToken = *pToken; + } + + if (optrType == TK_INTEGER || optrType == TK_STRING) { + if (pToken) { + toTSDBType(pToken->type); + tVariantCreate(&pSqlExpr->value, pToken, true); + } + pSqlExpr->tokenId = optrType; + pSqlExpr->type = SQL_NODE_VALUE; + } else if (optrType == TK_NOW) { + // use nanosecond by default TODO set value after getting database precision + pSqlExpr->value.i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT; + pSqlExpr->tokenId = TK_TIMESTAMP; // TK_TIMESTAMP used to denote the time value is in microsecond + pSqlExpr->type = SQL_NODE_VALUE; + pSqlExpr->flags |= 1 << EXPR_FLAG_NS_TIMESTAMP; + } else if (optrType == TK_PLUS || optrType == TK_MINUS) { + // use nanosecond by default + // TODO set value after getting database precision + if (pToken) { + char unit = 0; + int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->value.i64, &unit, TSDB_TIME_PRECISION_NANO); + if (ret != TSDB_CODE_SUCCESS) { + terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR; + } + } + + if (optrType == TK_PLUS) { + pSqlExpr->value.i64 += taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + } else { + pSqlExpr->value.i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO) - pSqlExpr->value.i64; + } + + pSqlExpr->flags |= 1 << EXPR_FLAG_NS_TIMESTAMP; + pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT; + pSqlExpr->tokenId = TK_TIMESTAMP; + pSqlExpr->type = SQL_NODE_VALUE; + } else { + // Here it must be the column name (tk_id) if it is not a number or string. + assert(optrType == TK_ID || optrType == TK_ALL); + if (pToken != NULL) { + pSqlExpr->columnName = *pToken; + } + + pSqlExpr->tokenId = optrType; + pSqlExpr->type = SQL_NODE_TABLE_COLUMN; + } + + return pSqlExpr; +} + + + /* * pList is the parameters for function with id(optType) * function name is denoted by pFunctionToken @@ -506,14 +565,14 @@ void tSqlExprDestroy(tSqlExpr *pExpr) { doDestroySqlExprNode(pExpr); } -SArray *tVariantListAppendToken(SArray *pList, SStrToken *pToken, uint8_t order) { +SArray *tVariantListAppendToken(SArray *pList, SStrToken *pToken, uint8_t order, bool needRmquoteEscape) { if (pList == NULL) { pList = taosArrayInit(4, sizeof(tVariantListItem)); } if (pToken) { tVariantListItem item; - tVariantCreate(&item.pVar, pToken); + tVariantCreate(&item.pVar, pToken, needRmquoteEscape); item.sortOrder = order; taosArrayPush(pList, &item); @@ -645,7 +704,7 @@ void tSetColumnInfo(TAOS_FIELD *pField, SStrToken *pName, TAOS_FIELD *pType) { // column name is too long, set the it to be invalid. if ((int32_t) pName->n >= maxLen) { - pName->n = -1; + pField->name[0] = 0; } else { strncpy(pField->name, pName->z, pName->n); pField->name[pName->n] = 0; @@ -775,7 +834,7 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) { SSqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelNodeList, SRelationInfo *pFrom, tSqlExpr *pWhere, SArray *pGroupby, SArray *pSortOrder, SIntervalVal *pInterval, SSessionWindowVal *pSession, SWindowStateVal *pWindowStateVal, SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, - SLimitVal *psLimit, tSqlExpr *pHaving) { + SLimitVal *psLimit, tSqlExpr *pHaving, SRangeVal *pRange) { assert(pSelNodeList != NULL); SSqlNode *pSqlNode = calloc(1, sizeof(SSqlNode)); @@ -791,7 +850,10 @@ SSqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelNodeList, SRelat pSqlNode->pWhere = pWhere; pSqlNode->fillType = pFill; pSqlNode->pHaving = pHaving; - + if (pRange) { + pSqlNode->pRange = *pRange; + } + if (pLimit != NULL) { pSqlNode->limit = *pLimit; } else { diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 39e38cac439e4e78847f9c6afbe6ac7bba374fd2..c669712fc5ea3a776b94ef28eff4b22b7c41253b 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -25,8 +25,6 @@ ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ -#line 24 "sql.y" - #include #include #include @@ -38,7 +36,6 @@ #include "ttokendef.h" #include "tutil.h" #include "tvariant.h" -#line 42 "sql.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ @@ -172,77 +169,78 @@ #define TK_DISTINCT 127 #define TK_FROM 128 #define TK_VARIABLE 129 -#define TK_INTERVAL 130 -#define TK_EVERY 131 -#define TK_SESSION 132 -#define TK_STATE_WINDOW 133 -#define TK_FILL 134 -#define TK_SLIDING 135 -#define TK_ORDER 136 -#define TK_BY 137 -#define TK_ASC 138 -#define TK_GROUP 139 -#define TK_HAVING 140 -#define TK_LIMIT 141 -#define TK_OFFSET 142 -#define TK_SLIMIT 143 -#define TK_SOFFSET 144 -#define TK_WHERE 145 -#define TK_RESET 146 -#define TK_QUERY 147 -#define TK_SYNCDB 148 -#define TK_ADD 149 -#define TK_COLUMN 150 -#define TK_MODIFY 151 -#define TK_TAG 152 -#define TK_CHANGE 153 -#define TK_SET 154 -#define TK_KILL 155 -#define TK_CONNECTION 156 -#define TK_STREAM 157 -#define TK_COLON 158 -#define TK_ABORT 159 -#define TK_AFTER 160 -#define TK_ATTACH 161 -#define TK_BEFORE 162 -#define TK_BEGIN 163 -#define TK_CASCADE 164 -#define TK_CLUSTER 165 -#define TK_CONFLICT 166 -#define TK_COPY 167 -#define TK_DEFERRED 168 -#define TK_DELIMITERS 169 -#define TK_DETACH 170 -#define TK_EACH 171 -#define TK_END 172 -#define TK_EXPLAIN 173 -#define TK_FAIL 174 -#define TK_FOR 175 -#define TK_IGNORE 176 -#define TK_IMMEDIATE 177 -#define TK_INITIALLY 178 -#define TK_INSTEAD 179 -#define TK_KEY 180 -#define TK_OF 181 -#define TK_RAISE 182 -#define TK_REPLACE 183 -#define TK_RESTRICT 184 -#define TK_ROW 185 -#define TK_STATEMENT 186 -#define TK_TRIGGER 187 -#define TK_VIEW 188 -#define TK_IPTOKEN 189 -#define TK_SEMI 190 -#define TK_NONE 191 -#define TK_PREV 192 -#define TK_LINEAR 193 -#define TK_IMPORT 194 -#define TK_TBNAME 195 -#define TK_JOIN 196 -#define TK_INSERT 197 -#define TK_INTO 198 -#define TK_VALUES 199 -#define TK_FILE 200 +#define TK_RANGE 130 +#define TK_INTERVAL 131 +#define TK_EVERY 132 +#define TK_SESSION 133 +#define TK_STATE_WINDOW 134 +#define TK_FILL 135 +#define TK_SLIDING 136 +#define TK_ORDER 137 +#define TK_BY 138 +#define TK_ASC 139 +#define TK_GROUP 140 +#define TK_HAVING 141 +#define TK_LIMIT 142 +#define TK_OFFSET 143 +#define TK_SLIMIT 144 +#define TK_SOFFSET 145 +#define TK_WHERE 146 +#define TK_RESET 147 +#define TK_QUERY 148 +#define TK_SYNCDB 149 +#define TK_ADD 150 +#define TK_COLUMN 151 +#define TK_MODIFY 152 +#define TK_TAG 153 +#define TK_CHANGE 154 +#define TK_SET 155 +#define TK_KILL 156 +#define TK_CONNECTION 157 +#define TK_STREAM 158 +#define TK_COLON 159 +#define TK_ABORT 160 +#define TK_AFTER 161 +#define TK_ATTACH 162 +#define TK_BEFORE 163 +#define TK_BEGIN 164 +#define TK_CASCADE 165 +#define TK_CLUSTER 166 +#define TK_CONFLICT 167 +#define TK_COPY 168 +#define TK_DEFERRED 169 +#define TK_DELIMITERS 170 +#define TK_DETACH 171 +#define TK_EACH 172 +#define TK_END 173 +#define TK_EXPLAIN 174 +#define TK_FAIL 175 +#define TK_FOR 176 +#define TK_IGNORE 177 +#define TK_IMMEDIATE 178 +#define TK_INITIALLY 179 +#define TK_INSTEAD 180 +#define TK_KEY 181 +#define TK_OF 182 +#define TK_RAISE 183 +#define TK_REPLACE 184 +#define TK_RESTRICT 185 +#define TK_ROW 186 +#define TK_STATEMENT 187 +#define TK_TRIGGER 188 +#define TK_VIEW 189 +#define TK_IPTOKEN 190 +#define TK_SEMI 191 +#define TK_NONE 192 +#define TK_PREV 193 +#define TK_LINEAR 194 +#define TK_IMPORT 195 +#define TK_TBNAME 196 +#define TK_JOIN 197 +#define TK_INSERT 198 +#define TK_INTO 199 +#define TK_VALUES 200 +#define TK_FILE 201 #endif /**************** End token definitions ***************************************/ @@ -302,29 +300,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 282 +#define YYNOCODE 285 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - tVariant yy2; - SCreateDbInfo yy10; - int32_t yy40; - SSqlNode* yy68; - SCreatedTableInfo yy72; - SLimitVal yy114; - SCreateTableSql* yy170; - SIntervalVal yy280; - int yy281; - SSessionWindowVal yy295; - SArray* yy345; - tSqlExpr* yy418; - SCreateAcctInfo yy427; - SWindowStateVal yy432; + SCreateAcctInfo yy31; + SSqlNode* yy86; + TAOS_FIELD yy103; + tVariant yy176; + tSqlExpr* yy226; + SWindowStateVal yy228; + SArray* yy231; + SCreatedTableInfo yy306; + int32_t yy310; + SSessionWindowVal yy409; + SCreateTableSql* yy422; + SIntervalVal yy430; + SLimitVal yy444; + SRangeVal yy480; SRelationInfo* yy484; - TAOS_FIELD yy487; - int64_t yy525; + int yy502; + SCreateDbInfo yy532; + int64_t yy549; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -340,18 +339,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 376 -#define YYNRULE 303 -#define YYNRULE_WITH_ACTION 303 -#define YYNTOKEN 201 -#define YY_MAX_SHIFT 375 -#define YY_MIN_SHIFTREDUCE 590 -#define YY_MAX_SHIFTREDUCE 892 -#define YY_ERROR_ACTION 893 -#define YY_ACCEPT_ACTION 894 -#define YY_NO_ACTION 895 -#define YY_MIN_REDUCE 896 -#define YY_MAX_REDUCE 1198 +#define YYNSTATE 386 +#define YYNRULE 311 +#define YYNRULE_WITH_ACTION 311 +#define YYNTOKEN 202 +#define YY_MAX_SHIFT 385 +#define YY_MIN_SHIFTREDUCE 607 +#define YY_MAX_SHIFTREDUCE 917 +#define YY_ERROR_ACTION 918 +#define YY_ACCEPT_ACTION 919 +#define YY_NO_ACTION 920 +#define YY_MIN_REDUCE 921 +#define YY_MAX_REDUCE 1231 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -418,303 +417,307 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (811) +#define YY_ACTTAB_COUNT (828) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 58, 642, 1117, 245, 1118, 298, 1051, 302, 94, 643, - /* 10 */ 93, 894, 375, 678, 37, 38, 243, 41, 42, 58, - /* 20 */ 1052, 257, 31, 30, 29, 642, 40, 330, 45, 43, - /* 30 */ 46, 44, 255, 643, 1074, 1194, 36, 35, 374, 237, - /* 40 */ 34, 33, 32, 37, 38, 239, 41, 42, 58, 1049, - /* 50 */ 257, 31, 30, 29, 642, 40, 330, 45, 43, 46, - /* 60 */ 44, 1065, 643, 250, 248, 36, 35, 1052, 1049, 34, - /* 70 */ 33, 32, 37, 38, 159, 41, 42, 279, 1046, 257, - /* 80 */ 31, 30, 29, 1038, 40, 330, 45, 43, 46, 44, - /* 90 */ 326, 82, 212, 249, 36, 35, 642, 1049, 34, 33, - /* 100 */ 32, 1172, 1071, 1175, 643, 88, 37, 39, 252, 41, - /* 110 */ 42, 51, 1052, 257, 31, 30, 29, 825, 40, 330, - /* 120 */ 45, 43, 46, 44, 1022, 251, 1020, 1021, 36, 35, - /* 130 */ 212, 1023, 34, 33, 32, 1024, 58, 1025, 1026, 1172, - /* 140 */ 763, 1174, 67, 286, 285, 591, 592, 593, 594, 595, - /* 150 */ 596, 597, 598, 599, 600, 601, 602, 603, 604, 157, - /* 160 */ 81, 238, 38, 58, 41, 42, 10, 127, 257, 31, - /* 170 */ 30, 29, 326, 40, 330, 45, 43, 46, 44, 362, - /* 180 */ 831, 341, 834, 36, 35, 1049, 362, 34, 33, 32, - /* 190 */ 1065, 41, 42, 1065, 1037, 257, 31, 30, 29, 99, - /* 200 */ 40, 330, 45, 43, 46, 44, 240, 1186, 342, 241, - /* 210 */ 36, 35, 1049, 1128, 34, 33, 32, 66, 324, 369, - /* 220 */ 368, 323, 322, 321, 367, 320, 319, 318, 366, 317, - /* 230 */ 365, 364, 1035, 1036, 55, 1039, 726, 1014, 1002, 1003, - /* 240 */ 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, - /* 250 */ 1015, 1016, 25, 785, 786, 5, 61, 183, 34, 33, - /* 260 */ 32, 24, 182, 108, 113, 104, 112, 352, 351, 215, - /* 270 */ 1172, 230, 840, 945, 174, 829, 223, 832, 1127, 835, - /* 280 */ 193, 313, 141, 140, 139, 222, 246, 230, 840, 337, - /* 290 */ 88, 829, 288, 832, 1124, 835, 254, 329, 328, 1123, - /* 300 */ 45, 43, 46, 44, 838, 58, 235, 236, 36, 35, - /* 310 */ 331, 102, 34, 33, 32, 256, 373, 372, 150, 830, - /* 320 */ 260, 833, 235, 236, 209, 750, 265, 67, 747, 271, - /* 330 */ 748, 210, 749, 1172, 125, 119, 130, 6, 275, 274, - /* 340 */ 1172, 129, 266, 135, 138, 128, 216, 1040, 247, 278, - /* 350 */ 343, 80, 132, 179, 1049, 1172, 212, 47, 231, 262, - /* 360 */ 263, 203, 201, 199, 258, 1172, 217, 1175, 198, 145, - /* 370 */ 144, 143, 142, 47, 58, 1172, 66, 280, 369, 368, - /* 380 */ 36, 35, 58, 367, 34, 33, 32, 366, 218, 365, - /* 390 */ 364, 59, 841, 836, 766, 58, 261, 1172, 259, 837, - /* 400 */ 340, 339, 267, 58, 264, 58, 347, 346, 841, 836, - /* 410 */ 1, 181, 58, 13, 276, 837, 1165, 98, 334, 344, - /* 420 */ 156, 154, 153, 1049, 212, 1172, 158, 348, 1164, 1163, - /* 430 */ 233, 1049, 234, 1172, 1115, 1175, 1116, 1172, 1172, 1172, - /* 440 */ 349, 1172, 213, 839, 1049, 751, 752, 101, 350, 805, - /* 450 */ 354, 1172, 1049, 214, 1049, 219, 211, 370, 983, 220, - /* 460 */ 221, 1048, 1172, 225, 1172, 1172, 226, 227, 1172, 1172, - /* 470 */ 955, 224, 1172, 97, 208, 1172, 1172, 193, 266, 266, - /* 480 */ 1172, 770, 96, 1172, 95, 85, 946, 83, 86, 180, - /* 490 */ 1050, 3, 194, 193, 782, 792, 793, 328, 73, 736, - /* 500 */ 54, 76, 305, 333, 738, 307, 804, 641, 161, 70, - /* 510 */ 48, 353, 737, 59, 301, 79, 59, 867, 70, 100, - /* 520 */ 842, 9, 282, 1073, 844, 282, 70, 15, 118, 14, - /* 530 */ 117, 9, 26, 308, 9, 17, 755, 16, 756, 1084, - /* 540 */ 74, 77, 828, 753, 19, 754, 18, 725, 124, 1081, - /* 550 */ 123, 21, 1082, 20, 137, 136, 1066, 283, 1086, 160, - /* 560 */ 165, 294, 175, 1107, 1047, 1106, 1105, 176, 1104, 1045, - /* 570 */ 177, 155, 178, 960, 310, 311, 312, 315, 316, 68, - /* 580 */ 167, 1063, 206, 64, 327, 954, 338, 1193, 781, 115, - /* 590 */ 1192, 1189, 184, 345, 1185, 121, 1184, 78, 1181, 287, - /* 600 */ 75, 242, 289, 291, 166, 303, 185, 980, 65, 169, - /* 610 */ 28, 168, 60, 69, 299, 207, 297, 295, 942, 293, - /* 620 */ 170, 131, 171, 940, 133, 134, 938, 290, 937, 268, - /* 630 */ 196, 27, 363, 197, 934, 314, 933, 932, 931, 930, - /* 640 */ 929, 928, 200, 202, 925, 923, 921, 919, 204, 916, - /* 650 */ 205, 912, 126, 355, 356, 281, 84, 89, 292, 357, - /* 660 */ 358, 359, 360, 361, 371, 232, 253, 309, 892, 270, - /* 670 */ 269, 891, 228, 229, 272, 273, 890, 109, 959, 958, - /* 680 */ 277, 873, 872, 110, 282, 304, 936, 11, 284, 87, - /* 690 */ 935, 758, 52, 90, 783, 188, 187, 981, 191, 186, - /* 700 */ 189, 146, 190, 147, 927, 192, 148, 1018, 926, 162, - /* 710 */ 149, 53, 918, 172, 917, 982, 173, 2, 4, 794, - /* 720 */ 163, 164, 1028, 788, 91, 244, 790, 92, 296, 62, - /* 730 */ 22, 332, 300, 23, 63, 12, 49, 306, 50, 101, - /* 740 */ 103, 656, 56, 105, 106, 57, 107, 691, 689, 688, - /* 750 */ 687, 685, 684, 683, 680, 646, 325, 111, 845, 864, - /* 760 */ 863, 843, 7, 865, 8, 336, 335, 114, 116, 71, - /* 770 */ 59, 728, 72, 120, 727, 122, 724, 672, 670, 662, - /* 780 */ 668, 664, 666, 660, 658, 694, 693, 692, 690, 686, - /* 790 */ 682, 681, 195, 644, 608, 896, 895, 895, 895, 895, - /* 800 */ 895, 895, 895, 895, 895, 895, 895, 895, 895, 151, - /* 810 */ 152, + /* 0 */ 214, 658, 1150, 24, 1151, 308, 856, 798, 859, 659, + /* 10 */ 1205, 801, 1207, 1205, 37, 38, 246, 41, 42, 58, + /* 20 */ 1076, 260, 31, 30, 29, 658, 40, 340, 45, 43, + /* 30 */ 46, 44, 258, 659, 384, 239, 36, 35, 294, 295, + /* 40 */ 34, 33, 32, 37, 38, 248, 41, 42, 380, 1007, + /* 50 */ 260, 31, 30, 29, 658, 40, 340, 45, 43, 46, + /* 60 */ 44, 1089, 659, 58, 241, 36, 35, 211, 1073, 34, + /* 70 */ 33, 32, 37, 38, 1098, 41, 42, 1205, 242, 260, + /* 80 */ 31, 30, 29, 969, 40, 340, 45, 43, 46, 44, + /* 90 */ 195, 84, 212, 214, 36, 35, 658, 253, 34, 33, + /* 100 */ 32, 1076, 1205, 1205, 659, 1208, 37, 39, 251, 41, + /* 110 */ 42, 51, 1073, 260, 31, 30, 29, 850, 40, 340, + /* 120 */ 45, 43, 46, 44, 1046, 244, 1044, 1045, 36, 35, + /* 130 */ 863, 1047, 34, 33, 32, 1048, 58, 1049, 1050, 1070, + /* 140 */ 919, 385, 855, 1095, 858, 608, 609, 610, 611, 612, + /* 150 */ 613, 614, 615, 616, 617, 618, 619, 620, 621, 158, + /* 160 */ 336, 240, 38, 255, 41, 42, 694, 1076, 260, 31, + /* 170 */ 30, 29, 90, 40, 340, 45, 43, 46, 44, 312, + /* 180 */ 96, 252, 95, 36, 35, 1073, 254, 34, 33, 32, + /* 190 */ 1089, 41, 42, 810, 811, 260, 31, 30, 29, 101, + /* 200 */ 40, 340, 45, 43, 46, 44, 1148, 282, 1149, 67, + /* 210 */ 36, 35, 160, 372, 34, 33, 32, 66, 334, 379, + /* 220 */ 378, 333, 332, 331, 377, 330, 329, 328, 376, 327, + /* 230 */ 375, 374, 1059, 1060, 55, 1063, 175, 25, 1038, 1026, + /* 240 */ 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, + /* 250 */ 1037, 1039, 1040, 218, 217, 298, 232, 865, 257, 1075, + /* 260 */ 854, 225, 857, 1205, 860, 261, 864, 143, 142, 141, + /* 270 */ 224, 742, 232, 865, 347, 90, 854, 1227, 857, 219, + /* 280 */ 860, 344, 289, 288, 129, 45, 43, 46, 44, 1205, + /* 290 */ 1219, 237, 238, 36, 35, 341, 372, 34, 33, 32, + /* 300 */ 339, 338, 362, 361, 263, 36, 35, 237, 238, 34, + /* 310 */ 33, 32, 67, 5, 61, 185, 1089, 220, 259, 214, + /* 320 */ 184, 110, 115, 106, 114, 766, 214, 1205, 763, 1205, + /* 330 */ 764, 1208, 765, 243, 268, 281, 1205, 82, 1208, 323, + /* 340 */ 6, 274, 47, 58, 233, 13, 127, 121, 132, 100, + /* 350 */ 278, 277, 1062, 131, 58, 137, 140, 130, 47, 265, + /* 360 */ 266, 205, 203, 201, 134, 34, 33, 32, 200, 147, + /* 370 */ 146, 145, 144, 58, 58, 58, 58, 866, 861, 103, + /* 380 */ 1198, 264, 58, 262, 862, 350, 349, 869, 351, 58, + /* 390 */ 1205, 1197, 1073, 866, 861, 66, 1161, 379, 378, 352, + /* 400 */ 862, 1205, 377, 1073, 1196, 290, 376, 235, 375, 374, + /* 410 */ 98, 270, 97, 267, 1205, 357, 356, 1205, 353, 354, + /* 420 */ 358, 359, 1073, 1073, 1073, 1073, 782, 360, 383, 382, + /* 430 */ 635, 1073, 236, 269, 364, 157, 155, 154, 1073, 104, + /* 440 */ 58, 336, 1205, 830, 181, 767, 768, 215, 216, 221, + /* 450 */ 83, 213, 222, 223, 227, 228, 229, 1205, 1205, 1205, + /* 460 */ 269, 1205, 1205, 1205, 1205, 1205, 1205, 99, 226, 210, + /* 470 */ 87, 182, 269, 979, 970, 1064, 779, 88, 1205, 1205, + /* 480 */ 195, 195, 85, 1074, 1061, 1, 183, 293, 292, 1072, + /* 490 */ 283, 3, 196, 75, 78, 807, 817, 818, 338, 54, + /* 500 */ 343, 829, 10, 752, 59, 315, 754, 285, 317, 162, + /* 510 */ 70, 48, 753, 786, 285, 311, 892, 59, 81, 59, + /* 520 */ 70, 291, 102, 867, 657, 1160, 70, 15, 249, 14, + /* 530 */ 9, 120, 318, 119, 1157, 79, 76, 9, 9, 853, + /* 540 */ 1156, 17, 771, 16, 772, 769, 19, 770, 18, 126, + /* 550 */ 741, 125, 21, 250, 20, 139, 138, 363, 279, 159, + /* 560 */ 1097, 1108, 26, 1105, 1106, 1110, 1090, 286, 161, 166, + /* 570 */ 304, 1071, 177, 178, 1140, 1069, 1139, 179, 1138, 1137, + /* 580 */ 156, 180, 984, 320, 297, 321, 245, 322, 325, 326, + /* 590 */ 797, 68, 208, 299, 301, 1087, 167, 64, 337, 168, + /* 600 */ 978, 348, 313, 1226, 117, 80, 169, 1225, 1222, 186, + /* 610 */ 355, 77, 28, 309, 1218, 123, 307, 1217, 1214, 305, + /* 620 */ 187, 303, 300, 1004, 173, 65, 60, 69, 296, 209, + /* 630 */ 966, 133, 172, 964, 135, 171, 136, 962, 961, 170, + /* 640 */ 27, 271, 198, 199, 958, 957, 956, 955, 954, 953, + /* 650 */ 952, 202, 204, 948, 324, 128, 946, 944, 206, 941, + /* 660 */ 207, 937, 373, 365, 284, 86, 91, 366, 302, 367, + /* 670 */ 368, 370, 369, 371, 381, 234, 256, 917, 273, 272, + /* 680 */ 319, 916, 276, 275, 915, 230, 231, 898, 897, 280, + /* 690 */ 111, 983, 982, 285, 112, 314, 11, 287, 774, 92, + /* 700 */ 89, 52, 73, 960, 806, 804, 959, 189, 1005, 190, + /* 710 */ 193, 188, 192, 191, 194, 148, 149, 951, 2, 150, + /* 720 */ 1042, 151, 1006, 176, 174, 950, 53, 943, 942, 800, + /* 730 */ 803, 4, 799, 74, 165, 808, 1052, 163, 247, 819, + /* 740 */ 164, 62, 813, 93, 22, 815, 94, 306, 342, 310, + /* 750 */ 63, 23, 12, 49, 316, 50, 103, 105, 108, 56, + /* 760 */ 107, 672, 57, 707, 705, 704, 109, 703, 701, 700, + /* 770 */ 699, 696, 662, 335, 113, 7, 889, 888, 868, 890, + /* 780 */ 870, 8, 345, 346, 116, 744, 71, 59, 72, 118, + /* 790 */ 122, 124, 743, 740, 688, 686, 678, 684, 680, 682, + /* 800 */ 676, 674, 710, 709, 708, 706, 702, 698, 697, 197, + /* 810 */ 660, 625, 921, 920, 920, 920, 920, 920, 920, 920, + /* 820 */ 920, 920, 920, 920, 920, 920, 152, 153, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 203, 1, 277, 1, 279, 280, 253, 276, 277, 9, - /* 10 */ 279, 201, 202, 5, 14, 15, 249, 17, 18, 203, - /* 20 */ 253, 21, 22, 23, 24, 1, 26, 27, 28, 29, - /* 30 */ 30, 31, 210, 9, 203, 253, 36, 37, 203, 204, - /* 40 */ 40, 41, 42, 14, 15, 248, 17, 18, 203, 252, + /* 0 */ 272, 1, 280, 272, 282, 283, 5, 5, 7, 9, + /* 10 */ 282, 9, 284, 282, 14, 15, 250, 17, 18, 204, + /* 20 */ 254, 21, 22, 23, 24, 1, 26, 27, 28, 29, + /* 30 */ 30, 31, 211, 9, 204, 205, 36, 37, 36, 37, + /* 40 */ 40, 41, 42, 14, 15, 1, 17, 18, 226, 227, /* 50 */ 21, 22, 23, 24, 1, 26, 27, 28, 29, 30, - /* 60 */ 31, 251, 9, 249, 248, 36, 37, 253, 252, 40, - /* 70 */ 41, 42, 14, 15, 203, 17, 18, 267, 203, 21, - /* 80 */ 22, 23, 24, 0, 26, 27, 28, 29, 30, 31, - /* 90 */ 89, 91, 270, 248, 36, 37, 1, 252, 40, 41, - /* 100 */ 42, 279, 271, 281, 9, 87, 14, 15, 249, 17, + /* 60 */ 31, 252, 9, 204, 249, 36, 37, 272, 253, 40, + /* 70 */ 41, 42, 14, 15, 204, 17, 18, 282, 269, 21, + /* 80 */ 22, 23, 24, 210, 26, 27, 28, 29, 30, 31, + /* 90 */ 217, 91, 272, 272, 36, 37, 1, 250, 40, 41, + /* 100 */ 42, 254, 282, 282, 9, 284, 14, 15, 249, 17, /* 110 */ 18, 87, 253, 21, 22, 23, 24, 88, 26, 27, - /* 120 */ 28, 29, 30, 31, 227, 250, 229, 230, 36, 37, - /* 130 */ 270, 234, 40, 41, 42, 238, 203, 240, 241, 279, - /* 140 */ 102, 281, 124, 272, 273, 50, 51, 52, 53, 54, + /* 120 */ 28, 29, 30, 31, 228, 123, 230, 231, 36, 37, + /* 130 */ 129, 235, 40, 41, 42, 239, 204, 241, 242, 204, + /* 140 */ 202, 203, 5, 273, 7, 50, 51, 52, 53, 54, /* 150 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - /* 160 */ 211, 66, 15, 203, 17, 18, 128, 83, 21, 22, - /* 170 */ 23, 24, 89, 26, 27, 28, 29, 30, 31, 95, - /* 180 */ 5, 248, 7, 36, 37, 252, 95, 40, 41, 42, - /* 190 */ 251, 17, 18, 251, 245, 21, 22, 23, 24, 211, - /* 200 */ 26, 27, 28, 29, 30, 31, 267, 253, 248, 267, - /* 210 */ 36, 37, 252, 243, 40, 41, 42, 103, 104, 105, + /* 160 */ 89, 66, 15, 250, 17, 18, 5, 254, 21, 22, + /* 170 */ 23, 24, 87, 26, 27, 28, 29, 30, 31, 279, + /* 180 */ 280, 249, 282, 36, 37, 253, 251, 40, 41, 42, + /* 190 */ 252, 17, 18, 131, 132, 21, 22, 23, 24, 212, + /* 200 */ 26, 27, 28, 29, 30, 31, 280, 269, 282, 124, + /* 210 */ 36, 37, 204, 95, 40, 41, 42, 103, 104, 105, /* 220 */ 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - /* 230 */ 116, 117, 244, 245, 246, 247, 5, 227, 228, 229, + /* 230 */ 116, 117, 245, 246, 247, 248, 259, 49, 228, 229, /* 240 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 250 */ 240, 241, 49, 130, 131, 67, 68, 69, 40, 41, - /* 260 */ 42, 270, 74, 75, 76, 77, 78, 36, 37, 66, - /* 270 */ 279, 1, 2, 209, 257, 5, 73, 7, 243, 9, - /* 280 */ 216, 93, 79, 80, 81, 82, 243, 1, 2, 86, - /* 290 */ 87, 5, 275, 7, 243, 9, 210, 47, 48, 243, - /* 300 */ 28, 29, 30, 31, 129, 203, 36, 37, 36, 37, - /* 310 */ 40, 211, 40, 41, 42, 65, 70, 71, 72, 5, - /* 320 */ 73, 7, 36, 37, 270, 2, 73, 124, 5, 147, - /* 330 */ 7, 270, 9, 279, 67, 68, 69, 87, 156, 157, - /* 340 */ 279, 74, 203, 76, 77, 78, 270, 247, 243, 146, - /* 350 */ 248, 148, 85, 214, 252, 279, 270, 87, 155, 36, - /* 360 */ 37, 67, 68, 69, 210, 279, 270, 281, 74, 75, - /* 370 */ 76, 77, 78, 87, 203, 279, 103, 88, 105, 106, - /* 380 */ 36, 37, 203, 110, 40, 41, 42, 114, 270, 116, - /* 390 */ 117, 102, 122, 123, 40, 203, 149, 279, 151, 129, - /* 400 */ 153, 154, 149, 203, 151, 203, 153, 154, 122, 123, - /* 410 */ 212, 213, 203, 87, 203, 129, 270, 91, 16, 248, - /* 420 */ 67, 68, 69, 252, 270, 279, 203, 248, 270, 270, - /* 430 */ 270, 252, 270, 279, 277, 281, 279, 279, 279, 279, - /* 440 */ 248, 279, 270, 129, 252, 122, 123, 121, 248, 81, - /* 450 */ 248, 279, 252, 270, 252, 270, 270, 225, 226, 270, - /* 460 */ 270, 252, 279, 270, 279, 279, 270, 270, 279, 279, - /* 470 */ 209, 270, 279, 254, 270, 279, 279, 216, 203, 203, - /* 480 */ 279, 127, 277, 279, 279, 88, 209, 268, 88, 214, - /* 490 */ 214, 207, 208, 216, 88, 88, 88, 48, 102, 88, - /* 500 */ 87, 102, 88, 1, 88, 88, 138, 88, 102, 102, - /* 510 */ 102, 243, 88, 102, 65, 87, 102, 88, 102, 102, - /* 520 */ 88, 102, 125, 203, 122, 125, 102, 150, 150, 152, - /* 530 */ 152, 102, 269, 120, 102, 150, 5, 152, 7, 203, - /* 540 */ 144, 142, 40, 5, 150, 7, 152, 119, 150, 203, - /* 550 */ 152, 150, 203, 152, 83, 84, 251, 251, 203, 203, - /* 560 */ 203, 203, 255, 278, 251, 278, 278, 203, 278, 203, - /* 570 */ 203, 65, 203, 203, 203, 203, 203, 203, 203, 203, - /* 580 */ 264, 266, 203, 203, 203, 203, 203, 203, 129, 203, - /* 590 */ 203, 203, 203, 203, 203, 203, 203, 141, 203, 274, - /* 600 */ 143, 274, 274, 274, 265, 136, 203, 203, 203, 262, - /* 610 */ 140, 263, 203, 203, 139, 203, 134, 133, 203, 132, - /* 620 */ 261, 203, 260, 203, 203, 203, 203, 135, 203, 203, - /* 630 */ 203, 145, 118, 203, 203, 94, 203, 203, 203, 203, - /* 640 */ 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, - /* 650 */ 203, 203, 101, 100, 56, 205, 205, 205, 205, 97, - /* 660 */ 99, 60, 98, 96, 89, 205, 205, 205, 5, 5, - /* 670 */ 158, 5, 205, 205, 158, 5, 5, 211, 215, 215, - /* 680 */ 147, 105, 104, 211, 125, 120, 205, 87, 102, 126, - /* 690 */ 205, 88, 87, 102, 88, 218, 222, 224, 220, 223, - /* 700 */ 221, 206, 219, 206, 205, 217, 206, 242, 205, 87, - /* 710 */ 206, 256, 205, 259, 205, 226, 258, 212, 207, 88, - /* 720 */ 87, 102, 242, 88, 87, 1, 88, 87, 87, 102, - /* 730 */ 137, 48, 1, 137, 102, 87, 87, 120, 87, 121, - /* 740 */ 83, 5, 92, 91, 75, 92, 91, 9, 5, 5, - /* 750 */ 5, 5, 5, 5, 5, 90, 16, 83, 122, 9, - /* 760 */ 9, 88, 87, 9, 87, 64, 27, 152, 152, 17, - /* 770 */ 102, 5, 17, 152, 5, 152, 88, 5, 5, 5, - /* 780 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 790 */ 5, 5, 102, 90, 65, 0, 282, 282, 282, 282, - /* 800 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 22, - /* 810 */ 22, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 820 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 830 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 840 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 850 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 860 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 870 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 880 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 890 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 900 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 910 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 920 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 930 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 940 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 950 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 960 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 970 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 980 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 990 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 1000 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - /* 1010 */ 282, 282, + /* 250 */ 240, 241, 242, 272, 66, 278, 1, 2, 211, 254, + /* 260 */ 5, 73, 7, 282, 9, 211, 129, 79, 80, 81, + /* 270 */ 82, 5, 1, 2, 86, 87, 5, 254, 7, 272, + /* 280 */ 9, 16, 274, 275, 83, 28, 29, 30, 31, 282, + /* 290 */ 254, 36, 37, 36, 37, 40, 95, 40, 41, 42, + /* 300 */ 47, 48, 36, 37, 73, 36, 37, 36, 37, 40, + /* 310 */ 41, 42, 124, 67, 68, 69, 252, 272, 65, 272, + /* 320 */ 74, 75, 76, 77, 78, 2, 272, 282, 5, 282, + /* 330 */ 7, 284, 9, 269, 73, 147, 282, 149, 284, 93, + /* 340 */ 87, 148, 87, 204, 156, 87, 67, 68, 69, 91, + /* 350 */ 157, 158, 0, 74, 204, 76, 77, 78, 87, 36, + /* 360 */ 37, 67, 68, 69, 85, 40, 41, 42, 74, 75, + /* 370 */ 76, 77, 78, 204, 204, 204, 204, 122, 123, 121, + /* 380 */ 272, 150, 204, 152, 129, 154, 155, 122, 249, 204, + /* 390 */ 282, 272, 253, 122, 123, 103, 244, 105, 106, 249, + /* 400 */ 129, 282, 110, 253, 272, 277, 114, 272, 116, 117, + /* 410 */ 280, 150, 282, 152, 282, 154, 155, 282, 249, 249, + /* 420 */ 249, 249, 253, 253, 253, 253, 40, 249, 70, 71, + /* 430 */ 72, 253, 272, 204, 249, 67, 68, 69, 253, 212, + /* 440 */ 204, 89, 282, 81, 215, 122, 123, 272, 272, 272, + /* 450 */ 212, 272, 272, 272, 272, 272, 272, 282, 282, 282, + /* 460 */ 204, 282, 282, 282, 282, 282, 282, 255, 272, 272, + /* 470 */ 88, 215, 204, 210, 210, 248, 102, 88, 282, 282, + /* 480 */ 217, 217, 270, 215, 246, 213, 214, 36, 37, 253, + /* 490 */ 88, 208, 209, 102, 102, 88, 88, 88, 48, 87, + /* 500 */ 1, 139, 128, 88, 102, 88, 88, 125, 88, 102, + /* 510 */ 102, 102, 88, 127, 125, 65, 88, 102, 87, 102, + /* 520 */ 102, 277, 102, 88, 88, 244, 102, 151, 244, 153, + /* 530 */ 102, 151, 120, 153, 244, 143, 145, 102, 102, 40, + /* 540 */ 244, 151, 5, 153, 7, 5, 151, 7, 153, 151, + /* 550 */ 119, 153, 151, 244, 153, 83, 84, 244, 204, 204, + /* 560 */ 204, 204, 271, 204, 204, 204, 252, 252, 204, 204, + /* 570 */ 204, 252, 256, 204, 281, 204, 281, 204, 281, 281, + /* 580 */ 65, 204, 204, 204, 276, 204, 276, 204, 204, 204, + /* 590 */ 129, 204, 204, 276, 276, 268, 267, 204, 204, 266, + /* 600 */ 204, 204, 137, 204, 204, 142, 265, 204, 204, 204, + /* 610 */ 204, 144, 141, 140, 204, 204, 135, 204, 204, 134, + /* 620 */ 204, 133, 136, 204, 261, 204, 204, 204, 130, 204, + /* 630 */ 204, 204, 262, 204, 204, 263, 204, 204, 204, 264, + /* 640 */ 146, 204, 204, 204, 204, 204, 204, 204, 204, 204, + /* 650 */ 204, 204, 204, 204, 94, 101, 204, 204, 204, 204, + /* 660 */ 204, 204, 118, 100, 206, 206, 206, 56, 206, 97, + /* 670 */ 99, 98, 60, 96, 89, 206, 206, 5, 5, 159, + /* 680 */ 206, 5, 5, 159, 5, 206, 206, 105, 104, 148, + /* 690 */ 212, 216, 216, 125, 212, 120, 87, 102, 88, 102, + /* 700 */ 126, 87, 102, 206, 88, 129, 206, 223, 225, 219, + /* 710 */ 221, 224, 220, 222, 218, 207, 207, 206, 213, 207, + /* 720 */ 243, 207, 227, 257, 260, 206, 258, 206, 206, 5, + /* 730 */ 129, 208, 5, 87, 102, 88, 243, 87, 1, 88, + /* 740 */ 87, 102, 88, 87, 138, 88, 87, 87, 48, 1, + /* 750 */ 102, 138, 87, 87, 120, 87, 121, 83, 75, 92, + /* 760 */ 91, 5, 92, 9, 5, 5, 91, 5, 5, 5, + /* 770 */ 5, 5, 90, 16, 83, 87, 9, 9, 88, 9, + /* 780 */ 122, 87, 27, 64, 153, 5, 17, 102, 17, 153, + /* 790 */ 153, 153, 5, 88, 5, 5, 5, 5, 5, 5, + /* 800 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 102, + /* 810 */ 90, 65, 0, 285, 285, 285, 285, 285, 285, 285, + /* 820 */ 285, 285, 285, 285, 285, 285, 22, 22, 285, 285, + /* 830 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 840 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 850 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 860 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 870 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 880 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 890 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 900 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 910 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 920 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 930 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 940 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 950 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 960 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 970 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 980 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 990 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 1000 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 1010 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + /* 1020 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, }; -#define YY_SHIFT_COUNT (375) +#define YY_SHIFT_COUNT (385) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (795) +#define YY_SHIFT_MAX (812) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 203, 114, 114, 273, 273, 1, 270, 286, 286, 286, + /* 0 */ 188, 114, 114, 292, 292, 71, 255, 271, 271, 271, /* 10 */ 24, 53, 53, 53, 53, 53, 53, 53, 53, 53, - /* 20 */ 53, 53, 2, 2, 0, 95, 286, 286, 286, 286, - /* 30 */ 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, - /* 40 */ 286, 286, 286, 286, 286, 286, 286, 286, 323, 323, - /* 50 */ 323, 18, 18, 123, 53, 83, 53, 53, 53, 53, - /* 60 */ 84, 1, 2, 2, 91, 91, 8, 811, 811, 811, - /* 70 */ 323, 323, 323, 231, 231, 231, 231, 231, 231, 231, - /* 80 */ 53, 53, 53, 354, 53, 53, 53, 18, 18, 53, - /* 90 */ 53, 53, 53, 368, 368, 368, 368, 38, 18, 53, - /* 100 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + /* 20 */ 53, 53, 44, 44, 0, 95, 271, 271, 271, 271, + /* 30 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 40 */ 271, 271, 271, 271, 271, 271, 271, 271, 323, 323, + /* 50 */ 323, 85, 85, 62, 53, 352, 53, 53, 53, 53, + /* 60 */ 201, 71, 44, 44, 118, 118, 161, 828, 828, 828, + /* 70 */ 323, 323, 323, 2, 2, 266, 266, 266, 266, 266, + /* 80 */ 266, 266, 53, 53, 53, 386, 53, 53, 53, 85, + /* 90 */ 85, 53, 53, 53, 53, 362, 362, 362, 362, 374, + /* 100 */ 85, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 110 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 120 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 130 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 140 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - /* 150 */ 53, 53, 53, 53, 53, 53, 53, 53, 506, 506, - /* 160 */ 506, 459, 459, 459, 459, 506, 456, 457, 469, 470, - /* 170 */ 475, 482, 484, 487, 492, 486, 506, 506, 506, 541, - /* 180 */ 541, 514, 1, 1, 506, 506, 551, 553, 598, 562, - /* 190 */ 561, 601, 564, 567, 514, 8, 506, 506, 575, 575, - /* 200 */ 506, 575, 506, 575, 506, 506, 811, 811, 29, 58, - /* 210 */ 58, 92, 58, 147, 174, 188, 272, 272, 272, 272, - /* 220 */ 272, 272, 267, 294, 344, 344, 344, 344, 247, 253, - /* 230 */ 250, 182, 326, 218, 218, 175, 314, 246, 353, 289, - /* 240 */ 397, 400, 406, 407, 408, 449, 396, 399, 411, 414, - /* 250 */ 416, 417, 424, 413, 429, 432, 502, 402, 419, 377, - /* 260 */ 378, 385, 531, 538, 394, 398, 428, 401, 471, 663, - /* 270 */ 512, 664, 666, 516, 670, 671, 576, 578, 533, 559, - /* 280 */ 565, 600, 563, 603, 605, 586, 591, 606, 622, 631, - /* 290 */ 633, 635, 619, 637, 638, 640, 724, 641, 627, 593, - /* 300 */ 683, 731, 632, 596, 648, 565, 649, 617, 651, 618, - /* 310 */ 657, 650, 652, 669, 736, 653, 655, 738, 743, 744, - /* 320 */ 745, 746, 747, 748, 749, 665, 740, 674, 750, 751, - /* 330 */ 675, 673, 754, 683, 636, 677, 739, 701, 752, 615, - /* 340 */ 616, 668, 668, 668, 668, 755, 621, 623, 668, 668, - /* 350 */ 668, 766, 769, 688, 668, 772, 773, 774, 775, 776, - /* 360 */ 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, - /* 370 */ 690, 703, 787, 788, 729, 795, + /* 150 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 515, + /* 160 */ 515, 515, 461, 461, 461, 461, 515, 463, 467, 465, + /* 170 */ 471, 473, 481, 485, 488, 486, 498, 494, 515, 515, + /* 180 */ 515, 560, 560, 544, 71, 71, 515, 515, 554, 563, + /* 190 */ 611, 572, 571, 612, 573, 577, 544, 161, 515, 515, + /* 200 */ 585, 585, 515, 585, 515, 585, 515, 515, 828, 828, + /* 210 */ 29, 58, 58, 92, 58, 147, 174, 246, 257, 257, + /* 220 */ 257, 257, 257, 257, 279, 294, 269, 269, 269, 269, + /* 230 */ 231, 261, 253, 193, 258, 325, 325, 1, 137, 358, + /* 240 */ 368, 402, 382, 389, 451, 407, 408, 409, 450, 391, + /* 250 */ 392, 415, 417, 418, 420, 424, 412, 428, 435, 499, + /* 260 */ 265, 436, 376, 380, 390, 537, 540, 395, 398, 431, + /* 270 */ 401, 472, 672, 520, 673, 676, 524, 677, 679, 582, + /* 280 */ 584, 541, 568, 575, 609, 574, 610, 614, 595, 597, + /* 290 */ 616, 600, 576, 601, 724, 727, 646, 647, 650, 651, + /* 300 */ 653, 654, 632, 656, 657, 659, 737, 660, 639, 606, + /* 310 */ 700, 748, 648, 613, 665, 575, 666, 634, 668, 635, + /* 320 */ 674, 667, 669, 683, 756, 670, 675, 754, 759, 760, + /* 330 */ 762, 763, 764, 765, 766, 682, 757, 691, 767, 768, + /* 340 */ 688, 690, 770, 700, 658, 694, 755, 719, 769, 631, + /* 350 */ 636, 685, 685, 685, 685, 771, 637, 638, 685, 685, + /* 360 */ 685, 780, 787, 705, 685, 789, 790, 791, 792, 793, + /* 370 */ 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, + /* 380 */ 707, 720, 804, 805, 746, 812, }; -#define YY_REDUCE_COUNT (207) -#define YY_REDUCE_MIN (-275) -#define YY_REDUCE_MAX (511) +#define YY_REDUCE_COUNT (209) +#define YY_REDUCE_MIN (-278) +#define YY_REDUCE_MAX (523) static const short yy_reduce_ofst[] = { - /* 0 */ -190, 10, 10, -103, -103, -12, -178, 86, 154, -140, - /* 10 */ -129, -203, -184, -155, -67, -40, 102, 171, 179, 192, - /* 20 */ 200, 202, -275, -269, -169, -165, -9, 54, 61, 76, - /* 30 */ 96, 118, 146, 158, 159, 160, 162, 172, 183, 185, - /* 40 */ 186, 189, 190, 193, 196, 197, 201, 204, -233, -186, - /* 50 */ -141, -61, -58, 17, -125, 100, 139, 275, 276, 209, - /* 60 */ 64, -51, 157, 205, 261, 277, 232, 219, 198, 284, - /* 70 */ -247, -218, -46, -30, 35, 43, 51, 56, 105, 268, - /* 80 */ 211, 223, 320, 263, 336, 346, 349, 305, 306, 355, - /* 90 */ 356, 357, 358, 285, 287, 288, 290, 307, 313, 364, - /* 100 */ 366, 367, 369, 370, 371, 372, 373, 374, 375, 376, - /* 110 */ 379, 380, 381, 382, 383, 384, 386, 387, 388, 389, - /* 120 */ 390, 391, 392, 393, 395, 403, 404, 405, 409, 410, - /* 130 */ 412, 415, 418, 420, 421, 422, 423, 425, 426, 427, - /* 140 */ 430, 431, 433, 434, 435, 436, 437, 438, 439, 440, - /* 150 */ 441, 442, 443, 444, 445, 446, 447, 448, 450, 451, - /* 160 */ 452, 325, 327, 328, 329, 453, 315, 339, 316, 348, - /* 170 */ 347, 359, 362, 454, 458, 455, 460, 461, 462, 463, - /* 180 */ 464, 465, 466, 472, 467, 468, 473, 476, 474, 477, - /* 190 */ 479, 483, 478, 488, 480, 489, 481, 485, 495, 497, - /* 200 */ 499, 500, 503, 504, 507, 509, 505, 511, + /* 0 */ -62, 10, 10, -104, -104, -13, -179, 47, 54, -272, + /* 10 */ 8, -185, -141, -68, 139, 150, 169, 170, 171, 172, + /* 20 */ 178, 185, -278, -100, -130, -170, -269, -205, -180, -19, + /* 30 */ 7, 45, 108, 119, 132, 135, 160, 175, 176, 177, + /* 40 */ 179, 180, 181, 182, 183, 184, 196, 197, -234, -153, + /* 50 */ -87, -191, 64, -23, -65, 227, 229, 256, 268, 236, + /* 60 */ -127, 238, -74, 130, 263, 264, -178, 212, 272, 283, + /* 70 */ 5, 23, 36, 128, 244, 152, 281, 284, 290, 296, + /* 80 */ 309, 313, 354, 355, 356, 291, 357, 359, 360, 314, + /* 90 */ 315, 361, 364, 365, 366, 293, 295, 297, 298, 316, + /* 100 */ 319, 369, 371, 373, 377, 378, 379, 381, 383, 384, + /* 110 */ 385, 387, 388, 393, 394, 396, 397, 399, 400, 403, + /* 120 */ 404, 405, 406, 410, 411, 413, 414, 416, 419, 421, + /* 130 */ 422, 423, 425, 426, 427, 429, 430, 432, 433, 434, + /* 140 */ 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, + /* 150 */ 447, 448, 449, 452, 453, 454, 455, 456, 457, 458, + /* 160 */ 459, 460, 308, 310, 317, 318, 462, 327, 329, 333, + /* 170 */ 341, 375, 372, 370, 363, 464, 468, 466, 469, 470, + /* 180 */ 474, 475, 476, 477, 478, 482, 479, 480, 483, 487, + /* 190 */ 484, 490, 491, 492, 489, 496, 493, 495, 497, 500, + /* 200 */ 508, 509, 511, 512, 519, 514, 521, 522, 505, 523, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 893, 1017, 956, 1027, 943, 953, 1177, 1177, 1177, 1177, - /* 10 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 20 */ 893, 893, 893, 893, 1075, 913, 893, 893, 893, 893, - /* 30 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 40 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 50 */ 893, 893, 893, 1090, 893, 953, 893, 893, 893, 893, - /* 60 */ 963, 953, 893, 893, 963, 963, 893, 1070, 1001, 1019, - /* 70 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 80 */ 893, 893, 893, 1077, 1083, 1080, 893, 893, 893, 1085, - /* 90 */ 893, 893, 893, 1112, 1112, 1112, 1112, 1068, 893, 893, - /* 100 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 110 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 120 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 130 */ 893, 941, 893, 939, 893, 893, 893, 893, 893, 893, - /* 140 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 150 */ 924, 893, 893, 893, 893, 893, 893, 911, 915, 915, - /* 160 */ 915, 893, 893, 893, 893, 915, 1121, 1125, 1102, 1119, - /* 170 */ 1113, 1097, 1095, 1093, 1101, 1129, 915, 915, 915, 961, - /* 180 */ 961, 957, 953, 953, 915, 915, 979, 977, 975, 967, - /* 190 */ 973, 969, 971, 965, 944, 893, 915, 915, 951, 951, - /* 200 */ 915, 951, 915, 951, 915, 915, 1001, 1019, 893, 1130, - /* 210 */ 1120, 893, 1176, 1160, 1159, 893, 1168, 1167, 1166, 1158, - /* 220 */ 1157, 1156, 893, 893, 1152, 1155, 1154, 1153, 893, 893, - /* 230 */ 1132, 893, 893, 1162, 1161, 893, 893, 893, 893, 893, - /* 240 */ 893, 893, 893, 893, 893, 1108, 1126, 1122, 893, 893, - /* 250 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 260 */ 893, 893, 893, 893, 893, 893, 1029, 893, 893, 893, - /* 270 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 1067, - /* 280 */ 893, 893, 893, 893, 893, 1079, 1078, 893, 893, 893, - /* 290 */ 893, 893, 893, 893, 893, 893, 893, 893, 1114, 893, - /* 300 */ 1109, 893, 1103, 893, 893, 1041, 893, 893, 893, 893, - /* 310 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 320 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 330 */ 893, 893, 893, 1133, 893, 893, 893, 893, 893, 893, - /* 340 */ 893, 1195, 1190, 1191, 1188, 893, 893, 893, 1187, 1182, - /* 350 */ 1183, 893, 893, 893, 1180, 893, 893, 893, 893, 893, - /* 360 */ 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, - /* 370 */ 985, 893, 922, 920, 893, 893, + /* 0 */ 918, 1041, 980, 1051, 967, 977, 1210, 1210, 1210, 1210, + /* 10 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 20 */ 918, 918, 918, 918, 1099, 938, 918, 918, 918, 918, + /* 30 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 40 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 50 */ 918, 918, 918, 1123, 918, 977, 918, 918, 918, 918, + /* 60 */ 987, 977, 918, 918, 987, 987, 918, 1094, 1025, 1043, + /* 70 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 80 */ 918, 918, 918, 918, 918, 1101, 1107, 1104, 918, 918, + /* 90 */ 918, 1109, 918, 918, 918, 1145, 1145, 1145, 1145, 1092, + /* 100 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 110 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 120 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 130 */ 918, 918, 918, 965, 918, 963, 918, 918, 918, 918, + /* 140 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 150 */ 918, 918, 918, 918, 918, 918, 918, 918, 936, 940, + /* 160 */ 940, 940, 918, 918, 918, 918, 940, 1154, 1158, 1135, + /* 170 */ 1152, 1146, 1130, 1128, 1126, 1134, 1119, 1162, 940, 940, + /* 180 */ 940, 985, 985, 981, 977, 977, 940, 940, 1003, 1001, + /* 190 */ 999, 991, 997, 993, 995, 989, 968, 918, 940, 940, + /* 200 */ 975, 975, 940, 975, 940, 975, 940, 940, 1025, 1043, + /* 210 */ 918, 1163, 1153, 918, 1209, 1193, 1192, 918, 1201, 1200, + /* 220 */ 1199, 1191, 1190, 1189, 918, 918, 1185, 1188, 1187, 1186, + /* 230 */ 918, 918, 1165, 918, 918, 1195, 1194, 918, 918, 918, + /* 240 */ 918, 918, 918, 918, 1116, 918, 918, 918, 1141, 1159, + /* 250 */ 1155, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 260 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 1053, + /* 270 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 280 */ 918, 918, 1091, 918, 918, 918, 918, 918, 1103, 1102, + /* 290 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 300 */ 918, 918, 918, 918, 918, 918, 918, 918, 1147, 918, + /* 310 */ 1142, 918, 1136, 918, 918, 1065, 918, 918, 918, 918, + /* 320 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 330 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 340 */ 918, 918, 918, 1166, 918, 918, 918, 918, 918, 918, + /* 350 */ 918, 1228, 1223, 1224, 1221, 918, 918, 918, 1220, 1215, + /* 360 */ 1216, 918, 918, 918, 1213, 918, 918, 918, 918, 918, + /* 370 */ 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, + /* 380 */ 1009, 918, 947, 945, 918, 918, }; /********** End of lemon-generated parsing tables *****************************/ @@ -864,6 +867,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* DISTINCT => nothing */ 0, /* FROM => nothing */ 0, /* VARIABLE => nothing */ + 0, /* RANGE => nothing */ 0, /* INTERVAL => nothing */ 0, /* EVERY => nothing */ 0, /* SESSION => nothing */ @@ -1153,158 +1157,161 @@ static const char *const yyTokenName[] = { /* 127 */ "DISTINCT", /* 128 */ "FROM", /* 129 */ "VARIABLE", - /* 130 */ "INTERVAL", - /* 131 */ "EVERY", - /* 132 */ "SESSION", - /* 133 */ "STATE_WINDOW", - /* 134 */ "FILL", - /* 135 */ "SLIDING", - /* 136 */ "ORDER", - /* 137 */ "BY", - /* 138 */ "ASC", - /* 139 */ "GROUP", - /* 140 */ "HAVING", - /* 141 */ "LIMIT", - /* 142 */ "OFFSET", - /* 143 */ "SLIMIT", - /* 144 */ "SOFFSET", - /* 145 */ "WHERE", - /* 146 */ "RESET", - /* 147 */ "QUERY", - /* 148 */ "SYNCDB", - /* 149 */ "ADD", - /* 150 */ "COLUMN", - /* 151 */ "MODIFY", - /* 152 */ "TAG", - /* 153 */ "CHANGE", - /* 154 */ "SET", - /* 155 */ "KILL", - /* 156 */ "CONNECTION", - /* 157 */ "STREAM", - /* 158 */ "COLON", - /* 159 */ "ABORT", - /* 160 */ "AFTER", - /* 161 */ "ATTACH", - /* 162 */ "BEFORE", - /* 163 */ "BEGIN", - /* 164 */ "CASCADE", - /* 165 */ "CLUSTER", - /* 166 */ "CONFLICT", - /* 167 */ "COPY", - /* 168 */ "DEFERRED", - /* 169 */ "DELIMITERS", - /* 170 */ "DETACH", - /* 171 */ "EACH", - /* 172 */ "END", - /* 173 */ "EXPLAIN", - /* 174 */ "FAIL", - /* 175 */ "FOR", - /* 176 */ "IGNORE", - /* 177 */ "IMMEDIATE", - /* 178 */ "INITIALLY", - /* 179 */ "INSTEAD", - /* 180 */ "KEY", - /* 181 */ "OF", - /* 182 */ "RAISE", - /* 183 */ "REPLACE", - /* 184 */ "RESTRICT", - /* 185 */ "ROW", - /* 186 */ "STATEMENT", - /* 187 */ "TRIGGER", - /* 188 */ "VIEW", - /* 189 */ "IPTOKEN", - /* 190 */ "SEMI", - /* 191 */ "NONE", - /* 192 */ "PREV", - /* 193 */ "LINEAR", - /* 194 */ "IMPORT", - /* 195 */ "TBNAME", - /* 196 */ "JOIN", - /* 197 */ "INSERT", - /* 198 */ "INTO", - /* 199 */ "VALUES", - /* 200 */ "FILE", - /* 201 */ "program", - /* 202 */ "cmd", - /* 203 */ "ids", - /* 204 */ "dbPrefix", - /* 205 */ "cpxName", - /* 206 */ "ifexists", - /* 207 */ "alter_db_optr", - /* 208 */ "alter_topic_optr", - /* 209 */ "acct_optr", - /* 210 */ "exprlist", - /* 211 */ "ifnotexists", - /* 212 */ "db_optr", - /* 213 */ "topic_optr", - /* 214 */ "typename", - /* 215 */ "bufsize", - /* 216 */ "pps", - /* 217 */ "tseries", - /* 218 */ "dbs", - /* 219 */ "streams", - /* 220 */ "storage", - /* 221 */ "qtime", - /* 222 */ "users", - /* 223 */ "conns", - /* 224 */ "state", - /* 225 */ "intitemlist", - /* 226 */ "intitem", - /* 227 */ "keep", - /* 228 */ "cache", - /* 229 */ "replica", - /* 230 */ "quorum", - /* 231 */ "days", - /* 232 */ "minrows", - /* 233 */ "maxrows", - /* 234 */ "blocks", - /* 235 */ "ctime", - /* 236 */ "wal", - /* 237 */ "fsync", - /* 238 */ "comp", - /* 239 */ "prec", - /* 240 */ "update", - /* 241 */ "cachelast", - /* 242 */ "partitions", - /* 243 */ "signed", - /* 244 */ "create_table_args", - /* 245 */ "create_stable_args", - /* 246 */ "create_table_list", - /* 247 */ "create_from_stable", - /* 248 */ "columnlist", - /* 249 */ "tagitemlist", - /* 250 */ "tagNamelist", - /* 251 */ "select", - /* 252 */ "column", - /* 253 */ "tagitem", - /* 254 */ "selcollist", - /* 255 */ "from", - /* 256 */ "where_opt", - /* 257 */ "interval_option", - /* 258 */ "sliding_opt", - /* 259 */ "session_option", - /* 260 */ "windowstate_option", - /* 261 */ "fill_opt", - /* 262 */ "groupby_opt", - /* 263 */ "having_opt", - /* 264 */ "orderby_opt", - /* 265 */ "slimit_opt", - /* 266 */ "limit_opt", - /* 267 */ "union", - /* 268 */ "sclp", - /* 269 */ "distinct", - /* 270 */ "expr", - /* 271 */ "as", - /* 272 */ "tablelist", - /* 273 */ "sub", - /* 274 */ "tmvar", - /* 275 */ "intervalKey", - /* 276 */ "sortlist", - /* 277 */ "item", - /* 278 */ "sortorder", - /* 279 */ "arrow", - /* 280 */ "grouplist", - /* 281 */ "expritem", + /* 130 */ "RANGE", + /* 131 */ "INTERVAL", + /* 132 */ "EVERY", + /* 133 */ "SESSION", + /* 134 */ "STATE_WINDOW", + /* 135 */ "FILL", + /* 136 */ "SLIDING", + /* 137 */ "ORDER", + /* 138 */ "BY", + /* 139 */ "ASC", + /* 140 */ "GROUP", + /* 141 */ "HAVING", + /* 142 */ "LIMIT", + /* 143 */ "OFFSET", + /* 144 */ "SLIMIT", + /* 145 */ "SOFFSET", + /* 146 */ "WHERE", + /* 147 */ "RESET", + /* 148 */ "QUERY", + /* 149 */ "SYNCDB", + /* 150 */ "ADD", + /* 151 */ "COLUMN", + /* 152 */ "MODIFY", + /* 153 */ "TAG", + /* 154 */ "CHANGE", + /* 155 */ "SET", + /* 156 */ "KILL", + /* 157 */ "CONNECTION", + /* 158 */ "STREAM", + /* 159 */ "COLON", + /* 160 */ "ABORT", + /* 161 */ "AFTER", + /* 162 */ "ATTACH", + /* 163 */ "BEFORE", + /* 164 */ "BEGIN", + /* 165 */ "CASCADE", + /* 166 */ "CLUSTER", + /* 167 */ "CONFLICT", + /* 168 */ "COPY", + /* 169 */ "DEFERRED", + /* 170 */ "DELIMITERS", + /* 171 */ "DETACH", + /* 172 */ "EACH", + /* 173 */ "END", + /* 174 */ "EXPLAIN", + /* 175 */ "FAIL", + /* 176 */ "FOR", + /* 177 */ "IGNORE", + /* 178 */ "IMMEDIATE", + /* 179 */ "INITIALLY", + /* 180 */ "INSTEAD", + /* 181 */ "KEY", + /* 182 */ "OF", + /* 183 */ "RAISE", + /* 184 */ "REPLACE", + /* 185 */ "RESTRICT", + /* 186 */ "ROW", + /* 187 */ "STATEMENT", + /* 188 */ "TRIGGER", + /* 189 */ "VIEW", + /* 190 */ "IPTOKEN", + /* 191 */ "SEMI", + /* 192 */ "NONE", + /* 193 */ "PREV", + /* 194 */ "LINEAR", + /* 195 */ "IMPORT", + /* 196 */ "TBNAME", + /* 197 */ "JOIN", + /* 198 */ "INSERT", + /* 199 */ "INTO", + /* 200 */ "VALUES", + /* 201 */ "FILE", + /* 202 */ "program", + /* 203 */ "cmd", + /* 204 */ "ids", + /* 205 */ "dbPrefix", + /* 206 */ "cpxName", + /* 207 */ "ifexists", + /* 208 */ "alter_db_optr", + /* 209 */ "alter_topic_optr", + /* 210 */ "acct_optr", + /* 211 */ "exprlist", + /* 212 */ "ifnotexists", + /* 213 */ "db_optr", + /* 214 */ "topic_optr", + /* 215 */ "typename", + /* 216 */ "bufsize", + /* 217 */ "pps", + /* 218 */ "tseries", + /* 219 */ "dbs", + /* 220 */ "streams", + /* 221 */ "storage", + /* 222 */ "qtime", + /* 223 */ "users", + /* 224 */ "conns", + /* 225 */ "state", + /* 226 */ "intitemlist", + /* 227 */ "intitem", + /* 228 */ "keep", + /* 229 */ "cache", + /* 230 */ "replica", + /* 231 */ "quorum", + /* 232 */ "days", + /* 233 */ "minrows", + /* 234 */ "maxrows", + /* 235 */ "blocks", + /* 236 */ "ctime", + /* 237 */ "wal", + /* 238 */ "fsync", + /* 239 */ "comp", + /* 240 */ "prec", + /* 241 */ "update", + /* 242 */ "cachelast", + /* 243 */ "partitions", + /* 244 */ "signed", + /* 245 */ "create_table_args", + /* 246 */ "create_stable_args", + /* 247 */ "create_table_list", + /* 248 */ "create_from_stable", + /* 249 */ "columnlist", + /* 250 */ "tagitemlist", + /* 251 */ "tagNamelist", + /* 252 */ "select", + /* 253 */ "column", + /* 254 */ "tagitem", + /* 255 */ "selcollist", + /* 256 */ "from", + /* 257 */ "where_opt", + /* 258 */ "range_option", + /* 259 */ "interval_option", + /* 260 */ "sliding_opt", + /* 261 */ "session_option", + /* 262 */ "windowstate_option", + /* 263 */ "fill_opt", + /* 264 */ "groupby_opt", + /* 265 */ "having_opt", + /* 266 */ "orderby_opt", + /* 267 */ "slimit_opt", + /* 268 */ "limit_opt", + /* 269 */ "union", + /* 270 */ "sclp", + /* 271 */ "distinct", + /* 272 */ "expr", + /* 273 */ "as", + /* 274 */ "tablelist", + /* 275 */ "sub", + /* 276 */ "tmvar", + /* 277 */ "timestamp", + /* 278 */ "intervalKey", + /* 279 */ "sortlist", + /* 280 */ "item", + /* 281 */ "sortorder", + /* 282 */ "arrow", + /* 283 */ "grouplist", + /* 284 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1341,280 +1348,288 @@ static const char *const yyRuleName[] = { /* 26 */ "cmd ::= SHOW dbPrefix STABLES", /* 27 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids", /* 28 */ "cmd ::= SHOW dbPrefix VGROUPS", - /* 29 */ "cmd ::= SHOW dbPrefix VGROUPS ids", - /* 30 */ "cmd ::= DROP TABLE ifexists ids cpxName", - /* 31 */ "cmd ::= DROP STABLE ifexists ids cpxName", - /* 32 */ "cmd ::= DROP DATABASE ifexists ids", - /* 33 */ "cmd ::= DROP TOPIC ifexists ids", - /* 34 */ "cmd ::= DROP FUNCTION ids", - /* 35 */ "cmd ::= DROP DNODE ids", - /* 36 */ "cmd ::= DROP USER ids", - /* 37 */ "cmd ::= DROP ACCOUNT ids", - /* 38 */ "cmd ::= USE ids", - /* 39 */ "cmd ::= DESCRIBE ids cpxName", - /* 40 */ "cmd ::= DESC ids cpxName", - /* 41 */ "cmd ::= ALTER USER ids PASS ids", - /* 42 */ "cmd ::= ALTER USER ids PRIVILEGE ids", - /* 43 */ "cmd ::= ALTER DNODE ids ids", - /* 44 */ "cmd ::= ALTER DNODE ids ids ids", - /* 45 */ "cmd ::= ALTER LOCAL ids", - /* 46 */ "cmd ::= ALTER LOCAL ids ids", - /* 47 */ "cmd ::= ALTER DATABASE ids alter_db_optr", - /* 48 */ "cmd ::= ALTER TOPIC ids alter_topic_optr", - /* 49 */ "cmd ::= ALTER ACCOUNT ids acct_optr", - /* 50 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr", - /* 51 */ "cmd ::= COMPACT VNODES IN LP exprlist RP", - /* 52 */ "ids ::= ID", - /* 53 */ "ids ::= STRING", - /* 54 */ "ifexists ::= IF EXISTS", - /* 55 */ "ifexists ::=", - /* 56 */ "ifnotexists ::= IF NOT EXISTS", - /* 57 */ "ifnotexists ::=", - /* 58 */ "cmd ::= CREATE DNODE ids", - /* 59 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr", - /* 60 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr", - /* 61 */ "cmd ::= CREATE TOPIC ifnotexists ids topic_optr", - /* 62 */ "cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize", - /* 63 */ "cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize", - /* 64 */ "cmd ::= CREATE USER ids PASS ids", - /* 65 */ "bufsize ::=", - /* 66 */ "bufsize ::= BUFSIZE INTEGER", - /* 67 */ "pps ::=", - /* 68 */ "pps ::= PPS INTEGER", - /* 69 */ "tseries ::=", - /* 70 */ "tseries ::= TSERIES INTEGER", - /* 71 */ "dbs ::=", - /* 72 */ "dbs ::= DBS INTEGER", - /* 73 */ "streams ::=", - /* 74 */ "streams ::= STREAMS INTEGER", - /* 75 */ "storage ::=", - /* 76 */ "storage ::= STORAGE INTEGER", - /* 77 */ "qtime ::=", - /* 78 */ "qtime ::= QTIME INTEGER", - /* 79 */ "users ::=", - /* 80 */ "users ::= USERS INTEGER", - /* 81 */ "conns ::=", - /* 82 */ "conns ::= CONNS INTEGER", - /* 83 */ "state ::=", - /* 84 */ "state ::= STATE ids", - /* 85 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state", - /* 86 */ "intitemlist ::= intitemlist COMMA intitem", - /* 87 */ "intitemlist ::= intitem", - /* 88 */ "intitem ::= INTEGER", - /* 89 */ "keep ::= KEEP intitemlist", - /* 90 */ "cache ::= CACHE INTEGER", - /* 91 */ "replica ::= REPLICA INTEGER", - /* 92 */ "quorum ::= QUORUM INTEGER", - /* 93 */ "days ::= DAYS INTEGER", - /* 94 */ "minrows ::= MINROWS INTEGER", - /* 95 */ "maxrows ::= MAXROWS INTEGER", - /* 96 */ "blocks ::= BLOCKS INTEGER", - /* 97 */ "ctime ::= CTIME INTEGER", - /* 98 */ "wal ::= WAL INTEGER", - /* 99 */ "fsync ::= FSYNC INTEGER", - /* 100 */ "comp ::= COMP INTEGER", - /* 101 */ "prec ::= PRECISION STRING", - /* 102 */ "update ::= UPDATE INTEGER", - /* 103 */ "cachelast ::= CACHELAST INTEGER", - /* 104 */ "partitions ::= PARTITIONS INTEGER", - /* 105 */ "db_optr ::=", - /* 106 */ "db_optr ::= db_optr cache", - /* 107 */ "db_optr ::= db_optr replica", - /* 108 */ "db_optr ::= db_optr quorum", - /* 109 */ "db_optr ::= db_optr days", - /* 110 */ "db_optr ::= db_optr minrows", - /* 111 */ "db_optr ::= db_optr maxrows", - /* 112 */ "db_optr ::= db_optr blocks", - /* 113 */ "db_optr ::= db_optr ctime", - /* 114 */ "db_optr ::= db_optr wal", - /* 115 */ "db_optr ::= db_optr fsync", - /* 116 */ "db_optr ::= db_optr comp", - /* 117 */ "db_optr ::= db_optr prec", - /* 118 */ "db_optr ::= db_optr keep", - /* 119 */ "db_optr ::= db_optr update", - /* 120 */ "db_optr ::= db_optr cachelast", - /* 121 */ "topic_optr ::= db_optr", - /* 122 */ "topic_optr ::= topic_optr partitions", - /* 123 */ "alter_db_optr ::=", - /* 124 */ "alter_db_optr ::= alter_db_optr replica", - /* 125 */ "alter_db_optr ::= alter_db_optr quorum", - /* 126 */ "alter_db_optr ::= alter_db_optr keep", - /* 127 */ "alter_db_optr ::= alter_db_optr blocks", - /* 128 */ "alter_db_optr ::= alter_db_optr comp", - /* 129 */ "alter_db_optr ::= alter_db_optr update", - /* 130 */ "alter_db_optr ::= alter_db_optr cachelast", - /* 131 */ "alter_topic_optr ::= alter_db_optr", - /* 132 */ "alter_topic_optr ::= alter_topic_optr partitions", - /* 133 */ "typename ::= ids", - /* 134 */ "typename ::= ids LP signed RP", - /* 135 */ "typename ::= ids UNSIGNED", - /* 136 */ "signed ::= INTEGER", - /* 137 */ "signed ::= PLUS INTEGER", - /* 138 */ "signed ::= MINUS INTEGER", - /* 139 */ "cmd ::= CREATE TABLE create_table_args", - /* 140 */ "cmd ::= CREATE TABLE create_stable_args", - /* 141 */ "cmd ::= CREATE STABLE create_stable_args", - /* 142 */ "cmd ::= CREATE TABLE create_table_list", - /* 143 */ "create_table_list ::= create_from_stable", - /* 144 */ "create_table_list ::= create_table_list create_from_stable", - /* 145 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", - /* 146 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", - /* 147 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", - /* 148 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP", - /* 149 */ "tagNamelist ::= tagNamelist COMMA ids", - /* 150 */ "tagNamelist ::= ids", - /* 151 */ "create_table_args ::= ifnotexists ids cpxName AS select", - /* 152 */ "columnlist ::= columnlist COMMA column", - /* 153 */ "columnlist ::= column", - /* 154 */ "column ::= ids typename", - /* 155 */ "tagitemlist ::= tagitemlist COMMA tagitem", - /* 156 */ "tagitemlist ::= tagitem", - /* 157 */ "tagitem ::= INTEGER", - /* 158 */ "tagitem ::= FLOAT", - /* 159 */ "tagitem ::= STRING", - /* 160 */ "tagitem ::= BOOL", - /* 161 */ "tagitem ::= NULL", - /* 162 */ "tagitem ::= NOW", - /* 163 */ "tagitem ::= MINUS INTEGER", - /* 164 */ "tagitem ::= MINUS FLOAT", - /* 165 */ "tagitem ::= PLUS INTEGER", - /* 166 */ "tagitem ::= PLUS FLOAT", - /* 167 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", - /* 168 */ "select ::= LP select RP", - /* 169 */ "union ::= select", - /* 170 */ "union ::= union UNION ALL select", - /* 171 */ "cmd ::= union", - /* 172 */ "select ::= SELECT selcollist", - /* 173 */ "sclp ::= selcollist COMMA", - /* 174 */ "sclp ::=", - /* 175 */ "selcollist ::= sclp distinct expr as", - /* 176 */ "selcollist ::= sclp STAR", - /* 177 */ "as ::= AS ids", - /* 178 */ "as ::= ids", - /* 179 */ "as ::=", - /* 180 */ "distinct ::= DISTINCT", - /* 181 */ "distinct ::=", - /* 182 */ "from ::= FROM tablelist", - /* 183 */ "from ::= FROM sub", - /* 184 */ "sub ::= LP union RP", - /* 185 */ "sub ::= LP union RP ids", - /* 186 */ "sub ::= sub COMMA LP union RP ids", - /* 187 */ "tablelist ::= ids cpxName", - /* 188 */ "tablelist ::= ids cpxName ids", - /* 189 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 190 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 191 */ "tmvar ::= VARIABLE", - /* 192 */ "interval_option ::= intervalKey LP tmvar RP", - /* 193 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", - /* 194 */ "interval_option ::=", - /* 195 */ "intervalKey ::= INTERVAL", - /* 196 */ "intervalKey ::= EVERY", - /* 197 */ "session_option ::=", - /* 198 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", - /* 199 */ "windowstate_option ::=", - /* 200 */ "windowstate_option ::= STATE_WINDOW LP ids RP", - /* 201 */ "fill_opt ::=", - /* 202 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 203 */ "fill_opt ::= FILL LP ID RP", - /* 204 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 205 */ "sliding_opt ::=", - /* 206 */ "orderby_opt ::=", - /* 207 */ "orderby_opt ::= ORDER BY sortlist", - /* 208 */ "sortlist ::= sortlist COMMA item sortorder", - /* 209 */ "sortlist ::= sortlist COMMA arrow sortorder", - /* 210 */ "sortlist ::= item sortorder", - /* 211 */ "sortlist ::= arrow sortorder", - /* 212 */ "item ::= ID", - /* 213 */ "item ::= ID DOT ID", - /* 214 */ "sortorder ::= ASC", - /* 215 */ "sortorder ::= DESC", - /* 216 */ "sortorder ::=", - /* 217 */ "groupby_opt ::=", - /* 218 */ "groupby_opt ::= GROUP BY grouplist", - /* 219 */ "grouplist ::= grouplist COMMA item", - /* 220 */ "grouplist ::= grouplist COMMA arrow", - /* 221 */ "grouplist ::= item", - /* 222 */ "grouplist ::= arrow", - /* 223 */ "having_opt ::=", - /* 224 */ "having_opt ::= HAVING expr", - /* 225 */ "limit_opt ::=", - /* 226 */ "limit_opt ::= LIMIT signed", - /* 227 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 228 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 229 */ "slimit_opt ::=", - /* 230 */ "slimit_opt ::= SLIMIT signed", - /* 231 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 232 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 233 */ "where_opt ::=", - /* 234 */ "where_opt ::= WHERE expr", - /* 235 */ "expr ::= LP expr RP", - /* 236 */ "expr ::= ID", - /* 237 */ "expr ::= ID DOT ID", - /* 238 */ "expr ::= ID DOT STAR", - /* 239 */ "expr ::= INTEGER", - /* 240 */ "expr ::= MINUS INTEGER", - /* 241 */ "expr ::= PLUS INTEGER", - /* 242 */ "expr ::= FLOAT", - /* 243 */ "expr ::= MINUS FLOAT", - /* 244 */ "expr ::= PLUS FLOAT", - /* 245 */ "expr ::= STRING", - /* 246 */ "expr ::= NOW", - /* 247 */ "expr ::= VARIABLE", - /* 248 */ "expr ::= PLUS VARIABLE", - /* 249 */ "expr ::= MINUS VARIABLE", - /* 250 */ "expr ::= BOOL", - /* 251 */ "expr ::= NULL", - /* 252 */ "expr ::= ID LP exprlist RP", - /* 253 */ "expr ::= ID LP STAR RP", - /* 254 */ "expr ::= expr IS NULL", - /* 255 */ "expr ::= expr IS NOT NULL", - /* 256 */ "expr ::= expr LT expr", - /* 257 */ "expr ::= expr GT expr", - /* 258 */ "expr ::= expr LE expr", - /* 259 */ "expr ::= expr GE expr", - /* 260 */ "expr ::= expr NE expr", - /* 261 */ "expr ::= expr EQ expr", - /* 262 */ "expr ::= expr BETWEEN expr AND expr", - /* 263 */ "expr ::= expr AND expr", - /* 264 */ "expr ::= expr OR expr", - /* 265 */ "expr ::= expr PLUS expr", - /* 266 */ "expr ::= expr MINUS expr", - /* 267 */ "expr ::= expr STAR expr", - /* 268 */ "expr ::= expr SLASH expr", - /* 269 */ "expr ::= expr REM expr", - /* 270 */ "expr ::= expr LIKE expr", - /* 271 */ "expr ::= expr MATCH expr", - /* 272 */ "expr ::= expr NMATCH expr", - /* 273 */ "expr ::= ID QUESTION STRING", - /* 274 */ "arrow ::= ID ARROW STRING", - /* 275 */ "arrow ::= ID DOT ID ARROW STRING", - /* 276 */ "expr ::= arrow", - /* 277 */ "expr ::= expr IN LP exprlist RP", - /* 278 */ "exprlist ::= exprlist COMMA expritem", - /* 279 */ "exprlist ::= expritem", - /* 280 */ "expritem ::= expr", - /* 281 */ "expritem ::=", - /* 282 */ "cmd ::= RESET QUERY CACHE", - /* 283 */ "cmd ::= SYNCDB ids REPLICA", - /* 284 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 285 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 286 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 287 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 288 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 289 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 290 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 291 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 292 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 293 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 294 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 295 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 296 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 297 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 298 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 299 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 300 */ "cmd ::= KILL CONNECTION INTEGER", - /* 301 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 302 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 29 */ "cmd ::= DROP TABLE ifexists ids cpxName", + /* 30 */ "cmd ::= DROP STABLE ifexists ids cpxName", + /* 31 */ "cmd ::= DROP DATABASE ifexists ids", + /* 32 */ "cmd ::= DROP TOPIC ifexists ids", + /* 33 */ "cmd ::= DROP FUNCTION ids", + /* 34 */ "cmd ::= DROP DNODE ids", + /* 35 */ "cmd ::= DROP USER ids", + /* 36 */ "cmd ::= DROP ACCOUNT ids", + /* 37 */ "cmd ::= USE ids", + /* 38 */ "cmd ::= DESCRIBE ids cpxName", + /* 39 */ "cmd ::= DESC ids cpxName", + /* 40 */ "cmd ::= ALTER USER ids PASS ids", + /* 41 */ "cmd ::= ALTER USER ids PRIVILEGE ids", + /* 42 */ "cmd ::= ALTER DNODE ids ids", + /* 43 */ "cmd ::= ALTER DNODE ids ids ids", + /* 44 */ "cmd ::= ALTER LOCAL ids", + /* 45 */ "cmd ::= ALTER LOCAL ids ids", + /* 46 */ "cmd ::= ALTER DATABASE ids alter_db_optr", + /* 47 */ "cmd ::= ALTER TOPIC ids alter_topic_optr", + /* 48 */ "cmd ::= ALTER ACCOUNT ids acct_optr", + /* 49 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr", + /* 50 */ "cmd ::= COMPACT VNODES IN LP exprlist RP", + /* 51 */ "ids ::= ID", + /* 52 */ "ids ::= STRING", + /* 53 */ "ifexists ::= IF EXISTS", + /* 54 */ "ifexists ::=", + /* 55 */ "ifnotexists ::= IF NOT EXISTS", + /* 56 */ "ifnotexists ::=", + /* 57 */ "cmd ::= CREATE DNODE ids", + /* 58 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr", + /* 59 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr", + /* 60 */ "cmd ::= CREATE TOPIC ifnotexists ids topic_optr", + /* 61 */ "cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize", + /* 62 */ "cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize", + /* 63 */ "cmd ::= CREATE USER ids PASS ids", + /* 64 */ "bufsize ::=", + /* 65 */ "bufsize ::= BUFSIZE INTEGER", + /* 66 */ "pps ::=", + /* 67 */ "pps ::= PPS INTEGER", + /* 68 */ "tseries ::=", + /* 69 */ "tseries ::= TSERIES INTEGER", + /* 70 */ "dbs ::=", + /* 71 */ "dbs ::= DBS INTEGER", + /* 72 */ "streams ::=", + /* 73 */ "streams ::= STREAMS INTEGER", + /* 74 */ "storage ::=", + /* 75 */ "storage ::= STORAGE INTEGER", + /* 76 */ "qtime ::=", + /* 77 */ "qtime ::= QTIME INTEGER", + /* 78 */ "users ::=", + /* 79 */ "users ::= USERS INTEGER", + /* 80 */ "conns ::=", + /* 81 */ "conns ::= CONNS INTEGER", + /* 82 */ "state ::=", + /* 83 */ "state ::= STATE ids", + /* 84 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state", + /* 85 */ "intitemlist ::= intitemlist COMMA intitem", + /* 86 */ "intitemlist ::= intitem", + /* 87 */ "intitem ::= INTEGER", + /* 88 */ "keep ::= KEEP intitemlist", + /* 89 */ "cache ::= CACHE INTEGER", + /* 90 */ "replica ::= REPLICA INTEGER", + /* 91 */ "quorum ::= QUORUM INTEGER", + /* 92 */ "days ::= DAYS INTEGER", + /* 93 */ "minrows ::= MINROWS INTEGER", + /* 94 */ "maxrows ::= MAXROWS INTEGER", + /* 95 */ "blocks ::= BLOCKS INTEGER", + /* 96 */ "ctime ::= CTIME INTEGER", + /* 97 */ "wal ::= WAL INTEGER", + /* 98 */ "fsync ::= FSYNC INTEGER", + /* 99 */ "comp ::= COMP INTEGER", + /* 100 */ "prec ::= PRECISION STRING", + /* 101 */ "update ::= UPDATE INTEGER", + /* 102 */ "cachelast ::= CACHELAST INTEGER", + /* 103 */ "partitions ::= PARTITIONS INTEGER", + /* 104 */ "db_optr ::=", + /* 105 */ "db_optr ::= db_optr cache", + /* 106 */ "db_optr ::= db_optr replica", + /* 107 */ "db_optr ::= db_optr quorum", + /* 108 */ "db_optr ::= db_optr days", + /* 109 */ "db_optr ::= db_optr minrows", + /* 110 */ "db_optr ::= db_optr maxrows", + /* 111 */ "db_optr ::= db_optr blocks", + /* 112 */ "db_optr ::= db_optr ctime", + /* 113 */ "db_optr ::= db_optr wal", + /* 114 */ "db_optr ::= db_optr fsync", + /* 115 */ "db_optr ::= db_optr comp", + /* 116 */ "db_optr ::= db_optr prec", + /* 117 */ "db_optr ::= db_optr keep", + /* 118 */ "db_optr ::= db_optr update", + /* 119 */ "db_optr ::= db_optr cachelast", + /* 120 */ "topic_optr ::= db_optr", + /* 121 */ "topic_optr ::= topic_optr partitions", + /* 122 */ "alter_db_optr ::=", + /* 123 */ "alter_db_optr ::= alter_db_optr replica", + /* 124 */ "alter_db_optr ::= alter_db_optr quorum", + /* 125 */ "alter_db_optr ::= alter_db_optr keep", + /* 126 */ "alter_db_optr ::= alter_db_optr blocks", + /* 127 */ "alter_db_optr ::= alter_db_optr comp", + /* 128 */ "alter_db_optr ::= alter_db_optr update", + /* 129 */ "alter_db_optr ::= alter_db_optr cachelast", + /* 130 */ "alter_topic_optr ::= alter_db_optr", + /* 131 */ "alter_topic_optr ::= alter_topic_optr partitions", + /* 132 */ "typename ::= ids", + /* 133 */ "typename ::= ids LP signed RP", + /* 134 */ "typename ::= ids UNSIGNED", + /* 135 */ "signed ::= INTEGER", + /* 136 */ "signed ::= PLUS INTEGER", + /* 137 */ "signed ::= MINUS INTEGER", + /* 138 */ "cmd ::= CREATE TABLE create_table_args", + /* 139 */ "cmd ::= CREATE TABLE create_stable_args", + /* 140 */ "cmd ::= CREATE STABLE create_stable_args", + /* 141 */ "cmd ::= CREATE TABLE create_table_list", + /* 142 */ "create_table_list ::= create_from_stable", + /* 143 */ "create_table_list ::= create_table_list create_from_stable", + /* 144 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", + /* 145 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", + /* 146 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", + /* 147 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP", + /* 148 */ "tagNamelist ::= tagNamelist COMMA ids", + /* 149 */ "tagNamelist ::= ids", + /* 150 */ "create_table_args ::= ifnotexists ids cpxName AS select", + /* 151 */ "columnlist ::= columnlist COMMA column", + /* 152 */ "columnlist ::= column", + /* 153 */ "column ::= ids typename", + /* 154 */ "tagitemlist ::= tagitemlist COMMA tagitem", + /* 155 */ "tagitemlist ::= tagitem", + /* 156 */ "tagitem ::= INTEGER", + /* 157 */ "tagitem ::= FLOAT", + /* 158 */ "tagitem ::= STRING", + /* 159 */ "tagitem ::= BOOL", + /* 160 */ "tagitem ::= NULL", + /* 161 */ "tagitem ::= NOW", + /* 162 */ "tagitem ::= MINUS INTEGER", + /* 163 */ "tagitem ::= MINUS FLOAT", + /* 164 */ "tagitem ::= PLUS INTEGER", + /* 165 */ "tagitem ::= PLUS FLOAT", + /* 166 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", + /* 167 */ "select ::= LP select RP", + /* 168 */ "union ::= select", + /* 169 */ "union ::= union UNION ALL select", + /* 170 */ "cmd ::= union", + /* 171 */ "select ::= SELECT selcollist", + /* 172 */ "sclp ::= selcollist COMMA", + /* 173 */ "sclp ::=", + /* 174 */ "selcollist ::= sclp distinct expr as", + /* 175 */ "selcollist ::= sclp STAR", + /* 176 */ "as ::= AS ids", + /* 177 */ "as ::= ids", + /* 178 */ "as ::=", + /* 179 */ "distinct ::= DISTINCT", + /* 180 */ "distinct ::=", + /* 181 */ "from ::= FROM tablelist", + /* 182 */ "from ::= FROM sub", + /* 183 */ "sub ::= LP union RP", + /* 184 */ "sub ::= LP union RP ids", + /* 185 */ "sub ::= sub COMMA LP union RP ids", + /* 186 */ "tablelist ::= ids cpxName", + /* 187 */ "tablelist ::= ids cpxName ids", + /* 188 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 189 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 190 */ "tmvar ::= VARIABLE", + /* 191 */ "timestamp ::= INTEGER", + /* 192 */ "timestamp ::= MINUS INTEGER", + /* 193 */ "timestamp ::= PLUS INTEGER", + /* 194 */ "timestamp ::= STRING", + /* 195 */ "timestamp ::= NOW", + /* 196 */ "timestamp ::= NOW PLUS VARIABLE", + /* 197 */ "timestamp ::= NOW MINUS VARIABLE", + /* 198 */ "range_option ::=", + /* 199 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP", + /* 200 */ "interval_option ::= intervalKey LP tmvar RP", + /* 201 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", + /* 202 */ "interval_option ::=", + /* 203 */ "intervalKey ::= INTERVAL", + /* 204 */ "intervalKey ::= EVERY", + /* 205 */ "session_option ::=", + /* 206 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", + /* 207 */ "windowstate_option ::=", + /* 208 */ "windowstate_option ::= STATE_WINDOW LP ids RP", + /* 209 */ "fill_opt ::=", + /* 210 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 211 */ "fill_opt ::= FILL LP ID RP", + /* 212 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 213 */ "sliding_opt ::=", + /* 214 */ "orderby_opt ::=", + /* 215 */ "orderby_opt ::= ORDER BY sortlist", + /* 216 */ "sortlist ::= sortlist COMMA item sortorder", + /* 217 */ "sortlist ::= sortlist COMMA arrow sortorder", + /* 218 */ "sortlist ::= item sortorder", + /* 219 */ "sortlist ::= arrow sortorder", + /* 220 */ "item ::= ID", + /* 221 */ "item ::= ID DOT ID", + /* 222 */ "sortorder ::= ASC", + /* 223 */ "sortorder ::= DESC", + /* 224 */ "sortorder ::=", + /* 225 */ "groupby_opt ::=", + /* 226 */ "groupby_opt ::= GROUP BY grouplist", + /* 227 */ "grouplist ::= grouplist COMMA item", + /* 228 */ "grouplist ::= grouplist COMMA arrow", + /* 229 */ "grouplist ::= item", + /* 230 */ "grouplist ::= arrow", + /* 231 */ "having_opt ::=", + /* 232 */ "having_opt ::= HAVING expr", + /* 233 */ "limit_opt ::=", + /* 234 */ "limit_opt ::= LIMIT signed", + /* 235 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 236 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 237 */ "slimit_opt ::=", + /* 238 */ "slimit_opt ::= SLIMIT signed", + /* 239 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 240 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 241 */ "where_opt ::=", + /* 242 */ "where_opt ::= WHERE expr", + /* 243 */ "expr ::= LP expr RP", + /* 244 */ "expr ::= ID", + /* 245 */ "expr ::= ID DOT ID", + /* 246 */ "expr ::= ID DOT STAR", + /* 247 */ "expr ::= INTEGER", + /* 248 */ "expr ::= MINUS INTEGER", + /* 249 */ "expr ::= PLUS INTEGER", + /* 250 */ "expr ::= FLOAT", + /* 251 */ "expr ::= MINUS FLOAT", + /* 252 */ "expr ::= PLUS FLOAT", + /* 253 */ "expr ::= STRING", + /* 254 */ "expr ::= NOW", + /* 255 */ "expr ::= VARIABLE", + /* 256 */ "expr ::= PLUS VARIABLE", + /* 257 */ "expr ::= MINUS VARIABLE", + /* 258 */ "expr ::= BOOL", + /* 259 */ "expr ::= NULL", + /* 260 */ "expr ::= ID LP exprlist RP", + /* 261 */ "expr ::= ID LP STAR RP", + /* 262 */ "expr ::= expr IS NULL", + /* 263 */ "expr ::= expr IS NOT NULL", + /* 264 */ "expr ::= expr LT expr", + /* 265 */ "expr ::= expr GT expr", + /* 266 */ "expr ::= expr LE expr", + /* 267 */ "expr ::= expr GE expr", + /* 268 */ "expr ::= expr NE expr", + /* 269 */ "expr ::= expr EQ expr", + /* 270 */ "expr ::= expr BETWEEN expr AND expr", + /* 271 */ "expr ::= expr AND expr", + /* 272 */ "expr ::= expr OR expr", + /* 273 */ "expr ::= expr PLUS expr", + /* 274 */ "expr ::= expr MINUS expr", + /* 275 */ "expr ::= expr STAR expr", + /* 276 */ "expr ::= expr SLASH expr", + /* 277 */ "expr ::= expr REM expr", + /* 278 */ "expr ::= expr LIKE expr", + /* 279 */ "expr ::= expr MATCH expr", + /* 280 */ "expr ::= expr NMATCH expr", + /* 281 */ "expr ::= ID QUESTION STRING", + /* 282 */ "arrow ::= ID ARROW STRING", + /* 283 */ "arrow ::= ID DOT ID ARROW STRING", + /* 284 */ "expr ::= arrow", + /* 285 */ "expr ::= expr IN LP exprlist RP", + /* 286 */ "exprlist ::= exprlist COMMA expritem", + /* 287 */ "exprlist ::= expritem", + /* 288 */ "expritem ::= expr", + /* 289 */ "expritem ::=", + /* 290 */ "cmd ::= RESET QUERY CACHE", + /* 291 */ "cmd ::= SYNCDB ids REPLICA", + /* 292 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 293 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 294 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 295 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 296 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 297 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 298 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 299 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 300 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 301 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 302 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 303 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 304 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 305 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 306 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 307 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 308 */ "cmd ::= KILL CONNECTION INTEGER", + /* 309 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 310 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1740,70 +1755,57 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 210: /* exprlist */ - case 254: /* selcollist */ - case 268: /* sclp */ + case 211: /* exprlist */ + case 255: /* selcollist */ + case 270: /* sclp */ { -#line 787 "sql.y" -tSqlExprListDestroy((yypminor->yy345)); -#line 1749 "sql.c" +tSqlExprListDestroy((yypminor->yy231)); } break; - case 225: /* intitemlist */ - case 227: /* keep */ - case 248: /* columnlist */ - case 249: /* tagitemlist */ - case 250: /* tagNamelist */ - case 261: /* fill_opt */ - case 262: /* groupby_opt */ - case 264: /* orderby_opt */ - case 276: /* sortlist */ - case 280: /* grouplist */ + case 226: /* intitemlist */ + case 228: /* keep */ + case 249: /* columnlist */ + case 250: /* tagitemlist */ + case 251: /* tagNamelist */ + case 263: /* fill_opt */ + case 264: /* groupby_opt */ + case 266: /* orderby_opt */ + case 279: /* sortlist */ + case 283: /* grouplist */ { -#line 257 "sql.y" -taosArrayDestroy((yypminor->yy345)); -#line 1765 "sql.c" +taosArrayDestroy((yypminor->yy231)); } break; - case 246: /* create_table_list */ + case 247: /* create_table_list */ { -#line 365 "sql.y" -destroyCreateTableSql((yypminor->yy170)); -#line 1772 "sql.c" +destroyCreateTableSql((yypminor->yy422)); } break; - case 251: /* select */ + case 252: /* select */ { -#line 485 "sql.y" -destroySqlNode((yypminor->yy68)); -#line 1779 "sql.c" +destroySqlNode((yypminor->yy86)); } break; - case 255: /* from */ - case 272: /* tablelist */ - case 273: /* sub */ + case 256: /* from */ + case 274: /* tablelist */ + case 275: /* sub */ { -#line 540 "sql.y" destroyRelationInfo((yypminor->yy484)); -#line 1788 "sql.c" } break; - case 256: /* where_opt */ - case 263: /* having_opt */ - case 270: /* expr */ - case 279: /* arrow */ - case 281: /* expritem */ + case 257: /* where_opt */ + case 265: /* having_opt */ + case 272: /* expr */ + case 277: /* timestamp */ + case 282: /* arrow */ + case 284: /* expritem */ { -#line 705 "sql.y" -tSqlExprDestroy((yypminor->yy418)); -#line 1799 "sql.c" +tSqlExprDestroy((yypminor->yy226)); } break; - case 267: /* union */ + case 269: /* union */ { -#line 493 "sql.y" -destroyAllSqlNode((yypminor->yy345)); -#line 1806 "sql.c" +destroyAllSqlNode((yypminor->yy231)); } break; /********* End destructor definitions *****************************************/ @@ -2092,309 +2094,317 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 201, /* (0) program ::= cmd */ - 202, /* (1) cmd ::= SHOW DATABASES */ - 202, /* (2) cmd ::= SHOW TOPICS */ - 202, /* (3) cmd ::= SHOW FUNCTIONS */ - 202, /* (4) cmd ::= SHOW MNODES */ - 202, /* (5) cmd ::= SHOW DNODES */ - 202, /* (6) cmd ::= SHOW ACCOUNTS */ - 202, /* (7) cmd ::= SHOW USERS */ - 202, /* (8) cmd ::= SHOW MODULES */ - 202, /* (9) cmd ::= SHOW QUERIES */ - 202, /* (10) cmd ::= SHOW CONNECTIONS */ - 202, /* (11) cmd ::= SHOW STREAMS */ - 202, /* (12) cmd ::= SHOW VARIABLES */ - 202, /* (13) cmd ::= SHOW SCORES */ - 202, /* (14) cmd ::= SHOW GRANTS */ - 202, /* (15) cmd ::= SHOW VNODES */ - 202, /* (16) cmd ::= SHOW VNODES ids */ - 204, /* (17) dbPrefix ::= */ - 204, /* (18) dbPrefix ::= ids DOT */ - 205, /* (19) cpxName ::= */ - 205, /* (20) cpxName ::= DOT ids */ - 202, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ - 202, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ - 202, /* (23) cmd ::= SHOW CREATE DATABASE ids */ - 202, /* (24) cmd ::= SHOW dbPrefix TABLES */ - 202, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - 202, /* (26) cmd ::= SHOW dbPrefix STABLES */ - 202, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - 202, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - 202, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ - 202, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ - 202, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ - 202, /* (32) cmd ::= DROP DATABASE ifexists ids */ - 202, /* (33) cmd ::= DROP TOPIC ifexists ids */ - 202, /* (34) cmd ::= DROP FUNCTION ids */ - 202, /* (35) cmd ::= DROP DNODE ids */ - 202, /* (36) cmd ::= DROP USER ids */ - 202, /* (37) cmd ::= DROP ACCOUNT ids */ - 202, /* (38) cmd ::= USE ids */ - 202, /* (39) cmd ::= DESCRIBE ids cpxName */ - 202, /* (40) cmd ::= DESC ids cpxName */ - 202, /* (41) cmd ::= ALTER USER ids PASS ids */ - 202, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ - 202, /* (43) cmd ::= ALTER DNODE ids ids */ - 202, /* (44) cmd ::= ALTER DNODE ids ids ids */ - 202, /* (45) cmd ::= ALTER LOCAL ids */ - 202, /* (46) cmd ::= ALTER LOCAL ids ids */ - 202, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ - 202, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ - 202, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ - 202, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - 202, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ - 203, /* (52) ids ::= ID */ - 203, /* (53) ids ::= STRING */ - 206, /* (54) ifexists ::= IF EXISTS */ - 206, /* (55) ifexists ::= */ - 211, /* (56) ifnotexists ::= IF NOT EXISTS */ - 211, /* (57) ifnotexists ::= */ - 202, /* (58) cmd ::= CREATE DNODE ids */ - 202, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - 202, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - 202, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - 202, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - 202, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - 202, /* (64) cmd ::= CREATE USER ids PASS ids */ - 215, /* (65) bufsize ::= */ - 215, /* (66) bufsize ::= BUFSIZE INTEGER */ - 216, /* (67) pps ::= */ - 216, /* (68) pps ::= PPS INTEGER */ - 217, /* (69) tseries ::= */ - 217, /* (70) tseries ::= TSERIES INTEGER */ - 218, /* (71) dbs ::= */ - 218, /* (72) dbs ::= DBS INTEGER */ - 219, /* (73) streams ::= */ - 219, /* (74) streams ::= STREAMS INTEGER */ - 220, /* (75) storage ::= */ - 220, /* (76) storage ::= STORAGE INTEGER */ - 221, /* (77) qtime ::= */ - 221, /* (78) qtime ::= QTIME INTEGER */ - 222, /* (79) users ::= */ - 222, /* (80) users ::= USERS INTEGER */ - 223, /* (81) conns ::= */ - 223, /* (82) conns ::= CONNS INTEGER */ - 224, /* (83) state ::= */ - 224, /* (84) state ::= STATE ids */ - 209, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - 225, /* (86) intitemlist ::= intitemlist COMMA intitem */ - 225, /* (87) intitemlist ::= intitem */ - 226, /* (88) intitem ::= INTEGER */ - 227, /* (89) keep ::= KEEP intitemlist */ - 228, /* (90) cache ::= CACHE INTEGER */ - 229, /* (91) replica ::= REPLICA INTEGER */ - 230, /* (92) quorum ::= QUORUM INTEGER */ - 231, /* (93) days ::= DAYS INTEGER */ - 232, /* (94) minrows ::= MINROWS INTEGER */ - 233, /* (95) maxrows ::= MAXROWS INTEGER */ - 234, /* (96) blocks ::= BLOCKS INTEGER */ - 235, /* (97) ctime ::= CTIME INTEGER */ - 236, /* (98) wal ::= WAL INTEGER */ - 237, /* (99) fsync ::= FSYNC INTEGER */ - 238, /* (100) comp ::= COMP INTEGER */ - 239, /* (101) prec ::= PRECISION STRING */ - 240, /* (102) update ::= UPDATE INTEGER */ - 241, /* (103) cachelast ::= CACHELAST INTEGER */ - 242, /* (104) partitions ::= PARTITIONS INTEGER */ - 212, /* (105) db_optr ::= */ - 212, /* (106) db_optr ::= db_optr cache */ - 212, /* (107) db_optr ::= db_optr replica */ - 212, /* (108) db_optr ::= db_optr quorum */ - 212, /* (109) db_optr ::= db_optr days */ - 212, /* (110) db_optr ::= db_optr minrows */ - 212, /* (111) db_optr ::= db_optr maxrows */ - 212, /* (112) db_optr ::= db_optr blocks */ - 212, /* (113) db_optr ::= db_optr ctime */ - 212, /* (114) db_optr ::= db_optr wal */ - 212, /* (115) db_optr ::= db_optr fsync */ - 212, /* (116) db_optr ::= db_optr comp */ - 212, /* (117) db_optr ::= db_optr prec */ - 212, /* (118) db_optr ::= db_optr keep */ - 212, /* (119) db_optr ::= db_optr update */ - 212, /* (120) db_optr ::= db_optr cachelast */ - 213, /* (121) topic_optr ::= db_optr */ - 213, /* (122) topic_optr ::= topic_optr partitions */ - 207, /* (123) alter_db_optr ::= */ - 207, /* (124) alter_db_optr ::= alter_db_optr replica */ - 207, /* (125) alter_db_optr ::= alter_db_optr quorum */ - 207, /* (126) alter_db_optr ::= alter_db_optr keep */ - 207, /* (127) alter_db_optr ::= alter_db_optr blocks */ - 207, /* (128) alter_db_optr ::= alter_db_optr comp */ - 207, /* (129) alter_db_optr ::= alter_db_optr update */ - 207, /* (130) alter_db_optr ::= alter_db_optr cachelast */ - 208, /* (131) alter_topic_optr ::= alter_db_optr */ - 208, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ - 214, /* (133) typename ::= ids */ - 214, /* (134) typename ::= ids LP signed RP */ - 214, /* (135) typename ::= ids UNSIGNED */ - 243, /* (136) signed ::= INTEGER */ - 243, /* (137) signed ::= PLUS INTEGER */ - 243, /* (138) signed ::= MINUS INTEGER */ - 202, /* (139) cmd ::= CREATE TABLE create_table_args */ - 202, /* (140) cmd ::= CREATE TABLE create_stable_args */ - 202, /* (141) cmd ::= CREATE STABLE create_stable_args */ - 202, /* (142) cmd ::= CREATE TABLE create_table_list */ - 246, /* (143) create_table_list ::= create_from_stable */ - 246, /* (144) create_table_list ::= create_table_list create_from_stable */ - 244, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - 245, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - 247, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - 247, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - 250, /* (149) tagNamelist ::= tagNamelist COMMA ids */ - 250, /* (150) tagNamelist ::= ids */ - 244, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ - 248, /* (152) columnlist ::= columnlist COMMA column */ - 248, /* (153) columnlist ::= column */ - 252, /* (154) column ::= ids typename */ - 249, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ - 249, /* (156) tagitemlist ::= tagitem */ - 253, /* (157) tagitem ::= INTEGER */ - 253, /* (158) tagitem ::= FLOAT */ - 253, /* (159) tagitem ::= STRING */ - 253, /* (160) tagitem ::= BOOL */ - 253, /* (161) tagitem ::= NULL */ - 253, /* (162) tagitem ::= NOW */ - 253, /* (163) tagitem ::= MINUS INTEGER */ - 253, /* (164) tagitem ::= MINUS FLOAT */ - 253, /* (165) tagitem ::= PLUS INTEGER */ - 253, /* (166) tagitem ::= PLUS FLOAT */ - 251, /* (167) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - 251, /* (168) select ::= LP select RP */ - 267, /* (169) union ::= select */ - 267, /* (170) union ::= union UNION ALL select */ - 202, /* (171) cmd ::= union */ - 251, /* (172) select ::= SELECT selcollist */ - 268, /* (173) sclp ::= selcollist COMMA */ - 268, /* (174) sclp ::= */ - 254, /* (175) selcollist ::= sclp distinct expr as */ - 254, /* (176) selcollist ::= sclp STAR */ - 271, /* (177) as ::= AS ids */ - 271, /* (178) as ::= ids */ - 271, /* (179) as ::= */ - 269, /* (180) distinct ::= DISTINCT */ - 269, /* (181) distinct ::= */ - 255, /* (182) from ::= FROM tablelist */ - 255, /* (183) from ::= FROM sub */ - 273, /* (184) sub ::= LP union RP */ - 273, /* (185) sub ::= LP union RP ids */ - 273, /* (186) sub ::= sub COMMA LP union RP ids */ - 272, /* (187) tablelist ::= ids cpxName */ - 272, /* (188) tablelist ::= ids cpxName ids */ - 272, /* (189) tablelist ::= tablelist COMMA ids cpxName */ - 272, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ - 274, /* (191) tmvar ::= VARIABLE */ - 257, /* (192) interval_option ::= intervalKey LP tmvar RP */ - 257, /* (193) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - 257, /* (194) interval_option ::= */ - 275, /* (195) intervalKey ::= INTERVAL */ - 275, /* (196) intervalKey ::= EVERY */ - 259, /* (197) session_option ::= */ - 259, /* (198) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - 260, /* (199) windowstate_option ::= */ - 260, /* (200) windowstate_option ::= STATE_WINDOW LP ids RP */ - 261, /* (201) fill_opt ::= */ - 261, /* (202) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - 261, /* (203) fill_opt ::= FILL LP ID RP */ - 258, /* (204) sliding_opt ::= SLIDING LP tmvar RP */ - 258, /* (205) sliding_opt ::= */ - 264, /* (206) orderby_opt ::= */ - 264, /* (207) orderby_opt ::= ORDER BY sortlist */ - 276, /* (208) sortlist ::= sortlist COMMA item sortorder */ - 276, /* (209) sortlist ::= sortlist COMMA arrow sortorder */ - 276, /* (210) sortlist ::= item sortorder */ - 276, /* (211) sortlist ::= arrow sortorder */ - 277, /* (212) item ::= ID */ - 277, /* (213) item ::= ID DOT ID */ - 278, /* (214) sortorder ::= ASC */ - 278, /* (215) sortorder ::= DESC */ - 278, /* (216) sortorder ::= */ - 262, /* (217) groupby_opt ::= */ - 262, /* (218) groupby_opt ::= GROUP BY grouplist */ - 280, /* (219) grouplist ::= grouplist COMMA item */ - 280, /* (220) grouplist ::= grouplist COMMA arrow */ - 280, /* (221) grouplist ::= item */ - 280, /* (222) grouplist ::= arrow */ - 263, /* (223) having_opt ::= */ - 263, /* (224) having_opt ::= HAVING expr */ - 266, /* (225) limit_opt ::= */ - 266, /* (226) limit_opt ::= LIMIT signed */ - 266, /* (227) limit_opt ::= LIMIT signed OFFSET signed */ - 266, /* (228) limit_opt ::= LIMIT signed COMMA signed */ - 265, /* (229) slimit_opt ::= */ - 265, /* (230) slimit_opt ::= SLIMIT signed */ - 265, /* (231) slimit_opt ::= SLIMIT signed SOFFSET signed */ - 265, /* (232) slimit_opt ::= SLIMIT signed COMMA signed */ - 256, /* (233) where_opt ::= */ - 256, /* (234) where_opt ::= WHERE expr */ - 270, /* (235) expr ::= LP expr RP */ - 270, /* (236) expr ::= ID */ - 270, /* (237) expr ::= ID DOT ID */ - 270, /* (238) expr ::= ID DOT STAR */ - 270, /* (239) expr ::= INTEGER */ - 270, /* (240) expr ::= MINUS INTEGER */ - 270, /* (241) expr ::= PLUS INTEGER */ - 270, /* (242) expr ::= FLOAT */ - 270, /* (243) expr ::= MINUS FLOAT */ - 270, /* (244) expr ::= PLUS FLOAT */ - 270, /* (245) expr ::= STRING */ - 270, /* (246) expr ::= NOW */ - 270, /* (247) expr ::= VARIABLE */ - 270, /* (248) expr ::= PLUS VARIABLE */ - 270, /* (249) expr ::= MINUS VARIABLE */ - 270, /* (250) expr ::= BOOL */ - 270, /* (251) expr ::= NULL */ - 270, /* (252) expr ::= ID LP exprlist RP */ - 270, /* (253) expr ::= ID LP STAR RP */ - 270, /* (254) expr ::= expr IS NULL */ - 270, /* (255) expr ::= expr IS NOT NULL */ - 270, /* (256) expr ::= expr LT expr */ - 270, /* (257) expr ::= expr GT expr */ - 270, /* (258) expr ::= expr LE expr */ - 270, /* (259) expr ::= expr GE expr */ - 270, /* (260) expr ::= expr NE expr */ - 270, /* (261) expr ::= expr EQ expr */ - 270, /* (262) expr ::= expr BETWEEN expr AND expr */ - 270, /* (263) expr ::= expr AND expr */ - 270, /* (264) expr ::= expr OR expr */ - 270, /* (265) expr ::= expr PLUS expr */ - 270, /* (266) expr ::= expr MINUS expr */ - 270, /* (267) expr ::= expr STAR expr */ - 270, /* (268) expr ::= expr SLASH expr */ - 270, /* (269) expr ::= expr REM expr */ - 270, /* (270) expr ::= expr LIKE expr */ - 270, /* (271) expr ::= expr MATCH expr */ - 270, /* (272) expr ::= expr NMATCH expr */ - 270, /* (273) expr ::= ID QUESTION STRING */ - 279, /* (274) arrow ::= ID ARROW STRING */ - 279, /* (275) arrow ::= ID DOT ID ARROW STRING */ - 270, /* (276) expr ::= arrow */ - 270, /* (277) expr ::= expr IN LP exprlist RP */ - 210, /* (278) exprlist ::= exprlist COMMA expritem */ - 210, /* (279) exprlist ::= expritem */ - 281, /* (280) expritem ::= expr */ - 281, /* (281) expritem ::= */ - 202, /* (282) cmd ::= RESET QUERY CACHE */ - 202, /* (283) cmd ::= SYNCDB ids REPLICA */ - 202, /* (284) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - 202, /* (285) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 202, /* (286) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - 202, /* (287) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - 202, /* (288) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - 202, /* (289) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - 202, /* (290) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 202, /* (291) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - 202, /* (292) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - 202, /* (293) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 202, /* (294) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - 202, /* (295) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 202, /* (296) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 202, /* (297) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 202, /* (298) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - 202, /* (299) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - 202, /* (300) cmd ::= KILL CONNECTION INTEGER */ - 202, /* (301) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 202, /* (302) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 202, /* (0) program ::= cmd */ + 203, /* (1) cmd ::= SHOW DATABASES */ + 203, /* (2) cmd ::= SHOW TOPICS */ + 203, /* (3) cmd ::= SHOW FUNCTIONS */ + 203, /* (4) cmd ::= SHOW MNODES */ + 203, /* (5) cmd ::= SHOW DNODES */ + 203, /* (6) cmd ::= SHOW ACCOUNTS */ + 203, /* (7) cmd ::= SHOW USERS */ + 203, /* (8) cmd ::= SHOW MODULES */ + 203, /* (9) cmd ::= SHOW QUERIES */ + 203, /* (10) cmd ::= SHOW CONNECTIONS */ + 203, /* (11) cmd ::= SHOW STREAMS */ + 203, /* (12) cmd ::= SHOW VARIABLES */ + 203, /* (13) cmd ::= SHOW SCORES */ + 203, /* (14) cmd ::= SHOW GRANTS */ + 203, /* (15) cmd ::= SHOW VNODES */ + 203, /* (16) cmd ::= SHOW VNODES ids */ + 205, /* (17) dbPrefix ::= */ + 205, /* (18) dbPrefix ::= ids DOT */ + 206, /* (19) cpxName ::= */ + 206, /* (20) cpxName ::= DOT ids */ + 203, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + 203, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + 203, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + 203, /* (24) cmd ::= SHOW dbPrefix TABLES */ + 203, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + 203, /* (26) cmd ::= SHOW dbPrefix STABLES */ + 203, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + 203, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + 203, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + 203, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + 203, /* (31) cmd ::= DROP DATABASE ifexists ids */ + 203, /* (32) cmd ::= DROP TOPIC ifexists ids */ + 203, /* (33) cmd ::= DROP FUNCTION ids */ + 203, /* (34) cmd ::= DROP DNODE ids */ + 203, /* (35) cmd ::= DROP USER ids */ + 203, /* (36) cmd ::= DROP ACCOUNT ids */ + 203, /* (37) cmd ::= USE ids */ + 203, /* (38) cmd ::= DESCRIBE ids cpxName */ + 203, /* (39) cmd ::= DESC ids cpxName */ + 203, /* (40) cmd ::= ALTER USER ids PASS ids */ + 203, /* (41) cmd ::= ALTER USER ids PRIVILEGE ids */ + 203, /* (42) cmd ::= ALTER DNODE ids ids */ + 203, /* (43) cmd ::= ALTER DNODE ids ids ids */ + 203, /* (44) cmd ::= ALTER LOCAL ids */ + 203, /* (45) cmd ::= ALTER LOCAL ids ids */ + 203, /* (46) cmd ::= ALTER DATABASE ids alter_db_optr */ + 203, /* (47) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 203, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */ + 203, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 203, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */ + 204, /* (51) ids ::= ID */ + 204, /* (52) ids ::= STRING */ + 207, /* (53) ifexists ::= IF EXISTS */ + 207, /* (54) ifexists ::= */ + 212, /* (55) ifnotexists ::= IF NOT EXISTS */ + 212, /* (56) ifnotexists ::= */ + 203, /* (57) cmd ::= CREATE DNODE ids */ + 203, /* (58) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 203, /* (59) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 203, /* (60) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 203, /* (61) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 203, /* (62) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 203, /* (63) cmd ::= CREATE USER ids PASS ids */ + 216, /* (64) bufsize ::= */ + 216, /* (65) bufsize ::= BUFSIZE INTEGER */ + 217, /* (66) pps ::= */ + 217, /* (67) pps ::= PPS INTEGER */ + 218, /* (68) tseries ::= */ + 218, /* (69) tseries ::= TSERIES INTEGER */ + 219, /* (70) dbs ::= */ + 219, /* (71) dbs ::= DBS INTEGER */ + 220, /* (72) streams ::= */ + 220, /* (73) streams ::= STREAMS INTEGER */ + 221, /* (74) storage ::= */ + 221, /* (75) storage ::= STORAGE INTEGER */ + 222, /* (76) qtime ::= */ + 222, /* (77) qtime ::= QTIME INTEGER */ + 223, /* (78) users ::= */ + 223, /* (79) users ::= USERS INTEGER */ + 224, /* (80) conns ::= */ + 224, /* (81) conns ::= CONNS INTEGER */ + 225, /* (82) state ::= */ + 225, /* (83) state ::= STATE ids */ + 210, /* (84) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 226, /* (85) intitemlist ::= intitemlist COMMA intitem */ + 226, /* (86) intitemlist ::= intitem */ + 227, /* (87) intitem ::= INTEGER */ + 228, /* (88) keep ::= KEEP intitemlist */ + 229, /* (89) cache ::= CACHE INTEGER */ + 230, /* (90) replica ::= REPLICA INTEGER */ + 231, /* (91) quorum ::= QUORUM INTEGER */ + 232, /* (92) days ::= DAYS INTEGER */ + 233, /* (93) minrows ::= MINROWS INTEGER */ + 234, /* (94) maxrows ::= MAXROWS INTEGER */ + 235, /* (95) blocks ::= BLOCKS INTEGER */ + 236, /* (96) ctime ::= CTIME INTEGER */ + 237, /* (97) wal ::= WAL INTEGER */ + 238, /* (98) fsync ::= FSYNC INTEGER */ + 239, /* (99) comp ::= COMP INTEGER */ + 240, /* (100) prec ::= PRECISION STRING */ + 241, /* (101) update ::= UPDATE INTEGER */ + 242, /* (102) cachelast ::= CACHELAST INTEGER */ + 243, /* (103) partitions ::= PARTITIONS INTEGER */ + 213, /* (104) db_optr ::= */ + 213, /* (105) db_optr ::= db_optr cache */ + 213, /* (106) db_optr ::= db_optr replica */ + 213, /* (107) db_optr ::= db_optr quorum */ + 213, /* (108) db_optr ::= db_optr days */ + 213, /* (109) db_optr ::= db_optr minrows */ + 213, /* (110) db_optr ::= db_optr maxrows */ + 213, /* (111) db_optr ::= db_optr blocks */ + 213, /* (112) db_optr ::= db_optr ctime */ + 213, /* (113) db_optr ::= db_optr wal */ + 213, /* (114) db_optr ::= db_optr fsync */ + 213, /* (115) db_optr ::= db_optr comp */ + 213, /* (116) db_optr ::= db_optr prec */ + 213, /* (117) db_optr ::= db_optr keep */ + 213, /* (118) db_optr ::= db_optr update */ + 213, /* (119) db_optr ::= db_optr cachelast */ + 214, /* (120) topic_optr ::= db_optr */ + 214, /* (121) topic_optr ::= topic_optr partitions */ + 208, /* (122) alter_db_optr ::= */ + 208, /* (123) alter_db_optr ::= alter_db_optr replica */ + 208, /* (124) alter_db_optr ::= alter_db_optr quorum */ + 208, /* (125) alter_db_optr ::= alter_db_optr keep */ + 208, /* (126) alter_db_optr ::= alter_db_optr blocks */ + 208, /* (127) alter_db_optr ::= alter_db_optr comp */ + 208, /* (128) alter_db_optr ::= alter_db_optr update */ + 208, /* (129) alter_db_optr ::= alter_db_optr cachelast */ + 209, /* (130) alter_topic_optr ::= alter_db_optr */ + 209, /* (131) alter_topic_optr ::= alter_topic_optr partitions */ + 215, /* (132) typename ::= ids */ + 215, /* (133) typename ::= ids LP signed RP */ + 215, /* (134) typename ::= ids UNSIGNED */ + 244, /* (135) signed ::= INTEGER */ + 244, /* (136) signed ::= PLUS INTEGER */ + 244, /* (137) signed ::= MINUS INTEGER */ + 203, /* (138) cmd ::= CREATE TABLE create_table_args */ + 203, /* (139) cmd ::= CREATE TABLE create_stable_args */ + 203, /* (140) cmd ::= CREATE STABLE create_stable_args */ + 203, /* (141) cmd ::= CREATE TABLE create_table_list */ + 247, /* (142) create_table_list ::= create_from_stable */ + 247, /* (143) create_table_list ::= create_table_list create_from_stable */ + 245, /* (144) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 246, /* (145) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 248, /* (146) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 248, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 251, /* (148) tagNamelist ::= tagNamelist COMMA ids */ + 251, /* (149) tagNamelist ::= ids */ + 245, /* (150) create_table_args ::= ifnotexists ids cpxName AS select */ + 249, /* (151) columnlist ::= columnlist COMMA column */ + 249, /* (152) columnlist ::= column */ + 253, /* (153) column ::= ids typename */ + 250, /* (154) tagitemlist ::= tagitemlist COMMA tagitem */ + 250, /* (155) tagitemlist ::= tagitem */ + 254, /* (156) tagitem ::= INTEGER */ + 254, /* (157) tagitem ::= FLOAT */ + 254, /* (158) tagitem ::= STRING */ + 254, /* (159) tagitem ::= BOOL */ + 254, /* (160) tagitem ::= NULL */ + 254, /* (161) tagitem ::= NOW */ + 254, /* (162) tagitem ::= MINUS INTEGER */ + 254, /* (163) tagitem ::= MINUS FLOAT */ + 254, /* (164) tagitem ::= PLUS INTEGER */ + 254, /* (165) tagitem ::= PLUS FLOAT */ + 252, /* (166) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + 252, /* (167) select ::= LP select RP */ + 269, /* (168) union ::= select */ + 269, /* (169) union ::= union UNION ALL select */ + 203, /* (170) cmd ::= union */ + 252, /* (171) select ::= SELECT selcollist */ + 270, /* (172) sclp ::= selcollist COMMA */ + 270, /* (173) sclp ::= */ + 255, /* (174) selcollist ::= sclp distinct expr as */ + 255, /* (175) selcollist ::= sclp STAR */ + 273, /* (176) as ::= AS ids */ + 273, /* (177) as ::= ids */ + 273, /* (178) as ::= */ + 271, /* (179) distinct ::= DISTINCT */ + 271, /* (180) distinct ::= */ + 256, /* (181) from ::= FROM tablelist */ + 256, /* (182) from ::= FROM sub */ + 275, /* (183) sub ::= LP union RP */ + 275, /* (184) sub ::= LP union RP ids */ + 275, /* (185) sub ::= sub COMMA LP union RP ids */ + 274, /* (186) tablelist ::= ids cpxName */ + 274, /* (187) tablelist ::= ids cpxName ids */ + 274, /* (188) tablelist ::= tablelist COMMA ids cpxName */ + 274, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */ + 276, /* (190) tmvar ::= VARIABLE */ + 277, /* (191) timestamp ::= INTEGER */ + 277, /* (192) timestamp ::= MINUS INTEGER */ + 277, /* (193) timestamp ::= PLUS INTEGER */ + 277, /* (194) timestamp ::= STRING */ + 277, /* (195) timestamp ::= NOW */ + 277, /* (196) timestamp ::= NOW PLUS VARIABLE */ + 277, /* (197) timestamp ::= NOW MINUS VARIABLE */ + 258, /* (198) range_option ::= */ + 258, /* (199) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + 259, /* (200) interval_option ::= intervalKey LP tmvar RP */ + 259, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 259, /* (202) interval_option ::= */ + 278, /* (203) intervalKey ::= INTERVAL */ + 278, /* (204) intervalKey ::= EVERY */ + 261, /* (205) session_option ::= */ + 261, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 262, /* (207) windowstate_option ::= */ + 262, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */ + 263, /* (209) fill_opt ::= */ + 263, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 263, /* (211) fill_opt ::= FILL LP ID RP */ + 260, /* (212) sliding_opt ::= SLIDING LP tmvar RP */ + 260, /* (213) sliding_opt ::= */ + 266, /* (214) orderby_opt ::= */ + 266, /* (215) orderby_opt ::= ORDER BY sortlist */ + 279, /* (216) sortlist ::= sortlist COMMA item sortorder */ + 279, /* (217) sortlist ::= sortlist COMMA arrow sortorder */ + 279, /* (218) sortlist ::= item sortorder */ + 279, /* (219) sortlist ::= arrow sortorder */ + 280, /* (220) item ::= ID */ + 280, /* (221) item ::= ID DOT ID */ + 281, /* (222) sortorder ::= ASC */ + 281, /* (223) sortorder ::= DESC */ + 281, /* (224) sortorder ::= */ + 264, /* (225) groupby_opt ::= */ + 264, /* (226) groupby_opt ::= GROUP BY grouplist */ + 283, /* (227) grouplist ::= grouplist COMMA item */ + 283, /* (228) grouplist ::= grouplist COMMA arrow */ + 283, /* (229) grouplist ::= item */ + 283, /* (230) grouplist ::= arrow */ + 265, /* (231) having_opt ::= */ + 265, /* (232) having_opt ::= HAVING expr */ + 268, /* (233) limit_opt ::= */ + 268, /* (234) limit_opt ::= LIMIT signed */ + 268, /* (235) limit_opt ::= LIMIT signed OFFSET signed */ + 268, /* (236) limit_opt ::= LIMIT signed COMMA signed */ + 267, /* (237) slimit_opt ::= */ + 267, /* (238) slimit_opt ::= SLIMIT signed */ + 267, /* (239) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 267, /* (240) slimit_opt ::= SLIMIT signed COMMA signed */ + 257, /* (241) where_opt ::= */ + 257, /* (242) where_opt ::= WHERE expr */ + 272, /* (243) expr ::= LP expr RP */ + 272, /* (244) expr ::= ID */ + 272, /* (245) expr ::= ID DOT ID */ + 272, /* (246) expr ::= ID DOT STAR */ + 272, /* (247) expr ::= INTEGER */ + 272, /* (248) expr ::= MINUS INTEGER */ + 272, /* (249) expr ::= PLUS INTEGER */ + 272, /* (250) expr ::= FLOAT */ + 272, /* (251) expr ::= MINUS FLOAT */ + 272, /* (252) expr ::= PLUS FLOAT */ + 272, /* (253) expr ::= STRING */ + 272, /* (254) expr ::= NOW */ + 272, /* (255) expr ::= VARIABLE */ + 272, /* (256) expr ::= PLUS VARIABLE */ + 272, /* (257) expr ::= MINUS VARIABLE */ + 272, /* (258) expr ::= BOOL */ + 272, /* (259) expr ::= NULL */ + 272, /* (260) expr ::= ID LP exprlist RP */ + 272, /* (261) expr ::= ID LP STAR RP */ + 272, /* (262) expr ::= expr IS NULL */ + 272, /* (263) expr ::= expr IS NOT NULL */ + 272, /* (264) expr ::= expr LT expr */ + 272, /* (265) expr ::= expr GT expr */ + 272, /* (266) expr ::= expr LE expr */ + 272, /* (267) expr ::= expr GE expr */ + 272, /* (268) expr ::= expr NE expr */ + 272, /* (269) expr ::= expr EQ expr */ + 272, /* (270) expr ::= expr BETWEEN expr AND expr */ + 272, /* (271) expr ::= expr AND expr */ + 272, /* (272) expr ::= expr OR expr */ + 272, /* (273) expr ::= expr PLUS expr */ + 272, /* (274) expr ::= expr MINUS expr */ + 272, /* (275) expr ::= expr STAR expr */ + 272, /* (276) expr ::= expr SLASH expr */ + 272, /* (277) expr ::= expr REM expr */ + 272, /* (278) expr ::= expr LIKE expr */ + 272, /* (279) expr ::= expr MATCH expr */ + 272, /* (280) expr ::= expr NMATCH expr */ + 272, /* (281) expr ::= ID QUESTION STRING */ + 282, /* (282) arrow ::= ID ARROW STRING */ + 282, /* (283) arrow ::= ID DOT ID ARROW STRING */ + 272, /* (284) expr ::= arrow */ + 272, /* (285) expr ::= expr IN LP exprlist RP */ + 211, /* (286) exprlist ::= exprlist COMMA expritem */ + 211, /* (287) exprlist ::= expritem */ + 284, /* (288) expritem ::= expr */ + 284, /* (289) expritem ::= */ + 203, /* (290) cmd ::= RESET QUERY CACHE */ + 203, /* (291) cmd ::= SYNCDB ids REPLICA */ + 203, /* (292) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 203, /* (293) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 203, /* (294) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 203, /* (295) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 203, /* (296) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 203, /* (297) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 203, /* (298) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 203, /* (299) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 203, /* (300) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 203, /* (301) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 203, /* (302) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 203, /* (303) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 203, /* (304) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 203, /* (305) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 203, /* (306) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 203, /* (307) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 203, /* (308) cmd ::= KILL CONNECTION INTEGER */ + 203, /* (309) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 203, /* (310) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2429,280 +2439,288 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (26) cmd ::= SHOW dbPrefix STABLES */ -5, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ -3, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - -4, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ - -5, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ - -5, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ - -4, /* (32) cmd ::= DROP DATABASE ifexists ids */ - -4, /* (33) cmd ::= DROP TOPIC ifexists ids */ - -3, /* (34) cmd ::= DROP FUNCTION ids */ - -3, /* (35) cmd ::= DROP DNODE ids */ - -3, /* (36) cmd ::= DROP USER ids */ - -3, /* (37) cmd ::= DROP ACCOUNT ids */ - -2, /* (38) cmd ::= USE ids */ - -3, /* (39) cmd ::= DESCRIBE ids cpxName */ - -3, /* (40) cmd ::= DESC ids cpxName */ - -5, /* (41) cmd ::= ALTER USER ids PASS ids */ - -5, /* (42) cmd ::= ALTER USER ids PRIVILEGE 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 */ - 0, /* (65) bufsize ::= */ - -2, /* (66) bufsize ::= BUFSIZE INTEGER */ - 0, /* (67) pps ::= */ - -2, /* (68) pps ::= PPS INTEGER */ - 0, /* (69) tseries ::= */ - -2, /* (70) tseries ::= TSERIES INTEGER */ - 0, /* (71) dbs ::= */ - -2, /* (72) dbs ::= DBS INTEGER */ - 0, /* (73) streams ::= */ - -2, /* (74) streams ::= STREAMS INTEGER */ - 0, /* (75) storage ::= */ - -2, /* (76) storage ::= STORAGE INTEGER */ - 0, /* (77) qtime ::= */ - -2, /* (78) qtime ::= QTIME INTEGER */ - 0, /* (79) users ::= */ - -2, /* (80) users ::= USERS INTEGER */ - 0, /* (81) conns ::= */ - -2, /* (82) conns ::= CONNS INTEGER */ - 0, /* (83) state ::= */ - -2, /* (84) state ::= STATE ids */ - -9, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - -3, /* (86) intitemlist ::= intitemlist COMMA intitem */ - -1, /* (87) intitemlist ::= intitem */ - -1, /* (88) intitem ::= INTEGER */ - -2, /* (89) keep ::= KEEP intitemlist */ - -2, /* (90) cache ::= CACHE INTEGER */ - -2, /* (91) replica ::= REPLICA INTEGER */ - -2, /* (92) quorum ::= QUORUM INTEGER */ - -2, /* (93) days ::= DAYS INTEGER */ - -2, /* (94) minrows ::= MINROWS INTEGER */ - -2, /* (95) maxrows ::= MAXROWS INTEGER */ - -2, /* (96) blocks ::= BLOCKS INTEGER */ - -2, /* (97) ctime ::= CTIME INTEGER */ - -2, /* (98) wal ::= WAL INTEGER */ - -2, /* (99) fsync ::= FSYNC INTEGER */ - -2, /* (100) comp ::= COMP INTEGER */ - -2, /* (101) prec ::= PRECISION STRING */ - -2, /* (102) update ::= UPDATE INTEGER */ - -2, /* (103) cachelast ::= CACHELAST INTEGER */ - -2, /* (104) partitions ::= PARTITIONS INTEGER */ - 0, /* (105) db_optr ::= */ - -2, /* (106) db_optr ::= db_optr cache */ - -2, /* (107) db_optr ::= db_optr replica */ - -2, /* (108) db_optr ::= db_optr quorum */ - -2, /* (109) db_optr ::= db_optr days */ - -2, /* (110) db_optr ::= db_optr minrows */ - -2, /* (111) db_optr ::= db_optr maxrows */ - -2, /* (112) db_optr ::= db_optr blocks */ - -2, /* (113) db_optr ::= db_optr ctime */ - -2, /* (114) db_optr ::= db_optr wal */ - -2, /* (115) db_optr ::= db_optr fsync */ - -2, /* (116) db_optr ::= db_optr comp */ - -2, /* (117) db_optr ::= db_optr prec */ - -2, /* (118) db_optr ::= db_optr keep */ - -2, /* (119) db_optr ::= db_optr update */ - -2, /* (120) db_optr ::= db_optr cachelast */ - -1, /* (121) topic_optr ::= db_optr */ - -2, /* (122) topic_optr ::= topic_optr partitions */ - 0, /* (123) alter_db_optr ::= */ - -2, /* (124) alter_db_optr ::= alter_db_optr replica */ - -2, /* (125) alter_db_optr ::= alter_db_optr quorum */ - -2, /* (126) alter_db_optr ::= alter_db_optr keep */ - -2, /* (127) alter_db_optr ::= alter_db_optr blocks */ - -2, /* (128) alter_db_optr ::= alter_db_optr comp */ - -2, /* (129) alter_db_optr ::= alter_db_optr update */ - -2, /* (130) alter_db_optr ::= alter_db_optr cachelast */ - -1, /* (131) alter_topic_optr ::= alter_db_optr */ - -2, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ - -1, /* (133) typename ::= ids */ - -4, /* (134) typename ::= ids LP signed RP */ - -2, /* (135) typename ::= ids UNSIGNED */ - -1, /* (136) signed ::= INTEGER */ - -2, /* (137) signed ::= PLUS INTEGER */ - -2, /* (138) signed ::= MINUS INTEGER */ - -3, /* (139) cmd ::= CREATE TABLE create_table_args */ - -3, /* (140) cmd ::= CREATE TABLE create_stable_args */ - -3, /* (141) cmd ::= CREATE STABLE create_stable_args */ - -3, /* (142) cmd ::= CREATE TABLE create_table_list */ - -1, /* (143) create_table_list ::= create_from_stable */ - -2, /* (144) create_table_list ::= create_table_list create_from_stable */ - -6, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - -10, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - -10, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - -13, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - -3, /* (149) tagNamelist ::= tagNamelist COMMA ids */ - -1, /* (150) tagNamelist ::= ids */ - -5, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ - -3, /* (152) columnlist ::= columnlist COMMA column */ - -1, /* (153) columnlist ::= column */ - -2, /* (154) column ::= ids typename */ - -3, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ - -1, /* (156) tagitemlist ::= tagitem */ - -1, /* (157) tagitem ::= INTEGER */ - -1, /* (158) tagitem ::= FLOAT */ - -1, /* (159) tagitem ::= STRING */ - -1, /* (160) tagitem ::= BOOL */ - -1, /* (161) tagitem ::= NULL */ - -1, /* (162) tagitem ::= NOW */ - -2, /* (163) tagitem ::= MINUS INTEGER */ - -2, /* (164) tagitem ::= MINUS FLOAT */ - -2, /* (165) tagitem ::= PLUS INTEGER */ - -2, /* (166) tagitem ::= PLUS FLOAT */ - -14, /* (167) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - -3, /* (168) select ::= LP select RP */ - -1, /* (169) union ::= select */ - -4, /* (170) union ::= union UNION ALL select */ - -1, /* (171) cmd ::= union */ - -2, /* (172) select ::= SELECT selcollist */ - -2, /* (173) sclp ::= selcollist COMMA */ - 0, /* (174) sclp ::= */ - -4, /* (175) selcollist ::= sclp distinct expr as */ - -2, /* (176) selcollist ::= sclp STAR */ - -2, /* (177) as ::= AS ids */ - -1, /* (178) as ::= ids */ - 0, /* (179) as ::= */ - -1, /* (180) distinct ::= DISTINCT */ - 0, /* (181) distinct ::= */ - -2, /* (182) from ::= FROM tablelist */ - -2, /* (183) from ::= FROM sub */ - -3, /* (184) sub ::= LP union RP */ - -4, /* (185) sub ::= LP union RP ids */ - -6, /* (186) sub ::= sub COMMA LP union RP ids */ - -2, /* (187) tablelist ::= ids cpxName */ - -3, /* (188) tablelist ::= ids cpxName ids */ - -4, /* (189) tablelist ::= tablelist COMMA ids cpxName */ - -5, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ - -1, /* (191) tmvar ::= VARIABLE */ - -4, /* (192) interval_option ::= intervalKey LP tmvar RP */ - -6, /* (193) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - 0, /* (194) interval_option ::= */ - -1, /* (195) intervalKey ::= INTERVAL */ - -1, /* (196) intervalKey ::= EVERY */ - 0, /* (197) session_option ::= */ - -7, /* (198) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - 0, /* (199) windowstate_option ::= */ - -4, /* (200) windowstate_option ::= STATE_WINDOW LP ids RP */ - 0, /* (201) fill_opt ::= */ - -6, /* (202) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - -4, /* (203) fill_opt ::= FILL LP ID RP */ - -4, /* (204) sliding_opt ::= SLIDING LP tmvar RP */ - 0, /* (205) sliding_opt ::= */ - 0, /* (206) orderby_opt ::= */ - -3, /* (207) orderby_opt ::= ORDER BY sortlist */ - -4, /* (208) sortlist ::= sortlist COMMA item sortorder */ - -4, /* (209) sortlist ::= sortlist COMMA arrow sortorder */ - -2, /* (210) sortlist ::= item sortorder */ - -2, /* (211) sortlist ::= arrow sortorder */ - -1, /* (212) item ::= ID */ - -3, /* (213) item ::= ID DOT ID */ - -1, /* (214) sortorder ::= ASC */ - -1, /* (215) sortorder ::= DESC */ - 0, /* (216) sortorder ::= */ - 0, /* (217) groupby_opt ::= */ - -3, /* (218) groupby_opt ::= GROUP BY grouplist */ - -3, /* (219) grouplist ::= grouplist COMMA item */ - -3, /* (220) grouplist ::= grouplist COMMA arrow */ - -1, /* (221) grouplist ::= item */ - -1, /* (222) grouplist ::= arrow */ - 0, /* (223) having_opt ::= */ - -2, /* (224) having_opt ::= HAVING expr */ - 0, /* (225) limit_opt ::= */ - -2, /* (226) limit_opt ::= LIMIT signed */ - -4, /* (227) limit_opt ::= LIMIT signed OFFSET signed */ - -4, /* (228) limit_opt ::= LIMIT signed COMMA signed */ - 0, /* (229) slimit_opt ::= */ - -2, /* (230) slimit_opt ::= SLIMIT signed */ - -4, /* (231) slimit_opt ::= SLIMIT signed SOFFSET signed */ - -4, /* (232) slimit_opt ::= SLIMIT signed COMMA signed */ - 0, /* (233) where_opt ::= */ - -2, /* (234) where_opt ::= WHERE expr */ - -3, /* (235) expr ::= LP expr RP */ - -1, /* (236) expr ::= ID */ - -3, /* (237) expr ::= ID DOT ID */ - -3, /* (238) expr ::= ID DOT STAR */ - -1, /* (239) expr ::= INTEGER */ - -2, /* (240) expr ::= MINUS INTEGER */ - -2, /* (241) expr ::= PLUS INTEGER */ - -1, /* (242) expr ::= FLOAT */ - -2, /* (243) expr ::= MINUS FLOAT */ - -2, /* (244) expr ::= PLUS FLOAT */ - -1, /* (245) expr ::= STRING */ - -1, /* (246) expr ::= NOW */ - -1, /* (247) expr ::= VARIABLE */ - -2, /* (248) expr ::= PLUS VARIABLE */ - -2, /* (249) expr ::= MINUS VARIABLE */ - -1, /* (250) expr ::= BOOL */ - -1, /* (251) expr ::= NULL */ - -4, /* (252) expr ::= ID LP exprlist RP */ - -4, /* (253) expr ::= ID LP STAR RP */ - -3, /* (254) expr ::= expr IS NULL */ - -4, /* (255) expr ::= expr IS NOT NULL */ - -3, /* (256) expr ::= expr LT expr */ - -3, /* (257) expr ::= expr GT expr */ - -3, /* (258) expr ::= expr LE expr */ - -3, /* (259) expr ::= expr GE expr */ - -3, /* (260) expr ::= expr NE expr */ - -3, /* (261) expr ::= expr EQ expr */ - -5, /* (262) expr ::= expr BETWEEN expr AND expr */ - -3, /* (263) expr ::= expr AND expr */ - -3, /* (264) expr ::= expr OR expr */ - -3, /* (265) expr ::= expr PLUS expr */ - -3, /* (266) expr ::= expr MINUS expr */ - -3, /* (267) expr ::= expr STAR expr */ - -3, /* (268) expr ::= expr SLASH expr */ - -3, /* (269) expr ::= expr REM expr */ - -3, /* (270) expr ::= expr LIKE expr */ - -3, /* (271) expr ::= expr MATCH expr */ - -3, /* (272) expr ::= expr NMATCH expr */ - -3, /* (273) expr ::= ID QUESTION STRING */ - -3, /* (274) arrow ::= ID ARROW STRING */ - -5, /* (275) arrow ::= ID DOT ID ARROW STRING */ - -1, /* (276) expr ::= arrow */ - -5, /* (277) expr ::= expr IN LP exprlist RP */ - -3, /* (278) exprlist ::= exprlist COMMA expritem */ - -1, /* (279) exprlist ::= expritem */ - -1, /* (280) expritem ::= expr */ - 0, /* (281) expritem ::= */ - -3, /* (282) cmd ::= RESET QUERY CACHE */ - -3, /* (283) cmd ::= SYNCDB ids REPLICA */ - -7, /* (284) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (285) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -7, /* (286) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (287) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - -7, /* (288) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - -8, /* (289) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (290) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (291) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - -7, /* (292) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (293) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -7, /* (294) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (295) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (296) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (297) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (298) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (299) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - -3, /* (300) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (301) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (302) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -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 */ + -4, /* (42) cmd ::= ALTER DNODE ids ids */ + -5, /* (43) cmd ::= ALTER DNODE ids ids ids */ + -3, /* (44) cmd ::= ALTER LOCAL ids */ + -4, /* (45) cmd ::= ALTER LOCAL ids ids */ + -4, /* (46) cmd ::= ALTER DATABASE ids alter_db_optr */ + -4, /* (47) cmd ::= ALTER TOPIC ids alter_topic_optr */ + -4, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */ + -6, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + -6, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */ + -1, /* (51) ids ::= ID */ + -1, /* (52) ids ::= STRING */ + -2, /* (53) ifexists ::= IF EXISTS */ + 0, /* (54) ifexists ::= */ + -3, /* (55) ifnotexists ::= IF NOT EXISTS */ + 0, /* (56) ifnotexists ::= */ + -3, /* (57) cmd ::= CREATE DNODE ids */ + -6, /* (58) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + -5, /* (59) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + -5, /* (60) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + -8, /* (61) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + -9, /* (62) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + -5, /* (63) cmd ::= CREATE USER ids PASS ids */ + 0, /* (64) bufsize ::= */ + -2, /* (65) bufsize ::= BUFSIZE INTEGER */ + 0, /* (66) pps ::= */ + -2, /* (67) pps ::= PPS INTEGER */ + 0, /* (68) tseries ::= */ + -2, /* (69) tseries ::= TSERIES INTEGER */ + 0, /* (70) dbs ::= */ + -2, /* (71) dbs ::= DBS INTEGER */ + 0, /* (72) streams ::= */ + -2, /* (73) streams ::= STREAMS INTEGER */ + 0, /* (74) storage ::= */ + -2, /* (75) storage ::= STORAGE INTEGER */ + 0, /* (76) qtime ::= */ + -2, /* (77) qtime ::= QTIME INTEGER */ + 0, /* (78) users ::= */ + -2, /* (79) users ::= USERS INTEGER */ + 0, /* (80) conns ::= */ + -2, /* (81) conns ::= CONNS INTEGER */ + 0, /* (82) state ::= */ + -2, /* (83) state ::= STATE ids */ + -9, /* (84) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + -3, /* (85) intitemlist ::= intitemlist COMMA intitem */ + -1, /* (86) intitemlist ::= intitem */ + -1, /* (87) intitem ::= INTEGER */ + -2, /* (88) keep ::= KEEP intitemlist */ + -2, /* (89) cache ::= CACHE INTEGER */ + -2, /* (90) replica ::= REPLICA INTEGER */ + -2, /* (91) quorum ::= QUORUM INTEGER */ + -2, /* (92) days ::= DAYS INTEGER */ + -2, /* (93) minrows ::= MINROWS INTEGER */ + -2, /* (94) maxrows ::= MAXROWS INTEGER */ + -2, /* (95) blocks ::= BLOCKS INTEGER */ + -2, /* (96) ctime ::= CTIME INTEGER */ + -2, /* (97) wal ::= WAL INTEGER */ + -2, /* (98) fsync ::= FSYNC INTEGER */ + -2, /* (99) comp ::= COMP INTEGER */ + -2, /* (100) prec ::= PRECISION STRING */ + -2, /* (101) update ::= UPDATE INTEGER */ + -2, /* (102) cachelast ::= CACHELAST INTEGER */ + -2, /* (103) partitions ::= PARTITIONS INTEGER */ + 0, /* (104) db_optr ::= */ + -2, /* (105) db_optr ::= db_optr cache */ + -2, /* (106) db_optr ::= db_optr replica */ + -2, /* (107) db_optr ::= db_optr quorum */ + -2, /* (108) db_optr ::= db_optr days */ + -2, /* (109) db_optr ::= db_optr minrows */ + -2, /* (110) db_optr ::= db_optr maxrows */ + -2, /* (111) db_optr ::= db_optr blocks */ + -2, /* (112) db_optr ::= db_optr ctime */ + -2, /* (113) db_optr ::= db_optr wal */ + -2, /* (114) db_optr ::= db_optr fsync */ + -2, /* (115) db_optr ::= db_optr comp */ + -2, /* (116) db_optr ::= db_optr prec */ + -2, /* (117) db_optr ::= db_optr keep */ + -2, /* (118) db_optr ::= db_optr update */ + -2, /* (119) db_optr ::= db_optr cachelast */ + -1, /* (120) topic_optr ::= db_optr */ + -2, /* (121) topic_optr ::= topic_optr partitions */ + 0, /* (122) alter_db_optr ::= */ + -2, /* (123) alter_db_optr ::= alter_db_optr replica */ + -2, /* (124) alter_db_optr ::= alter_db_optr quorum */ + -2, /* (125) alter_db_optr ::= alter_db_optr keep */ + -2, /* (126) alter_db_optr ::= alter_db_optr blocks */ + -2, /* (127) alter_db_optr ::= alter_db_optr comp */ + -2, /* (128) alter_db_optr ::= alter_db_optr update */ + -2, /* (129) alter_db_optr ::= alter_db_optr cachelast */ + -1, /* (130) alter_topic_optr ::= alter_db_optr */ + -2, /* (131) alter_topic_optr ::= alter_topic_optr partitions */ + -1, /* (132) typename ::= ids */ + -4, /* (133) typename ::= ids LP signed RP */ + -2, /* (134) typename ::= ids UNSIGNED */ + -1, /* (135) signed ::= INTEGER */ + -2, /* (136) signed ::= PLUS INTEGER */ + -2, /* (137) signed ::= MINUS INTEGER */ + -3, /* (138) cmd ::= CREATE TABLE create_table_args */ + -3, /* (139) cmd ::= CREATE TABLE create_stable_args */ + -3, /* (140) cmd ::= CREATE STABLE create_stable_args */ + -3, /* (141) cmd ::= CREATE TABLE create_table_list */ + -1, /* (142) create_table_list ::= create_from_stable */ + -2, /* (143) create_table_list ::= create_table_list create_from_stable */ + -6, /* (144) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + -10, /* (145) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + -10, /* (146) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + -13, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + -3, /* (148) tagNamelist ::= tagNamelist COMMA ids */ + -1, /* (149) tagNamelist ::= ids */ + -5, /* (150) create_table_args ::= ifnotexists ids cpxName AS select */ + -3, /* (151) columnlist ::= columnlist COMMA column */ + -1, /* (152) columnlist ::= column */ + -2, /* (153) column ::= ids typename */ + -3, /* (154) tagitemlist ::= tagitemlist COMMA tagitem */ + -1, /* (155) tagitemlist ::= tagitem */ + -1, /* (156) tagitem ::= INTEGER */ + -1, /* (157) tagitem ::= FLOAT */ + -1, /* (158) tagitem ::= STRING */ + -1, /* (159) tagitem ::= BOOL */ + -1, /* (160) tagitem ::= NULL */ + -1, /* (161) tagitem ::= NOW */ + -2, /* (162) tagitem ::= MINUS INTEGER */ + -2, /* (163) tagitem ::= MINUS FLOAT */ + -2, /* (164) tagitem ::= PLUS INTEGER */ + -2, /* (165) tagitem ::= PLUS FLOAT */ + -15, /* (166) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + -3, /* (167) select ::= LP select RP */ + -1, /* (168) union ::= select */ + -4, /* (169) union ::= union UNION ALL select */ + -1, /* (170) cmd ::= union */ + -2, /* (171) select ::= SELECT selcollist */ + -2, /* (172) sclp ::= selcollist COMMA */ + 0, /* (173) sclp ::= */ + -4, /* (174) selcollist ::= sclp distinct expr as */ + -2, /* (175) selcollist ::= sclp STAR */ + -2, /* (176) as ::= AS ids */ + -1, /* (177) as ::= ids */ + 0, /* (178) as ::= */ + -1, /* (179) distinct ::= DISTINCT */ + 0, /* (180) distinct ::= */ + -2, /* (181) from ::= FROM tablelist */ + -2, /* (182) from ::= FROM sub */ + -3, /* (183) sub ::= LP union RP */ + -4, /* (184) sub ::= LP union RP ids */ + -6, /* (185) sub ::= sub COMMA LP union RP ids */ + -2, /* (186) tablelist ::= ids cpxName */ + -3, /* (187) tablelist ::= ids cpxName ids */ + -4, /* (188) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (190) tmvar ::= VARIABLE */ + -1, /* (191) timestamp ::= INTEGER */ + -2, /* (192) timestamp ::= MINUS INTEGER */ + -2, /* (193) timestamp ::= PLUS INTEGER */ + -1, /* (194) timestamp ::= STRING */ + -1, /* (195) timestamp ::= NOW */ + -3, /* (196) timestamp ::= NOW PLUS VARIABLE */ + -3, /* (197) timestamp ::= NOW MINUS VARIABLE */ + 0, /* (198) range_option ::= */ + -6, /* (199) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + -4, /* (200) interval_option ::= intervalKey LP tmvar RP */ + -6, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 0, /* (202) interval_option ::= */ + -1, /* (203) intervalKey ::= INTERVAL */ + -1, /* (204) intervalKey ::= EVERY */ + 0, /* (205) session_option ::= */ + -7, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (207) windowstate_option ::= */ + -4, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */ + 0, /* (209) fill_opt ::= */ + -6, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (211) fill_opt ::= FILL LP ID RP */ + -4, /* (212) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (213) sliding_opt ::= */ + 0, /* (214) orderby_opt ::= */ + -3, /* (215) orderby_opt ::= ORDER BY sortlist */ + -4, /* (216) sortlist ::= sortlist COMMA item sortorder */ + -4, /* (217) sortlist ::= sortlist COMMA arrow sortorder */ + -2, /* (218) sortlist ::= item sortorder */ + -2, /* (219) sortlist ::= arrow sortorder */ + -1, /* (220) item ::= ID */ + -3, /* (221) item ::= ID DOT ID */ + -1, /* (222) sortorder ::= ASC */ + -1, /* (223) sortorder ::= DESC */ + 0, /* (224) sortorder ::= */ + 0, /* (225) groupby_opt ::= */ + -3, /* (226) groupby_opt ::= GROUP BY grouplist */ + -3, /* (227) grouplist ::= grouplist COMMA item */ + -3, /* (228) grouplist ::= grouplist COMMA arrow */ + -1, /* (229) grouplist ::= item */ + -1, /* (230) grouplist ::= arrow */ + 0, /* (231) having_opt ::= */ + -2, /* (232) having_opt ::= HAVING expr */ + 0, /* (233) limit_opt ::= */ + -2, /* (234) limit_opt ::= LIMIT signed */ + -4, /* (235) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (236) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (237) slimit_opt ::= */ + -2, /* (238) slimit_opt ::= SLIMIT signed */ + -4, /* (239) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (240) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (241) where_opt ::= */ + -2, /* (242) where_opt ::= WHERE expr */ + -3, /* (243) expr ::= LP expr RP */ + -1, /* (244) expr ::= ID */ + -3, /* (245) expr ::= ID DOT ID */ + -3, /* (246) expr ::= ID DOT STAR */ + -1, /* (247) expr ::= INTEGER */ + -2, /* (248) expr ::= MINUS INTEGER */ + -2, /* (249) expr ::= PLUS INTEGER */ + -1, /* (250) expr ::= FLOAT */ + -2, /* (251) expr ::= MINUS FLOAT */ + -2, /* (252) expr ::= PLUS FLOAT */ + -1, /* (253) expr ::= STRING */ + -1, /* (254) expr ::= NOW */ + -1, /* (255) expr ::= VARIABLE */ + -2, /* (256) expr ::= PLUS VARIABLE */ + -2, /* (257) expr ::= MINUS VARIABLE */ + -1, /* (258) expr ::= BOOL */ + -1, /* (259) expr ::= NULL */ + -4, /* (260) expr ::= ID LP exprlist RP */ + -4, /* (261) expr ::= ID LP STAR RP */ + -3, /* (262) expr ::= expr IS NULL */ + -4, /* (263) expr ::= expr IS NOT NULL */ + -3, /* (264) expr ::= expr LT expr */ + -3, /* (265) expr ::= expr GT expr */ + -3, /* (266) expr ::= expr LE expr */ + -3, /* (267) expr ::= expr GE expr */ + -3, /* (268) expr ::= expr NE expr */ + -3, /* (269) expr ::= expr EQ expr */ + -5, /* (270) expr ::= expr BETWEEN expr AND expr */ + -3, /* (271) expr ::= expr AND expr */ + -3, /* (272) expr ::= expr OR expr */ + -3, /* (273) expr ::= expr PLUS expr */ + -3, /* (274) expr ::= expr MINUS expr */ + -3, /* (275) expr ::= expr STAR expr */ + -3, /* (276) expr ::= expr SLASH expr */ + -3, /* (277) expr ::= expr REM expr */ + -3, /* (278) expr ::= expr LIKE expr */ + -3, /* (279) expr ::= expr MATCH expr */ + -3, /* (280) expr ::= expr NMATCH expr */ + -3, /* (281) expr ::= ID QUESTION STRING */ + -3, /* (282) arrow ::= ID ARROW STRING */ + -5, /* (283) arrow ::= ID DOT ID ARROW STRING */ + -1, /* (284) expr ::= arrow */ + -5, /* (285) expr ::= expr IN LP exprlist RP */ + -3, /* (286) exprlist ::= exprlist COMMA expritem */ + -1, /* (287) exprlist ::= expritem */ + -1, /* (288) expritem ::= expr */ + 0, /* (289) expritem ::= */ + -3, /* (290) cmd ::= RESET QUERY CACHE */ + -3, /* (291) cmd ::= SYNCDB ids REPLICA */ + -7, /* (292) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (293) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (294) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (295) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (296) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (297) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (298) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (299) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (300) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (301) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (302) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (303) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (304) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (305) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (306) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (307) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (308) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (309) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (310) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2745,1607 +2763,1165 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* program ::= cmd */ - case 139: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==139); - case 140: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==140); - case 141: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==141); -#line 64 "sql.y" + case 138: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==138); + case 139: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==139); + case 140: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==140); {} -#line 2753 "sql.c" break; case 1: /* cmd ::= SHOW DATABASES */ -#line 67 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);} -#line 2758 "sql.c" break; case 2: /* cmd ::= SHOW TOPICS */ -#line 68 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TP, 0, 0);} -#line 2763 "sql.c" break; case 3: /* cmd ::= SHOW FUNCTIONS */ -#line 69 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_FUNCTION, 0, 0);} -#line 2768 "sql.c" break; case 4: /* cmd ::= SHOW MNODES */ -#line 70 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);} -#line 2773 "sql.c" break; case 5: /* cmd ::= SHOW DNODES */ -#line 71 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);} -#line 2778 "sql.c" break; case 6: /* cmd ::= SHOW ACCOUNTS */ -#line 72 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);} -#line 2783 "sql.c" break; case 7: /* cmd ::= SHOW USERS */ -#line 73 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_USER, 0, 0);} -#line 2788 "sql.c" break; case 8: /* cmd ::= SHOW MODULES */ -#line 75 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0); } -#line 2793 "sql.c" break; case 9: /* cmd ::= SHOW QUERIES */ -#line 76 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0); } -#line 2798 "sql.c" break; case 10: /* cmd ::= SHOW CONNECTIONS */ -#line 77 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);} -#line 2803 "sql.c" break; case 11: /* cmd ::= SHOW STREAMS */ -#line 78 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); } -#line 2808 "sql.c" break; case 12: /* cmd ::= SHOW VARIABLES */ -#line 79 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); } -#line 2813 "sql.c" break; case 13: /* cmd ::= SHOW SCORES */ -#line 80 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); } -#line 2818 "sql.c" break; case 14: /* cmd ::= SHOW GRANTS */ -#line 81 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); } -#line 2823 "sql.c" break; case 15: /* cmd ::= SHOW VNODES */ -#line 83 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); } -#line 2828 "sql.c" break; case 16: /* cmd ::= SHOW VNODES ids */ -#line 84 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &yymsp[0].minor.yy0, 0); } -#line 2833 "sql.c" break; case 17: /* dbPrefix ::= */ -#line 88 "sql.y" {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.type = 0;} -#line 2838 "sql.c" break; case 18: /* dbPrefix ::= ids DOT */ -#line 89 "sql.y" {yylhsminor.yy0 = yymsp[-1].minor.yy0; } -#line 2843 "sql.c" yymsp[-1].minor.yy0 = yylhsminor.yy0; break; case 19: /* cpxName ::= */ -#line 92 "sql.y" {yymsp[1].minor.yy0.n = 0; } -#line 2849 "sql.c" break; case 20: /* cpxName ::= DOT ids */ -#line 93 "sql.y" {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1; } -#line 2854 "sql.c" break; case 21: /* cmd ::= SHOW CREATE TABLE ids cpxName */ -#line 94 "sql.y" { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &yymsp[-1].minor.yy0); } -#line 2862 "sql.c" break; case 22: /* cmd ::= SHOW CREATE STABLE ids cpxName */ -#line 98 "sql.y" { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_STABLE, 1, &yymsp[-1].minor.yy0); } -#line 2870 "sql.c" break; case 23: /* cmd ::= SHOW CREATE DATABASE ids */ -#line 103 "sql.y" { setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &yymsp[0].minor.yy0); } -#line 2877 "sql.c" break; case 24: /* cmd ::= SHOW dbPrefix TABLES */ -#line 107 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-1].minor.yy0, 0); } -#line 2884 "sql.c" break; case 25: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */ -#line 111 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); } -#line 2891 "sql.c" break; case 26: /* cmd ::= SHOW dbPrefix STABLES */ -#line 115 "sql.y" { setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &yymsp[-1].minor.yy0, 0); } -#line 2898 "sql.c" break; case 27: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */ -#line 119 "sql.y" { SStrToken token; tSetDbName(&token, &yymsp[-3].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &yymsp[0].minor.yy0); } -#line 2907 "sql.c" break; case 28: /* cmd ::= SHOW dbPrefix VGROUPS */ -#line 125 "sql.y" { SStrToken token; tSetDbName(&token, &yymsp[-1].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } -#line 2916 "sql.c" - break; - case 29: /* cmd ::= SHOW dbPrefix VGROUPS ids */ -#line 131 "sql.y" -{ - SStrToken token; - tSetDbName(&token, &yymsp[-2].minor.yy0); - setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &yymsp[0].minor.yy0); -} -#line 2925 "sql.c" break; - case 30: /* cmd ::= DROP TABLE ifexists ids cpxName */ -#line 138 "sql.y" + case 29: /* cmd ::= DROP TABLE ifexists ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1, -1); } -#line 2933 "sql.c" break; - case 31: /* cmd ::= DROP STABLE ifexists ids cpxName */ -#line 144 "sql.y" + case 30: /* cmd ::= DROP STABLE ifexists ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1, TSDB_SUPER_TABLE); } -#line 2941 "sql.c" break; - case 32: /* cmd ::= DROP DATABASE ifexists ids */ -#line 149 "sql.y" + case 31: /* cmd ::= DROP DATABASE ifexists ids */ { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, TSDB_DB_TYPE_DEFAULT, -1); } -#line 2946 "sql.c" break; - case 33: /* cmd ::= DROP TOPIC ifexists ids */ -#line 150 "sql.y" + case 32: /* cmd ::= DROP TOPIC ifexists ids */ { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, TSDB_DB_TYPE_TOPIC, -1); } -#line 2951 "sql.c" break; - case 34: /* cmd ::= DROP FUNCTION ids */ -#line 151 "sql.y" + case 33: /* cmd ::= DROP FUNCTION ids */ { setDropFuncInfo(pInfo, TSDB_SQL_DROP_FUNCTION, &yymsp[0].minor.yy0); } -#line 2956 "sql.c" break; - case 35: /* cmd ::= DROP DNODE ids */ -#line 153 "sql.y" + case 34: /* cmd ::= DROP DNODE ids */ { setDCLSqlElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0); } -#line 2961 "sql.c" break; - case 36: /* cmd ::= DROP USER ids */ -#line 154 "sql.y" + case 35: /* cmd ::= DROP USER ids */ { setDCLSqlElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0); } -#line 2966 "sql.c" break; - case 37: /* cmd ::= DROP ACCOUNT ids */ -#line 155 "sql.y" + case 36: /* cmd ::= DROP ACCOUNT ids */ { setDCLSqlElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0); } -#line 2971 "sql.c" break; - case 38: /* cmd ::= USE ids */ -#line 158 "sql.y" + case 37: /* cmd ::= USE ids */ { setDCLSqlElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);} -#line 2976 "sql.c" break; - case 39: /* cmd ::= DESCRIBE ids cpxName */ - case 40: /* cmd ::= DESC ids cpxName */ yytestcase(yyruleno==40); -#line 161 "sql.y" + case 38: /* cmd ::= DESCRIBE ids cpxName */ + case 39: /* cmd ::= DESC ids cpxName */ yytestcase(yyruleno==39); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSqlElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0); } -#line 2985 "sql.c" break; - case 41: /* cmd ::= ALTER USER ids PASS ids */ -#line 171 "sql.y" + case 40: /* cmd ::= ALTER USER ids PASS ids */ { setAlterUserSql(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 2990 "sql.c" break; - case 42: /* cmd ::= ALTER USER ids PRIVILEGE ids */ -#line 172 "sql.y" + case 41: /* cmd ::= ALTER USER ids PRIVILEGE ids */ { setAlterUserSql(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);} -#line 2995 "sql.c" break; - case 43: /* cmd ::= ALTER DNODE ids ids */ -#line 173 "sql.y" + case 42: /* cmd ::= ALTER DNODE ids ids */ { setDCLSqlElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 3000 "sql.c" break; - case 44: /* cmd ::= ALTER DNODE ids ids ids */ -#line 174 "sql.y" + case 43: /* cmd ::= ALTER DNODE ids ids ids */ { setDCLSqlElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 3005 "sql.c" break; - case 45: /* cmd ::= ALTER LOCAL ids */ -#line 175 "sql.y" + case 44: /* cmd ::= ALTER LOCAL ids */ { setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0); } -#line 3010 "sql.c" break; - case 46: /* cmd ::= ALTER LOCAL ids ids */ -#line 176 "sql.y" + case 45: /* cmd ::= ALTER LOCAL ids ids */ { setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 3015 "sql.c" - break; - case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */ - case 48: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==48); -#line 177 "sql.y" -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy10, &t);} -#line 3021 "sql.c" - break; - case 49: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -#line 180 "sql.y" -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy427);} -#line 3026 "sql.c" - break; - case 50: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -#line 181 "sql.y" -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy427);} -#line 3031 "sql.c" - break; - case 51: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ -#line 185 "sql.y" -{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy345);} -#line 3036 "sql.c" - break; - case 52: /* ids ::= ID */ - case 53: /* ids ::= STRING */ yytestcase(yyruleno==53); -#line 191 "sql.y" + break; + case 46: /* cmd ::= ALTER DATABASE ids alter_db_optr */ + case 47: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==47); +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy532, &t);} + break; + case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */ +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy31);} + break; + case 49: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy31);} + break; + case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ +{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy231);} + break; + case 51: /* ids ::= ID */ + case 52: /* ids ::= STRING */ yytestcase(yyruleno==52); {yylhsminor.yy0 = yymsp[0].minor.yy0; } -#line 3042 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 54: /* ifexists ::= IF EXISTS */ -#line 195 "sql.y" + case 53: /* ifexists ::= IF EXISTS */ { yymsp[-1].minor.yy0.n = 1;} -#line 3048 "sql.c" break; - case 55: /* ifexists ::= */ - case 57: /* ifnotexists ::= */ yytestcase(yyruleno==57); - case 181: /* distinct ::= */ yytestcase(yyruleno==181); -#line 196 "sql.y" + case 54: /* ifexists ::= */ + case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56); + case 180: /* distinct ::= */ yytestcase(yyruleno==180); { yymsp[1].minor.yy0.n = 0;} -#line 3055 "sql.c" break; - case 56: /* ifnotexists ::= IF NOT EXISTS */ -#line 199 "sql.y" + case 55: /* ifnotexists ::= IF NOT EXISTS */ { yymsp[-2].minor.yy0.n = 1;} -#line 3060 "sql.c" break; - case 58: /* cmd ::= CREATE DNODE ids */ -#line 204 "sql.y" + case 57: /* cmd ::= CREATE DNODE ids */ { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} -#line 3065 "sql.c" - break; - case 59: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -#line 206 "sql.y" -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy427);} -#line 3070 "sql.c" - break; - case 60: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - case 61: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==61); -#line 207 "sql.y" -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy10, &yymsp[-2].minor.yy0);} -#line 3076 "sql.c" - break; - case 62: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -#line 209 "sql.y" -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy487, &yymsp[0].minor.yy0, 1);} -#line 3081 "sql.c" - break; - case 63: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -#line 210 "sql.y" -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy487, &yymsp[0].minor.yy0, 2);} -#line 3086 "sql.c" - break; - case 64: /* cmd ::= CREATE USER ids PASS ids */ -#line 211 "sql.y" + break; + case 58: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy31);} + break; + case 59: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + case 60: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==60); +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy532, &yymsp[-2].minor.yy0);} + break; + case 61: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy103, &yymsp[0].minor.yy0, 1);} + break; + case 62: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy103, &yymsp[0].minor.yy0, 2);} + break; + case 63: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} -#line 3091 "sql.c" - break; - case 65: /* bufsize ::= */ - case 67: /* pps ::= */ yytestcase(yyruleno==67); - case 69: /* tseries ::= */ yytestcase(yyruleno==69); - case 71: /* dbs ::= */ yytestcase(yyruleno==71); - case 73: /* streams ::= */ yytestcase(yyruleno==73); - case 75: /* storage ::= */ yytestcase(yyruleno==75); - case 77: /* qtime ::= */ yytestcase(yyruleno==77); - case 79: /* users ::= */ yytestcase(yyruleno==79); - case 81: /* conns ::= */ yytestcase(yyruleno==81); - case 83: /* state ::= */ yytestcase(yyruleno==83); -#line 213 "sql.y" + break; + case 64: /* bufsize ::= */ + case 66: /* pps ::= */ yytestcase(yyruleno==66); + case 68: /* tseries ::= */ yytestcase(yyruleno==68); + case 70: /* dbs ::= */ yytestcase(yyruleno==70); + case 72: /* streams ::= */ yytestcase(yyruleno==72); + case 74: /* storage ::= */ yytestcase(yyruleno==74); + case 76: /* qtime ::= */ yytestcase(yyruleno==76); + case 78: /* users ::= */ yytestcase(yyruleno==78); + case 80: /* conns ::= */ yytestcase(yyruleno==80); + case 82: /* state ::= */ yytestcase(yyruleno==82); { yymsp[1].minor.yy0.n = 0; } -#line 3105 "sql.c" - break; - case 66: /* bufsize ::= BUFSIZE INTEGER */ - case 68: /* pps ::= PPS INTEGER */ yytestcase(yyruleno==68); - case 70: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==70); - case 72: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==72); - case 74: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==74); - case 76: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==76); - case 78: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==78); - case 80: /* users ::= USERS INTEGER */ yytestcase(yyruleno==80); - case 82: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==82); - case 84: /* state ::= STATE ids */ yytestcase(yyruleno==84); -#line 214 "sql.y" + break; + case 65: /* bufsize ::= BUFSIZE INTEGER */ + case 67: /* pps ::= PPS INTEGER */ yytestcase(yyruleno==67); + case 69: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==69); + case 71: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==71); + case 73: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==73); + case 75: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==75); + case 77: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==77); + case 79: /* users ::= USERS INTEGER */ yytestcase(yyruleno==79); + case 81: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==81); + case 83: /* state ::= STATE ids */ yytestcase(yyruleno==83); { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } -#line 3119 "sql.c" break; - case 85: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ -#line 244 "sql.y" + case 84: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy427.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy427.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy427.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy427.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy427.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy427.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy427.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy427.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy427.stat = yymsp[0].minor.yy0; + yylhsminor.yy31.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy31.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy31.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy31.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy31.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy31.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy31.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy31.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy31.stat = yymsp[0].minor.yy0; } -#line 3134 "sql.c" - yymsp[-8].minor.yy427 = yylhsminor.yy427; - break; - case 86: /* intitemlist ::= intitemlist COMMA intitem */ - case 155: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==155); -#line 260 "sql.y" -{ yylhsminor.yy345 = tVariantListAppend(yymsp[-2].minor.yy345, &yymsp[0].minor.yy2, -1); } -#line 3141 "sql.c" - yymsp[-2].minor.yy345 = yylhsminor.yy345; - break; - case 87: /* intitemlist ::= intitem */ - case 156: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==156); -#line 261 "sql.y" -{ yylhsminor.yy345 = tVariantListAppend(NULL, &yymsp[0].minor.yy2, -1); } -#line 3148 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; - break; - case 88: /* intitem ::= INTEGER */ - case 157: /* tagitem ::= INTEGER */ yytestcase(yyruleno==157); - case 158: /* tagitem ::= FLOAT */ yytestcase(yyruleno==158); - case 159: /* tagitem ::= STRING */ yytestcase(yyruleno==159); - case 160: /* tagitem ::= BOOL */ yytestcase(yyruleno==160); - case 212: /* item ::= ID */ yytestcase(yyruleno==212); -#line 263 "sql.y" -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy2, &yymsp[0].minor.yy0); } -#line 3159 "sql.c" - yymsp[0].minor.yy2 = yylhsminor.yy2; - break; - case 89: /* keep ::= KEEP intitemlist */ -#line 267 "sql.y" -{ yymsp[-1].minor.yy345 = yymsp[0].minor.yy345; } -#line 3165 "sql.c" - break; - case 90: /* cache ::= CACHE INTEGER */ - case 91: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==91); - case 92: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==92); - case 93: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==93); - case 94: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==94); - case 95: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==95); - case 96: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==96); - case 97: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==97); - case 98: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==98); - case 99: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==99); - case 100: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==100); - case 101: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==101); - case 102: /* update ::= UPDATE INTEGER */ yytestcase(yyruleno==102); - case 103: /* cachelast ::= CACHELAST INTEGER */ yytestcase(yyruleno==103); - case 104: /* partitions ::= PARTITIONS INTEGER */ yytestcase(yyruleno==104); -#line 269 "sql.y" + yymsp[-8].minor.yy31 = yylhsminor.yy31; + break; + case 85: /* intitemlist ::= intitemlist COMMA intitem */ + case 154: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==154); +{ yylhsminor.yy231 = tVariantListAppend(yymsp[-2].minor.yy231, &yymsp[0].minor.yy176, -1); } + yymsp[-2].minor.yy231 = yylhsminor.yy231; + break; + case 86: /* intitemlist ::= intitem */ + case 155: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==155); +{ yylhsminor.yy231 = tVariantListAppend(NULL, &yymsp[0].minor.yy176, -1); } + yymsp[0].minor.yy231 = yylhsminor.yy231; + break; + case 87: /* intitem ::= INTEGER */ + case 156: /* tagitem ::= INTEGER */ yytestcase(yyruleno==156); + case 157: /* tagitem ::= FLOAT */ yytestcase(yyruleno==157); + case 158: /* tagitem ::= STRING */ yytestcase(yyruleno==158); + case 159: /* tagitem ::= BOOL */ yytestcase(yyruleno==159); + case 220: /* item ::= ID */ yytestcase(yyruleno==220); +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy176, &yymsp[0].minor.yy0, true); } + yymsp[0].minor.yy176 = yylhsminor.yy176; + break; + case 88: /* keep ::= KEEP intitemlist */ +{ yymsp[-1].minor.yy231 = yymsp[0].minor.yy231; } + break; + case 89: /* cache ::= CACHE INTEGER */ + case 90: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==90); + case 91: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==91); + case 92: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==92); + case 93: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==93); + case 94: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==94); + case 95: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==95); + case 96: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==96); + case 97: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==97); + case 98: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==98); + case 99: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==99); + case 100: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==100); + case 101: /* update ::= UPDATE INTEGER */ yytestcase(yyruleno==101); + case 102: /* cachelast ::= CACHELAST INTEGER */ yytestcase(yyruleno==102); + case 103: /* partitions ::= PARTITIONS INTEGER */ yytestcase(yyruleno==103); { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } -#line 3184 "sql.c" - break; - case 105: /* db_optr ::= */ -#line 286 "sql.y" -{setDefaultCreateDbOption(&yymsp[1].minor.yy10); yymsp[1].minor.yy10.dbType = TSDB_DB_TYPE_DEFAULT;} -#line 3189 "sql.c" - break; - case 106: /* db_optr ::= db_optr cache */ -#line 288 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3194 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 107: /* db_optr ::= db_optr replica */ - case 124: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==124); -#line 289 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3201 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 108: /* db_optr ::= db_optr quorum */ - case 125: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==125); -#line 290 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3208 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 109: /* db_optr ::= db_optr days */ -#line 291 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3214 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 110: /* db_optr ::= db_optr minrows */ -#line 292 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } -#line 3220 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 111: /* db_optr ::= db_optr maxrows */ -#line 293 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } -#line 3226 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 112: /* db_optr ::= db_optr blocks */ - case 127: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==127); -#line 294 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3233 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 113: /* db_optr ::= db_optr ctime */ -#line 295 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3239 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 114: /* db_optr ::= db_optr wal */ -#line 296 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3245 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 115: /* db_optr ::= db_optr fsync */ -#line 297 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3251 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 116: /* db_optr ::= db_optr comp */ - case 128: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==128); -#line 298 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3258 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 117: /* db_optr ::= db_optr prec */ -#line 299 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.precision = yymsp[0].minor.yy0; } -#line 3264 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 118: /* db_optr ::= db_optr keep */ - case 126: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==126); -#line 300 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.keep = yymsp[0].minor.yy345; } -#line 3271 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 119: /* db_optr ::= db_optr update */ - case 129: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==129); -#line 301 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3278 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 120: /* db_optr ::= db_optr cachelast */ - case 130: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==130); -#line 302 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3285 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 121: /* topic_optr ::= db_optr */ - case 131: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==131); -#line 306 "sql.y" -{ yylhsminor.yy10 = yymsp[0].minor.yy10; yylhsminor.yy10.dbType = TSDB_DB_TYPE_TOPIC; } -#line 3292 "sql.c" - yymsp[0].minor.yy10 = yylhsminor.yy10; - break; - case 122: /* topic_optr ::= topic_optr partitions */ - case 132: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==132); -#line 307 "sql.y" -{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3299 "sql.c" - yymsp[-1].minor.yy10 = yylhsminor.yy10; - break; - case 123: /* alter_db_optr ::= */ -#line 310 "sql.y" -{ setDefaultCreateDbOption(&yymsp[1].minor.yy10); yymsp[1].minor.yy10.dbType = TSDB_DB_TYPE_DEFAULT;} -#line 3305 "sql.c" - break; - case 133: /* typename ::= ids */ -#line 330 "sql.y" + break; + case 104: /* db_optr ::= */ +{setDefaultCreateDbOption(&yymsp[1].minor.yy532); yymsp[1].minor.yy532.dbType = TSDB_DB_TYPE_DEFAULT;} + break; + case 105: /* db_optr ::= db_optr cache */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 106: /* db_optr ::= db_optr replica */ + case 123: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==123); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 107: /* db_optr ::= db_optr quorum */ + case 124: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==124); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 108: /* db_optr ::= db_optr days */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 109: /* db_optr ::= db_optr minrows */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 110: /* db_optr ::= db_optr maxrows */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 111: /* db_optr ::= db_optr blocks */ + case 126: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==126); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 112: /* db_optr ::= db_optr ctime */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 113: /* db_optr ::= db_optr wal */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 114: /* db_optr ::= db_optr fsync */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 115: /* db_optr ::= db_optr comp */ + case 127: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==127); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 116: /* db_optr ::= db_optr prec */ +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 117: /* db_optr ::= db_optr keep */ + case 125: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==125); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.keep = yymsp[0].minor.yy231; } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 118: /* db_optr ::= db_optr update */ + case 128: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==128); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 119: /* db_optr ::= db_optr cachelast */ + case 129: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==129); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 120: /* topic_optr ::= db_optr */ + case 130: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==130); +{ yylhsminor.yy532 = yymsp[0].minor.yy532; yylhsminor.yy532.dbType = TSDB_DB_TYPE_TOPIC; } + yymsp[0].minor.yy532 = yylhsminor.yy532; + break; + case 121: /* topic_optr ::= topic_optr partitions */ + case 131: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==131); +{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy532 = yylhsminor.yy532; + break; + case 122: /* alter_db_optr ::= */ +{ setDefaultCreateDbOption(&yymsp[1].minor.yy532); yymsp[1].minor.yy532.dbType = TSDB_DB_TYPE_DEFAULT;} + break; + case 132: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy487, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy103, &yymsp[0].minor.yy0); } -#line 3313 "sql.c" - yymsp[0].minor.yy487 = yylhsminor.yy487; + yymsp[0].minor.yy103 = yylhsminor.yy103; break; - case 134: /* typename ::= ids LP signed RP */ -#line 336 "sql.y" + case 133: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy525 <= 0) { + if (yymsp[-1].minor.yy549 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSetColumnType(&yylhsminor.yy487, &yymsp[-3].minor.yy0); + tSetColumnType(&yylhsminor.yy103, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy525; // negative value of name length - tSetColumnType(&yylhsminor.yy487, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy549; // negative value of name length + tSetColumnType(&yylhsminor.yy103, &yymsp[-3].minor.yy0); } } -#line 3327 "sql.c" - yymsp[-3].minor.yy487 = yylhsminor.yy487; + yymsp[-3].minor.yy103 = yylhsminor.yy103; break; - case 135: /* typename ::= ids UNSIGNED */ -#line 347 "sql.y" + case 134: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSetColumnType (&yylhsminor.yy487, &yymsp[-1].minor.yy0); + tSetColumnType (&yylhsminor.yy103, &yymsp[-1].minor.yy0); } -#line 3337 "sql.c" - yymsp[-1].minor.yy487 = yylhsminor.yy487; - break; - case 136: /* signed ::= INTEGER */ -#line 354 "sql.y" -{ yylhsminor.yy525 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3343 "sql.c" - yymsp[0].minor.yy525 = yylhsminor.yy525; - break; - case 137: /* signed ::= PLUS INTEGER */ -#line 355 "sql.y" -{ yymsp[-1].minor.yy525 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } -#line 3349 "sql.c" - break; - case 138: /* signed ::= MINUS INTEGER */ -#line 356 "sql.y" -{ yymsp[-1].minor.yy525 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} -#line 3354 "sql.c" - break; - case 142: /* cmd ::= CREATE TABLE create_table_list */ -#line 362 "sql.y" -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy170;} -#line 3359 "sql.c" - break; - case 143: /* create_table_list ::= create_from_stable */ -#line 366 "sql.y" + yymsp[-1].minor.yy103 = yylhsminor.yy103; + break; + case 135: /* signed ::= INTEGER */ +{ yylhsminor.yy549 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy549 = yylhsminor.yy549; + break; + case 136: /* signed ::= PLUS INTEGER */ +{ yymsp[-1].minor.yy549 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 137: /* signed ::= MINUS INTEGER */ +{ yymsp[-1].minor.yy549 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} + break; + case 141: /* cmd ::= CREATE TABLE create_table_list */ +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy422;} + break; + case 142: /* create_table_list ::= create_from_stable */ { SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy72); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy306); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy170 = pCreateTable; + yylhsminor.yy422 = pCreateTable; } -#line 3371 "sql.c" - yymsp[0].minor.yy170 = yylhsminor.yy170; + yymsp[0].minor.yy422 = yylhsminor.yy422; break; - case 144: /* create_table_list ::= create_table_list create_from_stable */ -#line 375 "sql.y" + case 143: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy170->childTableInfo, &yymsp[0].minor.yy72); - yylhsminor.yy170 = yymsp[-1].minor.yy170; + taosArrayPush(yymsp[-1].minor.yy422->childTableInfo, &yymsp[0].minor.yy306); + yylhsminor.yy422 = yymsp[-1].minor.yy422; } -#line 3380 "sql.c" - yymsp[-1].minor.yy170 = yylhsminor.yy170; + yymsp[-1].minor.yy422 = yylhsminor.yy422; break; - case 145: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ -#line 381 "sql.y" + case 144: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy170 = tSetCreateTableInfo(yymsp[-1].minor.yy345, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy170, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy422 = tSetCreateTableInfo(yymsp[-1].minor.yy231, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy422, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } -#line 3392 "sql.c" - yymsp[-5].minor.yy170 = yylhsminor.yy170; + yymsp[-5].minor.yy422 = yylhsminor.yy422; break; - case 146: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ -#line 391 "sql.y" + case 145: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy170 = tSetCreateTableInfo(yymsp[-5].minor.yy345, yymsp[-1].minor.yy345, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy170, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy422 = tSetCreateTableInfo(yymsp[-5].minor.yy231, yymsp[-1].minor.yy231, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy422, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } -#line 3404 "sql.c" - yymsp[-9].minor.yy170 = yylhsminor.yy170; + yymsp[-9].minor.yy422 = yylhsminor.yy422; break; - case 147: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ -#line 402 "sql.y" + case 146: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy72 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy345, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy306 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy231, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } -#line 3414 "sql.c" - yymsp[-9].minor.yy72 = yylhsminor.yy72; + yymsp[-9].minor.yy306 = yylhsminor.yy306; break; - case 148: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ -#line 408 "sql.y" + case 147: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ { yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; - yylhsminor.yy72 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy345, yymsp[-1].minor.yy345, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); + yylhsminor.yy306 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy231, yymsp[-1].minor.yy231, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); } -#line 3424 "sql.c" - yymsp[-12].minor.yy72 = yylhsminor.yy72; - break; - case 149: /* tagNamelist ::= tagNamelist COMMA ids */ -#line 416 "sql.y" -{taosArrayPush(yymsp[-2].minor.yy345, &yymsp[0].minor.yy0); yylhsminor.yy345 = yymsp[-2].minor.yy345; } -#line 3430 "sql.c" - yymsp[-2].minor.yy345 = yylhsminor.yy345; - break; - case 150: /* tagNamelist ::= ids */ -#line 417 "sql.y" -{yylhsminor.yy345 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy345, &yymsp[0].minor.yy0);} -#line 3436 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; - break; - case 151: /* create_table_args ::= ifnotexists ids cpxName AS select */ -#line 421 "sql.y" + yymsp[-12].minor.yy306 = yylhsminor.yy306; + break; + case 148: /* tagNamelist ::= tagNamelist COMMA ids */ +{taosArrayPush(yymsp[-2].minor.yy231, &yymsp[0].minor.yy0); yylhsminor.yy231 = yymsp[-2].minor.yy231; } + yymsp[-2].minor.yy231 = yylhsminor.yy231; + break; + case 149: /* tagNamelist ::= ids */ +{yylhsminor.yy231 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy231, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy231 = yylhsminor.yy231; + break; + case 150: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy170 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy68, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy170, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy422 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy86, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy422, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } -#line 3448 "sql.c" - yymsp[-4].minor.yy170 = yylhsminor.yy170; - break; - case 152: /* columnlist ::= columnlist COMMA column */ -#line 432 "sql.y" -{taosArrayPush(yymsp[-2].minor.yy345, &yymsp[0].minor.yy487); yylhsminor.yy345 = yymsp[-2].minor.yy345; } -#line 3454 "sql.c" - yymsp[-2].minor.yy345 = yylhsminor.yy345; - break; - case 153: /* columnlist ::= column */ -#line 433 "sql.y" -{yylhsminor.yy345 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy345, &yymsp[0].minor.yy487);} -#line 3460 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; - break; - case 154: /* column ::= ids typename */ -#line 437 "sql.y" + yymsp[-4].minor.yy422 = yylhsminor.yy422; + break; + case 151: /* columnlist ::= columnlist COMMA column */ +{taosArrayPush(yymsp[-2].minor.yy231, &yymsp[0].minor.yy103); yylhsminor.yy231 = yymsp[-2].minor.yy231; } + yymsp[-2].minor.yy231 = yylhsminor.yy231; + break; + case 152: /* columnlist ::= column */ +{yylhsminor.yy231 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy231, &yymsp[0].minor.yy103);} + yymsp[0].minor.yy231 = yylhsminor.yy231; + break; + case 153: /* column ::= ids typename */ { - tSetColumnInfo(&yylhsminor.yy487, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy487); + tSetColumnInfo(&yylhsminor.yy103, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy103); } -#line 3468 "sql.c" - yymsp[-1].minor.yy487 = yylhsminor.yy487; - break; - case 161: /* tagitem ::= NULL */ -#line 452 "sql.y" -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy2, &yymsp[0].minor.yy0); } -#line 3474 "sql.c" - yymsp[0].minor.yy2 = yylhsminor.yy2; - break; - case 162: /* tagitem ::= NOW */ -#line 453 "sql.y" -{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy2, &yymsp[0].minor.yy0);} -#line 3480 "sql.c" - yymsp[0].minor.yy2 = yylhsminor.yy2; - break; - case 163: /* tagitem ::= MINUS INTEGER */ - case 164: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==164); - case 165: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==165); - case 166: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==166); -#line 455 "sql.y" + yymsp[-1].minor.yy103 = yylhsminor.yy103; + break; + case 160: /* tagitem ::= NULL */ +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy176, &yymsp[0].minor.yy0, true); } + yymsp[0].minor.yy176 = yylhsminor.yy176; + break; + case 161: /* tagitem ::= NOW */ +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy176, &yymsp[0].minor.yy0, true);} + yymsp[0].minor.yy176 = yylhsminor.yy176; + break; + case 162: /* tagitem ::= MINUS INTEGER */ + case 163: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==163); + case 164: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==164); + case 165: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==165); { 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.yy2, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy176, &yymsp[-1].minor.yy0, true); } -#line 3494 "sql.c" - yymsp[-1].minor.yy2 = yylhsminor.yy2; + yymsp[-1].minor.yy176 = yylhsminor.yy176; break; - case 167: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ -#line 486 "sql.y" + case 166: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { - yylhsminor.yy68 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy345, yymsp[-11].minor.yy484, yymsp[-10].minor.yy418, yymsp[-4].minor.yy345, yymsp[-2].minor.yy345, &yymsp[-9].minor.yy280, &yymsp[-7].minor.yy295, &yymsp[-6].minor.yy432, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy345, &yymsp[0].minor.yy114, &yymsp[-1].minor.yy114, yymsp[-3].minor.yy418); + yylhsminor.yy86 = tSetQuerySqlNode(&yymsp[-14].minor.yy0, yymsp[-13].minor.yy231, yymsp[-12].minor.yy484, yymsp[-11].minor.yy226, yymsp[-4].minor.yy231, yymsp[-2].minor.yy231, &yymsp[-9].minor.yy430, &yymsp[-7].minor.yy409, &yymsp[-6].minor.yy228, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy231, &yymsp[0].minor.yy444, &yymsp[-1].minor.yy444, yymsp[-3].minor.yy226, &yymsp[-10].minor.yy480); } -#line 3502 "sql.c" - yymsp[-13].minor.yy68 = yylhsminor.yy68; - break; - case 168: /* select ::= LP select RP */ -#line 490 "sql.y" -{yymsp[-2].minor.yy68 = yymsp[-1].minor.yy68;} -#line 3508 "sql.c" - break; - case 169: /* union ::= select */ -#line 494 "sql.y" -{ yylhsminor.yy345 = setSubclause(NULL, yymsp[0].minor.yy68); } -#line 3513 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; - break; - case 170: /* union ::= union UNION ALL select */ -#line 495 "sql.y" -{ yylhsminor.yy345 = appendSelectClause(yymsp[-3].minor.yy345, yymsp[0].minor.yy68); } -#line 3519 "sql.c" - yymsp[-3].minor.yy345 = yylhsminor.yy345; - break; - case 171: /* cmd ::= union */ -#line 497 "sql.y" -{ setSqlInfo(pInfo, yymsp[0].minor.yy345, NULL, TSDB_SQL_SELECT); } -#line 3525 "sql.c" - break; - case 172: /* select ::= SELECT selcollist */ -#line 504 "sql.y" + yymsp[-14].minor.yy86 = yylhsminor.yy86; + break; + case 167: /* select ::= LP select RP */ +{yymsp[-2].minor.yy86 = yymsp[-1].minor.yy86;} + break; + case 168: /* union ::= select */ +{ yylhsminor.yy231 = setSubclause(NULL, yymsp[0].minor.yy86); } + yymsp[0].minor.yy231 = yylhsminor.yy231; + break; + case 169: /* union ::= union UNION ALL select */ +{ yylhsminor.yy231 = appendSelectClause(yymsp[-3].minor.yy231, yymsp[0].minor.yy86); } + yymsp[-3].minor.yy231 = yylhsminor.yy231; + break; + case 170: /* cmd ::= union */ +{ setSqlInfo(pInfo, yymsp[0].minor.yy231, NULL, TSDB_SQL_SELECT); } + break; + case 171: /* select ::= SELECT selcollist */ { - yylhsminor.yy68 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy345, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy86 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy231, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } -#line 3532 "sql.c" - yymsp[-1].minor.yy68 = yylhsminor.yy68; - break; - case 173: /* sclp ::= selcollist COMMA */ -#line 516 "sql.y" -{yylhsminor.yy345 = yymsp[-1].minor.yy345;} -#line 3538 "sql.c" - yymsp[-1].minor.yy345 = yylhsminor.yy345; - break; - case 174: /* sclp ::= */ - case 206: /* orderby_opt ::= */ yytestcase(yyruleno==206); -#line 517 "sql.y" -{yymsp[1].minor.yy345 = 0;} -#line 3545 "sql.c" - break; - case 175: /* selcollist ::= sclp distinct expr as */ -#line 518 "sql.y" + yymsp[-1].minor.yy86 = yylhsminor.yy86; + break; + case 172: /* sclp ::= selcollist COMMA */ +{yylhsminor.yy231 = yymsp[-1].minor.yy231;} + yymsp[-1].minor.yy231 = yylhsminor.yy231; + break; + case 173: /* sclp ::= */ + case 214: /* orderby_opt ::= */ yytestcase(yyruleno==214); +{yymsp[1].minor.yy231 = 0;} + break; + case 174: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy345 = tSqlExprListAppend(yymsp[-3].minor.yy345, yymsp[-1].minor.yy418, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy231 = tSqlExprListAppend(yymsp[-3].minor.yy231, yymsp[-1].minor.yy226, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } -#line 3552 "sql.c" - yymsp[-3].minor.yy345 = yylhsminor.yy345; + yymsp[-3].minor.yy231 = yylhsminor.yy231; break; - case 176: /* selcollist ::= sclp STAR */ -#line 522 "sql.y" + case 175: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(pInfo, NULL, TK_ALL); - yylhsminor.yy345 = tSqlExprListAppend(yymsp[-1].minor.yy345, pNode, 0, 0); + yylhsminor.yy231 = tSqlExprListAppend(yymsp[-1].minor.yy231, pNode, 0, 0); } -#line 3561 "sql.c" - yymsp[-1].minor.yy345 = yylhsminor.yy345; + yymsp[-1].minor.yy231 = yylhsminor.yy231; break; - case 177: /* as ::= AS ids */ -#line 530 "sql.y" + case 176: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } -#line 3567 "sql.c" break; - case 178: /* as ::= ids */ -#line 531 "sql.y" + case 177: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } -#line 3572 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 179: /* as ::= */ -#line 532 "sql.y" + case 178: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } -#line 3578 "sql.c" break; - case 180: /* distinct ::= DISTINCT */ -#line 535 "sql.y" + case 179: /* distinct ::= DISTINCT */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } -#line 3583 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 182: /* from ::= FROM tablelist */ - case 183: /* from ::= FROM sub */ yytestcase(yyruleno==183); -#line 541 "sql.y" + case 181: /* from ::= FROM tablelist */ + case 182: /* from ::= FROM sub */ yytestcase(yyruleno==182); {yymsp[-1].minor.yy484 = yymsp[0].minor.yy484;} -#line 3590 "sql.c" - break; - case 184: /* sub ::= LP union RP */ -#line 546 "sql.y" -{yymsp[-2].minor.yy484 = addSubqueryElem(NULL, yymsp[-1].minor.yy345, NULL);} -#line 3595 "sql.c" - break; - case 185: /* sub ::= LP union RP ids */ -#line 547 "sql.y" -{yymsp[-3].minor.yy484 = addSubqueryElem(NULL, yymsp[-2].minor.yy345, &yymsp[0].minor.yy0);} -#line 3600 "sql.c" - break; - case 186: /* sub ::= sub COMMA LP union RP ids */ -#line 548 "sql.y" -{yylhsminor.yy484 = addSubqueryElem(yymsp[-5].minor.yy484, yymsp[-2].minor.yy345, &yymsp[0].minor.yy0);} -#line 3605 "sql.c" + break; + case 183: /* sub ::= LP union RP */ +{yymsp[-2].minor.yy484 = addSubqueryElem(NULL, yymsp[-1].minor.yy231, NULL);} + break; + case 184: /* sub ::= LP union RP ids */ +{yymsp[-3].minor.yy484 = addSubqueryElem(NULL, yymsp[-2].minor.yy231, &yymsp[0].minor.yy0);} + break; + case 185: /* sub ::= sub COMMA LP union RP ids */ +{yylhsminor.yy484 = addSubqueryElem(yymsp[-5].minor.yy484, yymsp[-2].minor.yy231, &yymsp[0].minor.yy0);} yymsp[-5].minor.yy484 = yylhsminor.yy484; break; - case 187: /* tablelist ::= ids cpxName */ -#line 552 "sql.y" + case 186: /* tablelist ::= ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy484 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } -#line 3614 "sql.c" yymsp[-1].minor.yy484 = yylhsminor.yy484; break; - case 188: /* tablelist ::= ids cpxName ids */ -#line 557 "sql.y" + case 187: /* tablelist ::= ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yylhsminor.yy484 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 3623 "sql.c" yymsp[-2].minor.yy484 = yylhsminor.yy484; break; - case 189: /* tablelist ::= tablelist COMMA ids cpxName */ -#line 562 "sql.y" + case 188: /* tablelist ::= tablelist COMMA ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy484 = setTableNameList(yymsp[-3].minor.yy484, &yymsp[-1].minor.yy0, NULL); } -#line 3632 "sql.c" yymsp[-3].minor.yy484 = yylhsminor.yy484; break; - case 190: /* tablelist ::= tablelist COMMA ids cpxName ids */ -#line 567 "sql.y" + case 189: /* tablelist ::= tablelist COMMA ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yylhsminor.yy484 = setTableNameList(yymsp[-4].minor.yy484, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 3641 "sql.c" yymsp[-4].minor.yy484 = yylhsminor.yy484; break; - case 191: /* tmvar ::= VARIABLE */ -#line 574 "sql.y" + case 190: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} -#line 3647 "sql.c" yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 192: /* interval_option ::= intervalKey LP tmvar RP */ -#line 577 "sql.y" -{yylhsminor.yy280.interval = yymsp[-1].minor.yy0; yylhsminor.yy280.offset.n = 0; yylhsminor.yy280.token = yymsp[-3].minor.yy40;} -#line 3653 "sql.c" - yymsp[-3].minor.yy280 = yylhsminor.yy280; - break; - case 193: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ -#line 578 "sql.y" -{yylhsminor.yy280.interval = yymsp[-3].minor.yy0; yylhsminor.yy280.offset = yymsp[-1].minor.yy0; yylhsminor.yy280.token = yymsp[-5].minor.yy40;} -#line 3659 "sql.c" - yymsp[-5].minor.yy280 = yylhsminor.yy280; - break; - case 194: /* interval_option ::= */ -#line 579 "sql.y" -{memset(&yymsp[1].minor.yy280, 0, sizeof(yymsp[1].minor.yy280));} -#line 3665 "sql.c" - break; - case 195: /* intervalKey ::= INTERVAL */ -#line 582 "sql.y" -{yymsp[0].minor.yy40 = TK_INTERVAL;} -#line 3670 "sql.c" - break; - case 196: /* intervalKey ::= EVERY */ -#line 583 "sql.y" -{yymsp[0].minor.yy40 = TK_EVERY; } -#line 3675 "sql.c" - break; - case 197: /* session_option ::= */ -#line 586 "sql.y" -{yymsp[1].minor.yy295.col.n = 0; yymsp[1].minor.yy295.gap.n = 0;} -#line 3680 "sql.c" - break; - case 198: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ -#line 587 "sql.y" + case 191: /* timestamp ::= INTEGER */ +{ yylhsminor.yy226 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 192: /* timestamp ::= MINUS INTEGER */ + case 193: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==193); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy226 = tSqlExprCreateTimestamp(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy226 = yylhsminor.yy226; + break; + case 194: /* timestamp ::= STRING */ +{ yylhsminor.yy226 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 195: /* timestamp ::= NOW */ +{ yylhsminor.yy226 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 196: /* timestamp ::= NOW PLUS VARIABLE */ +{yymsp[-2].minor.yy226 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_PLUS); } + break; + case 197: /* timestamp ::= NOW MINUS VARIABLE */ +{yymsp[-2].minor.yy226 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_MINUS); } + break; + case 198: /* range_option ::= */ +{yymsp[1].minor.yy480.start = 0; yymsp[1].minor.yy480.end = 0;} + break; + case 199: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */ +{yymsp[-5].minor.yy480.start = yymsp[-3].minor.yy226; yymsp[-5].minor.yy480.end = yymsp[-1].minor.yy226;} + break; + case 200: /* interval_option ::= intervalKey LP tmvar RP */ +{yylhsminor.yy430.interval = yymsp[-1].minor.yy0; yylhsminor.yy430.offset.n = 0; yylhsminor.yy430.token = yymsp[-3].minor.yy310;} + yymsp[-3].minor.yy430 = yylhsminor.yy430; + break; + case 201: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ +{yylhsminor.yy430.interval = yymsp[-3].minor.yy0; yylhsminor.yy430.offset = yymsp[-1].minor.yy0; yylhsminor.yy430.token = yymsp[-5].minor.yy310;} + yymsp[-5].minor.yy430 = yylhsminor.yy430; + break; + case 202: /* interval_option ::= */ +{memset(&yymsp[1].minor.yy430, 0, sizeof(yymsp[1].minor.yy430));} + break; + case 203: /* intervalKey ::= INTERVAL */ +{yymsp[0].minor.yy310 = TK_INTERVAL;} + break; + case 204: /* intervalKey ::= EVERY */ +{yymsp[0].minor.yy310 = TK_EVERY; } + break; + case 205: /* session_option ::= */ +{yymsp[1].minor.yy409.col.n = 0; yymsp[1].minor.yy409.gap.n = 0;} + break; + case 206: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - yymsp[-6].minor.yy295.col = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy295.gap = yymsp[-1].minor.yy0; + yymsp[-6].minor.yy409.col = yymsp[-4].minor.yy0; + yymsp[-6].minor.yy409.gap = yymsp[-1].minor.yy0; } -#line 3689 "sql.c" break; - case 199: /* windowstate_option ::= */ -#line 594 "sql.y" -{ yymsp[1].minor.yy432.col.n = 0; yymsp[1].minor.yy432.col.z = NULL;} -#line 3694 "sql.c" + case 207: /* windowstate_option ::= */ +{ yymsp[1].minor.yy228.col.n = 0; yymsp[1].minor.yy228.col.z = NULL;} break; - case 200: /* windowstate_option ::= STATE_WINDOW LP ids RP */ -#line 595 "sql.y" -{ yymsp[-3].minor.yy432.col = yymsp[-1].minor.yy0; } -#line 3699 "sql.c" + case 208: /* windowstate_option ::= STATE_WINDOW LP ids RP */ +{ yymsp[-3].minor.yy228.col = yymsp[-1].minor.yy0; } break; - case 201: /* fill_opt ::= */ -#line 599 "sql.y" -{ yymsp[1].minor.yy345 = 0; } -#line 3704 "sql.c" + case 209: /* fill_opt ::= */ +{ yymsp[1].minor.yy231 = 0; } break; - case 202: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ -#line 600 "sql.y" + case 210: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); - tVariantCreate(&A, &yymsp[-3].minor.yy0); + tVariantCreate(&A, &yymsp[-3].minor.yy0, true); - tVariantListInsert(yymsp[-1].minor.yy345, &A, -1, 0); - yymsp[-5].minor.yy345 = yymsp[-1].minor.yy345; + tVariantListInsert(yymsp[-1].minor.yy231, &A, -1, 0); + yymsp[-5].minor.yy231 = yymsp[-1].minor.yy231; } -#line 3716 "sql.c" break; - case 203: /* fill_opt ::= FILL LP ID RP */ -#line 609 "sql.y" + case 211: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy345 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy231 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true); } -#line 3724 "sql.c" break; - case 204: /* sliding_opt ::= SLIDING LP tmvar RP */ -#line 615 "sql.y" + case 212: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } -#line 3729 "sql.c" break; - case 205: /* sliding_opt ::= */ -#line 616 "sql.y" + case 213: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } -#line 3734 "sql.c" break; - case 207: /* orderby_opt ::= ORDER BY sortlist */ -#line 625 "sql.y" -{yymsp[-2].minor.yy345 = yymsp[0].minor.yy345;} -#line 3739 "sql.c" + case 215: /* orderby_opt ::= ORDER BY sortlist */ +{yymsp[-2].minor.yy231 = yymsp[0].minor.yy231;} break; - case 208: /* sortlist ::= sortlist COMMA item sortorder */ -#line 627 "sql.y" + case 216: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy345 = commonItemAppend(yymsp[-3].minor.yy345, &yymsp[-1].minor.yy2, NULL, false, yymsp[0].minor.yy281); + yylhsminor.yy231 = commonItemAppend(yymsp[-3].minor.yy231, &yymsp[-1].minor.yy176, NULL, false, yymsp[0].minor.yy502); } -#line 3746 "sql.c" - yymsp[-3].minor.yy345 = yylhsminor.yy345; + yymsp[-3].minor.yy231 = yylhsminor.yy231; break; - case 209: /* sortlist ::= sortlist COMMA arrow sortorder */ -#line 631 "sql.y" + case 217: /* sortlist ::= sortlist COMMA arrow sortorder */ { - yylhsminor.yy345 = commonItemAppend(yymsp[-3].minor.yy345, NULL, yymsp[-1].minor.yy418, true, yymsp[0].minor.yy281); + yylhsminor.yy231 = commonItemAppend(yymsp[-3].minor.yy231, NULL, yymsp[-1].minor.yy226, true, yymsp[0].minor.yy502); } -#line 3754 "sql.c" - yymsp[-3].minor.yy345 = yylhsminor.yy345; + yymsp[-3].minor.yy231 = yylhsminor.yy231; break; - case 210: /* sortlist ::= item sortorder */ -#line 635 "sql.y" + case 218: /* sortlist ::= item sortorder */ { - yylhsminor.yy345 = commonItemAppend(NULL, &yymsp[-1].minor.yy2, NULL, false, yymsp[0].minor.yy281); + yylhsminor.yy231 = commonItemAppend(NULL, &yymsp[-1].minor.yy176, NULL, false, yymsp[0].minor.yy502); } -#line 3762 "sql.c" - yymsp[-1].minor.yy345 = yylhsminor.yy345; + yymsp[-1].minor.yy231 = yylhsminor.yy231; break; - case 211: /* sortlist ::= arrow sortorder */ -#line 639 "sql.y" + case 219: /* sortlist ::= arrow sortorder */ { - yylhsminor.yy345 = commonItemAppend(NULL, NULL, yymsp[-1].minor.yy418, true, yymsp[0].minor.yy281); + yylhsminor.yy231 = commonItemAppend(NULL, NULL, yymsp[-1].minor.yy226, true, yymsp[0].minor.yy502); } -#line 3770 "sql.c" - yymsp[-1].minor.yy345 = yylhsminor.yy345; + yymsp[-1].minor.yy231 = yylhsminor.yy231; break; - case 213: /* item ::= ID DOT ID */ -#line 645 "sql.y" + case 221: /* item ::= ID DOT ID */ { toTSDBType(yymsp[-2].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy2, &yymsp[-2].minor.yy0); + tVariantCreate(&yylhsminor.yy176, &yymsp[-2].minor.yy0, true); } -#line 3780 "sql.c" - yymsp[-2].minor.yy2 = yylhsminor.yy2; - break; - case 214: /* sortorder ::= ASC */ -#line 652 "sql.y" -{ yymsp[0].minor.yy281 = TSDB_ORDER_ASC; } -#line 3786 "sql.c" - break; - case 215: /* sortorder ::= DESC */ -#line 653 "sql.y" -{ yymsp[0].minor.yy281 = TSDB_ORDER_DESC;} -#line 3791 "sql.c" - break; - case 216: /* sortorder ::= */ -#line 654 "sql.y" -{ yymsp[1].minor.yy281 = TSDB_ORDER_ASC; } -#line 3796 "sql.c" - break; - case 217: /* groupby_opt ::= */ -#line 662 "sql.y" -{ yymsp[1].minor.yy345 = 0;} -#line 3801 "sql.c" - break; - case 218: /* groupby_opt ::= GROUP BY grouplist */ -#line 663 "sql.y" -{ yymsp[-2].minor.yy345 = yymsp[0].minor.yy345;} -#line 3806 "sql.c" - break; - case 219: /* grouplist ::= grouplist COMMA item */ -#line 665 "sql.y" + yymsp[-2].minor.yy176 = yylhsminor.yy176; + break; + case 222: /* sortorder ::= ASC */ +{ yymsp[0].minor.yy502 = TSDB_ORDER_ASC; } + break; + case 223: /* sortorder ::= DESC */ +{ yymsp[0].minor.yy502 = TSDB_ORDER_DESC;} + break; + case 224: /* sortorder ::= */ +{ yymsp[1].minor.yy502 = TSDB_ORDER_ASC; } + break; + case 225: /* groupby_opt ::= */ +{ yymsp[1].minor.yy231 = 0;} + break; + case 226: /* groupby_opt ::= GROUP BY grouplist */ +{ yymsp[-2].minor.yy231 = yymsp[0].minor.yy231;} + break; + case 227: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy345 = commonItemAppend(yymsp[-2].minor.yy345, &yymsp[0].minor.yy2, NULL, false, -1); + yylhsminor.yy231 = commonItemAppend(yymsp[-2].minor.yy231, &yymsp[0].minor.yy176, NULL, false, -1); } -#line 3813 "sql.c" - yymsp[-2].minor.yy345 = yylhsminor.yy345; + yymsp[-2].minor.yy231 = yylhsminor.yy231; break; - case 220: /* grouplist ::= grouplist COMMA arrow */ -#line 669 "sql.y" + case 228: /* grouplist ::= grouplist COMMA arrow */ { - yylhsminor.yy345 = commonItemAppend(yymsp[-2].minor.yy345, NULL, yymsp[0].minor.yy418, true, -1); + yylhsminor.yy231 = commonItemAppend(yymsp[-2].minor.yy231, NULL, yymsp[0].minor.yy226, true, -1); } -#line 3821 "sql.c" - yymsp[-2].minor.yy345 = yylhsminor.yy345; + yymsp[-2].minor.yy231 = yylhsminor.yy231; break; - case 221: /* grouplist ::= item */ -#line 673 "sql.y" + case 229: /* grouplist ::= item */ { - yylhsminor.yy345 = commonItemAppend(NULL, &yymsp[0].minor.yy2, NULL, false, -1); + yylhsminor.yy231 = commonItemAppend(NULL, &yymsp[0].minor.yy176, NULL, false, -1); } -#line 3829 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; + yymsp[0].minor.yy231 = yylhsminor.yy231; break; - case 222: /* grouplist ::= arrow */ -#line 677 "sql.y" + case 230: /* grouplist ::= arrow */ { - yylhsminor.yy345 = commonItemAppend(NULL, NULL, yymsp[0].minor.yy418, true, -1); + yylhsminor.yy231 = commonItemAppend(NULL, NULL, yymsp[0].minor.yy226, true, -1); } -#line 3837 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; - break; - case 223: /* having_opt ::= */ - case 233: /* where_opt ::= */ yytestcase(yyruleno==233); - case 281: /* expritem ::= */ yytestcase(yyruleno==281); -#line 684 "sql.y" -{yymsp[1].minor.yy418 = 0;} -#line 3845 "sql.c" - break; - case 224: /* having_opt ::= HAVING expr */ - case 234: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==234); -#line 685 "sql.y" -{yymsp[-1].minor.yy418 = yymsp[0].minor.yy418;} -#line 3851 "sql.c" - break; - case 225: /* limit_opt ::= */ - case 229: /* slimit_opt ::= */ yytestcase(yyruleno==229); -#line 689 "sql.y" -{yymsp[1].minor.yy114.limit = -1; yymsp[1].minor.yy114.offset = 0;} -#line 3857 "sql.c" - break; - case 226: /* limit_opt ::= LIMIT signed */ - case 230: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==230); -#line 690 "sql.y" -{yymsp[-1].minor.yy114.limit = yymsp[0].minor.yy525; yymsp[-1].minor.yy114.offset = 0;} -#line 3863 "sql.c" - break; - case 227: /* limit_opt ::= LIMIT signed OFFSET signed */ -#line 692 "sql.y" -{ yymsp[-3].minor.yy114.limit = yymsp[-2].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[0].minor.yy525;} -#line 3868 "sql.c" - break; - case 228: /* limit_opt ::= LIMIT signed COMMA signed */ -#line 694 "sql.y" -{ yymsp[-3].minor.yy114.limit = yymsp[0].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[-2].minor.yy525;} -#line 3873 "sql.c" - break; - case 231: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -#line 700 "sql.y" -{yymsp[-3].minor.yy114.limit = yymsp[-2].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[0].minor.yy525;} -#line 3878 "sql.c" - break; - case 232: /* slimit_opt ::= SLIMIT signed COMMA signed */ -#line 702 "sql.y" -{yymsp[-3].minor.yy114.limit = yymsp[0].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[-2].minor.yy525;} -#line 3883 "sql.c" - break; - case 235: /* expr ::= LP expr RP */ -#line 715 "sql.y" -{yylhsminor.yy418 = yymsp[-1].minor.yy418; yylhsminor.yy418->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy418->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} -#line 3888 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 236: /* expr ::= ID */ -#line 717 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} -#line 3894 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 237: /* expr ::= ID DOT ID */ -#line 718 "sql.y" -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} -#line 3900 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 238: /* expr ::= ID DOT STAR */ -#line 719 "sql.y" -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} -#line 3906 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 239: /* expr ::= INTEGER */ -#line 721 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} -#line 3912 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 240: /* expr ::= MINUS INTEGER */ - case 241: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==241); -#line 722 "sql.y" -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} -#line 3919 "sql.c" - yymsp[-1].minor.yy418 = yylhsminor.yy418; - break; - case 242: /* expr ::= FLOAT */ -#line 724 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} -#line 3925 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 243: /* expr ::= MINUS FLOAT */ - case 244: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==244); -#line 725 "sql.y" -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} -#line 3932 "sql.c" - yymsp[-1].minor.yy418 = yylhsminor.yy418; - break; - case 245: /* expr ::= STRING */ -#line 727 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} -#line 3938 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 246: /* expr ::= NOW */ -#line 728 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } -#line 3944 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 247: /* expr ::= VARIABLE */ -#line 729 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} -#line 3950 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 248: /* expr ::= PLUS VARIABLE */ - case 249: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==249); -#line 730 "sql.y" -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} -#line 3957 "sql.c" - yymsp[-1].minor.yy418 = yylhsminor.yy418; - break; - case 250: /* expr ::= BOOL */ -#line 732 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} -#line 3963 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 251: /* expr ::= NULL */ -#line 733 "sql.y" -{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} -#line 3969 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 252: /* expr ::= ID LP exprlist RP */ -#line 736 "sql.y" -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy418 = tSqlExprCreateFunction(yymsp[-1].minor.yy345, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } -#line 3975 "sql.c" - yymsp[-3].minor.yy418 = yylhsminor.yy418; - break; - case 253: /* expr ::= ID LP STAR RP */ -#line 739 "sql.y" -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy418 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } -#line 3981 "sql.c" - yymsp[-3].minor.yy418 = yylhsminor.yy418; - break; - case 254: /* expr ::= expr IS NULL */ -#line 742 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, NULL, TK_ISNULL);} -#line 3987 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 255: /* expr ::= expr IS NOT NULL */ -#line 743 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-3].minor.yy418, NULL, TK_NOTNULL);} -#line 3993 "sql.c" - yymsp[-3].minor.yy418 = yylhsminor.yy418; - break; - case 256: /* expr ::= expr LT expr */ -#line 746 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_LT);} -#line 3999 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 257: /* expr ::= expr GT expr */ -#line 747 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_GT);} -#line 4005 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 258: /* expr ::= expr LE expr */ -#line 748 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_LE);} -#line 4011 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 259: /* expr ::= expr GE expr */ -#line 749 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_GE);} -#line 4017 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 260: /* expr ::= expr NE expr */ -#line 750 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_NE);} -#line 4023 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 261: /* expr ::= expr EQ expr */ -#line 751 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_EQ);} -#line 4029 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 262: /* expr ::= expr BETWEEN expr AND expr */ -#line 753 "sql.y" -{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy418); yylhsminor.yy418 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy418, yymsp[-2].minor.yy418, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy418, TK_LE), TK_AND);} -#line 4035 "sql.c" - yymsp[-4].minor.yy418 = yylhsminor.yy418; - break; - case 263: /* expr ::= expr AND expr */ -#line 755 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_AND);} -#line 4041 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 264: /* expr ::= expr OR expr */ -#line 756 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_OR); } -#line 4047 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 265: /* expr ::= expr PLUS expr */ -#line 759 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_PLUS); } -#line 4053 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 266: /* expr ::= expr MINUS expr */ -#line 760 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_MINUS); } -#line 4059 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 267: /* expr ::= expr STAR expr */ -#line 761 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_STAR); } -#line 4065 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 268: /* expr ::= expr SLASH expr */ -#line 762 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_DIVIDE);} -#line 4071 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 269: /* expr ::= expr REM expr */ -#line 763 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_REM); } -#line 4077 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 270: /* expr ::= expr LIKE expr */ -#line 766 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_LIKE); } -#line 4083 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 271: /* expr ::= expr MATCH expr */ -#line 769 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_MATCH); } -#line 4089 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 272: /* expr ::= expr NMATCH expr */ -#line 770 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_NMATCH); } -#line 4095 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 273: /* expr ::= ID QUESTION STRING */ -#line 773 "sql.y" -{ tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy418 = tSqlExprCreate(S, M, TK_QUESTION); } -#line 4101 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 274: /* arrow ::= ID ARROW STRING */ -#line 778 "sql.y" -{tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy418 = tSqlExprCreate(S, M, TK_ARROW); } -#line 4107 "sql.c" - yymsp[-2].minor.yy418 = yylhsminor.yy418; - break; - case 275: /* arrow ::= ID DOT ID ARROW STRING */ -#line 779 "sql.y" -{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.yy418 = tSqlExprCreate(S, M, TK_ARROW); } -#line 4113 "sql.c" - yymsp[-4].minor.yy418 = yylhsminor.yy418; - break; - case 276: /* expr ::= arrow */ - case 280: /* expritem ::= expr */ yytestcase(yyruleno==280); -#line 781 "sql.y" -{yylhsminor.yy418 = yymsp[0].minor.yy418;} -#line 4120 "sql.c" - yymsp[0].minor.yy418 = yylhsminor.yy418; - break; - case 277: /* expr ::= expr IN LP exprlist RP */ -#line 784 "sql.y" -{yylhsminor.yy418 = tSqlExprCreate(yymsp[-4].minor.yy418, (tSqlExpr*)yymsp[-1].minor.yy345, TK_IN); } -#line 4126 "sql.c" - yymsp[-4].minor.yy418 = yylhsminor.yy418; - break; - case 278: /* exprlist ::= exprlist COMMA expritem */ -#line 792 "sql.y" -{yylhsminor.yy345 = tSqlExprListAppend(yymsp[-2].minor.yy345,yymsp[0].minor.yy418,0, 0);} -#line 4132 "sql.c" - yymsp[-2].minor.yy345 = yylhsminor.yy345; - break; - case 279: /* exprlist ::= expritem */ -#line 793 "sql.y" -{yylhsminor.yy345 = tSqlExprListAppend(0,yymsp[0].minor.yy418,0, 0);} -#line 4138 "sql.c" - yymsp[0].minor.yy345 = yylhsminor.yy345; - break; - case 282: /* cmd ::= RESET QUERY CACHE */ -#line 798 "sql.y" + yymsp[0].minor.yy231 = yylhsminor.yy231; + break; + case 231: /* having_opt ::= */ + case 241: /* where_opt ::= */ yytestcase(yyruleno==241); + case 289: /* expritem ::= */ yytestcase(yyruleno==289); +{yymsp[1].minor.yy226 = 0;} + break; + case 232: /* having_opt ::= HAVING expr */ + case 242: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==242); +{yymsp[-1].minor.yy226 = yymsp[0].minor.yy226;} + break; + case 233: /* limit_opt ::= */ + case 237: /* slimit_opt ::= */ yytestcase(yyruleno==237); +{yymsp[1].minor.yy444.limit = -1; yymsp[1].minor.yy444.offset = 0;} + break; + case 234: /* limit_opt ::= LIMIT signed */ + case 238: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==238); +{yymsp[-1].minor.yy444.limit = yymsp[0].minor.yy549; yymsp[-1].minor.yy444.offset = 0;} + break; + case 235: /* limit_opt ::= LIMIT signed OFFSET signed */ +{ yymsp[-3].minor.yy444.limit = yymsp[-2].minor.yy549; yymsp[-3].minor.yy444.offset = yymsp[0].minor.yy549;} + break; + case 236: /* limit_opt ::= LIMIT signed COMMA signed */ +{ yymsp[-3].minor.yy444.limit = yymsp[0].minor.yy549; yymsp[-3].minor.yy444.offset = yymsp[-2].minor.yy549;} + break; + case 239: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ +{yymsp[-3].minor.yy444.limit = yymsp[-2].minor.yy549; yymsp[-3].minor.yy444.offset = yymsp[0].minor.yy549;} + break; + case 240: /* slimit_opt ::= SLIMIT signed COMMA signed */ +{yymsp[-3].minor.yy444.limit = yymsp[0].minor.yy549; yymsp[-3].minor.yy444.offset = yymsp[-2].minor.yy549;} + break; + case 243: /* expr ::= LP expr RP */ +{yylhsminor.yy226 = yymsp[-1].minor.yy226; yylhsminor.yy226->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy226->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 244: /* expr ::= ID */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 245: /* expr ::= ID DOT ID */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 246: /* expr ::= ID DOT STAR */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 247: /* expr ::= INTEGER */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 248: /* expr ::= MINUS INTEGER */ + case 249: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==249); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy226 = yylhsminor.yy226; + break; + case 250: /* expr ::= FLOAT */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 251: /* expr ::= MINUS FLOAT */ + case 252: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==252); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy226 = yylhsminor.yy226; + break; + case 253: /* expr ::= STRING */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 254: /* expr ::= NOW */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 255: /* expr ::= VARIABLE */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 256: /* expr ::= PLUS VARIABLE */ + case 257: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==257); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} + yymsp[-1].minor.yy226 = yylhsminor.yy226; + break; + case 258: /* expr ::= BOOL */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 259: /* expr ::= NULL */ +{ yylhsminor.yy226 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 260: /* expr ::= ID LP exprlist RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy226 = tSqlExprCreateFunction(yymsp[-1].minor.yy231, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy226 = yylhsminor.yy226; + break; + case 261: /* expr ::= ID LP STAR RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy226 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy226 = yylhsminor.yy226; + break; + case 262: /* expr ::= expr IS NULL */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, NULL, TK_ISNULL);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 263: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-3].minor.yy226, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy226 = yylhsminor.yy226; + break; + case 264: /* expr ::= expr LT expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_LT);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 265: /* expr ::= expr GT expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_GT);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 266: /* expr ::= expr LE expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_LE);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 267: /* expr ::= expr GE expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_GE);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 268: /* expr ::= expr NE expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_NE);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 269: /* expr ::= expr EQ expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_EQ);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 270: /* expr ::= expr BETWEEN expr AND expr */ +{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy226); yylhsminor.yy226 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy226, yymsp[-2].minor.yy226, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy226, TK_LE), TK_AND);} + yymsp[-4].minor.yy226 = yylhsminor.yy226; + break; + case 271: /* expr ::= expr AND expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_AND);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 272: /* expr ::= expr OR expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_OR); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 273: /* expr ::= expr PLUS expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_PLUS); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 274: /* expr ::= expr MINUS expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_MINUS); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 275: /* expr ::= expr STAR expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_STAR); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 276: /* expr ::= expr SLASH expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_DIVIDE);} + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 277: /* expr ::= expr REM expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_REM); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 278: /* expr ::= expr LIKE expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_LIKE); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 279: /* expr ::= expr MATCH expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_MATCH); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 280: /* expr ::= expr NMATCH expr */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_NMATCH); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 281: /* expr ::= ID QUESTION STRING */ +{ tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy226 = tSqlExprCreate(S, M, TK_QUESTION); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 282: /* 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.yy226 = tSqlExprCreate(S, M, TK_ARROW); } + yymsp[-2].minor.yy226 = yylhsminor.yy226; + break; + case 283: /* 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.yy226 = tSqlExprCreate(S, M, TK_ARROW); } + yymsp[-4].minor.yy226 = yylhsminor.yy226; + break; + case 284: /* expr ::= arrow */ + case 288: /* expritem ::= expr */ yytestcase(yyruleno==288); +{yylhsminor.yy226 = yymsp[0].minor.yy226;} + yymsp[0].minor.yy226 = yylhsminor.yy226; + break; + case 285: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy226 = tSqlExprCreate(yymsp[-4].minor.yy226, (tSqlExpr*)yymsp[-1].minor.yy231, TK_IN); } + yymsp[-4].minor.yy226 = yylhsminor.yy226; + break; + case 286: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy231 = tSqlExprListAppend(yymsp[-2].minor.yy231,yymsp[0].minor.yy226,0, 0);} + yymsp[-2].minor.yy231 = yylhsminor.yy231; + break; + case 287: /* exprlist ::= expritem */ +{yylhsminor.yy231 = tSqlExprListAppend(0,yymsp[0].minor.yy226,0, 0);} + yymsp[0].minor.yy231 = yylhsminor.yy231; + break; + case 290: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} -#line 4144 "sql.c" break; - case 283: /* cmd ::= SYNCDB ids REPLICA */ -#line 801 "sql.y" + case 291: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} -#line 4149 "sql.c" break; - case 284: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ -#line 804 "sql.y" + case 292: /* 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.yy345, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4158 "sql.c" break; - case 285: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ -#line 810 "sql.y" + case 293: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; toTSDBType(yymsp[0].minor.yy0.type); - SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); + SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1, false); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4171 "sql.c" break; - case 286: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ -#line 820 "sql.y" + case 294: /* 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.yy345, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4180 "sql.c" break; - case 287: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ -#line 827 "sql.y" + case 295: /* 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.yy345, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4189 "sql.c" break; - case 288: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ -#line 832 "sql.y" + case 296: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; toTSDBType(yymsp[0].minor.yy0.type); - SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); + SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4202 "sql.c" break; - case 289: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ -#line 842 "sql.y" + case 297: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; toTSDBType(yymsp[-1].minor.yy0.type); - SArray* A = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + SArray* A = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true); toTSDBType(yymsp[0].minor.yy0.type); - A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1); + A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4218 "sql.c" break; - case 290: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ -#line 855 "sql.y" + case 298: /* 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); - A = tVariantListAppend(A, &yymsp[0].minor.yy2, -1); + SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1, true); + A = tVariantListAppend(A, &yymsp[0].minor.yy176, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4232 "sql.c" break; - case 291: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ -#line 866 "sql.y" + case 299: /* 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.yy345, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4241 "sql.c" break; - case 292: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ -#line 873 "sql.y" + case 300: /* 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.yy345, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4250 "sql.c" break; - case 293: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ -#line 879 "sql.y" + case 301: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; toTSDBType(yymsp[0].minor.yy0.type); - SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); + SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4263 "sql.c" break; - case 294: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ -#line 889 "sql.y" + case 302: /* 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.yy345, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4272 "sql.c" break; - case 295: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ -#line 896 "sql.y" + case 303: /* 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.yy345, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4281 "sql.c" break; - case 296: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ -#line 901 "sql.y" + case 304: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; toTSDBType(yymsp[0].minor.yy0.type); - SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); + SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4294 "sql.c" break; - case 297: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ -#line 911 "sql.y" + case 305: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; toTSDBType(yymsp[-1].minor.yy0.type); - SArray* A = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + SArray* A = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true); toTSDBType(yymsp[0].minor.yy0.type); - A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1); + A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1, true); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4310 "sql.c" break; - case 298: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ -#line 924 "sql.y" + case 306: /* 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); - A = tVariantListAppend(A, &yymsp[0].minor.yy2, -1); + SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1, true); + A = tVariantListAppend(A, &yymsp[0].minor.yy176, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4324 "sql.c" break; - case 299: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ -#line 935 "sql.y" + case 307: /* 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.yy345, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy231, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -#line 4333 "sql.c" break; - case 300: /* cmd ::= KILL CONNECTION INTEGER */ -#line 942 "sql.y" + case 308: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} -#line 4338 "sql.c" break; - case 301: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ -#line 943 "sql.y" + case 309: /* 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);} -#line 4343 "sql.c" break; - case 302: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ -#line 944 "sql.y" + case 310: /* 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);} -#line 4348 "sql.c" break; default: break; @@ -4407,7 +3983,6 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 38 "sql.y" pInfo->valid = false; int32_t outputBufLen = tListLen(pInfo->msg); @@ -4430,7 +4005,6 @@ static void yy_syntax_error( } assert(len <= outputBufLen); -#line 4433 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE @@ -4456,8 +4030,7 @@ static void yy_accept( /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ -#line 62 "sql.y" -#line 4460 "sql.c" + /*********** End %parse_accept code *******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/src/query/tests/cSortTest.cpp b/src/query/tests/cSortTest.cpp index aa5aa89afc211678cfc521dccd46fbdb533fbff1..ae3d4490ce8218031f8712f23b070dad637425e7 100644 --- a/src/query/tests/cSortTest.cpp +++ b/src/query/tests/cSortTest.cpp @@ -97,7 +97,7 @@ TEST(testCase, colunmnwise_sort_test) { } TEST(testCase, columnsort_test) { - SSchema field[1] = { + SSchema1 field[1] = { {TSDB_DATA_TYPE_INT, "k", sizeof(int32_t)}, }; diff --git a/src/query/tests/percentileTest.cpp b/src/query/tests/percentileTest.cpp index 1b6951201af5908378fb253b38cea01de1210d57..9985f7e6446913458c798ef8f27961e319bfc3d5 100644 --- a/src/query/tests/percentileTest.cpp +++ b/src/query/tests/percentileTest.cpp @@ -192,7 +192,7 @@ void largeDataTest() { void qsortTest() { printf("running : %s\n", __FUNCTION__); - SSchema field[1] = { + SSchema1 field[1] = { {TSDB_DATA_TYPE_INT, "k", sizeof(int32_t)}, }; diff --git a/src/tsdb/src/tsdbMemTable.c b/src/tsdb/src/tsdbMemTable.c index 28993f08c447c2a84a4493e40d74e924ad656c74..6bcffd85f411085f6fc973151fca5d97cf4bd87c 100644 --- a/src/tsdb/src/tsdbMemTable.c +++ b/src/tsdb/src/tsdbMemTable.c @@ -57,7 +57,7 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR STsdbRepo * pRepo = repo; SSubmitMsgIter msgIter = {0}; SSubmitBlk * pBlock = NULL; - int32_t affectedrows = 0; + int32_t affectedrows = 0, numOfRows = 0; if (tsdbScanAndConvertSubmitMsg(pRepo, pMsg) < 0) { if (terrno != TSDB_CODE_TDB_TABLE_RECONFIGURE) { @@ -73,9 +73,13 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR if (tsdbInsertDataToTable(pRepo, pBlock, &affectedrows) < 0) { return -1; } + numOfRows += pBlock->numOfRows; } - if (pRsp != NULL) pRsp->affectedRows = htonl(affectedrows); + if (pRsp != NULL) { + pRsp->affectedRows = htonl(affectedrows); + pRsp->numOfRows = htonl(numOfRows); + } if (tsdbCheckCommit(pRepo) < 0) return -1; return 0; diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 9c2d86fe017a893bc2f5af57371125b7214712f5..58f2ab657247d4fe63ae0fa235e859bc75c93fa7 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -347,7 +347,7 @@ int tsdbUpdateTableTagValue(STsdbRepo *repo, SUpdateTableTagValMsg *pMsg) { tsdbError( "vgId:%d failed to update tag value of table %s since version out of date, client tag version %d server tag " "version %d", - REPO_ID(pRepo), TABLE_CHAR_NAME(pTable), pMsg->tversion, schemaVersion(pTable->tagSchema)); + REPO_ID(pRepo), TABLE_CHAR_NAME(pTable), pMsg->tversion, schemaVersion(pTable->pSuper->tagSchema)); terrno = TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE; return -1; } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 145da28e2e881f14fdfb37594eae3d5f68499bf0..aaaf87545bf8362a00e063500b00e2dd030da572 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -684,8 +684,8 @@ SArray* tsdbGetQueriedTableList(TsdbQueryHandleT *pHandle) { TsdbQueryHandleT tsdbQueryRowsInExternalWindow(STsdbRepo *tsdb, STsdbQueryCond* pCond, STableGroupInfo *groupList, uint64_t qId, SMemRef* pRef) { STsdbQueryHandle *pQueryHandle = (STsdbQueryHandle*) tsdbQueryTables(tsdb, pCond, groupList, qId, pRef); - pQueryHandle->loadExternalRow = true; - pQueryHandle->currentLoadExternalRows = true; + //pQueryHandle->loadExternalRow = true; + //pQueryHandle->currentLoadExternalRows = true; return pQueryHandle; } @@ -1378,66 +1378,63 @@ static int32_t loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBlock, return code; } -static int doBinarySearchKey(char* pValue, int num, TSKEY key, int order) { - int firstPos, lastPos, midPos = -1; - int numOfRows; - TSKEY* keyList; - - assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); - - if (num <= 0) return -1; - - keyList = (TSKEY*)pValue; - firstPos = 0; - lastPos = num - 1; - - if (order == TSDB_ORDER_DESC) { +// search last keyList[ret] < key order asc and keyList[ret] > key order desc +static int doBinarySearchKey(TSKEY* keyList, int num, int pos, TSKEY key, int order) { + // start end posistion + int s, e; + s = pos; + + // check + assert(pos >=0 && pos < num); + assert(num > 0); + + if (order == TSDB_ORDER_ASC) { // find the first position which is smaller than the key + e = num - 1; + if (key < keyList[pos]) + return -1; while (1) { - if (key >= keyList[lastPos]) return lastPos; - if (key == keyList[firstPos]) return firstPos; - if (key < keyList[firstPos]) return firstPos - 1; - - numOfRows = lastPos - firstPos + 1; - midPos = (numOfRows >> 1) + firstPos; - - if (key < keyList[midPos]) { - lastPos = midPos - 1; - } else if (key > keyList[midPos]) { - firstPos = midPos + 1; - } else { - break; - } - } - - } else { + // check can return + if (key >= keyList[e]) + return e; + if (key <= keyList[s]) + return s; + if (e - s <= 1) + return s; + + // change start or end position + int mid = s + (e - s + 1)/2; + if (keyList[mid] > key) + e = mid; + else if(keyList[mid] < key) + s = mid; + else + return mid; + } + } else { // DESC // find the first position which is bigger than the key - while (1) { - if (key <= keyList[firstPos]) return firstPos; - if (key == keyList[lastPos]) return lastPos; - - if (key > keyList[lastPos]) { - lastPos = lastPos + 1; - if (lastPos >= num) - return -1; + e = 0; + if (key > keyList[pos]) + return -1; + while (1) { + // check can return + if (key <= keyList[e]) + return e; + if (key >= keyList[s]) + return s; + if (s - e <= 1) + return s; + + // change start or end position + int mid = s - (s - e + 1)/2; + if (keyList[mid] < key) + e = mid; + else if(keyList[mid] > key) + s = mid; else - return lastPos; - } - - numOfRows = lastPos - firstPos + 1; - midPos = (numOfRows >> 1) + firstPos; - - if (key < keyList[midPos]) { - lastPos = midPos - 1; - } else if (key > keyList[midPos]) { - firstPos = midPos + 1; - } else { - break; - } + return mid; + } } - } - - return midPos; } static int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t capacity, int32_t numOfRows, int32_t start, int32_t end) { @@ -1845,7 +1842,6 @@ static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STabl int32_t getEndPosInDataBlock(STsdbQueryHandle* pQueryHandle, SDataBlockInfo* pBlockInfo) { // NOTE: reverse the order to find the end position in data block int32_t endPos = -1; - int32_t order = ASCENDING_TRAVERSE(pQueryHandle->order)? TSDB_ORDER_DESC : TSDB_ORDER_ASC; SQueryFilePos* cur = &pQueryHandle->cur; SDataCols* pCols = pQueryHandle->rhelper.pDCols[0]; @@ -1858,7 +1854,9 @@ int32_t getEndPosInDataBlock(STsdbQueryHandle* pQueryHandle, SDataBlockInfo* pBl cur->mixBlock = (cur->pos != pBlockInfo->rows - 1); } else { assert(pCols->numOfRows > 0); - endPos = doBinarySearchKey(pCols->cols[0].pData, pCols->numOfRows, pQueryHandle->window.ekey, order); + int pos = ASCENDING_TRAVERSE(pQueryHandle->order)? 0 : pBlockInfo->rows - 1; + endPos = doBinarySearchKey(pCols->cols[0].pData, pCols->numOfRows, pos, pQueryHandle->window.ekey, pQueryHandle->order); + assert(endPos != -1); cur->mixBlock = true; } @@ -1878,17 +1876,16 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* assert(pCols->cols[0].type == TSDB_DATA_TYPE_TIMESTAMP && pCols->cols[0].colId == PRIMARYKEY_TIMESTAMP_COL_INDEX && cur->pos >= 0 && cur->pos < pBlock->numOfRows); - TSKEY* tsArray = pCols->cols[0].pData; - assert(pCols->numOfRows == pBlock->numOfRows && tsArray[0] == pBlock->keyFirst && tsArray[pBlock->numOfRows-1] == pBlock->keyLast); - - // for search the endPos, so the order needs to reverse - int32_t order = (pQueryHandle->order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC; + // key read from file + TSKEY* keyFile = pCols->cols[0].pData; + assert(pCols->numOfRows == pBlock->numOfRows && keyFile[0] == pBlock->keyFirst && keyFile[pBlock->numOfRows-1] == pBlock->keyLast); int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order)? 1:-1; int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle)); STable* pTable = pCheckInfo->pTableObj; int32_t endPos = getEndPosInDataBlock(pQueryHandle, &blockInfo); + tsdbDebug("%p uid:%" PRIu64",tid:%d start merge data block, file block range:%"PRIu64"-%"PRIu64" rows:%d, start:%d," "end:%d, 0x%"PRIx64, @@ -1903,6 +1900,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* STSchema* pSchema1 = NULL; STSchema* pSchema2 = NULL; + // position in file ->fpos int32_t pos = cur->pos; cur->win = TSWINDOW_INITIALIZER; @@ -1919,19 +1917,23 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* break; } - TSKEY key = memRowKey(row1); - if ((key > pQueryHandle->window.ekey && ASCENDING_TRAVERSE(pQueryHandle->order)) || - (key < pQueryHandle->window.ekey && !ASCENDING_TRAVERSE(pQueryHandle->order))) { + TSKEY keyMem = memRowKey(row1); + if ((keyMem > pQueryHandle->window.ekey && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (keyMem < pQueryHandle->window.ekey && !ASCENDING_TRAVERSE(pQueryHandle->order))) { break; } - if (((pos > endPos || tsArray[pos] > pQueryHandle->window.ekey) && ASCENDING_TRAVERSE(pQueryHandle->order)) || - ((pos < endPos || tsArray[pos] < pQueryHandle->window.ekey) && !ASCENDING_TRAVERSE(pQueryHandle->order))) { - break; + // break if pos not in this block endPos range. note old code when pos is -1 can crash. + if(ASCENDING_TRAVERSE(pQueryHandle->order)) { //ASC + if(pos > endPos || keyFile[pos] > pQueryHandle->window.ekey) + break; + } else { //DESC + if(pos < endPos || keyFile[pos] < pQueryHandle->window.ekey) + break; } - if ((key < tsArray[pos] && ASCENDING_TRAVERSE(pQueryHandle->order)) || - (key > tsArray[pos] && !ASCENDING_TRAVERSE(pQueryHandle->order))) { + if ((keyMem < keyFile[pos] && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (keyMem > keyFile[pos] && !ASCENDING_TRAVERSE(pQueryHandle->order))) { if (rv1 != memRowVersion(row1)) { pSchema1 = tsdbGetTableSchemaByVersion(pTable, memRowVersion(row1), (int8_t)memRowType(row1)); rv1 = memRowVersion(row1); @@ -1943,16 +1945,18 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* mergeTwoRowFromMem(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, row1, row2, numOfCols, pTable, pSchema1, pSchema2, true); numOfRows += 1; + // record start key with memory key if not if (cur->win.skey == TSKEY_INITIAL_VAL) { - cur->win.skey = key; + cur->win.skey = keyMem; } - cur->win.ekey = key; - cur->lastKey = key + step; + cur->win.ekey = keyMem; + cur->lastKey = keyMem + step; cur->mixBlock = true; moveToNextRowInMem(pCheckInfo); - } else if (key == tsArray[pos]) { // data in buffer has the same timestamp of data in file block, ignore it + // same select mem key if update is true + } else if (keyMem == keyFile[pos]) { if (pCfg->update) { if(pCfg->update == TD_ROW_PARTIAL_UPDATE) { doCopyRowsFromFileBlock(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, pos, pos); @@ -1970,31 +1974,36 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* mergeTwoRowFromMem(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, row1, row2, numOfCols, pTable, pSchema1, pSchema2, forceSetNull); numOfRows += 1; if (cur->win.skey == TSKEY_INITIAL_VAL) { - cur->win.skey = key; + cur->win.skey = keyMem; } - cur->win.ekey = key; - cur->lastKey = key + step; + cur->win.ekey = keyMem; + cur->lastKey = keyMem + step; cur->mixBlock = true; - + + //mem move next moveToNextRowInMem(pCheckInfo); + //file move next, discard file row pos += step; } else { + // not update, only mem move to next, discard mem row moveToNextRowInMem(pCheckInfo); } - } else if ((key > tsArray[pos] && ASCENDING_TRAVERSE(pQueryHandle->order)) || - (key < tsArray[pos] && !ASCENDING_TRAVERSE(pQueryHandle->order))) { + // put file row + } else if ((keyMem > keyFile[pos] && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (keyMem < keyFile[pos] && !ASCENDING_TRAVERSE(pQueryHandle->order))) { if (cur->win.skey == TSKEY_INITIAL_VAL) { - cur->win.skey = tsArray[pos]; + cur->win.skey = keyFile[pos]; } - int32_t end = doBinarySearchKey(pCols->cols[0].pData, pCols->numOfRows, key, order); + int32_t end = doBinarySearchKey(pCols->cols[0].pData, pCols->numOfRows, pos, keyMem, pQueryHandle->order); assert(end != -1); - if (tsArray[end] == key) { // the value of key in cache equals to the end timestamp value, ignore it + if (keyFile[end] == keyMem) { // the value of key in cache equals to the end timestamp value, ignore it if (pCfg->update == TD_ROW_DISCARD_UPDATE) { moveToNextRowInMem(pCheckInfo); } else { + // can update, don't copy then deal on next loop with keyMem == keyFile[pos] end -= step; } } @@ -2002,10 +2011,17 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* int32_t qstart = 0, qend = 0; getQualifiedRowsPos(pQueryHandle, pos, end, numOfRows, &qstart, &qend); - numOfRows = doCopyRowsFromFileBlock(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, qstart, qend); - pos += (qend - qstart + 1) * step; - - cur->win.ekey = ASCENDING_TRAVERSE(pQueryHandle->order)? tsArray[qend]:tsArray[qstart]; + if(qend >= qstart) { + // copy qend - qstart + 1 rows from file + numOfRows = doCopyRowsFromFileBlock(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, qstart, qend); + int32_t num = qend - qstart + 1; + pos += num * step; + } else { + // nothing copy from file + pos += step; + } + + cur->win.ekey = ASCENDING_TRAVERSE(pQueryHandle->order)? keyFile[qend] : keyFile[qstart]; cur->lastKey = cur->win.ekey + step; } } while (numOfRows < pQueryHandle->outputCapacity); @@ -2022,7 +2038,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* !ASCENDING_TRAVERSE(pQueryHandle->order))) { // no data in cache or data in cache is greater than the ekey of time window, load data from file block if (cur->win.skey == TSKEY_INITIAL_VAL) { - cur->win.skey = tsArray[pos]; + cur->win.skey = keyFile[pos]; } int32_t start = -1, end = -1; @@ -2031,7 +2047,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* numOfRows = doCopyRowsFromFileBlock(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, start, end); pos += (end - start + 1) * step; - cur->win.ekey = ASCENDING_TRAVERSE(pQueryHandle->order)? tsArray[end]:tsArray[start]; + cur->win.ekey = ASCENDING_TRAVERSE(pQueryHandle->order)? keyFile[end] : keyFile[start]; cur->lastKey = cur->win.ekey + step; cur->mixBlock = true; } @@ -2928,6 +2944,22 @@ static bool loadCachedLast(STsdbQueryHandle* pQueryHandle) { return false; } +void tsdbSwitchTable(TsdbQueryHandleT queryHandle) { + STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) queryHandle; + + STableCheckInfo* pCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, pQueryHandle->activeIndex); + pCheckInfo->numOfBlocks = 0; + + pQueryHandle->locateStart = false; + pQueryHandle->checkFiles = true; + pQueryHandle->cur.rows = 0; + pQueryHandle->currentLoadExternalRows = pQueryHandle->loadExternalRow; + + terrno = TSDB_CODE_SUCCESS; + + ++pQueryHandle->activeIndex; +} + static bool loadDataBlockFromTableSeq(STsdbQueryHandle* pQueryHandle) { size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); @@ -2961,6 +2993,9 @@ static bool loadDataBlockFromTableSeq(STsdbQueryHandle* pQueryHandle) { // handle data in cache situation bool tsdbNextDataBlock(TsdbQueryHandleT pHandle) { STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) pHandle; + if (pQueryHandle == NULL) { + return false; + } if (emptyQueryTimewindow(pQueryHandle)) { tsdbDebug("%p query window not overlaps with the data set, no result returned, 0x%"PRIx64, pQueryHandle, pQueryHandle->qId); @@ -3080,6 +3115,9 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM pSecQueryHandle = tsdbQueryTablesImpl(pQueryHandle->pTsdb, &cond, pQueryHandle->qId, pMemRef); tfree(cond.colList); + if (pSecQueryHandle == NULL) { + goto out_of_memory; + } // current table, only one table STableCheckInfo* pCurrent = taosArrayGet(pQueryHandle->pTableCheckInfo, pQueryHandle->activeIndex); diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 79214be83abe59cd4b642683109a13de77814d37..0ebf15a5a5801462e4a7b7a2667f6ee29da0998a 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -278,6 +278,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat if (j <= size) { if (c == '\\' && patterStr[i] == '_' && c1 == '_') { i++; continue; } + if (c == '\\' && patterStr[i] == '%' && c1 == '%') { i++; continue; } if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->matchOne && c1 != 0)) { continue; } diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 69b0d8d7bb9ad5ab37321a5460c3f083e3a71dba..4c968a8362766b564230befafb27c226c338c51b 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -334,8 +334,9 @@ bool taosReadConfigOption(const char *option, char *value, char *value2, char *v if (taosReadDirectoryConfig(cfg, value)) { taosReadDataDirCfg(value, value2, value3); ret = true; + } else { + ret = false; } - ret = false; break; default: uError("config option:%s, input value:%s, can't be recognized", option, value); diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 3e93796704a814e7e53adf2185b30346f50ba872..4b1285d3db67eede97a0499ade1020cbe11b19cf 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -230,7 +230,8 @@ static SKeyword keywordTable[] = { {"FUNCTIONS", TK_FUNCTIONS}, {"OUTPUTTYPE", TK_OUTPUTTYPE}, {"AGGREGATE", TK_AGGREGATE}, - {"BUFSIZE", TK_BUFSIZE} + {"BUFSIZE", TK_BUFSIZE}, + {"RANGE", TK_RANGE} }; static const char isIdChar[] = { diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index c8621e2b34eb3d8f7d02d7b0797b852a9cf8ed94..2da4b6ad19bc2d1ec0d49561f54502f2208b8aa0 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -69,7 +69,7 @@ int32_t strRmquote(char *z, int32_t len){ int32_t j = 0; for (uint32_t k = 1; k < len - 1; ++k) { if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) { - if (z[k] == '\\' && z[k + 1] == '_') { + if ((z[k] == '\\' && z[k + 1] == '_') || (z[k] == '\\' && z[k + 1] == '%')) { //match '_' self } else { z[j] = z[k + 1]; diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 35c2ab72dfdf55f66b1095c757fc4f90656c842b..40148fcc6d34196bed1997cb2499a4202a460fe2 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -27,6 +27,10 @@ #define MAX_QUEUED_MSG_NUM 100000 #define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB +static int64_t tsSubmitReqSucNum = 0; +static int64_t tsSubmitRowNum = 0; +static int64_t tsSubmitRowSucNum = 0; + extern void * tsDnodeTmr; static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, SRspRet *); static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *); @@ -163,7 +167,16 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR pRsp = pRet->rsp; } - if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) code = terrno; + if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) { + code = terrno; + } else { + if (pRsp != NULL) atomic_fetch_add_64(&tsSubmitReqSucNum, 1); + } + + if (pRsp) { + atomic_fetch_add_64(&tsSubmitRowNum, ntohl(pRsp->numOfRows)); + atomic_fetch_add_64(&tsSubmitRowSucNum, ntohl(pRsp->affectedRows)); + } return code; } @@ -425,3 +438,12 @@ void vnodeWaitWriteCompleted(SVnodeObj *pVnode) { if (extraSleep) taosMsleep(900); } + +SVnodeStatisInfo vnodeGetStatisInfo() { + SVnodeStatisInfo info = {0}; + info.submitReqSucNum = atomic_exchange_64(&tsSubmitReqSucNum, 0); + info.submitRowNum = atomic_exchange_64(&tsSubmitRowNum, 0); + info.submitRowSucNum = atomic_exchange_64(&tsSubmitRowSucNum, 0); + + return info; +} diff --git a/tests/examples/lua/OpenResty/rest/test.lua b/tests/examples/lua/OpenResty/rest/test.lua index 48aeef3fb4dd8c9a0dc18e8039b4b8c781760666..2dc0cf10f22b90c8bcb925700b1d7ebd00ff153a 100644 --- a/tests/examples/lua/OpenResty/rest/test.lua +++ b/tests/examples/lua/OpenResty/rest/test.lua @@ -63,6 +63,7 @@ else end +--[[ local flag = false function query_callback(res) if res.code ~=0 then @@ -80,9 +81,10 @@ end driver.query_a(conn,"insert into m1 values ('2019-09-01 00:00:00.001', 3, 'robotspace'),('2019-09-01 00:00:00.006', 4, 'Hilink'),('2019-09-01 00:00:00.007', 6, 'Harmony')", query_callback) while not flag do --- ngx.say("i am here once...") + ngx.say("i am here once...") ngx.sleep(0.001) -- time unit is second end +--]] ngx.say("pool water_mark:"..pool:get_water_mark()) diff --git a/tests/examples/lua/README.md b/tests/examples/lua/README.md index 32d6a4cace9bd0bf66238ff32af1d3ecf0285046..bdc88edbd7b5d6798a8df6530ea82d24eb22915b 100644 --- a/tests/examples/lua/README.md +++ b/tests/examples/lua/README.md @@ -1,7 +1,10 @@ # TDengine driver connector for Lua -It's a Lua implementation for [TDengine](https://github.com/taosdata/TDengine), an open-sourced big data platform designed and optimized for the Internet of Things (IoT), Connected Cars, Industrial IoT, and IT Infrastructure and Application Monitoring. You may need to install Lua5.3 . - +It's a Lua implementation for [TDengine](https://github.com/taosdata/TDengine), an open-sourced big data platform designed and optimized for the Internet of Things (IoT), Connected Cars, Industrial IoT, and IT Infrastructure and Application Monitoring. You may need to install Lua5.3 . +As TDengine is built with lua-enable, the built-in lua module conflicts with external lua. The following commands require TDengine built with lua-disable. +To disable built-in lua: +mkdir debug && cd debug +cmake .. -DBUILD_LUA=false && cmake --build . ## Lua Dependencies - Lua: ``` diff --git a/tests/examples/lua/lua51/lua_connector51.c b/tests/examples/lua/lua51/lua_connector51.c index fe2152945dc1915dca5de31458a8cbb2f007f4f2..b6e0b6d1de200b09750ffba6845ae9bf0606f4d8 100644 --- a/tests/examples/lua/lua51/lua_connector51.c +++ b/tests/examples/lua/lua51/lua_connector51.c @@ -102,7 +102,7 @@ static int l_query(lua_State *L){ printf("failed, reason:%s\n", taos_errstr(result)); lua_pushinteger(L, -1); lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); + lua_pushstring(L, taos_errstr(result)); lua_setfield(L, table_index, "error"); return 1; diff --git a/tests/examples/lua/lua_connector.c b/tests/examples/lua/lua_connector.c index 8c2ea3e9e83237fc8ed9ebce687f5131352e4d14..06568f35d656d5d9af1ae2e88eeaeba92f0ede91 100644 --- a/tests/examples/lua/lua_connector.c +++ b/tests/examples/lua/lua_connector.c @@ -102,7 +102,7 @@ static int l_query(lua_State *L){ printf("failed, reason:%s\n", taos_errstr(result)); lua_pushinteger(L, -1); lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); + lua_pushstring(L, taos_errstr(result)); lua_setfield(L, table_index, "error"); return 1; diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 8af0c4642e7452cf835442b17e28d9d7c498bde0..e057c5f542cb31570c8b7c810f512634bffc53f6 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -171,7 +171,7 @@ python3 test.py -f tools/taosdemoTestLimitOffset.py python3 test.py -f tools/taosdemoTestTblAlt.py python3 test.py -f tools/taosdemoTestSampleData.py python3 test.py -f tools/taosdemoTestInterlace.py -python3 test.py -f tools/taosdemoTestQuery.py +# python3 test.py -f tools/taosdemoTestQuery.py # restful test for python # python3 test.py -f restful/restful_bind_db1.py @@ -218,9 +218,9 @@ python3 ./test.py -f perfbenchmark/bug3433.py python3 ./test.py -f perfbenchmark/taosdemoInsert.py #taosdemo -#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py -# python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py -# python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py #query python3 test.py -f query/distinctOneColTb.py @@ -279,6 +279,7 @@ python3 ./test.py -f query/queryCnameDisplay.py # python3 ./test.py -f query/long_where_query.py python3 test.py -f query/nestedQuery/queryWithSpread.py python3 ./test.py -f query/bug6586.py +# python3 ./test.py -f query/bug5903.py #stream python3 ./test.py -f stream/metric_1.py @@ -363,7 +364,7 @@ python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py python3 ./test.py -f alter/alter_table.py python3 ./test.py -f query/queryGroupbySort.py -python3 ./test.py -f functions/queryTestCases.py +#python3 ./test.py -f functions/queryTestCases.py python3 ./test.py -f functions/function_stateWindow.py python3 ./test.py -f functions/function_derivative.py python3 ./test.py -f functions/function_irate.py diff --git a/tests/pytest/functions/function_count_last_stab.py b/tests/pytest/functions/function_count_last_stab.py index 1d777c6bd314941036f542c7d0e9063e590fa7dd..cd0a9b17c2fd8c98544dca09f6a7008929225ece 100644 --- a/tests/pytest/functions/function_count_last_stab.py +++ b/tests/pytest/functions/function_count_last_stab.py @@ -42,22 +42,22 @@ class TDTestCase: % (self.ts + i, i + 1, 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)) tdSql.query("select count(*),last(*) from stest group by col1") - tdSql.checkRows(10) - tdSql.checkData(0, 0, 1) - tdSql.checkData(1, 2, 2) - tdSql.checkData(1, 3, 1) + tdSql.checkRows(11) + tdSql.checkData(1, 0, 1) + tdSql.checkData(2, 2, 2) + tdSql.checkData(2, 3, 1) tdSql.query("select count(*),last(*) from stest group by col2") - tdSql.checkRows(1) - tdSql.checkData(0, 0, 10) - tdSql.checkData(0, 2, 10) - tdSql.checkData(0, 3, 1) + tdSql.checkRows(2) + tdSql.checkData(1, 0, 10) + tdSql.checkData(1, 2, 10) + tdSql.checkData(1, 3, 1) tdSql.query("select count(*),last(ts,stest.*) from stest group by col1") - tdSql.checkRows(10) - tdSql.checkData(0, 0, 1) - tdSql.checkData(0, 2, "2018-09-17 09:00:00") - tdSql.checkData(1, 4, 1) + tdSql.checkRows(11) + tdSql.checkData(1, 0, 1) + tdSql.checkData(1, 2, "2018-09-17 09:00:00") + tdSql.checkData(2, 4, 1) diff --git a/tests/pytest/functions/function_derivative.py b/tests/pytest/functions/function_derivative.py index db9fc04be2a4467fe47c3251d88a6781ccc31b67..a2a458ea290b13ed462d8dcd47a8af16e3af0f82 100644 --- a/tests/pytest/functions/function_derivative.py +++ b/tests/pytest/functions/function_derivative.py @@ -149,6 +149,7 @@ class TDTestCase: tdSql.error("select derivative(col, -106752999999999922222d, 0) from stb group by tbname"); #overflow error tdSql.error("select derivative(col, 10y, 0) from stb group by tbname") #TD-10399, DB error: syntax error near '10y, 0) from stb group by tbname;' tdSql.error("select derivative(col, -106752d, 0) from stb group by tbname") #TD-10398 overflow tips + tdSql.error("select derivative(col, 106751991168d, 0) from stb group by tbname") #TD-10398 overflow tips def run(self): tdSql.prepare() diff --git a/tests/pytest/functions/function_interp.py b/tests/pytest/functions/function_interp.py index ff7324d90b57904a8dea8ec5a0b391db839be72f..b3cf42fd275c07745109cf37eb9e1712b67ba7a9 100644 --- a/tests/pytest/functions/function_interp.py +++ b/tests/pytest/functions/function_interp.py @@ -12,137 +12,8387 @@ # -*- coding: utf-8 -*- import sys -from util.dnodes import * import taos +import numpy as np +import string +import os +import time from util.log import * from util.cases import * from util.sql import * -import numpy as np +from util.dnodes import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1630000000000 + self.num = 10 + + def function_introduction(self): + tdLog.info('select * from table|stable[group by tbname]|regular_table') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table ORDER BY ts DESC') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table where ts> ts_min') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table where ts> ts_max') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [range(ts_min,ts_max)]') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [EVERY(s)]') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [range(ts_min,ts_max)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select interp_select from table|stable[group by tbname]|regular_table [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select * from (select interp_select from table|stable[group by tbname]|regular_table)') + tdLog.info('select interp_select from (select * from table|stable[group by tbname]|regular_table)') + tdLog.info('select * from (select interp_select from table|stable[group by tbname]|regular_table [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)])') + tdLog.info('select interp_select from (select * from table|stable[group by tbname]|regular_table [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)])') + tdLog.info('select * from (select interp_select from table|stable[group by tbname]|regular_table) [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select interp_select from (select * from table|stable[group by tbname]|regular_table) [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]') + tdLog.info('select * from (select interp_select from table|stable[group by tbname]|regular_table [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]) a,\ + (select interp_select from table|stable[group by tbname]|regular_table [where condition] [range(ts_min,ts_max)] [EVERY(s)] [FILL(LINEAR,NEXT,PREV,VALUE,NULL)]) b where a.ts=b.ts') + tdLog.info('error select interp_select sql') + + def restartDnodes(self): + tdDnodes.stop(1) + tdDnodes.start(1) + + def dropandcreateDB(self): + 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 ) + tags(loc nchar(20));''') + tdSql.execute('''create table table_1 using stable_1 tags('table_1')''') + tdSql.execute('''create table table_2 using stable_1 tags('table_2')''') + tdSql.execute('''create table table_3 using stable_1 tags('table_3')''') + 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 ) ;''') + 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 ) ;''') + 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 ) ;''') + + for i in range(self.num): + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, i, i, i, i, i, i)) + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, i, i, i, i, i, i)) + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, i, i, i, i, i, i)) + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000 , i, i, i, i, i, i)) + + tdSql.execute('''insert into table_2 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + tdSql.execute('''insert into table_2 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + tdSql.execute('''insert into regular_table_2 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + tdSql.execute('''insert into regular_table_2 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000 , 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + + tdSql.execute('''insert into table_3 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + tdSql.execute('''insert into table_3 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + tdSql.execute('''insert into regular_table_3 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + tdSql.execute('''insert into regular_table_3 values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000 , -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + + def dropandcreateDB_null(self): + 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_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 bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp) + tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, + t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,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_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double ) + tags(loc nchar(20));''') + 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 , + 'binary1' , 'nchar1' , '1' , '11' , \'1999-09-09 09:09:09.090\')''') + tdSql.execute('''create table table_3 using stable_1 tags('table_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , + 'binary2' , 'nchar2nchar2' , '-2.2' , '-22.22' , \'2099-09-09 09:09:09.090\')''') + tdSql.execute('''create table table_21 using stable_2 tags('table_21')''') + 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_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 bool , q_binary binary(20) , q_nchar nchar(20) , q_ts 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_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 bool , q_binary binary(20) , q_nchar nchar(20) , q_ts 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_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 bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp) ;''') + + for i in range(self.num): + tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, i, i, i, i, i, i)) + tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, i, i, i, i, i, i)) + tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, i, i, i, i, i, i)) + tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000 , i, i, i, i, i, i)) + + tdSql.execute('''insert into table_21 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, i, i, i, i, i, i)) + tdSql.execute('''insert into table_21 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, i, i, i, i, i, i)) + + tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000 , 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i)) + + tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*10000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double) values(%d, %d, %d, %d, %d, %f, %f)''' + % (self.ts + i*3000 , -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i)) + + def result_0(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkRows(0) + dcDB = self.dropandcreateDB_null() + + def regular1_checkall_0_base(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:46:40.000') + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,0) + tdSql.checkData(0,6,0) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + + def regular1_checkall_0(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:46:40.000') + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,0) + tdSql.checkData(0,6,0) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,0) + tdSql.checkData(0,14,0) + tdSql.checkData(0,15,0) + tdSql.checkData(0,16,0) + tdSql.checkData(0,17,0) + tdSql.checkData(0,18,0) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular1_checkall_0_LINEAR(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:46:41.500') + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,0.5) + tdSql.checkData(0,6,0.5) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,0) + tdSql.checkData(0,14,0) + tdSql.checkData(0,15,0) + tdSql.checkData(0,16,0) + tdSql.checkData(0,17,0.5) + tdSql.checkData(0,18,0.5) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular1_checkall_0_NEXT(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:46:41.500') + tdSql.checkData(0,1,1) + tdSql.checkData(0,2,1) + tdSql.checkData(0,3,1) + tdSql.checkData(0,4,1) + tdSql.checkData(0,5,1) + tdSql.checkData(0,6,1) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,1) + tdSql.checkData(0,14,1) + tdSql.checkData(0,15,1) + tdSql.checkData(0,16,1) + tdSql.checkData(0,17,1) + tdSql.checkData(0,18,1) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular1_checkall_0_VALUE100(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'01:46:30.000') + tdSql.checkData(0,1,100) + tdSql.checkData(0,2,100) + tdSql.checkData(0,3,100) + tdSql.checkData(0,4,100) + tdSql.checkData(0,5,100) + tdSql.checkData(0,6,100) + # all data interp 100 + tdSql.checkData(0,7,100) + tdSql.checkData(0,8,100) + tdSql.checkData(0,9,100) + tdSql.checkData(0,10,100) + tdSql.checkData(0,11,100) + tdSql.checkData(0,12,100) + + tdSql.checkData(0,13,100) + tdSql.checkData(0,14,100) + tdSql.checkData(0,15,100) + tdSql.checkData(0,16,100) + tdSql.checkData(0,17,100) + tdSql.checkData(0,17,100) + tdSql.checkData(0,19,100) + tdSql.checkData(0,20,100) + tdSql.checkData(0,21,100) + tdSql.checkData(0,22,100) + tdSql.checkData(0,23,100) + tdSql.checkData(0,24,100) + + def regular1_checkall_0_NULL(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'01:46:30.000') + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,None) + tdSql.checkData(0,14,None) + tdSql.checkData(0,15,None) + tdSql.checkData(0,16,None) + tdSql.checkData(0,17,None) + tdSql.checkData(0,18,None) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular2_checkall_0(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:46:40.000') + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,0) + tdSql.checkData(0,6,0) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,2147483647) + tdSql.checkData(0,14,9223372036854775807) + tdSql.checkData(0,15,32767) + tdSql.checkData(0,16,127) + tdSql.checkData(0,17,0) + tdSql.checkData(0,18,0) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular2_checkall_0_LINEAR(self,sql): + tdLog.info(sql) + tdSql.query(sql) + #print(tdSql.queryResult) + tdSql.checkData(0,0,'2021-08-27 01:46:41.500') + tdSql.checkData(0,1,2147483646) + tdSql.checkData(0,2,9223372036854775806) + tdSql.checkData(0,3,32766) + tdSql.checkData(0,4,126) + tdSql.checkData(0,5,0.5) + tdSql.checkData(0,6,0.5) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,2147483646) + tdSql.checkData(0,14,9223372036854775806) + tdSql.checkData(0,15,32766) + tdSql.checkData(0,16,126) + tdSql.checkData(0,17,0.5) + tdSql.checkData(0,18,0.5) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular2_checkall_0_NEXT(self,sql): + tdLog.info(sql) + tdSql.query(sql) + #print(tdSql.queryResult) + tdSql.checkData(0,0,'2021-08-27 01:46:41.500') + tdSql.checkData(0,1,2147483646) + tdSql.checkData(0,2,9223372036854775806) + tdSql.checkData(0,3,32766) + tdSql.checkData(0,4,126) + tdSql.checkData(0,5,1) + tdSql.checkData(0,6,1) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,2147483646) + tdSql.checkData(0,14,9223372036854775806) + tdSql.checkData(0,15,32766) + tdSql.checkData(0,16,126) + tdSql.checkData(0,17,1) + tdSql.checkData(0,18,1) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular3_checkall_0(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:46:40.000') + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,-0) + tdSql.checkData(0,6,-0) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,-2147483647) + tdSql.checkData(0,14,-9223372036854775807) + tdSql.checkData(0,15,-32767) + tdSql.checkData(0,16,-127) + tdSql.checkData(0,17,-0) + tdSql.checkData(0,18,-0) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular3_checkall_0_LINEAR(self,sql): + tdLog.info(sql) + tdSql.query(sql) + #print(tdSql.queryResult) + tdSql.checkData(0,0,'2021-08-27 01:46:41.500') + tdSql.checkData(0,1,-2147483646) + tdSql.checkData(0,2,-9223372036854775806) + tdSql.checkData(0,3,-32766) + tdSql.checkData(0,4,-126) + tdSql.checkData(0,5,-0.5) + tdSql.checkData(0,6,-0.5) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,-2147483646) + tdSql.checkData(0,14,-9223372036854775806) + tdSql.checkData(0,15,-32766) + tdSql.checkData(0,16,-126) + tdSql.checkData(0,17,-0.5) + tdSql.checkData(0,18,-0.5) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular3_checkall_0_NEXT(self,sql): + tdLog.info(sql) + tdSql.query(sql) + #print(tdSql.queryResult) + tdSql.checkData(0,0,'2021-08-27 01:46:41.500') + tdSql.checkData(0,1,-2147483646) + tdSql.checkData(0,2,-9223372036854775806) + tdSql.checkData(0,3,-32766) + tdSql.checkData(0,4,-126) + tdSql.checkData(0,5,-1) + tdSql.checkData(0,6,-1) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,-2147483646) + tdSql.checkData(0,14,-9223372036854775806) + tdSql.checkData(0,15,-32766) + tdSql.checkData(0,16,-126) + tdSql.checkData(0,17,-1) + tdSql.checkData(0,18,-1) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular1_checkall_9(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:48:10.000') + tdSql.checkData(0,1,9) + tdSql.checkData(0,2,9) + tdSql.checkData(0,3,9) + tdSql.checkData(0,4,9) + tdSql.checkData(0,5,9) + tdSql.checkData(0,6,9) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,9) + tdSql.checkData(0,14,9) + tdSql.checkData(0,15,9) + tdSql.checkData(0,16,9) + tdSql.checkData(0,17,9) + tdSql.checkData(0,18,9) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular2_checkall_9(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:48:10.000') + tdSql.checkData(0,1,2147483638) + tdSql.checkData(0,2,9223372036854775798) + tdSql.checkData(0,3,32758) + tdSql.checkData(0,4,118) + tdSql.checkData(0,5,9) + tdSql.checkData(0,6,9) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,2147483638) + tdSql.checkData(0,14,9223372036854775798) + tdSql.checkData(0,15,32758) + tdSql.checkData(0,16,118) + tdSql.checkData(0,17,9) + tdSql.checkData(0,18,9) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular3_checkall_9(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(0,0,'2021-08-27 01:48:10.000') + tdSql.checkData(0,1,-2147483638) + tdSql.checkData(0,2,-9223372036854775798) + tdSql.checkData(0,3,-32758) + tdSql.checkData(0,4,-118) + tdSql.checkData(0,5,-9) + tdSql.checkData(0,6,-9) + tdSql.checkData(0,7,'None') + tdSql.checkData(0,8,'None') + tdSql.checkData(0,9,'None') + tdSql.checkData(0,10,'None') + tdSql.checkData(0,11,'None') + tdSql.checkData(0,12,'None') + tdSql.checkData(0,13,-2147483638) + tdSql.checkData(0,14,-9223372036854775798) + tdSql.checkData(0,15,-32758) + tdSql.checkData(0,16,-118) + tdSql.checkData(0,17,-9) + tdSql.checkData(0,18,-9) + tdSql.checkData(0,19,'None') + tdSql.checkData(0,20,'None') + tdSql.checkData(0,21,'None') + tdSql.checkData(0,22,'None') + tdSql.checkData(0,23,'None') + tdSql.checkData(0,24,'None') + + def regular1_checkall_20_base(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(18,0,'2021-08-27 01:48:10.000') + tdSql.checkData(18,1,9) + tdSql.checkData(18,2,9) + tdSql.checkData(18,3,9) + tdSql.checkData(18,4,9) + tdSql.checkData(18,5,9) + tdSql.checkData(18,6,9) + tdSql.checkData(18,7,'None') + tdSql.checkData(18,8,'None') + tdSql.checkData(18,9,'None') + tdSql.checkData(18,10,'None') + tdSql.checkData(18,11,'None') + tdSql.checkData(18,12,'None') + + def regular1_checkall_20(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(18,0,'2021-08-27 01:48:10.000') + tdSql.checkData(18,1,9) + tdSql.checkData(18,2,9) + tdSql.checkData(18,3,9) + tdSql.checkData(18,4,9) + tdSql.checkData(18,5,9) + tdSql.checkData(18,6,9) + tdSql.checkData(18,7,'None') + tdSql.checkData(18,8,'None') + tdSql.checkData(18,9,'None') + tdSql.checkData(18,10,'None') + tdSql.checkData(18,11,'None') + tdSql.checkData(18,12,'None') + tdSql.checkData(18,13,9) + tdSql.checkData(18,14,9) + tdSql.checkData(18,15,9) + tdSql.checkData(18,16,9) + tdSql.checkData(18,17,9) + tdSql.checkData(18,18,9) + tdSql.checkData(18,19,'None') + tdSql.checkData(18,20,'None') + tdSql.checkData(18,21,'None') + tdSql.checkData(18,22,'None') + tdSql.checkData(18,23,'None') + tdSql.checkData(18,24,'None') + + def regular2_checkall_20(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(18,0,'2021-08-27 01:48:10.000') + tdSql.checkData(18,1,2147483638) + tdSql.checkData(18,2,9223372036854775798) + tdSql.checkData(18,3,32758) + tdSql.checkData(18,4,118) + tdSql.checkData(18,5,9) + tdSql.checkData(18,6,9) + tdSql.checkData(18,7,'None') + tdSql.checkData(18,8,'None') + tdSql.checkData(18,9,'None') + tdSql.checkData(18,10,'None') + tdSql.checkData(18,11,'None') + tdSql.checkData(18,12,'None') + tdSql.checkData(18,13,2147483638) + tdSql.checkData(18,14,9223372036854775798) + tdSql.checkData(18,15,32758) + tdSql.checkData(18,16,118) + tdSql.checkData(18,17,9) + tdSql.checkData(18,18,9) + tdSql.checkData(18,19,'None') + tdSql.checkData(18,20,'None') + tdSql.checkData(18,21,'None') + tdSql.checkData(18,22,'None') + tdSql.checkData(18,23,'None') + tdSql.checkData(18,24,'None') + + def regular3_checkall_20(self,sql): + tdLog.info(sql) + tdSql.query(sql) + tdSql.checkData(18,0,'2021-08-27 01:48:10.000') + tdSql.checkData(18,1,-2147483638) + tdSql.checkData(18,2,-9223372036854775798) + tdSql.checkData(18,3,-32758) + tdSql.checkData(18,4,-118) + tdSql.checkData(18,5,-9) + tdSql.checkData(18,6,-9) + tdSql.checkData(18,7,'None') + tdSql.checkData(18,8,'None') + tdSql.checkData(18,9,'None') + tdSql.checkData(18,10,'None') + tdSql.checkData(18,11,'None') + tdSql.checkData(18,12,'None') + tdSql.checkData(18,13,-2147483638) + tdSql.checkData(18,14,-9223372036854775798) + tdSql.checkData(18,15,-32758) + tdSql.checkData(18,16,-118) + tdSql.checkData(18,17,-9) + tdSql.checkData(18,18,-9) + tdSql.checkData(18,19,'None') + tdSql.checkData(18,20,'None') + tdSql.checkData(18,21,'None') + tdSql.checkData(18,22,'None') + tdSql.checkData(18,23,'None') + tdSql.checkData(18,24,'None') + + def stable1_checkall_0(self,sql): + self.regular1_checkall_0(sql) - self.rowNum = 10 - self.ts = 1537100000000 def run(self): tdSql.prepare() - tdSql.execute("create table ap1 (ts timestamp, pav float)") - tdSql.execute("create table ap2 (ts timestamp, pav float) tags (t1 float)") - tdSql.execute("create table ap2_sub1 using ap2 tags (2.90799)") - tdSql.execute("create table ap2_sub2 using ap2 tags (2.90799)") - tdSql.execute("create table ap3 (ts timestamp, pav float) tags (t1 float)") - tdSql.execute("create table ap3_sub1 using ap3 tags (2.90799)") - for tb_name in ["ap1", "ap2_sub1", "ap3_sub1"]: - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:54.119', 2.90799)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:54.317', 3.07399)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:54.517', 0.58117)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:54.717', 0.16150)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:54.918', 1.47885)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:56.569', 1.76472)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:57.381', 2.13722)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:57.574', 4.10256)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:57.776', 3.55345)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:57.976', 1.46624)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:58.187', 0.17943)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:58.372', 2.04101)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:58.573', 3.20924)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:58.768', 1.71807)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:58.964', 4.60900)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:59.155', 4.33907)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:59.359', 0.76940)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:59.553', 0.06458)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:59.742', 4.59857)") - tdSql.execute(f"insert into {tb_name} values ('2021-07-25 02:19:59.938', 1.55081)") - - tdSql.query("select interp(pav) from ap1 where ts = '2021-07-25 02:19:54' FILL (PREV)") - tdSql.checkRows(0) - tdSql.query("select interp(pav) from ap1 where ts = '2021-07-25 02:19:54' FILL (NEXT)") - tdSql.checkRows(0) - tdSql.query("select interp(pav) from ap1 where ts = '2021-07-25 02:19:54' FILL (LINEAR)") - tdSql.checkRows(0) - # check None - tdSql.query("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (None)") - tdSql.checkRows(0) - # check NULL - tdSql.query("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (NULL)") - tdSql.checkRows(6) - for i in range(5): - tdSql.checkData(i,1,None) - # checkout VALUE - tdSql.query("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (VALUE, 1)") - tdSql.checkRows(6) - for i in range(5): - tdSql.checkData(i,1,1.00000) - # check tag group by - tdSql.query("select interp(pav) from ap2 where ts>= '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (VALUE,1) group by t1;") - for i in range(5): - tdSql.checkData(i,1,1.00000) - tdSql.checkData(i,2,2.90799) - # check multi ts lines - tdSql.query("select z1.ts,z1.val1,z2.val2 from (select interp(pav) val1 from ap2 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (value,1)) z1,(select interp(pav) val2 from ap3 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (value,2)) z2 where z1.ts=z2.ts ;") - for i in range(5): - tdSql.checkData(i,1,1.00000) - tdSql.checkData(i,2,2.00000) - tdSql.query("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (LINEAR)") - tdSql.checkRows(6) - tdSql.query("select interp(pav) from ap1 where ts>= '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (NEXT)") - tdSql.checkRows(6) - tdSql.checkData(0,1,2.90799) - tdSql.query("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts <= '2021-07-25 02:20:00' every(1000a) FILL (PREV)") + os.system("rm -rf functions/function_interp.py.sql") + startTime = time.time() + dcDB = self.dropandcreateDB_null() + + print("==============step1, regualr table ==============") + + interp_select = 'interp(q_int),interp(q_bigint),interp(q_smallint),interp(q_tinyint),interp(q_float),interp(q_double),\ + interp(q_int_null),interp(q_bigint_null),interp(q_smallint_null),interp(q_tinyint_null),interp(q_float_null),interp(q_double_null),\ + interp(q_int,q_bigint,q_smallint,q_tinyint,q_float,q_double),interp(q_int_null,q_bigint_null,q_smallint_null,q_tinyint_null,q_float_null,q_double_null)' + + sql = "select * from regular_table_1 ;" + datacheck = self.regular1_checkall_0_base(sql) + tdSql.checkRows(19) + datacheck = self.regular1_checkall_20_base(sql) + + sql = "select %s from regular_table_1 ;" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 ;" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 ;" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 ORDER BY ts DESC;" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 ORDER BY ts DESC;" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 ORDER BY ts DESC;" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 where " %interp_select + sql += "ts > %s ;" % (self.ts - 10) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 where " %interp_select + sql += "ts > %s ;" % (self.ts - 10) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 where " %interp_select + sql += "ts > %s ;" % (self.ts - 10) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 where " %interp_select + sql += "ts > %s ;" % (self.ts + 85000) + datacheck = self.regular1_checkall_9(sql) + sql = "select %s from regular_table_2 where " %interp_select + sql += "ts > %s ;" % (self.ts + 85000) + datacheck = self.regular2_checkall_9(sql) + sql = "select %s from regular_table_3 where " %interp_select + sql += "ts > %s ;" % (self.ts + 85000) + datacheck = self.regular3_checkall_9(sql) + + # range + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " %interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " %interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " %interp_select + sql += "range('%s' , '%s');" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " %interp_select + sql += "range('%s' , '%s');" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " %interp_select + sql += "range('%s' , '%s');" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " %interp_select + sql += "range('%s' , '%s');" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " %interp_select + sql += "range('%s' , '%s');" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " %interp_select + sql += "range('%s' , '%s');" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(LINEAR) + sql = "select %s from regular_table_1 FILL(LINEAR)" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 FILL(LINEAR)" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 FILL(LINEAR)" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(LINEAR) + EVERY( s) + sql = "select %s from regular_table_1 EVERY(1s) FILL(LINEAR);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 EVERY(1s) FILL(LINEAR);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 EVERY(1s) FILL(LINEAR);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 EVERY(5s) FILL(LINEAR);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_2 EVERY(5s) FILL(LINEAR);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_3 EVERY(5s) FILL(LINEAR);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(LINEAR) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # where + range + FILL(LINEAR) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(NEXT) + sql = "select %s from regular_table_1 FILL(NEXT)" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 FILL(NEXT)" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 FILL(NEXT)" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(NEXT) + EVERY( s) + sql = "select %s from regular_table_1 EVERY(1s) FILL(NEXT);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 EVERY(1s) FILL(NEXT);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 EVERY(1s) FILL(NEXT);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 EVERY(5s) FILL(NEXT);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_2 EVERY(5s) FILL(NEXT);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_3 EVERY(5s) FILL(NEXT);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(NEXT) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # where + range + FILL(NEXT) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(PREV) + sql = "select %s from regular_table_1 FILL(PREV)" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 FILL(PREV)" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 FILL(PREV)" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + + # FILL(PREV) + EVERY( s) + sql = "select %s from regular_table_1 EVERY(1s) FILL(PREV);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 EVERY(1s) FILL(PREV);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 EVERY(1s) FILL(PREV);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 EVERY(5s) FILL(PREV);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_2 EVERY(5s) FILL(PREV);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_3 EVERY(5s) FILL(PREV);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(PREV) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(51) + + # where + range + FILL(PREV) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # FILL(VALUE,100) + sql = "select %s from regular_table_1 FILL(VALUE, 100)" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 FILL(VALUE, 100)" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 FILL(VALUE, 100)" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + # FILL(VALUE,100) + EVERY( s) + sql = "select %s from regular_table_1 EVERY(1s) FILL(VALUE, 100);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 EVERY(1s) FILL(VALUE, 100);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 EVERY(1s) FILL(VALUE, 100);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 EVERY(5s) FILL(VALUE, 100);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_2 EVERY(5s) FILL(VALUE, 100);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_3 EVERY(5s) FILL(VALUE, 100);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(VALUE, 100) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # where + range + FILL(VALUE, 100) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # FILL(NULL) + sql = "select %s from regular_table_1 FILL(NULL)" %interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 FILL(NULL)" %interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 FILL(NULL)" %interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + + + # FILL(NULL) + EVERY( s) + sql = "select %s from regular_table_1 EVERY(1s) FILL(NULL);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_2 EVERY(1s) FILL(NULL);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from regular_table_3 EVERY(1s) FILL(NULL);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from regular_table_1 EVERY(5s) FILL(NULL);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_2 EVERY(5s) FILL(NULL);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from regular_table_3 EVERY(5s) FILL(NULL);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(NULL) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # where + range + FILL(NULL) + EVERY( s) + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + + # EVERY(1s) + sql = "select %s from regular_table_1 EVERY(1s);" %interp_select + datacheck = self.regular1_checkall_0(sql) + datacheck = self.regular1_checkall_20(sql) + sql = "select %s from regular_table_2 EVERY(1s);" %interp_select + datacheck = self.regular2_checkall_0(sql) + datacheck = self.regular2_checkall_20(sql) + sql = "select %s from regular_table_3 EVERY(1s);" %interp_select + datacheck = self.regular3_checkall_0(sql) + datacheck = self.regular3_checkall_20(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + datacheck = self.regular1_checkall_20(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + datacheck = self.regular2_checkall_20(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + datacheck = self.regular3_checkall_20(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular1_checkall_0_NEXT(sql) tdSql.checkRows(7) - tdSql.checkData(1,1,1.47885) - tdSql.query("select interp(pav) from ap1 where ts>= '2021-07-25 02:19:54' and ts <= '2021-07-25 02:20:00' every(1000a) FILL (LINEAR)") + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular2_checkall_0_NEXT(sql) tdSql.checkRows(7) - - # check desc order - tdSql.error("select interp(pav) from ap1 where ts = '2021-07-25 02:19:54' FILL (PREV) order by ts desc") - tdSql.query("select interp(pav) from ap1 where ts = '2021-07-25 02:19:54' FILL (NEXT) order by ts desc") - tdSql.checkRows(0) - tdSql.query("select interp(pav) from ap1 where ts = '2021-07-25 02:19:54' FILL (LINEAR) order by ts desc") - tdSql.checkRows(0) - tdSql.query("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (LINEAR) order by ts desc") - tdSql.checkRows(6) - tdSql.query("select interp(pav) from ap1 where ts>= '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1000a) FILL (NEXT) order by ts desc") - tdSql.checkRows(6) - tdSql.checkData(0,1,4.60900) - tdSql.error("select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts <= '2021-07-25 02:20:00' every(1000a) FILL (PREV) order by ts desc") - tdSql.query("select interp(pav) from ap1 where ts>= '2021-07-25 02:19:54' and ts <= '2021-07-25 02:20:00' every(1000a) FILL (LINEAR) order by ts desc") + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular3_checkall_0_NEXT(sql) tdSql.checkRows(7) - # check exception - tdSql.error("select interp(*) from ap1") - tdSql.error("select interp(*) from ap1 FILL(NEXT)") - tdSql.error("select interp(*) from ap1 ts >= '2021-07-25 02:19:54' FILL(NEXT)") - tdSql.error("select interp(*) from ap1 ts <= '2021-07-25 02:19:54' FILL(NEXT)") - tdSql.error("select interp(*) from ap1 where ts >'2021-07-25 02:19:59.938' and ts < now every(1s) fill(next)") - - # test case for https://jira.taosdata.com:18080/browse/TS-241 - tdSql.execute("create database test minrows 10") - tdSql.execute("use test") - tdSql.execute("create table st(ts timestamp, c1 int) tags(id int)") - tdSql.execute("create table t1 using st tags(1)") - - for i in range(10): - for j in range(10): - tdSql.execute("insert into t1 values(%d, %d)" % (self.ts + i * 3600000 + j, j)) - tdSql.query("select interp(c1) from st where ts >= '2018-09-16 20:00:00.000' and ts <= '2018-09-17 06:00:00.000' every(1h) fill(linear)") - if i==0: - tdSql.checkRows(0) - else: - tdSql.checkRows(11) - - tdDnodes.stop(1) - tdDnodes.start(1) - tdSql.query("select interp(c1) from st where ts >= '2018-09-16 20:00:00.000' and ts <= '2018-09-17 06:00:00.000' every(1h) fill(linear)") - if i==0: - tdSql.checkRows(0) - else: - tdSql.checkRows(11) + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # EVERY(2s) + sql = "select %s from regular_table_1 EVERY(2s);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from regular_table_2 EVERY(2s);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from regular_table_3 EVERY(2s);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(14) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(14) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(5) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(5) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(5) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # EVERY(5s) + sql = "select %s from regular_table_1 EVERY(5s);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_2 EVERY(5s);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from regular_table_3 EVERY(5s);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + # EVERY(100s) + sql = "select %s from regular_table_1 EVERY(100s);" %interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_2 EVERY(100s);" %interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from regular_table_3 EVERY(100s);" %interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + + # error + tdSql.error("select interp(*) from regular_table_1") + tdSql.error("select interp(*) from regular_table_2 FILL(NEXT)") + sql = "select interp(*) from regular_table_3 where ts >= '%s' FILL(NULL);" % self.ts + tdSql.error(sql) + sql = "select interp(*) from regular_table_1 where ts <= '%s' FILL(LINEAR);" % self.ts + tdSql.error(sql) + sql = "select interp(*) from regular_table_2 where ts > '%s' and ts < now every(1s) fill(PREV);" % self.ts + tdSql.error(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL (LINEAR);" % (self.ts + 150000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) FILL (PREV);" % (self.ts + 150000 , self.ts - 100000) + tdSql.error(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(5s) FILL (NEXT);" % (self.ts - 150000 , self.ts - 200000) + tdSql.error(sql) + + sql = "select %s from regular_table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(10s) FILL (NULL);" % (self.ts + 150000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from regular_table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(60s) FILL (VALUE,100);" % (self.ts + 150000 , self.ts - 100000) + tdSql.error(sql) + sql = "select %s from regular_table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(120s) FILL (LINEAR) ORDER BY ts DESC;" % (self.ts - 150000 , self.ts - 200000) + tdSql.error(sql) + + # Nested Query + sql = "select * from (select %s from regular_table_1) ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select * from (select %s from regular_table_2) ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select * from (select %s from regular_table_3) ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from (select * from regular_table_1) ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from (select * from regular_table_2) ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from (select * from regular_table_3) ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s) (1) + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s)(2) + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s)(3) + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s) (1) + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s)(2) + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s)(3) + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(PREV) + EVERY( s) (1) + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(PREV) + EVERY( s)(2) + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(PREV) + EVERY( s)(3) + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s) (1) + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s)(2) + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s)(3) + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s) (1) + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from regular_table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from regular_table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s)(2) + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from regular_table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from regular_table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from regular_table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s)(3) + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from regular_table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from regular_table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from regular_table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + print("==============step2, super table: child table==============") + + dcDB = self.dropandcreateDB() + + dcDB = self.dropandcreateDB_null() + + dcRestart = self.restartDnodes() + + interp_select = 'interp(q_int),interp(q_bigint),interp(q_smallint),interp(q_tinyint),interp(q_float),interp(q_double),\ + interp(q_int_null),interp(q_bigint_null),interp(q_smallint_null),interp(q_tinyint_null),interp(q_float_null),interp(q_double_null),\ + interp(q_int,q_bigint,q_smallint,q_tinyint,q_float,q_double),interp(q_int_null,q_bigint_null,q_smallint_null,q_tinyint_null,q_float_null,q_double_null),loc' + + sql = "select * from table_1 ;" + datacheck = self.regular1_checkall_0_base(sql) + tdSql.checkRows(19) + datacheck = self.regular1_checkall_20_base(sql) + + sql = "select %s from table_1 ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 ORDER BY ts DESC;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 ORDER BY ts DESC;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 ORDER BY ts DESC;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 where " % interp_select + sql += "ts > %s ;" % (self.ts - 10) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 where " % interp_select + sql += "ts > %s ;" % (self.ts - 10) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 where " % interp_select + sql += "ts > %s ;" % (self.ts - 10) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 where " % interp_select + sql += "ts > %s ;" % (self.ts + 85000) + datacheck = self.regular1_checkall_9(sql) + sql = "select %s from table_2 where " % interp_select + sql += "ts > %s ;" % (self.ts + 85000) + datacheck = self.regular2_checkall_9(sql) + sql = "select %s from table_3 where " % interp_select + sql += "ts > %s ;" % (self.ts + 85000) + datacheck = self.regular3_checkall_9(sql) + + # range + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s');" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(LINEAR) + sql = "select %s from table_1 FILL(LINEAR)" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 FILL(LINEAR)" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 FILL(LINEAR)" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(LINEAR) + EVERY( s) + sql = "select %s from table_1 EVERY(1s) FILL(LINEAR);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 EVERY(1s) FILL(LINEAR);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 EVERY(1s) FILL(LINEAR);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 EVERY(5s) FILL(LINEAR);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_2 EVERY(5s) FILL(LINEAR);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_3 EVERY(5s) FILL(LINEAR);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(LINEAR) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # where + range + FILL(LINEAR) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(NEXT) + sql = "select %s from table_1 FILL(NEXT)" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 FILL(NEXT)" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 FILL(NEXT)" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(NEXT) + EVERY( s) + sql = "select %s from table_1 EVERY(1s) FILL(NEXT);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 EVERY(1s) FILL(NEXT);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 EVERY(1s) FILL(NEXT);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 EVERY(5s) FILL(NEXT);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_2 EVERY(5s) FILL(NEXT);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_3 EVERY(5s) FILL(NEXT);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(NEXT) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # where + range + FILL(NEXT) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(PREV) + sql = "select %s from table_1 FILL(PREV)" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 FILL(PREV)" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 FILL(PREV)" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + + # FILL(PREV) + EVERY( s) + sql = "select %s from table_1 EVERY(1s) FILL(PREV);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 EVERY(1s) FILL(PREV);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 EVERY(1s) FILL(PREV);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 EVERY(5s) FILL(PREV);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_2 EVERY(5s) FILL(PREV);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_3 EVERY(5s) FILL(PREV);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(PREV) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(51) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(51) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(51) + + # where + range + FILL(PREV) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # FILL(VALUE,100) + sql = "select %s from table_1 FILL(VALUE, 100)" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 FILL(VALUE, 100)" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 FILL(VALUE, 100)" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + # FILL(VALUE,100) + EVERY( s) + sql = "select %s from table_1 EVERY(1s) FILL(VALUE, 100);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 EVERY(1s) FILL(VALUE, 100);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 EVERY(1s) FILL(VALUE, 100);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 EVERY(5s) FILL(VALUE, 100);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_2 EVERY(5s) FILL(VALUE, 100);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_3 EVERY(5s) FILL(VALUE, 100);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # FILL(NULL) + EVERY( s) + sql = "select %s from table_1 EVERY(1s) FILL(NULL);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_2 EVERY(1s) FILL(NULL);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from table_3 EVERY(1s) FILL(NULL);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from table_1 EVERY(5s) FILL(NULL);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_2 EVERY(5s) FILL(NULL);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from table_3 EVERY(5s) FILL(NULL);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(VALUE, 100) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # where + range + FILL(VALUE, 100) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # FILL(NULL) + sql = "select %s from table_1 FILL(NULL)" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 FILL(NULL)" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 FILL(NULL)" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + + # range + FILL(NULL) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # where + range + FILL(NULL) + EVERY( s) + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # EVERY(1s) + sql = "select %s from table_1 EVERY(1s);" % interp_select + datacheck = self.regular1_checkall_0(sql) + datacheck = self.regular1_checkall_20(sql) + sql = "select %s from table_2 EVERY(1s);" % interp_select + datacheck = self.regular2_checkall_0(sql) + datacheck = self.regular2_checkall_20(sql) + sql = "select %s from table_3 EVERY(1s);" % interp_select + datacheck = self.regular3_checkall_0(sql) + datacheck = self.regular3_checkall_20(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + datacheck = self.regular1_checkall_20(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + datacheck = self.regular2_checkall_20(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + datacheck = self.regular3_checkall_20(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(7) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(7) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(7) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(1s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # EVERY(2s) + sql = "select %s from table_1 EVERY(2s);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from table_2 EVERY(2s);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from table_3 EVERY(2s);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(14) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(14) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(5) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(5) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(5) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(2s);" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # EVERY(5s) + sql = "select %s from table_1 EVERY(5s);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_2 EVERY(5s);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from table_3 EVERY(5s);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + # EVERY(100s) + sql = "select %s from table_1 EVERY(100s);" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_2 EVERY(100s);" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from table_3 EVERY(100s);" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + # error + tdSql.error("select interp(*) from table_1") + tdSql.error("select interp(*) from table_2 FILL(NEXT)") + sql = "select interp(*) from table_3 where ts >= '%s' FILL(NULL);" % self.ts + tdSql.error(sql) + sql = "select interp(*) from table_1 where ts <= '%s' FILL(LINEAR);" % self.ts + tdSql.error(sql) + sql = "select interp(*) from table_2 where ts > '%s' and ts < now every(1s) fill(PREV);" % self.ts + tdSql.error(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL (LINEAR);" % (self.ts + 150000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) FILL (PREV);" % (self.ts + 150000 , self.ts - 100000) + tdSql.error(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(5s) FILL (NEXT);" % (self.ts - 150000 , self.ts - 200000) + tdSql.error(sql) + + sql = "select %s from table_1 " % interp_select + sql += "range('%s' , '%s') EVERY(10s) FILL (NULL);" % (self.ts + 150000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from table_2 " % interp_select + sql += "range('%s' , '%s') EVERY(60s) FILL (VALUE,100);" % (self.ts + 150000 , self.ts - 100000) + tdSql.error(sql) + sql = "select %s from table_3 " % interp_select + sql += "range('%s' , '%s') EVERY(120s) FILL (LINEAR) ORDER BY ts DESC;" % (self.ts - 150000 , self.ts - 200000) + tdSql.error(sql) + + # Nested Query + interp_select = 'interp(q_int),interp(q_bigint),interp(q_smallint),interp(q_tinyint),interp(q_float),interp(q_double),\ + interp(q_int_null),interp(q_bigint_null),interp(q_smallint_null),interp(q_tinyint_null),interp(q_float_null),interp(q_double_null),\ + interp(q_int,q_bigint,q_smallint,q_tinyint,q_float,q_double),interp(q_int_null,q_bigint_null,q_smallint_null,q_tinyint_null,q_float_null,q_double_null)' + + sql = "select * from (select %s from table_1) ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select * from (select %s from table_2) ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select * from (select %s from table_3) ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from (select * from table_1) ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from (select * from table_2) ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from (select * from table_3) ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s) (1) + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s)(2) + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s)(3) + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s) (1) + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s)(2) + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s)(3) + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(PREV) + EVERY( s) (1) + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(PREV) + EVERY( s)(2) + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(PREV) + EVERY( s)(3) + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s) (1) + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s)(2) + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s)(3) + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s) (1) + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from table_2 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from table_3 " % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL));" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s)(2) + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from (select * from table_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from table_2 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from (select * from table_3 )" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s)(3) + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + sql += "(select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from table_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + sql += "(select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from table_3 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + sql += "(select %s from table_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + print("==============step3, super table ==============") + + dcDB = self.dropandcreateDB() + + dcRestart = self.restartDnodes() + + dcDB = self.dropandcreateDB_null() + + interp_select = 'interp(q_int),interp(q_bigint),interp(q_smallint),interp(q_tinyint),interp(q_float),interp(q_double),\ + interp(q_int_null),interp(q_bigint_null),interp(q_smallint_null),interp(q_tinyint_null),interp(q_float_null),interp(q_double_null),\ + interp(q_int,q_bigint,q_smallint,q_tinyint,q_float,q_double),interp(q_int_null,q_bigint_null,q_smallint_null,q_tinyint_null,q_float_null,q_double_null),loc' + + sql = "select * from stable_1 ;" + datacheck = self.regular1_checkall_0_base(sql) + tdSql.checkRows(57) + datacheck = self.regular1_checkall_20_base(sql) + + sql = "select %s from stable_1 group by tbname;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') group by tbname;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') group by tbname;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 group by tbname ORDER BY ts DESC;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') group by tbname ORDER BY ts DESC;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') group by tbname ORDER BY ts DESC;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 where " % interp_select + sql += "ts > %s group by tbname ;" % (self.ts - 10) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where " % interp_select + sql += "ts > %s and tbname in ('table_2') group by tbname ;" % (self.ts - 10) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where " % interp_select + sql += "ts > %s and tbname in ('table_3') group by tbname ;" % (self.ts - 10) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 where " % interp_select + sql += "ts > %s group by tbname ;" % (self.ts + 85000) + datacheck = self.regular1_checkall_9(sql) + sql = "select %s from stable_1 where " % interp_select + sql += "ts > %s and tbname in ('table_2') group by tbname;" % (self.ts + 85000) + datacheck = self.regular2_checkall_9(sql) + sql = "select %s from stable_1 where " % interp_select + sql += "ts > %s and tbname in ('table_3') group by tbname;" % (self.ts + 85000) + datacheck = self.regular3_checkall_9(sql) + + # range + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') group by tbname;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') group by tbname;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') group by tbname;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') group by tbname;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') group by tbname;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') group by tbname;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(LINEAR) + sql = "select %s from stable_1 FILL(LINEAR) group by tbname " % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') FILL(LINEAR) group by tbname " % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') FILL(LINEAR) group by tbname " % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(LINEAR) group by tbname;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(LINEAR) + EVERY( s) + sql = "select %s from stable_1 EVERY(1s) FILL(LINEAR) group by tbname;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(1s) FILL(LINEAR) group by tbname;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(1s) FILL(LINEAR) group by tbname;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 EVERY(5s) FILL(LINEAR) group by tbname;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(57) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(5s) FILL(LINEAR) group by tbname;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(5s) FILL(LINEAR) group by tbname;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(LINEAR) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # where + range + FILL(LINEAR) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(33) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(NEXT) + sql = "select %s from stable_1 FILL(NEXT) group by tbname " % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') FILL(NEXT) group by tbname " % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') FILL(NEXT) group by tbname " % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NEXT) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(NEXT) + EVERY( s) + sql = "select %s from stable_1 EVERY(1s) FILL(NEXT) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(1s) FILL(NEXT) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(1s) FILL(NEXT) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 EVERY(5s) FILL(NEXT) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(57) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(5s) FILL(NEXT) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(5s) FILL(NEXT) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(NEXT) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(303) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # where + range + FILL(NEXT) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(63) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(33) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # FILL(PREV) + sql = "select %s from stable_1 FILL(PREV) group by tbname " % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') FILL(PREV) group by tbname " % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') FILL(PREV) group by tbname " % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(PREV) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + + # FILL(PREV) + EVERY( s) + sql = "select %s from stable_1 EVERY(1s) FILL(PREV) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(1s) FILL(PREV) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(1s) FILL(PREV) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 EVERY(5s) FILL(PREV) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(57) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(5s) FILL(PREV) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(5s) FILL(PREV) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(PREV) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(303) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_9(sql) + tdSql.checkRows(153) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_9(sql) + tdSql.checkRows(51) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_9(sql) + tdSql.checkRows(51) + + # where + range + FILL(PREV) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(303) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(153) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # FILL(VALUE,100) + sql = "select %s from stable_1 FILL(VALUE, 100) group by tbname " % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') FILL(VALUE, 100) group by tbname " % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') FILL(VALUE, 100) group by tbname " % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(VALUE, 100) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + + # FILL(VALUE,100) + EVERY( s) + sql = "select %s from stable_1 EVERY(1s) FILL(VALUE, 100) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 EVERY(5s) FILL(VALUE, 100) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(57) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(5s) FILL(VALUE, 100) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(5s) FILL(VALUE, 100) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # FILL(NULL) + EVERY( s) + sql = "select %s from stable_1 EVERY(1s) FILL(NULL) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(273) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(1s) FILL(NULL) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(91) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(1s) FILL(NULL) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(91) + + sql = "select %s from stable_1 EVERY(5s) FILL(NULL) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(57) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(5s) FILL(NULL) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(19) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(5s) FILL(NULL) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(19) + + # range + FILL(VALUE, 100) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(333) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(153) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # where + range + FILL(VALUE, 100) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(333) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(153) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # FILL(NULL) + sql = "select %s from stable_1 FILL(NULL) group by tbname " % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_2') FILL(NULL) group by tbname " % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 where tbname in ('table_3') FILL(NULL) group by tbname " % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') FILL(NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + + # range + FILL(NULL) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(333) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(153) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # where + range + FILL(NULL) + EVERY( s) + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(333) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(603) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC;" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(6) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(153) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ;" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # EVERY(1s) + sql = "select %s from stable_1 EVERY(1s) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + datacheck = self.regular1_checkall_20(sql) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(1s) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + datacheck = self.regular2_checkall_20(sql) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(1s) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + datacheck = self.regular3_checkall_20(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + datacheck = self.regular1_checkall_20(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + datacheck = self.regular2_checkall_20(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + datacheck = self.regular3_checkall_20(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(21) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(7) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(7) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(1s) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # EVERY(2s) + sql = "select %s from stable_1 EVERY(2s) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(42) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(2s) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(2s) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(14) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(42) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(14) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(14) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(15) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(5) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts + 10000 , self.ts + 25000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(5) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(2s) group by tbname ;" % (self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # EVERY(5s) + sql = "select %s from stable_1 EVERY(5s) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(5s) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(5s) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + # EVERY(100s) + sql = "select %s from stable_1 EVERY(100s) group by tbname ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select %s from stable_1 where tbname in ('table_2') EVERY(100s) group by tbname ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select %s from stable_1 where tbname in ('table_3') EVERY(100s) group by tbname ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + # error + tdSql.error("select interp(*) from stable_1 group by tbname ") + tdSql.error("select interp(*) from stable_1 FILL(NEXT) group by tbname ") + sql = "select interp(*) from stable_1 where ts >= '%s' FILL(NULL) group by tbname ;" % self.ts + tdSql.error(sql) + sql = "select interp(*) from stable_1 where ts <= '%s' FILL(LINEAR) group by tbname ;" % self.ts + tdSql.error(sql) + sql = "select interp(*) from stable_1 where ts > '%s' and ts < now every(1s) fill(PREV) group by tbname ;" % self.ts + tdSql.error(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(1s) FILL (LINEAR) group by tbname ;" % (self.ts + 150000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(2s) FILL (PREV) group by tbname ;" % (self.ts + 150000 , self.ts - 100000) + tdSql.error(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(5s) FILL (NEXT) group by tbname ;" % (self.ts - 150000 , self.ts - 200000) + tdSql.error(sql) + + sql = "select %s from stable_1 " % interp_select + sql += "range('%s' , '%s') EVERY(10s) FILL (NULL) group by tbname ;" % (self.ts + 150000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') range('%s' , '%s') EVERY(60s) FILL (VALUE,100) group by tbname ;" % (self.ts + 150000 , self.ts - 100000) + tdSql.error(sql) + sql = "select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') range('%s' , '%s') EVERY(120s) FILL (LINEAR) group by tbname ORDER BY ts DESC;" % (self.ts - 150000 , self.ts - 200000) + tdSql.error(sql) + + # Nested Query + sql = "select * from (select %s from stable_1 group by tbname) ;" % interp_select + datacheck = self.regular1_checkall_0(sql) + sql = "select * from (select %s from stable_1 where tbname in ('table_2') group by tbname) ;" % interp_select + datacheck = self.regular2_checkall_0(sql) + sql = "select * from (select %s from stable_1 where tbname in ('table_3') group by tbname) ;" % interp_select + datacheck = self.regular3_checkall_0(sql) + + sql = "select %s from (select * from stable_1) ;" % interp_select + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2') ) ;" % interp_select + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3') ) ;" % interp_select + tdSql.error(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s) (1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname );" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname );" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(33) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_LINEAR(sql) + tdSql.checkRows(6) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_LINEAR(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + tdLog.info(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s)(2-error) + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + tdSql.error(sql) + + # Nested Query + where + range + FILL(LINEAR) + EVERY( s)(3) + #TD-11096 + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(11) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # datacheck = self.result_0(sql) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # datacheck = self.regular3_checkall_0(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(11) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # datacheck = self.regular2_checkall_0_LINEAR(sql) + # tdSql.checkRows(2) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(LINEAR)) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s) (1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(63) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(21) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(21) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(33) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(33) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(11) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(11) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(6) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s)(2)--error + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + tdSql.error(sql) + + # Nested Query + where + range + FILL(NEXT) + EVERY( s)(3) + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # sql += "(select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(21) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # sql += "(select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # datacheck = self.regular2_checkall_0(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # sql += "(select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # datacheck = self.regular3_checkall_0(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # sql += "(select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(11) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # sql += "(select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # datacheck = self.regular2_checkall_0_NEXT(sql) + # tdSql.checkRows(2) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # sql += "(select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NEXT) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # datacheck = self.result_0(sql) + + # Nested Query + where + range + FILL(PREV) + EVERY( s) (1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(303) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(101) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(101) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.result_0(sql) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(603) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(6) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NEXT(sql) + tdSql.checkRows(153) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular2_checkall_0_NEXT(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular3_checkall_0_NEXT(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(PREV) + EVERY( s)(2) + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2') )" % interp_select + sql += " where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3') )" % interp_select + sql += " where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += " where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += " where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += " where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += " where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += " where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += " where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(PREV);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + + # Nested Query + where + range + FILL(PREV) + EVERY( s)(3) + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(101) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # datacheck = self.result_0(sql) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # datacheck = self.regular3_checkall_0(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(201) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # datacheck = self.regular2_checkall_0(sql) + # tdSql.checkRows(2) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(PREV) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # datacheck = self.regular3_checkall_0_NEXT(sql) + # tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s) (1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(333) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(603) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(6) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(153) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_VALUE100(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s)(2) + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + + # Nested Query + where + range + FILL(VALUE, 100) + EVERY( s)(3) + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # datacheck = self.regular1_checkall_0_VALUE100(sql) + # tdSql.checkRows(111) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # datacheck = self.regular1_checkall_0_VALUE100(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # datacheck = self.regular3_checkall_0(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(201) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # datacheck = self.regular1_checkall_0_VALUE100(sql) + # tdSql.checkRows(2) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(VALUE, 100) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # datacheck = self.regular1_checkall_0_VALUE100(sql) + # tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s) (1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(333) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(111) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(3) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(1) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(1) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0(sql) + tdSql.checkRows(603) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular2_checkall_0(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular3_checkall_0(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(603) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname ORDER BY ts DESC);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(201) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname );" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(6) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(2) + + sql = "select * from (select %s from stable_1 " % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(153) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_2') and ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + sql = "select * from (select %s from stable_1 " % interp_select + sql += " where tbname in ('table_3') and ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = self.regular1_checkall_0_NULL(sql) + tdSql.checkRows(51) + + # Nested Query + where + range + FILL(NULL) + EVERY( s)(2) + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + datacheck = tdSql.error(sql) + + sql = "select %s from (select * from stable_1 )" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_2'))" % interp_select + sql += "where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + sql = "select %s from (select * from stable_1 where tbname in ('table_3'))" % interp_select + sql += "where ts >= '%s' AND ts <= '%s' range('%s' , '%s') EVERY(1s) FILL(NULL);" % (self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + datacheck = tdSql.error(sql) + + # Nested Query + where + range + FILL(NULL) + EVERY( s)(3) + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts + 100000) + # datacheck = self.regular1_checkall_0_NULL(sql) + # tdSql.checkRows(111) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts - 10000 , self.ts - 9900) + # datacheck = self.regular1_checkall_0_NULL(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts) + # datacheck = self.regular3_checkall_0(sql) + # tdSql.checkRows(1) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts , self.ts + 200000) + # datacheck = self.regular1_checkall_0(sql) + # tdSql.checkRows(201) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 1500 , self.ts + 2500) + # datacheck = self.regular1_checkall_0_NULL(sql) + # tdSql.checkRows(2) + + # sql = "select * from (select %s from stable_1 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z1," % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # sql += "(select %s from stable_2 where ts BETWEEN '%s' AND '%s' range('%s' , '%s') EVERY(1s) FILL(NULL) group by tbname) z2 where z1.ts=z2.ts ;" % (interp_select , self.ts , self.ts + 10000 , self.ts + 150000 , self.ts + 200000) + # datacheck = self.regular1_checkall_0_NULL(sql) + # tdSql.checkRows(51) + endTime = time.time() + print("total time %ds" % (endTime - startTime)) def stop(self): tdSql.close() diff --git a/tests/pytest/functions/queryTestCases.py b/tests/pytest/functions/queryTestCases.py index 75e2359bb1c6b03e27e60ea75dbaeb6e77f2cc13..8bdbee09e7f715384f048028e7cccd0010e5642b 100644 --- a/tests/pytest/functions/queryTestCases.py +++ b/tests/pytest/functions/queryTestCases.py @@ -84,7 +84,7 @@ class TDTestCase: index_value = np.dstack((cpms_index[0])).squeeze() tdSql.query("show variables") - tdSql.checkData(index_value, 1, -1) + tdSql.checkData(index_value, 1, 524288) tdSql.query("show dnodes") index = tdSql.getData(0, 0) @@ -1570,7 +1570,7 @@ class TDTestCase: # master branch self.td3690() - self.td4082() + # self.td4082() self.td4288() self.td4724() self.td5935() diff --git a/tests/pytest/insert/basic.py b/tests/pytest/insert/basic.py index f23f38651aa57590a14824077e003812ea10d8bd..72daad7bcae66aec879cb30cde8c786e3e6d14c2 100644 --- a/tests/pytest/insert/basic.py +++ b/tests/pytest/insert/basic.py @@ -45,6 +45,11 @@ class TDTestCase: # test case for https://jira.taosdata.com:18080/browse/TD-3716: tdSql.error("insert into tb(now, 1)") + # test case for TD-10717 + tdSql.error("insert into tb values(now,1),,(now+1s,1)") + tdSql.execute("insert into tb values(now+2s,1),(now+3s,1),(now+4s,1)") + tdSql.query("select * from tb") + tdSql.checkRows(insertRows + 4 +3) def stop(self): tdSql.close() diff --git a/tests/pytest/insert/insertJSONPayload.py b/tests/pytest/insert/insertJSONPayload.py index 81d4b47ef15cb03311943d3d53c2efe25a3b0312..a2e773328a7a346f17d8c256cce79d7beb9628e4 100644 --- a/tests/pytest/insert/insertJSONPayload.py +++ b/tests/pytest/insert/insertJSONPayload.py @@ -686,10 +686,10 @@ class TDTestCase: print("schemaless_insert result {}".format(code)) tdSql.query("describe `1234`") - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query("select * from `123`") - tdSql.checkRows(1) + #tdSql.query("select * from `123`") + #tdSql.checkRows(1) payload = [''' { @@ -711,10 +711,10 @@ class TDTestCase: print("schemaless_insert result {}".format(code)) tdSql.query("describe `int`") - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query("select * from `and`") - tdSql.checkRows(1) + #tdSql.query("select * from `and`") + #tdSql.checkRows(1) payload = [''' { @@ -736,10 +736,10 @@ class TDTestCase: print("schemaless_insert result {}".format(code)) tdSql.query("describe `double`") - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query("select * from `for`") - tdSql.checkRows(1) + #tdSql.query("select * from `for`") + #tdSql.checkRows(1) payload = [''' { @@ -761,10 +761,10 @@ class TDTestCase: print("schemaless_insert result {}".format(code)) tdSql.query("describe `from`") - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query("select * from `!@#.^&`") - tdSql.checkRows(1) + #tdSql.query("select * from `!@#.^&`") + #tdSql.checkRows(1) payload = [''' { @@ -786,10 +786,10 @@ class TDTestCase: print("schemaless_insert result {}".format(code)) tdSql.query("describe `!@#$.%^&*()`") - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query("select * from `none`") - tdSql.checkRows(1) + #tdSql.query("select * from `none`") + #tdSql.checkRows(1) payload = [''' { @@ -836,11 +836,10 @@ class TDTestCase: print("schemaless_insert result {}".format(code)) tdSql.query("describe `stable`") - tdSql.checkRows(8) - - tdSql.query("select * from `key`") - tdSql.checkRows(1) + tdSql.checkRows(9) + #tdSql.query("select * from `key`") + #tdSql.checkRows(1) def stop(self): tdSql.close() diff --git a/tests/pytest/insert/insertTelnetLines.py b/tests/pytest/insert/insertTelnetLines.py index a48351f6c0b162be83f6aca44a87ff9f55b498c8..149e62c362ab802fbbc4f2d939b3bf149cbf7e1b 100644 --- a/tests/pytest/insert/insertTelnetLines.py +++ b/tests/pytest/insert/insertTelnetLines.py @@ -32,10 +32,10 @@ class TDTestCase: ### metric ### print("============= step1 : test metric ================") lines0 = [ - "stb0_0 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", - "stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", - "stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", - ".stb0.3. 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", + "stb0_0 1626006833639 4i8 host=\"host0\" interface=\"eth0\"", + "stb0_1 1626006833639 4i8 host=\"host0\" interface=\"eth0\"", + "stb0_2 1626006833639 4i8 host=\"host0\" interface=\"eth0\"", + ".stb0.3. 1626006833639 4i8 host=\"host0\" interface=\"eth0\"", ] code = self._conn.schemaless_insert(lines0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) @@ -287,72 +287,72 @@ class TDTestCase: #tag ID as child table name - lines3_1 = [ - "stb3_1 1626006833610 1 id=child_table1 host=host1", - "stb3_1 1626006833610 2 host=host2 iD=child_table2", - "stb3_1 1626006833610 3 ID=child_table3 host=host3" - ] + #lines3_1 = [ + # "stb3_1 1626006833610 1 id=child_table1 host=host1", + # "stb3_1 1626006833610 2 host=host2 iD=child_table2", + # "stb3_1 1626006833610 3 ID=child_table3 host=host3" + # ] - code = self._conn.schemaless_insert(lines3_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) - print("schemaless_insert result {}".format(code)) + #code = self._conn.schemaless_insert(lines3_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) + #print("schemaless_insert result {}".format(code)) - tdSql.query("select * from stb3_1") - tdSql.checkRows(3) + #tdSql.query("select * from stb3_1") + #tdSql.checkRows(3) - tdSql.query("show tables like \"child%\"") - tdSql.checkRows(3) + #tdSql.query("show tables like \"child%\"") + #tdSql.checkRows(3) - tdSql.checkData(0, 0, "child_table1") + #tdSql.checkData(0, 0, "child_table1") ### special characters and keywords ### print("============= step4 : test special characters and keywords ================") lines4_1 = [ - "1234 1626006833610ms 1 id=123 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", - "int 1626006833610ms 2 id=and 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", - "double 1626006833610ms 2 id=for 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", - "from 1626006833610ms 2 id=!@#.^& 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", - "!@#$.%^&*() 1626006833610ms 2 id=none 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", - "STABLE 1626006833610ms 2 id=KEY 456=true int=true double=false TAG=1 FROM=2 COLUMN=false", + "1234 1626006833610 1 id=123 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", + "int 1626006833610 2 id=and 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", + "double 1626006833610 2 id=for 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", + "from 1626006833610 2 id=!@#.^& 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", + "!@#$.%^&*() 1626006833610 2 id=none 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false", + "STABLE 1626006833610 2 id=KEY 456=true int=true double=false TAG=1 FROM=2 COLUMN=false", ] code = self._conn.schemaless_insert(lines4_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value) print("schemaless_insert result {}".format(code)) tdSql.query('describe `1234`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `int`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `double`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `from`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `!@#$.%^&*()`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `stable`') - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query('select * from `123`') - tdSql.checkRows(1) + #tdSql.query('select * from `123`') + #tdSql.checkRows(1) - tdSql.query('select * from `and`') - tdSql.checkRows(1) + #tdSql.query('select * from `and`') + #tdSql.checkRows(1) - tdSql.query('select * from `for`') - tdSql.checkRows(1) + #tdSql.query('select * from `for`') + #tdSql.checkRows(1) - tdSql.query('select * from `!@#.^&`') - tdSql.checkRows(1) + #tdSql.query('select * from `!@#.^&`') + #tdSql.checkRows(1) - tdSql.query('select * from `none`') - tdSql.checkRows(1) + #tdSql.query('select * from `none`') + #tdSql.checkRows(1) - tdSql.query('select * from `key`') - tdSql.checkRows(1) + #tdSql.query('select * from `key`') + #tdSql.checkRows(1) def stop(self): tdSql.close() diff --git a/tests/pytest/insert/line_insert.py b/tests/pytest/insert/line_insert.py index ff26483aeb323ebd309ba7a41e91ac860af9d222..acc43d80e719065706aaee95c5cdbaf5235ae04b 100644 --- a/tests/pytest/insert/line_insert.py +++ b/tests/pytest/insert/line_insert.py @@ -83,8 +83,8 @@ class TDTestCase: tdSql.query('select tbname, * from sth') tdSql.checkRows(2) - tdSql.query('select tbname, * from childtable') - tdSql.checkRows(1) + #tdSql.query('select tbname, * from childtable') + #tdSql.checkRows(1) ###Special Character and keyss self._conn.schemaless_insert([ @@ -98,40 +98,40 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.query('describe `1234`') - tdSql.checkRows(9) + tdSql.checkRows(10) tdSql.query('describe `int`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `double`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `from`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `!@#$.%^&*()`') - tdSql.checkRows(8) + tdSql.checkRows(9) tdSql.query('describe `stable`') - tdSql.checkRows(8) + tdSql.checkRows(9) - tdSql.query('select * from `3456`') - tdSql.checkRows(1) + #tdSql.query('select * from `3456`') + #tdSql.checkRows(1) - tdSql.query('select * from `and`') - tdSql.checkRows(1) + #tdSql.query('select * from `and`') + #tdSql.checkRows(1) - tdSql.query('select * from `for`') - tdSql.checkRows(1) + #tdSql.query('select * from `for`') + #tdSql.checkRows(1) - tdSql.query('select * from `!@#$.%^`') - tdSql.checkRows(1) + #tdSql.query('select * from `!@#$.%^`') + #tdSql.checkRows(1) - tdSql.query('select * from `none`') - tdSql.checkRows(1) + #tdSql.query('select * from `none`') + #tdSql.checkRows(1) - tdSql.query('select * from `create`') - tdSql.checkRows(1) + #tdSql.query('select * from `create`') + #tdSql.checkRows(1) def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/bug5903.py b/tests/pytest/query/bug5903.py new file mode 100644 index 0000000000000000000000000000000000000000..a973efbbdf7a0868a4db7910bf57bd5eef8dae06 --- /dev/null +++ b/tests/pytest/query/bug5903.py @@ -0,0 +1,36 @@ +################################################################### +# 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 -*- + +from util.log import * +from util.cases import * +from util.sql import * + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + # TD-5903 show db.vgroups xxx. xxx is invalid content, but still returns results. + + tdSql.execute("create database if not exists test_5903") + tdSql.execute("show test_5903.vgroups") + tdSql.error("show test_5903.vgroups xxx") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/nestedQuery/nestedQuery.py b/tests/pytest/query/nestedQuery/nestedQuery.py index 545f6429e825c468bdb07524329d6ea49944e379..9260aced9a1d79649802917daad8f36ec9cf249e 100755 --- a/tests/pytest/query/nestedQuery/nestedQuery.py +++ b/tests/pytest/query/nestedQuery/nestedQuery.py @@ -366,7 +366,7 @@ class TDTestCase: calc_select_regular = [ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)'] - calc_select_fill = ['INTERP(q_bool)' ,'INTERP(q_binary)' ,'INTERP(q_nchar)' ,'INTERP(q_ts)', 'INTERP(q_int)' ,'INTERP(*)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)'] + calc_select_fill = ['INTERP(q_int)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)'] interp_where = ['ts = now' , 'ts = \'2020-09-13 20:26:40.000\'' , 'ts = \'2020-09-13 20:26:40.009\'' ,'tbname in (\'table_1\') and ts = now' ,'tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\''] #two table join @@ -396,8 +396,8 @@ class TDTestCase: 'PERCENTILE(t2.q_int,10)' ,'PERCENTILE(t2.q_bigint,20)' , 'PERCENTILE(t2.q_smallint,30)' ,'PERCENTILE(t2.q_tinyint,40)' ,'PERCENTILE(t2.q_float,50)' ,'PERCENTILE(t2.q_double,60)'] - calc_select_fill_j = ['INTERP(t1.q_bool)' ,'INTERP(t1.q_binary)' ,'INTERP(t1.q_nchar)' ,'INTERP(t1.q_ts)', 'INTERP(t1.q_int)' ,'INTERP(t1.*)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' , - 'INTERP(t2.q_bool)' ,'INTERP(t2.q_binary)' ,'INTERP(t2.q_nchar)' ,'INTERP(t2.q_ts)', 'INTERP(t2.q_int)' ,'INTERP(t2.*)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)'] + calc_select_fill_j = ['INTERP(t1.q_int)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' , + 'INTERP(t2.q_int)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)'] interp_where_j = ['t1.ts = now' , 't1.ts = \'2020-09-13 20:26:40.000\'' , 't1.ts = \'2020-09-13 20:26:40.009\'' ,'t2.ts = now' , 't2.ts = \'2020-09-13 20:26:40.000\'' , 't2.ts = \'2020-09-13 20:26:40.009\'' , 't1.tbname in (\'table_1\') and t1.ts = now' ,'t1.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t1.ts = \'2020-09-13 20:26:40.000\'','t1.tbname like \'table%\' and t1.ts = \'2020-09-13 20:26:40.002\'', 't2.tbname in (\'table_1\') and t2.ts = now' ,'t2.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t2.ts = \'2020-09-13 20:26:40.000\'','t2.tbname like \'table%\' and t2.ts = \'2020-09-13 20:26:40.002\''] @@ -1996,7 +1996,7 @@ class TDTestCase: sql += ") " tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + #tdSql.query(sql) rsDn = self.restartDnodes() tdSql.query("select 20-2 from table_0;") @@ -2014,7 +2014,7 @@ class TDTestCase: sql += ") " tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + #tdSql.query(sql) tdSql.query("select 20-2.2 from table_0;") for i in range(self.fornum): @@ -2391,4 +2391,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/pytest/query/query.py b/tests/pytest/query/query.py index 8e79fc5f686d77aa276da5bca7d9493ff1a00ffb..31831cca9facea6aba1a6fc88a84a33a66583a5e 100644 --- a/tests/pytest/query/query.py +++ b/tests/pytest/query/query.py @@ -31,13 +31,42 @@ class TDTestCase: tdSql.execute("create database bug6387 ") tdSql.execute("use bug6387 ") tdSql.execute("create table test(ts timestamp, c1 int) tags(t1 int)") + prefix = "insert into " + sql = "" for i in range(5000): - sql = "insert into t%d using test tags(1) values " % i + temp = "t%d using test tags(1) values " % i for j in range(21): - sql = sql + "(now+%ds,%d)" % (j ,j ) - tdSql.execute(sql) + temp = temp + "(now+%ds,%d)" % (j ,j ) + sql = sql + temp + if i % 1000 == 0 : + tdSql.execute(prefix + sql) + sql = "" tdSql.query("select count(*) from test interval(1s) group by tbname") tdSql.checkData(0,1,1) + + def escape_ascii(self): + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + tdSql.execute("create table car (ts timestamp, s int) tags(j int)") + for i in range(32,127): + if i == 96 : continue #` + sql = 'create table `是否出现%s` using car tags(%d)' % (chr(i), i) + tdSql.execute(sql) + for i in range(32,65): + sql = 'select tbname from car where tbname like "是否出现\%s"' % chr(i) + tdSql.query(sql) + if i == 37 : continue # " ` + tdSql.checkRows(1) + for i in range(91,97): + sql = 'select tbname from car where tbname like "是否出现\%s"' % chr(i) + tdSql.query(sql) + if i == 96: continue # ` + tdSql.checkRows(1) + for i in range(123,127): + sql = 'select tbname from car where tbname like "是否出现\%s"' % chr(i) + tdSql.query(sql) + tdSql.checkRows(1) def run(self): tdSql.prepare() @@ -165,6 +194,10 @@ class TDTestCase: tdSql.query("show create table t1") tdSql.checkRows(1) + #TS-636 + tdLog.info("case for TS-636") + self.escape_ascii() + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/queryGroupTbname.py b/tests/pytest/query/queryGroupTbname.py index 8665a3f7746aa9e2868cb9f4d4d9d6c9a7e7859c..bb67809e60087f94ad7f92ca7515aa8ddfc43151 100644 --- a/tests/pytest/query/queryGroupTbname.py +++ b/tests/pytest/query/queryGroupTbname.py @@ -10,10 +10,12 @@ ################################################################### # -*- coding: utf-8 -*- +from util.dnodes import tdDnodes from util.log import tdLog from util.cases import tdCases from util.sql import tdSql from util.common import tdCom +import random class TDTestCase: def init(self, conn, logSql): @@ -46,8 +48,53 @@ class TDTestCase: for i in range(100): tdSql.query(f'select {table_name_sub1},{table_name_sub2},{table_name_sub3},{table_name_sub4},{table_name_sub5},{table_name_sub6},{table_name_sub7},{table_name_sub8},{table_name_sub9} from {table_name} where tbname in ("{table_name_sub1}","{table_name_sub2}","{table_name_sub3}","{table_name_sub4}","{table_name_sub5}","{table_name_sub6}","{table_name_sub7}","{table_name_sub8}","{table_name_sub9}") and ts >= "1980-01-01 00:00:00.000"') + tdSql.checkRows(0) + + # TS-634 + tdLog.info("test case for bug TS-634") + tdSql.execute("create database test") + tdSql.execute("use test") + tdSql.execute("create table meters (ts TIMESTAMP,voltage INT) TAGS (tableid INT)") + tdSql.execute("CREATE TABLE t1 USING meters TAGS (1)") + tdSql.execute("CREATE TABLE t2 USING meters TAGS (2)") + + ts = 1605381041000 + for i in range(10): + tdSql.execute("INSERT INTO t1 values(%d, %d)" % (ts + i, random.randint(0, 100))) + tdSql.execute("INSERT INTO t2 values(%d, %d)" % (ts + i, random.randint(0, 100))) + + tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc") + tdSql.checkRows(2) + + tdSql.execute("INSERT INTO t2 values(now, 2)") + tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc") + tdSql.checkRows(2) + + # TS-561 null tags group by crash + tdLog.info("test case for TS-561") + tdSql.execute("create database openfalcon") + tdSql.execute("use openfalcon") + tdSql.execute("create table stb (ts timestamp, value double) tags(_endpoint binary(150), _hostname binary(150), _indexname binary(50), _ip binary(50), _q_name binary(150))") + tdSql.execute("create table tb0 using stb tags('root.FTBI', 'CNSZ17VL4774', 'max_mem', '10.116.100.10_8088', 'root.line_volume_predict')") + tdSql.execute("create table tb1 using stb(_endpoint, _hostname, _indexname) tags('root.medium_high_freq', 'CNSZ17VL4775', 'max_mem_1')") + + for i in range(2): + sql = "insert into tb%d values" % i + for j in range(10000): + sql += "(%d, %d)" % (ts + j * 500, random.randint(1, 10000) + random.uniform(1.0, 1000.0)) + tdSql.execute(sql) + + tdSql.query("select avg(value) from openfalcon.stb where ts > '2020-11-15 03:30:00.000' and ts < '2020-11-15 04:30:00.000' group by _hostname, _indexname, _ip, _q_name") + tdSql.checkRows(2) + + tdDnodes.stop(1) + tdDnodes.start(1) + + tdSql.query("select avg(value) from openfalcon.stb where ts > '2020-11-15 03:30:00.000' and ts < '2020-11-15 04:30:00.000' group by _hostname, _indexname, _ip, _q_name") + tdSql.checkRows(2) + def run(self): tdSql.prepare() self.queryGroupTbname() diff --git a/tests/pytest/query/udf.py b/tests/pytest/query/udf.py index 14429a53f44b1393c9f179cc405ed61fb59e8b02..e9fc42c72edc9d6eee5592852960ddb8d53d124a 100644 --- a/tests/pytest/query/udf.py +++ b/tests/pytest/query/udf.py @@ -73,21 +73,18 @@ class TDTestCase: tdSql.error(sql) sql = 'select abs_max(c2) from db.stb' tdSql.query(sql) - tdSql.checkData(0,0,1410065607) + tdSql.checkData(0,0,10000000199) def test_udf_values(self): tdSql.execute("drop function abs_max") tdSql.execute("create function add_one as '/tmp/add_one.so' outputtype int") tdSql.execute("create aggregate function abs_max as '/tmp/abs_max.so' outputtype bigint;") - tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype int bufsize 128;") + tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype bigint;") - # UDF bug no 1 -> follow 3 cases about this bug ; # tdSql.error("create aggregate function max as '/tmp/abs_max.so' outputtype bigint ;") # tdSql.error("create aggregate function avg as '/tmp/abs_max.so' outputtype bigint ;") # tdSql.error("create aggregate function dbs as '/tmp/abs_max.so' outputtype bigint ;") - - tdSql.execute("drop database if exists test") tdSql.execute("create database test") tdSql.execute("use test") @@ -117,7 +114,7 @@ class TDTestCase: tdSql.execute("insert into bound values(%d, %d , %f, %d , %s)"%(epoch_time+1000,intdata2+1,float(intdata2+1),bigintdata2+1,"'binary"+str(intdata2+1)+"'")) # check super table calculation results - tdSql.query("select add_one(id) from st") + tdSql.query("select add_one(id) test from st") tdSql.checkData(0,0,1) tdSql.checkData(1,0,2) tdSql.checkData(4,0,5) @@ -157,29 +154,266 @@ class TDTestCase: tdLog.info(" ====== unexpected error occured about UDF function =====") sys.exit() - # UDF bug no 2 -> values of abs_max not inconsistent from common table and stable. - # tdSql.query("select abs_max(val) from st") # result is 0 rows - # tdSql.query("select abs_max(val) from tb1") - # tdSql.checkData(0,0,0) # this is error result - # tdSql.query("select sum_double(val) from st") # result is 0 rows - # tdSql.query("select sum_double(val) from tb1") - # tdSql.checkData(0,0,0) # this is error result + tdSql.query("select abs_max(val) from st") + tdSql.query("select abs_max(val) from tb1") + tdSql.checkRows(0) + tdSql.query("select sum_double(val) from st") + tdSql.query("select sum_double(val) from tb1") + tdSql.checkRows(0) - # UDF bug no 3 -> values of abs_max will error for boundary number - # check super table calculation results - # tdSql.query("select abs_max(number) from st") - # tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from st") + tdSql.checkData(0,0,9223372036854775807) # check common table calculation results tdSql.query("select abs_max(number) from tb1") tdSql.checkData(0,0,400) tdSql.query("select abs_max(number) from tb2") tdSql.checkData(0,0,400) + tdSql.execute("select add_one(id) from st limit 10 offset 2") + tdSql.query("select add_one(id) from st where ts > 1604298064000 and ts < 1604298064020 ") + tdSql.checkData(0,0,1) + tdSql.checkData(1,0,-2147483644) + tdSql.query("select add_one(id) from tb1 where ts > 1604298064000 and ts < 1604298064020 ") + tdSql.checkData(0,0,1) + tdSql.query("select sum_double(id) from st where ts > 1604298064030 and ts < 1604298064060 ") + tdSql.checkData(0,0,14) + tdSql.query("select sum_double(id) from tb2 where ts > 1604298064030 and ts < 1604298064060 ") + tdSql.checkRows(0) + tdSql.query("select add_one(id) from st where ts = 1604298064000 ") + tdSql.checkData(0,0,-2147483645) + tdSql.query("select add_one(id) from st where ts > 1604298064000 and id in (2,3) and ind =1;") + tdSql.checkData(0,0,3) + tdSql.checkData(1,0,4) + tdSql.query("select id , add_one(id) from tb1 where ts > 1604298064000 and id in (2,3)") + tdSql.checkData(0,0,2) + tdSql.checkData(0,1,3) + tdSql.checkData(1,0,3) + tdSql.checkData(1,1,4) + tdSql.query("select sum_double(id) from tb1 where ts > 1604298064000 and id in (2,3)") + tdSql.checkData(0,0,10) + tdSql.query("select sum_double(id) from st where ts > 1604298064000 and id in (2,3) and ind =1") + tdSql.checkData(0,0,10) + tdSql.query("select abs_max(number) from st where ts > 1604298064000 and id in (2,3) and ind =1") + tdSql.checkData(0,0,300) + tdSql.query("select sum_double(id) from st where ts = 1604298064030 ") + tdSql.checkData(0,0,4) + tdSql.query("select abs_max(number) from st where ts = 1604298064100 ") + tdSql.checkData(0,0,9223372036854775806) + tdSql.query("select abs_max(number) from tb2 where ts = 1604298064100 ") + tdSql.checkData(0,0,400) + tdSql.query("select sum_double(id) from tb2 where ts = 1604298064100 ") + tdSql.checkData(0,0,8) + tdSql.query("select add_one(id) from st where ts >= 1604298064000 and ts <= 1604298064010") + tdSql.checkData(0,0,1) + tdSql.checkData(1,0,-2147483645) + tdSql.checkData(2,0,-2147483644) + tdSql.query("select add_one(id) from tb1 where ts >= 1604298064000 and ts <= 1604298064010") + tdSql.checkData(0,0,1) + tdSql.query("select sum_double(id) from st where ts >= 1604298064030 and ts <= 1604298064050") + tdSql.checkData(0,0,18) + tdSql.query("select sum_double(id) from tb2 where ts >= 1604298064030 and ts <= 1604298064100") + tdSql.checkData(0,0,20) + tdSql.query("select abs_max(number) from tb2 where ts >= 1604298064030 and ts <= 1604298064100") + tdSql.checkData(0,0,400) + tdSql.query("select abs_max(number) from st where ts >= 1604298064030 and ts <= 1604298064100") + tdSql.checkData(0,0,9223372036854775806) + tdSql.query("select id from st where id != 0 and ts >=1604298064070") + tdSql.checkData(0,0,1) + tdSql.query("select add_one(id) from st where id != 0 and ts >=1604298064070") + tdSql.checkData(0,0,2) + tdSql.query("select add_one(id) from st where id <> 0 and ts >=1604298064010") + tdSql.checkData(0,0,2) + tdSql.query("select sum_double(id) from st where id in (2,3,4) and ts >=1604298064070") + tdSql.checkData(0,0,18) + tdSql.query("select sum_double(id) from tb2 where id in (2,3,4) and ts >=1604298064070") + tdSql.checkData(0,0,18) + tdSql.query("select abs_max(number) from st where id in (2,3,4) and ts >=1604298064070") + tdSql.checkData(0,0,400) + tdSql.query("select add_one(id) from st where id = 0 ") + tdSql.checkData(0,0,1) + tdSql.checkData(1,0,1) + tdSql.query("select add_one(id) from tb2 where id = 0 ") + tdSql.checkData(0,0,1) + tdSql.query("select sum_double(id) from st where id = 1") + tdSql.checkData(0,0,4) + tdSql.query("select sum_double(id) from tb2 where id = 1") + tdSql.checkData(0,0,2) + + + tdSql.query("select add_one(id) from st where id is not null and ts >=1604298065000 ") + tdSql.checkData(0,0,None) + tdSql.query("select abs_max(number) from st where id is not null and ts >=1604298065000 ") + tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from bound where id is not null and ts >=1604298065000 ") + tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select sum_double(id) from st where id is not null and ts >=1604298064000 and ind = 1 ") + tdSql.checkData(0,0,20) + tdSql.query("select sum_double(id) from tb1 where id is not null and ts >=1604298064000 ") + tdSql.checkData(0,0,20) + tdSql.query("select add_one(id) from st where id is null and ts >=1604298065000 ") + tdSql.checkRows(0) + tdSql.query("select abs_max(number) from st where id is null and ts >=1604298065000 ") + tdSql.checkRows(0) + tdSql.query("select abs_max(number) from tb1 where id is null and ts >=1604298065000 ") + tdSql.checkRows(0) + tdSql.query("select add_one(id) from bound where id is not null and ts >=1604298065000;") + tdSql.checkData(0,0,None) + tdSql.query("select id,add_one(id) from bound;") + tdSql.checkRowCol(4,2) + tdSql.checkData(3,1,None) + tdSql.query("select add_one(id) from st where ts between 1604298064000 and 1604298064010") + tdSql.checkRows(3) + tdSql.query("select add_one(id) from tb1 where ts between 1604298064000 and 1604298064010") + tdSql.checkRows(1) + tdSql.query("select sum_double(id) from st where ts between 1604298064000 and 1604298064010 and id>=0") + tdSql.checkData(0,0,0) + tdSql.query("select sum_double(id) from tb1 where ts between 1604298064000 and 1604298064010 and id>=0") + tdSql.checkData(0,0,0) + tdSql.query("select add_one(id) from st where id in (1,2)") + tdSql.checkData(0,0,2) + tdSql.checkData(1,0,3) + tdSql.checkData(2,0,2) + tdSql.checkData(3,0,3) + tdSql.checkRows(4) + + tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(1s)") + tdSql.checkData(0,1,20) + tdSql.error("select sum_double(id) from st where ts < now and ind =1 interval(3s) sliding (1s) fill (NULL) ") + tdSql.error("select sum_double(id) from st session(ts, 1s)") + tdSql.query("select sum_double(id) from tb1 session(ts, 1s)") + tdSql.checkData(0,1,20) + + # intervals sliding values calculation + tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2") + tdSql.checkData(0,1,20) + tdSql.checkData(1,1,20) + + # scalar_function can't work when using interval and sliding ========= + tdSql.error("select add_one(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2 ") + tdSql.error("select add_one(id) from st order by ts") + tdSql.error("select ts,id,add_one(id) from st order by ts asc;") + + # # UDF not support order by + tdSql.error("select ts,id,add_one(id) from st order by ts desc;") + + # UDF function union all + tdSql.query("select add_one(id) from tb1 union all select add_one(id) from tb2;") + tdSql.checkRows(10) + tdSql.checkData(0,0,1) + tdSql.checkData(5,0,1) + tdSql.query("select sum_double(id) from tb1 union all select sum_double(id) from tb2;") + tdSql.checkRows(2) + tdSql.checkData(0,0,20) + tdSql.checkData(1,0,20) + tdSql.query("select abs_max(number) from tb1 union all select abs_max(number) from bound;") + tdSql.checkRows(2) + tdSql.checkData(0,0,400) + tdSql.checkData(1,0,9223372036854775807) + tdSql.execute("create stable stb (ts timestamp,id int , val double , number bigint, chars binary(200)) tags (ind int)") + tdSql.execute("create table stb1 using stb tags(3)") + tdSql.execute("insert into stb1 values(1604298064000 , 1 , 1.0 , 10000 ,'chars')") + tdSql.query("select add_one(id) from st union all select add_one(id) from stb;") + tdSql.checkRows(15) + tdSql.checkData(13,0,None) + tdSql.checkData(14,0,2) + tdSql.query("select add_one(id) from st union all select add_one(id) from stb1;") + tdSql.checkRows(15) + tdSql.checkData(13,0,None) + tdSql.checkData(14,0,2) + tdSql.query("select id ,add_one(id) from tb1 union all select id ,add_one(id) from stb1;") + tdSql.checkRows(6) + tdSql.checkData(0,0,0) + tdSql.checkData(0,1,1) + tdSql.checkData(1,0,1) + tdSql.checkData(1,1,2) + + # aggregate union all for different stables + tdSql.query("select sum_double(id) from st union all select sum_double(id) from stb;") + tdSql.checkRows(2) + tdSql.checkData(0,0,44) + tdSql.checkData(1,0,2) + tdSql.query("select id from st union all select id from stb1;") + tdSql.checkRows(15) + tdSql.query("select id from tb1 union all select id from stb1") + tdSql.checkRows(6) + tdSql.query("select sum_double(id) from tb1 union all select sum_double(id) from stb") + tdSql.checkData(0,0,20) + tdSql.checkData(1,0,2) + tdSql.query("select sum_double(id) from st union all select sum_double(id) from stb1;") + tdSql.checkRows(2) + tdSql.checkData(0,0,44) + tdSql.checkData(1,0,2) + tdSql.query("select abs_max(number) from st union all select abs_max(number) from stb;") + tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from bound union all select abs_max(number) from stb1;") + tdSql.checkData(0,0,9223372036854775807) + tdSql.checkData(1,0,10000) + tdSql.query("select abs_max(number) from st union all select abs_max(number) from stb1;") + tdSql.checkData(0,0,9223372036854775807) + tdSql.checkData(1,0,10000) + + # group by for aggegate function ; + tdSql.query("select sum_double(id) from st group by tbname;") + tdSql.checkData(0,0,20) + tdSql.checkData(0,1,'tb1') + tdSql.checkData(1,0,20) + tdSql.checkData(1,1,'tb2') + tdSql.query("select sum_double(id) from st group by id;") + tdSql.checkRows(9) + tdSql.query("select sum_double(id) from st group by ts") + tdSql.checkRows(12) + tdSql.query("select sum_double(id) from st group by ind") + tdSql.checkRows(3) + tdSql.query("select sum_double(id) from st group by tbname order by ts asc;") + tdSql.query("select abs_max(number) from st group by id") + tdSql.checkRows(9) + tdSql.checkData(0,0,9223372036854775806) + tdSql.checkData(8,0,9223372036854775807) + tdSql.query("select abs_max(number) from st group by ts") + tdSql.checkRows(12) + tdSql.checkData(11,0,9223372036854775807) + tdSql.checkData(1,0,9223372036854775805) + tdSql.query("select abs_max(number) from st group by ind") + tdSql.checkRows(3) + tdSql.checkData(0,0,400) + tdSql.checkData(2,0,9223372036854775807) + + # UDF join + tdSql.query("select add_one(tb1.id),add_one(bound.id) from tb1,bound where tb1.ts=bound.ts;") + tdSql.checkData(0,0,1) + tdSql.checkData(0,1,-2147483644) + tdSql.query("select stb1.ts,add_one(stb1.id),bound.ts,add_one(bound.id) from stb1,bound where stb1.ts=bound.ts") + tdSql.checkData(0,1,2) + tdSql.checkData(0,3,-2147483645) + tdSql.query("select st.ts,add_one(st.id),stb.ts,add_one(stb.id) from st,stb where st.ts=stb.ts and st.ind=stb.ind") + tdSql.checkData(0,1,-2147483645) + tdSql.checkData(0,3,2) + + tdSql.query("select sum_double(tb1.id),sum_double(bound.id) from tb1,bound where tb1.ts=bound.ts;") + tdSql.checkData(0,0,0) + tdSql.checkData(0,1,-4294967290) + tdSql.query("select sum_double(stb1.id),sum_double(bound.id) from stb1,bound where stb1.ts=bound.ts") + tdSql.checkData(0,0,2) + tdSql.checkData(0,1,-4294967292) + + #UDF join for stables + tdSql.query("select sum_double(st.id),sum_double(stb.id) from st,stb where st.ts=stb.ts and st.ind=stb.ind") + tdSql.checkData(0,0,-4294967292) + tdSql.checkData(0,1,2) + tdSql.query("select abs_max(tb1.number),abs_max(bound.number) from tb1,bound where tb1.ts=bound.ts;") + tdSql.checkData(0,0,0) + tdSql.checkData(0,1,9223372036854775805) + tdSql.query("select abs_max(stb1.number),abs_max(bound.number) from stb1,bound where stb1.ts=bound.ts") + tdSql.checkData(0,0,10000) + tdSql.checkData(0,1,9223372036854775806) + tdSql.query("select abs_max(st.number),abs_max(stb.number) from st,stb where st.ts=stb.ts and st.ind=stb.ind") + tdSql.checkData(0,0,9223372036854775806) + tdSql.checkData(0,1,10000) # check boundary - # tdSql.query("select abs_max(number) from bound") - # tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from bound") + tdSql.checkData(0,0,9223372036854775807) tdLog.info("======= UDF function sum_double check =======") @@ -189,14 +423,10 @@ class TDTestCase: tdSql.query("select sum_double(id) from tb1") tdSql.checkData(0,0,20) - # UDF bug no 4 -> values error while two function work : it is limit that udf can't work with build-in functions. - # tdSql.query("select sum_double(id) , abs_max(number) from tb1") - # tdSql.checkData(0,0,20) - # tdSql.checkData(0,0,400) - - # tdSql.query("select sum_double(id) , abs_max(number) from st") - # tdSql.checkData(0,0,44) - # tdSql.checkData(0,0,9223372036854775807) + # only one udf function in SQL can use ,follow errors notice. + tdSql.error("select sum_double(id) , abs_max(number) from tb1") + tdSql.error("select sum_double(id) , abs_max(number) from st") + # UDF not support mix up with build-in functions # it seems like not support scalar_function mix up with aggregate functions @@ -204,147 +434,162 @@ class TDTestCase: tdSql.error("select sum_double(id) ,add_one(id) from tb1") tdSql.error("select sum_double(id) ,max(id) from st") tdSql.error("select sum_double(id) ,max(id) from tb1") + tdSql.error("select twa(id),add_one(id) from st") + tdSql.error("select twa(id),add_one(id) from tb1") # UDF function not support Arithmetic =================== + tdSql.query("select max(id) + 5 from st") tdSql.query("select max(id) + 5 from tb1") tdSql.query("select max(id) + avg(val) from st") + tdSql.query("select abs_max(number)*5 from st") + tdSql.checkData(0,0,46116860184273879040.000000000) + tdSql.query("select abs_max(number)*5 from tb1") + tdSql.checkData(0,0,2000.000000000) tdSql.query("select max(id) + avg(val) from tb1") - tdSql.query("select abs_max(number) + 5 from st") + tdSql.query("select add_one(id) + 5 from st") + tdSql.checkData(4,0,10.000000000) + tdSql.query("select add_one(id)/5 from tb1") + tdSql.checkData(4,0,1.000000000) + tdSql.query("select sum_double(id)-5 from st") + tdSql.checkData(0,0,39.000000000) + tdSql.query("select sum_double(id)*5 from tb1") + tdSql.checkData(0,0,100.000000000) + + tdSql.query("select abs_max(number) + 5 from tb1") tdSql.error("select abs_max(number) + max(id) from st") - tdSql.query("select abs_max(number)*abs_max(val) from st") + tdSql.query("select abs_max(number)*abs_max(val) from st") + tdSql.query("select sum_double(id) + sum_double(id) from st") + tdSql.checkData(0,0,88.000000000) tdLog.info("======= UDF Nested query test =======") tdSql.query("select sum(id) from (select id from st)") tdSql.checkData(0,0,22) - #UDF bug no 5 -> not support Nested query - # tdSql.query("select abs_max(number) from (select number from st)") - # tdSql.checkData(0,0,9223372036854775807) - # tdSql.query("select abs_max(number) from (select number from bound)") - # tdSql.checkData(0,0,9223372036854775807) - # tdSql.query("select sum_double(id) from (select id from st)") - # tdSql.checkData(0,0,44) - # tdSql.query("select sum_double(id) from (select id from tb1)") - # tdSql.checkData(0,0,10) + #UDF bug -> Nested query + # outer nest query + tdSql.query("select abs_max(number) from (select number from st)") + tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from (select number from bound)") + tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select sum_double(id) from (select id from st)") + tdSql.checkData(0,0,44) + tdSql.query("select sum_double(id) from (select id from bound)") + tdSql.checkData(0,0,4) + tdSql.query("select add_one(id) from (select id from st);") + tdSql.checkRows(14) + tdSql.checkData(1,0,2) + tdSql.query("select add_one(id) from (select id from bound);") + tdSql.checkRows(4) + tdSql.checkData(1,0,-2147483644) - # UDF bug no 6 -> group by work error - tdLog.info("======= UDF work with group by =======") + # inner nest query + tdSql.query("select id from (select add_one(id) id from st)") + tdSql.checkRows(14) + tdSql.checkData(13,0,None) + tdSql.query("select id from (select add_one(id) id from bound)") + tdSql.checkRows(4) + tdSql.checkData(3,0,None) - # tdSql.query("select sum_double(id) from st group by tbname;") - # tdSql.checkData(0,0,6) - # tdSql.checkData(0,1,'tb1') - # tdSql.checkData(1,0,2) - # tdSql.checkData(1,1,'tb2') - # tdSql.query("select sum_double(id) from st group by id;") - # tdSql.checkRows(2) - # tdSql.query("select sum_double(id) from st group by tbname order by ts asc;") + tdSql.query("select id from (select sum_double(id) id from bound)") + tdSql.checkData(0,0,4) + tdSql.query("select id from (select sum_double(id) id from st)") # it will crash taos shell + tdSql.checkData(0,0,44) + tdSql.query("select id from (select abs_max(number) id from st)") # it will crash taos shell + tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select id from (select abs_max(number) id from bound)") + tdSql.checkData(0,0,9223372036854775807) - tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(1s)") - tdSql.checkData(0,1,20) - tdSql.error("select sum_double(id) from st session(ts, 1s) interval (10s,1s) sliding(10s) fill (NULL) ") - tdSql.error("select sum_double(id) from st session(ts, 1s)") - tdSql.query("select sum_double(id) from tb1 session(ts, 1s)") - tdSql.checkData(0,1,20) + # inner and outer nest query - # UDF -> bug no 7 : intervals sliding values calculation error - # tdSql.query("select sum_double(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2") - # tdSql.checkData(0,1,20) - # tdSql.checkData(1,1,20) + tdSql.query("select add_one(id) from (select add_one(id) id from st)") + tdSql.checkRows(14) + tdSql.checkData(0,0,2) + tdSql.checkData(1,0,3) + + tdSql.query("select add_one(id) from (select add_one(id) id from tb1)") + tdSql.checkRows(5) + tdSql.checkData(0,0,2) + tdSql.checkData(1,0,3) + + tdSql.query("select sum_double(sumdb) from (select sum_double(id) sumdb from st)") + tdSql.query("select sum_double(sumdb) from (select sum_double(id) sumdb from tb1)") - # scalar_function can't work when using interval and sliding ========= - tdSql.error("select add_one(id) from st where ts < now and ind =1 interval(3s) sliding (1s) limit 2 ") + tdSql.query("select abs_max(number) from (select abs_max(number) number from st)") + tdSql.checkData(0,0,9223372036854775807) + + tdSql.query("select abs_max(number) from (select abs_max(number) number from bound)") + tdSql.checkData(0,0,9223372036854775807) + + # nest inner and outer with build-in func + + tdSql.query("select max(number) from (select abs_max(number) number from st)") + tdSql.checkData(0,0,9223372036854775807) + + tdSql.query("select max(number) from (select abs_max(number) number from bound)") + tdSql.checkData(0,0,9223372036854775807) + + tdSql.query("select sum_double(sumdb) from (select sum_double(id) sumdb from st)") + + tdSql.query("select sum(sumdb) from (select sum_double(id) sumdb from tb1)") + tdSql.checkData(0,0,20) + tdLog.info(" =====================test illegal creation method =====================") - tdSql.execute("drop function add_one") + # tdSql.execute("drop function add_one") tdSql.execute("drop function abs_max") tdSql.execute("drop function sum_double") tdSql.execute("create aggregate function error_use1 as '/tmp/abs_max.so' outputtype bigint ") tdSql.error("select error_use1(number) from st") - # UDF -> bug no 8: error return values when create aggregate functions as an scalar_function + # illega UDF create aggregate functions as an scalar_function # with no aggregate - # tdSql.execute("create function abs_max as '/tmp/abs_max.so' outputtype bigint bufsize 128") - # tdSql.query("select abs_max(number) from st") # this bug will return 3 rows - # tdSql.checkRows(1) - # tdSql.execute("create function sum_double as '/tmp/sum_double.so' outputtype bigint bufsize 128") - # tdSql.execute("select sum_double(id) from st") - # tdSql.checkRows(1) - - # UDF -> bug no 9: give bufsize for scalar_function add_one; - # UDF -> need improve : when outputtype is not match datatype which is defined in function codes - tdSql.execute("create function add_one as '/tmp/add_one.so' outputtype bigint bufsize 128") - # tdSql.error("select add_one(val) from st") # it should return error not [] for not match col datatype - # tdSql.query("select add_one(id) from st") # return error query result - # tdSql.checkData(0,0,1) - # tdSql.checkData(1,0,2) - # tdSql.checkData(5,0,1) - # tdSql.checkData(10,0,-2147483645) - # tdSql.checkData(13,0,None) + tdSql.execute("create function abs_max as '/tmp/abs_max.so' outputtype bigint bufsize 128") + tdSql.error("select abs_max(number) from st") + tdSql.execute("create function sum_double as '/tmp/sum_double.so' outputtype bigint bufsize 128") + tdSql.error("select sum_double(id) from st") # UDF -> improve : aggregate function with no bufsize : it seems with no affect - # tdSql.execute("drop function abs_max") - # tdSql.execute("drop function sum_double") + tdSql.execute("drop function abs_max") + tdSql.execute("drop function sum_double") tdSql.execute("create aggregate function abs_max as '/tmp/abs_max.so' outputtype bigint ") tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype int ") tdSql.query("select sum_double(id) from st") tdSql.checkData(0,0,44) tdSql.query("select sum_double(id) from tb1") tdSql.checkData(0,0,20) - # tdSql.query("select abs_max(number) from st") - # tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from st") + tdSql.checkData(0,0,9223372036854775807) tdSql.query("select abs_max(number) from tb1") tdSql.checkData(0,0,400) - - #UDF bug no 10 -> create function datatype of outputtype not match col datatype - tdSql.execute("drop function abs_max") - tdSql.execute("drop function sum_double") - tdSql.execute("drop function add_one") - tdSql.execute("create function add_one as '/tmp/add_one.so' outputtype bigint;") - tdSql.execute("create aggregate function abs_max as '/tmp/abs_max.so' outputtype int bufsize 128;") - tdSql.execute("create aggregate function sum_double as '/tmp/sum_double.so' outputtype double bufsize 128;") - # tdSql.query("select sum_double(id) from st") this bug will return 0.000000 - # tdSql.checkData(0,0,44) - # tdSql.query("select sum_double(id) from tb1") - # tdSql.checkData(0,0,20) this bug will return 0.000000 - # tdSql.query("select add_one(id) from st") this bug will return series error values - # tdSql.checkData(0,0,1) - # tdSql.checkData(1,0,2) - # tdSql.checkData(5,0,1) - # tdSql.checkData(10,0,-2147483645) - # tdSql.checkData(13,0,None) - # tdSql.query("select add_one(id) from tb1") this bug will return series error values - # tdSql.checkData(0,0,1) - # tdSql.checkData(2,0,3) - # tdSql.query("select abs_max(id) from st") - # tdSql.checkData(0,0,9223372036854775807) + tdSql.query("select abs_max(number) from tb1") # it seems work well tdSql.checkData(0,0,400) + # UDF scalar function not support group by + tdSql.error("select add_one(id) from st group by tbname") - # UDF bug no 11 -> follow test case will coredump for taosd and let data lost - # tdSql.query("select add_one(id) from st group by tbname") - - # UDF -> bug no 12: give aggregate for scalar_function add_one ,it will let taosd coredump as data lost - # tdSql.execute("drop function add_one") - # tdSql.execute("create aggregate function add_one as '/tmp/add_one.so' outputtype bigint bufsize 128") - # tdSql.query("select add_one(id) from st") - - # UDF bug no 13 -> follow test case will coredump for taosc - # tdSql.query("select add_one(*) from st ") - # tdSql.query("select add_one(*) from tb1 ") - - # UDF bug no 14 -> follow test case will coredump for taosc - # tdSql.query("select abs_max(id),abs_max(number) from st ") - # tdSql.query("select abs_max(number),abs_max(number) from st ") - # tdSql.query("select sum_double(id),sum_double(id) from st ") + # UDF : give aggregate for scalar_function add_one ,it can't work well + tdSql.execute("drop function add_one") + tdSql.execute("create aggregate function add_one as '/tmp/add_one.so' outputtype bigint bufsize 128") + tdSql.error("select add_one(id) from st") + + # udf must give col list + tdSql.error("select add_one(*) from st ") + tdSql.error("select add_one(*) from tb1 ") + + # one udf function can multi use + tdSql.query("select abs_max(id),abs_max(number) from st ") + tdSql.query("select abs_max(number),abs_max(number)*3 from st ") + tdSql.query("select abs_max(number),abs_max(number)*3 from tb1 ") + tdSql.query("select sum_double(id),sum_double(id) from st ") def run(self): tdSql.prepare() @@ -366,4 +611,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/stable/insert.py b/tests/pytest/stable/insert.py index ef5635c77ce04ddd33354e1754dc70b2c9f8b6a5..f46a6bcf4a0becf6cbee54281a9b3ecc862d63ce 100644 --- a/tests/pytest/stable/insert.py +++ b/tests/pytest/stable/insert.py @@ -91,6 +91,12 @@ class TDTestCase: tdSql.query("show stables") tdSql.checkRows(1) + # TS-646 + tdLog.info("test case for TS-646") + tdSql.execute("drop stable if exists db.st") + tdSql.execute("create table stb(ts timestamp, c1 int) tags(t1 int)") + tdSql.error("create table `` using stb tags(1)") + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/table/create.py b/tests/pytest/table/create.py index ec9179c5e97356f284b8d11ed006c12518142328..c431e2f6437786b0a9b787428659f029a41fa779 100644 --- a/tests/pytest/table/create.py +++ b/tests/pytest/table/create.py @@ -178,6 +178,8 @@ class TDTestCase: tdSql.checkRows(1) self.tb193new = "table_193~!@#$%^&*()-_+=[]{}':,<.>/?stST0123456789table_192~!@#$%^&*()-_+=[]{}':,<.>/?stST0123456789table_192~!@#$%^&*()-_+=[]{}':,<.>/?stST0123456789table_192~!@#$%^&*()-_+=[]{}':,<.>/?stST123" tdSql.error("create table db.`%s` using db.`%s` tags(1)" %(self.tb193new,self.stb1)) + # case for TD-10691 + tdSql.error("create table ttb1(ts timestamp, file int )") diff --git a/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json b/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json index 0068a9c30463ff39d49cbd14d15b5d84747d0a59..d73719ebe41c5f25fc2cd585bc9974d9e83a946e 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json @@ -35,7 +35,7 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 1000, + "childtable_count": 11, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 1, @@ -61,7 +61,7 @@ { "name": "stb1", "child_table_exists":"no", - "childtable_count": 1000, + "childtable_count": 10, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 10, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-default.json b/tests/pytest/tools/taosdemoAllTest/insert-default.json new file mode 100644 index 0000000000000000000000000000000000000000..423f94819f6302a50835a74e7eb5bb06fbf58c94 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-default.json @@ -0,0 +1,16 @@ +{ + "filetype": "insert", + "databases": [{ + "dbinfo": { + "name": "db" + }, + "super_tables": [{ + "name": "stb0", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "insert_rows": 123, + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/queryQps.json b/tests/pytest/tools/taosdemoAllTest/queryQps.json index 7ebad5e2b2f5af687656c8eed041579d7de1e2c2..c2ff21ea911f09bd459648a57a7ce4609f8bfb58 100644 --- a/tests/pytest/tools/taosdemoAllTest/queryQps.json +++ b/tests/pytest/tools/taosdemoAllTest/queryQps.json @@ -17,7 +17,7 @@ "result": "./query_res0.txt" }, { - "sql": "select last_row(*) from stb00_99 ", + "sql": "select last_row(*) from stb00_9 ", "result": "./query_res1.txt" }] diff --git a/tests/pytest/tools/taosdemoAllTest/sml/1174-large-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/1174-large-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..741a9f814b8a61c692343621c3dcc1117544fbed --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/1174-large-sml.json @@ -0,0 +1,46 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "192.168.1.103", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 1, + "result_file": "1174.out", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 51, + "databases": [ + { + "dbinfo": { + "name": "gdse", + "drop": "yes", + "keep": 36500 + }, + "super_tables": [{ + "name": "model_1174", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "model_1174_", + "auto_create_table": "no", + "batch_create_tbl_num": 0, + "data_source": "sample", + "insert_mode": "sml", + "insert_rate": 0, + "insert_rows": 2592000, + "interlace_rows": 1, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-05-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "tools/taosdemoAllTest/1174.csv", + "tags_file": "tools/taosdemoAllTest/1174-tag.csv", + "columns": [{"type": "FLOAT", "count": 109}, {"type": "INT", "count": 4}, {"type": "FLOAT", "count": 8}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 5}, {"type": "INT", "count": 47}, {"type": "BOOL", "count": 103}, {"type": "INT", "count": 2}, {"type": "TIMESTAMP", "count": 3}, {"type": "BOOL", "count": 28}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 6}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 7}, {"type": "BOOL", "count": 7}, {"type": "FLOAT", "count": 2}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 3}, {"type": "INT", "count": 3}, {"type": "BOOL", "count": 1}], + "tags": [{"type": "INT", "count": 1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/1174-large-taosc.json b/tests/pytest/tools/taosdemoAllTest/sml/1174-large-taosc.json new file mode 100644 index 0000000000000000000000000000000000000000..bb21003e9340b91496b8f96014aa7b318bb44895 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/1174-large-taosc.json @@ -0,0 +1,46 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "192.168.1.103", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 1, + "result_file": "1174.out", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 51, + "databases": [ + { + "dbinfo": { + "name": "gdse", + "drop": "yes", + "keep": 36500 + }, + "super_tables": [{ + "name": "model_1174", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "model_1174_", + "auto_create_table": "no", + "batch_create_tbl_num": 0, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rate": 0, + "insert_rows": 2592000, + "interlace_rows": 1, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-05-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "tools/taosdemoAllTest/1174.csv", + "tags_file": "tools/taosdemoAllTest/1174-tag.csv", + "columns": [{"type": "FLOAT", "count": 109}, {"type": "INT", "count": 4}, {"type": "FLOAT", "count": 8}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 5}, {"type": "INT", "count": 47}, {"type": "BOOL", "count": 103}, {"type": "INT", "count": 2}, {"type": "TIMESTAMP", "count": 3}, {"type": "BOOL", "count": 28}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 6}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 7}, {"type": "BOOL", "count": 7}, {"type": "FLOAT", "count": 2}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 3}, {"type": "INT", "count": 3}, {"type": "BOOL", "count": 1}], + "tags": [{"type": "INT", "count": 1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/1174-small-sml-random.json b/tests/pytest/tools/taosdemoAllTest/sml/1174-small-sml-random.json new file mode 100644 index 0000000000000000000000000000000000000000..615baad853987220ea2c76663327a2a783b4cdb4 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/1174-small-sml-random.json @@ -0,0 +1,46 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "192.168.1.103", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 1, + "result_file": "1174.out", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 51, + "databases": [ + { + "dbinfo": { + "name": "gdse", + "drop": "yes", + "keep": 36500 + }, + "super_tables": [{ + "name": "model_1174", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "model_1174_", + "auto_create_table": "no", + "batch_create_tbl_num": 0, + "data_source": "rand", + "insert_mode": "sml", + "insert_rate": 0, + "insert_rows": 259200, + "interlace_rows": 1, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-05-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "tools/taosdemoAllTest/1174.csv", + "tags_file": "tools/taosdemoAllTest/1174-tag.csv", + "columns": [{"type": "FLOAT", "count": 109}, {"type": "INT", "count": 4}, {"type": "FLOAT", "count": 8}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 5}, {"type": "INT", "count": 47}, {"type": "BOOL", "count": 103}, {"type": "INT", "count": 2}, {"type": "TIMESTAMP", "count": 3}, {"type": "BOOL", "count": 28}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 6}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 7}, {"type": "BOOL", "count": 7}, {"type": "FLOAT", "count": 2}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 3}, {"type": "INT", "count": 3}, {"type": "BOOL", "count": 1}], + "tags": [{"type": "INT", "count": 1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/1174-small-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/1174-small-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..be7c182d0ebdfd377bff4a020c63a03333160b39 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/1174-small-sml.json @@ -0,0 +1,46 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "192.168.1.103", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 1, + "result_file": "1174.out", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 51, + "databases": [ + { + "dbinfo": { + "name": "gdse", + "drop": "yes", + "keep": 36500 + }, + "super_tables": [{ + "name": "model_1174", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "model_1174_", + "auto_create_table": "no", + "batch_create_tbl_num": 0, + "data_source": "sample", + "insert_mode": "sml", + "insert_rate": 0, + "insert_rows": 259200, + "interlace_rows": 1, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-05-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "tools/taosdemoAllTest/1174.csv", + "tags_file": "tools/taosdemoAllTest/1174-tag.csv", + "columns": [{"type": "FLOAT", "count": 109}, {"type": "INT", "count": 4}, {"type": "FLOAT", "count": 8}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 5}, {"type": "INT", "count": 47}, {"type": "BOOL", "count": 103}, {"type": "INT", "count": 2}, {"type": "TIMESTAMP", "count": 3}, {"type": "BOOL", "count": 28}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 6}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 7}, {"type": "BOOL", "count": 7}, {"type": "FLOAT", "count": 2}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 3}, {"type": "INT", "count": 3}, {"type": "BOOL", "count": 1}], + "tags": [{"type": "INT", "count": 1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/1174-small-taosc.json b/tests/pytest/tools/taosdemoAllTest/sml/1174-small-taosc.json new file mode 100644 index 0000000000000000000000000000000000000000..f74ac693a90f48ce8cf0fceca61723861631d37a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/1174-small-taosc.json @@ -0,0 +1,46 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "192.168.1.103", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 1, + "result_file": "1174.out", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 51, + "databases": [ + { + "dbinfo": { + "name": "gdse", + "drop": "yes", + "keep": 36500 + }, + "super_tables": [{ + "name": "model_1174", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "model_1174_", + "auto_create_table": "no", + "batch_create_tbl_num": 0, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rate": 0, + "insert_rows": 259200, + "interlace_rows": 1, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-05-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "tools/taosdemoAllTest/1174.csv", + "tags_file": "tools/taosdemoAllTest/1174-tag.csv", + "columns": [{"type": "FLOAT", "count": 109}, {"type": "INT", "count": 4}, {"type": "FLOAT", "count": 8}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 5}, {"type": "INT", "count": 47}, {"type": "BOOL", "count": 103}, {"type": "INT", "count": 2}, {"type": "TIMESTAMP", "count": 3}, {"type": "BOOL", "count": 28}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 6}, {"type": "INT", "count": 1}, {"type": "FLOAT", "count": 7}, {"type": "BOOL", "count": 7}, {"type": "FLOAT", "count": 2}, {"type": "INT", "count": 3}, {"type": "FLOAT", "count": 3}, {"type": "INT", "count": 3}, {"type": "BOOL", "count": 1}], + "tags": [{"type": "INT", "count": 1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-1s1tnt1r-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-1s1tnt1r-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..5cd06c02759ddcba93eaa8ef4ef848a9b645cbda --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-1s1tnt1r-sml.json @@ -0,0 +1,142 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows": 100, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-1s1tntmr-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-1s1tntmr-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..0885e01782b41079ccbfb7a30a8b4d3628ba9c20 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-1s1tntmr-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 150, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 15, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..5be20c28bba11ff40296d062f93ab4fda57a1f88 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "TIMESTAMP"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-disorder-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-disorder-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..6f24801cb04f9f515e33898fb587b95029def325 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-disorder-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 10, + "disorder_range": 100, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 100, + "disorder_range": 1, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-drop-exist-auto-N00-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-drop-exist-auto-N00-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..92e6ec0df7a70329312676298c3b5ffccc2a8767 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-drop-exist-auto-N00-sml.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-drop-exist-auto-Y00-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-drop-exist-auto-Y00-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..c09493ec7b892baba37a7be4addb0ce526752f07 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-drop-exist-auto-Y00-sml.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-interlace-row-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-interlace-row-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..e04f2ff5e7cb24cb5384b7451712b3fe83bf18c3 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-interlace-row-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 150, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 151, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-interval-speed-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-interval-speed-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..4a4227adb8fdcd0cb025a10c5b6f417c921acd96 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-interval-speed-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 100, + "interlace_rows": 0, + "num_of_records_per_req": 2000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 35, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "insert_interval": 200, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-newdb-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-newdb-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..1d29842e02c654987c50e6e73d4aec5eed48aa83 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-newdb-sml.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-newtable-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-newtable-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..886503a950ca18b752bfa264218bb8564ce44ae0 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-newtable-sml.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 30, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-nodbnodrop-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-nodbnodrop-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..ca99d135c5f466c911f3063b88fbb3e58c4e4ed4 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-nodbnodrop-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbno", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-offset-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-offset-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..d0109b50cf449b0e7e1b258ae29723a560b1d2f6 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-offset-sml.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"yes", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"yes", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"yes", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset":7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"yes", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-renewdb-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-renewdb-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..f8f3a8ee5cea1834c31ebb275a10977cd960f829 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-renewdb-sml.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sample-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sample-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..780fd60bb7e98f18a5c33798b6bb35a77e1d85db --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sample-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbtest123", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "./tools/taosdemoAllTest/tags.csv", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json new file mode 100644 index 0000000000000000000000000000000000000000..2de298efa6553ec0c6de095ee0515a73e777445f --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json @@ -0,0 +1,270 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT", "count":1}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 4, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 5, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BIGINT"}], + "tags": [{"type": "BIGINT", "count":1}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "SMALLINT"}], + "tags": [{"type": "SMALLINT", "count":1}] + }, + { + "name": "stb5", + "child_table_exists":"no", + "childtable_count": 40, + "childtable_prefix": "stb05_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "FLOAT"}], + "tags": [{"type": "FLOAT", "count":1}] + }, + { + "name": "stb6", + "child_table_exists":"no", + "childtable_count": 15, + "childtable_prefix": "stb06_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "DOUBLE", "count":1}] + }, + { + "name": "stb7", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb07_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "BOOL"}], + "tags": [{"type": "BOOL", "count":1}] + }, + { + "name": "stb8", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb08_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "NCHAR","len": 16, "count":1}], + "tags": [{"type": "NCHAR", "count":1}] + }, + { + "name": "stb9", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb09_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16, "count":1}], + "tags": [{"type": "BINARY", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json new file mode 100644 index 0000000000000000000000000000000000000000..ff825440e5cbfd8aa5d8d6e74538c5802af8af38 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json @@ -0,0 +1,374 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UINT"}], + "tags": [{"type": "UINT", "count":1}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 4, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 5, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BIGINT"}], + "tags": [{"type": "BIGINT", "count":1}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":30, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "SMALLINT"}], + "tags": [{"type": "SMALLINT", "count":1}] + }, + { + "name": "stb5", + "child_table_exists":"no", + "childtable_count": 15, + "childtable_prefix": "stb05_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":20, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "FLOAT"}], + "tags": [{"type": "FLOAT", "count":1}] + }, + { + "name": "stb6", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb06_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":10, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "DOUBLE", "count":1}] + }, + { + "name": "stb7", + "child_table_exists":"no", + "childtable_count": 30, + "childtable_prefix": "stb07_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":5, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "BOOL"}], + "tags": [{"type": "BOOL", "count":1}] + }, + { + "name": "stb8", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb08_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":30, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "NCHAR","len": 16, "count":1}], + "tags": [{"type": "NCHAR", "count":1}] + }, + { + "name": "stb9", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb09_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16, "count":1}], + "tags": [{"type": "BINARY", "count":1}] + }, + { + "name": "stb10", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb10_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UBIGINT"}], + "tags": [{"type": "UBIGINT", "count":1}] + }, + { + "name": "stb11", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb11_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UTINYINT"}], + "tags": [{"type": "UTINYINT", "count":1}] + }, + { + "name": "stb12", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "USMALLINT"}], + "tags": [{"type": "USMALLINT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-timestep-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-timestep-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..1d496b6b46bf3df3c4312bacafbfb77125491058 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-timestep-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..83689d6c40e3844707cc367431f37f4f8ec144d5 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16374, "count":1}], + "tags": [{"type": "TINYINT", "count":12}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16370, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertChildTab0-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertChildTab0-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..28f566833fc8958d364ee867c7628d573b4bf8ee --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertChildTab0-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 0, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..8f27feba6be7e3018461b0070420cc759cf8fc72 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": -1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..2e4063cf272ba18732f0e456362cb1103ba6d5c4 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 1000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsAndTagNumLarge4096-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsAndTagNumLarge4096-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..c6fe0300f535a2b9d798b09853f0ad333e3bbcfd --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsAndTagNumLarge4096-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10000, + "num_of_records_per_req": 10000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1005}, {"type": "BINARY", "len": 16, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..92e88141ca09971d0d202ee488471c14e07d4cd3 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 100, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":0}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..18f1a39e0afcdae3d52e4bc4a4a97e15dbcfda37 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 1000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml-telnet.json b/tests/pytest/tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml-telnet.json new file mode 100644 index 0000000000000000000000000000000000000000..01ec546012ad04f94cfb6224048fffd89d5cbbc8 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml-telnet.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..d950a260f6ed3ad4a9ed53bc859304a71e5a680a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..0deed5ba5420a1dd9a1efddbb6e1e7a757dc10d0 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 0, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertNumOfrecordPerReqless0-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertNumOfrecordPerReqless0-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..9d1d1ee71898d5e80a7310822da00de6c4636746 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertNumOfrecordPerReqless0-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": -1, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertSigcolumnsNum4096-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertSigcolumnsNum4096-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..f732d2e0c5575740dc3d1eeade05e09de8860faf --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertSigcolumnsNum4096-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 100, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "DOUBLE", "count":4096}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertTagsNumLarge128-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertTagsNumLarge128-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..24f468d719546733b900ecbd283f2904e96d222f --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertTagsNumLarge128-sml.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000000, + "max_sql_len": 1024000000, + "databases": [{ + "dbinfo": { + "name": "db1", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 10000, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BIGINT", "count":1}, {"type": "float", "count":1}, {"type": "double", "count":1}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":127}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..07e625dad3a28929a63475aa18310ff6d5b24cc6 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json @@ -0,0 +1,65 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "databases": [ + { + "dbinfo": { + "name": "blf", + "drop": "yes" + }, + "super_tables": [ + { + "name": "p_0_topics", + "child_table_exists": "no", + "childtable_count": 10, + "childtable_prefix": "p_0_topics_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 525600, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 60000, + "start_timestamp": "2019-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "FLOAT", + "count": 1 + }, + { + "type": "BINARY", + "len": 12, + "count": 1 + } + ], + "tags": [ + { + "type": "BINARY", + "len": 12, + "count": 10 + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 0e68e2e88078d3239ceba8d88200e7ea5b1cffe4..1ab67e721774200f238b81c2fc6bd88564a0b3f6 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -48,21 +48,25 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert*_res.txt*") + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + # insert: create one or mutiple tables per sql and insert multiple rows per sql os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") - tdSql.checkData(0, 0, 1000) + tdSql.checkData(0, 0, 11) tdSql.query("select count (tbname) from stb1") - tdSql.checkData(0, 0, 1000) + tdSql.checkData(0, 0, 10) tdSql.query("select count(*) from stb00_0") tdSql.checkData(0, 0, 100) tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 100000) + tdSql.checkData(0, 0, 1100) tdSql.query("select count(*) from stb01_1") tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 200000) + tdSql.checkData(0, 0, 2000) # restful connector insert data os.system("%staosdemo -f tools/taosdemoAllTest/insertRestful.json -y " % binPath) @@ -80,7 +84,17 @@ 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("%staosdemo -f tools/taosdemoAllTest/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') + # insert: create mutiple tables per sql and insert one rows per sql . os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath) tdSql.execute("use db") @@ -339,9 +353,10 @@ class TDTestCase: tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes tdSql.checkRows(20) - testcaseFilename = os.path.split(__file__)[-1] - os.system("rm -rf ./insert_res.txt") - os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + # rm useless files + os.system("rm -rf ./insert*_res.txt*") + + diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py new file mode 100644 index 0000000000000000000000000000000000000000..af5006bb2333bbc9d8fba4a93ebcab3f5bb13257 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py @@ -0,0 +1,264 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + # insert: create one or mutiple tables per sql and insert multiple rows per sql + # line_protocol——telnet and json + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-1s1tnt1r-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(*) from stb01_1") + tdSql.checkData(0, 0, 200) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 4000) + + + # insert: create mutiple tables per sql and insert one rows per sql . + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-1s1tntmr-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 15) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 150) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 1500) + tdSql.query("select count(*) from stb01_0") + tdSql.checkData(0, 0, 200) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 3000) + + # insert: using parament "insert_interval to controls spped of insert. + # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select tbname from stb0") + tdSql.checkRows(100 ) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 20) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 2000) + tdSql.query("show stables") + tdSql.checkData(1, 4, 20) + tdSql.query("select count(*) from stb01_0") + tdSql.checkData(0, 0, 35) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 700) + + # spend 2min30s for 3 testcases. + # insert: drop and child_table_exists combination test + # insert: sml can't support parament "childtable_offset and childtable_limit" \ drop=no or child_table_exists = yes + + # os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-nodbnodrop-sml.json -y" % binPath) + # tdSql.error("show dbno.stables") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-newdb-sml.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 5) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 6) + tdSql.query("select count (tbname) from stb2") + tdSql.checkData(0, 0, 7) + tdSql.query("select count (tbname) from stb3") + tdSql.checkData(0, 0, 8) + tdSql.query("select count (tbname) from stb4") + tdSql.checkData(0, 0, 8) + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-renewdb-sml.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 50) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 120) + tdSql.query("select count(*) from stb2") + tdSql.checkData(0, 0, 140) + tdSql.query("select count(*) from stb3") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from stb4") + tdSql.checkData(0, 0, 160) + + + # insert: let parament in json file is illegal, it'll expect error. + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertColumnsAndTagNumLarge4096-sml.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertSigcolumnsNum4096-sml.json -y " % binPath) + tdSql.error("select * from db.stb0") + # tdSql.execute("drop database if exists db") + # os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath) + # tdSql.query("select count(*) from db.stb0") + # tdSql.checkData(0, 0, 10000) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath) + tdSql.query("select count(*) from db.stb0") + tdSql.checkRows(0) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("show stables like 'stb0%' ") + tdSql.checkData(0, 2, 11) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertTagsNumLarge128-sml.json -y " % binPath) + tdSql.error("use db1") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json -y " % binPath) + tdSql.query("select count(*) from db.stb0") + tdSql.checkRows(1) + tdSql.query("select count(*) from db.stb1") + tdSql.checkRows(1) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.query("select count(*) from db.stb3") + tdSql.checkRows(1) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json -y " % binPath) + tdSql.error("select count(*) from db.stb0") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReqless0-sml.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertChildTab0-sml.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists blf") + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath) + tdSql.execute("use blf") + tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") + tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") + tdSql.query("select first(ts) from blf.p_0_topics_2") + tdSql.checkData(0, 0, "2019-10-01 00:00:00") + tdSql.query("select last(ts) from blf.p_0_topics_6 ") + tdSql.checkData(0, 0, "2020-09-29 23:59:00") + # it will be commented in ci because it spend too much time to insert data, but when you can excute it when you want to test this case. + # os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json -y " % binPath) + # tdSql.execute("use db") + # tdSql.query("select count(*) from stb0") + # tdSql.checkData(0, 0, 5000000) + # tdSql.query("select count(*) from stb1") + # tdSql.checkData(0, 0, 5000000) + # os.system("%staosdemo -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml-telnet.json -y " % binPath) + # tdSql.execute("use db") + # tdSql.query("select count(*) from stb0") + # tdSql.checkData(0, 0, 5000000) + # tdSql.query("select count(*) from stb1") + # tdSql.checkData(0, 0, 5000000) + + + # insert: timestamp and step + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-timestep-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + tdSql.query("select last(ts) from db.stb00_0") + tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 200) + tdSql.query("select last(ts) from db.stb01_0") + tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 400) + + # # insert: disorder_ratio + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-disorder-sml.json 2>&1 -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 1) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 10) + + # insert: sample json + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath) + tdSql.execute("use dbtest123") + tdSql.query("select c2 from stb0") + tdSql.checkData(0, 0, 2147483647) + tdSql.query("select * from stb1 where t1=-127") + tdSql.checkRows(20) + tdSql.query("select * from stb1 where t2=127") + tdSql.checkRows(10) + tdSql.query("select * from stb1 where t2=126") + tdSql.checkRows(10) + + # insert: test interlace parament + os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-interlace-row-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count (*) from stb0") + tdSql.checkData(0, 0, 15000) + + + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py index 3a3152ecde3c4eca09d8b8583cf90bbfdc0cc31d..4025e023809d773d750314c8fa635be664b2ff76 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py @@ -52,8 +52,8 @@ class TDTestCase: self.expectResult = expectResult with open("%s" % filename, 'r+') as f1: for line in f1.readlines(): - queryResult = line.strip().split()[0] - self.assertCheck(filename, queryResult, expectResult) + queryResultTaosc = line.strip().split()[0] + self.assertCheck(filename, queryResultTaosc, expectResult) # 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。 def getfileDataRestful(self, filename): @@ -65,9 +65,12 @@ class TDTestCase: pattern = re.compile("{.*}") contents = pattern.search(contents).group() contentsDict = ast.literal_eval(contents) # 字符串转换为字典 - queryResult = contentsDict['data'][0][0] + queryResultRest = contentsDict['data'][0][0] break - return queryResult + else : + queryResultRest = "" + return queryResultRest + # 获取taosc接口查询次数 def queryTimesTaosc(self, filename): @@ -185,9 +188,10 @@ class TDTestCase: os.system( "%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath) - os.system( + exceptcode = os.system( "%staosdemo -f tools/taosdemoAllTest/queryQps.json" % binPath) + assert exceptcode == 0 # use illegal or out of range parameters query json file os.system( @@ -228,7 +232,7 @@ class TDTestCase: os.system("rm -rf tools/taosdemoAllTest/*.py.sql") os.system("rm -rf ./querySystemInfo*") os.system("rm -rf ./query_res*") -# os.system("rm -rf ./all_query*") + os.system("rm -rf ./all_query*") os.system("rm -rf ./test_query_res0.txt") def stop(self): diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c index e1db54e291ac6e02715a80ee852e5d78dc672a87..2cbee8eac91719a4cbff4d9c323f1f304e8e8684 100644 --- a/tests/script/api/batchprepare.c +++ b/tests/script/api/batchprepare.c @@ -1765,7 +1765,7 @@ int stmt_funcb_autoctb_e1(TAOS_STMT *stmt) { int code = taos_stmt_prepare(stmt, sql, 0); if (code != 0){ printf("failed to execute taos_stmt_prepare. error:%s\n", taos_stmt_errstr(stmt)); - return -1; + exit(1); } int id = 0; @@ -1801,9 +1801,44 @@ int stmt_funcb_autoctb_e1(TAOS_STMT *stmt) { return 0; } +int stmt_multi_insert_check(TAOS_STMT *stmt) { + char *sql; + // The number of tag column list is not equal to the number of tag value list + sql = "insert into ? using stb1 (id1) tags(1,?) values(?,?,?,?,?,?,?,?,?,?)"; + if (0 == taos_stmt_prepare(stmt, sql, 0)) { + printf("failed to check taos_stmt_prepare. sql:%s\n", sql); + exit(1); + } + + // The number of column list is not equal to the number of value list + sql = "insert into ? using stb1 tags(1,?,2,?,4,?,6.0,?,'b') " + "(ts, b, v1, v2, v4, v8, f4, f8, bin) values(?,?,?,?,?,?,?,?,?,?)"; + if (0 == taos_stmt_prepare(stmt, sql, 0)) { + printf("failed to check taos_stmt_prepare. sql:%s\n", sql); + exit(1); + } + + sql = "insert into ? using stb1 () tags(1,?) values(?,?,?,?,?,?,?,?,?,?)"; + if (0 == taos_stmt_prepare(stmt, sql, 0)) { + printf("failed to check taos_stmt_prepare. sql:%s\n", sql); + exit(1); + } + + sql = "insert into ? using stb1 ( tags(1,?) values(?,?,?,?,?,?,?,?,?,?)"; + if (0 == taos_stmt_prepare(stmt, sql, 0)) { + printf("failed to check taos_stmt_prepare. sql:%s\n", sql); + exit(1); + } + sql = "insert into ? using stb1 ) tags(1,?) values(?,?,?,?,?,?,?,?,?,?)"; + if (0 == taos_stmt_prepare(stmt, sql, 0)) { + printf("failed to check taos_stmt_prepare. sql:%s\n", sql); + exit(1); + } + return 0; +} //1 tables 10 records int stmt_funcb_autoctb_e2(TAOS_STMT *stmt) { @@ -4509,7 +4544,6 @@ void* runcase(void *par) { (void)idx; - #if 1 prepare(taos, 1, 1); @@ -4823,6 +4857,16 @@ void* runcase(void *par) { #endif +#if 1 + prepare(taos, 1, 0); + + stmt = taos_stmt_init(taos); + + printf("stmt_multi_insert_check start\n"); + stmt_multi_insert_check(stmt); + printf("stmt_multi_insert_check end\n"); + taos_stmt_close(stmt); +#endif #if 1 prepare(taos, 1, 1); @@ -5011,7 +5055,6 @@ void* runcase(void *par) { printf("check result end\n"); #endif - #if 1 preparem(taos, 0, idx); diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index ebc054777940430e9cdb78b55b496dda873f2143..a5d8216de1d537843bef42fbf3752a45e899b5c3 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -38,6 +38,7 @@ run general/compute/stddev.sim run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim +run general/compute/table_group.sim run general/db/alter_option.sim run general/db/alter_tables_d2.sim run general/db/alter_tables_v1.sim @@ -130,7 +131,7 @@ run general/parser/limit2.sim run general/parser/slimit.sim run general/parser/fill.sim run general/parser/fill_stb.sim -run general/parser/interp.sim +run general/parser/interp_full.sim run general/parser/where.sim run general/parser/join.sim run general/parser/join_multivnode.sim diff --git a/tests/script/general/compute/table_group.sim b/tests/script/general/compute/table_group.sim new file mode 100644 index 0000000000000000000000000000000000000000..cbce7963c3ede6688a2a6d1d0934fa6dfbc7f25b --- /dev/null +++ b/tests/script/general/compute/table_group.sim @@ -0,0 +1,2485 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c minRows -v 10 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +$db = m_db_tbg_limit +$tb = ct +$mt = st + +sql drop database $db -x step1 +step1: +sql create database $db +sql use $db +sql create table $mt ( ts timestamp, f1 int, f2 int ) tags(t int) + +$tb1 = ct1 +$tb2 = ct2 +$tb3 = ct3 +$tbnum = 3 +$rownum = 10 + +$x = 0 +while $x < $rownum + $i = 1 + while $i <= $tbnum + $tbi = $tb . $i + $inc = $x * 60 + $inc1 = $inc + $i + $ms = 1601481600000 + $inc1 + $v1 = $x * 10 + $v = $v1 + $i + sql insert into $tbi using $mt tags( $i ) values ( $ms , $v , $v ) + $i = $i + 1 + endw + $x = $x + 1 +endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect +sql use $db + +$x = 0 +while $x < $rownum + $i = 1 + while $i <= $tbnum + $tbi = $tb . $i + $inc = $x * 60 + $inc1 = $inc + $i + $ms = 1601481700000 + $inc1 + $v1 = $x * 10 + $temp = $rownum * 10 + $v1 = $v1 + $temp + $v = $v1 + $i + sql insert into $tbi using $mt tags( $i ) values ( $ms , $v , $v ) + $i = $i + 1 + endw + $x = $x + 1 +endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +sql connect +sql use $db + +print execute sql select csum(f1) from st group by tbname + +sql select csum(f1) from st group by tbname + +if $rows != 60 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data21 != @33@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data31 != @64@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data41 != @105@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data51 != @156@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data61 != @217@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data71 != @288@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data81 != @369@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data91 != @460@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select diff(f1) from st group by tbname + +sql select diff(f1) from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @10@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @10@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @10@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @10@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0) from st group by tbname + +sql select derivative(f1, 1s, 0) from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @166.666666667@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @166.666666667@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @166.666666667@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @0.100542932@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select mavg(f1,2) from st group by tbname + +sql select mavg(f1,2) from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @26.000000000@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @36.000000000@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @46.000000000@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @56.000000000@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @66.000000000@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @76.000000000@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @86.000000000@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @96.000000000@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select csum(f1),t from st group by tbname + +sql select csum(f1),t from st group by tbname + +if $rows != 60 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data21 != @33@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data31 != @64@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data41 != @105@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data51 != @156@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data61 != @217@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data71 != @288@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data81 != @369@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data91 != @460@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select diff(f1),t from st group by tbname + +sql select diff(f1),t from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @10@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @10@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @10@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @10@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t from st group by tbname + +sql select derivative(f1, 1s, 0),t from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @166.666666667@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @166.666666667@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @166.666666667@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @0.100542932@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select mavg(f1,2),t from st group by tbname + +sql select mavg(f1,2),t from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @26.000000000@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @36.000000000@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @46.000000000@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @56.000000000@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @66.000000000@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @76.000000000@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @86.000000000@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @96.000000000@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select csum(f1) from st group by tbname limit 2 + +sql select csum(f1) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.002@ then + return -1 +endi +if $data21 != @2@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data31 != @14@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.003@ then + return -1 +endi +if $data41 != @3@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data51 != @16@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select diff(f1) from st group by tbname limit 2 + +sql select diff(f1) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0) from st group by tbname limit 2 + +sql select derivative(f1, 1s, 0) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2) from st group by tbname limit 2 + +sql select mavg(f1,2) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @7.000000000@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @17.000000000@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @8.000000000@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @18.000000000@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select csum(f1),t from st group by tbname limit 2 + +sql select csum(f1),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.002@ then + return -1 +endi +if $data21 != @2@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data31 != @14@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.003@ then + return -1 +endi +if $data41 != @3@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data51 != @16@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select diff(f1),t from st group by tbname limit 2 + +sql select diff(f1),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 + +sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2),t from st group by tbname limit 2 + +sql select mavg(f1,2),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @7.000000000@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @17.000000000@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @8.000000000@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @18.000000000@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select csum(f1) from st group by tbname limit 2 offset 9 + +sql select csum(f1) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data01 != @460@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data11 != @561@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.542@ then + return -1 +endi +if $data21 != @470@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data31 != @572@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.543@ then + return -1 +endi +if $data41 != @480@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data51 != @583@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select diff(f1) from st group by tbname limit 2 offset 9 + +sql select diff(f1) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0) from st group by tbname limit 2 offset 9 + +sql select derivative(f1, 1s, 0) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @0.100542932@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @0.100542932@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @0.100542932@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2) from st group by tbname limit 2 offset 9 + +sql select mavg(f1,2) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @96.000000000@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @106.000000000@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @97.000000000@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @107.000000000@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @98.000000000@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @108.000000000@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select csum(f1),t from st group by tbname limit 2 offset 9 + +sql select csum(f1),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data01 != @460@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data11 != @561@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.542@ then + return -1 +endi +if $data21 != @470@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data31 != @572@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.543@ then + return -1 +endi +if $data41 != @480@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data51 != @583@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select diff(f1),t from st group by tbname limit 2 offset 9 + +sql select diff(f1),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 offset 9 + +sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @0.100542932@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @0.100542932@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @0.100542932@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2),t from st group by tbname limit 2 offset 9 + +sql select mavg(f1,2),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @96.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @106.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @97.000000000@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @107.000000000@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @98.000000000@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @108.000000000@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select csum(f1),t,tbname from st group by tbname limit 2 offset 9 + +sql select csum(f1),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data01 != @460@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data11 != @561@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.542@ then + return -1 +endi +if $data21 != @470@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data31 != @572@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.543@ then + return -1 +endi +if $data41 != @480@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data51 != @583@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print execute sql select diff(f1),t,tbname from st group by tbname limit 2 offset 9 + +sql select diff(f1),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t,tbname from st group by tbname limit 2 offset 9 + +sql select derivative(f1, 1s, 0),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @0.100542932@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @0.100542932@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @0.100542932@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2),t,tbname from st group by tbname limit 2 offset 9 + +sql select mavg(f1,2),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @96.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @106.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @97.000000000@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @107.000000000@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @98.000000000@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @108.000000000@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print ================================ clear +#sql drop database $db +#sql show databases +#if $rows != 0 then +# return -1 +#endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT + diff --git a/tests/script/general/compute/testSuite.sim b/tests/script/general/compute/testSuite.sim index 25c93ed29339c326628b885c34ed8766299460aa..ceb6525c7f67ab6c06f80d527f90c00299fbbd6e 100644 --- a/tests/script/general/compute/testSuite.sim +++ b/tests/script/general/compute/testSuite.sim @@ -20,3 +20,4 @@ run general/compute/stddev.sim run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim +run general/compute/table_group.sim diff --git a/tests/script/general/parser/col_arithmetic_query.sim b/tests/script/general/parser/col_arithmetic_query.sim index 502de9583e9727d2dbee4a5601f974d6a46173ba..9b0dc8e964cf39909b803fe5ea20a7bdff8ceb59 100644 --- a/tests/script/general/parser/col_arithmetic_query.sim +++ b/tests/script/general/parser/col_arithmetic_query.sim @@ -561,19 +561,19 @@ endi sql_error select first(c6) - last(c6) *12 / count(*) from $stb group by c3; sql select first(c6) - last(c6) *12 / count(*) from $stb group by c5; -if $rows != 10 then +if $rows != 11 then return -1 endi -if $data00 != 0.000000000 then +if $data00 != -0.002160000 then return -1 endi -if $data10 != 0.997600000 then +if $data10 != 0.000000000 then return -1 endi -if $data90 != 8.978400000 then +if $data90 != 7.980800000 then return -1 endi diff --git a/tests/script/general/parser/interp.sim b/tests/script/general/parser/interp.sim deleted file mode 100644 index f192837bb7422046b0fbf05e66b2f2165d7e3c10..0000000000000000000000000000000000000000 --- a/tests/script/general/parser/interp.sim +++ /dev/null @@ -1,83 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/exec.sh -n dnode1 -s start -sleep 100 -sql connect - -$dbPrefix = intp_db -$tbPrefix = intp_tb -$stbPrefix = intp_stb -$tbNum = 4 -$rowNum = 10000 -$totalNum = $tbNum * $rowNum -$ts0 = 1537146000000 -$delta = 600000 -print ========== interp.sim -$i = 0 -$db = $dbPrefix . $i -$stb = $stbPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -print ====== create tables -sql use $db -sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) - -$i = 0 -$ts = $ts0 -$halfNum = $tbNum / 2 -while $i < $halfNum - $tbId = $i + $halfNum - $tb = $tbPrefix . $i - $tb1 = $tbPrefix . $tbId - sql create table $tb using $stb tags( $i ) - sql create table $tb1 using $stb tags( $tbId ) - - $x = 0 - while $x < $rowNum - $xs = $x * $delta - $ts = $ts0 + $xs - $c = $x / 10 - $c = $c * 10 - $c = $x - $c - $binary = 'binary . $c - $binary = $binary . ' - $nchar = 'nchar . $c - $nchar = $nchar . ' - sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) - $x = $x + 1 - endw - - $i = $i + 1 -endw -print ====== tables created - -sql create table ap1 (ts timestamp, pav float); -sql INSERT INTO ap1 VALUES ('2021-07-25 02:19:54.100',1) ('2021-07-25 02:19:54.200',2) ('2021-07-25 02:19:54.300',3) ('2021-07-25 02:19:56.500',4) ('2021-07-25 02:19:57.500',5) ('2021-07-25 02:19:57.600',6) ('2021-07-25 02:19:57.900',7) ('2021-07-25 02:19:58.100',8) ('2021-07-25 02:19:58.300',9) ('2021-07-25 02:19:59.100',10) ('2021-07-25 02:19:59.300',11) ('2021-07-25 02:19:59.500',12) ('2021-07-25 02:19:59.700',13) ('2021-07-25 02:19:59.900',14) ('2021-07-25 02:20:05.000', 20) ('2021-07-25 02:25:00.000', 10000); - -run general/parser/interp_test.sim - -print ================== restart server to commit data into disk -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 500 -system sh/exec.sh -n dnode1 -s start -print ================== server restart completed - -run general/parser/interp_test.sim - -print ================= TD-5931 -sql create stable st5931(ts timestamp, f int) tags(t int) -sql create table ct5931 using st5931 tags(1) -sql create table nt5931(ts timestamp, f int) -sql select interp(*) from nt5931 where ts=now -sql select interp(*) from st5931 where ts=now -sql select interp(*) from ct5931 where ts=now - -if $rows != 0 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/interp_full.sim b/tests/script/general/parser/interp_full.sim new file mode 100644 index 0000000000000000000000000000000000000000..530ce20604d045c5a7510da72b5122bb8c60411b --- /dev/null +++ b/tests/script/general/parser/interp_full.sim @@ -0,0 +1,153 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c minRows -v 10 +system sh/exec.sh -n dnode1 -s start +sleep 100 +sql connect + +sql create database db; +sql use db; +sql create stable stb1 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) +sql create table tb1 using stb1 tags(1,'1',1.0) +sql create table tb2 using stb1 tags(2,'2',2.0) +sql create table tb3 using stb1 tags(3,'3',3.0) +sql create table tb4 using stb1 tags(4,'4',4.0) + +sql insert into tb1 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb1 values ('2021-10-20 10:00:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb1 values ('2021-10-20 10:00:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb1 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb1 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb1 values ('2021-10-20 10:00:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb1 values ('2021-10-20 10:00:21',21,21.0,21,21,21,21.0,false,'21','21') + +sql insert into tb2 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb2 values ('2021-10-20 10:00:02',2,2.0,2,2,2,2.0,true ,'2','2') +sql insert into tb2 values ('2021-10-20 10:00:04',4,4.0,4,4,4,4.0,false,'4','4') +sql insert into tb2 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb2 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb2 values ('2021-10-20 10:00:12',12,12.0,12,12,12,12.0,true ,'12','12') +sql insert into tb2 values ('2021-10-20 10:00:14',14,14.0,14,14,14,14.0,false,'14','14') + +sql insert into tb3 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb3 values ('2021-10-20 10:00:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb3 values ('2021-10-20 10:00:02',2,2.0,2,2,2,2.0,false,'2','2') +sql insert into tb3 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb3 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb3 values ('2021-10-20 10:00:18',18,18.0,18,18,18,18.0,true ,'18','18') +sql insert into tb3 values ('2021-10-20 10:00:21',21,21.0,21,21,21,21.0,false,'21','21') + + +sql create stable stb4 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) + +sql create table tb4_0 using stb4 tags(0,'0',0.0) +sql create table tb4_1 using stb4 tags(1,'1',1.0) +sql create table tb4_2 using stb4 tags(2,'2',2.0) + +sql insert into tb4_0 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:00:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:00:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:00:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:00:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:00:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:00:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:00:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:00:55',55,55.0,55,55,55,55.0,false,'55','55') + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:01:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:01:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:01:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:01:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:01:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:01:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:01:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:01:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:01:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:01:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:01:55',55,55.0,55,55,55,55.0,false,'55','55') + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:02:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:02:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:02:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:02:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:02:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:02:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:02:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:02:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:02:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:02:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:02:55',55,55.0,55,55,55,55.0,false,'55','55') + + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:03:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:03:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:03:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:03:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:03:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:03:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:03:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:03:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:03:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:03:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:03:55',55,55.0,55,55,55,55.0,false,'55','55') + + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:04:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:04:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:04:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:04:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:04:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:04:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:04:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:04:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:04:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:04:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:04:55',55,55.0,55,55,55,55.0,false,'55','55') + + + +run general/parser/interp_full_test1.sim +run general/parser/interp_full_test2.sim +run general/parser/interp_full_test3.sim +run general/parser/interp_full_test4.sim + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +run general/parser/interp_full_test1.sim +run general/parser/interp_full_test2.sim +run general/parser/interp_full_test3.sim +run general/parser/interp_full_test4.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/interp_full_test1.sim b/tests/script/general/parser/interp_full_test1.sim new file mode 100644 index 0000000000000000000000000000000000000000..858d58768bd6c0ab78d6debf0e4208d375080ef8 --- /dev/null +++ b/tests/script/general/parser/interp_full_test1.sim @@ -0,0 +1,2247 @@ +sleep 100 +sql connect + +sql use db; + +sql_error SELECT INTERP(c7) FROM tb1; +sql_error SELECT INTERP(c8) FROM tb1; +sql_error SELECT INTERP(c9) FROM tb1; +sql_error SELECT INTERP(c1,c8) FROM tb1; +sql_error SELECT INTERP(*) FROM tb1; +sql_error SELECT INTERP(c1),INTERP(c8) FROM tb1; +sql_error SELECT INTERP(c1),avg(c1) FROM tb1; +sql_error SELECT INTERP(c1),c1 FROM tb1; +sql_error SELECT INTERP(c1),top(c1,3) FROM tb1; +sql_error SELECT INTERP(c1),first(c1) FROM tb1; +sql_error SELECT INTERP(c1),count(c1) FROM tb1; +sql_error SELECT INTERP(c1),ceil(c1) FROM tb1; +sql_error SELECT c1,c2,interp(c1) FROM tb1; +sql_error SELECT INTERP(c1) FROM stb1; +sql_error SELECT interp(c1) FROM stb1 group by t1; +sql_error SELECT interp(c1) FROM stb1 group by tbname,t1; +sql_error SELECT interp(c1) FROM stb1 group by tbname,ts; +sql_error SELECT interp(c1) FROM stb1 group by tbname,c1; +sql_error SELECT INTERP(c1) FROM tb1 interval(1s); +sql_error SELECT avg(c1) FROM tb1 every(1s); +sql_error SELECT avg(c1) FROM tb1 range(0,1); +sql_error SELECT INTERP(c1) FROM tb1 STATE_WINDOW(c1); +sql_error SELECT INTERP(c1) FROM tb1 SESSION(ts,100s); +sql_error SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:11','2021-10-20 10:00:10'); +sql_error SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:11','2021-10-20 10:00:10') ORDER BY ts DESC; +sql_error SELECT INTERP(ts) FROM tb1; +sql_error select interp(c1) from tb1 EVERY(1s) sliding(1s); +sql_error select interp(c1) from (select ts,c1 from tb1 order by ts desc); +sql_error select interp(a) from (select top(c1,3) as a from stb1 group by tbname); +sql_error select interp(c1) from (select c1 from tb1 order by ts); +sql_error select interp(c1) from (select c1,ts from tb1 order by ts); +sql_error select interp(a) from (select top(c1,3) as a from stb1 order by ts); +sql_error select interp(a) from (select top(c1,3) as a from tb1 order by ts desc); + +sql SELECT INTERP(c1) FROM tb1; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT ts,INTERP(c1) FROM tb1; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data02 != 0 then + return -1 +endi + + + +sql SELECT INTERP(c1) FROM tb1 where ts > '2021-10-20 10:00:03' +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi + +sql SELECT INTERP(c1,c2,c3,c4,c6,c5) FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != 0.00000 then + return -1 +endi +if $data03 != 0 then + return -1 +endi +if $data04 != 0 then + return -1 +endi +if $data05 != 0.000000000 then + return -1 +endi +if $data06 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != 1.00000 then + return -1 +endi +if $data13 != 1 then + return -1 +endi +if $data14 != 1 then + return -1 +endi +if $data15 != 1.000000000 then + return -1 +endi +if $data16 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != 3.00000 then + return -1 +endi +if $data23 != 3 then + return -1 +endi +if $data24 != 3 then + return -1 +endi +if $data25 != 3.000000000 then + return -1 +endi +if $data26 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data34 != 6 then + return -1 +endi +if $data35 != 6.000000000 then + return -1 +endi +if $data36 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != 10.00000 then + return -1 +endi +if $data43 != 10 then + return -1 +endi +if $data44 != 10 then + return -1 +endi +if $data45 != 10.000000000 then + return -1 +endi +if $data46 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != 15.00000 then + return -1 +endi +if $data53 != 15 then + return -1 +endi +if $data54 != 15 then + return -1 +endi +if $data55 != 15.000000000 then + return -1 +endi +if $data56 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != 21.00000 then + return -1 +endi +if $data63 != 21 then + return -1 +endi +if $data64 != 21 then + return -1 +endi +if $data65 != 21.000000000 then + return -1 +endi +if $data66 != 21 then + return -1 +endi + +sql SELECT INTERP(c1),interp(c2),interp(c3) FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != 0.00000 then + return -1 +endi +if $data03 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != 1.00000 then + return -1 +endi +if $data13 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != 3.00000 then + return -1 +endi +if $data23 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != 10.00000 then + return -1 +endi +if $data43 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != 15.00000 then + return -1 +endi +if $data53 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != 21.00000 then + return -1 +endi +if $data63 != 21 then + return -1 +endi + + +sql SELECT INTERP(c1),ts FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != @21-10-20 10:00:21.000@ then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data72 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data82 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data91 != 4 then + return -1 +endi +if $data92 != tb2 then + return -1 +endi + + + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 5; +if $rows != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 3; +if $rows != 9 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data32 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data41 != 2 then + return -1 +endi +if $data42 != tb2 then + return -1 +endi +if $data50 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data51 != 4 then + return -1 +endi +if $data52 != tb2 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != tb3 then + return -1 +endi +if $data70 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data71 != 1 then + return -1 +endi +if $data72 != tb3 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data82 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 3 offset 6; +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data11 != 14 then + return -1 +endi +if $data12 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data22 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(1s) group by tbname; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 0.00000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 0 then + return -1 +endi +if $data06 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != 1 then + return -1 +endi +if $data13 != 1.00000 then + return -1 +endi +if $data14 != 1 then + return -1 +endi +if $data15 != 1 then + return -1 +endi +if $data16 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != 1 then + return -1 +endi +if $data23 != 3.00000 then + return -1 +endi +if $data24 != 1 then + return -1 +endi +if $data25 != 3 then + return -1 +endi +if $data26 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 1 then + return -1 +endi +if $data33 != 6.00000 then + return -1 +endi +if $data34 != 1 then + return -1 +endi +if $data35 != 6 then + return -1 +endi +if $data36 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != 1 then + return -1 +endi +if $data43 != 10.00000 then + return -1 +endi +if $data44 != 1 then + return -1 +endi +if $data45 != 10 then + return -1 +endi +if $data46 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != 1 then + return -1 +endi +if $data53 != 15.00000 then + return -1 +endi +if $data54 != 1 then + return -1 +endi +if $data55 != 15 then + return -1 +endi +if $data56 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != 1 then + return -1 +endi +if $data63 != 21.00000 then + return -1 +endi +if $data64 != 1 then + return -1 +endi +if $data65 != 21 then + return -1 +endi +if $data66 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data72 != 2 then + return -1 +endi +if $data73 != 0.00000 then + return -1 +endi +if $data74 != 2 then + return -1 +endi +if $data75 != 0 then + return -1 +endi +if $data76 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data82 != 2 then + return -1 +endi +if $data83 != 2.00000 then + return -1 +endi +if $data84 != 2 then + return -1 +endi +if $data85 != 2 then + return -1 +endi +if $data86 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data91 != 4 then + return -1 +endi +if $data92 != 2 then + return -1 +endi +if $data93 != 4.00000 then + return -1 +endi +if $data94 != 2 then + return -1 +endi +if $data95 != 4 then + return -1 +endi +if $data96 != tb2 then + return -1 +endi + +sql SELECT tbname,INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(4s) group by tbname; +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != tb1 then + return -1 +endi +if $data02 != 0 then + return -1 +endi +if $data03 != 1 then + return -1 +endi +if $data04 != 0.00000 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 0 then + return -1 +endi +if $data07 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != tb2 then + return -1 +endi +if $data12 != 0 then + return -1 +endi +if $data13 != 2 then + return -1 +endi +if $data14 != 0.00000 then + return -1 +endi +if $data15 != 2 then + return -1 +endi +if $data16 != 0 then + return -1 +endi +if $data17 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data21 != tb2 then + return -1 +endi +if $data22 != 4 then + return -1 +endi +if $data23 != 2 then + return -1 +endi +if $data24 != 4.00000 then + return -1 +endi +if $data25 != 2 then + return -1 +endi +if $data26 != 4 then + return -1 +endi +if $data27 != tb2 then + return -1 +endi +if $data30 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data31 != tb2 then + return -1 +endi +if $data32 != 12 then + return -1 +endi +if $data33 != 2 then + return -1 +endi +if $data34 != 12.00000 then + return -1 +endi +if $data35 != 2 then + return -1 +endi +if $data36 != 12 then + return -1 +endi +if $data37 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != tb3 then + return -1 +endi +if $data42 != 0 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data44 != 0.00000 then + return -1 +endi +if $data45 != 3 then + return -1 +endi +if $data46 != 0 then + return -1 +endi +if $data47 != tb3 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM stb1 range('2021-10-20 10:00:00.000','2021-10-20 10:00:40.000') every(1s) fill(linear) group by tbname; +if $rows != 59 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data72 != tb1 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data82 != tb1 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi +if $data92 != tb1 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00'); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00'); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00'); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(VALUE, 100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 every(2s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(5s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(100s); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100.00000 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0.00000 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s); +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s); +if $rows != 4 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(2s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(2s); +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(2s); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(2s); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(2s); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(LINEAR); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT) limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 21 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 1 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 3 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) limit 10 offset 20; +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(VALUE,100); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NULL); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(LINEAR); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 5 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 20 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NEXT); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(PREV); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(VALUE,100); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NULL); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi diff --git a/tests/script/general/parser/interp_full_test2.sim b/tests/script/general/parser/interp_full_test2.sim new file mode 100644 index 0000000000000000000000000000000000000000..e044ef572bbb97d7d71ec96821e8f0e65b21389e --- /dev/null +++ b/tests/script/general/parser/interp_full_test2.sim @@ -0,0 +1,2360 @@ +sleep 100 +sql connect + +sql use db; + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 5 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 7 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 8 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 9 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 11 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 12 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 13 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 3622 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) limit 10 offset 3612; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data70 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data81 != 21 then + return -1 +endi +if $data90 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data91 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NEXT); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +if $rows != 14401 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 1 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 3 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) limit 1 offset 14400; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) limit 5 offset 14396; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +if $rows != 10801 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 11:00:01.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 18001 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100) limit 20 offset 3600; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(VALUE,100); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 10801 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 11:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data90 != @21-10-20 11:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +if $rows != 18001 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL) limit 20 offset 3600; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NULL); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +if $rows != 10801 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 11:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data90 != @21-10-20 11:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:03.500@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data10 != @21-10-20 10:00:04.500@ then + return -1 +endi +if $data11 != 4 then + return -1 +endi +if $data20 != @21-10-20 10:00:05.500@ then + return -1 +endi +if $data21 != 5 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.500@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.500@ then + return -1 +endi +if $data41 != 7 then + return -1 +endi +if $data50 != @21-10-20 10:00:08.500@ then + return -1 +endi +if $data51 != 8 then + return -1 +endi +if $data60 != @21-10-20 10:00:09.500@ then + return -1 +endi +if $data61 != 9 then + return -1 +endi +if $data70 != @21-10-20 10:00:10.500@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:11.500@ then + return -1 +endi +if $data81 != 11 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.500@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi + + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:03.500@ then + return -1 +endi +if $data01 != 3.50000 then + return -1 +endi +if $data10 != @21-10-20 10:00:04.500@ then + return -1 +endi +if $data11 != 4.50000 then + return -1 +endi +if $data20 != @21-10-20 10:00:05.500@ then + return -1 +endi +if $data21 != 5.50000 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.500@ then + return -1 +endi +if $data31 != 6.50000 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.500@ then + return -1 +endi +if $data41 != 7.50000 then + return -1 +endi +if $data50 != @21-10-20 10:00:08.500@ then + return -1 +endi +if $data51 != 8.50000 then + return -1 +endi +if $data60 != @21-10-20 10:00:09.500@ then + return -1 +endi +if $data61 != 9.50000 then + return -1 +endi +if $data70 != @21-10-20 10:00:10.500@ then + return -1 +endi +if $data71 != 10.50000 then + return -1 +endi +if $data80 != @21-10-20 10:00:11.500@ then + return -1 +endi +if $data81 != 11.50000 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.500@ then + return -1 +endi +if $data91 != 12.50000 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 11 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 12 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 13 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 14 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:11' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 16 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(LINEAR); +if $rows != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 11 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 12 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 13 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 14 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(PREV); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(PREV); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(PREV); +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:25.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:26.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:28.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:29.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:30.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(NEXT); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 09:00:02.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 09:00:03.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 09:00:04.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 09:00:05.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 09:00:06.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 09:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 09:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 09:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(NEXT); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NULL); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 0 then + return -1 +endi + + + +print ================== start DESC test + +sql SELECT INTERP(c1) FROM tb1 ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT ts,INTERP(c1) FROM tb1 ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data02 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 where ts > '2021-10-20 10:00:03' ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +sql SELECT INTERP(c1,c2,c3,c4,c6,c5) FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != 21.00000 then + return -1 +endi +if $data03 != 21 then + return -1 +endi +if $data04 != 21 then + return -1 +endi +if $data05 != 21.000000000 then + return -1 +endi +if $data06 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != 15.00000 then + return -1 +endi +if $data13 != 15 then + return -1 +endi +if $data14 != 15 then + return -1 +endi +if $data15 != 15.000000000 then + return -1 +endi +if $data16 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != 10.00000 then + return -1 +endi +if $data23 != 10 then + return -1 +endi +if $data24 != 10 then + return -1 +endi +if $data25 != 10.000000000 then + return -1 +endi +if $data26 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data34 != 6 then + return -1 +endi +if $data35 != 6.000000000 then + return -1 +endi +if $data36 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != 3.00000 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data44 != 3 then + return -1 +endi +if $data45 != 3.000000000 then + return -1 +endi +if $data46 != 3 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != 1.00000 then + return -1 +endi +if $data53 != 1 then + return -1 +endi +if $data54 != 1 then + return -1 +endi +if $data55 != 1.000000000 then + return -1 +endi +if $data56 != 1 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != 0.00000 then + return -1 +endi +if $data63 != 0 then + return -1 +endi +if $data64 != 0 then + return -1 +endi +if $data65 != 0.000000000 then + return -1 +endi +if $data66 != 0 then + return -1 +endi + +sql SELECT INTERP(c1),interp(c2),interp(c3) FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != 0.00000 then + return -1 +endi +if $data63 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != 1.00000 then + return -1 +endi +if $data53 != 1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != 3.00000 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != 10.00000 then + return -1 +endi +if $data23 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != 15.00000 then + return -1 +endi +if $data13 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != 21.00000 then + return -1 +endi +if $data03 != 21 then + return -1 +endi + +sql SELECT INTERP(c1),ts FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != @21-10-20 10:00:21.000@ then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC; +if $rows != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data72 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 12 then + return -1 +endi +if $data82 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +if $data92 != tb2 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC limit 5; +if $rows != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC limit 3; +if $rows != 9 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data32 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data41 != 12 then + return -1 +endi +if $data42 != tb2 then + return -1 +endi +if $data50 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data52 != tb2 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != tb3 then + return -1 +endi +if $data70 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data71 != 18 then + return -1 +endi +if $data72 != tb3 then + return -1 +endi +if $data80 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data82 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC limit 3 offset 6; +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data12 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data22 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(1s) group by tbname ORDER BY ts DESC; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 21.00000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 21 then + return -1 +endi +if $data06 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != 1 then + return -1 +endi +if $data13 != 15.00000 then + return -1 +endi +if $data14 != 1 then + return -1 +endi +if $data15 != 15 then + return -1 +endi +if $data16 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != 1 then + return -1 +endi +if $data23 != 10.00000 then + return -1 +endi +if $data24 != 1 then + return -1 +endi +if $data25 != 10 then + return -1 +endi +if $data26 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 1 then + return -1 +endi +if $data33 != 6.00000 then + return -1 +endi +if $data34 != 1 then + return -1 +endi +if $data35 != 6 then + return -1 +endi +if $data36 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != 1 then + return -1 +endi +if $data43 != 3.00000 then + return -1 +endi +if $data44 != 1 then + return -1 +endi +if $data45 != 3 then + return -1 +endi +if $data46 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != 1 then + return -1 +endi +if $data53 != 1.00000 then + return -1 +endi +if $data54 != 1 then + return -1 +endi +if $data55 != 1 then + return -1 +endi +if $data56 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != 1 then + return -1 +endi +if $data63 != 0.00000 then + return -1 +endi +if $data64 != 1 then + return -1 +endi +if $data65 != 0 then + return -1 +endi +if $data66 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data72 != 2 then + return -1 +endi +if $data73 != 14.00000 then + return -1 +endi +if $data74 != 2 then + return -1 +endi +if $data75 != 14 then + return -1 +endi +if $data76 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 12 then + return -1 +endi +if $data82 != 2 then + return -1 +endi +if $data83 != 12.00000 then + return -1 +endi +if $data84 != 2 then + return -1 +endi +if $data85 != 12 then + return -1 +endi +if $data86 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +if $data92 != 2 then + return -1 +endi +if $data93 != 10.00000 then + return -1 +endi +if $data94 != 2 then + return -1 +endi +if $data95 != 10 then + return -1 +endi +if $data96 != tb2 then + return -1 +endi diff --git a/tests/script/general/parser/interp_full_test3.sim b/tests/script/general/parser/interp_full_test3.sim new file mode 100644 index 0000000000000000000000000000000000000000..94745211e4efb71ee96e5e9161f901a2ccb52a71 --- /dev/null +++ b/tests/script/general/parser/interp_full_test3.sim @@ -0,0 +1,2401 @@ +sleep 100 +sql connect + +sql use db; + + +sql SELECT tbname,INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(4s) group by tbname ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != tb1 then + return -1 +endi +if $data02 != 0 then + return -1 +endi +if $data03 != 1 then + return -1 +endi +if $data04 != 0.00000 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 0 then + return -1 +endi +if $data07 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data31 != tb2 then + return -1 +endi +if $data32 != 0 then + return -1 +endi +if $data33 != 2 then + return -1 +endi +if $data34 != 0.00000 then + return -1 +endi +if $data35 != 2 then + return -1 +endi +if $data36 != 0 then + return -1 +endi +if $data37 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data21 != tb2 then + return -1 +endi +if $data22 != 4 then + return -1 +endi +if $data23 != 2 then + return -1 +endi +if $data24 != 4.00000 then + return -1 +endi +if $data25 != 2 then + return -1 +endi +if $data26 != 4 then + return -1 +endi +if $data27 != tb2 then + return -1 +endi +if $data10 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data11 != tb2 then + return -1 +endi +if $data12 != 12 then + return -1 +endi +if $data13 != 2 then + return -1 +endi +if $data14 != 12.00000 then + return -1 +endi +if $data15 != 2 then + return -1 +endi +if $data16 != 12 then + return -1 +endi +if $data17 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != tb3 then + return -1 +endi +if $data42 != 0 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data44 != 0.00000 then + return -1 +endi +if $data45 != 3 then + return -1 +endi +if $data46 != 0 then + return -1 +endi +if $data47 != tb3 then + return -1 +endi +sql SELECT INTERP(c1) FROM stb1 range('2021-10-20 10:00:00.000','2021-10-20 10:00:40.000') every(1s) fill(linear) group by tbname ORDER BY ts DESC; +if $rows != 59 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 18 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 17 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 16 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data72 != tb1 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data82 != tb1 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi +if $data92 != tb1 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(VALUE, 100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(2s) ORDER BY ts DESC; +if $rows != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 every(5s) ORDER BY ts DESC; +if $rows != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 every(100s) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100.00000 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0.00000 then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 4 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(2s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 2 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT) ORDER BY ts DESC limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 3 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 3 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 3 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 1 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 10 offset 20; +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NULL) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 5 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 20 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(PREV) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NULL) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 18 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 17 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 16 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC limit 20 offset 10; +if $rows != 12 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 11 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 9 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 8 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 7 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 5 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 4 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 2 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 18 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 17 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 16 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 3622 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC limit 20 offset 10 ; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC limit 20 offset 20 ; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data20 != @21-10-20 09:59:59.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data30 != @21-10-20 09:59:58.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data40 != @21-10-20 09:59:57.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 09:59:56.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 09:59:55.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data70 != @21-10-20 09:59:54.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data80 != @21-10-20 09:59:53.000@ then + return -1 +endi +if $data81 != 0 then + return -1 +endi +if $data90 != @21-10-20 09:59:52.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 14401 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 13:59:59.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 13:59:58.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 13:59:57.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 13:59:56.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 13:59:55.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 13:59:54.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data70 != @21-10-20 13:59:53.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 13:59:52.000@ then + return -1 +endi +if $data81 != 21 then + return -1 +endi +if $data90 != @21-10-20 13:59:51.000@ then + return -1 +endi +if $data91 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 30 offset 14379; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 13:59:59.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 20 offset 14387; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data91 != 3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100) limit 20 offset 3600; +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL) limit 20 offset 3600; +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:11' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(NEXT); + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NULL) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:30') EVERY(1s) FILL(LINEAR) GROUP BY TBNAME ORDER BY TBNAME desc; +if $rows != 59 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb3 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb3 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != tb3 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data32 != tb3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data42 != tb3 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data52 != tb3 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data62 != tb3 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data72 != tb3 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data82 != tb3 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi +if $data92 != tb3 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30'); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts every(1s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts fill(linear); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') fill(next); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts every(1s) fill(prev); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi + diff --git a/tests/script/general/parser/interp_full_test4.sim b/tests/script/general/parser/interp_full_test4.sim new file mode 100644 index 0000000000000000000000000000000000000000..70796bd8b61bdd0706474b8f1ce58b71ef2aba98 --- /dev/null +++ b/tests/script/general/parser/interp_full_test4.sim @@ -0,0 +1,1499 @@ +sleep 100 +sql connect + +sql use db; + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts every(1s) fill(prev) order by ts desc; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 0 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(linear); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(linear) order by ts desc; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 9 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 8 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 7 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 4 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 3 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 1 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev); +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev) limit 30 offset 10; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev) order by ts desc; +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:30.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:29.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:28.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:26.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:25.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev) order by ts desc limit 10 offset 21; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data70 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data80 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data81 != 0 then + return -1 +endi +if $data90 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(next); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(next) order by ts desc; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(NULL); +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(NULL) order by ts desc; +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:30.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 10:00:29.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:28.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:26.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:25.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data70 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(NULL) order by ts desc limit 10 offset 21; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data70 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(VALUE,100); +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(VALUE,100) order by ts desc limit 20 offset 20; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 100 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql select interp(c1) from (select ts,c1 from tb1); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql select interp(c1) from (select ts,c1 from tb1 order by ts); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + + +sql select interp(a) from (select sum(c1) as a from stb1 interval(1s)); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql select interp(a) from (select top(c1,3) as a from tb1 order by ts) every(1s) fill(prev); +if $rows != 12 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql select interp(a) from (select max(c1) as a from tb1 interval(6s)) every(1s) fill(next); +if $rows != 19 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql select interp(a) from (select diff(c2) as a from tb1) every(1s) fill(linear); +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +if $data10 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data11 != 1.50000 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 2.00000 then + return -1 +endi +if $data30 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data31 != 2.33333 then + return -1 +endi +if $data40 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data41 != 2.66667 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 3.00000 then + return -1 +endi +if $data60 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data61 != 3.25000 then + return -1 +endi +if $data70 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data71 != 3.50000 then + return -1 +endi +if $data80 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data81 != 3.75000 then + return -1 +endi +if $data90 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data91 != 4.00000 then + return -1 +endi + +sql select interp(a) from (select sum(c2) as a from stb1 interval(6s)) RANGE('2021-10-20 10:00:05.000','2021-10-20 10:00:20.000') every(1s) fill(linear); +if $rows != 14 then + return -1 +endi +if $data00 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data01 != 42.166666667 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 48.000000000 then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != 46.833333333 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 45.666666667 then + return -1 +endi +if $data40 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data41 != 44.500000000 then + return -1 +endi +if $data50 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data51 != 43.333333333 then + return -1 +endi +if $data60 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data61 != 42.166666667 then + return -1 +endi +if $data70 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data71 != 41.000000000 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 44.166666667 then + return -1 +endi +if $data90 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data91 != 47.333333333 then + return -1 +endi + +sql select interp(a) from (select interp(c1) b,interp(c2) a from tb1 where ts < '2021-10-20 10:00:15.000' range('2021-10-20 10:00:05.000','2021-10-20 10:00:20.000') every(3s) fill(prev)) where ts between '2021-10-20 10:00:06.000' and '2021-10-20 10:00:18.000' range('2021-10-20 10:00:00.000','2021-10-20 10:00:25.000') every(1s) fill(linear); +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data01 != 6.00000 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 7.33333 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 8.66667 then + return -1 +endi +if $data30 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data31 != 10.00000 then + return -1 +endi +if $data40 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data41 != 10.00000 then + return -1 +endi +if $data50 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data51 != 10.00000 then + return -1 +endi +if $data60 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data61 != 10.00000 then + return -1 +endi +if $data70 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data71 != 10.00000 then + return -1 +endi +if $data80 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data81 != 10.00000 then + return -1 +endi +if $data90 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data91 != 10.00000 then + return -1 +endi + +sql select interp(a) from (select interp(c4) a from tb1,tb4_0 where tb1.ts=tb4_0.ts every(3s) fill(linear)) every(4s) fill(prev); +if $rows != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data31 != 12 then + return -1 +endi +if $data40 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data51 != 18 then + return -1 +endi + +sql select interp(c4) from tb1 every(7s) fill(linear) union all select interp(c4) from tb4_0 every(33s) fill(prev); +if $rows != 13 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data11 != 7 then + return -1 +endi +if $data20 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data21 != 14 then + return -1 +endi +if $data30 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:33.000@ then + return -1 +endi +if $data51 != 28 then + return -1 +endi +if $data60 != @21-10-20 10:01:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:01:39.000@ then + return -1 +endi +if $data71 != 36 then + return -1 +endi +if $data80 != @21-10-20 10:02:12.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:02:45.000@ then + return -1 +endi +if $data91 != 45 then + return -1 +endi + +sql select interp(c3) from tb4_0 every(3s) fill(linear); +if $rows != 99 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data31 != 9 then + return -1 +endi +if $data40 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data41 != 12 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data61 != 18 then + return -1 +endi +if $data70 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data81 != 24 then + return -1 +endi +if $data90 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data91 != 27 then + return -1 +endi + +sql select interp(c3) from tb4_0 every(5s) fill(linear) order by ts desc; +if $rows != 60 then + return -1 +endi + + +sql select interp(c3) from tb4_0 where ts > '2021-10-20 10:04:15.000' and ts < '2021-10-20 10:04:55.000' every(5s) fill(linear) order by ts desc; +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:04:41.000@ then + return -1 +endi +if $data01 != 41 then + return -1 +endi +if $data10 != @21-10-20 10:04:36.000@ then + return -1 +endi +if $data11 != 36 then + return -1 +endi +if $data20 != @21-10-20 10:04:31.000@ then + return -1 +endi +if $data21 != 31 then + return -1 +endi +if $data30 != @21-10-20 10:04:26.000@ then + return -1 +endi +if $data31 != 26 then + return -1 +endi +if $data40 != @21-10-20 10:04:21.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi diff --git a/tests/script/general/parser/interp_test.sim b/tests/script/general/parser/interp_test.sim deleted file mode 100644 index 8eac8a41d391508737232a3f068c477922bf77aa..0000000000000000000000000000000000000000 --- a/tests/script/general/parser/interp_test.sim +++ /dev/null @@ -1,2496 +0,0 @@ -sleep 100 -sql connect - -$dbPrefix = intp_db -$tbPrefix = intp_tb -$stbPrefix = intp_stb -$tbNum = 4 -$rowNum = 10000 -$totalNum = $tbNum * $rowNum -$ts0 = 1537146000000 -$delta = 600000 -print ========== intp_test.sim -$i = 0 -$db = $dbPrefix . $i -$stb = $stbPrefix . $i -$tsu = $rowNum * $delta -$tsu = $tsu - $delta -$tsu = $tsu + $ts0 - -print ====== use db -sql use $db - -##### select interp from table -print ====== select intp from table -$tb = $tbPrefix . 0 -## interp(*) from tb -sql select interp(*) from $tb where ts = $ts0 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi - -## interp + limit offset -sql select interp(*) from $tb where ts = $ts0 limit 5 offset 1 -if $rows != 0 then - return -1 -endi - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -## intp + aggregation functions -$t = $ts0 + $delta -$t = $t + $delta -sql_error select interp(ts), max(c1), min(c2), count(c3), sum(c4), avg(c5), stddev(c6), first(c7), last(c8), interp(c9) from $tb where ts = $t -sql_error select interp(ts) from $tb where ts=$ts0 interval(1s) - -### illegal queries on a table -sql_error select interp(ts), c1 from $tb where ts = $ts0 -sql_error select interp(ts) from $tb where ts >= $ts0 -sql_error select interp(ts), max(c1), min(c2), count(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(NULL) - -### interp from tb + fill -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t -if $rows != 0 then - return -1 -endi - -## fill(none) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi - -## fill(NULL) -$t = $tsu - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, NULL) order by ts asc -if $rows != 1 then - return -1 -endi -if $data00 != @18-11-25 19:29:59.000@ then - return -1 -endi -if $data01 != NULL then - print expect NULL, actual $data01 - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != NULL then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != NULL then - return -1 -endi -if $data06 != NULL then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi - -## fill(prev) -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 1 then - return -1 -endi - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(prev) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -$t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 0 then - return -1 -endi - -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(prev) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - print expect 0.00000, actual:$data03 - return -1 -endi -# if $data04 != NULL then -# return -1 -# endi - -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 0 then - return -1 -endi - -## fill(linear) -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -print $data03 -if $data03 != 0.00167 then - return -1 -endi -if $data04 != 0.001666667 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -# columns contain NULL values -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(linear) -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00167 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi -# columns contain NULL values - -print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -$t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -if $rows != 0 then - return -1 -endi - -$t = $tsu + 1000 -print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -if $rows != 0 then - return -1 -endi - -## fill(value) -$t = $ts0 + 1000 -print 91 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != -2 then - return -1 -endi -if $data02 != -2 then - return -1 -endi -if $data03 != -2.00000 then - return -1 -endi -if $data04 != -2.000000000 then - return -1 -endi -if $data05 != -2 then - return -1 -endi -if $data06 != -2 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(value, -1, -2, -3) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -# table has NULL columns -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(value, -1, -2, -3) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi - -$t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 0 then - return -1 -endi - -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 0 then - return -1 -endi - -### select interp from stable -## interp(*) from stb -print select interp(*) from $stb where ts = $ts0 -sql select interp(*) from $stb where ts = $ts0 -if $rows != 1 then - return -1 -endi -$t = $ts0 + 1000 -print 92 - -sql select interp(*) from $stb where ts = $t -if $rows != 0 then - return -1 -endi -## interp(*) from stb + group by -sql select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc -print ====== select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data08 != intp_tb0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data28 != intp_tb2 then - return -1 -endi - -## interp(*) from stb + group by + limit offset -sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 -if $rows != 0 then - return -1 -endi -sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 offset 1 - -## interp(*) from stb + group by + fill(none) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(none) group by tbname -if $rows != 0 then - return -1 -endi - -sql select interp(*) from $stb where ts = $ts0 fill(none) group by tbname -if $rows != 4 then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi - -## interp(*) from stb + group by + fill(none) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(NULL) group by tbname -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data12 != NULL then - return -1 -endi -if $data23 != NULL then - return -1 -endi -if $data34 != NULL then - return -1 -endi -if $data05 != NULL then - return -1 -endi -if $data16 != NULL then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data38 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -sql select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname -print $rows - -if $rows != 4 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -if $data02 != 0 then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi - -## interp(*) from stb + group by + fill(prev) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(prev) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data23 != 0.00000 then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data25 != 0 then - return -1 -endi -if $data26 != 0 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != binary0 then - return -1 -endi -if $data29 != nchar0 then - return -1 -endi - -## interp(*) from stb + group by + fill(linear) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(linear) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00167 then - return -1 -endi -if $data04 != 0.001666667 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data23 != 0.00167 then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data25 != 0 then - return -1 -endi -if $data26 != 0 then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data28 != NULL then - return -1 -endi -if $data29 != NULL then - return -1 -endi - - ## interp(*) from stb + group by + fill(value) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(value, -1, -2) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != -2 then - return -1 -endi -if $data02 != -2 then - return -1 -endi -if $data03 != -2.00000 then - return -1 -endi -if $data04 != -2.000000000 then - return -1 -endi -if $data05 != -2 then - return -1 -endi -if $data06 != -2 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != -2 then - return -1 -endi -if $data22 != -2 then - return -1 -endi -if $data23 != -2.00000 then - return -1 -endi -if $data24 != -2.000000000 then - return -1 -endi -if $data25 != -2 then - return -1 -endi -if $data26 != -2 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != NULL then - return -1 -endi -if $data29 != NULL then - return -1 -endi - -sql_error select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12'; -sql select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12' every(1s) fill(linear); -if $rows != 0 then - return -1 -endi - -sql select interp(c1) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m); -if $rows != 1 then - return -1 -endi - -if $data00 != @18-11-25 18:30:00.000@ then - return -1 -endi - -if $data01 != 3 then - return -1 -endi - -sql select interp(c1,c3,c4,ts) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m) fill(linear) -if $rows != 5 then - return -1 -endi - -if $data00 != @18-11-25 17:54:00.000@ then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -if $data02 != 0.00000 then - return -1 -endi - -if $data03 != 0.000000000 then - return -1 -endi - -if $data04 != @18-11-25 17:54:00.000@ then - return -1 -endi - -if $data10 != @18-11-25 18:12:00.000@ then - return -1 -endi - -if $data11 != 1 then - return -1 -endi - -if $data12 != 1.20000 then - return -1 -endi - -if $data13 != 1.200000000 then - return -1 -endi - -if $data14 != @18-11-25 18:12:00.000@ then - return -1 -endi - -if $data40 != @18-11-25 19:06:00.000@ then - return -1 -endi - -if $data41 != 6 then - return -1 -endi - -if $data42 != 6.60000 then - return -1 -endi - -if $data43 != 6.600000000 then - return -1 -endi - -if $data44 != @18-11-25 19:06:00.000@ then - return -1 -endi - - -sql select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear); -if $rows != 8 then - return -1 -endi -if $data00 != @18-09-17 20:35:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:37:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data51 != 0 then - return -1 -endi -if $data60 != @18-09-17 20:41:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi - - -sql select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear) order by ts desc; -if $rows != 8 then - return -1 -endi -if $data00 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:41:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data30 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:37:00.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi -if $data60 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @18-09-17 20:35:00.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi - -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(2m) fill(linear) order by ts; -if $rows != 9 then - return -1 -endi -if $data00 != @18-09-17 20:34:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data31 != 0.00000 then - return -1 -endi -if $data40 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data41 != 0.20000 then - return -1 -endi -if $data50 != @18-09-17 20:44:00.000@ then - return -1 -endi -if $data51 != 0.40000 then - return -1 -endi -if $data60 != @18-09-17 20:46:00.000@ then - return -1 -endi -if $data61 != 0.60000 then - return -1 -endi -if $data70 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data71 != 0.80000 then - return -1 -endi -if $data80 != @18-09-17 20:50:00.000@ then - return -1 -endi -if $data81 != 1.00000 then - return -1 -endi - - -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts; -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 20:33:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data31 != 0.20000 then - return -1 -endi -if $data40 != @18-09-17 20:45:00.000@ then - return -1 -endi -if $data41 != 0.50000 then - return -1 -endi -if $data50 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data51 != 0.80000 then - return -1 -endi - -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts desc; -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data01 != 0.80000 then - return -1 -endi -if $data10 != @18-09-17 20:45:00.000@ then - return -1 -endi -if $data11 != 0.50000 then - return -1 -endi -if $data20 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data21 != 0.20000 then - return -1 -endi -if $data30 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:33:00.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi - - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(linear); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(value, 1); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 1.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 1.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 1.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 1.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 1.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(NULL); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(prev); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(next); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(linear); -if $rows != 0 then - return -1 -endi -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(prev); -if $rows != 2 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(next); -if $rows != 2 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(linear); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(prev); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(next); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(linear); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != NULL then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(prev); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(next); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != NULL then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(linear); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(prev); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(next); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(value, 1); -if $rows != 4 then - return -1 -endi -if $data00 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data11 != 1.00000 then - return -1 -endi -if $data20 != @21-07-25 02:20:04.000@ then - return -1 -endi -if $data21 != 1.00000 then - return -1 -endi -if $data30 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data31 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(null); -if $rows != 4 then - return -1 -endi -if $data00 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @21-07-25 02:20:04.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data31 != 20.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(linear); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(prev); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(next); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(linear); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(prev); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(next); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(linear); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(prev); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(next); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:07' every(1s); -if $rows != 1 then - return -1 -endi -if $data00 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data01 != 20.00000 then - return -1 -endi - diff --git a/tests/script/general/parser/like.sim b/tests/script/general/parser/like.sim index fce996ebee37d887e2f86fc2a8566d844e8d04f5..382240c91141a19e28bc4a25d81cea54737b6a55 100644 --- a/tests/script/general/parser/like.sim +++ b/tests/script/general/parser/like.sim @@ -23,7 +23,7 @@ sql create table $table2 (ts timestamp, b binary(20)) sql insert into $table1 values(now, "table_name") sql insert into $table1 values(now-1m, "tablexname") sql insert into $table1 values(now-2m, "tablexxx") -sql insert into $table1 values(now-2m, "table") +sql insert into $table1 values(now-3m, "table") sql select b from $table1 if $rows != 4 then @@ -56,6 +56,45 @@ if $rows != 1 then return -1 endi +sql create database escape_percentage; +sql use escape_percentage; +$table1 = tablename +$table2 = `table%` + +sql create table $table1 (ts timestamp, b binary(20)) +sql create table $table2 (ts timestamp, b binary(20)) + +sql insert into $table1 values(now, "table%name") +sql insert into $table1 values(now-1m, "table%") +sql insert into $table1 values(now-2m, "table%%%") +sql insert into $table1 values(now-3m, "table") + +sql select b from $table1 where b like 'table\%' +print $rows +if $rows != 1 then + return -1 +endi +sql select b from $table1 where b like 'table\%\%\%' +print $rows +if $rows != 1 then + return -1 +endi +sql select b from $table1 where b like 'table%' +print $rows +if $rows != 4 then + return -1 +endi +sql show tables like 'table\%' +print $rows +if $rows != 1 then + return -1 +endi +sql show tables like 'table%' +print $rows +if $rows != 2 then + return -1 +endi +sql drop database escape_percentage system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim index 22f18179a418b5779993c91a17d62848674e1774..25cc8a4ee8774fc7b43234d54d06abdc56af61f8 100644 --- a/tests/script/general/parser/nestquery.sim +++ b/tests/script/general/parser/nestquery.sim @@ -181,7 +181,7 @@ endi sql_error select stddev(c1) from (select c1 from nest_tb0); sql_error select percentile(c1, 20) from (select * from nest_tb0); -sql_error select interp(c1) from (select * from nest_tb0); +#sql_error select interp(c1) from (select * from nest_tb0); sql_error select derivative(val, 1s, 0) from (select c1 val from nest_tb0); sql_error select twa(c1) from (select c1 from nest_tb0); sql_error select irate(c1) from (select c1 from nest_tb0); @@ -925,5 +925,18 @@ if $data00 != 24 then return -1 endi +sql select sum(a)/sum(b) from meters where ts >= '2021-09-30 15:00:00.000' and ts <= '2021-09-30 15:00:05.000' interval(1s) fill(null) group by area order by area; +if $rows != 12 then + return -1 +endi +if $data00 != @21-09-30 15:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != 0 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index fcd9d49fe555ae749da0fcd799e1866a8a05f656..84c9e89d872679f92f45a522ae3f6483b9ebf77f 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -20,7 +20,7 @@ run general/parser/import_commit3.sim run general/parser/import_file.sim run general/parser/insert_tb.sim run general/parser/tags_dynamically_specifiy.sim -run general/parser/interp.sim +run general/parser/interp_full.sim run general/parser/lastrow.sim run general/parser/limit.sim run general/parser/limit1.sim diff --git a/tests/script/general/parser/udf_dll.sim b/tests/script/general/parser/udf_dll.sim index 61bf5fee6e54d02ccc08218102a43a37821fdd30..c6eff722d5fbcfc79faebca131db5e071bd093c4 100644 --- a/tests/script/general/parser/udf_dll.sim +++ b/tests/script/general/parser/udf_dll.sim @@ -10,7 +10,7 @@ sql connect print ======================== dnode1 start sql create function add_one as '/tmp/add_one.so' outputtype int; -sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype int; +sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype bigint; sql show functions; if $rows != 2 then return -1 diff --git a/tests/script/general/parser/udf_dll_stable.sim b/tests/script/general/parser/udf_dll_stable.sim index cd1dbc8b5374779d13decde5bf8a0fce48d90f0a..d7e987c5fd8f0a46c08b40d84775c2dcfcc221c7 100644 --- a/tests/script/general/parser/udf_dll_stable.sim +++ b/tests/script/general/parser/udf_dll_stable.sim @@ -11,7 +11,7 @@ print ======================== dnode1 start sql create function add_one as '/tmp/add_one.so' outputtype int; sql create function add_one_64232 as '/tmp/add_one_64232.so' outputtype int; -sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype int; +sql create aggregate function sum_double as '/tmp/sum_double.so' outputtype bigint; sql show functions; if $rows != 3 then return -1 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 850f3a19467a8748bba56f80033d4fc0b0bc77a3..9a8f602901507bc4fc31d3902461394446a3067b 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -75,7 +75,7 @@ cd ../../../debug; make ./test.sh -f general/parser/where.sim ./test.sh -f general/parser/slimit.sim ./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/interp_full.sim ./test.sh -f general/parser/tags_dynamically_specifiy.sim ./test.sh -f general/parser/groupby.sim ./test.sh -f general/parser/set_tag_vals.sim @@ -414,6 +414,7 @@ cd ../../../debug; make ./test.sh -f general/parser/between_and.sim ./test.sh -f general/parser/last_cache.sim ./test.sh -f unique/big/balance.sim +./test.sh -f general/parser/nestquery.sim ./test.sh -f general/parser/udf.sim ./test.sh -f general/parser/udf_dll.sim diff --git a/tests/script/jenkins/simple.txt b/tests/script/jenkins/simple.txt index 88ff4d660131bea5dee2f5ccd0dad9d81c7bed5f..a0a2f5191768b70638aa45fa9ad97f73c91d4d86 100644 --- a/tests/script/jenkins/simple.txt +++ b/tests/script/jenkins/simple.txt @@ -138,7 +138,7 @@ cd ../../../debug; make ./test.sh -f general/parser/where.sim ./test.sh -f general/parser/slimit.sim ./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/interp_full.sim ./test.sh -f general/parser/tags_dynamically_specifiy.sim ./test.sh -f general/parser/groupby.sim ./test.sh -f general/parser/set_tag_vals.sim diff --git a/tests/script/jenkins/wbasic.txt b/tests/script/jenkins/wbasic.txt index 984b15fc5a4e49a5e730667782b41afb8bdb6bb8..22fee77344371a634086ebf2a37a9bf5b03a7f6b 100644 --- a/tests/script/jenkins/wbasic.txt +++ b/tests/script/jenkins/wbasic.txt @@ -143,7 +143,7 @@ wtest.bat -f general/parser/fill_stb.sim wtest.bat -f general/parser/where.sim wtest.bat -f general/parser/slimit.sim wtest.bat -f general/parser/select_with_tags.sim -wtest.bat -f general/parser/interp.sim +wtest.bat -f general/parser/interp_full.sim wtest.bat -f general/parser/tags_dynamically_specifiy.sim wtest.bat -f general/parser/groupby.sim wtest.bat -f general/parser/set_tag_vals.sim diff --git a/tests/script/regressionSuite.sim b/tests/script/regressionSuite.sim index faa6672b42be666d17bafe5a6176d95cdbbc27a8..91a88451924e6856a693208d30733c1f610dd74a 100644 --- a/tests/script/regressionSuite.sim +++ b/tests/script/regressionSuite.sim @@ -38,6 +38,7 @@ run general/compute/stddev.sim run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim +run general/compute/table_group.sim run general/db/alter_option.sim run general/db/alter_tables_d2.sim run general/db/alter_tables_v1.sim @@ -129,7 +130,7 @@ run general/parser/limit2.sim run general/parser/slimit.sim run general/parser/fill.sim run general/parser/fill_stb.sim -run general/parser/interp.sim +run general/parser/interp_full.sim run general/parser/where.sim run general/parser/join.sim run general/parser/join_multivnode.sim diff --git a/tests/script/sh/abs_max.c b/tests/script/sh/abs_max.c index e9f11feb414363eb0e741c722f4d4dd79b87e81e..9faea60374766e47f82a70880fe2b1376bbc12dc 100644 --- a/tests/script/sh/abs_max.c +++ b/tests/script/sh/abs_max.c @@ -1,11 +1,12 @@ #include #include #include +#include typedef struct SUdfInit{ int maybe_null; /* 1 if function can return NULL */ int decimals; /* for real functions */ - long long length; /* For string functions */ + int64_t length; /* For string functions */ char *ptr; /* free pointer for function data */ int const_item; /* 0 if result is independent of arguments */ } SUdfInit; @@ -14,31 +15,36 @@ typedef struct SUdfInit{ #define TSDB_DATA_INT_NULL 0x80000000L #define TSDB_DATA_BIGINT_NULL 0x8000000000000000L -void abs_max(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, +void abs_max(char* data, short itype, short ibytes, int numOfRows, int64_t* ts, char* dataOutput, char* interBuf, char* tsOutput, int* numOfOutput, short otype, short obytes, SUdfInit* buf) { int i; - long r = 0; - printf("abs_max input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf); + int64_t r = 0; + // printf("abs_max input data:%p, type:%d, rows:%d, ts:%p, %" PRId64 ", dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf); if (itype == 5) { - r=*(long *)dataOutput; + r=*(int64_t *)dataOutput; *numOfOutput=0; for(i=0;i r) { r = v; } } - *(long *)dataOutput=r; + *(int64_t *)dataOutput=r; - printf("abs_max out, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput); - } else { + // printf("abs_max out, dataoutput:%" PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput); + }else { *numOfOutput=0; } } @@ -47,44 +53,43 @@ void abs_max(char* data, short itype, short ibytes, int numOfRows, long long* ts void abs_max_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf) { int i; - int r = 0; - printf("abs_max_finalize dataoutput:%p:%d, numOfOutput:%d, buf:%p\n", dataOutput, *dataOutput, *numOfOutput, buf); - - printf("abs_max finalize, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput); + //int64_t r = 0; + // printf("abs_max_finalize dataoutput:%p:%d, numOfOutput:%d, buf:%p\n", dataOutput, *dataOutput, *numOfOutput, buf); + // *numOfOutput=1; + // printf("abs_max finalize, dataoutput:%" PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput); } void abs_max_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) { - int r = 0; + int64_t r = 0; if (numOfRows > 0) { - r = *((long *)data); + r = *((int64_t *)data); } - printf("abs_max_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf); + // printf("abs_max_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf); for (int i = 1; i < numOfRows; ++i) { - printf("abs_max_merge %d - %ld\n", i, *((long *)data + i)); - if (*((long*)data + i) > r) { - r= *((long*)data + i); + // printf("abs_max_merge %d - %" PRId64"\n", i, *((int64_t *)data + i)); + if (*((int64_t*)data + i) > r) { + r= *((int64_t*)data + i); } } - *(long*)dataOutput=r; + *(int64_t*)dataOutput=r; if (numOfRows > 0) { *numOfOutput=1; } else { *numOfOutput=0; } - printf("abs_max_merge, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput); + // printf("abs_max_merge, dataoutput:%" PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput); } int abs_max_init(SUdfInit* buf) { - printf("abs_max init\n"); + // printf("abs_max init\n"); return 0; } void abs_max_destroy(SUdfInit* buf) { - printf("abs_max destroy\n"); -} - + // printf("abs_max destroy\n"); +} \ No newline at end of file diff --git a/tests/script/sh/add_one.c b/tests/script/sh/add_one.c index e12cf8f26f6ddad67f9f7b091c033de46a3f6f50..de2a7d168c88d1a13bf5cbe6a327ea451ddb2546 100644 --- a/tests/script/sh/add_one.c +++ b/tests/script/sh/add_one.c @@ -14,20 +14,18 @@ void add_one(char* data, short itype, short ibytes, int numOfRows, long long* ts int* numOfOutput, short otype, short obytes, SUdfInit* buf) { int i; int r = 0; - printf("add_one input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf); + // printf("add_one input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf); if (itype == 4) { for(i=0;i #include #include +#include typedef struct SUdfInit{ int maybe_null; /* 1 if function can return NULL */ int decimals; /* for real functions */ - long long length; /* For string functions */ + int64_t length; /* For string functions */ char *ptr; /* free pointer for function data */ int const_item; /* 0 if result is independent of arguments */ } SUdfInit; @@ -13,13 +14,13 @@ typedef struct SUdfInit{ #define TSDB_DATA_INT_NULL 0x80000000L -void sum_double(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, +void sum_double(char* data, short itype, short ibytes, int numOfRows, int64_t* ts, char* dataOutput, char* interBuf, char* tsOutput, int* numOfOutput, short otype, short obytes, SUdfInit* buf) { int i; - int r = 0; - printf("sum_double input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf); + int64_t r = 0; + printf("sum_double input data:%p, type:%d, rows:%d, ts:%p,%"PRId64", dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf); if (itype == 4) { - r=*(int *)dataOutput; + r=*(int64_t *)dataOutput; *numOfOutput=0; for(i=0;iptr)=*(int*)dataOutput*2; - *(int*)dataOutput=*(int*)(buf->ptr); - printf("sum_double finalize, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput); + int64_t r = 0; + // printf("sum_double_finalize dataoutput:%p:%"PRId64", numOfOutput:%d, buf:%p\n", dataOutput, *(int64_t*)dataOutput, *numOfOutput, buf); + // *numOfOutput=1; + *(int64_t*)(buf->ptr)=*(int64_t*)dataOutput*2; + *(int64_t*)dataOutput=*(int64_t*)(buf->ptr); + // printf("sum_double finalize, dataoutput:%"PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput); } -void sum_double_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) { +void sum_double_merge(char* data, int32_t numOfRows, char* dataOutput, int* numOfOutput, SUdfInit* buf) { int r = 0; - int sum = 0; + int64_t sum = 0; - printf("sum_double_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf); + // printf("sum_double_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf); for (int i = 0; i < numOfRows; ++i) { - printf("sum_double_merge %d - %d\n", i, *((int*)data + i)); - sum +=*((int*)data + i); + // printf("sum_double_merge %d - %"PRId64"\n", i, *((int64_t*)data + i)); + sum +=*((int64_t*)data + i); } - *(int*)dataOutput+=sum; + *(int64_t*)dataOutput+=sum; if (numOfRows > 0) { *numOfOutput=1; } else { *numOfOutput=0; } - printf("sum_double_merge, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput); + // printf("sum_double_merge, dataoutput:%"PRId64", numOfOutput:%d\n", *(int64_t *)dataOutput, *numOfOutput); } int sum_double_init(SUdfInit* buf) { buf->maybe_null=1; - buf->ptr = malloc(sizeof(int)); - printf("sum_double init\n"); + buf->ptr = malloc(sizeof(int64_t)); + // printf("sum_double init\n"); return 0; } void sum_double_destroy(SUdfInit* buf) { free(buf->ptr); - printf("sum_double destroy\n"); -} - + // printf("sum_double destroy\n"); +} \ No newline at end of file diff --git a/tests/script/unique/cluster/cache.sim b/tests/script/unique/cluster/cache.sim index 740eddfb0d36767631c08a60806ab2e38e6f364a..1b3771353f8ca411db1fc8ea62335c5ecc16bf45 100644 --- a/tests/script/unique/cluster/cache.sim +++ b/tests/script/unique/cluster/cache.sim @@ -41,7 +41,7 @@ sql create dnode $hostname2 sleep 10000 sql show log.tables; -if $rows > 6 then +if $rows > 20 then return -1 endi @@ -50,7 +50,7 @@ print ===>rows $rows print $data00 $data01 $data02 print $data10 $data11 $data12 print $data20 $data21 $data22 -if $rows < 10 then +if $rows < 9 then return -1 endi diff --git a/tests/script/unique/dnode/monitor.sim b/tests/script/unique/dnode/monitor.sim index 0b41a4137ca74046b24e84fb6202279f45eaa578..b1be43ecf58355216266accd308e5e7d41088892 100644 --- a/tests/script/unique/dnode/monitor.sim +++ b/tests/script/unique/dnode/monitor.sim @@ -42,7 +42,7 @@ print dnode2 openVnodes $data2_2 if $data2_1 != 0 then return -1 endi -if $data2_2 != 1 then +if $data2_2 != 2 then return -1 endi @@ -56,7 +56,25 @@ print $data30 print $data40 print $data50 -if $rows > 6 then +print *num of tables $rows + +if $rows > 17 then + return -1 +endi + +sql show log.stables + +print $data00 +print $data10 +print $data20 +print $data30 +print $data40 +print $data50 +print $data60 + +print *num of stables $rows + +if $rows > 7 then return -1 endi diff --git a/tests/script/unique/dnode/monitor_bug.sim b/tests/script/unique/dnode/monitor_bug.sim index 60c6524d9ce70c549cbea2964768888bf0d72fcb..acde8cc3c76297249c71aa0ad307502ce0283391 100644 --- a/tests/script/unique/dnode/monitor_bug.sim +++ b/tests/script/unique/dnode/monitor_bug.sim @@ -19,7 +19,7 @@ sleep 3000 sql show dnodes print dnode1 openVnodes $data2_1 -if $data2_1 > 2 then +if $data2_1 > 4 then return -1 endi @@ -28,20 +28,20 @@ sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start $x = 0 -show2: +show2: $x = $x + 1 sleep 2000 if $x == 10 then return -1 endi - + sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 if $data2_1 != 0 then goto show2 endi -if $data2_2 > 2 then +if $data2_2 > 4 then goto show2 endi @@ -55,7 +55,7 @@ print $data30 print $data40 print $data50 -if $rows > 5 then +if $rows > 14 then return -1 endi @@ -74,4 +74,4 @@ if $rows2 <= $rows1 then endi system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode2 -s stop -x SIGINT