提交 7de7e54c 编写于 作者: haoranc's avatar haoranc

Merge branch 'develop' of github.com:taosdata/TDengine into dev/chr

...@@ -122,10 +122,14 @@ IF (TD_LINUX) ...@@ -122,10 +122,14 @@ IF (TD_LINUX)
ADD_DEFINITIONS(-D_TD_NINGSI_60) ADD_DEFINITIONS(-D_TD_NINGSI_60)
MESSAGE(STATUS "set ningsi macro to true") MESSAGE(STATUS "set ningsi macro to true")
ENDIF () ENDIF ()
SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG") IF (TD_MEMORY_SANITIZER)
SET(DEBUG_FLAGS "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -O0 -g3 -DDEBUG")
ELSE ()
SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG")
ENDIF ()
SET(RELEASE_FLAGS "-O3 -Wno-error") SET(RELEASE_FLAGS "-O3 -Wno-error")
IF (${COVER} MATCHES "true") IF (${COVER} MATCHES "true")
MESSAGE(STATUS "Test coverage mode, add extra flags") MESSAGE(STATUS "Test coverage mode, add extra flags")
SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage") SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
...@@ -144,7 +148,11 @@ IF (TD_DARWIN_64) ...@@ -144,7 +148,11 @@ IF (TD_DARWIN_64)
ADD_DEFINITIONS(-DUSE_LIBICONV) ADD_DEFINITIONS(-DUSE_LIBICONV)
MESSAGE(STATUS "darwin64 is defined") MESSAGE(STATUS "darwin64 is defined")
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG") IF (TD_MEMORY_SANITIZER)
SET(DEBUG_FLAGS "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -O0 -g3 -DDEBUG")
ELSE ()
SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG")
ENDIF ()
SET(RELEASE_FLAGS "-Og") SET(RELEASE_FLAGS "-Og")
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc)
...@@ -162,7 +170,14 @@ IF (TD_WINDOWS) ...@@ -162,7 +170,14 @@ IF (TD_WINDOWS)
IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900)) IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18") SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
ENDIF () ENDIF ()
SET(DEBUG_FLAGS "/fsanitize=thread /fsanitize=leak /fsanitize=memory /fsanitize=undefined /fsanitize=hwaddress /Zi /W3 /GL")
IF (TD_MEMORY_SANITIZER)
MESSAGE("memory sanitizer detected as true")
SET(DEBUG_FLAGS "/fsanitize=address /Zi /W3 /GL")
ELSE ()
MESSAGE("memory sanitizer detected as false")
SET(DEBUG_FLAGS "/Zi /W3 /GL")
ENDIF ()
SET(RELEASE_FLAGS "/W0 /O3 /GL") SET(RELEASE_FLAGS "/W0 /O3 /GL")
ENDIF () ENDIF ()
...@@ -171,7 +186,7 @@ IF (TD_WINDOWS) ...@@ -171,7 +186,7 @@ IF (TD_WINDOWS)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/wepoll/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/wepoll/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MsvcLibX/include) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MsvcLibX/include)
ENDIF () ENDIF ()
IF (TD_WINDOWS_64) IF (TD_WINDOWS_64)
ADD_DEFINITIONS(-D_M_X64) ADD_DEFINITIONS(-D_M_X64)
......
...@@ -83,3 +83,8 @@ SET(TD_BUILD_JDBC TRUE) ...@@ -83,3 +83,8 @@ SET(TD_BUILD_JDBC TRUE)
IF (${BUILD_JDBC} MATCHES "false") IF (${BUILD_JDBC} MATCHES "false")
SET(TD_BUILD_JDBC FALSE) SET(TD_BUILD_JDBC FALSE)
ENDIF () ENDIF ()
SET(TD_MEMORY_SANITIZER FALSE)
IF (${MEMORY_SANITIZER} MATCHES "true")
SET(TD_MEMORY_SANITIZER TRUE)
ENDIF ()
...@@ -176,7 +176,7 @@ TDengine 分布式架构的逻辑结构图如下: ...@@ -176,7 +176,7 @@ TDengine 分布式架构的逻辑结构图如下:
**通讯方式:**TDengine系统的各个数据节点之间,以及应用驱动与各数据节点之间的通讯是通过TCP/UDP进行的。因为考虑到物联网场景,数据写入的包一般不大,因此TDengine 除采用TCP做传输之外,还采用UDP方式,因为UDP 更加高效,而且不受连接数的限制。TDengine实现了自己的超时、重传、确认等机制,以确保UDP的可靠传输。对于数据量不到15K的数据包,采取UDP的方式进行传输,超过15K的,或者是查询类的操作,自动采取TCP的方式进行传输。同时,TDengine根据配置和数据包,会自动对数据进行压缩/解压缩,数字签名/认证等处理。对于数据节点之间的数据复制,只采用TCP方式进行数据传输。 **通讯方式:**TDengine系统的各个数据节点之间,以及应用驱动与各数据节点之间的通讯是通过TCP/UDP进行的。因为考虑到物联网场景,数据写入的包一般不大,因此TDengine 除采用TCP做传输之外,还采用UDP方式,因为UDP 更加高效,而且不受连接数的限制。TDengine实现了自己的超时、重传、确认等机制,以确保UDP的可靠传输。对于数据量不到15K的数据包,采取UDP的方式进行传输,超过15K的,或者是查询类的操作,自动采取TCP的方式进行传输。同时,TDengine根据配置和数据包,会自动对数据进行压缩/解压缩,数字签名/认证等处理。对于数据节点之间的数据复制,只采用TCP方式进行数据传输。
**FQDN配置**:一个数据节点有一个或多个FQDN,可以在系统配置文件taos.cfg通过参数“fqdn"进行指定,如果没有指定,系统将自动获取计算机的hostname作为其FQDN。如果节点没有配置FQDN,可以直接将该节点的配置参数fqdn设置为它的IP地址。但不建议使用IP,因为IP地址可变,一旦变化,将让集群无法正常工作。一个数据节点的EP(End Point)由FQDN + Port组成。采用FQDN,需要保证DNS服务正常工作,或者在节点以及应用所在的节点配置好hosts文件。 **FQDN配置**:一个数据节点有一个或多个FQDN,可以在系统配置文件taos.cfg通过参数“fqdn"进行指定,如果没有指定,系统将自动获取计算机的hostname作为其FQDN。如果节点没有配置FQDN,可以直接将该节点的配置参数fqdn设置为它的IP地址。但不建议使用IP,因为IP地址可变,一旦变化,将让集群无法正常工作。一个数据节点的EP(End Point)由FQDN + Port组成。采用FQDN,需要保证DNS服务正常工作,或者在节点以及应用所在的节点配置好hosts文件。另外,这个参数值的长度需要控制在 96 个字符以内。
**端口配置:**一个数据节点对外的端口由TDengine的系统配置参数serverPort决定,对集群内部通讯的端口是serverPort+5。集群内数据节点之间的数据复制操作还占有一个TCP端口,是serverPort+10. 为支持多线程高效的处理UDP数据,每个对内和对外的UDP连接,都需要占用5个连续的端口。因此一个数据节点总的端口范围为serverPort到serverPort + 10,总共11个TCP/UDP端口。(另外还可能有 RESTful、Arbitrator 所使用的端口,那样的话就一共是 13 个。)使用时,需要确保防火墙将这些端口打开,以备使用。每个数据节点可以配置不同的serverPort。(详细的端口情况请参见 [TDengine 2.0 端口说明](https://www.taosdata.com/cn/documentation/faq#port) **端口配置:**一个数据节点对外的端口由TDengine的系统配置参数serverPort决定,对集群内部通讯的端口是serverPort+5。集群内数据节点之间的数据复制操作还占有一个TCP端口,是serverPort+10. 为支持多线程高效的处理UDP数据,每个对内和对外的UDP连接,都需要占用5个连续的端口。因此一个数据节点总的端口范围为serverPort到serverPort + 10,总共11个TCP/UDP端口。(另外还可能有 RESTful、Arbitrator 所使用的端口,那样的话就一共是 13 个。)使用时,需要确保防火墙将这些端口打开,以备使用。每个数据节点可以配置不同的serverPort。(详细的端口情况请参见 [TDengine 2.0 端口说明](https://www.taosdata.com/cn/documentation/faq#port)
......
...@@ -325,10 +325,12 @@ for (int i = 0; i < numOfRows; i++){ ...@@ -325,10 +325,12 @@ for (int i = 0; i < numOfRows; i++){
} }
s.setString(2, s2, 10); s.setString(2, s2, 10);
// AddBatch 之后,可以再设定新的表名、TAGS、VALUES 取值,这样就能实现一次执行向多个数据表写入 // AddBatch 之后,缓存并未清空。为避免混乱,并不推荐在 ExecuteBatch 之前再次绑定新一批的数据
s.columnDataAddBatch(); s.columnDataAddBatch();
// 执行语句: // 执行绑定数据后的语句:
s.columnDataExecuteBatch(); s.columnDataExecuteBatch();
// 执行语句后清空缓存。在清空之后,可以复用当前的对象,绑定新的一批数据(可以是新表名、新 TAGS 值、新 VALUES 值):
s.columnDataClearBatch();
// 执行完毕,释放资源: // 执行完毕,释放资源:
s.columnDataCloseBatch(); s.columnDataCloseBatch();
``` ```
......
...@@ -307,6 +307,8 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线 ...@@ -307,6 +307,8 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线
8. 调用 `taos_stmt_execute` 执行已经准备好的批处理指令; 8. 调用 `taos_stmt_execute` 执行已经准备好的批处理指令;
9. 执行完毕,调用 `taos_stmt_close` 释放所有资源。 9. 执行完毕,调用 `taos_stmt_close` 释放所有资源。
说明:如果 `taos_stmt_execute` 执行成功,假如不需要改变 SQL 语句的话,那么是可以复用 `taos_stmt_prepare` 的解析结果,直接进行第 3~6 步绑定新数据的。但如果执行出错,那么并不建议继续在当前的环境上下文下继续工作,而是建议释放资源,然后从 `taos_stmt_init` 步骤重新开始。
除 C/C++ 语言外,TDengine 的 Java 语言 JNI Connector 也提供参数绑定接口支持,具体请另外参见:[参数绑定接口的 Java 用法](https://www.taosdata.com/cn/documentation/connector/java#stmt-java) 除 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) 文件中使用对应函数的方式): 接口相关的具体函数如下(也可以参考 [apitest.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/apitest.c) 文件中使用对应函数的方式):
...@@ -378,6 +380,11 @@ typedef struct TAOS_MULTI_BIND { ...@@ -378,6 +380,11 @@ typedef struct TAOS_MULTI_BIND {
执行完毕,释放所有资源。 执行完毕,释放所有资源。
- `char * taos_stmt_errstr(TAOS_STMT *stmt)`
(2.1.3.0 版本新增)
用于在其他 stmt API 返回错误(返回错误码或空指针)时获取错误信息。
### 连续查询接口 ### 连续查询接口
TDengine提供时间驱动的实时流式计算API。可以每隔一指定的时间段,对一张或多张数据库的表(数据流)进行各种实时聚合计算操作。操作简单,仅有打开、关闭流的API。具体如下: TDengine提供时间驱动的实时流式计算API。可以每隔一指定的时间段,对一张或多张数据库的表(数据流)进行各种实时聚合计算操作。操作简单,仅有打开、关闭流的API。具体如下:
......
...@@ -99,7 +99,7 @@ taosd -C ...@@ -99,7 +99,7 @@ taosd -C
下面仅仅列出一些重要的配置参数,更多的参数请看配置文件里的说明。各个参数的详细介绍及作用请看前述章节,而且这些参数的缺省配置都是工作的,一般无需设置。**注意:配置修改后,需要重启*taosd*服务才能生效。** 下面仅仅列出一些重要的配置参数,更多的参数请看配置文件里的说明。各个参数的详细介绍及作用请看前述章节,而且这些参数的缺省配置都是工作的,一般无需设置。**注意:配置修改后,需要重启*taosd*服务才能生效。**
- firstEp: taosd启动时,主动连接的集群中首个dnode的end point, 默认值为localhost:6030。 - firstEp: taosd启动时,主动连接的集群中首个dnode的end point, 默认值为localhost:6030。
- fqdn:数据节点的FQDN,缺省为操作系统配置的第一个hostname。如果习惯IP地址访问,可设置为该节点的IP地址。 - fqdn:数据节点的FQDN,缺省为操作系统配置的第一个hostname。如果习惯IP地址访问,可设置为该节点的IP地址。这个参数值的长度需要控制在 96 个字符以内。
- serverPort:taosd启动后,对外服务的端口号,默认值为6030。(RESTful服务使用的端口号是在此基础上+11,即默认值为6041。) - serverPort:taosd启动后,对外服务的端口号,默认值为6030。(RESTful服务使用的端口号是在此基础上+11,即默认值为6041。)
- dataDir: 数据文件目录,所有的数据文件都将写入该目录。默认值:/var/lib/taos。 - dataDir: 数据文件目录,所有的数据文件都将写入该目录。默认值:/var/lib/taos。
- logDir:日志文件目录,客户端和服务器的运行日志文件将写入该目录。默认值:/var/log/taos。 - logDir:日志文件目录,客户端和服务器的运行日志文件将写入该目录。默认值:/var/log/taos。
......
...@@ -138,6 +138,7 @@ bool isSimpleAggregateRv(SQueryInfo* pQueryInfo); ...@@ -138,6 +138,7 @@ bool isSimpleAggregateRv(SQueryInfo* pQueryInfo);
bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo *pQueryInfo, int32_t tableIndex); bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo *pQueryInfo, int32_t tableIndex);
bool tscOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex); bool tscOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex);
bool tscIsDiffDerivQuery(SQueryInfo* pQueryInfo);
bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex); bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex);
bool tscIsProjectionQuery(SQueryInfo* pQueryInfo); bool tscIsProjectionQuery(SQueryInfo* pQueryInfo);
......
...@@ -266,6 +266,7 @@ typedef struct SSqlObj { ...@@ -266,6 +266,7 @@ typedef struct SSqlObj {
typedef struct SSqlStream { typedef struct SSqlStream {
SSqlObj *pSql; SSqlObj *pSql;
void * cqhandle; // stream belong to SCQContext handle
const char* dstTable; const char* dstTable;
uint32_t streamId; uint32_t streamId;
char listed; char listed;
......
...@@ -468,6 +468,10 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i ...@@ -468,6 +468,10 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i
int32_t cnt = 0; int32_t cnt = 0;
int32_t j = 0; int32_t j = 0;
if (sToken.n >= TSDB_MAX_BYTES_PER_ROW) {
return tscSQLSyntaxErrMsg(pInsertParam->msg, "too long string", sToken.z);
}
for (uint32_t k = 1; k < sToken.n - 1; ++k) { for (uint32_t k = 1; k < sToken.n - 1; ++k) {
if (sToken.z[k] == '\\' || (sToken.z[k] == delim && sToken.z[k + 1] == delim)) { if (sToken.z[k] == '\\' || (sToken.z[k] == delim && sToken.z[k + 1] == delim)) {
tmpTokenBuf[j] = sToken.z[k + 1]; tmpTokenBuf[j] = sToken.z[k + 1];
...@@ -711,7 +715,7 @@ static int32_t doParseInsertStatement(SInsertStatementParam *pInsertParam, char ...@@ -711,7 +715,7 @@ static int32_t doParseInsertStatement(SInsertStatementParam *pInsertParam, char
} }
code = TSDB_CODE_TSC_INVALID_OPERATION; code = TSDB_CODE_TSC_INVALID_OPERATION;
char tmpTokenBuf[16*1024] = {0}; // used for deleting Escape character: \\, \', \" char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // used for deleting Escape character: \\, \', \"
int32_t numOfRows = 0; int32_t numOfRows = 0;
code = tsParseValues(str, dataBuf, maxNumOfRows, pInsertParam, &numOfRows, tmpTokenBuf); code = tsParseValues(str, dataBuf, maxNumOfRows, pInsertParam, &numOfRows, tmpTokenBuf);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "ttimer.h" #include "ttimer.h"
#include "tutil.h" #include "tutil.h"
#include "taosmsg.h" #include "taosmsg.h"
#include "tcq.h"
#include "taos.h" #include "taos.h"
...@@ -294,24 +295,34 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { ...@@ -294,24 +295,34 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
return msgLen; return msgLen;
} }
void tscKillConnection(STscObj *pObj) { // cqContext->dbconn is killed then call this callback
pthread_mutex_lock(&pObj->mutex); void cqConnKilledNotify(void* handle, void* conn) {
if (handle == NULL || conn == NULL){
return ;
}
SSqlObj *pSql = pObj->sqlList; SCqContext* pContext = (SCqContext*) handle;
while (pSql) { if (pContext->dbConn == conn){
pSql = pSql->next; atomic_store_ptr(&(pContext->dbConn), NULL);
} }
}
void tscKillConnection(STscObj *pObj) {
// get stream header by locked
pthread_mutex_lock(&pObj->mutex);
SSqlStream *pStream = pObj->streamList; SSqlStream *pStream = pObj->streamList;
pthread_mutex_unlock(&pObj->mutex);
while (pStream) { while (pStream) {
SSqlStream *tmp = pStream->next; SSqlStream *tmp = pStream->next;
// set associate variant to NULL
cqConnKilledNotify(pStream->cqhandle, pObj);
// taos_close_stream function call pObj->mutet lock , careful death-lock
taos_close_stream(pStream); taos_close_stream(pStream);
pStream = tmp; pStream = tmp;
} }
pthread_mutex_unlock(&pObj->mutex);
tscDebug("connection:%p is killed", pObj); tscDebug("connection:%p is killed", pObj);
taos_close(pObj); taos_close(pObj);
} }
...@@ -122,7 +122,7 @@ static int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQue ...@@ -122,7 +122,7 @@ static int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQue
static int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex); static int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
static int32_t getTableIndexImpl(SStrToken* pTableToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex); static int32_t getTableIndexImpl(SStrToken* pTableToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
static int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo); static int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* msg);
static int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode); static int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode);
static int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate); static int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate);
...@@ -438,7 +438,9 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -438,7 +438,9 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} }
} else if (pInfo->type == TSDB_SQL_DROP_DNODE) { } else if (pInfo->type == TSDB_SQL_DROP_DNODE) {
pzName->n = strdequote(pzName->z); if (pzName->type == TK_STRING) {
pzName->n = strdequote(pzName->z);
}
strncpy(pCmd->payload, pzName->z, pzName->n); strncpy(pCmd->payload, pzName->z, pzName->n);
} else { // drop user/account } else { // drop user/account
if (pzName->n >= TSDB_USER_LEN) { if (pzName->n >= TSDB_USER_LEN) {
...@@ -516,7 +518,9 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -516,7 +518,9 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} }
SStrToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0); SStrToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0);
id->n = strdequote(id->z); if (id->type == TK_STRING) {
id->n = strdequote(id->z);
}
break; break;
} }
...@@ -2157,7 +2161,10 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2157,7 +2161,10 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
const char* msg6 = "function applied to tags not allowed"; const char* msg6 = "function applied to tags not allowed";
const char* msg7 = "normal table can not apply this function"; const char* msg7 = "normal table can not apply this function";
const char* msg8 = "multi-columns selection does not support alias column name"; const char* msg8 = "multi-columns selection does not support alias column name";
const char* msg9 = "diff can no be applied to unsigned numeric type"; const char* msg9 = "diff/derivative can no be applied to unsigned numeric type";
const char* msg10 = "derivative duration should be greater than 1 Second";
const char* msg11 = "third parameter in derivative should be 0 or 1";
const char* msg12 = "parameter is out of range [1, 100]";
switch (functionId) { switch (functionId) {
case TSDB_FUNC_COUNT: { case TSDB_FUNC_COUNT: {
...@@ -2309,7 +2316,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2309,7 +2316,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
} }
SExprInfo* pExpr = tscExprAppend(pQueryInfo, functionId, &index, resultType, resultSize, getNewResColId(pCmd), resultSize, false); SExprInfo* pExpr = tscExprAppend(pQueryInfo, functionId, &index, resultType, resultSize, getNewResColId(pCmd), intermediateResSize, false);
if (functionId == TSDB_FUNC_LEASTSQR) { // set the leastsquares parameters if (functionId == TSDB_FUNC_LEASTSQR) { // set the leastsquares parameters
char val[8] = {0}; char val[8] = {0};
...@@ -2340,12 +2347,22 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2340,12 +2347,22 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tickPerSec /= 1000; tickPerSec /= 1000;
} }
if (tickPerSec <= 0 || tickPerSec < TSDB_TICK_PER_SECOND(info.precision)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10);
}
tscExprAddParams(&pExpr->base, (char*) &tickPerSec, TSDB_DATA_TYPE_BIGINT, LONG_BYTES); tscExprAddParams(&pExpr->base, (char*) &tickPerSec, TSDB_DATA_TYPE_BIGINT, LONG_BYTES);
memset(val, 0, tListLen(val)); memset(val, 0, tListLen(val));
if (tVariantDump(&pParamElem[2].pNode->value, val, TSDB_DATA_TYPE_BIGINT, true) < 0) { if (tVariantDump(&pParamElem[2].pNode->value, val, TSDB_DATA_TYPE_BIGINT, true) < 0) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
int64_t v = *(int64_t*) val;
if (v != 0 && v != 1) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg11);
}
tscExprAddParams(&pExpr->base, val, TSDB_DATA_TYPE_BIGINT, LONG_BYTES); tscExprAddParams(&pExpr->base, val, TSDB_DATA_TYPE_BIGINT, LONG_BYTES);
} }
...@@ -2551,7 +2568,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2551,7 +2568,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
int64_t nTop = GET_INT32_VAL(val); int64_t nTop = GET_INT32_VAL(val);
if (nTop <= 0 || nTop > 100) { // todo use macro if (nTop <= 0 || nTop > 100) { // todo use macro
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12);
} }
// todo REFACTOR // todo REFACTOR
...@@ -5645,7 +5662,7 @@ int32_t validateSqlFunctionInStreamSql(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { ...@@ -5645,7 +5662,7 @@ int32_t validateSqlFunctionInStreamSql(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
bool isProjectionFunction = false; bool isProjectionFunction = false;
const char* msg1 = "column projection is not compatible with interval"; const char* msg1 = "functions not compatible with interval";
// multi-output set/ todo refactor // multi-output set/ todo refactor
size_t size = taosArrayGetSize(pQueryInfo->exprList); size_t size = taosArrayGetSize(pQueryInfo->exprList);
...@@ -5669,8 +5686,8 @@ int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQu ...@@ -5669,8 +5686,8 @@ int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQu
} }
} }
if ((pExpr->base.functionId == TSDB_FUNC_PRJ && pExpr->base.numOfParams == 0) || pExpr->base.functionId == TSDB_FUNC_DIFF || int32_t f = pExpr->base.functionId;
pExpr->base.functionId == TSDB_FUNC_ARITHM) { if ((f == TSDB_FUNC_PRJ && pExpr->base.numOfParams == 0) || f == TSDB_FUNC_DIFF || f == TSDB_FUNC_ARITHM || f == TSDB_FUNC_DERIVATIVE) {
isProjectionFunction = true; isProjectionFunction = true;
} }
} }
...@@ -6266,7 +6283,7 @@ static void updateTagPrjFunction(SQueryInfo* pQueryInfo) { ...@@ -6266,7 +6283,7 @@ static void updateTagPrjFunction(SQueryInfo* pQueryInfo) {
* 2. if selectivity function and tagprj function both exist, there should be only * 2. if selectivity function and tagprj function both exist, there should be only
* one selectivity function exists. * one selectivity function exists.
*/ */
static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd) { static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) {
const char* msg1 = "only one selectivity function allowed in presence of tags function"; const char* msg1 = "only one selectivity function allowed in presence of tags function";
const char* msg3 = "aggregation function should not be mixed up with projection"; const char* msg3 = "aggregation function should not be mixed up with projection";
...@@ -6289,10 +6306,11 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd) ...@@ -6289,10 +6306,11 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd)
int16_t functionId = pExpr->base.functionId; int16_t functionId = pExpr->base.functionId;
if (functionId == TSDB_FUNC_TAGPRJ || functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TS || if (functionId == TSDB_FUNC_TAGPRJ || functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TS ||
functionId == TSDB_FUNC_ARITHM) { functionId == TSDB_FUNC_ARITHM || functionId == TSDB_FUNC_TS_DUMMY) {
continue; continue;
} }
if ((aAggs[functionId].status & TSDB_FUNCSTATE_SELECTIVITY) != 0) { if ((aAggs[functionId].status & TSDB_FUNCSTATE_SELECTIVITY) != 0) {
numOfSelectivity++; numOfSelectivity++;
} else { } else {
...@@ -6304,7 +6322,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd) ...@@ -6304,7 +6322,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd)
// When the tag projection function on tag column that is not in the group by clause, aggregation function and // When the tag projection function on tag column that is not in the group by clause, aggregation function and
// selectivity function exist in select clause is not allowed. // selectivity function exist in select clause is not allowed.
if (numOfAggregation > 0) { if (numOfAggregation > 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(msg, msg1);
} }
/* /*
...@@ -6333,7 +6351,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd) ...@@ -6333,7 +6351,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd)
(functionId == TSDB_FUNC_LAST_DST && (pExpr->base.colInfo.flag & TSDB_COL_NULL) != 0)) { (functionId == TSDB_FUNC_LAST_DST && (pExpr->base.colInfo.flag & TSDB_COL_NULL) != 0)) {
// do nothing // do nothing
} else { } else {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(msg, msg1);
} }
} }
...@@ -6346,7 +6364,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd) ...@@ -6346,7 +6364,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd)
} else { } else {
if ((pQueryInfo->type & TSDB_QUERY_TYPE_PROJECTION_QUERY) != 0) { if ((pQueryInfo->type & TSDB_QUERY_TYPE_PROJECTION_QUERY) != 0) {
if (numOfAggregation > 0 && pQueryInfo->groupbyExpr.numOfGroupCols == 0) { if (numOfAggregation > 0 && pQueryInfo->groupbyExpr.numOfGroupCols == 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(msg, msg3);
} }
if (numOfAggregation > 0 || numOfSelectivity > 0) { if (numOfAggregation > 0 || numOfSelectivity > 0) {
...@@ -6394,9 +6412,14 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo ...@@ -6394,9 +6412,14 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo
size_t size = tscNumOfExprs(pQueryInfo); size_t size = tscNumOfExprs(pQueryInfo);
if (TSDB_COL_IS_TAG(pColIndex->flag)) { if (TSDB_COL_IS_TAG(pColIndex->flag)) {
int32_t f = TSDB_FUNC_TAG;
if (tscIsDiffDerivQuery(pQueryInfo)) {
f = TSDB_FUNC_TAGPRJ;
}
SColumnIndex index = {.tableIndex = pQueryInfo->groupbyExpr.tableIndex, .columnIndex = colIndex}; SColumnIndex index = {.tableIndex = pQueryInfo->groupbyExpr.tableIndex, .columnIndex = colIndex};
SExprInfo* pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TAG, &index, s->type, s->bytes, SExprInfo* pExpr = tscExprAppend(pQueryInfo, f, &index, s->type, s->bytes, getNewResColId(pCmd), s->bytes, true);
getNewResColId(pCmd), s->bytes, true);
memset(pExpr->base.aliasName, 0, sizeof(pExpr->base.aliasName)); memset(pExpr->base.aliasName, 0, sizeof(pExpr->base.aliasName));
tstrncpy(pExpr->base.aliasName, s->name, sizeof(pExpr->base.aliasName)); tstrncpy(pExpr->base.aliasName, s->name, sizeof(pExpr->base.aliasName));
...@@ -6456,7 +6479,7 @@ static int32_t doTagFunctionCheck(SQueryInfo* pQueryInfo) { ...@@ -6456,7 +6479,7 @@ static int32_t doTagFunctionCheck(SQueryInfo* pQueryInfo) {
return (tableCounting && tagProjection)? -1:0; return (tableCounting && tagProjection)? -1:0;
} }
int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* msg) {
const char* msg1 = "functions/columns not allowed in group by query"; const char* msg1 = "functions/columns not allowed in group by query";
const char* msg2 = "projection query on columns not allowed"; const char* msg2 = "projection query on columns not allowed";
const char* msg3 = "group by/session/state_window not allowed on projection query"; const char* msg3 = "group by/session/state_window not allowed on projection query";
...@@ -6466,17 +6489,17 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { ...@@ -6466,17 +6489,17 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
// only retrieve tags, group by is not supportted // only retrieve tags, group by is not supportted
if (tscQueryTags(pQueryInfo)) { if (tscQueryTags(pQueryInfo)) {
if (doTagFunctionCheck(pQueryInfo) != TSDB_CODE_SUCCESS) { if (doTagFunctionCheck(pQueryInfo) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); return invalidOperationMsg(msg, msg5);
} }
if (pQueryInfo->groupbyExpr.numOfGroupCols > 0 || isTimeWindowQuery(pQueryInfo)) { if (pQueryInfo->groupbyExpr.numOfGroupCols > 0 || isTimeWindowQuery(pQueryInfo)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); return invalidOperationMsg(msg, msg4);
} else { } else {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
} }
if (tscIsProjectionQuery(pQueryInfo) && tscIsSessionWindowQuery(pQueryInfo)) { if (tscIsProjectionQuery(pQueryInfo) && tscIsSessionWindowQuery(pQueryInfo)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(msg, msg3);
} }
if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) { if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) {
...@@ -6484,6 +6507,7 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { ...@@ -6484,6 +6507,7 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
if (onlyTagPrjFunction(pQueryInfo) && allTagPrjInGroupby(pQueryInfo)) { if (onlyTagPrjFunction(pQueryInfo) && allTagPrjInGroupby(pQueryInfo)) {
// It is a groupby aggregate query, the tag project function is not suitable for this case. // It is a groupby aggregate query, the tag project function is not suitable for this case.
updateTagPrjFunction(pQueryInfo); updateTagPrjFunction(pQueryInfo);
return doAddGroupbyColumnsOnDemand(pCmd, pQueryInfo); return doAddGroupbyColumnsOnDemand(pCmd, pQueryInfo);
} }
...@@ -6508,21 +6532,21 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { ...@@ -6508,21 +6532,21 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
} }
if (!qualified) { if (!qualified) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(msg, msg2);
} }
} }
if (IS_MULTIOUTPUT(aAggs[functId].status) && functId != TSDB_FUNC_TOP && functId != TSDB_FUNC_BOTTOM && if (IS_MULTIOUTPUT(aAggs[functId].status) && functId != TSDB_FUNC_TOP && functId != TSDB_FUNC_BOTTOM &&
functId != TSDB_FUNC_DIFF && functId != TSDB_FUNC_TAGPRJ && functId != TSDB_FUNC_PRJ) { functId != TSDB_FUNC_DIFF && functId != TSDB_FUNC_TAGPRJ && functId != TSDB_FUNC_PRJ) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(msg, msg1);
} }
if (functId == TSDB_FUNC_COUNT && pExpr->base.colInfo.colIndex == TSDB_TBNAME_COLUMN_INDEX) { if (functId == TSDB_FUNC_COUNT && pExpr->base.colInfo.colIndex == TSDB_TBNAME_COLUMN_INDEX) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(msg, msg1);
} }
} }
if (checkUpdateTagPrjFunctions(pQueryInfo, pCmd) != TSDB_CODE_SUCCESS) { if (checkUpdateTagPrjFunctions(pQueryInfo, msg) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
...@@ -6531,13 +6555,13 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { ...@@ -6531,13 +6555,13 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
} }
// projection query on super table does not compatible with "group by" syntax // projection query on super table does not compatible with "group by" syntax
if (tscIsProjectionQuery(pQueryInfo)) { if (tscIsProjectionQuery(pQueryInfo) && !(tscIsDiffDerivQuery(pQueryInfo))) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(msg, msg3);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { } else {
return checkUpdateTagPrjFunctions(pQueryInfo, pCmd); return checkUpdateTagPrjFunctions(pQueryInfo, msg);
} }
} }
int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode) { int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode) {
...@@ -6623,6 +6647,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate) { ...@@ -6623,6 +6647,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg);
} }
int32_t blocks = ntohl(pCreate->totalBlocks);
if (blocks != -1 && (blocks < TSDB_MIN_TOTAL_BLOCKS || blocks > TSDB_MAX_TOTAL_BLOCKS)) {
snprintf(msg, tListLen(msg), "invalid db option totalBlocks: %d valid range: [%d, %d]", blocks,
TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS);
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg);
}
if (pCreate->quorum != -1 && if (pCreate->quorum != -1 &&
(pCreate->quorum < TSDB_MIN_DB_QUORUM_OPTION || pCreate->quorum > TSDB_MAX_DB_QUORUM_OPTION)) { (pCreate->quorum < TSDB_MIN_DB_QUORUM_OPTION || pCreate->quorum > TSDB_MAX_DB_QUORUM_OPTION)) {
snprintf(msg, tListLen(msg), "invalid db option quorum: %d valid range: [%d, %d]", pCreate->quorum, snprintf(msg, tListLen(msg), "invalid db option quorum: %d valid range: [%d, %d]", pCreate->quorum,
...@@ -7052,6 +7083,7 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -7052,6 +7083,7 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
// project query primary column must be timestamp type
if (tscIsProjectionQuery(pQueryInfo)) { if (tscIsProjectionQuery(pQueryInfo)) {
SExprInfo* pExpr = tscExprGet(pQueryInfo, 0); SExprInfo* pExpr = tscExprGet(pQueryInfo, 0);
if (pExpr->base.colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX) { if (pExpr->base.colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX) {
...@@ -7060,7 +7092,7 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -7060,7 +7092,7 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
} else { } else {
if (pQueryInfo->interval.interval == 0) { if (pQueryInfo->interval.interval == 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
} }
} }
// set the created table[stream] name // set the created table[stream] name
...@@ -7731,7 +7763,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7731,7 +7763,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
const char* msg2 = "too many tables in from clause"; 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* 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"; const char* msg4 = "interval query not supported, since the result of sub query not include valid timestamp column";
const char* msg9 = "only tag query not compatible with normal column filter"; const char* msg5 = "only tag query not compatible with normal column filter";
const char* msg6 = "not support stddev/percentile in outer query yet";
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
...@@ -7772,6 +7805,15 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7772,6 +7805,15 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
// todo NOT support yet
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) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
}
}
// validate the query filter condition info // validate the query filter condition info
if (pSqlNode->pWhere != NULL) { if (pSqlNode->pWhere != NULL) {
if (validateWhereNode(pQueryInfo, &pSqlNode->pWhere, pSql) != TSDB_CODE_SUCCESS) { if (validateWhereNode(pQueryInfo, &pSqlNode->pWhere, pSql) != TSDB_CODE_SUCCESS) {
...@@ -7789,7 +7831,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7789,7 +7831,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
if (validateIntervalNode(pSql, pQueryInfo, pSqlNode) != TSDB_CODE_SUCCESS) { if (validateIntervalNode(pSql, pQueryInfo, pSqlNode) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} else { } else {
if (isTimeWindowQuery(pQueryInfo)) { if (isTimeWindowQuery(pQueryInfo) || pQueryInfo->sessionWindow.gap > 0) {
// check if the first column of the nest query result is timestamp column // check if the first column of the nest query result is timestamp column
SColumn* pCol = taosArrayGetP(pQueryInfo->colList, 0); SColumn* pCol = taosArrayGetP(pQueryInfo->colList, 0);
if (pCol->info.type != TSDB_DATA_TYPE_TIMESTAMP) { if (pCol->info.type != TSDB_DATA_TYPE_TIMESTAMP) {
...@@ -7804,10 +7846,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7804,10 +7846,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
// set order by info // set order by info
STableMeta* pTableMeta = tscGetMetaInfo(pQueryInfo, 0)->pTableMeta; STableMeta* pTableMeta = tscGetMetaInfo(pQueryInfo, 0)->pTableMeta;
if (validateOrderbyNode(pCmd, pQueryInfo, pSqlNode, tscGetTableSchema(pTableMeta)) != if (validateOrderbyNode(pCmd, pQueryInfo, pSqlNode, tscGetTableSchema(pTableMeta)) != TSDB_CODE_SUCCESS) {
TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
if ((code = doFunctionsCompatibleCheck(pCmd, pQueryInfo, tscGetErrorMsgPayload(pCmd))) != TSDB_CODE_SUCCESS) {
return code;
}
} else { } else {
pQueryInfo->command = TSDB_SQL_SELECT; pQueryInfo->command = TSDB_SQL_SELECT;
...@@ -7872,11 +7917,6 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7872,11 +7917,6 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
// set interval value // set interval value
if (validateIntervalNode(pSql, pQueryInfo, pSqlNode) != TSDB_CODE_SUCCESS) { if (validateIntervalNode(pSql, pQueryInfo, pSqlNode) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} else {
if (isTimeWindowQuery(pQueryInfo) &&
(validateFunctionsInIntervalOrGroupbyQuery(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
} }
if (tscQueryTags(pQueryInfo)) { if (tscQueryTags(pQueryInfo)) {
...@@ -7887,7 +7927,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7887,7 +7927,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
SColumn* pCols = taosArrayGetP(pQueryInfo->colList, i); SColumn* pCols = taosArrayGetP(pQueryInfo->colList, i);
if (pCols->info.flist.numOfFilters > 0) { if (pCols->info.flist.numOfFilters > 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg9); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5);
} }
} }
} }
...@@ -7907,6 +7947,11 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7907,6 +7947,11 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
if ((isTimeWindowQuery(pQueryInfo) || pQueryInfo->sessionWindow.gap > 0) &&
(validateFunctionsInIntervalOrGroupbyQuery(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
if (isSTable) { if (isSTable) {
tscTansformFuncForSTableQuery(pQueryInfo); tscTansformFuncForSTableQuery(pQueryInfo);
if (hasUnsupportFunctionsForSTableQuery(pCmd, pQueryInfo)) { if (hasUnsupportFunctionsForSTableQuery(pCmd, pQueryInfo)) {
...@@ -7936,7 +7981,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7936,7 +7981,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
return code; return code;
} }
if ((code = doFunctionsCompatibleCheck(pCmd, pQueryInfo)) != TSDB_CODE_SUCCESS) { if ((code = doFunctionsCompatibleCheck(pCmd, pQueryInfo,tscGetErrorMsgPayload(pCmd))) != TSDB_CODE_SUCCESS) {
return code; return code;
} }
......
...@@ -912,7 +912,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -912,7 +912,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} }
SGroupbyExpr *pGroupbyExpr = query.pGroupbyExpr; SGroupbyExpr *pGroupbyExpr = query.pGroupbyExpr;
if (pGroupbyExpr->numOfGroupCols > 0) { if (pGroupbyExpr != NULL && pGroupbyExpr->numOfGroupCols > 0) {
pQueryMsg->orderByIdx = htons(pGroupbyExpr->orderIndex); pQueryMsg->orderByIdx = htons(pGroupbyExpr->orderIndex);
pQueryMsg->orderType = htons(pGroupbyExpr->orderType); pQueryMsg->orderType = htons(pGroupbyExpr->orderType);
......
...@@ -139,8 +139,13 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) { ...@@ -139,8 +139,13 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
pStream->numOfRes = 0; // reset the numOfRes. pStream->numOfRes = 0; // reset the numOfRes.
SSqlObj *pSql = pStream->pSql; SSqlObj *pSql = pStream->pSql;
// pSql == NULL maybe killStream already called
if(pSql == NULL) {
return ;
}
SQueryInfo* pQueryInfo = tscGetQueryInfo(&pSql->cmd); SQueryInfo* pQueryInfo = tscGetQueryInfo(&pSql->cmd);
tscDebug("0x%"PRIx64" timer launch query", pSql->self); tscDebug("0x%"PRIx64" add into timer", pSql->self);
if (pStream->isProject) { if (pStream->isProject) {
/* /*
...@@ -339,8 +344,12 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer) ...@@ -339,8 +344,12 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
if (pStream->isProject) { if (pStream->isProject) {
int64_t now = taosGetTimestamp(pStream->precision); int64_t now = taosGetTimestamp(pStream->precision);
int64_t etime = now > pStream->etime ? pStream->etime : now; int64_t etime = now > pStream->etime ? pStream->etime : now;
int64_t maxRetent = tsMaxRetentWindow * 1000;
if (pStream->etime < now && now - pStream->etime > tsMaxRetentWindow) { if(pStream->precision == TSDB_TIME_PRECISION_MICRO) {
maxRetent *= 1000;
}
if (pStream->etime < now && now - pStream->etime > maxRetent) {
/* /*
* current time window will be closed, since it too early to exceed the maxRetentWindow value * current time window will be closed, since it too early to exceed the maxRetentWindow value
*/ */
...@@ -664,7 +673,7 @@ void cbParseSql(void* param, TAOS_RES* res, int code) { ...@@ -664,7 +673,7 @@ void cbParseSql(void* param, TAOS_RES* res, int code) {
} }
TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const char *sqlstr, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const char *sqlstr, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row),
int64_t stime, void *param, void (*callback)(void *)) { int64_t stime, void *param, void (*callback)(void *), void* cqhandle) {
STscObj *pObj = (STscObj *)taos; STscObj *pObj = (STscObj *)taos;
if (pObj == NULL || pObj->signature != pObj) return NULL; if (pObj == NULL || pObj->signature != pObj) return NULL;
...@@ -697,6 +706,7 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c ...@@ -697,6 +706,7 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c
pStream->callback = callback; pStream->callback = callback;
pStream->param = param; pStream->param = param;
pStream->pSql = pSql; pStream->pSql = pSql;
pStream->cqhandle = cqhandle;
pSql->pStream = pStream; pSql->pStream = pStream;
pSql->param = pStream; pSql->param = pStream;
pSql->maxRetry = TSDB_MAX_REPLICA; pSql->maxRetry = TSDB_MAX_REPLICA;
...@@ -745,7 +755,7 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c ...@@ -745,7 +755,7 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c
TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row),
int64_t stime, void *param, void (*callback)(void *)) { int64_t stime, void *param, void (*callback)(void *)) {
return taos_open_stream_withname(taos, "", sqlstr, fp, stime, param, callback); return taos_open_stream_withname(taos, "", sqlstr, fp, stime, param, callback, NULL);
} }
void taos_close_stream(TAOS_STREAM *handle) { void taos_close_stream(TAOS_STREAM *handle) {
......
...@@ -255,10 +255,14 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo) { ...@@ -255,10 +255,14 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo) {
size_t size = tscNumOfExprs(pQueryInfo); size_t size = tscNumOfExprs(pQueryInfo);
for (int32_t i = 0; i < size; ++i) { for (int32_t i = 0; i < size; ++i) {
int32_t functionId = tscExprGet(pQueryInfo, i)->base.functionId; int32_t f = tscExprGet(pQueryInfo, i)->base.functionId;
if (f == TSDB_FUNC_TS_DUMMY) {
continue;
}
if (functionId != TSDB_FUNC_PRJ && functionId != TSDB_FUNC_TAGPRJ && functionId != TSDB_FUNC_TAG && if (f != TSDB_FUNC_PRJ && f != TSDB_FUNC_TAGPRJ && f != TSDB_FUNC_TAG &&
functionId != TSDB_FUNC_TS && functionId != TSDB_FUNC_ARITHM) { f != TSDB_FUNC_TS && f != TSDB_FUNC_ARITHM && f != TSDB_FUNC_DIFF &&
f != TSDB_FUNC_DERIVATIVE) {
return false; return false;
} }
} }
...@@ -266,6 +270,24 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo) { ...@@ -266,6 +270,24 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo) {
return true; return true;
} }
bool tscIsDiffDerivQuery(SQueryInfo* pQueryInfo) {
size_t size = tscNumOfExprs(pQueryInfo);
for (int32_t i = 0; i < size; ++i) {
int32_t f = tscExprGet(pQueryInfo, i)->base.functionId;
if (f == TSDB_FUNC_TS_DUMMY) {
continue;
}
if (f == TSDB_FUNC_DIFF || f == TSDB_FUNC_DERIVATIVE) {
return true;
}
}
return false;
}
bool tscHasColumnFilter(SQueryInfo* pQueryInfo) { bool tscHasColumnFilter(SQueryInfo* pQueryInfo) {
// filter on primary timestamp column // filter on primary timestamp column
if (pQueryInfo->window.skey != INT64_MIN || pQueryInfo->window.ekey != INT64_MAX) { if (pQueryInfo->window.skey != INT64_MIN || pQueryInfo->window.ekey != INT64_MAX) {
...@@ -962,6 +984,9 @@ static void destroyDummyInputOperator(void* param, int32_t numOfOutput) { ...@@ -962,6 +984,9 @@ static void destroyDummyInputOperator(void* param, int32_t numOfOutput) {
pInfo->block = destroyOutputBuf(pInfo->block); pInfo->block = destroyOutputBuf(pInfo->block);
pInfo->pSql = NULL; pInfo->pSql = NULL;
cleanupResultRowInfo(&pInfo->pTableQueryInfo->resInfo);
tfree(pInfo->pTableQueryInfo);
} }
// todo this operator servers as the adapter for Operator tree and SqlRes result, remove it later // todo this operator servers as the adapter for Operator tree and SqlRes result, remove it later
...@@ -4263,10 +4288,9 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt ...@@ -4263,10 +4288,9 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt
STableMetaInfo* pTableMetaInfo = pQueryInfo->pTableMetaInfo[0]; STableMetaInfo* pTableMetaInfo = pQueryInfo->pTableMetaInfo[0];
pQueryAttr->pGroupbyExpr = calloc(1, sizeof(SGroupbyExpr));
*(pQueryAttr->pGroupbyExpr) = pQueryInfo->groupbyExpr;
if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) { if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) {
pQueryAttr->pGroupbyExpr = calloc(1, sizeof(SGroupbyExpr));
*(pQueryAttr->pGroupbyExpr) = pQueryInfo->groupbyExpr;
pQueryAttr->pGroupbyExpr->columnInfo = taosArrayDup(pQueryInfo->groupbyExpr.columnInfo); pQueryAttr->pGroupbyExpr->columnInfo = taosArrayDup(pQueryInfo->groupbyExpr.columnInfo);
} else { } else {
assert(pQueryInfo->groupbyExpr.columnInfo == NULL); assert(pQueryInfo->groupbyExpr.columnInfo == NULL);
...@@ -4345,7 +4369,7 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt ...@@ -4345,7 +4369,7 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
if (pQueryAttr->pGroupbyExpr->numOfGroupCols < 0) { if (pQueryAttr->pGroupbyExpr != NULL && pQueryAttr->pGroupbyExpr->numOfGroupCols < 0) {
tscError("%p illegal value of numOfGroupCols in query msg: %d", addr, pQueryInfo->groupbyExpr.numOfGroupCols); tscError("%p illegal value of numOfGroupCols in query msg: %d", addr, pQueryInfo->groupbyExpr.numOfGroupCols);
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
......
...@@ -831,6 +831,16 @@ static void doInitGlobalConfig(void) { ...@@ -831,6 +831,16 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosInitConfigOption(cfg);
cfg.option = "precision";
cfg.ptr = &tsTimePrecision;
cfg.valType = TAOS_CFG_VTYPE_INT8;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = TSDB_MIN_PRECISION;
cfg.maxValue = TSDB_MAX_PRECISION;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "comp"; cfg.option = "comp";
cfg.ptr = &tsCompression; cfg.ptr = &tsCompression;
cfg.valType = TAOS_CFG_VTYPE_INT8; cfg.valType = TAOS_CFG_VTYPE_INT8;
...@@ -901,6 +911,16 @@ static void doInitGlobalConfig(void) { ...@@ -901,6 +911,16 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosInitConfigOption(cfg);
cfg.option = "cachelast";
cfg.ptr = &tsCacheLastRow;
cfg.valType = TAOS_CFG_VTYPE_INT8;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = TSDB_MIN_DB_CACHE_LAST_ROW;
cfg.maxValue = TSDB_MAX_DB_CACHE_LAST_ROW;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "mqttHostName"; cfg.option = "mqttHostName";
cfg.ptr = tsMqttHostName; cfg.ptr = tsMqttHostName;
cfg.valType = TAOS_CFG_VTYPE_STRING; cfg.valType = TAOS_CFG_VTYPE_STRING;
......
...@@ -74,7 +74,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) { ...@@ -74,7 +74,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case TSDB_DATA_TYPE_BINARY: { case TSDB_DATA_TYPE_BINARY: {
pVar->pz = strndup(token->z, token->n); pVar->pz = strndup(token->z, token->n);
pVar->nLen = strdequote(pVar->pz); pVar->nLen = strRmquote(pVar->pz, token->n);
break; break;
} }
......
...@@ -303,7 +303,7 @@ public class TSDBPreparedStatementTest { ...@@ -303,7 +303,7 @@ public class TSDBPreparedStatementTest {
stmt.execute("create database dbtest"); stmt.execute("create database dbtest");
Assert.assertThrows(SQLException.class, () -> stmt.execute("create database dbtest")); Assert.assertThrows(SQLException.class, () -> stmt.execute("create database dbtest"));
} }
@Test @Test
public void setBoolean() throws SQLException { public void setBoolean() throws SQLException {
// given // given
......
...@@ -177,7 +177,8 @@ public class TSDBResultSetTest { ...@@ -177,7 +177,8 @@ public class TSDBResultSetTest {
rs.getAsciiStream("f1"); rs.getAsciiStream("f1");
} }
@Test(expected = SQLFeatureNotSupportedException.class) @SuppressWarnings("deprecation")
@Test(expected = SQLFeatureNotSupportedException.class)
public void getUnicodeStream() throws SQLException { public void getUnicodeStream() throws SQLException {
rs.getUnicodeStream("f1"); rs.getUnicodeStream("f1");
} }
......
...@@ -242,7 +242,7 @@ def _load_taos_linux(): ...@@ -242,7 +242,7 @@ def _load_taos_linux():
def _load_taos_darwin(): def _load_taos_darwin():
return ctypes.cDLL('libtaos.dylib') return ctypes.CDLL('libtaos.dylib')
def _load_taos_windows(): def _load_taos_windows():
......
...@@ -38,21 +38,6 @@ ...@@ -38,21 +38,6 @@
#define cDebug(...) { if (cqDebugFlag & DEBUG_DEBUG) { taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__); }} #define cDebug(...) { if (cqDebugFlag & DEBUG_DEBUG) { taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__); }}
#define cTrace(...) { if (cqDebugFlag & DEBUG_TRACE) { taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__); }} #define cTrace(...) { if (cqDebugFlag & DEBUG_TRACE) { taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__); }}
typedef struct {
int32_t vgId;
int32_t master;
int32_t num; // number of continuous streams
char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
char db[TSDB_DB_NAME_LEN];
FCqWrite cqWrite;
struct SCqObj *pHead;
void *dbConn;
void *tmrCtrl;
pthread_mutex_t mutex;
int32_t delete;
int32_t cqObjNum;
} SCqContext;
typedef struct SCqObj { typedef struct SCqObj {
tmr_h tmrId; tmr_h tmrId;
...@@ -439,7 +424,7 @@ static void cqProcessCreateTimer(void *param, void *tmrId) { ...@@ -439,7 +424,7 @@ static void cqProcessCreateTimer(void *param, void *tmrId) {
// inner implement in tscStream.c // inner implement in tscStream.c
TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* desName, const char *sqlstr, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* desName, const char *sqlstr, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row),
int64_t stime, void *param, void (*callback)(void *)); int64_t stime, void *param, void (*callback)(void *), void* cqhandle);
static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) { static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) {
pObj->pContext = pContext; pObj->pContext = pContext;
...@@ -453,7 +438,8 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) { ...@@ -453,7 +438,8 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) {
pObj->tmrId = 0; pObj->tmrId = 0;
if (pObj->pStream == NULL) { if (pObj->pStream == NULL) {
pObj->pStream = taos_open_stream_withname(pContext->dbConn, pObj->dstTable, pObj->sqlStr, cqProcessStreamRes, INT64_MIN, (void *)pObj->rid, NULL); pObj->pStream = taos_open_stream_withname(pContext->dbConn, pObj->dstTable, pObj->sqlStr, cqProcessStreamRes, \
INT64_MIN, (void *)pObj->rid, NULL, pContext);
// TODO the pObj->pStream may be released if error happens // TODO the pObj->pStream may be released if error happens
if (pObj->pStream) { if (pObj->pStream) {
......
...@@ -31,6 +31,23 @@ typedef struct { ...@@ -31,6 +31,23 @@ typedef struct {
FCqWrite cqWrite; FCqWrite cqWrite;
} SCqCfg; } SCqCfg;
// SCqContext
typedef struct {
int32_t vgId;
int32_t master;
int32_t num; // number of continuous streams
char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
char db[TSDB_DB_NAME_LEN];
FCqWrite cqWrite;
struct SCqObj *pHead;
void *dbConn;
void *tmrCtrl;
pthread_mutex_t mutex;
int32_t delete;
int32_t cqObjNum;
} SCqContext;
// the following API shall be called by vnode // the following API shall be called by vnode
void *cqOpen(void *ahandle, const SCqCfg *pCfg); void *cqOpen(void *ahandle, const SCqCfg *pCfg);
void cqClose(void *handle); void cqClose(void *handle);
......
...@@ -94,7 +94,7 @@ STsdbRepo *tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH); ...@@ -94,7 +94,7 @@ STsdbRepo *tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH);
int tsdbCloseRepo(STsdbRepo *repo, int toCommit); int tsdbCloseRepo(STsdbRepo *repo, int toCommit);
int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg); int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg);
int tsdbGetState(STsdbRepo *repo); int tsdbGetState(STsdbRepo *repo);
bool tsdbInCompact(STsdbRepo *repo);
// --------- TSDB TABLE DEFINITION // --------- TSDB TABLE DEFINITION
typedef struct { typedef struct {
uint64_t uid; // the unique table ID uint64_t uid; // the unique table ID
......
...@@ -625,6 +625,10 @@ static int64_t g_totalChildTables = 0; ...@@ -625,6 +625,10 @@ static int64_t g_totalChildTables = 0;
static SQueryMetaInfo g_queryInfo; static SQueryMetaInfo g_queryInfo;
static FILE * g_fpOfInsertResult = NULL; static FILE * g_fpOfInsertResult = NULL;
#if _MSC_VER <= 1900
#define __func__ __FUNCTION__
#endif
#define debugPrint(fmt, ...) \ #define debugPrint(fmt, ...) \
do { if (g_args.debug_print || g_args.verbose_print) \ do { if (g_args.debug_print || g_args.verbose_print) \
fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0) fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0)
...@@ -1209,7 +1213,6 @@ static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) { ...@@ -1209,7 +1213,6 @@ static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) {
} }
int totalLen = 0; int totalLen = 0;
char temp[16000];
// fetch the records row by row // fetch the records row by row
while((row = taos_fetch_row(res))) { while((row = taos_fetch_row(res))) {
...@@ -1220,6 +1223,7 @@ static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) { ...@@ -1220,6 +1223,7 @@ static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) {
memset(databuf, 0, 100*1024*1024); memset(databuf, 0, 100*1024*1024);
} }
num_rows++; num_rows++;
char temp[16000] = {0};
int len = taos_print_row(temp, row, fields, num_fields); int len = taos_print_row(temp, row, fields, num_fields);
len += sprintf(temp + len, "\n"); len += sprintf(temp + len, "\n");
//printf("query result:%s\n", temp); //printf("query result:%s\n", temp);
......
...@@ -59,6 +59,9 @@ bool taosMbsToUcs4(char *mbs, size_t mbsLength, char *ucs4, int32_t ucs4_max_len ...@@ -59,6 +59,9 @@ bool taosMbsToUcs4(char *mbs, size_t mbsLength, char *ucs4, int32_t ucs4_max_len
iconv_close(cd); iconv_close(cd);
if (len != NULL) { if (len != NULL) {
*len = (int32_t)(ucs4_max_len - outLeft); *len = (int32_t)(ucs4_max_len - outLeft);
if (*len < 0) {
return false;
}
} }
return true; return true;
......
...@@ -464,6 +464,7 @@ typedef struct SSWindowOperatorInfo { ...@@ -464,6 +464,7 @@ typedef struct SSWindowOperatorInfo {
TSKEY prevTs; // previous timestamp TSKEY prevTs; // previous timestamp
int32_t numOfRows; // number of rows int32_t numOfRows; // number of rows
int32_t start; // start row index int32_t start; // start row index
bool reptScan; // next round scan
} SSWindowOperatorInfo; } SSWindowOperatorInfo;
typedef struct SStateWindowOperatorInfo { typedef struct SStateWindowOperatorInfo {
...@@ -473,7 +474,7 @@ typedef struct SStateWindowOperatorInfo { ...@@ -473,7 +474,7 @@ typedef struct SStateWindowOperatorInfo {
int32_t colIndex; // start row index int32_t colIndex; // start row index
int32_t start; int32_t start;
char* prevData; // previous data char* prevData; // previous data
bool reptScan;
} SStateWindowOperatorInfo ; } SStateWindowOperatorInfo ;
typedef struct SDistinctOperatorInfo { typedef struct SDistinctOperatorInfo {
......
...@@ -559,10 +559,8 @@ session_option(X) ::= SESSION LP ids(V) cpxName(Z) COMMA tmvar(Y) RP. { ...@@ -559,10 +559,8 @@ session_option(X) ::= SESSION LP ids(V) cpxName(Z) COMMA tmvar(Y) RP. {
X.gap = Y; X.gap = Y;
} }
%type windowstate_option {SWindowStateVal} %type windowstate_option {SWindowStateVal}
windowstate_option(X) ::= . {X.col.n = 0;} windowstate_option(X) ::= . { X.col.n = 0; X.col.z = NULL;}
windowstate_option(X) ::= STATE_WINDOW LP ids(V) RP. { windowstate_option(X) ::= STATE_WINDOW LP ids(V) RP. { X.col = V; }
X.col = V;
}
%type fill_opt {SArray*} %type fill_opt {SArray*}
%destructor fill_opt {taosArrayDestroy($$);} %destructor fill_opt {taosArrayDestroy($$);}
......
...@@ -3428,7 +3428,7 @@ static bool deriv_function_setup(SQLFunctionCtx *pCtx) { ...@@ -3428,7 +3428,7 @@ static bool deriv_function_setup(SQLFunctionCtx *pCtx) {
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
SDerivInfo* pDerivInfo = GET_ROWCELL_INTERBUF(pResInfo); SDerivInfo* pDerivInfo = GET_ROWCELL_INTERBUF(pResInfo);
pDerivInfo->ignoreNegative = pCtx->param[2].i64; pDerivInfo->ignoreNegative = pCtx->param[1].i64;
pDerivInfo->prevTs = -1; pDerivInfo->prevTs = -1;
pDerivInfo->tsWindow = pCtx->param[0].i64; pDerivInfo->tsWindow = pCtx->param[0].i64;
pDerivInfo->valueSet = false; pDerivInfo->valueSet = false;
...@@ -3440,10 +3440,8 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3440,10 +3440,8 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
SDerivInfo* pDerivInfo = GET_ROWCELL_INTERBUF(pResInfo); SDerivInfo* pDerivInfo = GET_ROWCELL_INTERBUF(pResInfo);
void *data = GET_INPUT_DATA_LIST(pCtx); void *data = GET_INPUT_DATA_LIST(pCtx);
bool isFirstBlock = (pDerivInfo->valueSet == false);
int32_t notNullElems = 0; int32_t notNullElems = 0;
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pCtx->order); int32_t step = GET_FORWARD_DIRECTION_FACTOR(pCtx->order);
int32_t i = (pCtx->order == TSDB_ORDER_ASC) ? 0 : pCtx->size - 1; int32_t i = (pCtx->order == TSDB_ORDER_ASC) ? 0 : pCtx->size - 1;
...@@ -3469,12 +3467,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3469,12 +3467,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
*pTimestamp = tsList[i]; *pTimestamp = tsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
notNullElems++;
} }
} }
pDerivInfo->prevValue = pData[i]; pDerivInfo->prevValue = pData[i];
pDerivInfo->prevTs = tsList[i]; pDerivInfo->prevTs = tsList[i];
notNullElems++;
} }
break; break;
...@@ -3496,12 +3494,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3496,12 +3494,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
*pTimestamp = tsList[i]; *pTimestamp = tsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
notNullElems++;
} }
} }
pDerivInfo->prevValue = (double) pData[i]; pDerivInfo->prevValue = (double) pData[i];
pDerivInfo->prevTs = tsList[i]; pDerivInfo->prevTs = tsList[i];
notNullElems++;
} }
break; break;
} }
...@@ -3522,12 +3520,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3522,12 +3520,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
*pTimestamp = tsList[i]; *pTimestamp = tsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
notNullElems++;
} }
} }
pDerivInfo->prevValue = pData[i]; pDerivInfo->prevValue = pData[i];
pDerivInfo->prevTs = tsList[i]; pDerivInfo->prevTs = tsList[i];
notNullElems++;
} }
break; break;
} }
...@@ -3549,12 +3547,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3549,12 +3547,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
*pTimestamp = tsList[i]; *pTimestamp = tsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
notNullElems++;
} }
} }
pDerivInfo->prevValue = pData[i]; pDerivInfo->prevValue = pData[i];
pDerivInfo->prevTs = tsList[i]; pDerivInfo->prevTs = tsList[i];
notNullElems++;
} }
break; break;
} }
...@@ -3575,12 +3573,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3575,12 +3573,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
*pTimestamp = tsList[i]; *pTimestamp = tsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
notNullElems++;
} }
} }
pDerivInfo->prevValue = pData[i]; pDerivInfo->prevValue = pData[i];
pDerivInfo->prevTs = tsList[i]; pDerivInfo->prevTs = tsList[i];
notNullElems++;
} }
break; break;
} }
...@@ -3602,12 +3600,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3602,12 +3600,12 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
notNullElems++;
} }
} }
pDerivInfo->prevValue = pData[i]; pDerivInfo->prevValue = pData[i];
pDerivInfo->prevTs = tsList[i]; pDerivInfo->prevTs = tsList[i];
notNullElems++;
} }
break; break;
} }
...@@ -3623,8 +3621,7 @@ static void deriv_function(SQLFunctionCtx *pCtx) { ...@@ -3623,8 +3621,7 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
*/ */
assert(pCtx->hasNull); assert(pCtx->hasNull);
} else { } else {
int32_t forwardStep = (isFirstBlock) ? notNullElems - 1 : notNullElems; GET_RES_INFO(pCtx)->numOfRes += notNullElems;
GET_RES_INFO(pCtx)->numOfRes += forwardStep;
} }
} }
...@@ -4687,8 +4684,8 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx) { ...@@ -4687,8 +4684,8 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx) {
pInfo->correctionValue = 0; pInfo->correctionValue = 0;
pInfo->firstKey = INT64_MIN; pInfo->firstKey = INT64_MIN;
pInfo->lastKey = INT64_MIN; pInfo->lastKey = INT64_MIN;
pInfo->firstValue = INT64_MIN; pInfo->firstValue = (double) INT64_MIN;
pInfo->lastValue = INT64_MIN; pInfo->lastValue = (double) INT64_MIN;
pInfo->hasResult = 0; pInfo->hasResult = 0;
pInfo->isIRate = (pCtx->functionId == TSDB_FUNC_IRATE); pInfo->isIRate = (pCtx->functionId == TSDB_FUNC_IRATE);
...@@ -5003,6 +5000,19 @@ void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) { ...@@ -5003,6 +5000,19 @@ void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) {
min = totalBlocks > 0 ? pTableBlockDist->minRows : 0; min = totalBlocks > 0 ? pTableBlockDist->minRows : 0;
max = totalBlocks > 0 ? pTableBlockDist->maxRows : 0; max = totalBlocks > 0 ? pTableBlockDist->maxRows : 0;
double stdDev = 0;
if (totalBlocks > 0) {
double variance = 0;
for (int32_t i = 0; i < numSteps; i++) {
SFileBlockInfo *blockInfo = taosArrayGet(blockInfos, i);
int64_t blocks = blockInfo->numBlocksOfStep;
int32_t rows = (i * TSDB_BLOCK_DIST_STEP_ROWS + TSDB_BLOCK_DIST_STEP_ROWS / 2);
variance += blocks * (rows - avg) * (rows - avg);
}
variance = variance / totalBlocks;
stdDev = sqrt(variance);
}
double percents[] = {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 0.95, 0.99}; double percents[] = {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 0.95, 0.99};
int32_t percentiles[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; int32_t percentiles[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
assert(sizeof(percents)/sizeof(double) == sizeof(percentiles)/sizeof(int32_t)); assert(sizeof(percents)/sizeof(double) == sizeof(percentiles)/sizeof(int32_t));
...@@ -5017,12 +5027,12 @@ void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) { ...@@ -5017,12 +5027,12 @@ void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) {
"60th=[%d], 70th=[%d], 80th=[%d], 90th=[%d], 95th=[%d], 99th=[%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 " "Min=[%"PRId64"(Rows)] Max=[%"PRId64"(Rows)] Avg=[%"PRId64"(Rows)] Stddev=[%.2f] \n\t "
"Rows=[%"PRIu64"], Blocks=[%"PRId64"], Size=[%.3f(Kb)] Comp=[%.2f]\n\t " "Rows=[%"PRIu64"], Blocks=[%"PRId64"], Size=[%.3f(Kb)] Comp=[%.2f]\n\t "
"RowsInMem=[%d] \n\t SeekHeaderTime=[%d(us)]", "RowsInMem=[%d] \n\t",
percentiles[0], percentiles[1], percentiles[2], percentiles[3], percentiles[4], percentiles[5], percentiles[0], percentiles[1], percentiles[2], percentiles[3], percentiles[4], percentiles[5],
percentiles[6], percentiles[7], percentiles[8], percentiles[9], percentiles[10], percentiles[11], percentiles[6], percentiles[7], percentiles[8], percentiles[9], percentiles[10], percentiles[11],
min, max, avg, 0.0, min, max, avg, stdDev,
totalRows, totalBlocks, totalLen/1024.0, compRatio, totalRows, totalBlocks, totalLen/1024.0, compRatio,
pTableBlockDist->numOfRowsInMemTable, pTableBlockDist->firstSeekTimeUs); pTableBlockDist->numOfRowsInMemTable);
varDataSetLen(result, sz); varDataSetLen(result, sz);
UNUSED(sz); UNUSED(sz);
} }
...@@ -5290,7 +5300,7 @@ SAggFunctionInfo aAggs[] = {{ ...@@ -5290,7 +5300,7 @@ SAggFunctionInfo aAggs[] = {{
}, },
{ {
// 17 // 17
"ts_dummy", "ts",
TSDB_FUNC_TS_DUMMY, TSDB_FUNC_TS_DUMMY,
TSDB_FUNC_TS_DUMMY, TSDB_FUNC_TS_DUMMY,
TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_NEED_TS, TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_NEED_TS,
...@@ -5384,7 +5394,7 @@ SAggFunctionInfo aAggs[] = {{ ...@@ -5384,7 +5394,7 @@ SAggFunctionInfo aAggs[] = {{
"diff", "diff",
TSDB_FUNC_DIFF, TSDB_FUNC_DIFF,
TSDB_FUNC_INVALID_ID, TSDB_FUNC_INVALID_ID,
TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS, TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS | TSDB_FUNCSTATE_SELECTIVITY,
diff_function_setup, diff_function_setup,
diff_function, diff_function,
diff_function_f, diff_function_f,
...@@ -5488,7 +5498,7 @@ SAggFunctionInfo aAggs[] = {{ ...@@ -5488,7 +5498,7 @@ SAggFunctionInfo aAggs[] = {{
"derivative", // return table id and the corresponding tags for join match and subscribe "derivative", // return table id and the corresponding tags for join match and subscribe
TSDB_FUNC_DERIVATIVE, TSDB_FUNC_DERIVATIVE,
TSDB_FUNC_INVALID_ID, TSDB_FUNC_INVALID_ID,
TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS, TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS | TSDB_FUNCSTATE_SELECTIVITY,
deriv_function_setup, deriv_function_setup,
deriv_function, deriv_function,
noop2, noop2,
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define IS_MASTER_SCAN(runtime) ((runtime)->scanFlag == MASTER_SCAN) #define IS_MASTER_SCAN(runtime) ((runtime)->scanFlag == MASTER_SCAN)
#define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == REVERSE_SCAN) #define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == REVERSE_SCAN)
#define IS_REPEAT_SCAN(runtime) ((runtime)->scanFlag == REPEAT_SCAN)
#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN) #define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN)
#define SET_REVERSE_SCAN_FLAG(runtime) ((runtime)->scanFlag = REVERSE_SCAN) #define SET_REVERSE_SCAN_FLAG(runtime) ((runtime)->scanFlag = REVERSE_SCAN)
...@@ -735,6 +736,7 @@ static void doApplyFunctions(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx ...@@ -735,6 +736,7 @@ static void doApplyFunctions(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx
if (pCtx[k].preAggVals.isSet && forwardStep < numOfTotal) { if (pCtx[k].preAggVals.isSet && forwardStep < numOfTotal) {
pCtx[k].preAggVals.isSet = false; pCtx[k].preAggVals.isSet = false;
} }
if (functionNeedToExecute(pRuntimeEnv, &pCtx[k], functionId)) { if (functionNeedToExecute(pRuntimeEnv, &pCtx[k], functionId)) {
aAggs[functionId].xFunction(&pCtx[k]); aAggs[functionId].xFunction(&pCtx[k]);
} }
...@@ -918,7 +920,7 @@ void setInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, SSDataBlo ...@@ -918,7 +920,7 @@ void setInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, SSDataBlo
doSetInputDataBlockInfo(pOperator, pCtx, pBlock, order); doSetInputDataBlockInfo(pOperator, pCtx, pBlock, order);
} }
} else { } else {
if (pCtx[0].pInput == NULL && pBlock->pDataBlock != NULL) { if (/*pCtx[0].pInput == NULL && */pBlock->pDataBlock != NULL) {
doSetInputDataBlock(pOperator, pCtx, pBlock, order); doSetInputDataBlock(pOperator, pCtx, pBlock, order);
} else { } else {
doSetInputDataBlockInfo(pOperator, pCtx, pBlock, order); doSetInputDataBlockInfo(pOperator, pCtx, pBlock, order);
...@@ -1169,7 +1171,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ...@@ -1169,7 +1171,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
SQueryRuntimeEnv* pRuntimeEnv = pOperatorInfo->pRuntimeEnv; SQueryRuntimeEnv* pRuntimeEnv = pOperatorInfo->pRuntimeEnv;
int32_t numOfOutput = pOperatorInfo->numOfOutput; int32_t numOfOutput = pOperatorInfo->numOfOutput;
SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQueryAttr->order.order); int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQueryAttr->order.order);
bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr);
...@@ -1336,6 +1338,10 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf ...@@ -1336,6 +1338,10 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
int64_t gap = pOperator->pRuntimeEnv->pQueryAttr->sw.gap; int64_t gap = pOperator->pRuntimeEnv->pQueryAttr->sw.gap;
pInfo->numOfRows = 0; pInfo->numOfRows = 0;
if (IS_REPEAT_SCAN(pRuntimeEnv) && !pInfo->reptScan) {
pInfo->reptScan = true;
pInfo->prevTs = INT64_MIN;
}
TSKEY* tsList = (TSKEY*)pColInfoData->pData; TSKEY* tsList = (TSKEY*)pColInfoData->pData;
for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) { for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) {
...@@ -1345,7 +1351,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf ...@@ -1345,7 +1351,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
pInfo->prevTs = tsList[j]; pInfo->prevTs = tsList[j];
pInfo->numOfRows = 1; pInfo->numOfRows = 1;
pInfo->start = j; pInfo->start = j;
} else if (tsList[j] - pInfo->prevTs <= gap) { } else if (tsList[j] - pInfo->prevTs <= gap && (tsList[j] - pInfo->prevTs) >= 0) {
pInfo->curWindow.ekey = tsList[j]; pInfo->curWindow.ekey = tsList[j];
pInfo->prevTs = tsList[j]; pInfo->prevTs = tsList[j];
pInfo->numOfRows += 1; pInfo->numOfRows += 1;
...@@ -1681,8 +1687,6 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf ...@@ -1681,8 +1687,6 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr; SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
pRuntimeEnv->prevGroupId = INT32_MIN; pRuntimeEnv->prevGroupId = INT32_MIN;
pRuntimeEnv->enableGroupData = false;
pRuntimeEnv->pQueryAttr = pQueryAttr; pRuntimeEnv->pQueryAttr = pQueryAttr;
pRuntimeEnv->pResultRowHashTable = taosHashInit(numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); pRuntimeEnv->pResultRowHashTable = taosHashInit(numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
...@@ -3094,7 +3098,7 @@ int32_t initResultRow(SResultRow *pResultRow) { ...@@ -3094,7 +3098,7 @@ int32_t initResultRow(SResultRow *pResultRow) {
* +------------+-----------------result column 1-----------+-----------------result column 2-----------+ * +------------+-----------------result column 1-----------+-----------------result column 2-----------+
* + SResultRow | SResultRowCellInfo | intermediate buffer1 | SResultRowCellInfo | intermediate buffer 2| * + SResultRow | SResultRowCellInfo | intermediate buffer1 | SResultRowCellInfo | intermediate buffer 2|
* +------------+-------------------------------------------+-------------------------------------------+ * +------------+-------------------------------------------+-------------------------------------------+
* offset[0] offset[1] * offset[0] offset[1] offset[2]
*/ */
void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, int64_t uid, int32_t stage) { void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, int64_t uid, int32_t stage) {
SQLFunctionCtx* pCtx = pInfo->pCtx; SQLFunctionCtx* pCtx = pInfo->pCtx;
...@@ -3323,7 +3327,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe ...@@ -3323,7 +3327,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe
offset += pCtx[i].outputBytes; offset += pCtx[i].outputBytes;
int32_t functionId = pCtx[i].functionId; int32_t functionId = pCtx[i].functionId;
if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF) { if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_DERIVATIVE) {
pCtx[i].ptsOutputBuf = pCtx[0].pOutput; pCtx[i].ptsOutputBuf = pCtx[0].pOutput;
} }
...@@ -3381,7 +3385,7 @@ void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult, SQLF ...@@ -3381,7 +3385,7 @@ void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult, SQLF
offset += pCtx[i].outputBytes; offset += pCtx[i].outputBytes;
int32_t functionId = pCtx[i].functionId; int32_t functionId = pCtx[i].functionId;
if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF) { if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_DERIVATIVE) {
pCtx[i].ptsOutputBuf = pCtx[0].pOutput; pCtx[i].ptsOutputBuf = pCtx[0].pOutput;
} }
...@@ -3589,6 +3593,8 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo* ...@@ -3589,6 +3593,8 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
int32_t step = -1; int32_t step = -1;
qDebug("QInfo:0x%"PRIx64" start to copy data from windowResInfo to output buf", GET_QID(pRuntimeEnv)); qDebug("QInfo:0x%"PRIx64" start to copy data from windowResInfo to output buf", GET_QID(pRuntimeEnv));
assert(orderType == TSDB_ORDER_ASC || orderType == TSDB_ORDER_DESC);
if (orderType == TSDB_ORDER_ASC) { if (orderType == TSDB_ORDER_ASC) {
start = pGroupResInfo->index; start = pGroupResInfo->index;
step = 1; step = 1;
...@@ -4115,6 +4121,7 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr ...@@ -4115,6 +4121,7 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
pQueryAttr->interBufSize = getOutputInterResultBufSize(pQueryAttr); pQueryAttr->interBufSize = getOutputInterResultBufSize(pQueryAttr);
pRuntimeEnv->groupResInfo.totalGroup = (int32_t) (pQueryAttr->stableQuery? GET_NUM_OF_TABLEGROUP(pRuntimeEnv):0); pRuntimeEnv->groupResInfo.totalGroup = (int32_t) (pQueryAttr->stableQuery? GET_NUM_OF_TABLEGROUP(pRuntimeEnv):0);
pRuntimeEnv->enableGroupData = false;
pRuntimeEnv->pQueryAttr = pQueryAttr; pRuntimeEnv->pQueryAttr = pQueryAttr;
pRuntimeEnv->pTsBuf = pTsBuf; pRuntimeEnv->pTsBuf = pTsBuf;
...@@ -4570,7 +4577,7 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime ...@@ -4570,7 +4577,7 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime
} }
SArray* getOrderCheckColumns(SQueryAttr* pQuery) { SArray* getOrderCheckColumns(SQueryAttr* pQuery) {
int32_t numOfCols = pQuery->pGroupbyExpr->numOfGroupCols; int32_t numOfCols = pQuery->pGroupbyExpr == NULL? 0: pQuery->pGroupbyExpr->numOfGroupCols;
SArray* pOrderColumns = NULL; SArray* pOrderColumns = NULL;
if (numOfCols > 0) { if (numOfCols > 0) {
...@@ -4609,7 +4616,7 @@ SArray* getOrderCheckColumns(SQueryAttr* pQuery) { ...@@ -4609,7 +4616,7 @@ SArray* getOrderCheckColumns(SQueryAttr* pQuery) {
} }
SArray* getResultGroupCheckColumns(SQueryAttr* pQuery) { SArray* getResultGroupCheckColumns(SQueryAttr* pQuery) {
int32_t numOfCols = pQuery->pGroupbyExpr->numOfGroupCols; int32_t numOfCols = pQuery->pGroupbyExpr == NULL? 0 : pQuery->pGroupbyExpr->numOfGroupCols;
SArray* pOrderColumns = NULL; SArray* pOrderColumns = NULL;
if (numOfCols > 0) { if (numOfCols > 0) {
...@@ -5175,6 +5182,10 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI ...@@ -5175,6 +5182,10 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
SColumnInfoData* pTsColInfoData = taosArrayGet(pSDataBlock->pDataBlock, 0); SColumnInfoData* pTsColInfoData = taosArrayGet(pSDataBlock->pDataBlock, 0);
TSKEY* tsList = (TSKEY*)pTsColInfoData->pData; TSKEY* tsList = (TSKEY*)pTsColInfoData->pData;
if (IS_REPEAT_SCAN(pRuntimeEnv) && !pInfo->reptScan) {
pInfo->reptScan = true;
tfree(pInfo->prevData);
}
pInfo->numOfRows = 0; pInfo->numOfRows = 0;
for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) { for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) {
...@@ -5761,6 +5772,7 @@ SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOp ...@@ -5761,6 +5772,7 @@ SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOp
SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) {
SStateWindowOperatorInfo* pInfo = calloc(1, sizeof(SStateWindowOperatorInfo)); SStateWindowOperatorInfo* pInfo = calloc(1, sizeof(SStateWindowOperatorInfo));
pInfo->colIndex = -1; pInfo->colIndex = -1;
pInfo->reptScan = false;
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset);
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -5788,7 +5800,8 @@ SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato ...@@ -5788,7 +5800,8 @@ SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
pInfo->prevTs = INT64_MIN; pInfo->prevTs = INT64_MIN;
pInfo->reptScan = false;
SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo));
pOperator->name = "SessionWindowAggOperator"; pOperator->name = "SessionWindowAggOperator";
...@@ -7213,7 +7226,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S ...@@ -7213,7 +7226,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
// todo refactor // todo refactor
pQInfo->query.queryBlockDist = (numOfOutput == 1 && pExprs[0].base.functionId == TSDB_FUNC_BLKINFO); pQInfo->query.queryBlockDist = (numOfOutput == 1 && pExprs[0].base.functionId == TSDB_FUNC_BLKINFO);
qDebug("qmsg:%p QInfo:0x%" PRIx64 "-%p created", pQueryMsg, pQInfo->qId, pQInfo); qDebug("qmsg:%p vgId:%d, QInfo:0x%" PRIx64 "-%p created", pQueryMsg, pQInfo->query.vgId, pQInfo->qId, pQInfo);
return pQInfo; return pQInfo;
_cleanup_qinfo: _cleanup_qinfo:
......
...@@ -132,7 +132,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi ...@@ -132,7 +132,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
numOfGroupByCols = 0; numOfGroupByCols = 0;
} }
qDebug("qmsg:%p query stable, uid:%"PRId64", tid:%d", pQueryMsg, id->uid, id->tid); qDebug("qmsg:%p query stable, uid:%"PRIu64", tid:%d", pQueryMsg, id->uid, id->tid);
code = tsdbQuerySTableByTagCond(tsdb, id->uid, pQueryMsg->window.skey, param.tagCond, pQueryMsg->tagCondLen, code = tsdbQuerySTableByTagCond(tsdb, id->uid, pQueryMsg->window.skey, param.tagCond, pQueryMsg->tagCondLen,
pQueryMsg->tagNameRelType, param.tbnameCond, &tableGroupInfo, param.pGroupColIndex, numOfGroupByCols); pQueryMsg->tagNameRelType, param.tbnameCond, &tableGroupInfo, param.pGroupColIndex, numOfGroupByCols);
...@@ -162,7 +162,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi ...@@ -162,7 +162,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
assert(pQueryMsg->stableQuery == isSTableQuery); assert(pQueryMsg->stableQuery == isSTableQuery);
(*pQInfo) = createQInfoImpl(pQueryMsg, param.pGroupbyExpr, param.pExprs, param.pSecExprs, &tableGroupInfo, (*pQInfo) = createQInfoImpl(pQueryMsg, param.pGroupbyExpr, param.pExprs, param.pSecExprs, &tableGroupInfo,
param.pTagColumnInfo, vgId, param.sql, qId); param.pTagColumnInfo, vgId, param.sql, qId);
param.sql = NULL; param.sql = NULL;
param.pExprs = NULL; param.pExprs = NULL;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
** input grammar file: ** input grammar file:
*/ */
#include <stdio.h> #include <stdio.h>
#include <assert.h>
/************ Begin %include sections from the grammar ************************/ /************ Begin %include sections from the grammar ************************/
#include <stdio.h> #include <stdio.h>
...@@ -77,10 +76,8 @@ ...@@ -77,10 +76,8 @@
** zero the stack is dynamically sized using realloc() ** zero the stack is dynamically sized using realloc()
** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_SDECL A static variable declaration for the %extra_argument
** ParseARG_PDECL A parameter declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument
** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_STORE Code to store %extra_argument into yypParser
** ParseARG_FETCH Code to extract %extra_argument from yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser
** ParseCTX_* As ParseARG_ except for %extra_context
** YYERRORSYMBOL is the code number of the error symbol. If not ** YYERRORSYMBOL is the code number of the error symbol. If not
** defined, then do no error processing. ** defined, then do no error processing.
** YYNSTATE the combined number of states. ** YYNSTATE the combined number of states.
...@@ -100,46 +97,39 @@ ...@@ -100,46 +97,39 @@
#endif #endif
/************* Begin control #defines *****************************************/ /************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int #define YYCODETYPE unsigned short int
#define YYNOCODE 266 #define YYNOCODE 268
#define YYACTIONTYPE unsigned short int #define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SStrToken #define ParseTOKENTYPE SStrToken
typedef union { typedef union {
int yyinit; int yyinit;
ParseTOKENTYPE yy0; ParseTOKENTYPE yy0;
TAOS_FIELD yy27; SArray* yy15;
SWindowStateVal yy76; SWindowStateVal yy96;
SCreateDbInfo yy114; SSqlNode* yy134;
SSqlNode* yy124; SLimitVal yy150;
SCreateAcctInfo yy183; SSessionWindowVal yy151;
SCreatedTableInfo yy192; SRelationInfo* yy160;
SArray* yy193; int yy250;
SCreateTableSql* yy270; tSqlExpr* yy328;
int yy312; tVariant yy380;
SRelationInfo* yy332; SCreatedTableInfo yy390;
SIntervalVal yy392; SCreateAcctInfo yy397;
tVariant yy442; SCreateDbInfo yy454;
SSessionWindowVal yy447; SCreateTableSql* yy482;
tSqlExpr* yy454; int64_t yy489;
int64_t yy473; SIntervalVal yy496;
SLimitVal yy482; TAOS_FIELD yy505;
} YYMINORTYPE; } YYMINORTYPE;
#ifndef YYSTACKDEPTH #ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100 #define YYSTACKDEPTH 100
#endif #endif
#define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_SDECL SSqlInfo* pInfo;
#define ParseARG_PDECL ,SSqlInfo* pInfo #define ParseARG_PDECL ,SSqlInfo* pInfo
#define ParseARG_PARAM ,pInfo #define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo
#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; #define ParseARG_STORE yypParser->pInfo = pInfo
#define ParseARG_STORE yypParser->pInfo=pInfo;
#define ParseCTX_SDECL
#define ParseCTX_PDECL
#define ParseCTX_PARAM
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1 #define YYFALLBACK 1
#define YYNSTATE 341 #define YYNSTATE 341
#define YYNRULE 280 #define YYNRULE 280
#define YYNRULE_WITH_ACTION 280
#define YYNTOKEN 189 #define YYNTOKEN 189
#define YY_MAX_SHIFT 340 #define YY_MAX_SHIFT 340
#define YY_MIN_SHIFTREDUCE 538 #define YY_MIN_SHIFTREDUCE 538
...@@ -150,7 +140,6 @@ typedef union { ...@@ -150,7 +140,6 @@ typedef union {
#define YY_MIN_REDUCE 821 #define YY_MIN_REDUCE 821
#define YY_MAX_REDUCE 1100 #define YY_MAX_REDUCE 1100
/************* End control #defines *******************************************/ /************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
/* Define the yytestcase() macro to be a no-op if is not already defined /* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise. ** otherwise.
...@@ -215,11 +204,11 @@ typedef union { ...@@ -215,11 +204,11 @@ typedef union {
** yy_default[] Default action for each state. ** yy_default[] Default action for each state.
** **
*********** Begin parsing tables **********************************************/ *********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (722) #define YY_ACTTAB_COUNT (721)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 989, 586, 217, 338, 954, 22, 223, 192, 194, 587, /* 0 */ 989, 586, 217, 338, 954, 22, 223, 192, 194, 587,
/* 10 */ 819, 340, 198, 52, 53, 151, 56, 57, 226, 1077, /* 10 */ 819, 340, 198, 52, 53, 151, 56, 57, 226, 1077,
/* 20 */ 229, 46, 283, 55, 282, 60, 58, 62, 59, 1073, /* 20 */ 229, 46, 1073, 55, 282, 60, 58, 62, 59, 1072,
/* 30 */ 665, 194, 968, 51, 50, 194, 234, 49, 48, 47, /* 30 */ 665, 194, 968, 51, 50, 194, 234, 49, 48, 47,
/* 40 */ 52, 53, 1076, 56, 57, 225, 1077, 229, 46, 586, /* 40 */ 52, 53, 1076, 56, 57, 225, 1077, 229, 46, 586,
/* 50 */ 55, 282, 60, 58, 62, 59, 980, 587, 314, 313, /* 50 */ 55, 282, 60, 58, 62, 59, 980, 587, 314, 313,
...@@ -228,162 +217,161 @@ static const YYACTIONTYPE yy_action[] = { ...@@ -228,162 +217,161 @@ static const YYACTIONTYPE yy_action[] = {
/* 80 */ 62, 59, 279, 298, 87, 867, 51, 50, 94, 178, /* 80 */ 62, 59, 279, 298, 87, 867, 51, 50, 94, 178,
/* 90 */ 49, 48, 47, 539, 540, 541, 542, 543, 544, 545, /* 90 */ 49, 48, 47, 539, 540, 541, 542, 543, 544, 545,
/* 100 */ 546, 547, 548, 549, 550, 551, 339, 953, 298, 218, /* 100 */ 546, 547, 548, 549, 550, 551, 339, 953, 298, 218,
/* 110 */ 76, 586, 964, 52, 53, 35, 56, 57, 775, 587, /* 110 */ 76, 586, 964, 52, 53, 35, 56, 57, 324, 587,
/* 120 */ 229, 46, 956, 55, 282, 60, 58, 62, 59, 49, /* 120 */ 229, 46, 956, 55, 282, 60, 58, 62, 59, 49,
/* 130 */ 48, 47, 756, 51, 50, 265, 264, 49, 48, 47, /* 130 */ 48, 47, 756, 51, 50, 265, 264, 49, 48, 47,
/* 140 */ 52, 54, 980, 56, 57, 324, 980, 229, 46, 586, /* 140 */ 52, 54, 980, 56, 57, 1071, 980, 229, 46, 586,
/* 150 */ 55, 282, 60, 58, 62, 59, 219, 587, 220, 965, /* 150 */ 55, 282, 60, 58, 62, 59, 219, 587, 220, 965,
/* 160 */ 51, 50, 221, 1072, 49, 48, 47, 28, 296, 333, /* 160 */ 51, 50, 221, 212, 49, 48, 47, 28, 296, 333,
/* 170 */ 332, 295, 294, 293, 331, 292, 330, 329, 328, 291, /* 170 */ 332, 295, 294, 293, 331, 292, 330, 329, 328, 291,
/* 180 */ 327, 326, 928, 35, 916, 917, 918, 919, 920, 921, /* 180 */ 327, 326, 928, 35, 916, 917, 918, 919, 920, 921,
/* 190 */ 922, 923, 924, 925, 926, 927, 929, 930, 56, 57, /* 190 */ 922, 923, 924, 925, 926, 927, 929, 930, 56, 57,
/* 200 */ 876, 1071, 229, 46, 178, 55, 282, 60, 58, 62, /* 200 */ 151, 213, 229, 46, 151, 55, 282, 60, 58, 62,
/* 210 */ 59, 962, 23, 91, 29, 51, 50, 1, 166, 49, /* 210 */ 59, 962, 23, 91, 29, 51, 50, 243, 196, 49,
/* 220 */ 48, 47, 228, 771, 232, 79, 760, 965, 763, 203, /* 220 */ 48, 47, 228, 771, 232, 197, 760, 965, 763, 203,
/* 230 */ 766, 228, 771, 261, 13, 760, 204, 763, 93, 766, /* 230 */ 766, 228, 771, 151, 13, 760, 204, 763, 93, 766,
/* 240 */ 90, 128, 127, 202, 951, 952, 34, 955, 60, 58, /* 240 */ 90, 128, 127, 202, 951, 952, 34, 955, 60, 58,
/* 250 */ 62, 59, 89, 235, 214, 215, 51, 50, 281, 151, /* 250 */ 62, 59, 966, 235, 214, 215, 51, 50, 281, 1096,
/* 260 */ 49, 48, 47, 214, 215, 762, 77, 765, 28, 1096, /* 260 */ 49, 48, 47, 214, 215, 337, 336, 136, 28, 1025,
/* 270 */ 333, 332, 82, 35, 35, 331, 701, 330, 329, 328, /* 270 */ 333, 332, 82, 88, 250, 331, 704, 330, 329, 328,
/* 280 */ 41, 327, 326, 8, 936, 51, 50, 934, 935, 49, /* 280 */ 41, 327, 326, 254, 253, 936, 35, 199, 934, 935,
/* 290 */ 48, 47, 937, 868, 939, 940, 938, 178, 941, 942, /* 290 */ 142, 140, 139, 937, 876, 939, 940, 938, 178, 941,
/* 300 */ 113, 107, 118, 257, 239, 74, 704, 117, 123, 126, /* 300 */ 942, 82, 1026, 257, 277, 74, 113, 107, 118, 41,
/* 310 */ 116, 242, 211, 35, 233, 303, 120, 965, 965, 689, /* 310 */ 236, 334, 211, 117, 123, 126, 116, 239, 762, 193,
/* 320 */ 212, 761, 686, 764, 687, 61, 688, 213, 1026, 35, /* 320 */ 765, 35, 120, 242, 761, 61, 764, 233, 689, 1088,
/* 330 */ 277, 35, 772, 1036, 61, 5, 38, 168, 768, 151, /* 330 */ 965, 686, 772, 687, 61, 688, 968, 968, 768, 200,
/* 340 */ 196, 772, 167, 101, 96, 100, 35, 768, 35, 151, /* 340 */ 115, 772, 5, 38, 168, 324, 283, 768, 79, 167,
/* 350 */ 245, 246, 35, 35, 304, 767, 236, 965, 186, 184, /* 350 */ 101, 96, 100, 868, 708, 767, 261, 178, 35, 245,
/* 360 */ 182, 142, 140, 139, 767, 181, 131, 130, 129, 334, /* 360 */ 246, 201, 303, 35, 767, 965, 186, 184, 182, 35,
/* 370 */ 305, 243, 306, 965, 240, 965, 238, 769, 302, 301, /* 370 */ 35, 35, 89, 181, 131, 130, 129, 51, 50, 35,
/* 380 */ 82, 244, 968, 241, 708, 309, 308, 310, 41, 311, /* 380 */ 35, 49, 48, 47, 1, 166, 77, 240, 967, 238,
/* 390 */ 965, 250, 965, 312, 316, 968, 965, 965, 3, 179, /* 390 */ 259, 302, 301, 244, 36, 241, 701, 309, 308, 304,
/* 400 */ 254, 253, 337, 336, 136, 115, 966, 80, 1025, 259, /* 400 */ 3, 179, 965, 8, 305, 758, 227, 965, 737, 738,
/* 410 */ 324, 737, 738, 36, 758, 261, 720, 728, 88, 729, /* 410 */ 306, 310, 311, 965, 965, 965, 67, 80, 207, 70,
/* 420 */ 146, 66, 227, 25, 67, 792, 197, 773, 690, 24, /* 420 */ 312, 316, 720, 965, 965, 261, 146, 728, 729, 792,
/* 430 */ 675, 24, 70, 770, 36, 285, 677, 287, 676, 36, /* 430 */ 769, 66, 25, 24, 773, 1036, 770, 690, 24, 68,
/* 440 */ 66, 92, 66, 33, 125, 124, 288, 68, 199, 15, /* 440 */ 71, 759, 775, 675, 285, 208, 33, 36, 36, 288,
/* 450 */ 759, 14, 106, 71, 105, 193, 200, 17, 19, 16, /* 450 */ 6, 206, 677, 287, 676, 255, 66, 92, 66, 73,
/* 460 */ 18, 201, 73, 112, 664, 111, 6, 207, 693, 691, /* 460 */ 15, 664, 14, 693, 106, 694, 105, 17, 691, 16,
/* 470 */ 694, 692, 208, 206, 21, 1035, 20, 1088, 191, 205, /* 470 */ 692, 19, 112, 18, 111, 21, 1035, 20, 125, 124,
/* 480 */ 195, 967, 230, 255, 1032, 1031, 231, 315, 44, 143, /* 480 */ 191, 205, 195, 230, 143, 1032, 1031, 231, 315, 988,
/* 490 */ 988, 1018, 999, 996, 1017, 997, 981, 262, 1001, 145, /* 490 */ 44, 999, 996, 997, 1001, 145, 981, 262, 149, 271,
/* 500 */ 149, 271, 162, 963, 141, 114, 266, 222, 719, 268, /* 500 */ 1018, 1017, 963, 162, 163, 141, 932, 961, 164, 165,
/* 510 */ 158, 275, 154, 163, 978, 152, 155, 276, 961, 164, /* 510 */ 719, 879, 266, 290, 325, 160, 158, 276, 153, 978,
/* 520 */ 165, 280, 153, 72, 156, 63, 879, 69, 290, 278, /* 520 */ 42, 152, 63, 189, 222, 72, 268, 39, 299, 275,
/* 530 */ 42, 274, 189, 39, 299, 875, 300, 1095, 103, 1094, /* 530 */ 875, 69, 280, 300, 1095, 278, 103, 154, 1094, 155,
/* 540 */ 1091, 169, 307, 1087, 109, 1086, 1083, 170, 897, 40, /* 540 */ 156, 274, 157, 1091, 169, 307, 1087, 109, 272, 1086,
/* 550 */ 272, 37, 43, 190, 270, 864, 119, 862, 121, 122, /* 550 */ 1083, 170, 897, 40, 37, 43, 190, 864, 119, 862,
/* 560 */ 267, 860, 859, 247, 180, 857, 856, 855, 854, 853, /* 560 */ 121, 122, 860, 859, 247, 180, 857, 856, 855, 854,
/* 570 */ 852, 183, 185, 849, 847, 845, 843, 187, 840, 188, /* 570 */ 853, 852, 183, 185, 849, 847, 845, 843, 187, 840,
/* 580 */ 45, 260, 78, 83, 325, 269, 1019, 317, 318, 319, /* 580 */ 188, 270, 260, 78, 83, 269, 1019, 267, 45, 114,
/* 590 */ 320, 321, 322, 323, 335, 817, 248, 216, 237, 289, /* 590 */ 317, 318, 319, 216, 321, 237, 320, 289, 322, 323,
/* 600 */ 249, 816, 251, 252, 209, 210, 97, 98, 815, 798, /* 600 */ 335, 209, 817, 248, 97, 98, 210, 249, 816, 252,
/* 610 */ 797, 256, 261, 263, 858, 696, 284, 9, 132, 851, /* 610 */ 815, 251, 798, 797, 256, 858, 261, 132, 173, 133,
/* 620 */ 173, 133, 172, 898, 171, 174, 175, 177, 176, 4, /* 620 */ 898, 175, 171, 172, 174, 176, 177, 851, 4, 134,
/* 630 */ 134, 850, 842, 932, 135, 30, 841, 81, 84, 721, /* 630 */ 850, 2, 135, 842, 841, 284, 9, 81, 696, 161,
/* 640 */ 2, 161, 159, 157, 160, 147, 944, 724, 148, 85, /* 640 */ 159, 30, 147, 263, 84, 944, 224, 721, 724, 85,
/* 650 */ 224, 726, 86, 273, 10, 730, 150, 11, 776, 774, /* 650 */ 10, 726, 86, 148, 273, 11, 730, 150, 31, 774,
/* 660 */ 31, 7, 32, 12, 26, 286, 27, 95, 628, 93, /* 660 */ 7, 32, 12, 26, 286, 27, 776, 95, 93, 628,
/* 670 */ 624, 622, 621, 620, 617, 297, 99, 590, 64, 36, /* 670 */ 624, 622, 621, 620, 617, 590, 297, 99, 64, 36,
/* 680 */ 65, 102, 667, 666, 104, 108, 663, 612, 610, 602, /* 680 */ 102, 667, 666, 663, 612, 610, 65, 602, 104, 608,
/* 690 */ 608, 604, 606, 600, 598, 631, 110, 630, 629, 627, /* 690 */ 604, 606, 600, 598, 631, 630, 629, 627, 626, 625,
/* 700 */ 626, 625, 623, 619, 618, 588, 555, 553, 66, 821, /* 700 */ 623, 619, 618, 108, 110, 66, 588, 555, 553, 821,
/* 710 */ 820, 820, 137, 820, 820, 820, 820, 820, 820, 820, /* 710 */ 820, 820, 820, 820, 820, 820, 820, 820, 820, 137,
/* 720 */ 820, 138, /* 720 */ 138,
}; };
static const YYCODETYPE yy_lookahead[] = { static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 192, 1, 191, 192, 0, 254, 211, 254, 254, 9, /* 0 */ 193, 1, 192, 193, 0, 255, 212, 255, 255, 9,
/* 10 */ 189, 190, 254, 13, 14, 192, 16, 17, 264, 265, /* 10 */ 190, 191, 255, 13, 14, 193, 16, 17, 265, 266,
/* 20 */ 20, 21, 15, 23, 24, 25, 26, 27, 28, 254, /* 20 */ 20, 21, 255, 23, 24, 25, 26, 27, 28, 255,
/* 30 */ 5, 254, 237, 33, 34, 254, 211, 37, 38, 39, /* 30 */ 5, 255, 238, 33, 34, 255, 212, 37, 38, 39,
/* 40 */ 13, 14, 265, 16, 17, 264, 265, 20, 21, 1, /* 40 */ 13, 14, 266, 16, 17, 265, 266, 20, 21, 1,
/* 50 */ 23, 24, 25, 26, 27, 28, 235, 9, 33, 34, /* 50 */ 23, 24, 25, 26, 27, 28, 236, 9, 33, 34,
/* 60 */ 33, 34, 237, 255, 37, 38, 39, 14, 192, 16, /* 60 */ 33, 34, 238, 256, 37, 38, 39, 14, 193, 16,
/* 70 */ 17, 192, 251, 20, 21, 198, 23, 24, 25, 26, /* 70 */ 17, 193, 252, 20, 21, 199, 23, 24, 25, 26,
/* 80 */ 27, 28, 259, 79, 261, 197, 33, 34, 198, 201, /* 80 */ 27, 28, 260, 79, 262, 198, 33, 34, 199, 202,
/* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51,
/* 100 */ 52, 53, 54, 55, 56, 57, 58, 230, 79, 61, /* 100 */ 52, 53, 54, 55, 56, 57, 58, 231, 79, 61,
/* 110 */ 110, 1, 236, 13, 14, 192, 16, 17, 111, 9, /* 110 */ 110, 1, 237, 13, 14, 193, 16, 17, 81, 9,
/* 120 */ 20, 21, 232, 23, 24, 25, 26, 27, 28, 37, /* 120 */ 20, 21, 233, 23, 24, 25, 26, 27, 28, 37,
/* 130 */ 38, 39, 105, 33, 34, 256, 257, 37, 38, 39, /* 130 */ 38, 39, 105, 33, 34, 257, 258, 37, 38, 39,
/* 140 */ 13, 14, 235, 16, 17, 81, 235, 20, 21, 1, /* 140 */ 13, 14, 236, 16, 17, 255, 236, 20, 21, 1,
/* 150 */ 23, 24, 25, 26, 27, 28, 233, 9, 251, 236, /* 150 */ 23, 24, 25, 26, 27, 28, 234, 9, 252, 237,
/* 160 */ 33, 34, 251, 254, 37, 38, 39, 88, 89, 90, /* 160 */ 33, 34, 252, 255, 37, 38, 39, 88, 89, 90,
/* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
/* 180 */ 101, 102, 210, 192, 212, 213, 214, 215, 216, 217, /* 180 */ 101, 102, 211, 193, 213, 214, 215, 216, 217, 218,
/* 190 */ 218, 219, 220, 221, 222, 223, 224, 225, 16, 17, /* 190 */ 219, 220, 221, 222, 223, 224, 225, 226, 16, 17,
/* 200 */ 197, 254, 20, 21, 201, 23, 24, 25, 26, 27, /* 200 */ 193, 255, 20, 21, 193, 23, 24, 25, 26, 27,
/* 210 */ 28, 192, 44, 198, 104, 33, 34, 199, 200, 37, /* 210 */ 28, 193, 44, 199, 104, 33, 34, 193, 255, 37,
/* 220 */ 38, 39, 1, 2, 233, 105, 5, 236, 7, 61, /* 220 */ 38, 39, 1, 2, 234, 255, 5, 237, 7, 61,
/* 230 */ 9, 1, 2, 113, 104, 5, 68, 7, 108, 9, /* 230 */ 9, 1, 2, 193, 104, 5, 68, 7, 108, 9,
/* 240 */ 110, 73, 74, 75, 229, 230, 231, 232, 25, 26, /* 240 */ 110, 73, 74, 75, 230, 231, 232, 233, 25, 26,
/* 250 */ 27, 28, 238, 234, 33, 34, 33, 34, 37, 192, /* 250 */ 27, 28, 228, 235, 33, 34, 33, 34, 37, 238,
/* 260 */ 37, 38, 39, 33, 34, 5, 252, 7, 88, 237, /* 260 */ 37, 38, 39, 33, 34, 65, 66, 67, 88, 262,
/* 270 */ 90, 91, 104, 192, 192, 95, 109, 97, 98, 99, /* 270 */ 90, 91, 104, 262, 136, 95, 37, 97, 98, 99,
/* 280 */ 112, 101, 102, 116, 210, 33, 34, 213, 214, 37, /* 280 */ 112, 101, 102, 145, 146, 211, 193, 255, 214, 215,
/* 290 */ 38, 39, 218, 197, 220, 221, 222, 201, 224, 225, /* 290 */ 62, 63, 64, 219, 198, 221, 222, 223, 202, 225,
/* 300 */ 62, 63, 64, 135, 68, 137, 37, 69, 70, 71, /* 300 */ 226, 104, 262, 135, 264, 137, 62, 63, 64, 112,
/* 310 */ 72, 68, 144, 192, 233, 233, 78, 236, 236, 2, /* 310 */ 212, 212, 144, 69, 70, 71, 72, 68, 5, 255,
/* 320 */ 254, 5, 5, 7, 7, 104, 9, 254, 261, 192, /* 320 */ 7, 193, 78, 68, 5, 104, 7, 234, 2, 238,
/* 330 */ 263, 192, 111, 228, 104, 62, 63, 64, 117, 192, /* 330 */ 237, 5, 111, 7, 104, 9, 238, 238, 117, 255,
/* 340 */ 254, 111, 69, 70, 71, 72, 192, 117, 192, 192, /* 340 */ 76, 111, 62, 63, 64, 81, 15, 117, 105, 69,
/* 350 */ 33, 34, 192, 192, 233, 134, 211, 236, 62, 63, /* 350 */ 70, 71, 72, 198, 115, 134, 113, 202, 193, 33,
/* 360 */ 64, 62, 63, 64, 134, 69, 70, 71, 72, 211, /* 360 */ 34, 255, 234, 193, 134, 237, 62, 63, 64, 193,
/* 370 */ 233, 192, 233, 236, 138, 236, 140, 117, 142, 143, /* 370 */ 193, 193, 239, 69, 70, 71, 72, 33, 34, 193,
/* 380 */ 104, 138, 237, 140, 115, 142, 143, 233, 112, 233, /* 380 */ 193, 37, 38, 39, 200, 201, 253, 138, 238, 140,
/* 390 */ 236, 136, 236, 233, 233, 237, 236, 236, 195, 196, /* 390 */ 105, 142, 143, 138, 109, 140, 109, 142, 143, 234,
/* 400 */ 145, 146, 65, 66, 67, 76, 227, 105, 261, 105, /* 400 */ 196, 197, 237, 116, 234, 1, 60, 237, 125, 126,
/* 410 */ 81, 125, 126, 109, 1, 113, 105, 105, 261, 105, /* 410 */ 234, 234, 234, 237, 237, 237, 109, 105, 255, 109,
/* 420 */ 109, 109, 60, 109, 109, 105, 254, 105, 111, 109, /* 420 */ 234, 234, 105, 237, 237, 113, 109, 105, 105, 105,
/* 430 */ 105, 109, 109, 117, 109, 105, 105, 105, 105, 109, /* 430 */ 117, 109, 109, 109, 105, 229, 117, 111, 109, 132,
/* 440 */ 109, 109, 109, 104, 76, 77, 107, 132, 254, 139, /* 440 */ 130, 37, 111, 105, 105, 255, 104, 109, 109, 107,
/* 450 */ 37, 141, 139, 130, 141, 254, 254, 139, 139, 141, /* 450 */ 104, 255, 105, 105, 105, 193, 109, 109, 109, 104,
/* 460 */ 141, 254, 104, 139, 106, 141, 104, 254, 5, 5, /* 460 */ 139, 106, 141, 5, 139, 7, 141, 139, 5, 141,
/* 470 */ 7, 7, 254, 254, 139, 228, 141, 237, 254, 254, /* 470 */ 7, 139, 139, 141, 141, 139, 229, 141, 76, 77,
/* 480 */ 254, 237, 228, 192, 228, 228, 228, 228, 253, 192, /* 480 */ 255, 255, 255, 229, 193, 229, 229, 229, 229, 193,
/* 490 */ 192, 262, 192, 192, 262, 192, 235, 235, 192, 192, /* 490 */ 254, 193, 193, 193, 193, 193, 236, 236, 193, 193,
/* 500 */ 192, 192, 239, 235, 60, 87, 258, 258, 117, 258, /* 500 */ 263, 263, 236, 240, 193, 60, 227, 193, 193, 193,
/* 510 */ 243, 258, 247, 192, 250, 249, 246, 122, 192, 192, /* 510 */ 117, 193, 259, 193, 103, 242, 244, 122, 249, 251,
/* 520 */ 192, 123, 248, 129, 245, 128, 192, 131, 192, 127, /* 520 */ 193, 250, 128, 193, 259, 129, 259, 193, 193, 259,
/* 530 */ 192, 121, 192, 192, 192, 192, 192, 192, 192, 192, /* 530 */ 193, 131, 123, 193, 193, 127, 193, 248, 193, 247,
/* 540 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, /* 540 */ 246, 121, 245, 193, 193, 193, 193, 193, 120, 193,
/* 550 */ 120, 192, 192, 192, 119, 192, 192, 192, 192, 192, /* 550 */ 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
/* 560 */ 118, 192, 192, 192, 192, 192, 192, 192, 192, 192, /* 560 */ 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
/* 570 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, /* 570 */ 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
/* 580 */ 133, 193, 193, 193, 103, 193, 193, 86, 50, 83, /* 580 */ 193, 119, 194, 194, 194, 194, 194, 118, 133, 87,
/* 590 */ 85, 54, 84, 82, 79, 5, 147, 193, 193, 193, /* 590 */ 86, 50, 83, 194, 54, 194, 85, 194, 84, 82,
/* 600 */ 5, 5, 147, 5, 193, 193, 198, 198, 5, 90, /* 600 */ 79, 194, 5, 147, 199, 199, 194, 5, 5, 5,
/* 610 */ 89, 136, 113, 109, 193, 105, 107, 104, 194, 193, /* 610 */ 5, 147, 90, 89, 136, 194, 113, 195, 204, 195,
/* 620 */ 203, 194, 207, 209, 208, 206, 204, 202, 205, 195, /* 620 */ 210, 205, 209, 208, 207, 206, 203, 194, 196, 195,
/* 630 */ 194, 193, 193, 226, 194, 104, 193, 114, 109, 105, /* 630 */ 194, 200, 195, 194, 194, 107, 104, 114, 105, 241,
/* 640 */ 199, 240, 242, 244, 241, 104, 226, 105, 109, 104, /* 640 */ 243, 104, 104, 109, 109, 227, 1, 105, 105, 104,
/* 650 */ 1, 105, 104, 104, 124, 105, 104, 124, 111, 105, /* 650 */ 124, 105, 104, 109, 104, 124, 105, 104, 109, 105,
/* 660 */ 109, 104, 109, 104, 104, 107, 104, 76, 9, 108, /* 660 */ 104, 109, 104, 104, 107, 104, 111, 76, 108, 9,
/* 670 */ 5, 5, 5, 5, 5, 15, 76, 80, 16, 109, /* 670 */ 5, 5, 5, 5, 5, 80, 15, 76, 16, 109,
/* 680 */ 16, 141, 5, 5, 141, 141, 105, 5, 5, 5, /* 680 */ 141, 5, 5, 105, 5, 5, 16, 5, 141, 5,
/* 690 */ 5, 5, 5, 5, 5, 5, 141, 5, 5, 5, /* 690 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
/* 700 */ 5, 5, 5, 5, 5, 80, 60, 59, 109, 0, /* 700 */ 5, 5, 5, 141, 141, 109, 80, 60, 59, 0,
/* 710 */ 266, 266, 21, 266, 266, 266, 266, 266, 266, 266, /* 710 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 21,
/* 720 */ 266, 21, 266, 266, 266, 266, 266, 266, 266, 266, /* 720 */ 21, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 730 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 730 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 740 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 740 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 750 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 750 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 760 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 760 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 770 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 770 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 780 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 780 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 790 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 790 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 800 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 800 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 810 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 810 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 820 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 820 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 830 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 830 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 840 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 840 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 850 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 850 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 860 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 860 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 870 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 870 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 880 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 880 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 890 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 890 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 900 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 900 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 910 */ 266,
}; };
#define YY_SHIFT_COUNT (340) #define YY_SHIFT_COUNT (340)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
...@@ -391,64 +379,64 @@ static const YYCODETYPE yy_lookahead[] = { ...@@ -391,64 +379,64 @@ static const YYCODETYPE yy_lookahead[] = {
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 168, 79, 79, 180, 180, 29, 221, 230, 110, 148, /* 0 */ 168, 79, 79, 180, 180, 29, 221, 230, 110, 148,
/* 10 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, /* 10 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
/* 20 */ 148, 148, 0, 48, 230, 317, 317, 317, 317, 276, /* 20 */ 148, 148, 0, 48, 230, 326, 326, 326, 326, 197,
/* 30 */ 276, 148, 148, 148, 4, 148, 148, 329, 29, 64, /* 30 */ 197, 148, 148, 148, 4, 148, 148, 264, 29, 37,
/* 40 */ 64, 722, 722, 722, 230, 230, 230, 230, 230, 230, /* 40 */ 37, 721, 721, 721, 230, 230, 230, 230, 230, 230,
/* 50 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, /* 50 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
/* 60 */ 230, 230, 230, 230, 317, 317, 317, 25, 25, 25, /* 60 */ 230, 230, 230, 230, 326, 326, 326, 25, 25, 25,
/* 70 */ 25, 25, 25, 25, 148, 148, 148, 269, 148, 148, /* 70 */ 25, 25, 25, 25, 148, 148, 148, 239, 148, 148,
/* 80 */ 148, 276, 276, 148, 148, 148, 148, 286, 286, 167, /* 80 */ 148, 197, 197, 148, 148, 148, 148, 283, 283, 287,
/* 90 */ 276, 148, 148, 148, 148, 148, 148, 148, 148, 148, /* 90 */ 197, 148, 148, 148, 148, 148, 148, 148, 148, 148,
/* 100 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, /* 100 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
/* 110 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, /* 110 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
/* 120 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, /* 120 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
/* 130 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, /* 130 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
/* 140 */ 148, 148, 148, 444, 444, 444, 391, 391, 391, 444, /* 140 */ 148, 148, 148, 445, 445, 445, 393, 393, 393, 445,
/* 150 */ 391, 444, 394, 396, 397, 398, 402, 395, 410, 430, /* 150 */ 393, 445, 396, 400, 394, 409, 408, 395, 420, 428,
/* 160 */ 435, 442, 447, 444, 444, 444, 481, 29, 29, 444, /* 160 */ 462, 469, 455, 445, 445, 445, 411, 29, 29, 445,
/* 170 */ 444, 418, 501, 538, 506, 505, 537, 508, 511, 481, /* 170 */ 445, 502, 504, 541, 509, 511, 540, 514, 517, 411,
/* 180 */ 444, 515, 515, 444, 515, 444, 515, 444, 444, 722, /* 180 */ 445, 521, 521, 445, 521, 445, 521, 445, 445, 721,
/* 190 */ 722, 27, 100, 127, 100, 100, 53, 182, 223, 223, /* 190 */ 721, 27, 100, 127, 100, 100, 53, 182, 223, 223,
/* 200 */ 223, 223, 238, 273, 296, 252, 252, 252, 252, 236, /* 200 */ 223, 223, 244, 280, 304, 344, 344, 344, 344, 249,
/* 210 */ 243, 255, 92, 92, 260, 316, 130, 337, 299, 304, /* 210 */ 255, 138, 92, 92, 313, 319, 130, 200, 228, 285,
/* 220 */ 120, 302, 311, 312, 314, 320, 322, 413, 362, 7, /* 220 */ 243, 312, 317, 322, 323, 324, 329, 404, 346, 331,
/* 230 */ 315, 323, 325, 330, 331, 332, 333, 339, 310, 313, /* 230 */ 307, 310, 338, 339, 347, 348, 349, 342, 321, 325,
/* 240 */ 318, 319, 324, 358, 335, 463, 464, 368, 590, 449, /* 240 */ 328, 332, 333, 355, 336, 458, 463, 402, 597, 456,
/* 250 */ 595, 596, 455, 598, 603, 519, 521, 475, 499, 509, /* 250 */ 602, 603, 464, 604, 605, 522, 524, 478, 503, 528,
/* 260 */ 513, 523, 510, 531, 504, 529, 534, 541, 542, 539, /* 260 */ 532, 523, 533, 537, 534, 535, 542, 538, 543, 544,
/* 270 */ 545, 546, 548, 649, 549, 550, 552, 551, 530, 553, /* 270 */ 545, 546, 548, 645, 550, 551, 553, 549, 526, 552,
/* 280 */ 533, 554, 557, 547, 559, 509, 560, 558, 562, 561, /* 280 */ 531, 554, 556, 555, 558, 528, 559, 557, 561, 560,
/* 290 */ 591, 659, 665, 666, 667, 668, 669, 597, 660, 600, /* 290 */ 591, 660, 665, 666, 667, 668, 669, 595, 661, 601,
/* 300 */ 662, 540, 543, 570, 570, 570, 570, 664, 544, 555, /* 300 */ 662, 539, 547, 570, 570, 570, 570, 670, 562, 563,
/* 310 */ 570, 570, 570, 677, 678, 581, 570, 682, 683, 684, /* 310 */ 570, 570, 570, 676, 677, 578, 570, 679, 680, 682,
/* 320 */ 685, 686, 687, 688, 689, 690, 692, 693, 694, 695, /* 320 */ 684, 685, 686, 687, 688, 689, 690, 691, 692, 693,
/* 330 */ 696, 697, 698, 699, 599, 625, 691, 700, 646, 648, /* 330 */ 694, 695, 696, 697, 596, 626, 698, 699, 647, 649,
/* 340 */ 709, /* 340 */ 709,
}; };
#define YY_REDUCE_COUNT (190) #define YY_REDUCE_COUNT (190)
#define YY_REDUCE_MIN (-249) #define YY_REDUCE_MIN (-250)
#define YY_REDUCE_MAX (443) #define YY_REDUCE_MAX (440)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
/* 0 */ -179, -28, -28, 74, 74, 15, -246, -219, -121, -77, /* 0 */ -180, -29, -29, 74, 74, 14, -247, -220, -122, -78,
/* 10 */ 67, -177, -9, 81, 82, 121, 137, 139, 154, 156, /* 10 */ 40, -178, -10, 93, 128, 165, 170, 176, 177, 178,
/* 20 */ 160, 161, -192, -189, -223, -205, -175, 145, 158, -93, /* 20 */ 186, 187, -193, -190, -224, -206, -176, 98, 99, -94,
/* 30 */ -89, 147, 157, 19, -110, 179, -124, -112, -123, 3, /* 30 */ -90, 7, 11, 18, -111, 24, -125, -113, -124, 96,
/* 40 */ 96, 14, 18, 203, -249, -247, -242, -225, -91, -53, /* 40 */ 155, 133, 184, 204, -250, -248, -243, -233, -226, -110,
/* 50 */ 66, 73, 86, 172, 194, 201, 202, 207, 213, 218, /* 50 */ -92, -54, -37, -30, 32, 64, 84, 106, 163, 190,
/* 60 */ 219, 224, 225, 226, 32, 240, 244, 105, 247, 254, /* 60 */ 196, 225, 226, 227, 21, 91, 150, 206, 247, 254,
/* 70 */ 256, 257, 258, 259, 291, 297, 298, 235, 300, 301, /* 70 */ 256, 257, 258, 259, 262, 291, 296, 236, 298, 299,
/* 80 */ 303, 261, 262, 306, 307, 308, 309, 229, 232, 263, /* 80 */ 300, 260, 261, 301, 302, 305, 306, 237, 238, 263,
/* 90 */ 268, 321, 326, 327, 328, 334, 336, 338, 340, 341, /* 90 */ 266, 311, 314, 315, 316, 318, 320, 327, 330, 334,
/* 100 */ 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, /* 100 */ 335, 337, 340, 341, 343, 345, 350, 351, 352, 353,
/* 110 */ 352, 353, 354, 355, 356, 357, 359, 360, 361, 363, /* 110 */ 354, 356, 357, 358, 359, 360, 361, 362, 363, 364,
/* 120 */ 364, 365, 366, 367, 369, 370, 371, 372, 373, 374, /* 120 */ 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
/* 130 */ 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, /* 130 */ 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
/* 140 */ 385, 386, 387, 388, 389, 390, 248, 249, 251, 392, /* 140 */ 385, 386, 387, 388, 389, 390, 253, 265, 267, 391,
/* 150 */ 253, 393, 264, 266, 274, 265, 270, 279, 399, 267, /* 150 */ 270, 392, 268, 271, 269, 289, 292, 294, 297, 272,
/* 160 */ 400, 403, 401, 404, 405, 406, 407, 408, 409, 411, /* 160 */ 397, 273, 398, 399, 401, 403, 279, 405, 406, 407,
/* 170 */ 412, 414, 416, 415, 417, 419, 422, 423, 425, 420, /* 170 */ 412, 410, 413, 415, 414, 417, 416, 419, 423, 418,
/* 180 */ 421, 424, 427, 426, 436, 438, 440, 439, 443, 441, /* 180 */ 421, 422, 424, 433, 434, 436, 437, 439, 440, 431,
/* 190 */ 434, /* 190 */ 432,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 818, 931, 877, 943, 865, 874, 1079, 1079, 818, 818, /* 0 */ 818, 931, 877, 943, 865, 874, 1079, 1079, 818, 818,
...@@ -733,7 +721,6 @@ struct yyParser { ...@@ -733,7 +721,6 @@ struct yyParser {
int yyerrcnt; /* Shifts left before out of the error */ int yyerrcnt; /* Shifts left before out of the error */
#endif #endif
ParseARG_SDECL /* A place to hold %extra_argument */ ParseARG_SDECL /* A place to hold %extra_argument */
ParseCTX_SDECL /* A place to hold %extra_context */
#if YYSTACKDEPTH<=0 #if YYSTACKDEPTH<=0
int yystksz; /* Current side of the stack */ int yystksz; /* Current side of the stack */
yyStackEntry *yystack; /* The parser's stack */ yyStackEntry *yystack; /* The parser's stack */
...@@ -970,83 +957,84 @@ static const char *const yyTokenName[] = { ...@@ -970,83 +957,84 @@ static const char *const yyTokenName[] = {
/* 186 */ "INSERT", /* 186 */ "INSERT",
/* 187 */ "INTO", /* 187 */ "INTO",
/* 188 */ "VALUES", /* 188 */ "VALUES",
/* 189 */ "program", /* 189 */ "error",
/* 190 */ "cmd", /* 190 */ "program",
/* 191 */ "dbPrefix", /* 191 */ "cmd",
/* 192 */ "ids", /* 192 */ "dbPrefix",
/* 193 */ "cpxName", /* 193 */ "ids",
/* 194 */ "ifexists", /* 194 */ "cpxName",
/* 195 */ "alter_db_optr", /* 195 */ "ifexists",
/* 196 */ "alter_topic_optr", /* 196 */ "alter_db_optr",
/* 197 */ "acct_optr", /* 197 */ "alter_topic_optr",
/* 198 */ "ifnotexists", /* 198 */ "acct_optr",
/* 199 */ "db_optr", /* 199 */ "ifnotexists",
/* 200 */ "topic_optr", /* 200 */ "db_optr",
/* 201 */ "pps", /* 201 */ "topic_optr",
/* 202 */ "tseries", /* 202 */ "pps",
/* 203 */ "dbs", /* 203 */ "tseries",
/* 204 */ "streams", /* 204 */ "dbs",
/* 205 */ "storage", /* 205 */ "streams",
/* 206 */ "qtime", /* 206 */ "storage",
/* 207 */ "users", /* 207 */ "qtime",
/* 208 */ "conns", /* 208 */ "users",
/* 209 */ "state", /* 209 */ "conns",
/* 210 */ "keep", /* 210 */ "state",
/* 211 */ "tagitemlist", /* 211 */ "keep",
/* 212 */ "cache", /* 212 */ "tagitemlist",
/* 213 */ "replica", /* 213 */ "cache",
/* 214 */ "quorum", /* 214 */ "replica",
/* 215 */ "days", /* 215 */ "quorum",
/* 216 */ "minrows", /* 216 */ "days",
/* 217 */ "maxrows", /* 217 */ "minrows",
/* 218 */ "blocks", /* 218 */ "maxrows",
/* 219 */ "ctime", /* 219 */ "blocks",
/* 220 */ "wal", /* 220 */ "ctime",
/* 221 */ "fsync", /* 221 */ "wal",
/* 222 */ "comp", /* 222 */ "fsync",
/* 223 */ "prec", /* 223 */ "comp",
/* 224 */ "update", /* 224 */ "prec",
/* 225 */ "cachelast", /* 225 */ "update",
/* 226 */ "partitions", /* 226 */ "cachelast",
/* 227 */ "typename", /* 227 */ "partitions",
/* 228 */ "signed", /* 228 */ "typename",
/* 229 */ "create_table_args", /* 229 */ "signed",
/* 230 */ "create_stable_args", /* 230 */ "create_table_args",
/* 231 */ "create_table_list", /* 231 */ "create_stable_args",
/* 232 */ "create_from_stable", /* 232 */ "create_table_list",
/* 233 */ "columnlist", /* 233 */ "create_from_stable",
/* 234 */ "tagNamelist", /* 234 */ "columnlist",
/* 235 */ "select", /* 235 */ "tagNamelist",
/* 236 */ "column", /* 236 */ "select",
/* 237 */ "tagitem", /* 237 */ "column",
/* 238 */ "selcollist", /* 238 */ "tagitem",
/* 239 */ "from", /* 239 */ "selcollist",
/* 240 */ "where_opt", /* 240 */ "from",
/* 241 */ "interval_opt", /* 241 */ "where_opt",
/* 242 */ "session_option", /* 242 */ "interval_opt",
/* 243 */ "windowstate_option", /* 243 */ "session_option",
/* 244 */ "fill_opt", /* 244 */ "windowstate_option",
/* 245 */ "sliding_opt", /* 245 */ "fill_opt",
/* 246 */ "groupby_opt", /* 246 */ "sliding_opt",
/* 247 */ "orderby_opt", /* 247 */ "groupby_opt",
/* 248 */ "having_opt", /* 248 */ "orderby_opt",
/* 249 */ "slimit_opt", /* 249 */ "having_opt",
/* 250 */ "limit_opt", /* 250 */ "slimit_opt",
/* 251 */ "union", /* 251 */ "limit_opt",
/* 252 */ "sclp", /* 252 */ "union",
/* 253 */ "distinct", /* 253 */ "sclp",
/* 254 */ "expr", /* 254 */ "distinct",
/* 255 */ "as", /* 255 */ "expr",
/* 256 */ "tablelist", /* 256 */ "as",
/* 257 */ "sub", /* 257 */ "tablelist",
/* 258 */ "tmvar", /* 258 */ "sub",
/* 259 */ "sortlist", /* 259 */ "tmvar",
/* 260 */ "sortitem", /* 260 */ "sortlist",
/* 261 */ "item", /* 261 */ "sortitem",
/* 262 */ "sortorder", /* 262 */ "item",
/* 263 */ "grouplist", /* 263 */ "sortorder",
/* 264 */ "exprlist", /* 264 */ "grouplist",
/* 265 */ "expritem", /* 265 */ "exprlist",
/* 266 */ "expritem",
}; };
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
...@@ -1382,29 +1370,28 @@ static int yyGrowStack(yyParser *p){ ...@@ -1382,29 +1370,28 @@ static int yyGrowStack(yyParser *p){
/* Initialize a new parser that has already been allocated. /* Initialize a new parser that has already been allocated.
*/ */
void ParseInit(void *yypRawParser ParseCTX_PDECL){ void ParseInit(void *yypParser){
yyParser *yypParser = (yyParser*)yypRawParser; yyParser *pParser = (yyParser*)yypParser;
ParseCTX_STORE
#ifdef YYTRACKMAXSTACKDEPTH #ifdef YYTRACKMAXSTACKDEPTH
yypParser->yyhwm = 0; pParser->yyhwm = 0;
#endif #endif
#if YYSTACKDEPTH<=0 #if YYSTACKDEPTH<=0
yypParser->yytos = NULL; pParser->yytos = NULL;
yypParser->yystack = NULL; pParser->yystack = NULL;
yypParser->yystksz = 0; pParser->yystksz = 0;
if( yyGrowStack(yypParser) ){ if( yyGrowStack(pParser) ){
yypParser->yystack = &yypParser->yystk0; pParser->yystack = &pParser->yystk0;
yypParser->yystksz = 1; pParser->yystksz = 1;
} }
#endif #endif
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt = -1; pParser->yyerrcnt = -1;
#endif #endif
yypParser->yytos = yypParser->yystack; pParser->yytos = pParser->yystack;
yypParser->yystack[0].stateno = 0; pParser->yystack[0].stateno = 0;
yypParser->yystack[0].major = 0; pParser->yystack[0].major = 0;
#if YYSTACKDEPTH>0 #if YYSTACKDEPTH>0
yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
#endif #endif
} }
...@@ -1421,14 +1408,11 @@ void ParseInit(void *yypRawParser ParseCTX_PDECL){ ...@@ -1421,14 +1408,11 @@ void ParseInit(void *yypRawParser ParseCTX_PDECL){
** A pointer to a parser. This pointer is used in subsequent calls ** A pointer to a parser. This pointer is used in subsequent calls
** to Parse and ParseFree. ** to Parse and ParseFree.
*/ */
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
yyParser *yypParser; yyParser *pParser;
yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
if( yypParser ){ if( pParser ) ParseInit(pParser);
ParseCTX_STORE return pParser;
ParseInit(yypParser ParseCTX_PARAM);
}
return (void*)yypParser;
} }
#endif /* Parse_ENGINEALWAYSONSTACK */ #endif /* Parse_ENGINEALWAYSONSTACK */
...@@ -1445,8 +1429,7 @@ static void yy_destructor( ...@@ -1445,8 +1429,7 @@ static void yy_destructor(
YYCODETYPE yymajor, /* Type code for object to destroy */ YYCODETYPE yymajor, /* Type code for object to destroy */
YYMINORTYPE *yypminor /* The object to be destroyed */ YYMINORTYPE *yypminor /* The object to be destroyed */
){ ){
ParseARG_FETCH ParseARG_FETCH;
ParseCTX_FETCH
switch( yymajor ){ switch( yymajor ){
/* Here is inserted the actions which take place when a /* Here is inserted the actions which take place when a
** terminal or non-terminal is destroyed. This can happen ** terminal or non-terminal is destroyed. This can happen
...@@ -1459,59 +1442,59 @@ static void yy_destructor( ...@@ -1459,59 +1442,59 @@ static void yy_destructor(
** inside the C code. ** inside the C code.
*/ */
/********* Begin destructor definitions ***************************************/ /********* Begin destructor definitions ***************************************/
case 210: /* keep */ case 211: /* keep */
case 211: /* tagitemlist */ case 212: /* tagitemlist */
case 233: /* columnlist */ case 234: /* columnlist */
case 234: /* tagNamelist */ case 235: /* tagNamelist */
case 244: /* fill_opt */ case 245: /* fill_opt */
case 246: /* groupby_opt */ case 247: /* groupby_opt */
case 247: /* orderby_opt */ case 248: /* orderby_opt */
case 259: /* sortlist */ case 260: /* sortlist */
case 263: /* grouplist */ case 264: /* grouplist */
{ {
taosArrayDestroy((yypminor->yy193)); taosArrayDestroy((yypminor->yy15));
} }
break; break;
case 231: /* create_table_list */ case 232: /* create_table_list */
{ {
destroyCreateTableSql((yypminor->yy270)); destroyCreateTableSql((yypminor->yy482));
} }
break; break;
case 235: /* select */ case 236: /* select */
{ {
destroySqlNode((yypminor->yy124)); destroySqlNode((yypminor->yy134));
} }
break; break;
case 238: /* selcollist */ case 239: /* selcollist */
case 252: /* sclp */ case 253: /* sclp */
case 264: /* exprlist */ case 265: /* exprlist */
{ {
tSqlExprListDestroy((yypminor->yy193)); tSqlExprListDestroy((yypminor->yy15));
} }
break; break;
case 239: /* from */ case 240: /* from */
case 256: /* tablelist */ case 257: /* tablelist */
case 257: /* sub */ case 258: /* sub */
{ {
destroyRelationInfo((yypminor->yy332)); destroyRelationInfo((yypminor->yy160));
} }
break; break;
case 240: /* where_opt */ case 241: /* where_opt */
case 248: /* having_opt */ case 249: /* having_opt */
case 254: /* expr */ case 255: /* expr */
case 265: /* expritem */ case 266: /* expritem */
{ {
tSqlExprDestroy((yypminor->yy454)); tSqlExprDestroy((yypminor->yy328));
} }
break; break;
case 251: /* union */ case 252: /* union */
{ {
destroyAllSqlNode((yypminor->yy193)); destroyAllSqlNode((yypminor->yy15));
} }
break; break;
case 260: /* sortitem */ case 261: /* sortitem */
{ {
tVariantDestroy(&(yypminor->yy442)); tVariantDestroy(&(yypminor->yy380));
} }
break; break;
/********* End destructor definitions *****************************************/ /********* End destructor definitions *****************************************/
...@@ -1623,12 +1606,13 @@ int ParseCoverage(FILE *out){ ...@@ -1623,12 +1606,13 @@ int ParseCoverage(FILE *out){
** Find the appropriate action for a parser given the terminal ** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead. ** look-ahead token iLookAhead.
*/ */
static YYACTIONTYPE yy_find_shift_action( static unsigned int yy_find_shift_action(
YYCODETYPE iLookAhead, /* The look-ahead token */ yyParser *pParser, /* The parser */
YYACTIONTYPE stateno /* Current state number */ YYCODETYPE iLookAhead /* The look-ahead token */
){ ){
int i; int i;
int stateno = pParser->yytos->stateno;
if( stateno>YY_MAX_SHIFT ) return stateno; if( stateno>YY_MAX_SHIFT ) return stateno;
assert( stateno <= YY_SHIFT_COUNT ); assert( stateno <= YY_SHIFT_COUNT );
#if defined(YYCOVERAGE) #if defined(YYCOVERAGE)
...@@ -1636,19 +1620,15 @@ static YYACTIONTYPE yy_find_shift_action( ...@@ -1636,19 +1620,15 @@ static YYACTIONTYPE yy_find_shift_action(
#endif #endif
do{ do{
i = yy_shift_ofst[stateno]; i = yy_shift_ofst[stateno];
assert( i>=0 ); assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) );
assert( i<=YY_ACTTAB_COUNT );
assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
assert( iLookAhead!=YYNOCODE ); assert( iLookAhead!=YYNOCODE );
assert( iLookAhead < YYNTOKEN ); assert( iLookAhead < YYNTOKEN );
i += iLookAhead; i += iLookAhead;
assert( i<(int)YY_NLOOKAHEAD );
if( yy_lookahead[i]!=iLookAhead ){ if( yy_lookahead[i]!=iLookAhead ){
#ifdef YYFALLBACK #ifdef YYFALLBACK
YYCODETYPE iFallback; /* Fallback token */ YYCODETYPE iFallback; /* Fallback token */
assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) ); if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
iFallback = yyFallback[iLookAhead]; && (iFallback = yyFallback[iLookAhead])!=0 ){
if( iFallback!=0 ){
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
...@@ -1663,8 +1643,15 @@ static YYACTIONTYPE yy_find_shift_action( ...@@ -1663,8 +1643,15 @@ static YYACTIONTYPE yy_find_shift_action(
#ifdef YYWILDCARD #ifdef YYWILDCARD
{ {
int j = i - iLookAhead + YYWILDCARD; int j = i - iLookAhead + YYWILDCARD;
assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); if(
if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ #if YY_SHIFT_MIN+YYWILDCARD<0
j>=0 &&
#endif
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
j<YY_ACTTAB_COUNT &&
#endif
yy_lookahead[j]==YYWILDCARD && iLookAhead>0
){
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
...@@ -1678,7 +1665,6 @@ static YYACTIONTYPE yy_find_shift_action( ...@@ -1678,7 +1665,6 @@ static YYACTIONTYPE yy_find_shift_action(
#endif /* YYWILDCARD */ #endif /* YYWILDCARD */
return yy_default[stateno]; return yy_default[stateno];
}else{ }else{
assert( i>=0 && i<sizeof(yy_action)/sizeof(yy_action[0]) );
return yy_action[i]; return yy_action[i];
} }
}while(1); }while(1);
...@@ -1688,8 +1674,8 @@ static YYACTIONTYPE yy_find_shift_action( ...@@ -1688,8 +1674,8 @@ static YYACTIONTYPE yy_find_shift_action(
** Find the appropriate action for a parser given the non-terminal ** Find the appropriate action for a parser given the non-terminal
** look-ahead token iLookAhead. ** look-ahead token iLookAhead.
*/ */
static YYACTIONTYPE yy_find_reduce_action( static int yy_find_reduce_action(
YYACTIONTYPE stateno, /* Current state number */ int stateno, /* Current state number */
YYCODETYPE iLookAhead /* The look-ahead token */ YYCODETYPE iLookAhead /* The look-ahead token */
){ ){
int i; int i;
...@@ -1718,8 +1704,7 @@ static YYACTIONTYPE yy_find_reduce_action( ...@@ -1718,8 +1704,7 @@ static YYACTIONTYPE yy_find_reduce_action(
** The following routine is called if the stack overflows. ** The following routine is called if the stack overflows.
*/ */
static void yyStackOverflow(yyParser *yypParser){ static void yyStackOverflow(yyParser *yypParser){
ParseARG_FETCH ParseARG_FETCH;
ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
...@@ -1730,8 +1715,7 @@ static void yyStackOverflow(yyParser *yypParser){ ...@@ -1730,8 +1715,7 @@ static void yyStackOverflow(yyParser *yypParser){
** stack every overflows */ ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/ /******** Begin %stack_overflow code ******************************************/
/******** End %stack_overflow code ********************************************/ /******** End %stack_overflow code ********************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument var */ ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
ParseCTX_STORE
} }
/* /*
...@@ -1760,8 +1744,8 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ ...@@ -1760,8 +1744,8 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
*/ */
static void yy_shift( static void yy_shift(
yyParser *yypParser, /* The parser to be shifted */ yyParser *yypParser, /* The parser to be shifted */
YYACTIONTYPE yyNewState, /* The new state to shift in */ int yyNewState, /* The new state to shift in */
YYCODETYPE yyMajor, /* The major token to shift in */ int yyMajor, /* The major token to shift in */
ParseTOKENTYPE yyMinor /* The minor token to shift in */ ParseTOKENTYPE yyMinor /* The minor token to shift in */
){ ){
yyStackEntry *yytos; yyStackEntry *yytos;
...@@ -1791,580 +1775,299 @@ static void yy_shift( ...@@ -1791,580 +1775,299 @@ static void yy_shift(
yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
} }
yytos = yypParser->yytos; yytos = yypParser->yytos;
yytos->stateno = yyNewState; yytos->stateno = (YYACTIONTYPE)yyNewState;
yytos->major = yyMajor; yytos->major = (YYCODETYPE)yyMajor;
yytos->minor.yy0 = yyMinor; yytos->minor.yy0 = yyMinor;
yyTraceShift(yypParser, yyNewState, "Shift"); yyTraceShift(yypParser, yyNewState, "Shift");
} }
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side /* The following table contains information about every rule that
** of that rule */ ** is used during the reduce.
static const YYCODETYPE yyRuleInfoLhs[] = { */
189, /* (0) program ::= cmd */ static const struct {
190, /* (1) cmd ::= SHOW DATABASES */ YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
190, /* (2) cmd ::= SHOW TOPICS */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */
190, /* (3) cmd ::= SHOW MNODES */ } yyRuleInfo[] = {
190, /* (4) cmd ::= SHOW DNODES */ { 190, -1 }, /* (0) program ::= cmd */
190, /* (5) cmd ::= SHOW ACCOUNTS */ { 191, -2 }, /* (1) cmd ::= SHOW DATABASES */
190, /* (6) cmd ::= SHOW USERS */ { 191, -2 }, /* (2) cmd ::= SHOW TOPICS */
190, /* (7) cmd ::= SHOW MODULES */ { 191, -2 }, /* (3) cmd ::= SHOW MNODES */
190, /* (8) cmd ::= SHOW QUERIES */ { 191, -2 }, /* (4) cmd ::= SHOW DNODES */
190, /* (9) cmd ::= SHOW CONNECTIONS */ { 191, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */
190, /* (10) cmd ::= SHOW STREAMS */ { 191, -2 }, /* (6) cmd ::= SHOW USERS */
190, /* (11) cmd ::= SHOW VARIABLES */ { 191, -2 }, /* (7) cmd ::= SHOW MODULES */
190, /* (12) cmd ::= SHOW SCORES */ { 191, -2 }, /* (8) cmd ::= SHOW QUERIES */
190, /* (13) cmd ::= SHOW GRANTS */ { 191, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */
190, /* (14) cmd ::= SHOW VNODES */ { 191, -2 }, /* (10) cmd ::= SHOW STREAMS */
190, /* (15) cmd ::= SHOW VNODES IPTOKEN */ { 191, -2 }, /* (11) cmd ::= SHOW VARIABLES */
191, /* (16) dbPrefix ::= */ { 191, -2 }, /* (12) cmd ::= SHOW SCORES */
191, /* (17) dbPrefix ::= ids DOT */ { 191, -2 }, /* (13) cmd ::= SHOW GRANTS */
193, /* (18) cpxName ::= */ { 191, -2 }, /* (14) cmd ::= SHOW VNODES */
193, /* (19) cpxName ::= DOT ids */ { 191, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */
190, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ { 192, 0 }, /* (16) dbPrefix ::= */
190, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ { 192, -2 }, /* (17) dbPrefix ::= ids DOT */
190, /* (22) cmd ::= SHOW CREATE DATABASE ids */ { 194, 0 }, /* (18) cpxName ::= */
190, /* (23) cmd ::= SHOW dbPrefix TABLES */ { 194, -2 }, /* (19) cpxName ::= DOT ids */
190, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ { 191, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */
190, /* (25) cmd ::= SHOW dbPrefix STABLES */ { 191, -5 }, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */
190, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ { 191, -4 }, /* (22) cmd ::= SHOW CREATE DATABASE ids */
190, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ { 191, -3 }, /* (23) cmd ::= SHOW dbPrefix TABLES */
190, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ { 191, -5 }, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */
190, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ { 191, -3 }, /* (25) cmd ::= SHOW dbPrefix STABLES */
190, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ { 191, -5 }, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */
190, /* (31) cmd ::= DROP DATABASE ifexists ids */ { 191, -3 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS */
190, /* (32) cmd ::= DROP TOPIC ifexists ids */ { 191, -4 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */
190, /* (33) cmd ::= DROP DNODE ids */ { 191, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */
190, /* (34) cmd ::= DROP USER ids */ { 191, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */
190, /* (35) cmd ::= DROP ACCOUNT ids */ { 191, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */
190, /* (36) cmd ::= USE ids */ { 191, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */
190, /* (37) cmd ::= DESCRIBE ids cpxName */ { 191, -3 }, /* (33) cmd ::= DROP DNODE ids */
190, /* (38) cmd ::= ALTER USER ids PASS ids */ { 191, -3 }, /* (34) cmd ::= DROP USER ids */
190, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ { 191, -3 }, /* (35) cmd ::= DROP ACCOUNT ids */
190, /* (40) cmd ::= ALTER DNODE ids ids */ { 191, -2 }, /* (36) cmd ::= USE ids */
190, /* (41) cmd ::= ALTER DNODE ids ids ids */ { 191, -3 }, /* (37) cmd ::= DESCRIBE ids cpxName */
190, /* (42) cmd ::= ALTER LOCAL ids */ { 191, -5 }, /* (38) cmd ::= ALTER USER ids PASS ids */
190, /* (43) cmd ::= ALTER LOCAL ids ids */ { 191, -5 }, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */
190, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ { 191, -4 }, /* (40) cmd ::= ALTER DNODE ids ids */
190, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ { 191, -5 }, /* (41) cmd ::= ALTER DNODE ids ids ids */
190, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ { 191, -3 }, /* (42) cmd ::= ALTER LOCAL ids */
190, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ { 191, -4 }, /* (43) cmd ::= ALTER LOCAL ids ids */
192, /* (48) ids ::= ID */ { 191, -4 }, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */
192, /* (49) ids ::= STRING */ { 191, -4 }, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */
194, /* (50) ifexists ::= IF EXISTS */ { 191, -4 }, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */
194, /* (51) ifexists ::= */ { 191, -6 }, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
198, /* (52) ifnotexists ::= IF NOT EXISTS */ { 193, -1 }, /* (48) ids ::= ID */
198, /* (53) ifnotexists ::= */ { 193, -1 }, /* (49) ids ::= STRING */
190, /* (54) cmd ::= CREATE DNODE ids */ { 195, -2 }, /* (50) ifexists ::= IF EXISTS */
190, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ { 195, 0 }, /* (51) ifexists ::= */
190, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ { 199, -3 }, /* (52) ifnotexists ::= IF NOT EXISTS */
190, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ { 199, 0 }, /* (53) ifnotexists ::= */
190, /* (58) cmd ::= CREATE USER ids PASS ids */ { 191, -3 }, /* (54) cmd ::= CREATE DNODE ids */
201, /* (59) pps ::= */ { 191, -6 }, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
201, /* (60) pps ::= PPS INTEGER */ { 191, -5 }, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
202, /* (61) tseries ::= */ { 191, -5 }, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
202, /* (62) tseries ::= TSERIES INTEGER */ { 191, -5 }, /* (58) cmd ::= CREATE USER ids PASS ids */
203, /* (63) dbs ::= */ { 202, 0 }, /* (59) pps ::= */
203, /* (64) dbs ::= DBS INTEGER */ { 202, -2 }, /* (60) pps ::= PPS INTEGER */
204, /* (65) streams ::= */ { 203, 0 }, /* (61) tseries ::= */
204, /* (66) streams ::= STREAMS INTEGER */ { 203, -2 }, /* (62) tseries ::= TSERIES INTEGER */
205, /* (67) storage ::= */ { 204, 0 }, /* (63) dbs ::= */
205, /* (68) storage ::= STORAGE INTEGER */ { 204, -2 }, /* (64) dbs ::= DBS INTEGER */
206, /* (69) qtime ::= */ { 205, 0 }, /* (65) streams ::= */
206, /* (70) qtime ::= QTIME INTEGER */ { 205, -2 }, /* (66) streams ::= STREAMS INTEGER */
207, /* (71) users ::= */ { 206, 0 }, /* (67) storage ::= */
207, /* (72) users ::= USERS INTEGER */ { 206, -2 }, /* (68) storage ::= STORAGE INTEGER */
208, /* (73) conns ::= */ { 207, 0 }, /* (69) qtime ::= */
208, /* (74) conns ::= CONNS INTEGER */ { 207, -2 }, /* (70) qtime ::= QTIME INTEGER */
209, /* (75) state ::= */ { 208, 0 }, /* (71) users ::= */
209, /* (76) state ::= STATE ids */ { 208, -2 }, /* (72) users ::= USERS INTEGER */
197, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { 209, 0 }, /* (73) conns ::= */
210, /* (78) keep ::= KEEP tagitemlist */ { 209, -2 }, /* (74) conns ::= CONNS INTEGER */
212, /* (79) cache ::= CACHE INTEGER */ { 210, 0 }, /* (75) state ::= */
213, /* (80) replica ::= REPLICA INTEGER */ { 210, -2 }, /* (76) state ::= STATE ids */
214, /* (81) quorum ::= QUORUM INTEGER */ { 198, -9 }, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
215, /* (82) days ::= DAYS INTEGER */ { 211, -2 }, /* (78) keep ::= KEEP tagitemlist */
216, /* (83) minrows ::= MINROWS INTEGER */ { 213, -2 }, /* (79) cache ::= CACHE INTEGER */
217, /* (84) maxrows ::= MAXROWS INTEGER */ { 214, -2 }, /* (80) replica ::= REPLICA INTEGER */
218, /* (85) blocks ::= BLOCKS INTEGER */ { 215, -2 }, /* (81) quorum ::= QUORUM INTEGER */
219, /* (86) ctime ::= CTIME INTEGER */ { 216, -2 }, /* (82) days ::= DAYS INTEGER */
220, /* (87) wal ::= WAL INTEGER */ { 217, -2 }, /* (83) minrows ::= MINROWS INTEGER */
221, /* (88) fsync ::= FSYNC INTEGER */ { 218, -2 }, /* (84) maxrows ::= MAXROWS INTEGER */
222, /* (89) comp ::= COMP INTEGER */ { 219, -2 }, /* (85) blocks ::= BLOCKS INTEGER */
223, /* (90) prec ::= PRECISION STRING */ { 220, -2 }, /* (86) ctime ::= CTIME INTEGER */
224, /* (91) update ::= UPDATE INTEGER */ { 221, -2 }, /* (87) wal ::= WAL INTEGER */
225, /* (92) cachelast ::= CACHELAST INTEGER */ { 222, -2 }, /* (88) fsync ::= FSYNC INTEGER */
226, /* (93) partitions ::= PARTITIONS INTEGER */ { 223, -2 }, /* (89) comp ::= COMP INTEGER */
199, /* (94) db_optr ::= */ { 224, -2 }, /* (90) prec ::= PRECISION STRING */
199, /* (95) db_optr ::= db_optr cache */ { 225, -2 }, /* (91) update ::= UPDATE INTEGER */
199, /* (96) db_optr ::= db_optr replica */ { 226, -2 }, /* (92) cachelast ::= CACHELAST INTEGER */
199, /* (97) db_optr ::= db_optr quorum */ { 227, -2 }, /* (93) partitions ::= PARTITIONS INTEGER */
199, /* (98) db_optr ::= db_optr days */ { 200, 0 }, /* (94) db_optr ::= */
199, /* (99) db_optr ::= db_optr minrows */ { 200, -2 }, /* (95) db_optr ::= db_optr cache */
199, /* (100) db_optr ::= db_optr maxrows */ { 200, -2 }, /* (96) db_optr ::= db_optr replica */
199, /* (101) db_optr ::= db_optr blocks */ { 200, -2 }, /* (97) db_optr ::= db_optr quorum */
199, /* (102) db_optr ::= db_optr ctime */ { 200, -2 }, /* (98) db_optr ::= db_optr days */
199, /* (103) db_optr ::= db_optr wal */ { 200, -2 }, /* (99) db_optr ::= db_optr minrows */
199, /* (104) db_optr ::= db_optr fsync */ { 200, -2 }, /* (100) db_optr ::= db_optr maxrows */
199, /* (105) db_optr ::= db_optr comp */ { 200, -2 }, /* (101) db_optr ::= db_optr blocks */
199, /* (106) db_optr ::= db_optr prec */ { 200, -2 }, /* (102) db_optr ::= db_optr ctime */
199, /* (107) db_optr ::= db_optr keep */ { 200, -2 }, /* (103) db_optr ::= db_optr wal */
199, /* (108) db_optr ::= db_optr update */ { 200, -2 }, /* (104) db_optr ::= db_optr fsync */
199, /* (109) db_optr ::= db_optr cachelast */ { 200, -2 }, /* (105) db_optr ::= db_optr comp */
200, /* (110) topic_optr ::= db_optr */ { 200, -2 }, /* (106) db_optr ::= db_optr prec */
200, /* (111) topic_optr ::= topic_optr partitions */ { 200, -2 }, /* (107) db_optr ::= db_optr keep */
195, /* (112) alter_db_optr ::= */ { 200, -2 }, /* (108) db_optr ::= db_optr update */
195, /* (113) alter_db_optr ::= alter_db_optr replica */ { 200, -2 }, /* (109) db_optr ::= db_optr cachelast */
195, /* (114) alter_db_optr ::= alter_db_optr quorum */ { 201, -1 }, /* (110) topic_optr ::= db_optr */
195, /* (115) alter_db_optr ::= alter_db_optr keep */ { 201, -2 }, /* (111) topic_optr ::= topic_optr partitions */
195, /* (116) alter_db_optr ::= alter_db_optr blocks */ { 196, 0 }, /* (112) alter_db_optr ::= */
195, /* (117) alter_db_optr ::= alter_db_optr comp */ { 196, -2 }, /* (113) alter_db_optr ::= alter_db_optr replica */
195, /* (118) alter_db_optr ::= alter_db_optr wal */ { 196, -2 }, /* (114) alter_db_optr ::= alter_db_optr quorum */
195, /* (119) alter_db_optr ::= alter_db_optr fsync */ { 196, -2 }, /* (115) alter_db_optr ::= alter_db_optr keep */
195, /* (120) alter_db_optr ::= alter_db_optr update */ { 196, -2 }, /* (116) alter_db_optr ::= alter_db_optr blocks */
195, /* (121) alter_db_optr ::= alter_db_optr cachelast */ { 196, -2 }, /* (117) alter_db_optr ::= alter_db_optr comp */
196, /* (122) alter_topic_optr ::= alter_db_optr */ { 196, -2 }, /* (118) alter_db_optr ::= alter_db_optr wal */
196, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ { 196, -2 }, /* (119) alter_db_optr ::= alter_db_optr fsync */
227, /* (124) typename ::= ids */ { 196, -2 }, /* (120) alter_db_optr ::= alter_db_optr update */
227, /* (125) typename ::= ids LP signed RP */ { 196, -2 }, /* (121) alter_db_optr ::= alter_db_optr cachelast */
227, /* (126) typename ::= ids UNSIGNED */ { 197, -1 }, /* (122) alter_topic_optr ::= alter_db_optr */
228, /* (127) signed ::= INTEGER */ { 197, -2 }, /* (123) alter_topic_optr ::= alter_topic_optr partitions */
228, /* (128) signed ::= PLUS INTEGER */ { 228, -1 }, /* (124) typename ::= ids */
228, /* (129) signed ::= MINUS INTEGER */ { 228, -4 }, /* (125) typename ::= ids LP signed RP */
190, /* (130) cmd ::= CREATE TABLE create_table_args */ { 228, -2 }, /* (126) typename ::= ids UNSIGNED */
190, /* (131) cmd ::= CREATE TABLE create_stable_args */ { 229, -1 }, /* (127) signed ::= INTEGER */
190, /* (132) cmd ::= CREATE STABLE create_stable_args */ { 229, -2 }, /* (128) signed ::= PLUS INTEGER */
190, /* (133) cmd ::= CREATE TABLE create_table_list */ { 229, -2 }, /* (129) signed ::= MINUS INTEGER */
231, /* (134) create_table_list ::= create_from_stable */ { 191, -3 }, /* (130) cmd ::= CREATE TABLE create_table_args */
231, /* (135) create_table_list ::= create_table_list create_from_stable */ { 191, -3 }, /* (131) cmd ::= CREATE TABLE create_stable_args */
229, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { 191, -3 }, /* (132) cmd ::= CREATE STABLE create_stable_args */
230, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { 191, -3 }, /* (133) cmd ::= CREATE TABLE create_table_list */
232, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ { 232, -1 }, /* (134) create_table_list ::= create_from_stable */
232, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ { 232, -2 }, /* (135) create_table_list ::= create_table_list create_from_stable */
234, /* (140) tagNamelist ::= tagNamelist COMMA ids */ { 230, -6 }, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
234, /* (141) tagNamelist ::= ids */ { 231, -10 }, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
229, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ { 233, -10 }, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
233, /* (143) columnlist ::= columnlist COMMA column */ { 233, -13 }, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
233, /* (144) columnlist ::= column */ { 235, -3 }, /* (140) tagNamelist ::= tagNamelist COMMA ids */
236, /* (145) column ::= ids typename */ { 235, -1 }, /* (141) tagNamelist ::= ids */
211, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ { 230, -5 }, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */
211, /* (147) tagitemlist ::= tagitem */ { 234, -3 }, /* (143) columnlist ::= columnlist COMMA column */
237, /* (148) tagitem ::= INTEGER */ { 234, -1 }, /* (144) columnlist ::= column */
237, /* (149) tagitem ::= FLOAT */ { 237, -2 }, /* (145) column ::= ids typename */
237, /* (150) tagitem ::= STRING */ { 212, -3 }, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */
237, /* (151) tagitem ::= BOOL */ { 212, -1 }, /* (147) tagitemlist ::= tagitem */
237, /* (152) tagitem ::= NULL */ { 238, -1 }, /* (148) tagitem ::= INTEGER */
237, /* (153) tagitem ::= MINUS INTEGER */ { 238, -1 }, /* (149) tagitem ::= FLOAT */
237, /* (154) tagitem ::= MINUS FLOAT */ { 238, -1 }, /* (150) tagitem ::= STRING */
237, /* (155) tagitem ::= PLUS INTEGER */ { 238, -1 }, /* (151) tagitem ::= BOOL */
237, /* (156) tagitem ::= PLUS FLOAT */ { 238, -1 }, /* (152) tagitem ::= NULL */
235, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { 238, -2 }, /* (153) tagitem ::= MINUS INTEGER */
235, /* (158) select ::= LP select RP */ { 238, -2 }, /* (154) tagitem ::= MINUS FLOAT */
251, /* (159) union ::= select */ { 238, -2 }, /* (155) tagitem ::= PLUS INTEGER */
251, /* (160) union ::= union UNION ALL select */ { 238, -2 }, /* (156) tagitem ::= PLUS FLOAT */
190, /* (161) cmd ::= union */ { 236, -14 }, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
235, /* (162) select ::= SELECT selcollist */ { 236, -3 }, /* (158) select ::= LP select RP */
252, /* (163) sclp ::= selcollist COMMA */ { 252, -1 }, /* (159) union ::= select */
252, /* (164) sclp ::= */ { 252, -4 }, /* (160) union ::= union UNION ALL select */
238, /* (165) selcollist ::= sclp distinct expr as */ { 191, -1 }, /* (161) cmd ::= union */
238, /* (166) selcollist ::= sclp STAR */ { 236, -2 }, /* (162) select ::= SELECT selcollist */
255, /* (167) as ::= AS ids */ { 253, -2 }, /* (163) sclp ::= selcollist COMMA */
255, /* (168) as ::= ids */ { 253, 0 }, /* (164) sclp ::= */
255, /* (169) as ::= */ { 239, -4 }, /* (165) selcollist ::= sclp distinct expr as */
253, /* (170) distinct ::= DISTINCT */ { 239, -2 }, /* (166) selcollist ::= sclp STAR */
253, /* (171) distinct ::= */ { 256, -2 }, /* (167) as ::= AS ids */
239, /* (172) from ::= FROM tablelist */ { 256, -1 }, /* (168) as ::= ids */
239, /* (173) from ::= FROM sub */ { 256, 0 }, /* (169) as ::= */
257, /* (174) sub ::= LP union RP */ { 254, -1 }, /* (170) distinct ::= DISTINCT */
257, /* (175) sub ::= LP union RP ids */ { 254, 0 }, /* (171) distinct ::= */
257, /* (176) sub ::= sub COMMA LP union RP ids */ { 240, -2 }, /* (172) from ::= FROM tablelist */
256, /* (177) tablelist ::= ids cpxName */ { 240, -2 }, /* (173) from ::= FROM sub */
256, /* (178) tablelist ::= ids cpxName ids */ { 258, -3 }, /* (174) sub ::= LP union RP */
256, /* (179) tablelist ::= tablelist COMMA ids cpxName */ { 258, -4 }, /* (175) sub ::= LP union RP ids */
256, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */ { 258, -6 }, /* (176) sub ::= sub COMMA LP union RP ids */
258, /* (181) tmvar ::= VARIABLE */ { 257, -2 }, /* (177) tablelist ::= ids cpxName */
241, /* (182) interval_opt ::= INTERVAL LP tmvar RP */ { 257, -3 }, /* (178) tablelist ::= ids cpxName ids */
241, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ { 257, -4 }, /* (179) tablelist ::= tablelist COMMA ids cpxName */
241, /* (184) interval_opt ::= */ { 257, -5 }, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */
242, /* (185) session_option ::= */ { 259, -1 }, /* (181) tmvar ::= VARIABLE */
242, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { 242, -4 }, /* (182) interval_opt ::= INTERVAL LP tmvar RP */
243, /* (187) windowstate_option ::= */ { 242, -6 }, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
243, /* (188) windowstate_option ::= STATE_WINDOW LP ids RP */ { 242, 0 }, /* (184) interval_opt ::= */
244, /* (189) fill_opt ::= */ { 243, 0 }, /* (185) session_option ::= */
244, /* (190) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { 243, -7 }, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
244, /* (191) fill_opt ::= FILL LP ID RP */ { 244, 0 }, /* (187) windowstate_option ::= */
245, /* (192) sliding_opt ::= SLIDING LP tmvar RP */ { 244, -4 }, /* (188) windowstate_option ::= STATE_WINDOW LP ids RP */
245, /* (193) sliding_opt ::= */ { 245, 0 }, /* (189) fill_opt ::= */
247, /* (194) orderby_opt ::= */ { 245, -6 }, /* (190) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
247, /* (195) orderby_opt ::= ORDER BY sortlist */ { 245, -4 }, /* (191) fill_opt ::= FILL LP ID RP */
259, /* (196) sortlist ::= sortlist COMMA item sortorder */ { 246, -4 }, /* (192) sliding_opt ::= SLIDING LP tmvar RP */
259, /* (197) sortlist ::= item sortorder */ { 246, 0 }, /* (193) sliding_opt ::= */
261, /* (198) item ::= ids cpxName */ { 248, 0 }, /* (194) orderby_opt ::= */
262, /* (199) sortorder ::= ASC */ { 248, -3 }, /* (195) orderby_opt ::= ORDER BY sortlist */
262, /* (200) sortorder ::= DESC */ { 260, -4 }, /* (196) sortlist ::= sortlist COMMA item sortorder */
262, /* (201) sortorder ::= */ { 260, -2 }, /* (197) sortlist ::= item sortorder */
246, /* (202) groupby_opt ::= */ { 262, -2 }, /* (198) item ::= ids cpxName */
246, /* (203) groupby_opt ::= GROUP BY grouplist */ { 263, -1 }, /* (199) sortorder ::= ASC */
263, /* (204) grouplist ::= grouplist COMMA item */ { 263, -1 }, /* (200) sortorder ::= DESC */
263, /* (205) grouplist ::= item */ { 263, 0 }, /* (201) sortorder ::= */
248, /* (206) having_opt ::= */ { 247, 0 }, /* (202) groupby_opt ::= */
248, /* (207) having_opt ::= HAVING expr */ { 247, -3 }, /* (203) groupby_opt ::= GROUP BY grouplist */
250, /* (208) limit_opt ::= */ { 264, -3 }, /* (204) grouplist ::= grouplist COMMA item */
250, /* (209) limit_opt ::= LIMIT signed */ { 264, -1 }, /* (205) grouplist ::= item */
250, /* (210) limit_opt ::= LIMIT signed OFFSET signed */ { 249, 0 }, /* (206) having_opt ::= */
250, /* (211) limit_opt ::= LIMIT signed COMMA signed */ { 249, -2 }, /* (207) having_opt ::= HAVING expr */
249, /* (212) slimit_opt ::= */ { 251, 0 }, /* (208) limit_opt ::= */
249, /* (213) slimit_opt ::= SLIMIT signed */ { 251, -2 }, /* (209) limit_opt ::= LIMIT signed */
249, /* (214) slimit_opt ::= SLIMIT signed SOFFSET signed */ { 251, -4 }, /* (210) limit_opt ::= LIMIT signed OFFSET signed */
249, /* (215) slimit_opt ::= SLIMIT signed COMMA signed */ { 251, -4 }, /* (211) limit_opt ::= LIMIT signed COMMA signed */
240, /* (216) where_opt ::= */ { 250, 0 }, /* (212) slimit_opt ::= */
240, /* (217) where_opt ::= WHERE expr */ { 250, -2 }, /* (213) slimit_opt ::= SLIMIT signed */
254, /* (218) expr ::= LP expr RP */ { 250, -4 }, /* (214) slimit_opt ::= SLIMIT signed SOFFSET signed */
254, /* (219) expr ::= ID */ { 250, -4 }, /* (215) slimit_opt ::= SLIMIT signed COMMA signed */
254, /* (220) expr ::= ID DOT ID */ { 241, 0 }, /* (216) where_opt ::= */
254, /* (221) expr ::= ID DOT STAR */ { 241, -2 }, /* (217) where_opt ::= WHERE expr */
254, /* (222) expr ::= INTEGER */ { 255, -3 }, /* (218) expr ::= LP expr RP */
254, /* (223) expr ::= MINUS INTEGER */ { 255, -1 }, /* (219) expr ::= ID */
254, /* (224) expr ::= PLUS INTEGER */ { 255, -3 }, /* (220) expr ::= ID DOT ID */
254, /* (225) expr ::= FLOAT */ { 255, -3 }, /* (221) expr ::= ID DOT STAR */
254, /* (226) expr ::= MINUS FLOAT */ { 255, -1 }, /* (222) expr ::= INTEGER */
254, /* (227) expr ::= PLUS FLOAT */ { 255, -2 }, /* (223) expr ::= MINUS INTEGER */
254, /* (228) expr ::= STRING */ { 255, -2 }, /* (224) expr ::= PLUS INTEGER */
254, /* (229) expr ::= NOW */ { 255, -1 }, /* (225) expr ::= FLOAT */
254, /* (230) expr ::= VARIABLE */ { 255, -2 }, /* (226) expr ::= MINUS FLOAT */
254, /* (231) expr ::= PLUS VARIABLE */ { 255, -2 }, /* (227) expr ::= PLUS FLOAT */
254, /* (232) expr ::= MINUS VARIABLE */ { 255, -1 }, /* (228) expr ::= STRING */
254, /* (233) expr ::= BOOL */ { 255, -1 }, /* (229) expr ::= NOW */
254, /* (234) expr ::= NULL */ { 255, -1 }, /* (230) expr ::= VARIABLE */
254, /* (235) expr ::= ID LP exprlist RP */ { 255, -2 }, /* (231) expr ::= PLUS VARIABLE */
254, /* (236) expr ::= ID LP STAR RP */ { 255, -2 }, /* (232) expr ::= MINUS VARIABLE */
254, /* (237) expr ::= expr IS NULL */ { 255, -1 }, /* (233) expr ::= BOOL */
254, /* (238) expr ::= expr IS NOT NULL */ { 255, -1 }, /* (234) expr ::= NULL */
254, /* (239) expr ::= expr LT expr */ { 255, -4 }, /* (235) expr ::= ID LP exprlist RP */
254, /* (240) expr ::= expr GT expr */ { 255, -4 }, /* (236) expr ::= ID LP STAR RP */
254, /* (241) expr ::= expr LE expr */ { 255, -3 }, /* (237) expr ::= expr IS NULL */
254, /* (242) expr ::= expr GE expr */ { 255, -4 }, /* (238) expr ::= expr IS NOT NULL */
254, /* (243) expr ::= expr NE expr */ { 255, -3 }, /* (239) expr ::= expr LT expr */
254, /* (244) expr ::= expr EQ expr */ { 255, -3 }, /* (240) expr ::= expr GT expr */
254, /* (245) expr ::= expr BETWEEN expr AND expr */ { 255, -3 }, /* (241) expr ::= expr LE expr */
254, /* (246) expr ::= expr AND expr */ { 255, -3 }, /* (242) expr ::= expr GE expr */
254, /* (247) expr ::= expr OR expr */ { 255, -3 }, /* (243) expr ::= expr NE expr */
254, /* (248) expr ::= expr PLUS expr */ { 255, -3 }, /* (244) expr ::= expr EQ expr */
254, /* (249) expr ::= expr MINUS expr */ { 255, -5 }, /* (245) expr ::= expr BETWEEN expr AND expr */
254, /* (250) expr ::= expr STAR expr */ { 255, -3 }, /* (246) expr ::= expr AND expr */
254, /* (251) expr ::= expr SLASH expr */ { 255, -3 }, /* (247) expr ::= expr OR expr */
254, /* (252) expr ::= expr REM expr */ { 255, -3 }, /* (248) expr ::= expr PLUS expr */
254, /* (253) expr ::= expr LIKE expr */ { 255, -3 }, /* (249) expr ::= expr MINUS expr */
254, /* (254) expr ::= expr IN LP exprlist RP */ { 255, -3 }, /* (250) expr ::= expr STAR expr */
264, /* (255) exprlist ::= exprlist COMMA expritem */ { 255, -3 }, /* (251) expr ::= expr SLASH expr */
264, /* (256) exprlist ::= expritem */ { 255, -3 }, /* (252) expr ::= expr REM expr */
265, /* (257) expritem ::= expr */ { 255, -3 }, /* (253) expr ::= expr LIKE expr */
265, /* (258) expritem ::= */ { 255, -5 }, /* (254) expr ::= expr IN LP exprlist RP */
190, /* (259) cmd ::= RESET QUERY CACHE */ { 265, -3 }, /* (255) exprlist ::= exprlist COMMA expritem */
190, /* (260) cmd ::= SYNCDB ids REPLICA */ { 265, -1 }, /* (256) exprlist ::= expritem */
190, /* (261) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { 266, -1 }, /* (257) expritem ::= expr */
190, /* (262) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { 266, 0 }, /* (258) expritem ::= */
190, /* (263) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { 191, -3 }, /* (259) cmd ::= RESET QUERY CACHE */
190, /* (264) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { 191, -3 }, /* (260) cmd ::= SYNCDB ids REPLICA */
190, /* (265) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { 191, -7 }, /* (261) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
190, /* (266) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { 191, -7 }, /* (262) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
190, /* (267) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { 191, -7 }, /* (263) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
190, /* (268) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { 191, -7 }, /* (264) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
190, /* (269) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { 191, -7 }, /* (265) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
190, /* (270) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { 191, -8 }, /* (266) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
190, /* (271) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { 191, -9 }, /* (267) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
190, /* (272) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { 191, -7 }, /* (268) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
190, /* (273) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { 191, -7 }, /* (269) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
190, /* (274) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { 191, -7 }, /* (270) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
190, /* (275) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { 191, -7 }, /* (271) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
190, /* (276) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { 191, -7 }, /* (272) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
190, /* (277) cmd ::= KILL CONNECTION INTEGER */ { 191, -7 }, /* (273) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
190, /* (278) cmd ::= KILL STREAM INTEGER COLON INTEGER */ { 191, -8 }, /* (274) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
190, /* (279) cmd ::= KILL QUERY INTEGER COLON INTEGER */ { 191, -9 }, /* (275) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
}; { 191, -7 }, /* (276) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{ 191, -3 }, /* (277) cmd ::= KILL CONNECTION INTEGER */
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number { 191, -5 }, /* (278) cmd ::= KILL STREAM INTEGER COLON INTEGER */
** of symbols on the right-hand side of that rule. */ { 191, -5 }, /* (279) cmd ::= KILL QUERY INTEGER COLON INTEGER */
static const signed char yyRuleInfoNRhs[] = {
-1, /* (0) program ::= cmd */
-2, /* (1) cmd ::= SHOW DATABASES */
-2, /* (2) cmd ::= SHOW TOPICS */
-2, /* (3) cmd ::= SHOW MNODES */
-2, /* (4) cmd ::= SHOW DNODES */
-2, /* (5) cmd ::= SHOW ACCOUNTS */
-2, /* (6) cmd ::= SHOW USERS */
-2, /* (7) cmd ::= SHOW MODULES */
-2, /* (8) cmd ::= SHOW QUERIES */
-2, /* (9) cmd ::= SHOW CONNECTIONS */
-2, /* (10) cmd ::= SHOW STREAMS */
-2, /* (11) cmd ::= SHOW VARIABLES */
-2, /* (12) cmd ::= SHOW SCORES */
-2, /* (13) cmd ::= SHOW GRANTS */
-2, /* (14) cmd ::= SHOW VNODES */
-3, /* (15) cmd ::= SHOW VNODES IPTOKEN */
0, /* (16) dbPrefix ::= */
-2, /* (17) dbPrefix ::= ids DOT */
0, /* (18) cpxName ::= */
-2, /* (19) cpxName ::= DOT ids */
-5, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */
-5, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */
-4, /* (22) cmd ::= SHOW CREATE DATABASE ids */
-3, /* (23) cmd ::= SHOW dbPrefix TABLES */
-5, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */
-3, /* (25) cmd ::= SHOW dbPrefix STABLES */
-5, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */
-3, /* (27) cmd ::= SHOW dbPrefix VGROUPS */
-4, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */
-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 DNODE ids */
-3, /* (34) cmd ::= DROP USER ids */
-3, /* (35) cmd ::= DROP ACCOUNT ids */
-2, /* (36) cmd ::= USE ids */
-3, /* (37) cmd ::= DESCRIBE ids cpxName */
-5, /* (38) cmd ::= ALTER USER ids PASS ids */
-5, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */
-4, /* (40) cmd ::= ALTER DNODE ids ids */
-5, /* (41) cmd ::= ALTER DNODE ids ids ids */
-3, /* (42) cmd ::= ALTER LOCAL ids */
-4, /* (43) cmd ::= ALTER LOCAL ids ids */
-4, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */
-4, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */
-4, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */
-6, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
-1, /* (48) ids ::= ID */
-1, /* (49) ids ::= STRING */
-2, /* (50) ifexists ::= IF EXISTS */
0, /* (51) ifexists ::= */
-3, /* (52) ifnotexists ::= IF NOT EXISTS */
0, /* (53) ifnotexists ::= */
-3, /* (54) cmd ::= CREATE DNODE ids */
-6, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
-5, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
-5, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
-5, /* (58) cmd ::= CREATE USER ids PASS ids */
0, /* (59) pps ::= */
-2, /* (60) pps ::= PPS INTEGER */
0, /* (61) tseries ::= */
-2, /* (62) tseries ::= TSERIES INTEGER */
0, /* (63) dbs ::= */
-2, /* (64) dbs ::= DBS INTEGER */
0, /* (65) streams ::= */
-2, /* (66) streams ::= STREAMS INTEGER */
0, /* (67) storage ::= */
-2, /* (68) storage ::= STORAGE INTEGER */
0, /* (69) qtime ::= */
-2, /* (70) qtime ::= QTIME INTEGER */
0, /* (71) users ::= */
-2, /* (72) users ::= USERS INTEGER */
0, /* (73) conns ::= */
-2, /* (74) conns ::= CONNS INTEGER */
0, /* (75) state ::= */
-2, /* (76) state ::= STATE ids */
-9, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
-2, /* (78) keep ::= KEEP tagitemlist */
-2, /* (79) cache ::= CACHE INTEGER */
-2, /* (80) replica ::= REPLICA INTEGER */
-2, /* (81) quorum ::= QUORUM INTEGER */
-2, /* (82) days ::= DAYS INTEGER */
-2, /* (83) minrows ::= MINROWS INTEGER */
-2, /* (84) maxrows ::= MAXROWS INTEGER */
-2, /* (85) blocks ::= BLOCKS INTEGER */
-2, /* (86) ctime ::= CTIME INTEGER */
-2, /* (87) wal ::= WAL INTEGER */
-2, /* (88) fsync ::= FSYNC INTEGER */
-2, /* (89) comp ::= COMP INTEGER */
-2, /* (90) prec ::= PRECISION STRING */
-2, /* (91) update ::= UPDATE INTEGER */
-2, /* (92) cachelast ::= CACHELAST INTEGER */
-2, /* (93) partitions ::= PARTITIONS INTEGER */
0, /* (94) db_optr ::= */
-2, /* (95) db_optr ::= db_optr cache */
-2, /* (96) db_optr ::= db_optr replica */
-2, /* (97) db_optr ::= db_optr quorum */
-2, /* (98) db_optr ::= db_optr days */
-2, /* (99) db_optr ::= db_optr minrows */
-2, /* (100) db_optr ::= db_optr maxrows */
-2, /* (101) db_optr ::= db_optr blocks */
-2, /* (102) db_optr ::= db_optr ctime */
-2, /* (103) db_optr ::= db_optr wal */
-2, /* (104) db_optr ::= db_optr fsync */
-2, /* (105) db_optr ::= db_optr comp */
-2, /* (106) db_optr ::= db_optr prec */
-2, /* (107) db_optr ::= db_optr keep */
-2, /* (108) db_optr ::= db_optr update */
-2, /* (109) db_optr ::= db_optr cachelast */
-1, /* (110) topic_optr ::= db_optr */
-2, /* (111) topic_optr ::= topic_optr partitions */
0, /* (112) alter_db_optr ::= */
-2, /* (113) alter_db_optr ::= alter_db_optr replica */
-2, /* (114) alter_db_optr ::= alter_db_optr quorum */
-2, /* (115) alter_db_optr ::= alter_db_optr keep */
-2, /* (116) alter_db_optr ::= alter_db_optr blocks */
-2, /* (117) alter_db_optr ::= alter_db_optr comp */
-2, /* (118) alter_db_optr ::= alter_db_optr wal */
-2, /* (119) alter_db_optr ::= alter_db_optr fsync */
-2, /* (120) alter_db_optr ::= alter_db_optr update */
-2, /* (121) alter_db_optr ::= alter_db_optr cachelast */
-1, /* (122) alter_topic_optr ::= alter_db_optr */
-2, /* (123) alter_topic_optr ::= alter_topic_optr partitions */
-1, /* (124) typename ::= ids */
-4, /* (125) typename ::= ids LP signed RP */
-2, /* (126) typename ::= ids UNSIGNED */
-1, /* (127) signed ::= INTEGER */
-2, /* (128) signed ::= PLUS INTEGER */
-2, /* (129) signed ::= MINUS INTEGER */
-3, /* (130) cmd ::= CREATE TABLE create_table_args */
-3, /* (131) cmd ::= CREATE TABLE create_stable_args */
-3, /* (132) cmd ::= CREATE STABLE create_stable_args */
-3, /* (133) cmd ::= CREATE TABLE create_table_list */
-1, /* (134) create_table_list ::= create_from_stable */
-2, /* (135) create_table_list ::= create_table_list create_from_stable */
-6, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
-10, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
-10, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
-13, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
-3, /* (140) tagNamelist ::= tagNamelist COMMA ids */
-1, /* (141) tagNamelist ::= ids */
-5, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */
-3, /* (143) columnlist ::= columnlist COMMA column */
-1, /* (144) columnlist ::= column */
-2, /* (145) column ::= ids typename */
-3, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */
-1, /* (147) tagitemlist ::= tagitem */
-1, /* (148) tagitem ::= INTEGER */
-1, /* (149) tagitem ::= FLOAT */
-1, /* (150) tagitem ::= STRING */
-1, /* (151) tagitem ::= BOOL */
-1, /* (152) tagitem ::= NULL */
-2, /* (153) tagitem ::= MINUS INTEGER */
-2, /* (154) tagitem ::= MINUS FLOAT */
-2, /* (155) tagitem ::= PLUS INTEGER */
-2, /* (156) tagitem ::= PLUS FLOAT */
-14, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
-3, /* (158) select ::= LP select RP */
-1, /* (159) union ::= select */
-4, /* (160) union ::= union UNION ALL select */
-1, /* (161) cmd ::= union */
-2, /* (162) select ::= SELECT selcollist */
-2, /* (163) sclp ::= selcollist COMMA */
0, /* (164) sclp ::= */
-4, /* (165) selcollist ::= sclp distinct expr as */
-2, /* (166) selcollist ::= sclp STAR */
-2, /* (167) as ::= AS ids */
-1, /* (168) as ::= ids */
0, /* (169) as ::= */
-1, /* (170) distinct ::= DISTINCT */
0, /* (171) distinct ::= */
-2, /* (172) from ::= FROM tablelist */
-2, /* (173) from ::= FROM sub */
-3, /* (174) sub ::= LP union RP */
-4, /* (175) sub ::= LP union RP ids */
-6, /* (176) sub ::= sub COMMA LP union RP ids */
-2, /* (177) tablelist ::= ids cpxName */
-3, /* (178) tablelist ::= ids cpxName ids */
-4, /* (179) tablelist ::= tablelist COMMA ids cpxName */
-5, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */
-1, /* (181) tmvar ::= VARIABLE */
-4, /* (182) interval_opt ::= INTERVAL LP tmvar RP */
-6, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
0, /* (184) interval_opt ::= */
0, /* (185) session_option ::= */
-7, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
0, /* (187) windowstate_option ::= */
-4, /* (188) windowstate_option ::= STATE_WINDOW LP ids RP */
0, /* (189) fill_opt ::= */
-6, /* (190) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
-4, /* (191) fill_opt ::= FILL LP ID RP */
-4, /* (192) sliding_opt ::= SLIDING LP tmvar RP */
0, /* (193) sliding_opt ::= */
0, /* (194) orderby_opt ::= */
-3, /* (195) orderby_opt ::= ORDER BY sortlist */
-4, /* (196) sortlist ::= sortlist COMMA item sortorder */
-2, /* (197) sortlist ::= item sortorder */
-2, /* (198) item ::= ids cpxName */
-1, /* (199) sortorder ::= ASC */
-1, /* (200) sortorder ::= DESC */
0, /* (201) sortorder ::= */
0, /* (202) groupby_opt ::= */
-3, /* (203) groupby_opt ::= GROUP BY grouplist */
-3, /* (204) grouplist ::= grouplist COMMA item */
-1, /* (205) grouplist ::= item */
0, /* (206) having_opt ::= */
-2, /* (207) having_opt ::= HAVING expr */
0, /* (208) limit_opt ::= */
-2, /* (209) limit_opt ::= LIMIT signed */
-4, /* (210) limit_opt ::= LIMIT signed OFFSET signed */
-4, /* (211) limit_opt ::= LIMIT signed COMMA signed */
0, /* (212) slimit_opt ::= */
-2, /* (213) slimit_opt ::= SLIMIT signed */
-4, /* (214) slimit_opt ::= SLIMIT signed SOFFSET signed */
-4, /* (215) slimit_opt ::= SLIMIT signed COMMA signed */
0, /* (216) where_opt ::= */
-2, /* (217) where_opt ::= WHERE expr */
-3, /* (218) expr ::= LP expr RP */
-1, /* (219) expr ::= ID */
-3, /* (220) expr ::= ID DOT ID */
-3, /* (221) expr ::= ID DOT STAR */
-1, /* (222) expr ::= INTEGER */
-2, /* (223) expr ::= MINUS INTEGER */
-2, /* (224) expr ::= PLUS INTEGER */
-1, /* (225) expr ::= FLOAT */
-2, /* (226) expr ::= MINUS FLOAT */
-2, /* (227) expr ::= PLUS FLOAT */
-1, /* (228) expr ::= STRING */
-1, /* (229) expr ::= NOW */
-1, /* (230) expr ::= VARIABLE */
-2, /* (231) expr ::= PLUS VARIABLE */
-2, /* (232) expr ::= MINUS VARIABLE */
-1, /* (233) expr ::= BOOL */
-1, /* (234) expr ::= NULL */
-4, /* (235) expr ::= ID LP exprlist RP */
-4, /* (236) expr ::= ID LP STAR RP */
-3, /* (237) expr ::= expr IS NULL */
-4, /* (238) expr ::= expr IS NOT NULL */
-3, /* (239) expr ::= expr LT expr */
-3, /* (240) expr ::= expr GT expr */
-3, /* (241) expr ::= expr LE expr */
-3, /* (242) expr ::= expr GE expr */
-3, /* (243) expr ::= expr NE expr */
-3, /* (244) expr ::= expr EQ expr */
-5, /* (245) expr ::= expr BETWEEN expr AND expr */
-3, /* (246) expr ::= expr AND expr */
-3, /* (247) expr ::= expr OR expr */
-3, /* (248) expr ::= expr PLUS expr */
-3, /* (249) expr ::= expr MINUS expr */
-3, /* (250) expr ::= expr STAR expr */
-3, /* (251) expr ::= expr SLASH expr */
-3, /* (252) expr ::= expr REM expr */
-3, /* (253) expr ::= expr LIKE expr */
-5, /* (254) expr ::= expr IN LP exprlist RP */
-3, /* (255) exprlist ::= exprlist COMMA expritem */
-1, /* (256) exprlist ::= expritem */
-1, /* (257) expritem ::= expr */
0, /* (258) expritem ::= */
-3, /* (259) cmd ::= RESET QUERY CACHE */
-3, /* (260) cmd ::= SYNCDB ids REPLICA */
-7, /* (261) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
-7, /* (262) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
-7, /* (263) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
-7, /* (264) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
-7, /* (265) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
-8, /* (266) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
-9, /* (267) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
-7, /* (268) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
-7, /* (269) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
-7, /* (270) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
-7, /* (271) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
-7, /* (272) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
-7, /* (273) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
-8, /* (274) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
-9, /* (275) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
-7, /* (276) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
-3, /* (277) cmd ::= KILL CONNECTION INTEGER */
-5, /* (278) cmd ::= KILL STREAM INTEGER COLON INTEGER */
-5, /* (279) cmd ::= KILL QUERY INTEGER COLON INTEGER */
}; };
static void yy_accept(yyParser*); /* Forward Declaration */ static void yy_accept(yyParser*); /* Forward Declaration */
...@@ -2379,34 +2082,30 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ...@@ -2379,34 +2082,30 @@ static void yy_accept(yyParser*); /* Forward Declaration */
** only called from one place, optimizing compilers will in-line it, which ** only called from one place, optimizing compilers will in-line it, which
** means that the extra parameters have no performance impact. ** means that the extra parameters have no performance impact.
*/ */
static YYACTIONTYPE yy_reduce( static void yy_reduce(
yyParser *yypParser, /* The parser */ yyParser *yypParser, /* The parser */
unsigned int yyruleno, /* Number of the rule by which to reduce */ unsigned int yyruleno, /* Number of the rule by which to reduce */
int yyLookahead, /* Lookahead token, or YYNOCODE if none */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */
ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
ParseCTX_PDECL /* %extra_context */
){ ){
int yygoto; /* The next state */ int yygoto; /* The next state */
YYACTIONTYPE yyact; /* The next action */ int yyact; /* The next action */
yyStackEntry *yymsp; /* The top of the parser's stack */ yyStackEntry *yymsp; /* The top of the parser's stack */
int yysize; /* Amount to pop the stack */ int yysize; /* Amount to pop the stack */
ParseARG_FETCH ParseARG_FETCH;
(void)yyLookahead; (void)yyLookahead;
(void)yyLookaheadToken; (void)yyLookaheadToken;
yymsp = yypParser->yytos; yymsp = yypParser->yytos;
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
yysize = yyRuleInfoNRhs[yyruleno]; yysize = yyRuleInfo[yyruleno].nrhs;
if( yysize ){ if( yysize ){
fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n",
yyTracePrompt, yyTracePrompt,
yyruleno, yyRuleName[yyruleno], yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno);
yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
yymsp[yysize].stateno);
}else{ }else{
fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", fprintf(yyTraceFILE, "%sReduce %d [%s].\n",
yyTracePrompt, yyruleno, yyRuleName[yyruleno], yyTracePrompt, yyruleno, yyRuleName[yyruleno]);
yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
} }
} }
#endif /* NDEBUG */ #endif /* NDEBUG */
...@@ -2414,7 +2113,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -2414,7 +2113,7 @@ static YYACTIONTYPE yy_reduce(
/* Check that the stack is large enough to grow by a single entry /* Check that the stack is large enough to grow by a single entry
** if the RHS of the rule is empty. This ensures that there is room ** if the RHS of the rule is empty. This ensures that there is room
** enough on the stack to push the LHS value */ ** enough on the stack to push the LHS value */
if( yyRuleInfoNRhs[yyruleno]==0 ){ if( yyRuleInfo[yyruleno].nrhs==0 ){
#ifdef YYTRACKMAXSTACKDEPTH #ifdef YYTRACKMAXSTACKDEPTH
if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
yypParser->yyhwm++; yypParser->yyhwm++;
...@@ -2424,19 +2123,13 @@ static YYACTIONTYPE yy_reduce( ...@@ -2424,19 +2123,13 @@ static YYACTIONTYPE yy_reduce(
#if YYSTACKDEPTH>0 #if YYSTACKDEPTH>0
if( yypParser->yytos>=yypParser->yystackEnd ){ if( yypParser->yytos>=yypParser->yystackEnd ){
yyStackOverflow(yypParser); yyStackOverflow(yypParser);
/* The call to yyStackOverflow() above pops the stack until it is return;
** empty, causing the main parser loop to exit. So the return value
** is never used and does not matter. */
return 0;
} }
#else #else
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
if( yyGrowStack(yypParser) ){ if( yyGrowStack(yypParser) ){
yyStackOverflow(yypParser); yyStackOverflow(yypParser);
/* The call to yyStackOverflow() above pops the stack until it is return;
** empty, causing the main parser loop to exit. So the return value
** is never used and does not matter. */
return 0;
} }
yymsp = yypParser->yytos; yymsp = yypParser->yytos;
} }
...@@ -2627,13 +2320,13 @@ static YYACTIONTYPE yy_reduce( ...@@ -2627,13 +2320,13 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 44: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 44: /* cmd ::= ALTER DATABASE ids alter_db_optr */
case 45: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==45); case 45: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==45);
{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy114, &t);} { SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy454, &t);}
break; break;
case 46: /* cmd ::= ALTER ACCOUNT ids acct_optr */ case 46: /* cmd ::= ALTER ACCOUNT ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy183);} { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy397);}
break; break;
case 47: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ case 47: /* 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.yy183);} { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy397);}
break; break;
case 48: /* ids ::= ID */ case 48: /* ids ::= ID */
case 49: /* ids ::= STRING */ yytestcase(yyruleno==49); case 49: /* ids ::= STRING */ yytestcase(yyruleno==49);
...@@ -2655,11 +2348,11 @@ static YYACTIONTYPE yy_reduce( ...@@ -2655,11 +2348,11 @@ static YYACTIONTYPE yy_reduce(
{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
break; break;
case 55: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ case 55: /* 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.yy183);} { setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy397);}
break; break;
case 56: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 56: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
case 57: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==57); case 57: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==57);
{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy114, &yymsp[-2].minor.yy0);} { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy454, &yymsp[-2].minor.yy0);}
break; break;
case 58: /* cmd ::= CREATE USER ids PASS ids */ case 58: /* cmd ::= CREATE USER ids PASS ids */
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
...@@ -2688,20 +2381,20 @@ static YYACTIONTYPE yy_reduce( ...@@ -2688,20 +2381,20 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 77: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ case 77: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{ {
yylhsminor.yy183.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; yylhsminor.yy397.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
yylhsminor.yy183.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; yylhsminor.yy397.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
yylhsminor.yy183.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; yylhsminor.yy397.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
yylhsminor.yy183.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; yylhsminor.yy397.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
yylhsminor.yy183.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; yylhsminor.yy397.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
yylhsminor.yy183.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; yylhsminor.yy397.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy183.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; yylhsminor.yy397.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy183.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; yylhsminor.yy397.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
yylhsminor.yy183.stat = yymsp[0].minor.yy0; yylhsminor.yy397.stat = yymsp[0].minor.yy0;
} }
yymsp[-8].minor.yy183 = yylhsminor.yy183; yymsp[-8].minor.yy397 = yylhsminor.yy397;
break; break;
case 78: /* keep ::= KEEP tagitemlist */ case 78: /* keep ::= KEEP tagitemlist */
{ yymsp[-1].minor.yy193 = yymsp[0].minor.yy193; } { yymsp[-1].minor.yy15 = yymsp[0].minor.yy15; }
break; break;
case 79: /* cache ::= CACHE INTEGER */ case 79: /* cache ::= CACHE INTEGER */
case 80: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==80); case 80: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==80);
...@@ -2721,234 +2414,234 @@ static YYACTIONTYPE yy_reduce( ...@@ -2721,234 +2414,234 @@ static YYACTIONTYPE yy_reduce(
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break; break;
case 94: /* db_optr ::= */ case 94: /* db_optr ::= */
{setDefaultCreateDbOption(&yymsp[1].minor.yy114); yymsp[1].minor.yy114.dbType = TSDB_DB_TYPE_DEFAULT;} {setDefaultCreateDbOption(&yymsp[1].minor.yy454); yymsp[1].minor.yy454.dbType = TSDB_DB_TYPE_DEFAULT;}
break; break;
case 95: /* db_optr ::= db_optr cache */ case 95: /* db_optr ::= db_optr cache */
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 96: /* db_optr ::= db_optr replica */ case 96: /* db_optr ::= db_optr replica */
case 113: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==113); case 113: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==113);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 97: /* db_optr ::= db_optr quorum */ case 97: /* db_optr ::= db_optr quorum */
case 114: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==114); case 114: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==114);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 98: /* db_optr ::= db_optr days */ case 98: /* db_optr ::= db_optr days */
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 99: /* db_optr ::= db_optr minrows */ case 99: /* db_optr ::= db_optr minrows */
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 100: /* db_optr ::= db_optr maxrows */ case 100: /* db_optr ::= db_optr maxrows */
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 101: /* db_optr ::= db_optr blocks */ case 101: /* db_optr ::= db_optr blocks */
case 116: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==116); case 116: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==116);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 102: /* db_optr ::= db_optr ctime */ case 102: /* db_optr ::= db_optr ctime */
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 103: /* db_optr ::= db_optr wal */ case 103: /* db_optr ::= db_optr wal */
case 118: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==118); case 118: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==118);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 104: /* db_optr ::= db_optr fsync */ case 104: /* db_optr ::= db_optr fsync */
case 119: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==119); case 119: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==119);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 105: /* db_optr ::= db_optr comp */ case 105: /* db_optr ::= db_optr comp */
case 117: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==117); case 117: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==117);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 106: /* db_optr ::= db_optr prec */ case 106: /* db_optr ::= db_optr prec */
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.precision = yymsp[0].minor.yy0; } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.precision = yymsp[0].minor.yy0; }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 107: /* db_optr ::= db_optr keep */ case 107: /* db_optr ::= db_optr keep */
case 115: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==115); case 115: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==115);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.keep = yymsp[0].minor.yy193; } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.keep = yymsp[0].minor.yy15; }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 108: /* db_optr ::= db_optr update */ case 108: /* db_optr ::= db_optr update */
case 120: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==120); case 120: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==120);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 109: /* db_optr ::= db_optr cachelast */ case 109: /* db_optr ::= db_optr cachelast */
case 121: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==121); case 121: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==121);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 110: /* topic_optr ::= db_optr */ case 110: /* topic_optr ::= db_optr */
case 122: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==122); case 122: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==122);
{ yylhsminor.yy114 = yymsp[0].minor.yy114; yylhsminor.yy114.dbType = TSDB_DB_TYPE_TOPIC; } { yylhsminor.yy454 = yymsp[0].minor.yy454; yylhsminor.yy454.dbType = TSDB_DB_TYPE_TOPIC; }
yymsp[0].minor.yy114 = yylhsminor.yy114; yymsp[0].minor.yy454 = yylhsminor.yy454;
break; break;
case 111: /* topic_optr ::= topic_optr partitions */ case 111: /* topic_optr ::= topic_optr partitions */
case 123: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==123); case 123: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==123);
{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy114 = yylhsminor.yy114; yymsp[-1].minor.yy454 = yylhsminor.yy454;
break; break;
case 112: /* alter_db_optr ::= */ case 112: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yymsp[1].minor.yy114); yymsp[1].minor.yy114.dbType = TSDB_DB_TYPE_DEFAULT;} { setDefaultCreateDbOption(&yymsp[1].minor.yy454); yymsp[1].minor.yy454.dbType = TSDB_DB_TYPE_DEFAULT;}
break; break;
case 124: /* typename ::= ids */ case 124: /* typename ::= ids */
{ {
yymsp[0].minor.yy0.type = 0; yymsp[0].minor.yy0.type = 0;
tSetColumnType (&yylhsminor.yy27, &yymsp[0].minor.yy0); tSetColumnType (&yylhsminor.yy505, &yymsp[0].minor.yy0);
} }
yymsp[0].minor.yy27 = yylhsminor.yy27; yymsp[0].minor.yy505 = yylhsminor.yy505;
break; break;
case 125: /* typename ::= ids LP signed RP */ case 125: /* typename ::= ids LP signed RP */
{ {
if (yymsp[-1].minor.yy473 <= 0) { if (yymsp[-1].minor.yy489 <= 0) {
yymsp[-3].minor.yy0.type = 0; yymsp[-3].minor.yy0.type = 0;
tSetColumnType(&yylhsminor.yy27, &yymsp[-3].minor.yy0); tSetColumnType(&yylhsminor.yy505, &yymsp[-3].minor.yy0);
} else { } else {
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy473; // negative value of name length yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy489; // negative value of name length
tSetColumnType(&yylhsminor.yy27, &yymsp[-3].minor.yy0); tSetColumnType(&yylhsminor.yy505, &yymsp[-3].minor.yy0);
} }
} }
yymsp[-3].minor.yy27 = yylhsminor.yy27; yymsp[-3].minor.yy505 = yylhsminor.yy505;
break; break;
case 126: /* typename ::= ids UNSIGNED */ case 126: /* typename ::= ids UNSIGNED */
{ {
yymsp[-1].minor.yy0.type = 0; 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); yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
tSetColumnType (&yylhsminor.yy27, &yymsp[-1].minor.yy0); tSetColumnType (&yylhsminor.yy505, &yymsp[-1].minor.yy0);
} }
yymsp[-1].minor.yy27 = yylhsminor.yy27; yymsp[-1].minor.yy505 = yylhsminor.yy505;
break; break;
case 127: /* signed ::= INTEGER */ case 127: /* signed ::= INTEGER */
{ yylhsminor.yy473 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy489 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[0].minor.yy473 = yylhsminor.yy473; yymsp[0].minor.yy489 = yylhsminor.yy489;
break; break;
case 128: /* signed ::= PLUS INTEGER */ case 128: /* signed ::= PLUS INTEGER */
{ yymsp[-1].minor.yy473 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yymsp[-1].minor.yy489 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
break; break;
case 129: /* signed ::= MINUS INTEGER */ case 129: /* signed ::= MINUS INTEGER */
{ yymsp[-1].minor.yy473 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} { yymsp[-1].minor.yy489 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
break; break;
case 133: /* cmd ::= CREATE TABLE create_table_list */ case 133: /* cmd ::= CREATE TABLE create_table_list */
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy270;} { pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy482;}
break; break;
case 134: /* create_table_list ::= create_from_stable */ case 134: /* create_table_list ::= create_from_stable */
{ {
SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy192); taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy390);
pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE;
yylhsminor.yy270 = pCreateTable; yylhsminor.yy482 = pCreateTable;
} }
yymsp[0].minor.yy270 = yylhsminor.yy270; yymsp[0].minor.yy482 = yylhsminor.yy482;
break; break;
case 135: /* create_table_list ::= create_table_list create_from_stable */ case 135: /* create_table_list ::= create_table_list create_from_stable */
{ {
taosArrayPush(yymsp[-1].minor.yy270->childTableInfo, &yymsp[0].minor.yy192); taosArrayPush(yymsp[-1].minor.yy482->childTableInfo, &yymsp[0].minor.yy390);
yylhsminor.yy270 = yymsp[-1].minor.yy270; yylhsminor.yy482 = yymsp[-1].minor.yy482;
} }
yymsp[-1].minor.yy270 = yylhsminor.yy270; yymsp[-1].minor.yy482 = yylhsminor.yy482;
break; break;
case 136: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ case 136: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{ {
yylhsminor.yy270 = tSetCreateTableInfo(yymsp[-1].minor.yy193, NULL, NULL, TSQL_CREATE_TABLE); yylhsminor.yy482 = tSetCreateTableInfo(yymsp[-1].minor.yy15, NULL, NULL, TSQL_CREATE_TABLE);
setSqlInfo(pInfo, yylhsminor.yy270, NULL, TSDB_SQL_CREATE_TABLE); setSqlInfo(pInfo, yylhsminor.yy482, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0);
} }
yymsp[-5].minor.yy270 = yylhsminor.yy270; yymsp[-5].minor.yy482 = yylhsminor.yy482;
break; break;
case 137: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ case 137: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{ {
yylhsminor.yy270 = tSetCreateTableInfo(yymsp[-5].minor.yy193, yymsp[-1].minor.yy193, NULL, TSQL_CREATE_STABLE); yylhsminor.yy482 = tSetCreateTableInfo(yymsp[-5].minor.yy15, yymsp[-1].minor.yy15, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, yylhsminor.yy270, NULL, TSDB_SQL_CREATE_TABLE); setSqlInfo(pInfo, yylhsminor.yy482, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
} }
yymsp[-9].minor.yy270 = yylhsminor.yy270; yymsp[-9].minor.yy482 = yylhsminor.yy482;
break; break;
case 138: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ case 138: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
{ {
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yylhsminor.yy192 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy193, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); yylhsminor.yy390 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy15, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
} }
yymsp[-9].minor.yy192 = yylhsminor.yy192; yymsp[-9].minor.yy390 = yylhsminor.yy390;
break; break;
case 139: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ case 139: /* 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[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
yylhsminor.yy192 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy193, yymsp[-1].minor.yy193, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); yylhsminor.yy390 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy15, yymsp[-1].minor.yy15, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
} }
yymsp[-12].minor.yy192 = yylhsminor.yy192; yymsp[-12].minor.yy390 = yylhsminor.yy390;
break; break;
case 140: /* tagNamelist ::= tagNamelist COMMA ids */ case 140: /* tagNamelist ::= tagNamelist COMMA ids */
{taosArrayPush(yymsp[-2].minor.yy193, &yymsp[0].minor.yy0); yylhsminor.yy193 = yymsp[-2].minor.yy193; } {taosArrayPush(yymsp[-2].minor.yy15, &yymsp[0].minor.yy0); yylhsminor.yy15 = yymsp[-2].minor.yy15; }
yymsp[-2].minor.yy193 = yylhsminor.yy193; yymsp[-2].minor.yy15 = yylhsminor.yy15;
break; break;
case 141: /* tagNamelist ::= ids */ case 141: /* tagNamelist ::= ids */
{yylhsminor.yy193 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy193, &yymsp[0].minor.yy0);} {yylhsminor.yy15 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy15, &yymsp[0].minor.yy0);}
yymsp[0].minor.yy193 = yylhsminor.yy193; yymsp[0].minor.yy15 = yylhsminor.yy15;
break; break;
case 142: /* create_table_args ::= ifnotexists ids cpxName AS select */ case 142: /* create_table_args ::= ifnotexists ids cpxName AS select */
{ {
yylhsminor.yy270 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy124, TSQL_CREATE_STREAM); yylhsminor.yy482 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy134, TSQL_CREATE_STREAM);
setSqlInfo(pInfo, yylhsminor.yy270, NULL, TSDB_SQL_CREATE_TABLE); setSqlInfo(pInfo, yylhsminor.yy482, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0);
} }
yymsp[-4].minor.yy270 = yylhsminor.yy270; yymsp[-4].minor.yy482 = yylhsminor.yy482;
break; break;
case 143: /* columnlist ::= columnlist COMMA column */ case 143: /* columnlist ::= columnlist COMMA column */
{taosArrayPush(yymsp[-2].minor.yy193, &yymsp[0].minor.yy27); yylhsminor.yy193 = yymsp[-2].minor.yy193; } {taosArrayPush(yymsp[-2].minor.yy15, &yymsp[0].minor.yy505); yylhsminor.yy15 = yymsp[-2].minor.yy15; }
yymsp[-2].minor.yy193 = yylhsminor.yy193; yymsp[-2].minor.yy15 = yylhsminor.yy15;
break; break;
case 144: /* columnlist ::= column */ case 144: /* columnlist ::= column */
{yylhsminor.yy193 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy193, &yymsp[0].minor.yy27);} {yylhsminor.yy15 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy15, &yymsp[0].minor.yy505);}
yymsp[0].minor.yy193 = yylhsminor.yy193; yymsp[0].minor.yy15 = yylhsminor.yy15;
break; break;
case 145: /* column ::= ids typename */ case 145: /* column ::= ids typename */
{ {
tSetColumnInfo(&yylhsminor.yy27, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy27); tSetColumnInfo(&yylhsminor.yy505, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy505);
} }
yymsp[-1].minor.yy27 = yylhsminor.yy27; yymsp[-1].minor.yy505 = yylhsminor.yy505;
break; break;
case 146: /* tagitemlist ::= tagitemlist COMMA tagitem */ case 146: /* tagitemlist ::= tagitemlist COMMA tagitem */
{ yylhsminor.yy193 = tVariantListAppend(yymsp[-2].minor.yy193, &yymsp[0].minor.yy442, -1); } { yylhsminor.yy15 = tVariantListAppend(yymsp[-2].minor.yy15, &yymsp[0].minor.yy380, -1); }
yymsp[-2].minor.yy193 = yylhsminor.yy193; yymsp[-2].minor.yy15 = yylhsminor.yy15;
break; break;
case 147: /* tagitemlist ::= tagitem */ case 147: /* tagitemlist ::= tagitem */
{ yylhsminor.yy193 = tVariantListAppend(NULL, &yymsp[0].minor.yy442, -1); } { yylhsminor.yy15 = tVariantListAppend(NULL, &yymsp[0].minor.yy380, -1); }
yymsp[0].minor.yy193 = yylhsminor.yy193; yymsp[0].minor.yy15 = yylhsminor.yy15;
break; break;
case 148: /* tagitem ::= INTEGER */ case 148: /* tagitem ::= INTEGER */
case 149: /* tagitem ::= FLOAT */ yytestcase(yyruleno==149); case 149: /* tagitem ::= FLOAT */ yytestcase(yyruleno==149);
case 150: /* tagitem ::= STRING */ yytestcase(yyruleno==150); case 150: /* tagitem ::= STRING */ yytestcase(yyruleno==150);
case 151: /* tagitem ::= BOOL */ yytestcase(yyruleno==151); case 151: /* tagitem ::= BOOL */ yytestcase(yyruleno==151);
{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy442, &yymsp[0].minor.yy0); } { toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy380, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy442 = yylhsminor.yy442; yymsp[0].minor.yy380 = yylhsminor.yy380;
break; break;
case 152: /* tagitem ::= NULL */ case 152: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy442, &yymsp[0].minor.yy0); } { yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy380, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy442 = yylhsminor.yy442; yymsp[0].minor.yy380 = yylhsminor.yy380;
break; break;
case 153: /* tagitem ::= MINUS INTEGER */ case 153: /* tagitem ::= MINUS INTEGER */
case 154: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==154); case 154: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==154);
...@@ -2958,56 +2651,56 @@ static YYACTIONTYPE yy_reduce( ...@@ -2958,56 +2651,56 @@ static YYACTIONTYPE yy_reduce(
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
toTSDBType(yymsp[-1].minor.yy0.type); toTSDBType(yymsp[-1].minor.yy0.type);
tVariantCreate(&yylhsminor.yy442, &yymsp[-1].minor.yy0); tVariantCreate(&yylhsminor.yy380, &yymsp[-1].minor.yy0);
} }
yymsp[-1].minor.yy442 = yylhsminor.yy442; yymsp[-1].minor.yy380 = yylhsminor.yy380;
break; break;
case 157: /* select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ case 157: /* select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{ {
yylhsminor.yy124 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy193, yymsp[-11].minor.yy332, yymsp[-10].minor.yy454, yymsp[-4].minor.yy193, yymsp[-3].minor.yy193, &yymsp[-9].minor.yy392, &yymsp[-8].minor.yy447, &yymsp[-7].minor.yy76, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy193, &yymsp[0].minor.yy482, &yymsp[-1].minor.yy482, yymsp[-2].minor.yy454); yylhsminor.yy134 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy15, yymsp[-11].minor.yy160, yymsp[-10].minor.yy328, yymsp[-4].minor.yy15, yymsp[-3].minor.yy15, &yymsp[-9].minor.yy496, &yymsp[-8].minor.yy151, &yymsp[-7].minor.yy96, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy15, &yymsp[0].minor.yy150, &yymsp[-1].minor.yy150, yymsp[-2].minor.yy328);
} }
yymsp[-13].minor.yy124 = yylhsminor.yy124; yymsp[-13].minor.yy134 = yylhsminor.yy134;
break; break;
case 158: /* select ::= LP select RP */ case 158: /* select ::= LP select RP */
{yymsp[-2].minor.yy124 = yymsp[-1].minor.yy124;} {yymsp[-2].minor.yy134 = yymsp[-1].minor.yy134;}
break; break;
case 159: /* union ::= select */ case 159: /* union ::= select */
{ yylhsminor.yy193 = setSubclause(NULL, yymsp[0].minor.yy124); } { yylhsminor.yy15 = setSubclause(NULL, yymsp[0].minor.yy134); }
yymsp[0].minor.yy193 = yylhsminor.yy193; yymsp[0].minor.yy15 = yylhsminor.yy15;
break; break;
case 160: /* union ::= union UNION ALL select */ case 160: /* union ::= union UNION ALL select */
{ yylhsminor.yy193 = appendSelectClause(yymsp[-3].minor.yy193, yymsp[0].minor.yy124); } { yylhsminor.yy15 = appendSelectClause(yymsp[-3].minor.yy15, yymsp[0].minor.yy134); }
yymsp[-3].minor.yy193 = yylhsminor.yy193; yymsp[-3].minor.yy15 = yylhsminor.yy15;
break; break;
case 161: /* cmd ::= union */ case 161: /* cmd ::= union */
{ setSqlInfo(pInfo, yymsp[0].minor.yy193, NULL, TSDB_SQL_SELECT); } { setSqlInfo(pInfo, yymsp[0].minor.yy15, NULL, TSDB_SQL_SELECT); }
break; break;
case 162: /* select ::= SELECT selcollist */ case 162: /* select ::= SELECT selcollist */
{ {
yylhsminor.yy124 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy193, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); yylhsminor.yy134 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy15, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
} }
yymsp[-1].minor.yy124 = yylhsminor.yy124; yymsp[-1].minor.yy134 = yylhsminor.yy134;
break; break;
case 163: /* sclp ::= selcollist COMMA */ case 163: /* sclp ::= selcollist COMMA */
{yylhsminor.yy193 = yymsp[-1].minor.yy193;} {yylhsminor.yy15 = yymsp[-1].minor.yy15;}
yymsp[-1].minor.yy193 = yylhsminor.yy193; yymsp[-1].minor.yy15 = yylhsminor.yy15;
break; break;
case 164: /* sclp ::= */ case 164: /* sclp ::= */
case 194: /* orderby_opt ::= */ yytestcase(yyruleno==194); case 194: /* orderby_opt ::= */ yytestcase(yyruleno==194);
{yymsp[1].minor.yy193 = 0;} {yymsp[1].minor.yy15 = 0;}
break; break;
case 165: /* selcollist ::= sclp distinct expr as */ case 165: /* selcollist ::= sclp distinct expr as */
{ {
yylhsminor.yy193 = tSqlExprListAppend(yymsp[-3].minor.yy193, yymsp[-1].minor.yy454, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); yylhsminor.yy15 = tSqlExprListAppend(yymsp[-3].minor.yy15, yymsp[-1].minor.yy328, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
} }
yymsp[-3].minor.yy193 = yylhsminor.yy193; yymsp[-3].minor.yy15 = yylhsminor.yy15;
break; break;
case 166: /* selcollist ::= sclp STAR */ case 166: /* selcollist ::= sclp STAR */
{ {
tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL); tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL);
yylhsminor.yy193 = tSqlExprListAppend(yymsp[-1].minor.yy193, pNode, 0, 0); yylhsminor.yy15 = tSqlExprListAppend(yymsp[-1].minor.yy15, pNode, 0, 0);
} }
yymsp[-1].minor.yy193 = yylhsminor.yy193; yymsp[-1].minor.yy15 = yylhsminor.yy15;
break; break;
case 167: /* as ::= AS ids */ case 167: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
...@@ -3025,79 +2718,77 @@ static YYACTIONTYPE yy_reduce( ...@@ -3025,79 +2718,77 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 172: /* from ::= FROM tablelist */ case 172: /* from ::= FROM tablelist */
case 173: /* from ::= FROM sub */ yytestcase(yyruleno==173); case 173: /* from ::= FROM sub */ yytestcase(yyruleno==173);
{yymsp[-1].minor.yy332 = yymsp[0].minor.yy332;} {yymsp[-1].minor.yy160 = yymsp[0].minor.yy160;}
break; break;
case 174: /* sub ::= LP union RP */ case 174: /* sub ::= LP union RP */
{yymsp[-2].minor.yy332 = addSubqueryElem(NULL, yymsp[-1].minor.yy193, NULL);} {yymsp[-2].minor.yy160 = addSubqueryElem(NULL, yymsp[-1].minor.yy15, NULL);}
break; break;
case 175: /* sub ::= LP union RP ids */ case 175: /* sub ::= LP union RP ids */
{yymsp[-3].minor.yy332 = addSubqueryElem(NULL, yymsp[-2].minor.yy193, &yymsp[0].minor.yy0);} {yymsp[-3].minor.yy160 = addSubqueryElem(NULL, yymsp[-2].minor.yy15, &yymsp[0].minor.yy0);}
break; break;
case 176: /* sub ::= sub COMMA LP union RP ids */ case 176: /* sub ::= sub COMMA LP union RP ids */
{yylhsminor.yy332 = addSubqueryElem(yymsp[-5].minor.yy332, yymsp[-2].minor.yy193, &yymsp[0].minor.yy0);} {yylhsminor.yy160 = addSubqueryElem(yymsp[-5].minor.yy160, yymsp[-2].minor.yy15, &yymsp[0].minor.yy0);}
yymsp[-5].minor.yy332 = yylhsminor.yy332; yymsp[-5].minor.yy160 = yylhsminor.yy160;
break; break;
case 177: /* tablelist ::= ids cpxName */ case 177: /* tablelist ::= ids cpxName */
{ {
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy332 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); yylhsminor.yy160 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
} }
yymsp[-1].minor.yy332 = yylhsminor.yy332; yymsp[-1].minor.yy160 = yylhsminor.yy160;
break; break;
case 178: /* tablelist ::= ids cpxName ids */ case 178: /* tablelist ::= ids cpxName ids */
{ {
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy332 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); yylhsminor.yy160 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
} }
yymsp[-2].minor.yy332 = yylhsminor.yy332; yymsp[-2].minor.yy160 = yylhsminor.yy160;
break; break;
case 179: /* tablelist ::= tablelist COMMA ids cpxName */ case 179: /* tablelist ::= tablelist COMMA ids cpxName */
{ {
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy332 = setTableNameList(yymsp[-3].minor.yy332, &yymsp[-1].minor.yy0, NULL); yylhsminor.yy160 = setTableNameList(yymsp[-3].minor.yy160, &yymsp[-1].minor.yy0, NULL);
} }
yymsp[-3].minor.yy332 = yylhsminor.yy332; yymsp[-3].minor.yy160 = yylhsminor.yy160;
break; break;
case 180: /* tablelist ::= tablelist COMMA ids cpxName ids */ case 180: /* tablelist ::= tablelist COMMA ids cpxName ids */
{ {
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy332 = setTableNameList(yymsp[-4].minor.yy332, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); yylhsminor.yy160 = setTableNameList(yymsp[-4].minor.yy160, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
} }
yymsp[-4].minor.yy332 = yylhsminor.yy332; yymsp[-4].minor.yy160 = yylhsminor.yy160;
break; break;
case 181: /* tmvar ::= VARIABLE */ case 181: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;} {yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0; yymsp[0].minor.yy0 = yylhsminor.yy0;
break; break;
case 182: /* interval_opt ::= INTERVAL LP tmvar RP */ case 182: /* interval_opt ::= INTERVAL LP tmvar RP */
{yymsp[-3].minor.yy392.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy392.offset.n = 0;} {yymsp[-3].minor.yy496.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy496.offset.n = 0;}
break; break;
case 183: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ case 183: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
{yymsp[-5].minor.yy392.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy392.offset = yymsp[-1].minor.yy0;} {yymsp[-5].minor.yy496.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy496.offset = yymsp[-1].minor.yy0;}
break; break;
case 184: /* interval_opt ::= */ case 184: /* interval_opt ::= */
{memset(&yymsp[1].minor.yy392, 0, sizeof(yymsp[1].minor.yy392));} {memset(&yymsp[1].minor.yy496, 0, sizeof(yymsp[1].minor.yy496));}
break; break;
case 185: /* session_option ::= */ case 185: /* session_option ::= */
{yymsp[1].minor.yy447.col.n = 0; yymsp[1].minor.yy447.gap.n = 0;} {yymsp[1].minor.yy151.col.n = 0; yymsp[1].minor.yy151.gap.n = 0;}
break; break;
case 186: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ case 186: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
yymsp[-6].minor.yy447.col = yymsp[-4].minor.yy0; yymsp[-6].minor.yy151.col = yymsp[-4].minor.yy0;
yymsp[-6].minor.yy447.gap = yymsp[-1].minor.yy0; yymsp[-6].minor.yy151.gap = yymsp[-1].minor.yy0;
} }
break; break;
case 187: /* windowstate_option ::= */ case 187: /* windowstate_option ::= */
{yymsp[1].minor.yy76.col.n = 0;} { yymsp[1].minor.yy96.col.n = 0; yymsp[1].minor.yy96.col.z = NULL;}
break; break;
case 188: /* windowstate_option ::= STATE_WINDOW LP ids RP */ case 188: /* windowstate_option ::= STATE_WINDOW LP ids RP */
{ { yymsp[-3].minor.yy96.col = yymsp[-1].minor.yy0; }
yymsp[-3].minor.yy76.col = yymsp[-1].minor.yy0;
}
break; break;
case 189: /* fill_opt ::= */ case 189: /* fill_opt ::= */
{ yymsp[1].minor.yy193 = 0; } { yymsp[1].minor.yy15 = 0; }
break; break;
case 190: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ case 190: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{ {
...@@ -3105,14 +2796,14 @@ static YYACTIONTYPE yy_reduce( ...@@ -3105,14 +2796,14 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-3].minor.yy0.type); toTSDBType(yymsp[-3].minor.yy0.type);
tVariantCreate(&A, &yymsp[-3].minor.yy0); tVariantCreate(&A, &yymsp[-3].minor.yy0);
tVariantListInsert(yymsp[-1].minor.yy193, &A, -1, 0); tVariantListInsert(yymsp[-1].minor.yy15, &A, -1, 0);
yymsp[-5].minor.yy193 = yymsp[-1].minor.yy193; yymsp[-5].minor.yy15 = yymsp[-1].minor.yy15;
} }
break; break;
case 191: /* fill_opt ::= FILL LP ID RP */ case 191: /* fill_opt ::= FILL LP ID RP */
{ {
toTSDBType(yymsp[-1].minor.yy0.type); toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-3].minor.yy193 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); yymsp[-3].minor.yy15 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
} }
break; break;
case 192: /* sliding_opt ::= SLIDING LP tmvar RP */ case 192: /* sliding_opt ::= SLIDING LP tmvar RP */
...@@ -3122,235 +2813,235 @@ static YYACTIONTYPE yy_reduce( ...@@ -3122,235 +2813,235 @@ static YYACTIONTYPE yy_reduce(
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
break; break;
case 195: /* orderby_opt ::= ORDER BY sortlist */ case 195: /* orderby_opt ::= ORDER BY sortlist */
{yymsp[-2].minor.yy193 = yymsp[0].minor.yy193;} {yymsp[-2].minor.yy15 = yymsp[0].minor.yy15;}
break; break;
case 196: /* sortlist ::= sortlist COMMA item sortorder */ case 196: /* sortlist ::= sortlist COMMA item sortorder */
{ {
yylhsminor.yy193 = tVariantListAppend(yymsp[-3].minor.yy193, &yymsp[-1].minor.yy442, yymsp[0].minor.yy312); yylhsminor.yy15 = tVariantListAppend(yymsp[-3].minor.yy15, &yymsp[-1].minor.yy380, yymsp[0].minor.yy250);
} }
yymsp[-3].minor.yy193 = yylhsminor.yy193; yymsp[-3].minor.yy15 = yylhsminor.yy15;
break; break;
case 197: /* sortlist ::= item sortorder */ case 197: /* sortlist ::= item sortorder */
{ {
yylhsminor.yy193 = tVariantListAppend(NULL, &yymsp[-1].minor.yy442, yymsp[0].minor.yy312); yylhsminor.yy15 = tVariantListAppend(NULL, &yymsp[-1].minor.yy380, yymsp[0].minor.yy250);
} }
yymsp[-1].minor.yy193 = yylhsminor.yy193; yymsp[-1].minor.yy15 = yylhsminor.yy15;
break; break;
case 198: /* item ::= ids cpxName */ case 198: /* item ::= ids cpxName */
{ {
toTSDBType(yymsp[-1].minor.yy0.type); toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
tVariantCreate(&yylhsminor.yy442, &yymsp[-1].minor.yy0); tVariantCreate(&yylhsminor.yy380, &yymsp[-1].minor.yy0);
} }
yymsp[-1].minor.yy442 = yylhsminor.yy442; yymsp[-1].minor.yy380 = yylhsminor.yy380;
break; break;
case 199: /* sortorder ::= ASC */ case 199: /* sortorder ::= ASC */
{ yymsp[0].minor.yy312 = TSDB_ORDER_ASC; } { yymsp[0].minor.yy250 = TSDB_ORDER_ASC; }
break; break;
case 200: /* sortorder ::= DESC */ case 200: /* sortorder ::= DESC */
{ yymsp[0].minor.yy312 = TSDB_ORDER_DESC;} { yymsp[0].minor.yy250 = TSDB_ORDER_DESC;}
break; break;
case 201: /* sortorder ::= */ case 201: /* sortorder ::= */
{ yymsp[1].minor.yy312 = TSDB_ORDER_ASC; } { yymsp[1].minor.yy250 = TSDB_ORDER_ASC; }
break; break;
case 202: /* groupby_opt ::= */ case 202: /* groupby_opt ::= */
{ yymsp[1].minor.yy193 = 0;} { yymsp[1].minor.yy15 = 0;}
break; break;
case 203: /* groupby_opt ::= GROUP BY grouplist */ case 203: /* groupby_opt ::= GROUP BY grouplist */
{ yymsp[-2].minor.yy193 = yymsp[0].minor.yy193;} { yymsp[-2].minor.yy15 = yymsp[0].minor.yy15;}
break; break;
case 204: /* grouplist ::= grouplist COMMA item */ case 204: /* grouplist ::= grouplist COMMA item */
{ {
yylhsminor.yy193 = tVariantListAppend(yymsp[-2].minor.yy193, &yymsp[0].minor.yy442, -1); yylhsminor.yy15 = tVariantListAppend(yymsp[-2].minor.yy15, &yymsp[0].minor.yy380, -1);
} }
yymsp[-2].minor.yy193 = yylhsminor.yy193; yymsp[-2].minor.yy15 = yylhsminor.yy15;
break; break;
case 205: /* grouplist ::= item */ case 205: /* grouplist ::= item */
{ {
yylhsminor.yy193 = tVariantListAppend(NULL, &yymsp[0].minor.yy442, -1); yylhsminor.yy15 = tVariantListAppend(NULL, &yymsp[0].minor.yy380, -1);
} }
yymsp[0].minor.yy193 = yylhsminor.yy193; yymsp[0].minor.yy15 = yylhsminor.yy15;
break; break;
case 206: /* having_opt ::= */ case 206: /* having_opt ::= */
case 216: /* where_opt ::= */ yytestcase(yyruleno==216); case 216: /* where_opt ::= */ yytestcase(yyruleno==216);
case 258: /* expritem ::= */ yytestcase(yyruleno==258); case 258: /* expritem ::= */ yytestcase(yyruleno==258);
{yymsp[1].minor.yy454 = 0;} {yymsp[1].minor.yy328 = 0;}
break; break;
case 207: /* having_opt ::= HAVING expr */ case 207: /* having_opt ::= HAVING expr */
case 217: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==217); case 217: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==217);
{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;} {yymsp[-1].minor.yy328 = yymsp[0].minor.yy328;}
break; break;
case 208: /* limit_opt ::= */ case 208: /* limit_opt ::= */
case 212: /* slimit_opt ::= */ yytestcase(yyruleno==212); case 212: /* slimit_opt ::= */ yytestcase(yyruleno==212);
{yymsp[1].minor.yy482.limit = -1; yymsp[1].minor.yy482.offset = 0;} {yymsp[1].minor.yy150.limit = -1; yymsp[1].minor.yy150.offset = 0;}
break; break;
case 209: /* limit_opt ::= LIMIT signed */ case 209: /* limit_opt ::= LIMIT signed */
case 213: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==213); case 213: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==213);
{yymsp[-1].minor.yy482.limit = yymsp[0].minor.yy473; yymsp[-1].minor.yy482.offset = 0;} {yymsp[-1].minor.yy150.limit = yymsp[0].minor.yy489; yymsp[-1].minor.yy150.offset = 0;}
break; break;
case 210: /* limit_opt ::= LIMIT signed OFFSET signed */ case 210: /* limit_opt ::= LIMIT signed OFFSET signed */
{ yymsp[-3].minor.yy482.limit = yymsp[-2].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[0].minor.yy473;} { yymsp[-3].minor.yy150.limit = yymsp[-2].minor.yy489; yymsp[-3].minor.yy150.offset = yymsp[0].minor.yy489;}
break; break;
case 211: /* limit_opt ::= LIMIT signed COMMA signed */ case 211: /* limit_opt ::= LIMIT signed COMMA signed */
{ yymsp[-3].minor.yy482.limit = yymsp[0].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[-2].minor.yy473;} { yymsp[-3].minor.yy150.limit = yymsp[0].minor.yy489; yymsp[-3].minor.yy150.offset = yymsp[-2].minor.yy489;}
break; break;
case 214: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ case 214: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
{yymsp[-3].minor.yy482.limit = yymsp[-2].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[0].minor.yy473;} {yymsp[-3].minor.yy150.limit = yymsp[-2].minor.yy489; yymsp[-3].minor.yy150.offset = yymsp[0].minor.yy489;}
break; break;
case 215: /* slimit_opt ::= SLIMIT signed COMMA signed */ case 215: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy482.limit = yymsp[0].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[-2].minor.yy473;} {yymsp[-3].minor.yy150.limit = yymsp[0].minor.yy489; yymsp[-3].minor.yy150.offset = yymsp[-2].minor.yy489;}
break; break;
case 218: /* expr ::= LP expr RP */ case 218: /* expr ::= LP expr RP */
{yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy454->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} {yylhsminor.yy328 = yymsp[-1].minor.yy328; yylhsminor.yy328->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy328->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 219: /* expr ::= ID */ case 219: /* expr ::= ID */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 220: /* expr ::= ID DOT ID */ case 220: /* expr ::= ID DOT ID */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 221: /* expr ::= ID DOT STAR */ case 221: /* expr ::= ID DOT STAR */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 222: /* expr ::= INTEGER */ case 222: /* expr ::= INTEGER */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 223: /* expr ::= MINUS INTEGER */ case 223: /* expr ::= MINUS INTEGER */
case 224: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==224); case 224: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==224);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy454 = yylhsminor.yy454; yymsp[-1].minor.yy328 = yylhsminor.yy328;
break; break;
case 225: /* expr ::= FLOAT */ case 225: /* expr ::= FLOAT */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 226: /* expr ::= MINUS FLOAT */ case 226: /* expr ::= MINUS FLOAT */
case 227: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==227); case 227: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==227);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
yymsp[-1].minor.yy454 = yylhsminor.yy454; yymsp[-1].minor.yy328 = yylhsminor.yy328;
break; break;
case 228: /* expr ::= STRING */ case 228: /* expr ::= STRING */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 229: /* expr ::= NOW */ case 229: /* expr ::= NOW */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 230: /* expr ::= VARIABLE */ case 230: /* expr ::= VARIABLE */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 231: /* expr ::= PLUS VARIABLE */ case 231: /* expr ::= PLUS VARIABLE */
case 232: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==232); case 232: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==232);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);} { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
yymsp[-1].minor.yy454 = yylhsminor.yy454; yymsp[-1].minor.yy328 = yylhsminor.yy328;
break; break;
case 233: /* expr ::= BOOL */ case 233: /* expr ::= BOOL */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 234: /* expr ::= NULL */ case 234: /* expr ::= NULL */
{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} { yylhsminor.yy328 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 235: /* expr ::= ID LP exprlist RP */ case 235: /* expr ::= ID LP exprlist RP */
{ yylhsminor.yy454 = tSqlExprCreateFunction(yymsp[-1].minor.yy193, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } { yylhsminor.yy328 = tSqlExprCreateFunction(yymsp[-1].minor.yy15, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy454 = yylhsminor.yy454; yymsp[-3].minor.yy328 = yylhsminor.yy328;
break; break;
case 236: /* expr ::= ID LP STAR RP */ case 236: /* expr ::= ID LP STAR RP */
{ yylhsminor.yy454 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } { yylhsminor.yy328 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy454 = yylhsminor.yy454; yymsp[-3].minor.yy328 = yylhsminor.yy328;
break; break;
case 237: /* expr ::= expr IS NULL */ case 237: /* expr ::= expr IS NULL */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, NULL, TK_ISNULL);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, NULL, TK_ISNULL);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 238: /* expr ::= expr IS NOT NULL */ case 238: /* expr ::= expr IS NOT NULL */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-3].minor.yy454, NULL, TK_NOTNULL);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-3].minor.yy328, NULL, TK_NOTNULL);}
yymsp[-3].minor.yy454 = yylhsminor.yy454; yymsp[-3].minor.yy328 = yylhsminor.yy328;
break; break;
case 239: /* expr ::= expr LT expr */ case 239: /* expr ::= expr LT expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_LT);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_LT);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 240: /* expr ::= expr GT expr */ case 240: /* expr ::= expr GT expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_GT);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_GT);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 241: /* expr ::= expr LE expr */ case 241: /* expr ::= expr LE expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_LE);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_LE);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 242: /* expr ::= expr GE expr */ case 242: /* expr ::= expr GE expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_GE);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_GE);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 243: /* expr ::= expr NE expr */ case 243: /* expr ::= expr NE expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_NE);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_NE);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 244: /* expr ::= expr EQ expr */ case 244: /* expr ::= expr EQ expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_EQ);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_EQ);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 245: /* expr ::= expr BETWEEN expr AND expr */ case 245: /* expr ::= expr BETWEEN expr AND expr */
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy454); yylhsminor.yy454 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy454, yymsp[-2].minor.yy454, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy454, TK_LE), TK_AND);} { tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy328); yylhsminor.yy328 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy328, yymsp[-2].minor.yy328, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy328, TK_LE), TK_AND);}
yymsp[-4].minor.yy454 = yylhsminor.yy454; yymsp[-4].minor.yy328 = yylhsminor.yy328;
break; break;
case 246: /* expr ::= expr AND expr */ case 246: /* expr ::= expr AND expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_AND);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_AND);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 247: /* expr ::= expr OR expr */ case 247: /* expr ::= expr OR expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_OR); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_OR); }
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 248: /* expr ::= expr PLUS expr */ case 248: /* expr ::= expr PLUS expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_PLUS); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_PLUS); }
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 249: /* expr ::= expr MINUS expr */ case 249: /* expr ::= expr MINUS expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_MINUS); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_MINUS); }
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 250: /* expr ::= expr STAR expr */ case 250: /* expr ::= expr STAR expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_STAR); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_STAR); }
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 251: /* expr ::= expr SLASH expr */ case 251: /* expr ::= expr SLASH expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_DIVIDE);} {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_DIVIDE);}
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 252: /* expr ::= expr REM expr */ case 252: /* expr ::= expr REM expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_REM); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_REM); }
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 253: /* expr ::= expr LIKE expr */ case 253: /* expr ::= expr LIKE expr */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_LIKE); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-2].minor.yy328, yymsp[0].minor.yy328, TK_LIKE); }
yymsp[-2].minor.yy454 = yylhsminor.yy454; yymsp[-2].minor.yy328 = yylhsminor.yy328;
break; break;
case 254: /* expr ::= expr IN LP exprlist RP */ case 254: /* expr ::= expr IN LP exprlist RP */
{yylhsminor.yy454 = tSqlExprCreate(yymsp[-4].minor.yy454, (tSqlExpr*)yymsp[-1].minor.yy193, TK_IN); } {yylhsminor.yy328 = tSqlExprCreate(yymsp[-4].minor.yy328, (tSqlExpr*)yymsp[-1].minor.yy15, TK_IN); }
yymsp[-4].minor.yy454 = yylhsminor.yy454; yymsp[-4].minor.yy328 = yylhsminor.yy328;
break; break;
case 255: /* exprlist ::= exprlist COMMA expritem */ case 255: /* exprlist ::= exprlist COMMA expritem */
{yylhsminor.yy193 = tSqlExprListAppend(yymsp[-2].minor.yy193,yymsp[0].minor.yy454,0, 0);} {yylhsminor.yy15 = tSqlExprListAppend(yymsp[-2].minor.yy15,yymsp[0].minor.yy328,0, 0);}
yymsp[-2].minor.yy193 = yylhsminor.yy193; yymsp[-2].minor.yy15 = yylhsminor.yy15;
break; break;
case 256: /* exprlist ::= expritem */ case 256: /* exprlist ::= expritem */
{yylhsminor.yy193 = tSqlExprListAppend(0,yymsp[0].minor.yy454,0, 0);} {yylhsminor.yy15 = tSqlExprListAppend(0,yymsp[0].minor.yy328,0, 0);}
yymsp[0].minor.yy193 = yylhsminor.yy193; yymsp[0].minor.yy15 = yylhsminor.yy15;
break; break;
case 257: /* expritem ::= expr */ case 257: /* expritem ::= expr */
{yylhsminor.yy454 = yymsp[0].minor.yy454;} {yylhsminor.yy328 = yymsp[0].minor.yy328;}
yymsp[0].minor.yy454 = yylhsminor.yy454; yymsp[0].minor.yy328 = yylhsminor.yy328;
break; break;
case 259: /* cmd ::= RESET QUERY CACHE */ case 259: /* cmd ::= RESET QUERY CACHE */
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
...@@ -3361,7 +3052,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3361,7 +3052,7 @@ static YYACTIONTYPE yy_reduce(
case 261: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ case 261: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
...@@ -3379,14 +3070,14 @@ static YYACTIONTYPE yy_reduce( ...@@ -3379,14 +3070,14 @@ static YYACTIONTYPE yy_reduce(
case 263: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ case 263: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 264: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ case 264: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
...@@ -3421,7 +3112,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3421,7 +3112,7 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy442, -1); A = tVariantListAppend(A, &yymsp[0].minor.yy380, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -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); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -3430,14 +3121,14 @@ static YYACTIONTYPE yy_reduce( ...@@ -3430,14 +3121,14 @@ static YYACTIONTYPE yy_reduce(
case 268: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ case 268: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 269: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ case 269: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
...@@ -3455,14 +3146,14 @@ static YYACTIONTYPE yy_reduce( ...@@ -3455,14 +3146,14 @@ static YYACTIONTYPE yy_reduce(
case 271: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ case 271: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 272: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ case 272: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
...@@ -3497,7 +3188,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3497,7 +3188,7 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy442, -1); A = tVariantListAppend(A, &yymsp[0].minor.yy380, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); 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); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -3506,7 +3197,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3506,7 +3197,7 @@ static YYACTIONTYPE yy_reduce(
case 276: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ case 276: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy15, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
...@@ -3523,9 +3214,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -3523,9 +3214,9 @@ static YYACTIONTYPE yy_reduce(
break; break;
/********** End reduce actions ************************************************/ /********** End reduce actions ************************************************/
}; };
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) ); assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
yygoto = yyRuleInfoLhs[yyruleno]; yygoto = yyRuleInfo[yyruleno].lhs;
yysize = yyRuleInfoNRhs[yyruleno]; yysize = yyRuleInfo[yyruleno].nrhs;
yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
/* There are no SHIFTREDUCE actions on nonterminals because the table /* There are no SHIFTREDUCE actions on nonterminals because the table
...@@ -3540,7 +3231,6 @@ static YYACTIONTYPE yy_reduce( ...@@ -3540,7 +3231,6 @@ static YYACTIONTYPE yy_reduce(
yymsp->stateno = (YYACTIONTYPE)yyact; yymsp->stateno = (YYACTIONTYPE)yyact;
yymsp->major = (YYCODETYPE)yygoto; yymsp->major = (YYCODETYPE)yygoto;
yyTraceShift(yypParser, yyact, "... then shift"); yyTraceShift(yypParser, yyact, "... then shift");
return yyact;
} }
/* /*
...@@ -3550,8 +3240,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3550,8 +3240,7 @@ static YYACTIONTYPE yy_reduce(
static void yy_parse_failed( static void yy_parse_failed(
yyParser *yypParser /* The parser */ yyParser *yypParser /* The parser */
){ ){
ParseARG_FETCH ParseARG_FETCH;
ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
...@@ -3562,8 +3251,7 @@ static void yy_parse_failed( ...@@ -3562,8 +3251,7 @@ static void yy_parse_failed(
** parser fails */ ** parser fails */
/************ Begin %parse_failure code ***************************************/ /************ Begin %parse_failure code ***************************************/
/************ End %parse_failure code *****************************************/ /************ End %parse_failure code *****************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
} }
#endif /* YYNOERRORRECOVERY */ #endif /* YYNOERRORRECOVERY */
...@@ -3575,8 +3263,7 @@ static void yy_syntax_error( ...@@ -3575,8 +3263,7 @@ static void yy_syntax_error(
int yymajor, /* The major type of the error token */ int yymajor, /* The major type of the error token */
ParseTOKENTYPE yyminor /* The minor type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */
){ ){
ParseARG_FETCH ParseARG_FETCH;
ParseCTX_FETCH
#define TOKEN yyminor #define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/ /************ Begin %syntax_error code ****************************************/
...@@ -3602,8 +3289,7 @@ static void yy_syntax_error( ...@@ -3602,8 +3289,7 @@ static void yy_syntax_error(
assert(len <= outputBufLen); assert(len <= outputBufLen);
/************ End %syntax_error code ******************************************/ /************ End %syntax_error code ******************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
} }
/* /*
...@@ -3612,8 +3298,7 @@ static void yy_syntax_error( ...@@ -3612,8 +3298,7 @@ static void yy_syntax_error(
static void yy_accept( static void yy_accept(
yyParser *yypParser /* The parser */ yyParser *yypParser /* The parser */
){ ){
ParseARG_FETCH ParseARG_FETCH;
ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
...@@ -3628,8 +3313,7 @@ static void yy_accept( ...@@ -3628,8 +3313,7 @@ static void yy_accept(
/*********** Begin %parse_accept code *****************************************/ /*********** Begin %parse_accept code *****************************************/
/*********** End %parse_accept code *******************************************/ /*********** End %parse_accept code *******************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
} }
/* The main parser program. /* The main parser program.
...@@ -3658,47 +3342,45 @@ void Parse( ...@@ -3658,47 +3342,45 @@ void Parse(
ParseARG_PDECL /* Optional %extra_argument parameter */ ParseARG_PDECL /* Optional %extra_argument parameter */
){ ){
YYMINORTYPE yyminorunion; YYMINORTYPE yyminorunion;
YYACTIONTYPE yyact; /* The parser action. */ unsigned int yyact; /* The parser action. */
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
int yyendofinput; /* True if we are at the end of input */ int yyendofinput; /* True if we are at the end of input */
#endif #endif
#ifdef YYERRORSYMBOL #ifdef YYERRORSYMBOL
int yyerrorhit = 0; /* True if yymajor has invoked an error */ int yyerrorhit = 0; /* True if yymajor has invoked an error */
#endif #endif
yyParser *yypParser = (yyParser*)yyp; /* The parser */ yyParser *yypParser; /* The parser */
ParseCTX_FETCH
ParseARG_STORE
yypParser = (yyParser*)yyp;
assert( yypParser->yytos!=0 ); assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
yyendofinput = (yymajor==0); yyendofinput = (yymajor==0);
#endif #endif
ParseARG_STORE;
yyact = yypParser->yytos->stateno;
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
if( yyact < YY_MIN_REDUCE ){ int stateno = yypParser->yytos->stateno;
if( stateno < YY_MIN_REDUCE ){
fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
yyTracePrompt,yyTokenName[yymajor],yyact); yyTracePrompt,yyTokenName[yymajor],stateno);
}else{ }else{
fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE);
} }
} }
#endif #endif
do{ do{
assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
if( yyact >= YY_MIN_REDUCE ){ if( yyact >= YY_MIN_REDUCE ){
yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
yyminor ParseCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){ }else if( yyact <= YY_MAX_SHIFTREDUCE ){
yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); yy_shift(yypParser,yyact,yymajor,yyminor);
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt--; yypParser->yyerrcnt--;
#endif #endif
break; yymajor = YYNOCODE;
}else if( yyact==YY_ACCEPT_ACTION ){ }else if( yyact==YY_ACCEPT_ACTION ){
yypParser->yytos--; yypParser->yytos--;
yy_accept(yypParser); yy_accept(yypParser);
...@@ -3749,9 +3431,10 @@ void Parse( ...@@ -3749,9 +3431,10 @@ void Parse(
yymajor = YYNOCODE; yymajor = YYNOCODE;
}else{ }else{
while( yypParser->yytos >= yypParser->yystack while( yypParser->yytos >= yypParser->yystack
&& yymx != YYERRORSYMBOL
&& (yyact = yy_find_reduce_action( && (yyact = yy_find_reduce_action(
yypParser->yytos->stateno, yypParser->yytos->stateno,
YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE YYERRORSYMBOL)) >= YY_MIN_REDUCE
){ ){
yy_pop_parser_stack(yypParser); yy_pop_parser_stack(yypParser);
} }
...@@ -3768,8 +3451,6 @@ void Parse( ...@@ -3768,8 +3451,6 @@ void Parse(
} }
yypParser->yyerrcnt = 3; yypParser->yyerrcnt = 3;
yyerrorhit = 1; yyerrorhit = 1;
if( yymajor==YYNOCODE ) break;
yyact = yypParser->yytos->stateno;
#elif defined(YYNOERRORRECOVERY) #elif defined(YYNOERRORRECOVERY)
/* If the YYNOERRORRECOVERY macro is defined, then do not attempt to /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
** do any kind of error recovery. Instead, simply invoke the syntax ** do any kind of error recovery. Instead, simply invoke the syntax
...@@ -3780,7 +3461,8 @@ void Parse( ...@@ -3780,7 +3461,8 @@ void Parse(
*/ */
yy_syntax_error(yypParser,yymajor, yyminor); yy_syntax_error(yypParser,yymajor, yyminor);
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
break; yymajor = YYNOCODE;
#else /* YYERRORSYMBOL is not defined */ #else /* YYERRORSYMBOL is not defined */
/* This is what we do if the grammar does not define ERROR: /* This is what we do if the grammar does not define ERROR:
** **
...@@ -3802,10 +3484,10 @@ void Parse( ...@@ -3802,10 +3484,10 @@ void Parse(
yypParser->yyerrcnt = -1; yypParser->yyerrcnt = -1;
#endif #endif
} }
break; yymajor = YYNOCODE;
#endif #endif
} }
}while( yypParser->yytos>yypParser->yystack ); }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
yyStackEntry *i; yyStackEntry *i;
...@@ -3820,17 +3502,3 @@ void Parse( ...@@ -3820,17 +3502,3 @@ void Parse(
#endif #endif
return; return;
} }
/*
** Return the fallback token corresponding to canonical token iToken, or
** 0 if iToken has no fallback.
*/
int ParseFallback(int iToken){
#ifdef YYFALLBACK
assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
return yyFallback[iToken];
#else
(void)iToken;
return 0;
#endif
}
...@@ -92,6 +92,7 @@ struct STsdbRepo { ...@@ -92,6 +92,7 @@ struct STsdbRepo {
pthread_mutex_t mutex; pthread_mutex_t mutex;
bool repoLocked; bool repoLocked;
int32_t code; // Commit code int32_t code; // Commit code
bool inCompact; // is in compact process?
}; };
#define REPO_ID(r) (r)->config.tsdbId #define REPO_ID(r) (r)->config.tsdbId
......
...@@ -12,11 +12,516 @@ ...@@ -12,11 +12,516 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tsdb.h" #include "tsdbint.h"
#ifndef _TSDB_PLUGINS #ifndef _TSDB_PLUGINS
int tsdbCompact(STsdbRepo *pRepo) { return 0; } typedef struct {
void *tsdbCompactImpl(STsdbRepo *pRepo) { return NULL; } STable * pTable;
SBlockIdx * pBlkIdx;
SBlockIdx bindex;
SBlockInfo *pInfo;
} STableCompactH;
typedef struct {
SRtn rtn;
SFSIter fsIter;
SArray * tbArray; // table array to cache table obj and block indexes
SReadH readh;
SDFileSet wSet;
SArray * aBlkIdx;
SArray * aSupBlk;
SDataCols *pDataCols;
} SCompactH;
#define TSDB_COMPACT_WSET(pComph) (&((pComph)->wSet))
#define TSDB_COMPACT_REPO(pComph) TSDB_READ_REPO(&((pComph)->readh))
#define TSDB_COMPACT_HEAD_FILE(pComph) TSDB_DFILE_IN_SET(TSDB_COMPACT_WSET(pComph), TSDB_FILE_HEAD)
#define TSDB_COMPACT_DATA_FILE(pComph) TSDB_DFILE_IN_SET(TSDB_COMPACT_WSET(pComph), TSDB_FILE_DATA)
#define TSDB_COMPACT_LAST_FILE(pComph) TSDB_DFILE_IN_SET(TSDB_COMPACT_WSET(pComph), TSDB_FILE_LAST)
#define TSDB_COMPACT_BUF(pComph) TSDB_READ_BUF(&((pComph)->readh))
#define TSDB_COMPACT_COMP_BUF(pComph) TSDB_READ_COMP_BUF(&((pComph)->readh))
static int tsdbAsyncCompact(STsdbRepo *pRepo);
static void tsdbStartCompact(STsdbRepo *pRepo);
static void tsdbEndCompact(STsdbRepo *pRepo, int eno);
static int tsdbCompactMeta(STsdbRepo *pRepo);
static int tsdbCompactTSData(STsdbRepo *pRepo);
static int tsdbCompactFSet(SCompactH *pComph, SDFileSet *pSet);
static bool tsdbShouldCompact(SCompactH *pComph);
static int tsdbInitCompactH(SCompactH *pComph, STsdbRepo *pRepo);
static void tsdbDestroyCompactH(SCompactH *pComph);
static int tsdbInitCompTbArray(SCompactH *pComph);
static void tsdbDestroyCompTbArray(SCompactH *pComph);
static int tsdbCacheFSetIndex(SCompactH *pComph);
static int tsdbCompactFSetInit(SCompactH *pComph, SDFileSet *pSet);
static void tsdbCompactFSetEnd(SCompactH *pComph);
static int tsdbCompactFSetImpl(SCompactH *pComph);
static int tsdbWriteBlockToRightFile(SCompactH *pComph, STable *pTable, SDataCols *pDataCols, void **ppBuf,
void **ppCBuf);
int tsdbCompact(STsdbRepo *pRepo) { return tsdbAsyncCompact(pRepo); }
void *tsdbCompactImpl(STsdbRepo *pRepo) {
// Check if there are files in TSDB FS to compact
if (REPO_FS(pRepo)->cstatus->pmf == NULL) {
tsdbInfo("vgId:%d no file to compact in FS", REPO_ID(pRepo));
return NULL;
}
tsdbStartCompact(pRepo);
if (tsdbCompactMeta(pRepo) < 0) {
tsdbError("vgId:%d failed to compact META data since %s", REPO_ID(pRepo), tstrerror(terrno));
goto _err;
}
if (tsdbCompactTSData(pRepo) < 0) {
tsdbError("vgId:%d failed to compact TS data since %s", REPO_ID(pRepo), tstrerror(terrno));
goto _err;
}
tsdbEndCompact(pRepo, TSDB_CODE_SUCCESS);
return NULL;
_err:
pRepo->code = terrno;
tsdbEndCompact(pRepo, terrno);
return NULL;
}
static int tsdbAsyncCompact(STsdbRepo *pRepo) {
tsem_wait(&(pRepo->readyToCommit));
return tsdbScheduleCommit(pRepo, COMPACT_REQ);
}
static void tsdbStartCompact(STsdbRepo *pRepo) {
ASSERT(!pRepo->inCompact);
tsdbInfo("vgId:%d start to compact!", REPO_ID(pRepo));
tsdbStartFSTxn(pRepo, 0, 0);
pRepo->code = TSDB_CODE_SUCCESS;
pRepo->inCompact = true;
}
static void tsdbEndCompact(STsdbRepo *pRepo, int eno) {
if (eno != TSDB_CODE_SUCCESS) {
tsdbEndFSTxnWithError(REPO_FS(pRepo));
} else {
tsdbEndFSTxn(pRepo);
}
pRepo->inCompact = false;
tsdbInfo("vgId:%d compact over, %s", REPO_ID(pRepo), (eno == TSDB_CODE_SUCCESS) ? "succeed" : "failed");
tsem_post(&(pRepo->readyToCommit));
}
static int tsdbCompactMeta(STsdbRepo *pRepo) {
STsdbFS *pfs = REPO_FS(pRepo);
tsdbUpdateMFile(pfs, pfs->cstatus->pmf);
return 0;
}
static int tsdbCompactTSData(STsdbRepo *pRepo) {
SCompactH compactH;
SDFileSet *pSet = NULL;
tsdbDebug("vgId:%d start to compact TS data", REPO_ID(pRepo));
// If no file, just return 0;
if (taosArrayGetSize(REPO_FS(pRepo)->cstatus->df) <= 0) {
tsdbDebug("vgId:%d no TS data file to compact, compact over", REPO_ID(pRepo));
return 0;
}
if (tsdbInitCompactH(&compactH, pRepo) < 0) {
return -1;
}
while ((pSet = tsdbFSIterNext(&(compactH.fsIter)))) {
// Remove those expired files
if (pSet->fid < compactH.rtn.minFid) {
tsdbInfo("vgId:%d FSET %d on level %d disk id %d expires, remove it", REPO_ID(pRepo), pSet->fid,
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet));
continue;
}
if (TSDB_FSET_LEVEL(pSet) == TFS_MAX_LEVEL) {
tsdbDebug("vgId:%d FSET %d on level %d, should not compact", REPO_ID(pRepo), pSet->fid, TFS_MAX_LEVEL);
tsdbUpdateDFileSet(REPO_FS(pRepo), pSet);
continue;
}
if (tsdbCompactFSet(&compactH, pSet) < 0) {
tsdbDestroyCompactH(&compactH);
tsdbError("vgId:%d failed to compact FSET %d since %s", REPO_ID(pRepo), pSet->fid, tstrerror(terrno));
return -1;
}
}
tsdbDestroyCompactH(&compactH);
tsdbDebug("vgId:%d compact TS data over", REPO_ID(pRepo));
return 0;
}
static int tsdbCompactFSet(SCompactH *pComph, SDFileSet *pSet) {
STsdbRepo *pRepo = TSDB_COMPACT_REPO(pComph);
SDiskID did;
tsdbDebug("vgId:%d start to compact FSET %d on level %d id %d", REPO_ID(pRepo), pSet->fid, TSDB_FSET_LEVEL(pSet),
TSDB_FSET_ID(pSet));
if (tsdbCompactFSetInit(pComph, pSet) < 0) {
return -1;
}
if (!tsdbShouldCompact(pComph)) {
tsdbDebug("vgId:%d no need to compact FSET %d", REPO_ID(pRepo), pSet->fid);
if (tsdbApplyRtnOnFSet(TSDB_COMPACT_REPO(pComph), pSet, &(pComph->rtn)) < 0) {
tsdbCompactFSetEnd(pComph);
return -1;
}
} else {
// Create new fset as compacted fset
tfsAllocDisk(tsdbGetFidLevel(pSet->fid, &(pComph->rtn)), &(did.level), &(did.id));
if (did.level == TFS_UNDECIDED_LEVEL) {
terrno = TSDB_CODE_TDB_NO_AVAIL_DISK;
tsdbError("vgId:%d failed to compact FSET %d since %s", REPO_ID(pRepo), pSet->fid, tstrerror(terrno));
tsdbCompactFSetEnd(pComph);
return -1;
}
tsdbInitDFileSet(TSDB_COMPACT_WSET(pComph), did, REPO_ID(pRepo), TSDB_FSET_FID(pSet),
FS_TXN_VERSION(REPO_FS(pRepo)));
if (tsdbCreateDFileSet(TSDB_COMPACT_WSET(pComph), true) < 0) {
tsdbError("vgId:%d failed to compact FSET %d since %s", REPO_ID(pRepo), pSet->fid, tstrerror(terrno));
tsdbCompactFSetEnd(pComph);
return -1;
}
if (tsdbCompactFSetImpl(pComph) < 0) {
tsdbCloseDFileSet(TSDB_COMPACT_WSET(pComph));
tsdbRemoveDFileSet(TSDB_COMPACT_WSET(pComph));
tsdbCompactFSetEnd(pComph);
return -1;
}
tsdbCloseDFileSet(TSDB_COMPACT_WSET(pComph));
tsdbUpdateDFileSet(REPO_FS(pRepo), TSDB_COMPACT_WSET(pComph));
tsdbDebug("vgId:%d FSET %d compact over", REPO_ID(pRepo), pSet->fid);
}
tsdbCompactFSetEnd(pComph);
return 0;
}
static bool tsdbShouldCompact(SCompactH *pComph) {
STsdbRepo * pRepo = TSDB_COMPACT_REPO(pComph);
STsdbCfg * pCfg = REPO_CFG(pRepo);
SReadH * pReadh = &(pComph->readh);
STableCompactH *pTh;
SBlock * pBlock;
int defaultRows = TSDB_DEFAULT_BLOCK_ROWS(pCfg->maxRowsPerFileBlock);
SDFile * pDataF = TSDB_READ_DATA_FILE(pReadh);
SDFile * pLastF = TSDB_READ_LAST_FILE(pReadh);
int tblocks = 0; // total blocks
int nSubBlocks = 0; // # of blocks with sub-blocks
int nSmallBlocks = 0; // # of blocks with rows < defaultRows
int64_t tsize = 0;
for (size_t i = 0; i < taosArrayGetSize(pComph->tbArray); i++) {
pTh = (STableCompactH *)taosArrayGet(pComph->tbArray, i);
if (pTh->pTable == NULL || pTh->pBlkIdx == NULL) continue;
for (size_t bidx = 0; bidx < pTh->pBlkIdx->numOfBlocks; bidx++) {
tblocks++;
pBlock = pTh->pInfo->blocks + bidx;
if (pBlock->numOfRows < defaultRows) {
nSmallBlocks++;
}
if (pBlock->numOfSubBlocks > 1) {
nSubBlocks++;
for (int k = 0; k < pBlock->numOfSubBlocks; k++) {
SBlock *iBlock = ((SBlock *)POINTER_SHIFT(pTh->pInfo, pBlock->offset)) + k;
tsize = tsize + iBlock->len;
}
} else if (pBlock->numOfSubBlocks == 1) {
tsize += pBlock->len;
} else {
ASSERT(0);
}
}
}
return (((nSubBlocks * 1.0 / tblocks) > 0.33) || ((nSmallBlocks * 1.0 / tblocks) > 0.33) ||
(tsize * 1.0 / (pDataF->info.size + pLastF->info.size - 2 * TSDB_FILE_HEAD_SIZE) < 0.85));
}
static int tsdbInitCompactH(SCompactH *pComph, STsdbRepo *pRepo) {
STsdbCfg *pCfg = REPO_CFG(pRepo);
memset(pComph, 0, sizeof(*pComph));
TSDB_FSET_SET_CLOSED(TSDB_COMPACT_WSET(pComph));
tsdbGetRtnSnap(pRepo, &(pComph->rtn));
tsdbFSIterInit(&(pComph->fsIter), REPO_FS(pRepo), TSDB_FS_ITER_FORWARD);
if (tsdbInitReadH(&(pComph->readh), pRepo) < 0) {
return -1;
}
if (tsdbInitCompTbArray(pComph) < 0) {
tsdbDestroyCompactH(pComph);
return -1;
}
pComph->aBlkIdx = taosArrayInit(1024, sizeof(SBlockIdx));
if (pComph->aBlkIdx == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbDestroyCompactH(pComph);
return -1;
}
pComph->aSupBlk = taosArrayInit(1024, sizeof(SBlock));
if (pComph->aSupBlk == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbDestroyCompactH(pComph);
return -1;
}
pComph->pDataCols = tdNewDataCols(0, 0, pCfg->maxRowsPerFileBlock);
if (pComph->pDataCols == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbDestroyCompactH(pComph);
return -1;
}
return 0;
}
static void tsdbDestroyCompactH(SCompactH *pComph) {
pComph->pDataCols = tdFreeDataCols(pComph->pDataCols);
pComph->aSupBlk = taosArrayDestroy(pComph->aSupBlk);
pComph->aBlkIdx = taosArrayDestroy(pComph->aBlkIdx);
tsdbDestroyCompTbArray(pComph);
tsdbDestroyReadH(&(pComph->readh));
tsdbCloseDFileSet(TSDB_COMPACT_WSET(pComph));
}
static int tsdbInitCompTbArray(SCompactH *pComph) { // Init pComp->tbArray
STsdbRepo *pRepo = TSDB_COMPACT_REPO(pComph);
STsdbMeta *pMeta = pRepo->tsdbMeta;
if (tsdbRLockRepoMeta(pRepo) < 0) return -1;
pComph->tbArray = taosArrayInit(pMeta->maxTables, sizeof(STableCompactH));
if (pComph->tbArray == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbUnlockRepoMeta(pRepo);
return -1;
}
// Note here must start from 0
for (int i = 0; i < pMeta->maxTables; i++) {
STableCompactH ch = {0};
if (pMeta->tables[i] != NULL) {
tsdbRefTable(pMeta->tables[i]);
ch.pTable = pMeta->tables[i];
}
if (taosArrayPush(pComph->tbArray, &ch) == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbUnlockRepoMeta(pRepo);
return -1;
}
}
if (tsdbUnlockRepoMeta(pRepo) < 0) return -1;
return 0;
}
static void tsdbDestroyCompTbArray(SCompactH *pComph) {
STableCompactH *pTh;
if (pComph->tbArray == NULL) return;
for (size_t i = 0; i < taosArrayGetSize(pComph->tbArray); i++) {
pTh = (STableCompactH *)taosArrayGet(pComph->tbArray, i);
if (pTh->pTable) {
tsdbUnRefTable(pTh->pTable);
}
pTh->pInfo = taosTZfree(pTh->pInfo);
}
pComph->tbArray = taosArrayDestroy(pComph->tbArray);
}
static int tsdbCacheFSetIndex(SCompactH *pComph) {
SReadH *pReadH = &(pComph->readh);
if (tsdbLoadBlockIdx(pReadH) < 0) {
return -1;
}
for (int tid = 1; tid < taosArrayGetSize(pComph->tbArray); tid++) {
STableCompactH *pTh = (STableCompactH *)taosArrayGet(pComph->tbArray, tid);
pTh->pBlkIdx = NULL;
if (pTh->pTable == NULL) continue;
if (tsdbSetReadTable(pReadH, pTh->pTable) < 0) {
return -1;
}
if (pReadH->pBlkIdx == NULL) continue;
pTh->bindex = *(pReadH->pBlkIdx);
pTh->pBlkIdx = &(pTh->bindex);
if (tsdbMakeRoom((void **)(&(pTh->pInfo)), pTh->pBlkIdx->len) < 0) {
return -1;
}
if (tsdbLoadBlockInfo(pReadH, (void *)(pTh->pInfo)) < 0) {
return -1;
}
}
return 0;
}
static int tsdbCompactFSetInit(SCompactH *pComph, SDFileSet *pSet) {
taosArrayClear(pComph->aBlkIdx);
taosArrayClear(pComph->aSupBlk);
if (tsdbSetAndOpenReadFSet(&(pComph->readh), pSet) < 0) {
return -1;
}
if (tsdbCacheFSetIndex(pComph) < 0) {
tsdbCloseAndUnsetFSet(&(pComph->readh));
return -1;
}
return 0;
}
static void tsdbCompactFSetEnd(SCompactH *pComph) { tsdbCloseAndUnsetFSet(&(pComph->readh)); }
static int tsdbCompactFSetImpl(SCompactH *pComph) {
STsdbRepo *pRepo = TSDB_COMPACT_REPO(pComph);
STsdbCfg * pCfg = REPO_CFG(pRepo);
SReadH * pReadh = &(pComph->readh);
SBlockIdx blkIdx;
void ** ppBuf = &(TSDB_COMPACT_BUF(pComph));
void ** ppCBuf = &(TSDB_COMPACT_COMP_BUF(pComph));
int defaultRows = TSDB_DEFAULT_BLOCK_ROWS(pCfg->maxRowsPerFileBlock);
taosArrayClear(pComph->aBlkIdx);
for (int tid = 1; tid < taosArrayGetSize(pComph->tbArray); tid++) {
STableCompactH *pTh = (STableCompactH *)taosArrayGet(pComph->tbArray, tid);
STSchema * pSchema;
if (pTh->pTable == NULL || pTh->pBlkIdx == NULL) continue;
pSchema = tsdbGetTableSchemaImpl(pTh->pTable, true, true, -1);
taosArrayClear(pComph->aSupBlk);
if ((tdInitDataCols(pComph->pDataCols, pSchema) < 0) || (tdInitDataCols(pReadh->pDCols[0], pSchema) < 0) ||
(tdInitDataCols(pReadh->pDCols[1], pSchema) < 0)) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return -1;
}
tdFreeSchema(pSchema);
// Loop to compact each block data
for (int i = 0; i < pTh->pBlkIdx->numOfBlocks; i++) {
SBlock *pBlock = pTh->pInfo->blocks + i;
// Load the block data
if (tsdbLoadBlockData(pReadh, pBlock, pTh->pInfo) < 0) {
return -1;
}
// Merge pComph->pDataCols and pReadh->pDCols[0] and write data to file
if (pComph->pDataCols->numOfRows == 0 && pBlock->numOfRows >= defaultRows) {
if (tsdbWriteBlockToRightFile(pComph, pTh->pTable, pReadh->pDCols[0], ppBuf, ppCBuf) < 0) {
return -1;
}
} else {
int ridx = 0;
while (true) {
if (pReadh->pDCols[0]->numOfRows - ridx == 0) break;
int rowsToMerge = MIN(pReadh->pDCols[0]->numOfRows - ridx, defaultRows - pComph->pDataCols->numOfRows);
tdMergeDataCols(pComph->pDataCols, pReadh->pDCols[0], rowsToMerge, &ridx);
if (pComph->pDataCols->numOfRows < defaultRows) {
break;
}
if (tsdbWriteBlockToRightFile(pComph, pTh->pTable, pComph->pDataCols, ppBuf, ppCBuf) < 0) {
return -1;
}
tdResetDataCols(pComph->pDataCols);
}
}
}
if (pComph->pDataCols->numOfRows > 0 &&
tsdbWriteBlockToRightFile(pComph, pTh->pTable, pComph->pDataCols, ppBuf, ppCBuf) < 0) {
return -1;
}
if (tsdbWriteBlockInfoImpl(TSDB_COMPACT_HEAD_FILE(pComph), pTh->pTable, pComph->aSupBlk, NULL, ppBuf, &blkIdx) <
0) {
return -1;
}
if ((blkIdx.numOfBlocks > 0) && (taosArrayPush(pComph->aBlkIdx, (void *)(&blkIdx)) == NULL)) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return -1;
}
}
if (tsdbWriteBlockIdx(TSDB_COMPACT_HEAD_FILE(pComph), pComph->aBlkIdx, ppBuf) < 0) {
return -1;
}
return 0;
}
static int tsdbWriteBlockToRightFile(SCompactH *pComph, STable *pTable, SDataCols *pDataCols, void **ppBuf,
void **ppCBuf) {
STsdbRepo *pRepo = TSDB_COMPACT_REPO(pComph);
STsdbCfg * pCfg = REPO_CFG(pRepo);
SDFile * pDFile;
bool isLast;
SBlock block;
ASSERT(pDataCols->numOfRows > 0);
if (pDataCols->numOfRows < pCfg->minRowsPerFileBlock) {
pDFile = TSDB_COMPACT_LAST_FILE(pComph);
isLast = true;
} else {
pDFile = TSDB_COMPACT_DATA_FILE(pComph);
isLast = false;
}
if (tsdbWriteBlockImpl(pRepo, pTable, pDFile, pDataCols, &block, isLast, true, ppBuf, ppCBuf) < 0) {
return -1;
}
if (taosArrayPush(pComph->aSupBlk, (void *)(&block)) == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return -1;
}
return 0;
}
#endif #endif
\ No newline at end of file
...@@ -195,6 +195,8 @@ STsdbRepoInfo *tsdbGetStatus(STsdbRepo *pRepo) { return NULL; } ...@@ -195,6 +195,8 @@ STsdbRepoInfo *tsdbGetStatus(STsdbRepo *pRepo) { return NULL; }
int tsdbGetState(STsdbRepo *repo) { return repo->state; } int tsdbGetState(STsdbRepo *repo) { return repo->state; }
bool tsdbInCompact(STsdbRepo *repo) { return repo->inCompact; }
void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int64_t *compStorage) { void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int64_t *compStorage) {
ASSERT(repo != NULL); ASSERT(repo != NULL);
STsdbRepo *pRepo = repo; STsdbRepo *pRepo = repo;
...@@ -533,6 +535,7 @@ static STsdbRepo *tsdbNewRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) { ...@@ -533,6 +535,7 @@ static STsdbRepo *tsdbNewRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) {
pRepo->state = TSDB_STATE_OK; pRepo->state = TSDB_STATE_OK;
pRepo->code = TSDB_CODE_SUCCESS; pRepo->code = TSDB_CODE_SUCCESS;
pRepo->inCompact = false;
pRepo->config = *pCfg; pRepo->config = *pCfg;
if (pAppH) { if (pAppH) {
pRepo->appH = *pAppH; pRepo->appH = *pAppH;
......
...@@ -218,11 +218,6 @@ static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) { ...@@ -218,11 +218,6 @@ static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) {
int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle) { int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle) {
STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) pHandle; STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) pHandle;
size_t size = taosArrayGetSize(pQueryHandle->pTableCheckInfo);
assert(pQueryHandle->activeIndex < size && pQueryHandle->activeIndex >= 0 && size >= 1);
STableCheckInfo* pCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, pQueryHandle->activeIndex);
int64_t rows = 0; int64_t rows = 0;
SMemRef* pMemRef = pQueryHandle->pMemRef; SMemRef* pMemRef = pQueryHandle->pMemRef;
if (pMemRef == NULL) { return rows; } if (pMemRef == NULL) { return rows; }
...@@ -233,15 +228,19 @@ int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle) { ...@@ -233,15 +228,19 @@ int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle) {
SMemTable* pMemT = pMemRef->snapshot.mem; SMemTable* pMemT = pMemRef->snapshot.mem;
SMemTable* pIMemT = pMemRef->snapshot.imem; SMemTable* pIMemT = pMemRef->snapshot.imem;
if (pMemT && pCheckInfo->tableId.tid < pMemT->maxTables) { size_t size = taosArrayGetSize(pQueryHandle->pTableCheckInfo);
pMem = pMemT->tData[pCheckInfo->tableId.tid]; for (int32_t i = 0; i < size; ++i) {
rows += (pMem && pMem->uid == pCheckInfo->tableId.uid) ? pMem->numOfRows: 0; STableCheckInfo* pCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, i);
}
if (pIMemT && pCheckInfo->tableId.tid < pIMemT->maxTables) { if (pMemT && pCheckInfo->tableId.tid < pMemT->maxTables) {
pIMem = pIMemT->tData[pCheckInfo->tableId.tid]; pMem = pMemT->tData[pCheckInfo->tableId.tid];
rows += (pIMem && pIMem->uid == pCheckInfo->tableId.uid) ? pIMem->numOfRows: 0; rows += (pMem && pMem->uid == pCheckInfo->tableId.uid) ? pMem->numOfRows : 0;
}
if (pIMemT && pCheckInfo->tableId.tid < pIMemT->maxTables) {
pIMem = pIMemT->tData[pCheckInfo->tableId.tid];
rows += (pIMem && pIMem->uid == pCheckInfo->tableId.uid) ? pIMem->numOfRows : 0;
}
} }
return rows; return rows;
} }
...@@ -1088,7 +1087,11 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p ...@@ -1088,7 +1087,11 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
assert(cur->pos >= 0 && cur->pos <= binfo.rows); assert(cur->pos >= 0 && cur->pos <= binfo.rows);
TSKEY key = (row != NULL)? dataRowKey(row):TSKEY_INITIAL_VAL; TSKEY key = (row != NULL)? dataRowKey(row):TSKEY_INITIAL_VAL;
tsdbDebug("%p key in mem:%"PRId64", 0x%"PRIx64, pQueryHandle, key, pQueryHandle->qId); if (key != TSKEY_INITIAL_VAL) {
tsdbDebug("%p key in mem:%"PRId64", 0x%"PRIx64, pQueryHandle, key, pQueryHandle->qId);
} else {
tsdbDebug("%p no data in mem, 0x%"PRIx64, pQueryHandle, pQueryHandle->qId);
}
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) || if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) ||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) { (!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) {
...@@ -1152,8 +1155,14 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p ...@@ -1152,8 +1155,14 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
} }
assert(cur->blockCompleted); assert(cur->blockCompleted);
tsdbDebug("create data block from remain file block, brange:%"PRId64"-%"PRId64", rows:%d, lastKey:%"PRId64", %p", if (cur->rows == binfo.rows) {
cur->win.skey, cur->win.ekey, cur->rows, cur->lastKey, pQueryHandle); tsdbDebug("%p whole file block qualified, brange:%"PRId64"-%"PRId64", rows:%d, lastKey:%"PRId64", %"PRIx64,
pQueryHandle, cur->win.skey, cur->win.ekey, cur->rows, cur->lastKey, pQueryHandle->qId);
} else {
tsdbDebug("%p create data block from remain file block, brange:%"PRId64"-%"PRId64", rows:%d, total:%d, lastKey:%"PRId64", %"PRIx64,
pQueryHandle, cur->win.skey, cur->win.ekey, cur->rows, binfo.rows, cur->lastKey, pQueryHandle->qId);
}
} }
return code; return code;
......
...@@ -26,6 +26,7 @@ extern "C" { ...@@ -26,6 +26,7 @@ extern "C" {
#include "taosdef.h" #include "taosdef.h"
int32_t strdequote(char *src); int32_t strdequote(char *src);
int32_t strRmquote(char *z, int32_t len);
size_t strtrim(char *src); size_t strtrim(char *src);
char * strnchr(char *haystack, char needle, int32_t len, bool skipquote); char * strnchr(char *haystack, char needle, int32_t len, bool skipquote);
char ** strsplit(char *src, const char *delim, int32_t *num); char ** strsplit(char *src, const char *delim, int32_t *num);
......
...@@ -52,6 +52,36 @@ int32_t strdequote(char *z) { ...@@ -52,6 +52,36 @@ int32_t strdequote(char *z) {
return j + 1; // only one quote, do nothing return j + 1; // only one quote, do nothing
} }
int32_t strRmquote(char *z, int32_t len){
// delete escape character: \\, \', \"
char delim = z[0];
if (delim != '\'' && delim != '\"') {
return len;
}
int32_t cnt = 0;
int32_t j = 0;
for (uint32_t k = 1; k < len - 1; ++k) {
if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) {
z[j] = z[k + 1];
cnt++;
j++;
k++;
continue;
}
z[j] = z[k];
j++;
}
z[j] = 0;
return len - 2 - cnt;
}
size_t strtrim(char *z) { size_t strtrim(char *z) {
int32_t i = 0; int32_t i = 0;
int32_t j = 0; int32_t j = 0;
......
...@@ -216,13 +216,13 @@ ...@@ -216,13 +216,13 @@
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId> <artifactId>logback-core</artifactId>
<version>1.0.13</version> <version>1.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>1.0.13</version> <version>1.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -86,7 +86,7 @@ static int print_result(TAOS_RES* res, int blockFetch) { ...@@ -86,7 +86,7 @@ static int print_result(TAOS_RES* res, int blockFetch) {
} }
} else { } else {
while ((row = taos_fetch_row(res))) { while ((row = taos_fetch_row(res))) {
char temp[256]; char temp[256] = {0};
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
puts(temp); puts(temp);
nRows++; nRows++;
...@@ -391,10 +391,10 @@ void verify_prepare(TAOS* taos) { ...@@ -391,10 +391,10 @@ void verify_prepare(TAOS* taos) {
int rows = 0; int rows = 0;
int num_fields = taos_num_fields(result); int num_fields = taos_num_fields(result);
TAOS_FIELD *fields = taos_fetch_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result);
char temp[256];
// fetch the records row by row // fetch the records row by row
while ((row = taos_fetch_row(result))) { while ((row = taos_fetch_row(result))) {
char temp[256] = {0};
rows++; rows++;
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
printf("%s\n", temp); printf("%s\n", temp);
...@@ -614,10 +614,10 @@ void verify_prepare2(TAOS* taos) { ...@@ -614,10 +614,10 @@ void verify_prepare2(TAOS* taos) {
int rows = 0; int rows = 0;
int num_fields = taos_num_fields(result); int num_fields = taos_num_fields(result);
TAOS_FIELD *fields = taos_fetch_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result);
char temp[256];
// fetch the records row by row // fetch the records row by row
while ((row = taos_fetch_row(result))) { while ((row = taos_fetch_row(result))) {
char temp[256] = {0};
rows++; rows++;
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
printf("%s\n", temp); printf("%s\n", temp);
...@@ -866,12 +866,10 @@ void verify_prepare3(TAOS* taos) { ...@@ -866,12 +866,10 @@ void verify_prepare3(TAOS* taos) {
int rows = 0; int rows = 0;
int num_fields = taos_num_fields(result); int num_fields = taos_num_fields(result);
TAOS_FIELD *fields = taos_fetch_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result);
char temp[256] = {0};
// fetch the records row by row // fetch the records row by row
while ((row = taos_fetch_row(result))) { while ((row = taos_fetch_row(result))) {
memset(temp, 0, sizeof(temp)/sizeof(temp[0])); char temp[256] = {0};
rows++; rows++;
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
printf("%s\n", temp); printf("%s\n", temp);
......
...@@ -116,12 +116,12 @@ void Test(TAOS *taos, char *qstr, int index) { ...@@ -116,12 +116,12 @@ void Test(TAOS *taos, char *qstr, int index) {
int rows = 0; int rows = 0;
int num_fields = taos_field_count(result); int num_fields = taos_field_count(result);
TAOS_FIELD *fields = taos_fetch_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result);
char temp[1024];
printf("num_fields = %d\n", num_fields); printf("num_fields = %d\n", num_fields);
printf("select * from table, result:\n"); printf("select * from table, result:\n");
// fetch the records row by row // fetch the records row by row
while ((row = taos_fetch_row(result))) { while ((row = taos_fetch_row(result))) {
char temp[1024] = {0};
rows++; rows++;
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
printf("%s\n", temp); printf("%s\n", temp);
......
...@@ -184,10 +184,10 @@ int main(int argc, char *argv[]) ...@@ -184,10 +184,10 @@ int main(int argc, char *argv[])
int rows = 0; int rows = 0;
int num_fields = taos_num_fields(result); int num_fields = taos_num_fields(result);
TAOS_FIELD *fields = taos_fetch_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result);
char temp[256];
// fetch the records row by row // fetch the records row by row
while ((row = taos_fetch_row(result))) { while ((row = taos_fetch_row(result))) {
char temp[256] = {0};
rows++; rows++;
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
printf("%s\n", temp); printf("%s\n", temp);
......
...@@ -14,8 +14,6 @@ void print_result(TAOS_RES* res, int blockFetch) { ...@@ -14,8 +14,6 @@ void print_result(TAOS_RES* res, int blockFetch) {
int num_fields = taos_num_fields(res); int num_fields = taos_num_fields(res);
TAOS_FIELD* fields = taos_fetch_fields(res); TAOS_FIELD* fields = taos_fetch_fields(res);
int nRows = 0; int nRows = 0;
char buf[4096];
if (blockFetch) { if (blockFetch) {
nRows = taos_fetch_block(res, &row); nRows = taos_fetch_block(res, &row);
...@@ -25,6 +23,7 @@ void print_result(TAOS_RES* res, int blockFetch) { ...@@ -25,6 +23,7 @@ void print_result(TAOS_RES* res, int blockFetch) {
//} //}
} else { } else {
while ((row = taos_fetch_row(res))) { while ((row = taos_fetch_row(res))) {
char buf[4096] = {0};
taos_print_row(buf, row, fields, num_fields); taos_print_row(buf, row, fields, num_fields);
puts(buf); puts(buf);
nRows++; nRows++;
......
...@@ -21,7 +21,7 @@ def pre_test(){ ...@@ -21,7 +21,7 @@ def pre_test(){
cmake .. > /dev/null cmake .. > /dev/null
make > /dev/null make > /dev/null
make install > /dev/null make install > /dev/null
pip3 install ${WKC}/src/connector/python/linux/python3/ pip3 install ${WKC}/src/connector/python/ || echo 0
''' '''
return 1 return 1
} }
......
...@@ -23,7 +23,8 @@ class Node: ...@@ -23,7 +23,8 @@ class Node:
self.hostIP = hostIP self.hostIP = hostIP
self.hostName = hostName self.hostName = hostName
self.homeDir = homeDir self.homeDir = homeDir
self.conn = Connection("{}@{}".format(username, hostName), connect_kwargs={"password": "{}".format(password)}) self.corePath = '/coredump'
self.conn = Connection("{}@{}".format(username, hostName), connect_kwargs={"password": "{}".format(password)})
def buildTaosd(self): def buildTaosd(self):
try: try:
...@@ -126,21 +127,37 @@ class Node: ...@@ -126,21 +127,37 @@ class Node:
except Exception as e: except Exception as e:
print("remove taosd error for node %d " % self.index) print("remove taosd error for node %d " % self.index)
logging.exception(e) logging.exception(e)
def detectCoredumpFile(self):
try:
result = self.conn.run("find /coredump -name 'core_*' ", hide=True)
output = result.stdout
print("output: %s" % output)
return output
except Exception as e:
print("find coredump file error on node %d " % self.index)
logging.exception(e)
class Nodes: class Nodes:
def __init__(self): def __init__(self):
self.tdnodes = [] self.tdnodes = []
self.tdnodes.append(Node(0, 'root', '52.143.103.7', 'node1', 'a', '/root/')) self.tdnodes.append(Node(0, 'root', '192.168.17.194', 'taosdata', 'r', '/root/'))
self.tdnodes.append(Node(1, 'root', '52.250.48.222', 'node2', 'a', '/root/')) # self.tdnodes.append(Node(1, 'root', '52.250.48.222', 'node2', 'a', '/root/'))
self.tdnodes.append(Node(2, 'root', '51.141.167.23', 'node3', 'a', '/root/')) # self.tdnodes.append(Node(2, 'root', '51.141.167.23', 'node3', 'a', '/root/'))
self.tdnodes.append(Node(3, 'root', '52.247.207.173', 'node4', 'a', '/root/')) # self.tdnodes.append(Node(3, 'root', '52.247.207.173', 'node4', 'a', '/root/'))
self.tdnodes.append(Node(4, 'root', '51.141.166.100', 'node5', 'a', '/root/')) # self.tdnodes.append(Node(4, 'root', '51.141.166.100', 'node5', 'a', '/root/'))
def stopOneNode(self, index): def stopOneNode(self, index):
self.tdnodes[index].stopTaosd()
self.tdnodes[index].forceStopOneTaosd() self.tdnodes[index].forceStopOneTaosd()
def startOneNode(self, index): def startOneNode(self, index):
self.tdnodes[index].startOneTaosd() self.tdnodes[index].startOneTaosd()
def detectCoredumpFile(self, index):
return self.tdnodes[index].detectCoredumpFile()
def stopAllTaosd(self): def stopAllTaosd(self):
for i in range(len(self.tdnodes)): for i in range(len(self.tdnodes)):
...@@ -166,14 +183,32 @@ class Nodes: ...@@ -166,14 +183,32 @@ class Nodes:
for i in range(len(self.tdnodes)): for i in range(len(self.tdnodes)):
self.tdnodes[i].removeData() self.tdnodes[i].removeData()
# kill taosd randomly every 10 mins class Test:
nodes = Nodes() def __init__(self):
loop = 0 self.nodes = Nodes()
while True:
loop = loop + 1 # kill taosd randomly every 10 mins
index = random.randint(0, 4) def randomlyKillDnode(self):
print("loop: %d, kill taosd on node%d" %(loop, index)) loop = 0
nodes.stopOneNode(index) while True:
time.sleep(60) index = random.randint(0, 4)
nodes.startOneNode(index) print("loop: %d, kill taosd on node%d" %(loop, index))
time.sleep(600) self.nodes.stopOneNode(index)
\ No newline at end of file time.sleep(60)
self.nodes.startOneNode(index)
time.sleep(600)
loop = loop + 1
def detectCoredump(self):
loop = 0
while True:
for i in range(len(self.nodes.tdnodes)):
result = self.nodes.detectCoredumpFile(i)
print("core file path is %s" % result)
if result and not result.isspace():
self.nodes.stopAllTaosd()
print("sleep for 10 mins")
time.sleep(600)
test = Test()
test.detectCoredump()
\ No newline at end of file
...@@ -229,7 +229,7 @@ python3 ./test.py -f query/queryFilterTswithDateUnit.py ...@@ -229,7 +229,7 @@ python3 ./test.py -f query/queryFilterTswithDateUnit.py
python3 ./test.py -f query/queryTscomputWithNow.py python3 ./test.py -f query/queryTscomputWithNow.py
python3 ./test.py -f query/computeErrorinWhere.py python3 ./test.py -f query/computeErrorinWhere.py
python3 ./test.py -f query/queryTsisNull.py python3 ./test.py -f query/queryTsisNull.py
python3 ./test.py -f query/subqueryFilter.py
#stream #stream
......
...@@ -25,7 +25,7 @@ class TDTestCase: ...@@ -25,7 +25,7 @@ class TDTestCase:
def run(self): def run(self):
tdSql.query("show variables") tdSql.query("show variables")
tdSql.checkData(51, 1, 864000) tdSql.checkData(53, 1, 864000)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
...@@ -33,4 +33,4 @@ class TDTestCase: ...@@ -33,4 +33,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
...@@ -141,7 +141,7 @@ class TDTestCase: ...@@ -141,7 +141,7 @@ class TDTestCase:
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
print("============== last_row_cache_0.sim") print("============== Step1: last_row_cache_0.sim")
tdSql.execute("create database test1 cachelast 0") tdSql.execute("create database test1 cachelast 0")
tdSql.execute("use test1") tdSql.execute("use test1")
self.insertData() self.insertData()
...@@ -149,43 +149,48 @@ class TDTestCase: ...@@ -149,43 +149,48 @@ class TDTestCase:
self.insertData2() self.insertData2()
self.executeQueries2() self.executeQueries2()
print("============== alter last cache") print("============== Step2: alter database test1 cachelast 1")
tdSql.execute("alter database test1 cachelast 1") tdSql.execute("alter database test1 cachelast 1")
self.executeQueries2() self.executeQueries2()
print("============== Step3: alter database test1 cachelast 2")
tdSql.execute("alter database test1 cachelast 2") tdSql.execute("alter database test1 cachelast 2")
self.executeQueries2() self.executeQueries2()
print("============== Step4: alter database test1 cachelast 3")
tdSql.execute("alter database test1 cachelast 3") tdSql.execute("alter database test1 cachelast 3")
self.executeQueries2() self.executeQueries2()
print("============== alter last cache") print("============== Step5: alter database test1 cachelast 0 and restart taosd")
tdSql.execute("alter database test1 cachelast 0") tdSql.execute("alter database test1 cachelast 0")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step6: alter database test1 cachelast 1 and restart taosd")
tdSql.execute("alter database test1 cachelast 1") tdSql.execute("alter database test1 cachelast 1")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step7: alter database test1 cachelast 2 and restart taosd")
tdSql.execute("alter database test1 cachelast 2") tdSql.execute("alter database test1 cachelast 2")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step8: alter database test1 cachelast 3 and restart taosd")
tdSql.execute("alter database test1 cachelast 3") tdSql.execute("alter database test1 cachelast 3")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== last_row_cache_1.sim") print("============== Step9: create database test2 cachelast 1")
tdSql.execute("create database test2 cachelast 1") tdSql.execute("create database test2 cachelast 1")
tdSql.execute("use test2") tdSql.execute("use test2")
self.insertData() self.insertData()
...@@ -196,42 +201,51 @@ class TDTestCase: ...@@ -196,42 +201,51 @@ class TDTestCase:
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step8: alter database test2 cachelast 0")
tdSql.execute("alter database test2 cachelast 0") tdSql.execute("alter database test2 cachelast 0")
self.executeQueries2() self.executeQueries2()
print("============== Step9: alter database test2 cachelast 1")
tdSql.execute("alter database test2 cachelast 1") tdSql.execute("alter database test2 cachelast 1")
self.executeQueries2() self.executeQueries2()
print("============== Step10: alter database test2 cachelast 2")
tdSql.execute("alter database test2 cachelast 2") tdSql.execute("alter database test2 cachelast 2")
self.executeQueries2() self.executeQueries2()
print("============== Step11: alter database test2 cachelast 3")
tdSql.execute("alter database test2 cachelast 3") tdSql.execute("alter database test2 cachelast 3")
self.executeQueries2() self.executeQueries2()
print("============== Step12: alter database test2 cachelast 0 and restart taosd")
tdSql.execute("alter database test2 cachelast 0") tdSql.execute("alter database test2 cachelast 0")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step13: alter database test2 cachelast 1 and restart taosd")
tdSql.execute("alter database test2 cachelast 1") tdSql.execute("alter database test2 cachelast 1")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step14: alter database test2 cachelast 2 and restart taosd")
tdSql.execute("alter database test2 cachelast 2") tdSql.execute("alter database test2 cachelast 2")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step15: alter database test2 cachelast 3 and restart taosd")
tdSql.execute("alter database test2 cachelast 3") tdSql.execute("alter database test2 cachelast 3")
self.executeQueries2() self.executeQueries2()
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
self.executeQueries2() self.executeQueries2()
print("============== Step16: select last_row(*) from st group by tbname")
tdSql.query("select last_row(*) from st group by tbname") tdSql.query("select last_row(*) from st group by tbname")
tdSql.checkRows(10) tdSql.checkRows(10)
......
###################################################################
# 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 taos
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())
def run(self):
tdSql.prepare()
print("==============step1")
tdSql.execute(
"create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50), tag2 binary(16))")
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags("dev_01", "tag_01")')
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags("dev_02", "tag_02")')
print("==============step2")
tdSql.execute(
"""INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.011', 3)
('2020-05-13 10:00:01.011', 4)('2020-05-13 10:00:01.611', 5)('2020-05-13 10:00:02.612', 6)
('2020-05-13 10:01:02.612', 7)('2020-05-13 10:02:02.612', 8)('2020-05-13 10:03:02.613', 9)
('2020-05-13 11:00:00.000', 10)('2020-05-13 12:00:00.000', 11)('2020-05-13 13:00:00.001', 12)
('2020-05-14 13:00:00.001', 13)('2020-05-15 14:00:00.000', 14)('2020-05-20 10:00:00.000', 15)
('2020-05-27 10:00:00.001', 16) dev_002 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.009', 3)('2020-05-13 10:00:00.0021', 4)
('2020-05-13 10:00:00.031', 5)('2020-05-13 10:00:00.036', 6)('2020-05-13 10:00:00.51', 7)
""")
# session(ts,5a)
tdSql.query("select count(*) from dev_001 session(ts,5a)")
tdSql.checkRows(15)
tdSql.checkData(0, 1, 2)
# session(ts,1s)
tdSql.query("select count(*) from dev_001 session(ts,1s)")
tdSql.checkRows(12)
tdSql.checkData(0, 1, 5)
tdSql.query("select count(*) from dev_001 session(ts,1000a)")
tdSql.checkRows(12)
tdSql.checkData(0, 1, 5)
# session(ts,1m)
tdSql.query("select count(*) from dev_001 session(ts,1m)")
tdSql.checkRows(9)
tdSql.checkData(0, 1, 8)
# session(ts,1h)
tdSql.query("select count(*) from dev_001 session(ts,1h)")
tdSql.checkRows(6)
tdSql.checkData(0, 1, 11)
# session(ts,1d)
tdSql.query("select count(*) from dev_001 session(ts,1d)")
tdSql.checkRows(4)
tdSql.checkData(0, 1, 13)
# session(ts,1w)
tdSql.query("select count(*) from dev_001 session(ts,1w)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 15)
# session with where
tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 13)
tdSql.checkData(0, 2, 1)
tdSql.checkData(0, 3, 13)
tdSql.checkData(0, 4, 7)
tdSql.checkData(0, 5, 91)
tdSql.checkData(0, 6, 1)
tdSql.checkData(0, 7, 13)
tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}')
tdSql.checkData(0, 9, 12)
# tdsql err
tdSql.error("select * from dev_001 session(ts,1w)")
tdSql.error("select count(*) from st session(ts,1w)")
tdSql.error("select count(*) from dev_001 group by tagtype session(ts,1w) ")
tdSql.error("select count(*) from dev_001 session(ts,1n)")
tdSql.error("select count(*) from dev_001 session(ts,1y)")
tdSql.error("select count(*) from dev_001 session(ts,0s)")
tdSql.error("select count(*) from dev_001 session(i,1y)")
tdSql.error("select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'")
#test precision us
tdSql.execute("create database test precision 'us'")
tdSql.execute("use test")
tdSql.execute("create table dev_001 (ts timestamp ,i timestamp ,j int)")
tdSql.execute("insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)")
# session(ts,1u)
tdSql.query("select count(*) from dev_001 session(ts,1u)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 3)
tdSql.error("select count(*) from dev_001 session(i,1s)")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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 taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
from util.dnodes import tdDnodes
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1601481600000
self.tables = 10
self.perfix = 'dev'
def insertData(self):
print("==============step1")
tdSql.execute(
"create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50))")
for i in range(self.tables):
tdSql.execute("create table %s%d using st tags(%d)" % (self.perfix, i, i))
rows = 15 + i
for j in range(rows):
tdSql.execute("insert into %s%d values(%d, %d)" %(self.perfix, i, self.ts + i * 20 * 10000 + j * 10000, j))
def run(self):
tdSql.prepare()
self.insertData()
tdSql.query("select count(*) val from st group by tbname")
tdSql.checkRows(10)
tdSql.query("select * from (select count(*) val from st group by tbname)")
tdSql.checkRows(10)
tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val < 20")
tdSql.checkRows(5)
tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val > 20")
tdSql.checkRows(4)
tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val = 20")
tdSql.checkRows(1)
tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val <= 20")
tdSql.checkRows(6)
tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val >= 20")
tdSql.checkRows(5)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val > 20")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val >= 20")
tdSql.checkData(0, 0, 2)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val < 20")
tdSql.checkData(0, 0, 63)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val <= 20")
tdSql.checkData(0, 0, 64)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val = 20")
tdSql.checkData(0, 0, 1)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val > 20")
tdSql.checkData(0, 0, 1)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val >= 20")
tdSql.checkData(0, 0, 2)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val < 20")
tdSql.checkData(0, 0, 63)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val <= 20")
tdSql.checkData(0, 0, 64)
tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val = 20")
tdSql.checkData(0, 0, 1)
tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val > 20")
tdSql.checkData(0, 0, 3)
tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val >= 20")
tdSql.checkData(0, 0, 5)
tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val < 20")
tdSql.checkData(0, 0, 60)
tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val <= 20")
tdSql.checkData(0, 0, 62)
tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val = 20")
tdSql.checkData(0, 0, 2)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -177,7 +177,7 @@ sql alter database db blocks 20 ...@@ -177,7 +177,7 @@ sql alter database db blocks 20
sql alter database db blocks 10 sql alter database db blocks 10
sql_error alter database db blocks 2 sql_error alter database db blocks 2
sql_error alter database db blocks 1 sql_error alter database db blocks 1
sql alter database db blocks 0 sql_error alter database db blocks 0
sql_error alter database db blocks -1 sql_error alter database db blocks -1
sql_error alter database db blocks 10001 sql_error alter database db blocks 10001
......
...@@ -455,7 +455,7 @@ sql alter database db blocks 20 ...@@ -455,7 +455,7 @@ sql alter database db blocks 20
sql alter database db blocks 10 sql alter database db blocks 10
sql_error alter database db blocks 2 sql_error alter database db blocks 2
sql_error alter database db blocks 1 sql_error alter database db blocks 1
sql alter database db blocks 0 sql_error alter database db blocks 0
sql_error alter database db blocks -1 sql_error alter database db blocks -1
sql_error alter database db blocks 10001 sql_error alter database db blocks 10001
......
...@@ -932,3 +932,125 @@ if $data32 != 0.000144445 then ...@@ -932,3 +932,125 @@ if $data32 != 0.000144445 then
return -1 return -1
endi endi
print ===========================> derivative
sql drop table t1
sql drop table tx;
sql drop table m1;
sql drop table if exists tm0;
sql drop table if exists tm1;
sql create table tm0(ts timestamp, k double)
sql insert into tm0 values('2015-08-18T00:00:00Z', 2.064) ('2015-08-18T00:06:00Z', 2.116) ('2015-08-18T00:12:00Z', 2.028)
sql insert into tm0 values('2015-08-18T00:18:00Z', 2.126) ('2015-08-18T00:24:00Z', 2.041) ('2015-08-18T00:30:00Z', 2.051)
sql_error select derivative(ts) from tm0;
sql_error select derivative(k) from tm0;
sql_error select derivative(k, 0, 0) from tm0;
sql_error select derivative(k, 1, 911) from tm0;
sql_error select derivative(kx, 1s, 1) from tm0;
sql_error select derivative(k, -20s, 1) from tm0;
sql_error select derivative(k, 20a, 0) from tm0;
sql_error select derivative(k, 200a, 0) from tm0;
sql_error select derivative(k, 999a, 0) from tm0;
sql_error select derivative(k, 20s, -12) from tm0;
sql select derivative(k, 1s, 0) from tm0
if $rows != 5 then
return -1
endi
if $data00 != @15-08-18 08:06:00.000@ then
return -1
endi
if $data01 != 0.000144444 then
print expect 0.000144444, actual: $data01
return -1
endi
if $data10 != @15-08-18 08:12:00.000@ then
return -1
endi
if $data11 != -0.000244444 then
return -1
endi
if $data20 != @15-08-18 08:18:00.000@ then
return -1
endi
if $data21 != 0.000272222 then
print expect 0.000272222, actual: $data21
return -1
endi
if $data30 != @15-08-18 08:24:00.000@ then
return -1
endi
if $data31 != -0.000236111 then
print expect 0.000236111, actual: $data31
return -1
endi
sql select derivative(k, 6m, 0) from tm0;
if $rows != 5 then
return -1
endi
if $data00 != @15-08-18 08:06:00.000@ then
return -1
endi
if $data01 != 0.052000000 then
print expect 0.052000000, actual: $data01
return -1
endi
if $data10 != @15-08-18 08:12:00.000@ then
return -1
endi
if $data11 != -0.088000000 then
return -1
endi
if $data20 != @15-08-18 08:18:00.000@ then
return -1
endi
if $data21 != 0.098000000 then
return -1
endi
if $data30 != @15-08-18 08:24:00.000@ then
return -1
endi
if $data31 != -0.085000000 then
return -1
endi
sql select derivative(k, 12m, 0) from tm0;
if $rows != 5 then
return -1
endi
if $data00 != @15-08-18 08:06:00.000@ then
return -1
endi
if $data01 != 0.104000000 then
print expect 0.104000000, actual: $data01
return -1
endi
sql select derivative(k, 6m, 1) from tm0;
if $rows != 3 then
return -1
endi
sql_error select derivative(k, 6m, 1) from tm0 interval(1s);
sql_error select derivative(k, 6m, 1) from tm0 session(ts, 1s);
sql_error select derivative(k, 6m, 1) from tm0 group by k;
sql_error select derivative(k, 6m, 1) from
\ No newline at end of file
...@@ -147,8 +147,57 @@ if $data02 != @nest_tb0@ then ...@@ -147,8 +147,57 @@ if $data02 != @nest_tb0@ then
endi endi
print ===================> nest query interval print ===================> nest query interval
sql_error select ts, avg(c1) from (select ts, c1 from nest_tb0);
sql select avg(c1) from (select * from nest_tb0) interval(3d)
if $rows != 3 then
return -1
endi
if $data00 != @20-09-14 00:00:00.000@ then
return -1
endi
if $data01 != 49.222222222 then
return -1
endi
if $data10 != @20-09-17 00:00:00.000@ then
print expect 20-09-17 00:00:00.000, actual: $data10
return -1
endi
if $data11 != 49.685185185 then
return -1
endi
if $data20 != @20-09-20 00:00:00.000@ then
return -1
endi
if $data21 != 49.500000000 then
return -1
endi
#define TSDB_FUNC_APERCT 7
#define TSDB_FUNC_LAST_ROW 10
#define TSDB_FUNC_TWA 14
#define TSDB_FUNC_LEASTSQR 15
#define TSDB_FUNC_ARITHM 23
#define TSDB_FUNC_DIFF 24
#define TSDB_FUNC_INTERP 28
#define TSDB_FUNC_RATE 29
#define TSDB_FUNC_IRATE 30
#define TSDB_FUNC_DERIVATIVE 32
sql_error select stddev(c1) from (select c1 from nest_tb0);
sql_error select percentile(c1, 20) from (select * from nest_tb0);
sql select avg(c1),sum(c2), max(c3), min(c4), count(*), first(c7), last(c7),spread(c6) from (select * from nest_tb0) interval(1d);
sql select top(x, 20) from (select c1 x from nest_tb0);
sql select bottom(x, 20) from (select c1 x from nest_tb0)
print ===================> complex query print ===================> complex query
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册