diff --git a/example/src/tmq.c b/example/src/tmq.c index 832e389a13..fdd26bc95d 100644 --- a/example/src/tmq.c +++ b/example/src/tmq.c @@ -54,7 +54,8 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c4 int) tags(t1 int)"); + pRes = + taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(10)) tags(t1 int)"); if (taos_errno(pRes) != 0) { printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); return -1; @@ -101,7 +102,7 @@ int32_t create_topic() { /*const char* sql = "select * from tu1";*/ /*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql));*/ - pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c4 from ct1"); + pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from ct1"); if (taos_errno(pRes) != 0) { printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes)); return -1; @@ -144,6 +145,7 @@ void tmq_commit_cb_print(tmq_t* tmq, tmq_resp_err_t resp, tmq_topic_vgroup_list_ } tmq_t* build_consumer() { +#if 0 TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); @@ -152,11 +154,15 @@ tmq_t* build_consumer() { printf("error in use db, reason:%s\n", taos_errstr(pRes)); } taos_free_result(pRes); +#endif tmq_conf_t* conf = tmq_conf_new(); tmq_conf_set(conf, "group.id", "tg2"); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "td.connect.db", "abc1"); tmq_conf_set_offset_commit_cb(conf, tmq_commit_cb_print); - tmq_t* tmq = tmq_consumer_new(pConn, conf, NULL, 0); + tmq_t* tmq = tmq_consumer_new1(conf, NULL, 0); return tmq; } diff --git a/include/client/taos.h b/include/client/taos.h index 87948e7824..2180903633 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -247,10 +247,10 @@ DLL_EXPORT tmq_list_t *tmq_list_new(); DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *); DLL_EXPORT void tmq_list_destroy(tmq_list_t *); -// will be removed in 3.0 +#if 1 DLL_EXPORT tmq_t *tmq_consumer_new(void *conn, tmq_conf_t *conf, char *errstr, int32_t errstrLen); +#endif -// will replace last one DLL_EXPORT tmq_t *tmq_consumer_new1(tmq_conf_t *conf, char *errstr, int32_t errstrLen); DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t); diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 1ded61eb3f..8956c3b7cf 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -332,6 +332,7 @@ int32_t taosEncodeSEpSet(void** buf, const SEpSet* pEp); void* taosDecodeSEpSet(void* buf, SEpSet* pEp); typedef struct { + int8_t connType; int32_t pid; char app[TSDB_APP_NAME_LEN]; char db[TSDB_DB_NAME_LEN]; @@ -346,6 +347,7 @@ typedef struct { int64_t clusterId; int32_t connId; int8_t superUser; + int8_t connType; SEpSet epSet; char sVersion[128]; } SConnectRsp; @@ -953,9 +955,14 @@ typedef struct { char db[TSDB_DB_FNAME_LEN]; char tb[TSDB_TABLE_NAME_LEN]; int64_t showId; - int8_t free; } SRetrieveTableReq; +typedef struct SSysTableSchema { + int8_t type; + col_id_t colId; + int32_t bytes; +} SSysTableSchema; + int32_t tSerializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq); int32_t tDeserializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq); diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 5f919a28d7..e553dff270 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -136,7 +136,6 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_KILL_CONN, "mnode-kill-conn", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_HEARTBEAT, "mnode-heartbeat", SClientHbBatchReq, SClientHbBatchRsp) TD_DEF_MSG_TYPE(TDMT_MND_SHOW, "mnode-show", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_SHOW_RETRIEVE, "mnode-retrieve", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_SYSTABLE_RETRIEVE, "mnode-systable-retrieve", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_STATUS, "mnode-status", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "mnode-trans-tmr", NULL, NULL) @@ -189,8 +188,8 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TOPIC, "vnode-create-topic", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TOPIC, "vnode-alter-topic", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TOPIC, "vnode-drop-topic", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES, "vnode-show-tables", SVShowTablesReq, SVShowTablesRsp) - TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES_FETCH, "vnode-show-tables-fetch", SVShowTablesFetchReq, SVShowTablesFetchRsp) +// TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES, "vnode-show-tables", SVShowTablesReq, SVShowTablesRsp) +// TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES_FETCH, "vnode-show-tables-fetch", SVShowTablesFetchReq, SVShowTablesFetchRsp) TD_DEF_MSG_TYPE(TDMT_VND_QUERY_CONTINUE, "vnode-query-continue", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_QUERY_HEARTBEAT, "vnode-query-heartbeat", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_EXPLAIN, "vnode-explain", NULL, NULL) diff --git a/include/common/ttime.h b/include/common/ttime.h index 15450c31ca..3de0b98d85 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -40,6 +40,7 @@ extern "C" { * @return timestamp decided by global conf variable, tsTimePrecision * if precision == TSDB_TIME_PRECISION_MICRO, it returns timestamp in microsecond. * precision == TSDB_TIME_PRECISION_MILLI, it returns timestamp in millisecond. + * precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond. */ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) { if (precision == TSDB_TIME_PRECISION_MICRO) { @@ -51,6 +52,24 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) { } } +/* + * @return timestamp of today at 00:00:00 in given precision + * if precision == TSDB_TIME_PRECISION_MICRO, it returns timestamp in microsecond. + * precision == TSDB_TIME_PRECISION_MILLI, it returns timestamp in millisecond. + * precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond. + */ +static FORCE_INLINE int64_t taosGetTimestampToday(int32_t precision) { + int64_t factor = (precision == TSDB_TIME_PRECISION_MILLI) ? 1000 : + (precision == TSDB_TIME_PRECISION_MICRO) ? 1000000 : 1000000000; + time_t t = taosTime(NULL); + struct tm * tm= taosLocalTime(&t, NULL); + tm->tm_hour = 0; + tm->tm_min = 0; + tm->tm_sec = 0; + + return (int64_t)taosMktime(tm) * factor; +} + int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision); int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision); int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 5f4e539f9d..23dd4b38ff 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -183,47 +183,48 @@ #define TK_LAST 165 #define TK_CAST 166 #define TK_NOW 167 -#define TK_ROWTS 168 -#define TK_TBNAME 169 -#define TK_QSTARTTS 170 -#define TK_QENDTS 171 -#define TK_WSTARTTS 172 -#define TK_WENDTS 173 -#define TK_WDURATION 174 -#define TK_BETWEEN 175 -#define TK_IS 176 -#define TK_NK_LT 177 -#define TK_NK_GT 178 -#define TK_NK_LE 179 -#define TK_NK_GE 180 -#define TK_NK_NE 181 -#define TK_MATCH 182 -#define TK_NMATCH 183 -#define TK_JOIN 184 -#define TK_INNER 185 -#define TK_SELECT 186 -#define TK_DISTINCT 187 -#define TK_WHERE 188 -#define TK_PARTITION 189 -#define TK_BY 190 -#define TK_SESSION 191 -#define TK_STATE_WINDOW 192 -#define TK_SLIDING 193 -#define TK_FILL 194 -#define TK_VALUE 195 -#define TK_NONE 196 -#define TK_PREV 197 -#define TK_LINEAR 198 -#define TK_NEXT 199 -#define TK_GROUP 200 -#define TK_HAVING 201 -#define TK_ORDER 202 -#define TK_SLIMIT 203 -#define TK_SOFFSET 204 -#define TK_LIMIT 205 -#define TK_OFFSET 206 -#define TK_ASC 207 -#define TK_NULLS 208 +#define TK_TODAY 168 +#define TK_ROWTS 169 +#define TK_TBNAME 170 +#define TK_QSTARTTS 171 +#define TK_QENDTS 172 +#define TK_WSTARTTS 173 +#define TK_WENDTS 174 +#define TK_WDURATION 175 +#define TK_BETWEEN 176 +#define TK_IS 177 +#define TK_NK_LT 178 +#define TK_NK_GT 179 +#define TK_NK_LE 180 +#define TK_NK_GE 181 +#define TK_NK_NE 182 +#define TK_MATCH 183 +#define TK_NMATCH 184 +#define TK_JOIN 185 +#define TK_INNER 186 +#define TK_SELECT 187 +#define TK_DISTINCT 188 +#define TK_WHERE 189 +#define TK_PARTITION 190 +#define TK_BY 191 +#define TK_SESSION 192 +#define TK_STATE_WINDOW 193 +#define TK_SLIDING 194 +#define TK_FILL 195 +#define TK_VALUE 196 +#define TK_NONE 197 +#define TK_PREV 198 +#define TK_LINEAR 199 +#define TK_NEXT 200 +#define TK_GROUP 201 +#define TK_HAVING 202 +#define TK_ORDER 203 +#define TK_SLIMIT 204 +#define TK_SOFFSET 205 +#define TK_LIMIT 206 +#define TK_OFFSET 207 +#define TK_ASC 208 +#define TK_NULLS 209 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/common/ttypes.h b/include/common/ttypes.h index f3a59f51fd..23b260849d 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -24,7 +24,6 @@ extern "C" { #include "types.h" // ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR -typedef int32_t VarDataOffsetT; typedef uint32_t TDRowLenT; typedef uint8_t TDRowValT; typedef uint64_t TDRowVerT; diff --git a/include/os/osTime.h b/include/os/osTime.h index 766fec0fbd..fd431f6df8 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -27,9 +27,11 @@ extern "C" { #ifndef ALLOW_FORBID_FUNC #define strptime STRPTIME_FUNC_TAOS_FORBID #define gettimeofday GETTIMEOFDAY_FUNC_TAOS_FORBID + #define localtime LOCALTIME_FUNC_TAOS_FORBID #define localtime_s LOCALTIMES_FUNC_TAOS_FORBID #define localtime_r LOCALTIMER_FUNC_TAOS_FORBID #define time TIME_FUNC_TAOS_FORBID + #define mktime MKTIME_FUNC_TAOS_FORBID #endif #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) @@ -82,6 +84,8 @@ static FORCE_INLINE int64_t taosGetTimestampNs() { char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm); struct tm *taosLocalTime(const time_t *timep, struct tm *result); +time_t taosTime(time_t *t); +time_t taosMktime(struct tm *timep); #ifdef __cplusplus } diff --git a/include/util/tdef.h b/include/util/tdef.h index f276a1a812..eeaa34007a 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -100,6 +100,7 @@ extern const int32_t TYPE_BYTES[15]; #define TSDB_TIME_PRECISION_NANO_DIGITS 19 #define TSDB_INFORMATION_SCHEMA_DB "information_schema" +#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" #define TSDB_INS_TABLE_DNODES "dnodes" #define TSDB_INS_TABLE_MNODES "mnodes" #define TSDB_INS_TABLE_MODULES "modules" @@ -117,6 +118,7 @@ extern const int32_t TYPE_BYTES[15]; #define TSDB_INS_TABLE_VGROUPS "vgroups" #define TSDB_INS_TABLE_BNODES "bnodes" #define TSDB_INS_TABLE_SNODES "snodes" +#define TSDB_INS_TABLE_LICENCES "grants" #define TSDB_INDEX_TYPE_SMA "SMA" #define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT" diff --git a/packaging/install.sh b/packaging/install.sh index c9748d223b..6642f89221 100755 --- a/packaging/install.sh +++ b/packaging/install.sh @@ -228,6 +228,12 @@ function install_header() { ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h } +# temp install taosBenchmark +function install_taosTools() { + cd ${script_dir}/taos-tools/ + tar xvf taosTools-1.4.1-Linux-x64.tar.gz && cd taosTools-1.4.1/ && ./install-taostools.sh +} + function add_newHostname_to_hosts() { localIp="127.0.0.1" OLD_IFS="$IFS" @@ -473,6 +479,7 @@ function install_TDengine() { install_log install_header install_lib + install_taosTools if [ -z $1 ]; then # install service and client # For installing new diff --git a/packaging/release.sh b/packaging/release.sh index 5219b1b7b1..885d73c33b 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -55,6 +55,7 @@ mkdir -p ${install_dir} mkdir -p ${install_dir}/bin mkdir -p ${install_dir}/lib mkdir -p ${install_dir}/inc +mkdir -p ${install_dir}/taos-tools install_files="${script_dir}/install.sh" chmod a+x ${script_dir}/install.sh || : @@ -68,6 +69,8 @@ cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : cp ${compile_dir}/source/client/libtaos.so ${install_dir}/lib/ cp ${compile_dir}/source/libs/tdb/libtdb.so ${install_dir}/lib/ +taostoolfile="${top_dir}/tools/taosTools-1.4.1-Linux-x64.tar.gz" +cp ${taostoolfile} ${install_dir}/taos-tools #cp ${compile_dir}/source/dnode/mnode/impl/libmnode.so ${install_dir}/lib/ #cp ${compile_dir}/source/dnode/qnode/libqnode.so ${install_dir}/lib/ diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index b7d88c277b..0f12880272 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -45,6 +45,11 @@ extern "C" { #define HEARTBEAT_INTERVAL 1500 // ms +enum { + CONN_TYPE__QUERY = 1, + CONN_TYPE__TMQ, +}; + typedef struct SAppInstInfo SAppInstInfo; typedef struct { @@ -132,9 +137,9 @@ typedef struct STscObj { char pass[TSDB_PASSWORD_LEN]; char db[TSDB_DB_FNAME_LEN]; char ver[128]; + int8_t connType; int32_t acctId; uint32_t connId; - int32_t connType; uint64_t id; // ref ID returned by taosAddRef TdThreadMutex mutex; // used to protect the operation on db int32_t numOfReqs; // number of sqlObj bound to this connection @@ -272,14 +277,14 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet); void initMsgHandleFp(); TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db, - uint16_t port); + uint16_t port, int connType); int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery); int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList); int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj** pRequest); -void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); +void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); void doSetOneRowPtr(SReqResultInfo* pResultInfo); int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows, bool convertUcs4); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index d389fc34c6..82788b2e11 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -23,6 +23,8 @@ static SClientHbMgr clientHbMgr = {0}; static int32_t hbCreateThread(); static void hbStopThread(); +static int32_t hbMqHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req) { return 0; } + static int32_t hbMqHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { return 0; } static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog *pCatalog) { @@ -297,11 +299,10 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req return TSDB_CODE_SUCCESS; } -int32_t hbMqHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req) { return 0; } - void hbMgrInitMqHbHandle() { clientHbMgr.reqHandle[HEARTBEAT_TYPE_QUERY] = hbQueryHbReqHandle; clientHbMgr.reqHandle[HEARTBEAT_TYPE_MQ] = hbMqHbReqHandle; + clientHbMgr.rspHandle[HEARTBEAT_TYPE_QUERY] = hbQueryHbRspHandle; clientHbMgr.rspHandle[HEARTBEAT_TYPE_MQ] = hbMqHbRspHandle; } @@ -438,7 +439,7 @@ static int32_t hbCreateThread() { if (taosThreadCreate(&clientHbMgr.thread, &thAttr, hbThreadFunc, NULL) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; - } + } taosThreadAttrDestroy(&thAttr); return 0; } @@ -568,7 +569,7 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo * int hbRegisterConn(SAppHbMgr *pAppHbMgr, int32_t connId, int64_t clusterId, int32_t hbType) { SClientHbKey connKey = { .connId = connId, - .hbType = HEARTBEAT_TYPE_QUERY, + .hbType = hbType, }; SHbConnInfo info = {0}; @@ -578,16 +579,14 @@ int hbRegisterConn(SAppHbMgr *pAppHbMgr, int32_t connId, int64_t clusterId, int3 *pClusterId = clusterId; info.param = pClusterId; - break; + return hbRegisterConnImpl(pAppHbMgr, connKey, &info); } case HEARTBEAT_TYPE_MQ: { - break; + return 0; } default: - break; + return 0; } - - return hbRegisterConnImpl(pAppHbMgr, connKey, &info); } void hbDeregisterConn(SAppHbMgr *pAppHbMgr, SClientHbKey connKey) { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 63bb3637cf..52262eeaef 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -11,7 +11,7 @@ #include "tref.h" static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet); -static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest); +static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest, int8_t connType); static void destroySendMsgInfo(SMsgSendInfo* pMsgBody); static bool stringLengthCheck(const char* str, size_t maxsize) { @@ -40,10 +40,10 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i } static STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param, - SAppInstInfo* pAppInfo); + SAppInstInfo* pAppInfo, int connType); TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db, - uint16_t port) { + uint16_t port, int connType) { if (taos_init() != TSDB_CODE_SUCCESS) { return NULL; } @@ -111,7 +111,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass, taosThreadMutexUnlock(&appInfo.mutex); taosMemoryFreeClear(key); - return taosConnectImpl(user, &secretEncrypt[0], localDb, NULL, NULL, *pInst); + return taosConnectImpl(user, &secretEncrypt[0], localDb, NULL, NULL, *pInst, connType); } int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj** pRequest) { @@ -193,13 +193,6 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { STscObj* pTscObj = pRequest->pTscObj; SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest); - if (pMsgInfo->msgType == TDMT_VND_SHOW_TABLES) { - SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo; - if (pShowReqInfo->pArray == NULL) { - pShowReqInfo->currentIndex = 0; // set the first vnode/ then iterate the next vnode - pShowReqInfo->pArray = pMsgInfo->pExtension; - } - } int64_t transporterId = 0; asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, &transporterId, pSendMsg); @@ -425,7 +418,7 @@ int initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSe } STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param, - SAppInstInfo* pAppInfo) { + SAppInstInfo* pAppInfo, int connType) { STscObj* pTscObj = createTscObj(user, auth, db, pAppInfo); if (NULL == pTscObj) { terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -439,7 +432,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t return NULL; } - SMsgSendInfo* body = buildConnectMsg(pRequest); + SMsgSendInfo* body = buildConnectMsg(pRequest, connType); int64_t transporterId = 0; asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pTscObj->pAppInfo->mgmtEp.epSet, &transporterId, body); @@ -462,7 +455,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t return pTscObj; } -static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { +static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest, int8_t connType) { SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (pMsgSendInfo == NULL) { terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -485,6 +478,7 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { } taosMemoryFreeClear(db); + connectReq.connType = connType; connectReq.pid = htonl(appInfo.pid); connectReq.startTime = htobe64(appInfo.startTime); tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app)); @@ -570,7 +564,7 @@ TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, cons return NULL; } - return taos_connect_internal(ip, user, NULL, auth, db, port); + return taos_connect_internal(ip, user, NULL, auth, db, port, CONN_TYPE__QUERY); } TAOS* taos_connect_l(const char* ip, int ipLen, const char* user, int userLen, const char* pass, int passLen, @@ -613,102 +607,38 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) { } } -void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) { +void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) { assert(pRequest != NULL); + SReqResultInfo* pResultInfo = &pRequest->body.resInfo; - - SEpSet epSet = {0}; - if (pResultInfo->pData == NULL || pResultInfo->current >= pResultInfo->numOfRows) { - if (pRequest->type == TDMT_VND_QUERY) { - // All data has returned to App already, no need to try again - if (pResultInfo->completed) { - pResultInfo->numOfRows = 0; - return NULL; - } - - SReqResultInfo* pResInfo = &pRequest->body.resInfo; - pRequest->code = schedulerFetchRows(pRequest->body.queryJob, (void**)&pResInfo->pData); - if (pRequest->code != TSDB_CODE_SUCCESS) { - pResultInfo->numOfRows = 0; - return NULL; - } - - pRequest->code = setQueryResultFromRsp(&pRequest->body.resInfo, (SRetrieveTableRsp*)pResInfo->pData, convertUcs4); - if (pRequest->code != TSDB_CODE_SUCCESS) { - pResultInfo->numOfRows = 0; - return NULL; - } - - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64, - pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId); - - if (pResultInfo->numOfRows == 0) { - return NULL; - } - - goto _return; - } else if (pRequest->type == TDMT_MND_SHOW) { - pRequest->type = TDMT_MND_SHOW_RETRIEVE; - epSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - } else if (pRequest->type == TDMT_VND_SHOW_TABLES) { - pRequest->type = TDMT_VND_SHOW_TABLES_FETCH; - SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo; - SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex); - - epSet = pVgroupInfo->epSet; - } else if (pRequest->type == TDMT_VND_SHOW_TABLES_FETCH) { - pRequest->type = TDMT_VND_SHOW_TABLES; - SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo; - pShowReqInfo->currentIndex += 1; - if (pShowReqInfo->currentIndex >= taosArrayGetSize(pShowReqInfo->pArray)) { - return NULL; - } - - SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex); - SVShowTablesReq* pShowReq = taosMemoryCalloc(1, sizeof(SVShowTablesReq)); - pShowReq->head.vgId = htonl(pVgroupInfo->vgId); - - pRequest->body.requestMsg.len = sizeof(SVShowTablesReq); - pRequest->body.requestMsg.pData = pShowReq; - - SMsgSendInfo* body = buildMsgInfoImpl(pRequest); - epSet = pVgroupInfo->epSet; - - int64_t transporterId = 0; - STscObj* pTscObj = pRequest->pTscObj; - asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body); - tsem_wait(&pRequest->body.rspSem); - - pRequest->type = TDMT_VND_SHOW_TABLES_FETCH; - } else if (pRequest->type == TDMT_MND_SHOW_RETRIEVE) { - epSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - - if (pResultInfo->completed) { - return NULL; - } - } - + // All data has returned to App already, no need to try again if (pResultInfo->completed) { pResultInfo->numOfRows = 0; return NULL; } - SMsgSendInfo* body = buildMsgInfoImpl(pRequest); + SReqResultInfo* pResInfo = &pRequest->body.resInfo; + pRequest->code = schedulerFetchRows(pRequest->body.queryJob, (void**)&pResInfo->pData); + if (pRequest->code != TSDB_CODE_SUCCESS) { + pResultInfo->numOfRows = 0; + return NULL; + } - int64_t transporterId = 0; - STscObj* pTscObj = pRequest->pTscObj; - asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body); + pRequest->code = setQueryResultFromRsp(&pRequest->body.resInfo, (SRetrieveTableRsp*)pResInfo->pData, convertUcs4); + if (pRequest->code != TSDB_CODE_SUCCESS) { + pResultInfo->numOfRows = 0; + return NULL; + } - tsem_wait(&pRequest->body.rspSem); + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64, + pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId); - pResultInfo->current = 0; - if (pResultInfo->numOfRows <= pResultInfo->current) { + if (pResultInfo->numOfRows == 0) { return NULL; } } -_return: if (setupOneRowPtr) { doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index fa55e9c295..6fab4aa4e1 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -87,7 +87,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha pass = TSDB_DEFAULT_PASS; } - return taos_connect_internal(ip, user, pass, NULL, db, port); + return taos_connect_internal(ip, user, pass, NULL, db, port, CONN_TYPE__QUERY); } void taos_close(TAOS *taos) { @@ -124,8 +124,10 @@ const char *taos_errstr(TAOS_RES *res) { } void taos_free_result(TAOS_RES *res) { - SRequestObj *pRequest = (SRequestObj *)res; - destroyRequest(pRequest); + if (TD_RES_QUERY(res)) { + SRequestObj *pRequest = (SRequestObj *)res; + destroyRequest(pRequest); + } } int taos_field_count(TAOS_RES *res) { @@ -168,7 +170,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { return NULL; } - return doFetchRow(pRequest, true, true); + return doFetchRows(pRequest, true, true); } else if (TD_RES_TMQ(res)) { SMqRspObj *msg = ((SMqRspObj *)res); @@ -434,7 +436,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) { return 0; } - doFetchRow(pRequest, false, true); + doFetchRows(pRequest, false, true); // TODO refactor SReqResultInfo *pResultInfo = &pRequest->body.resInfo; @@ -469,7 +471,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { return 0; } - doFetchRow(pRequest, false, true); + doFetchRows(pRequest, false, false); SReqResultInfo *pResultInfo = &pRequest->body.resInfo; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 99c6e81551..67c5679cac 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -69,9 +69,9 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) { pTscObj->pAppInfo->clusterId = connectRsp.clusterId; atomic_add_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); - pTscObj->connType = HEARTBEAT_TYPE_QUERY; + pTscObj->connType = connectRsp.connType; - hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, connectRsp.connId, connectRsp.clusterId, HEARTBEAT_TYPE_QUERY); + hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, connectRsp.connId, connectRsp.clusterId, connectRsp.connType); // pRequest->body.resInfo.pRspMsg = pMsg->pData; tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, @@ -90,150 +90,13 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) { pMsgSendInfo->param = pRequest; pMsgSendInfo->msgType = pRequest->type; - if (pRequest->type == TDMT_MND_SHOW_RETRIEVE || pRequest->type == TDMT_VND_SHOW_TABLES_FETCH) { - if (pRequest->type == TDMT_MND_SHOW_RETRIEVE) { - SRetrieveTableReq retrieveReq = {0}; - retrieveReq.showId = pRequest->body.showInfo.execId; - - int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq); - void* pReq = taosMemoryMalloc(contLen); - tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq); - pMsgSendInfo->msgInfo.pData = pReq; - pMsgSendInfo->msgInfo.len = contLen; - pMsgSendInfo->msgInfo.handle = NULL; - } else { - SVShowTablesFetchReq* pFetchMsg = taosMemoryCalloc(1, sizeof(SVShowTablesFetchReq)); - if (pFetchMsg == NULL) { - return NULL; - } - - pFetchMsg->id = htobe64(pRequest->body.showInfo.execId); - pFetchMsg->head.vgId = htonl(pRequest->body.showInfo.vgId); - - pMsgSendInfo->msgInfo.pData = pFetchMsg; - pMsgSendInfo->msgInfo.len = sizeof(SVShowTablesFetchReq); - pMsgSendInfo->msgInfo.handle = NULL; - } - } else { - assert(pRequest != NULL); - pMsgSendInfo->msgInfo = pRequest->body.requestMsg; - } + assert(pRequest != NULL); + pMsgSendInfo->msgInfo = pRequest->body.requestMsg; pMsgSendInfo->fp = (handleRequestRspFp[TMSG_INDEX(pRequest->type)] == NULL)? genericRspCallback:handleRequestRspFp[TMSG_INDEX(pRequest->type)]; return pMsgSendInfo; } -int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) { - SRequestObj* pRequest = param; - if (code != TSDB_CODE_SUCCESS) { - setErrno(pRequest, code); - tsem_post(&pRequest->body.rspSem); - return code; - } - - SShowRsp showRsp = {0}; - tDeserializeSShowRsp(pMsg->pData, pMsg->len, &showRsp); - STableMetaRsp *pMetaMsg = &showRsp.tableMeta; - - taosMemoryFreeClear(pRequest->body.resInfo.pRspMsg); - pRequest->body.resInfo.pRspMsg = pMsg->pData; - SReqResultInfo* pResInfo = &pRequest->body.resInfo; - - if (pResInfo->fields == NULL) { - TAOS_FIELD* pFields = taosMemoryCalloc(pMetaMsg->numOfColumns, sizeof(TAOS_FIELD)); - for (int32_t i = 0; i < pMetaMsg->numOfColumns; ++i) { - SSchema* pSchema = &pMetaMsg->pSchemas[i]; - tstrncpy(pFields[i].name, pSchema->name, tListLen(pFields[i].name)); - pFields[i].type = pSchema->type; - pFields[i].bytes = pSchema->bytes; - } - - pResInfo->fields = pFields; - } - - pResInfo->numOfCols = pMetaMsg->numOfColumns; - pRequest->body.showInfo.execId = showRsp.showId; - tFreeSShowRsp(&showRsp); - - // todo - if (pRequest->type == TDMT_VND_SHOW_TABLES) { - SShowReqInfo* pShowInfo = &pRequest->body.showInfo; - - int32_t index = pShowInfo->currentIndex; - SVgroupInfo* pInfo = taosArrayGet(pShowInfo->pArray, index); - pShowInfo->vgId = pInfo->vgId; - } - - tsem_post(&pRequest->body.rspSem); - return 0; -} - -int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code) { - SRequestObj *pRequest = param; - SReqResultInfo *pResInfo = &pRequest->body.resInfo; - taosMemoryFreeClear(pResInfo->pRspMsg); - - if (code != TSDB_CODE_SUCCESS) { - setErrno(pRequest, code); - tsem_post(&pRequest->body.rspSem); - return code; - } - - assert(pMsg->len >= sizeof(SRetrieveTableRsp)); - - SRetrieveTableRsp *pRetrieve = (SRetrieveTableRsp *) pMsg->pData; - pRetrieve->numOfRows = htonl(pRetrieve->numOfRows); - pRetrieve->precision = htons(pRetrieve->precision); - - pResInfo->pRspMsg = pMsg->pData; - pResInfo->numOfRows = pRetrieve->numOfRows; - pResInfo->pData = pRetrieve->data; - pResInfo->completed = pRetrieve->completed; - - pResInfo->current = 0; -// setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows); - - tscDebug("0x%"PRIx64" numOfRows:%d, complete:%d, qId:0x%"PRIx64, pRequest->self, pRetrieve->numOfRows, - pRetrieve->completed, pRequest->body.showInfo.execId); - - tsem_post(&pRequest->body.rspSem); - return 0; -} - -int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) { - SRequestObj* pRequest = param; - - SReqResultInfo* pResInfo = &pRequest->body.resInfo; - taosMemoryFreeClear(pResInfo->pRspMsg); - - if (code != TSDB_CODE_SUCCESS) { - setErrno(pRequest, code); - tsem_post(&pRequest->body.rspSem); - return code; - } - - assert(pMsg->len >= sizeof(SRetrieveTableRsp)); - - pResInfo->pRspMsg = pMsg->pData; - - SVShowTablesFetchRsp *pFetchRsp = (SVShowTablesFetchRsp *) pMsg->pData; - pFetchRsp->numOfRows = htonl(pFetchRsp->numOfRows); - pFetchRsp->precision = htons(pFetchRsp->precision); - - pResInfo->pRspMsg = pMsg->pData; - pResInfo->numOfRows = pFetchRsp->numOfRows; - pResInfo->pData = pFetchRsp->data; - - pResInfo->current = 0; -// setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows); - - tscDebug("0x%"PRIx64" numOfRows:%d, complete:%d, qId:0x%"PRIx64, pRequest->self, pFetchRsp->numOfRows, - pFetchRsp->completed, pRequest->body.showInfo.execId); - - tsem_post(&pRequest->body.rspSem); - return 0; -} - int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { // todo rsp with the vnode id list SRequestObj* pRequest = param; @@ -256,13 +119,14 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { if (usedbRsp.vgVersion >= 0) { int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (code != TSDB_CODE_SUCCESS) { - tscWarn("catalogGetHandle failed, clusterId:%"PRIx64", error:%s", pRequest->pTscObj->pAppInfo->clusterId, tstrerror(code)); + tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId, + tstrerror(code)); } else { catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid); } } - tFreeSUsedbRsp(&usedbRsp); + tFreeSUsedbRsp(&usedbRsp); } if (code != TSDB_CODE_SUCCESS) { @@ -276,7 +140,7 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp); SName name = {0}; - tNameFromString(&name, usedbRsp.db, T_NAME_ACCT|T_NAME_DB); + tNameFromString(&name, usedbRsp.db, T_NAME_ACCT | T_NAME_DB); SUseDbOutput output = {0}; code = queryBuildUseDbOutput(&output, &usedbRsp); @@ -288,11 +152,12 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { tscError("failed to build use db output since %s", terrstr()); } else { - struct SCatalog *pCatalog = NULL; - + struct SCatalog* pCatalog = NULL; + int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (code != TSDB_CODE_SUCCESS) { - tscWarn("catalogGetHandle failed, clusterId:%"PRIx64", error:%s", pRequest->pTscObj->pAppInfo->clusterId, tstrerror(code)); + tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId, + tstrerror(code)); } else { catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup); } @@ -420,13 +285,8 @@ void initMsgHandleFp() { #endif handleRequestRspFp[TMSG_INDEX(TDMT_MND_CONNECT)] = processConnectRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_MND_SHOW)] = processShowRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_MND_SHOW_RETRIEVE)] = processRetrieveMnodeRsp; handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_DB)] = processCreateDbRsp; handleRequestRspFp[TMSG_INDEX(TDMT_MND_USE_DB)] = processUseDbRsp; handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_STB)] = processCreateTableRsp; handleRequestRspFp[TMSG_INDEX(TDMT_MND_DROP_DB)] = processDropDbRsp; - - handleRequestRspFp[TMSG_INDEX(TDMT_VND_SHOW_TABLES)] = processShowRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_VND_SHOW_TABLES_FETCH)] = processRetrieveVndRsp; } diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 2b69b47865..478e328a16 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -357,7 +357,15 @@ tmq_t* tmq_consumer_new1(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { if (pTmq == NULL) { return NULL; } - pTmq->pTscObj = taos_connect(conf->ip, conf->user, conf->pass, conf->db, conf->port); + const char* user = conf->user == NULL ? TSDB_DEFAULT_USER : conf->user; + const char* pass = conf->pass == NULL ? TSDB_DEFAULT_PASS : conf->pass; + + ASSERT(user); + ASSERT(pass); + ASSERT(conf->db); + + pTmq->pTscObj = taos_connect_internal(conf->ip, user, pass, NULL, conf->db, conf->port, CONN_TYPE__TMQ); + if (pTmq->pTscObj == NULL) return NULL; pTmq->inWaiting = 0; pTmq->status = 0; @@ -783,7 +791,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { } } - struct tm* ptm = localtime(&tt); + struct tm* ptm = taosLocalTime(&tt, NULL); size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", ptm); if (precision == TSDB_TIME_PRECISION_NANO) { diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index fd2abbb559..f5d8d7ec67 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -675,8 +675,15 @@ TEST(testCase, agg_query_tables) { char str[512] = {0}; while ((pRow = taos_fetch_row(pRes)) != NULL) { + int32_t* length = taos_fetch_lengths(pRes); + for(int32_t i = 0; i < numOfFields; ++i) { + printf("(%d):%d " , i, length[i]); + } + printf("\n"); + int32_t code = taos_print_row(str, pRow, pFields, numOfFields); printf("%s\n", str); + memset(str, 0, sizeof(str)); } taos_free_result(pRes); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 053a1a1ee6..dad5805c66 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1368,7 +1368,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { } } - struct tm* ptm = localtime(&tt); + struct tm* ptm = taosLocalTime(&tt, NULL); size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", ptm); if (precision == TSDB_TIME_PRECISION_NANO) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 08010db1d8..4aeaec5051 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2182,7 +2182,7 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI64(&encoder, pReq->showId) < 0) return -1; if (tEncodeI32(&encoder, pReq->type) < 0) return -1; - if (tEncodeI8(&encoder, pReq->free) < 0) return -1; +// if (tEncodeI8(&encoder, pReq->free) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; if (tEncodeCStr(&encoder, pReq->tb) < 0) return -1; tEndEncode(&encoder); @@ -2199,7 +2199,7 @@ int32_t tDeserializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableR if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI64(&decoder, &pReq->showId) < 0) return -1; if (tDecodeI32(&decoder, &pReq->type) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->free) < 0) return -1; +// if (tDecodeI8(&decoder, &pReq->free) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->tb) < 0) return -1; tEndDecode(&decoder); @@ -2532,6 +2532,7 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER); if (tStartEncode(&encoder) < 0) return -1; + if (tEncodeI8(&encoder, pReq->connType) < 0) return -1; if (tEncodeI32(&encoder, pReq->pid) < 0) return -1; if (tEncodeCStr(&encoder, pReq->app) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; @@ -2548,6 +2549,7 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER); if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->connType) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pid) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->app) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; @@ -2567,6 +2569,7 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (tEncodeI64(&encoder, pRsp->clusterId) < 0) return -1; if (tEncodeI32(&encoder, pRsp->connId) < 0) return -1; if (tEncodeI8(&encoder, pRsp->superUser) < 0) return -1; + if (tEncodeI8(&encoder, pRsp->connType) < 0) return -1; if (tEncodeSEpSet(&encoder, &pRsp->epSet) < 0) return -1; if (tEncodeCStr(&encoder, pRsp->sVersion) < 0) return -1; tEndEncode(&encoder); @@ -2585,6 +2588,7 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->connId) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->superUser) < 0) return -1; + if (tDecodeI8(&decoder, &pRsp->connType) < 0) return -1; if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) return -1; if (tDecodeCStrTo(&decoder, pRsp->sVersion) < 0) return -1; tEndDecode(&decoder); diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 1baf393e9a..4686d856cc 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -70,7 +70,7 @@ void deltaToUtcInitOnce() { struct tm tm = {0}; (void)taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm); - m_deltaUtc = (int64_t)mktime(&tm); + m_deltaUtc = (int64_t)taosMktime(&tm); // printf("====delta:%lld\n\n", seconds); } @@ -344,7 +344,7 @@ int32_t parseLocaltimeDst(char* timestr, int64_t* time, int32_t timePrec) { } /* mktime will be affected by TZ, set by using taos_options */ - int64_t seconds = mktime(&tm); + int64_t seconds = taosMktime(&tm); int64_t fraction = 0; @@ -539,7 +539,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - return (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision)); + return (int64_t)(taosMktime(&tm) * TSDB_TICK_PER_SECOND(precision)); } int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision) { @@ -598,7 +598,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio tm.tm_mon = mon % 12; } - start = (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision)); + start = (int64_t)(taosMktime(&tm) * TSDB_TICK_PER_SECOND(precision)); } else { int64_t delta = t - pInterval->interval; int32_t factor = (delta >= 0) ? 1 : -1; @@ -745,7 +745,7 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) assert(false); } - ptm = localtime("); + ptm = taosLocalTime(", NULL); int32_t length = (int32_t)strftime(ts, 40, "%Y-%m-%dT%H:%M:%S", ptm); length += snprintf(ts + length, fractionLen, format, mod); length += (int32_t)strftime(ts + length, 40 - length, "%z", ptm); diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index 8fb4b02479..e002bbe444 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -24,13 +24,6 @@ target_include_directories( ) target_link_libraries(taosd dnode) -IF (TD_GRANT) - TARGET_LINK_LIBRARIES(taosd grant) -ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(taosd usb_dongle) -ENDIF () - if(${BUILD_TEST}) add_subdirectory(test) endif(${BUILD_TEST}) diff --git a/source/dnode/mgmt/exe/dndMain.c b/source/dnode/mgmt/exe/dndMain.c index 80c431fe36..ae2b734319 100644 --- a/source/dnode/mgmt/exe/dndMain.c +++ b/source/dnode/mgmt/exe/dndMain.c @@ -91,7 +91,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { } static void dndGenerateGrant() { - grantParseParameter(); + parseGrantParameter(); } static void dndPrintVersion() { diff --git a/source/dnode/mgmt/mm/mmHandle.c b/source/dnode/mgmt/mm/mmHandle.c index 63240c3224..c4b99c2bc9 100644 --- a/source/dnode/mgmt/mm/mmHandle.c +++ b/source/dnode/mgmt/mm/mmHandle.c @@ -164,7 +164,6 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) { dndSetMsgHandle(pWrapper, TDMT_MND_KILL_CONN, mmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_MND_HEARTBEAT, mmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_MND_SHOW, mmProcessReadMsg, DEFAULT_HANDLE); - dndSetMsgHandle(pWrapper, TDMT_MND_SHOW_RETRIEVE, mmProcessReadMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_MND_SYSTABLE_RETRIEVE, mmProcessReadMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_MND_STATUS, mmProcessReadMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_MND_KILL_TRANS, mmProcessWriteMsg, DEFAULT_HANDLE); diff --git a/source/dnode/mgmt/qm/qmHandle.c b/source/dnode/mgmt/qm/qmHandle.c index 4fda72759a..96fb4d20e4 100644 --- a/source/dnode/mgmt/qm/qmHandle.c +++ b/source/dnode/mgmt/qm/qmHandle.c @@ -95,5 +95,4 @@ void qmInitMsgHandle(SMgmtWrapper *pWrapper) { dndSetMsgHandle(pWrapper, TDMT_VND_TASKS_STATUS, qmProcessFetchMsg, QNODE_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_CANCEL_TASK, qmProcessFetchMsg, QNODE_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_DROP_TASK, qmProcessFetchMsg, QNODE_HANDLE); - dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES, qmProcessFetchMsg, QNODE_HANDLE); } diff --git a/source/dnode/mgmt/test/sut/src/sut.cpp b/source/dnode/mgmt/test/sut/src/sut.cpp index 14197153b4..01532e66f9 100644 --- a/source/dnode/mgmt/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/test/sut/src/sut.cpp @@ -133,17 +133,17 @@ const char* Testbase::GetMetaTbName() { return metaRsp.tbName; } void Testbase::SendShowRetrieveReq() { SRetrieveTableReq retrieveReq = {0}; retrieveReq.showId = showId; - retrieveReq.free = 0; +// retrieveReq.free = 0; int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq); void* pReq = rpcMallocCont(contLen); tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq); - SRpcMsg* pRsp = SendReq(TDMT_MND_SHOW_RETRIEVE, pReq, contLen); - pRetrieveRsp = (SRetrieveTableRsp*)pRsp->pCont; - pRetrieveRsp->numOfRows = htonl(pRetrieveRsp->numOfRows); - pRetrieveRsp->useconds = htobe64(pRetrieveRsp->useconds); - pRetrieveRsp->compLen = htonl(pRetrieveRsp->compLen); +// SRpcMsg* pRsp = SendReq(TDMT_MND_SHOW_RETRIEVE, pReq, contLen); +// pRetrieveRsp = (SRetrieveTableRsp*)pRsp->pCont; +// pRetrieveRsp->numOfRows = htonl(pRetrieveRsp->numOfRows); +// pRetrieveRsp->useconds = htobe64(pRetrieveRsp->useconds); +// pRetrieveRsp->compLen = htonl(pRetrieveRsp->compLen); pData = pRetrieveRsp->data; pos = 0; diff --git a/source/dnode/mgmt/vm/vmHandle.c b/source/dnode/mgmt/vm/vmHandle.c index 0e74ca656c..3623654218 100644 --- a/source/dnode/mgmt/vm/vmHandle.c +++ b/source/dnode/mgmt/vm/vmHandle.c @@ -335,8 +335,6 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) { dndSetMsgHandle(pWrapper, TDMT_VND_CREATE_SMA, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_CANCEL_SMA, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_DROP_SMA, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); - dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE); - dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES_FETCH, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CONN, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_REB, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_CANCEL_CONN, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 38dbdc4799..e827dd5131 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -385,14 +385,14 @@ typedef struct { int16_t numOfColumns; int32_t rowSize; int32_t numOfRows; - int32_t numOfReads; int32_t payloadLen; void* pIter; SMnode* pMnode; + STableMetaRsp* pMeta; + bool sysDbRsp; char db[TSDB_DB_FNAME_LEN]; int16_t offset[TSDB_MAX_COLUMNS]; int32_t bytes[TSDB_MAX_COLUMNS]; - char payload[]; } SShowObj; typedef struct { diff --git a/source/dnode/mnode/impl/inc/mndGrant.h b/source/dnode/mnode/impl/inc/mndGrant.h index ad3dc7f79d..a2ff5ea6ce 100644 --- a/source/dnode/mnode/impl/inc/mndGrant.h +++ b/source/dnode/mnode/impl/inc/mndGrant.h @@ -44,6 +44,7 @@ void grantReset(EGrantType grant, uint64_t value); void grantAdd(EGrantType grant, uint64_t value); void grantRestore(EGrantType grant, uint64_t value); +void parseGrantParameter(); #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index fa1502fe10..11c1b09cc9 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -41,8 +41,7 @@ extern "C" { typedef int32_t (*MndMsgFp)(SNodeMsg *pMsg); typedef int32_t (*MndInitFp)(SMnode *pMnode); typedef void (*MndCleanupFp)(SMnode *pMnode); -typedef int32_t (*ShowMetaFp)(SNodeMsg *pMsg, SShowObj *pShow, STableMetaRsp *pMeta); -typedef int32_t (*ShowRetrieveFp)(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows); +typedef int32_t (*ShowRetrieveFp)(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); typedef void (*ShowFreeIterFp)(SMnode *pMnode, void *pIter); typedef struct SMnodeLoad { @@ -98,7 +97,7 @@ typedef struct { int64_t timeseriesAllowed; } SGrantInfo; -typedef struct SMnode { +struct SMnode { int32_t selfId; int64_t clusterId; int8_t replica; @@ -122,7 +121,7 @@ typedef struct SMnode { SGrantInfo grant; MndMsgFp msgFp[TDMT_MAX]; SMsgCb msgCb; -} SMnode; +}; void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp); int64_t mndGenerateUid(char *name, int32_t len); diff --git a/source/dnode/mnode/impl/src/mndBnode.c b/source/dnode/mnode/impl/src/mndBnode.c index 86e2976516..f7c4a6c225 100644 --- a/source/dnode/mnode/impl/src/mndBnode.c +++ b/source/dnode/mnode/impl/src/mndBnode.c @@ -33,8 +33,7 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq); static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq); static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp); -static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); -static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextBnode(SMnode *pMnode, void *pIter); int32_t mndInitBnode(SMnode *pMnode) { @@ -438,39 +437,35 @@ static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp) { return 0; } -static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; int32_t cols = 0; SBnodeObj *pObj = NULL; - char *pWrite; while (numOfRows < rows) { pShow->pIter = sdbFetch(pSdb, SDB_BNODE, pShow->pIter, (void **)&pObj); if (pShow->pIter == NULL) break; cols = 0; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pObj->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pObj->id; - cols++; + char buf[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(buf, pObj->pDnode->ep, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, buf, false); - cols++; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pObj->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pObj->createdTime, false); numOfRows++; sdbRelease(pSdb, pObj); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 5a811ea490..57326b26ce 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -26,7 +26,7 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster); static int32_t mndClusterActionDelete(SSdb *pSdb, SClusterObj *pCluster); static int32_t mndClusterActionUpdate(SSdb *pSdb, SClusterObj *pOldCluster, SClusterObj *pNewCluster); static int32_t mndCreateDefaultCluster(SMnode *pMnode); -static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter); int32_t mndInitCluster(SMnode *pMnode) { @@ -178,12 +178,11 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) { return sdbWrite(pMnode->pSdb, pRaw); } -static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pMsg->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; int32_t cols = 0; - char *pWrite; SClusterObj *pCluster = NULL; while (numOfRows < rows) { @@ -191,25 +190,23 @@ static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, if (pShow->pIter == NULL) break; cols = 0; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pCluster->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pCluster->id; - cols++; + char buf[tListLen(pCluster->name) + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(buf, pCluster->name, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pCluster->name, TSDB_CLUSTER_ID_LEN); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, buf, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pCluster->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pCluster->createdTime, false); sdbRelease(pSdb, pCluster); numOfRows++; } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 1a865247b9..d2a3c38135 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -35,7 +35,7 @@ static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer); static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer); static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pConsumer, SMqConsumerObj *pNewConsumer); static int32_t mndProcessConsumerMetaMsg(SNodeMsg *pMsg); -static int32_t mndRetrieveConsumer(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveConsumer(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter); int32_t mndInitConsumer(SMnode *pMnode) { diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 49e9ccaba6..3db4e9870e 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -38,7 +38,7 @@ static int32_t mndProcessDropDbReq(SNodeMsg *pReq); static int32_t mndProcessUseDbReq(SNodeMsg *pReq); static int32_t mndProcessSyncDbReq(SNodeMsg *pReq); static int32_t mndProcessCompactDbReq(SNodeMsg *pReq); -static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rowsCapacity); static void mndCancelGetNextDb(SMnode *pMnode, void *pIter); static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq); static int32_t mndProcessGetIndexReq(SNodeMsg *pReq); @@ -1351,90 +1351,76 @@ char *mnGetDbStr(char *src) { return pos; } -static char *getDataPosition(char *pData, SShowObj *pShow, int32_t cols, int32_t rows, int32_t capacityOfRow) { - return pData + pShow->offset[cols] * capacityOfRow + pShow->bytes[cols] * rows; -} - -static void dumpDbInfoToPayload(char *data, SDbObj *pDb, SShowObj *pShow, int32_t rows, int32_t rowCapacity, - int64_t numOfTables) { +static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, int32_t rows, int64_t numOfTables) { int32_t cols = 0; - char *pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); + char* buf = taosMemoryMalloc(pShow->bytes[cols]); char *name = mnGetDbStr(pDb->name); if (name != NULL) { - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]); + STR_WITH_MAXSIZE_TO_VARSTR(buf, name, pShow->bytes[cols]); } else { - STR_TO_VARSTR(pWrite, "NULL"); +// STR_TO_VARSTR(pWrite, "NULL"); + ASSERT(0); } - cols++; - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int64_t *)pWrite = pDb->createdTime; - cols++; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, buf, false); + taosMemoryFree(buf); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int16_t *)pWrite = pDb->cfg.numOfVgroups; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->createdTime, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int64_t *)pWrite = numOfTables; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int16_t *)pWrite = pDb->cfg.replications; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&numOfTables, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int16_t *)pWrite = pDb->cfg.quorum; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.replications, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.daysPerFile; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.quorum, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.daysPerFile, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); char tmp[128] = {0}; + int32_t len = 0; if (pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep1 || pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep2) { - sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, pDb->cfg.daysToKeep0); + len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, pDb->cfg.daysToKeep0); } else { - sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2); + len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2); } - STR_WITH_SIZE_TO_VARSTR(pWrite, tmp, strlen(tmp)); - cols++; - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.cacheBlockSize; - cols++; + varDataSetLen(tmp, len); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)tmp, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.totalBlocks; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.cacheBlockSize, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.minRows; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.totalBlocks, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.maxRows; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.minRows, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int8_t *)pWrite = pDb->cfg.walLevel; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.fsyncPeriod; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int8_t *)pWrite = pDb->cfg.compression; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.fsyncPeriod, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int8_t *)pWrite = pDb->cfg.cacheLastRow; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.compression, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.cacheLastRow, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); char *prec = NULL; switch (pDb->cfg.precision) { case TSDB_TIME_PRECISION_MILLI: @@ -1450,28 +1436,31 @@ static void dumpDbInfoToPayload(char *data, SDbObj *pDb, SShowObj *pShow, int32_ prec = "none"; break; } - STR_WITH_SIZE_TO_VARSTR(pWrite, prec, 2); - cols++; - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int32_t *)pWrite = pDb->cfg.ttl; - cols++; + char t[10] = {0}; + STR_WITH_SIZE_TO_VARSTR(t, prec, 2); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)t, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int8_t *)pWrite = pDb->cfg.singleSTable; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.ttl, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int8_t *)pWrite = pDb->cfg.streamMode; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.singleSTable, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.streamMode, false); - pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); char *status = "ready"; - STR_WITH_SIZE_TO_VARSTR(pWrite, status, strlen(status)); - cols++; + char b[24] = {0}; + STR_WITH_SIZE_TO_VARSTR(b, status, strlen(status)); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)b, false); // pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); // *(int8_t *)pWrite = pDb->cfg.update; + } static void setInformationSchemaDbCfg(SDbObj *pDbObj) { @@ -1486,6 +1475,18 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) { pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI; } +static void setPerfSchemaDbCfg(SDbObj* pDbObj) { + ASSERT(pDbObj != NULL); + strncpy(pDbObj->name, TSDB_PERFORMANCE_SCHEMA_DB, tListLen(pDbObj->name)); + + pDbObj->createdTime = 0; + pDbObj->cfg.numOfVgroups = 0; + pDbObj->cfg.quorum = 1; + pDbObj->cfg.replications = 1; + pDbObj->cfg.update = 1; + pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI; +} + static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) { SVgObj *pVgroup = pObj; int32_t *numOfTables = p1; @@ -1494,12 +1495,28 @@ static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, v return true; } -static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rowsCapacity) { +static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rowsCapacity) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; SDbObj *pDb = NULL; + // Append the information_schema database into the result. + if (!pShow->sysDbRsp) { + SDbObj infoschemaDb = {0}; + setInformationSchemaDbCfg(&infoschemaDb); + dumpDbInfoData(pBlock, &infoschemaDb, pShow, numOfRows, 14); + + numOfRows += 1; + + SDbObj perfschemaDb = {0}; + setPerfSchemaDbCfg(&perfschemaDb); + dumpDbInfoData(pBlock, &perfschemaDb, pShow, numOfRows, 3); + + numOfRows += 1; + pShow->sysDbRsp = true; + } + while (numOfRows < rowsCapacity) { pShow->pIter = sdbFetch(pSdb, SDB_DB, pShow->pIter, (void **)&pDb); if (pShow->pIter == NULL) { @@ -1509,21 +1526,12 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 int32_t numOfTables = 0; sdbTraverse(pSdb, SDB_VGROUP, mndGetTablesOfDbFp, &numOfTables, NULL, NULL); - dumpDbInfoToPayload(data, pDb, pShow, numOfRows, rowsCapacity, numOfTables); + dumpDbInfoData(pBlock, pDb, pShow, numOfRows, numOfTables); numOfRows++; sdbRelease(pSdb, pDb); } - // Append the information_schema database into the result. - if (numOfRows < rowsCapacity) { - SDbObj dummyISDb = {0}; - setInformationSchemaDbCfg(&dummyISDb); - dumpDbInfoToPayload(data, &dummyISDb, pShow, numOfRows, rowsCapacity, 14); - numOfRows += 1; - } - - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rowsCapacity, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 86ec49127a..fc6ec86c49 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -56,9 +56,9 @@ static int32_t mndProcessConfigDnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessStatusReq(SNodeMsg *pReq); static int32_t mndGetConfigMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); -static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter); -static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter); int32_t mndInitDnode(SMnode *pMnode) { @@ -669,7 +669,7 @@ static int32_t mndGetConfigMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp * return 0; } -static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; int32_t totalRows = 0; int32_t numOfRows = 0; @@ -694,34 +694,36 @@ static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, i snprintf(cfgVals[totalRows], TSDB_CONIIG_VALUE_LEN, "%s", tsCharset); totalRows++; + char buf[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0}; + char bufVal[TSDB_CONIIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0}; + for (int32_t i = 0; i < totalRows; i++) { cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfgOpts[i], TSDB_CONFIG_OPTION_LEN); - cols++; + STR_WITH_MAXSIZE_TO_VARSTR(buf, cfgOpts[i], TSDB_CONFIG_OPTION_LEN); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfgVals[i], TSDB_CONIIG_VALUE_LEN); - cols++; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) buf, false); + + STR_WITH_MAXSIZE_TO_VARSTR(bufVal, cfgVals[i], TSDB_CONIIG_VALUE_LEN); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) bufVal, false); numOfRows++; } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter) {} -static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; int32_t cols = 0; SDnodeObj *pDnode = NULL; - char *pWrite; int64_t curMs = taosGetTimestampMs(); while (numOfRows < rows) { @@ -731,40 +733,42 @@ static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pDnode->id; - cols++; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pDnode->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->ep, pShow->bytes[cols]); - cols++; + char buf[tListLen(pDnode->ep) + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(buf, pDnode->ep, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = mndGetVnodesNum(pMnode, pDnode->id); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, buf, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pDnode->numOfSupportVnodes; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + int16_t id = mndGetVnodesNum(pMnode, pDnode->id); + colDataAppend(pColInfo, numOfRows, (const char*) &id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, online ? "ready" : "offline"); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pDnode->numOfSupportVnodes, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pDnode->createdTime; - cols++; + char b1[9] = {0}; + STR_TO_VARSTR(b1, online? "ready":"offline"); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, online ? "" : offlineReason[pDnode->offlineReason]); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, b1, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pDnode->createdTime, false); + + char b[tListLen(offlineReason) + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, b, false); numOfRows++; sdbRelease(pSdb, pDnode); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index 842e74197b..a18afbea73 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -34,8 +34,7 @@ static int32_t mndDropFunc(SMnode *pMnode, SNodeMsg *pReq, SFuncObj *pFunc); static int32_t mndProcessCreateFuncReq(SNodeMsg *pReq); static int32_t mndProcessDropFuncReq(SNodeMsg *pReq); static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq); -static int32_t mndGetFuncMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); -static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextFunc(SMnode *pMnode, void *pIter); int32_t mndInitFunc(SMnode *pMnode) { @@ -462,70 +461,6 @@ RETRIEVE_FUNC_OVER: return code; } -static int32_t mndGetFuncMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) { - SMnode *pMnode = pReq->pNode; - SSdb *pSdb = pMnode->pSdb; - - int32_t cols = 0; - SSchema *pSchema = pMeta->pSchemas; - - pShow->bytes[cols] = TSDB_FUNC_NAME_LEN + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "name"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = PATH_MAX + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "comment"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 4; - pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "aggregate"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = TSDB_TYPE_STR_MAX_LEN + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "outputtype"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 8; - pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; - strcpy(pSchema[cols].name, "create_time"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 4; - pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "code_len"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 4; - pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "bufsize"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pMeta->numOfColumns = cols; - pShow->numOfColumns = cols; - - pShow->offset[0] = 0; - for (int32_t i = 1; i < cols; ++i) { - pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1]; - } - - pShow->numOfRows = sdbGetSize(pSdb, SDB_FUNC); - pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; - strcpy(pMeta->tbName, mndShowStr(pShow->type)); - - return 0; -} - static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int16_t len) { char *msg = "unknown"; if (type >= sizeof(tDataTypes) / sizeof(tDataTypes[0])) { @@ -544,13 +479,12 @@ static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int16_t le return tDataTypes[type].name; } -static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; SFuncObj *pFunc = NULL; int32_t cols = 0; - char *pWrite; char buf[TSDB_TYPE_STR_MAX_LEN]; while (numOfRows < rows) { @@ -559,41 +493,43 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, char *data, int cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pFunc->name, pShow->bytes[cols]); - cols++; + char b1[tListLen(pFunc->name) + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(b1, pFunc->name, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pFunc->pComment, pShow->bytes[cols]); - cols++; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) b1, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pFunc->funcType == TSDB_FUNC_TYPE_AGGREGATE ? 1 : 0; - cols++; + char* b2 = taosMemoryCalloc(1, pShow->bytes[cols]); + STR_WITH_MAXSIZE_TO_VARSTR(b2, pFunc->pComment, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, mnodeGenTypeStr(buf, TSDB_TYPE_STR_MAX_LEN, pFunc->outputType, pFunc->outputLen), - pShow->bytes[cols]); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) b2, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pFunc->createdTime; - cols++; + int32_t isAgg = (pFunc->funcType == TSDB_FUNC_TYPE_AGGREGATE) ? 1 : 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pFunc->codeSize; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &isAgg, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pFunc->bufSize; - cols++; + char b3[TSDB_TYPE_STR_MAX_LEN] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(b3, mnodeGenTypeStr(buf, TSDB_TYPE_STR_MAX_LEN, pFunc->outputType, pFunc->outputLen), pShow->bytes[cols]); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) b3, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pFunc->createdTime, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pFunc->codeSize, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pFunc->bufSize, false); numOfRows++; sdbRelease(pSdb, pFunc); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 37f87142e6..15aa55ef83 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -14,12 +14,13 @@ */ #define _DEFAULT_SOURCE -#ifndef _GRANT #include "os.h" #include "taoserror.h" #include "mndGrant.h" #include "mndInt.h" +#ifndef _GRANT + int32_t mndInitGrant(SMnode *pMnode) { return TSDB_CODE_SUCCESS; } void mndCleanupGrant() {} void grantParseParameter() { mError("can't parsed parameter k"); } @@ -28,4 +29,6 @@ void grantReset(EGrantType grant, uint64_t value) {} void grantAdd(EGrantType grant, uint64_t value) {} void grantRestore(EGrantType grant, uint64_t value) {} -#endif \ No newline at end of file +#endif + +void parseGrantParameter() { grantParseParameter(); } \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index d60e7f5cf9..b210ee0d4f 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -23,54 +23,54 @@ //!!!! Note: only APPEND columns in below tables, NO insert !!!! static const SInfosTableSchema dnodesSchema[] = { {.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, - {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, - {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableSchema mnodesSchema[] = { {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "role_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, }; static const SInfosTableSchema modulesSchema[] = { {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableSchema qnodesSchema[] = { {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, }; static const SInfosTableSchema snodesSchema[] = { {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, }; static const SInfosTableSchema bnodesSchema[] = { {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, }; static const SInfosTableSchema clusterSchema[] = { {.name = "id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, - {.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, }; static const SInfosTableSchema userDBSchema[] = { - {.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "vgroups", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, - {.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, - {.name = "quorum", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, + {.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_TINYINT}, + {.name = "quorum", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "days", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "cache", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, @@ -79,61 +79,61 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, - {.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "stream_mode", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, - {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, // {.name = "update", .bytes = 1, .type = // TSDB_DATA_TYPE_TINYINT}, // disable update }; static const SInfosTableSchema userFuncSchema[] = { - {.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableSchema userIdxSchema[] = { - {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "index_database", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "index_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "column_name", .bytes = SYSTABLE_SCH_COL_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "index_database", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "index_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "column_name", .bytes = SYSTABLE_SCH_COL_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableSchema userStbsSchema[] = { - {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "tags", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_INT}, + {.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableSchema userStreamsSchema[] = { - {.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableSchema userTblsSchema[] = { - {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "uid", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "table_comment", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, }; static const SInfosTableSchema userTblDistSchema[] = { - {.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "max_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "avg_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, @@ -146,23 +146,39 @@ static const SInfosTableSchema userTblDistSchema[] = { {.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, }; static const SInfosTableSchema userUsersSchema[] = { - {.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, +}; +static const SInfosTableSchema grantsSchema[] = { + {.name = "version", .bytes = 8 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "expire time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "storage(GB)", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "cpu cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "speed(PPS)", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, }; static const SInfosTableSchema vgroupsSchema[] = { {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "onlines", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "v1_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "v1_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "v1_status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "v2_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "v2_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "v2_status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "v3_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "v3_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "v3_status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "compacting", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "nfiles", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, @@ -170,16 +186,16 @@ static const SInfosTableSchema vgroupsSchema[] = { // TODO put into perf schema static const SInfosTableSchema topicSchema[] = { - {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "row_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, }; static const SInfosTableSchema consumerSchema[] = { - {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "status", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, // ep @@ -188,10 +204,10 @@ static const SInfosTableSchema consumerSchema[] = { }; static const SInfosTableSchema subscribeSchema[] = { - {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, - {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, }; static const SInfosTableMeta infosMeta[] = { @@ -211,6 +227,7 @@ static const SInfosTableMeta infosMeta[] = { {TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)}, {TSDB_INS_TABLE_USER_USERS, userUsersSchema, tListLen(userUsersSchema)}, {TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)}, + {TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema)}, }; // connection/application/ @@ -286,7 +303,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char * } int32_t mndInitInfos(SMnode *pMnode) { - pMnode->infosMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + pMnode->infosMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK); if (pMnode->infosMeta == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 8c75a737a2..6be7097e6a 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -35,7 +35,7 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq); static int32_t mndProcessCreateMnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessAlterMnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessDropMnodeRsp(SNodeMsg *pRsp); -static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextMnode(SMnode *pMnode, void *pIter); int32_t mndInitMnode(SMnode *pMnode) { @@ -615,7 +615,7 @@ static int32_t mndProcessDropMnodeRsp(SNodeMsg *pRsp) { return 0; } -static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; @@ -628,35 +628,33 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in if (pShow->pIter == NULL) break; cols = 0; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) &pObj->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pObj->id; - cols++; + char b1[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(b1, pObj->pDnode->ep, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, b1, false); - cols++; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; const char *roles = mndGetRoleStr(pObj->role); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, roles, pShow->bytes[cols]); - cols++; + char* b2 = taosMemoryCalloc(1, strlen(roles) + VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(b2, roles, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pObj->roleTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) b2, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pObj->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pObj->roleTime, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); numOfRows++; sdbRelease(pSdb, pObj); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 320671c332..556e17ad2d 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -23,13 +23,14 @@ #include "tglobal.h" #include "version.h" -#define QUERY_ID_SIZE 20 -#define QUERY_OBJ_ID_SIZE 18 +#define QUERY_ID_SIZE 20 +#define QUERY_OBJ_ID_SIZE 18 #define SUBQUERY_INFO_SIZE 6 -#define QUERY_SAVE_SIZE 20 +#define QUERY_SAVE_SIZE 20 typedef struct { int32_t id; + int8_t connType; char user[TSDB_USER_LEN]; char app[TSDB_APP_NAME_LEN]; // app name that invokes taosc int64_t appStartTimeMs; // app start time @@ -44,8 +45,8 @@ typedef struct { SQueryDesc *pQueries; } SConnObj; -static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, uint16_t port, int32_t pid, - const char *app, int64_t startTime); +static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType, uint32_t ip, uint16_t port, + int32_t pid, const char *app, int64_t startTime); static void mndFreeConn(SConnObj *pConn); static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId); static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn); @@ -77,9 +78,9 @@ int32_t mndInitProfile(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_KILL_QUERY, mndProcessKillQueryReq); mndSetMsgHandle(pMnode, TDMT_MND_KILL_CONN, mndProcessKillConnReq); - mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns); +// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndCancelGetNextConn); - mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries); +// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndCancelGetNextQuery); return 0; @@ -93,8 +94,8 @@ void mndCleanupProfile(SMnode *pMnode) { } } -static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, uint16_t port, int32_t pid, - const char *app, int64_t startTime) { +static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType, uint32_t ip, uint16_t port, + int32_t pid, const char *app, int64_t startTime) { SProfileMgmt *pMgmt = &pMnode->profileMgmt; int32_t connId = atomic_add_fetch_32(&pMgmt->connId, 1); @@ -102,6 +103,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, ui if (startTime == 0) startTime = taosGetTimestampMs(); SConnObj connObj = {.id = connId, + .connType = connType, .appStartTimeMs = startTime, .pid = pid, .ip = ip, @@ -159,8 +161,8 @@ static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn) { } void *mndGetNextConn(SMnode *pMnode, SCacheIter *pIter) { - SConnObj* pConn = NULL; - bool hasNext = taosCacheIterNext(pIter); + SConnObj *pConn = NULL; + bool hasNext = taosCacheIterNext(pIter); if (hasNext) { size_t dataLen = 0; pConn = taosCacheIterGetData(pIter, &dataLen); @@ -210,8 +212,8 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { } } - pConn = - mndCreateConn(pMnode, pReq->user, pReq->clientIp, pReq->clientPort, connReq.pid, connReq.app, connReq.startTime); + pConn = mndCreateConn(pMnode, pReq->user, connReq.connType, pReq->clientIp, pReq->clientPort, connReq.pid, + connReq.app, connReq.startTime); if (pConn == NULL) { mError("user:%s, failed to login from %s while create connection since %s", pReq->user, ip, terrstr()); goto CONN_OVER; @@ -222,6 +224,7 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { connectRsp.superUser = pUser->superUser; connectRsp.clusterId = pMnode->clusterId; connectRsp.connId = pConn->id; + connectRsp.connType = connReq.connType; snprintf(connectRsp.sVersion, sizeof(connectRsp.sVersion), "ver:%s\nbuild:%s\ngitinfo:%s", version, buildinfo, gitinfo); @@ -343,7 +346,6 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { return -1; } - SClientHbBatchRsp batchRsp = {0}; batchRsp.rsps = taosArrayInit(0, sizeof(SClientHbRsp)); @@ -685,7 +687,7 @@ static int32_t mndRetrieveConns(SNodeMsg *pReq, SShowObj *pShow, char *data, int numOfRows++; } - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } @@ -903,8 +905,7 @@ static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, i } } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } @@ -917,4 +918,4 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter) { int32_t mndGetNumOfConnections(SMnode *pMnode) { SProfileMgmt *pMgmt = &pMnode->profileMgmt; return taosCacheGetNumOfObj(pMgmt->cache); -} \ No newline at end of file +} diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 3f8c7e88f9..3b622795cb 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -34,7 +34,7 @@ static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq); static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessQnodeListReq(SNodeMsg *pReq); -static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter); int32_t mndInitQnode(SMnode *pMnode) { @@ -497,7 +497,7 @@ static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp) { return 0; } -static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; @@ -510,26 +510,22 @@ static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in if (pShow->pIter == NULL) break; cols = 0; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*)&pObj->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pObj->id; - cols++; + char ep[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(ep, pObj->pDnode->ep, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)ep, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]); - - cols++; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pObj->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); numOfRows++; sdbRelease(pSdb, pObj); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 03e6049d82..d9f4f142df 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -60,7 +60,6 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SShowReq *pReq) { showObj.type = pReq->type; showObj.payloadLen = pReq->payloadLen; memcpy(showObj.db, pReq->db, TSDB_DB_FNAME_LEN); - memcpy(showObj.payload, pReq->payload, pReq->payloadLen); int32_t keepTime = tsShellActivityTimer * 6 * 1000; SShowObj *pShow = taosCachePut(pMgmt->cache, &showId, sizeof(int64_t), &showObj, size, keepTime); @@ -113,95 +112,10 @@ static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) { taosCacheRelease(pMgmt->cache, (void **)(&pShow), forceRemove); } -static int32_t mndProcessRetrieveReq(SNodeMsg *pReq) { - SMnode *pMnode = pReq->pNode; - SShowMgmt *pMgmt = &pMnode->showMgmt; - int32_t rowsToRead = 0; - int32_t size = 0; - int32_t rowsRead = 0; - - SRetrieveTableReq retrieveReq = {0}; - if (tDeserializeSRetrieveTableReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &retrieveReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - return -1; - } - - SShowObj *pShow = mndAcquireShowObj(pMnode, retrieveReq.showId); - if (pShow == NULL) { - terrno = TSDB_CODE_MND_INVALID_SHOWOBJ; - mError("failed to process show-retrieve req:%p since %s", pShow, terrstr()); - return -1; - } - - ShowRetrieveFp retrieveFp = pMgmt->retrieveFps[pShow->type]; - if (retrieveFp == NULL) { - mndReleaseShowObj(pShow, false); - terrno = TSDB_CODE_MSG_NOT_PROCESSED; - mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, terrstr()); - return -1; - } - - mDebug("show:0x%" PRIx64 ", start retrieve data, numOfReads:%d numOfRows:%d type:%s", pShow->id, pShow->numOfReads, - pShow->numOfRows, mndShowStr(pShow->type)); - - if (mndCheckRetrieveFinished(pShow)) { - mDebug("show:0x%" PRIx64 ", read finished, numOfReads:%d numOfRows:%d", pShow->id, pShow->numOfReads, - pShow->numOfRows); - pShow->numOfReads = pShow->numOfRows; - } - - if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { - rowsToRead = pShow->numOfRows - pShow->numOfReads; - } - - /* return no more than 100 tables in one round trip */ - if (rowsToRead > SHOW_STEP_SIZE) rowsToRead = SHOW_STEP_SIZE; - - /* - * the actual number of table may be larger than the value of pShow->numOfRows, if a query is - * issued during a continuous create table operation. Therefore, rowToRead may be less than 0. - */ - if (rowsToRead < 0) rowsToRead = 0; - size = pShow->rowSize * rowsToRead; - - size += SHOW_STEP_SIZE; - SRetrieveTableRsp *pRsp = rpcMallocCont(size); - if (pRsp == NULL) { - mndReleaseShowObj(pShow, false); - terrno = TSDB_CODE_OUT_OF_MEMORY; - mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, terrstr()); - return -1; - } - - // if free flag is set, client wants to clean the resources - if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { - rowsRead = (*retrieveFp)(pReq, pShow, pRsp->data, rowsToRead); - } - - mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d rowsToRead:%d", pShow->id, rowsRead, rowsToRead); - - pRsp->numOfRows = htonl(rowsRead); - pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision - - pReq->pRsp = pRsp; - pReq->rspLen = size; - - if (rowsRead == 0 || rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) { - pRsp->completed = 1; - mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id); - mndReleaseShowObj(pShow, true); - } else { - mDebug("show:0x%" PRIx64 ", retrieve not completed yet", pShow->id); - mndReleaseShowObj(pShow, false); - } - - return TSDB_CODE_SUCCESS; -} - static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { SMnode *pMnode = pReq->pNode; SShowMgmt *pMgmt = &pMnode->showMgmt; - int32_t rowsToRead = 0; + int32_t rowsToRead = SHOW_STEP_SIZE; int32_t size = 0; int32_t rowsRead = 0; @@ -225,15 +139,14 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { return -1; } - STableMetaRsp *meta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb)); - pShow->numOfRows = 100; - + pShow->pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb)); + pShow->numOfColumns = pShow->pMeta->numOfColumns; int32_t offset = 0; - for(int32_t i = 0; i < meta->numOfColumns; ++i) { - pShow->numOfColumns = meta->numOfColumns; + + for(int32_t i = 0; i < pShow->pMeta->numOfColumns; ++i) { pShow->offset[i] = offset; - int32_t bytes = meta->pSchemas[i].bytes; + int32_t bytes = pShow->pMeta->pSchemas[i].bytes; pShow->rowSize += bytes; pShow->bytes[i] = bytes; offset += bytes; @@ -245,8 +158,6 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { mError("failed to process show-retrieve req:%p since %s", pShow, terrstr()); return -1; } - - pShow->numOfReads = 0; } ShowRetrieveFp retrieveFp = pMgmt->retrieveFps[pShow->type]; @@ -257,61 +168,87 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { return -1; } - mDebug("show:0x%" PRIx64 ", start retrieve data, numOfReads:%d numOfRows:%d type:%s", pShow->id, pShow->numOfReads, - pShow->numOfRows, mndShowStr(pShow->type)); + mDebug("show:0x%" PRIx64 ", start retrieve data, type:%s", pShow->id, mndShowStr(pShow->type)); + int32_t numOfCols = pShow->pMeta->numOfColumns; + + SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); + pBlock->pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); + pBlock->info.numOfCols = numOfCols; + + for(int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData idata = {0}; + SSchema* p = &pShow->pMeta->pSchemas[i]; + + idata.info.bytes = p->bytes; + idata.info.type = p->type; + idata.info.colId = p->colId; + + taosArrayPush(pBlock->pDataBlock, &idata); + if (IS_VAR_DATA_TYPE(p->type)) { + pBlock->info.hasVarCol = true; + } + } + + blockDataEnsureCapacity(pBlock, rowsToRead); if (mndCheckRetrieveFinished((SShowObj*) pShow)) { - mDebug("show:0x%" PRIx64 ", read finished, numOfReads:%d numOfRows:%d", pShow->id, pShow->numOfReads, - pShow->numOfRows); - pShow->numOfReads = pShow->numOfRows; + mDebug("show:0x%" PRIx64 ", read finished, numOfRows:%d", pShow->id, pShow->numOfRows); + rowsRead = 0; + } else { + rowsRead = (*retrieveFp)(pReq, (SShowObj *)pShow, pBlock, rowsToRead); + if (rowsRead < 0) { + terrno = rowsRead; + mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id); + mndReleaseShowObj((SShowObj *)pShow, true); + return -1; + } + + pBlock->info.rows = rowsRead; + mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d numOfRows:%d", pShow->id, rowsRead, pShow->numOfRows); } - if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { - rowsToRead = pShow->numOfRows - pShow->numOfReads; - } + // numOfCols + sizeof(SSysTableSchema) * numOfCols + data payload + size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + blockDataGetSize(pBlock) + + blockDataGetSerialMetaSize(pBlock); - /* return no more than 100 tables in one round trip */ - if (rowsToRead > SHOW_STEP_SIZE) rowsToRead = SHOW_STEP_SIZE; - - /* - * the actual number of table may be larger than the value of pShow->numOfRows, if a query is - * issued during a continuous create table operation. Therefore, rowToRead may be less than 0. - */ - if (rowsToRead < 0) rowsToRead = 0; - size = pShow->rowSize * rowsToRead; - - size += SHOW_STEP_SIZE; SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size); if (pRsp == NULL) { mndReleaseShowObj((SShowObj*) pShow, false); terrno = TSDB_CODE_OUT_OF_MEMORY; mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, terrstr()); + blockDataDestroy(pBlock); return -1; } pRsp->handle = htobe64(pShow->id); // if free flag is set, client wants to clean the resources - if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { - rowsRead = (*retrieveFp)(pReq, (SShowObj*) pShow, pRsp->data, rowsToRead); - if (rowsRead < 0) { - terrno = rowsRead; - rpcFreeCont(pRsp); - mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id); - mndReleaseShowObj((SShowObj*) pShow, true); - return -1; - } - } + if (rowsRead > 0) { + char * pStart = pRsp->data; + SSchema *ps = pShow->pMeta->pSchemas; - mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d rowsToRead:%d", pShow->id, rowsRead, rowsToRead); + *(int32_t *)pStart = htonl(pShow->pMeta->numOfColumns); + pStart += sizeof(int32_t); // number of columns + + for (int32_t i = 0; i < pShow->pMeta->numOfColumns; ++i) { + SSysTableSchema *pSchema = (SSysTableSchema *)pStart; + pSchema->bytes = htonl(ps[i].bytes); + pSchema->colId = htons(ps[i].colId); + pSchema->type = ps[i].type; + + pStart += sizeof(SSysTableSchema); + } + + int32_t len = 0; + blockCompressEncode(pBlock, pStart, &len, pShow->pMeta->numOfColumns, false); + } pRsp->numOfRows = htonl(rowsRead); pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision + pReq->pRsp = pRsp; + pReq->rspLen = size; - pReq->pRsp = pRsp; - pReq->rspLen = size; - - if (rowsRead == 0 || rowsToRead == 0 || (rowsRead < rowsToRead)) { + if (rowsRead == 0 || rowsRead < rowsToRead) { pRsp->completed = 1; mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id); mndReleaseShowObj((SShowObj*) pShow, true); @@ -320,6 +257,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { mndReleaseShowObj((SShowObj*) pShow, false); } + blockDataDestroy(pBlock); return TSDB_CODE_SUCCESS; } @@ -379,7 +317,7 @@ char *mndShowStr(int32_t showType) { } static bool mndCheckRetrieveFinished(SShowObj *pShow) { - if (pShow->pIter == NULL && pShow->numOfReads != 0) { + if (pShow->pIter == NULL && pShow->numOfRows != 0) { return true; } return false; diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index f56c72d93e..70e41a73b7 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -40,8 +40,7 @@ static int32_t mndProcessMCreateSmaReq(SNodeMsg *pReq); static int32_t mndProcessMDropSmaReq(SNodeMsg *pReq); static int32_t mndProcessVCreateSmaRsp(SNodeMsg *pRsp); static int32_t mndProcessVDropSmaRsp(SNodeMsg *pRsp); -static int32_t mndGetSmaMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); -static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextSma(SMnode *pMnode, void *pIter); int32_t mndInitSma(SMnode *pMnode) { @@ -765,14 +764,12 @@ static int32_t mndGetSmaMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMe return 0; } -static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; SSmaObj *pSma = NULL; int32_t cols = 0; - char *pWrite; - char prefix[TSDB_DB_FNAME_LEN] = {0}; SDbObj *pDb = mndAcquireDb(pMnode, pShow->db); if (pDb == NULL) return 0; @@ -790,27 +787,32 @@ static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 SName smaName = {0}; tNameFromString(&smaName, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, (char *)tNameGetTableName(&smaName)); - cols++; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pSma->createdTime; + char n[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(n, (char *)tNameGetTableName(&smaName)); cols++; SName stbName = {0}; tNameFromString(&stbName, pSma->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, (char *)tNameGetTableName(&stbName)); - cols++; + + char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(n1, (char *)tNameGetTableName(&stbName)); + + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) n, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pSma->createdTime, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)n1, false); numOfRows++; sdbRelease(pSdb, pSma); } mndReleaseDb(pMnode, pDb); - pShow->numOfReads += numOfRows; - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index cc25e523c1..686cf1400d 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -33,7 +33,7 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq); static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq); static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp); -static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextSnode(SMnode *pMnode, void *pIter); int32_t mndInitSnode(SMnode *pMnode) { @@ -447,39 +447,35 @@ static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp) { return 0; } -static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; int32_t cols = 0; SSnodeObj *pObj = NULL; - char *pWrite; while (numOfRows < rows) { pShow->pIter = sdbFetch(pSdb, SDB_SNODE, pShow->pIter, (void **)&pObj); if (pShow->pIter == NULL) break; cols = 0; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*)&pObj->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pObj->id; - cols++; + char ep[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(ep, pObj->pDnode->ep, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)ep, false); - cols++; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pObj->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); numOfRows++; sdbRelease(pSdb, pObj); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index afcea6e732..92a67fd7e9 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -39,7 +39,7 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp); static int32_t mndProcessVAlterStbRsp(SNodeMsg *pRsp); static int32_t mndProcessVDropStbRsp(SNodeMsg *pRsp); static int32_t mndProcessTableMetaReq(SNodeMsg *pReq); -static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextStb(SMnode *pMnode, void *pIter); int32_t mndInitStb(SMnode *pMnode) { @@ -1638,13 +1638,12 @@ static void mndExtractTableName(char *tableId, char *name) { } } -static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; SStbObj *pStb = NULL; int32_t cols = 0; - char *pWrite; SDbObj* pDb = NULL; if (strlen(pShow->db) > 0) { @@ -1664,42 +1663,45 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 cols = 0; SName name = {0}; - char stbName[TSDB_TABLE_NAME_LEN] = {0}; - mndExtractTableName(pStb->name, stbName); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, stbName); - cols++; + char stbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + mndExtractTableName(pStb->name, &stbName[VARSTR_HEADER_SIZE]); + varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE])); - char db[TSDB_DB_NAME_LEN] = {0}; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) stbName, false); + + char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; tNameFromString(&name, pStb->db, T_NAME_ACCT|T_NAME_DB); - tNameGetDbName(&name, db); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, db); - cols++; + tNameGetDbName(&name, varDataVal(db)); + varDataSetLen(db, strlen(varDataVal(db))); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pStb->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char*) db, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pStb->numOfColumns; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pStb->createdTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pStb->numOfTags; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pStb->numOfColumns, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pStb->updateTime; // number of tables - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pStb->numOfTags, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - if (pStb->commentLen != 0) { - STR_TO_VARSTR(pWrite, pStb->comment); - } else { - STR_TO_VARSTR(pWrite, ""); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pStb->updateTime, false); // number of tables + + char* p = taosMemoryMalloc(pStb->commentLen + VARSTR_HEADER_SIZE); // check malloc failures + if (p != NULL) { + if (pStb->commentLen != 0) { + STR_TO_VARSTR(p, pStb->comment); + } else { + STR_TO_VARSTR(p, ""); + } + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); + colDataAppend(pColInfo, numOfRows, (const char *)p, false); + taosMemoryFree(p); } - cols++; numOfRows++; sdbRelease(pSdb, pStb); @@ -1709,8 +1711,7 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 mndReleaseDb(pMnode, pDb); } - pShow->numOfReads += numOfRows; - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 4411db97a5..a7285162fa 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -58,7 +58,7 @@ int32_t mndInitStream(SMnode *pMnode) { /*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);*/ /*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM_RSP, mndProcessDropStreamInRsp);*/ - mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveStream); +// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveStream); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TP, mndCancelGetNextStream); return sdbSetTable(pMnode->pSdb, table); @@ -515,8 +515,7 @@ static int32_t mndRetrieveStream(SNodeMsg *pReq, SShowObj *pShow, char *data, in } mndReleaseDb(pMnode, pDb); - pShow->numOfReads += numOfRows; - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 4d7f00c24c..65a304e951 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -35,7 +35,6 @@ static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pTopic, SMqTopicObj static int32_t mndProcessCreateTopicReq(SNodeMsg *pReq); static int32_t mndProcessDropTopicReq(SNodeMsg *pReq); static int32_t mndProcessDropTopicInRsp(SNodeMsg *pRsp); -static int32_t mndProcessTopicMetaReq(SNodeMsg *pReq); static int32_t mndGetTopicMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); static int32_t mndRetrieveTopic(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); static void mndCancelGetNextTopic(SMnode *pMnode, void *pIter); @@ -53,7 +52,7 @@ int32_t mndInitTopic(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_DROP_TOPIC, mndProcessDropTopicReq); mndSetMsgHandle(pMnode, TDMT_VND_DROP_TOPIC_RSP, mndProcessDropTopicInRsp); - mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveTopic); +// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveTopic); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TP, mndCancelGetNextTopic); return sdbSetTable(pMnode->pSdb, table); @@ -595,8 +594,7 @@ static int32_t mndRetrieveTopic(SNodeMsg *pReq, SShowObj *pShow, char *data, int } mndReleaseDb(pMnode, pDb); - pShow->numOfReads += numOfRows; - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index cfaaa304a9..e1bf4b1b7d 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -74,7 +74,7 @@ int32_t mndInitTrans(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransReq); mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq); - mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); +// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans); return sdbSetTable(pMnode->pSdb, table); } @@ -1370,8 +1370,7 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int sdbRelease(pSdb, pTrans); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 6e1aae64ab..054bff466c 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -35,8 +35,7 @@ static int32_t mndProcessCreateUserReq(SNodeMsg *pReq); static int32_t mndProcessAlterUserReq(SNodeMsg *pReq); static int32_t mndProcessDropUserReq(SNodeMsg *pReq); static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq); -static int32_t mndGetUserMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); -static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextUser(SMnode *pMnode, void *pIter); int32_t mndInitUser(SMnode *pMnode) { @@ -640,53 +639,7 @@ GET_AUTH_OVER: return code; } -static int32_t mndGetUserMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) { - SMnode *pMnode = pReq->pNode; - SSdb *pSdb = pMnode->pSdb; - - int32_t cols = 0; - SSchema *pSchema = pMeta->pSchemas; - - pShow->bytes[cols] = TSDB_USER_LEN + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "name"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 10 + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "privilege"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 8; - pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; - strcpy(pSchema[cols].name, "create_time"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = TSDB_USER_LEN + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "account"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pMeta->numOfColumns = cols; - pShow->numOfColumns = cols; - - pShow->offset[0] = 0; - for (int32_t i = 1; i < cols; ++i) { - pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1]; - } - - pShow->numOfRows = sdbGetSize(pSdb, SDB_USER); - pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; - strcpy(pMeta->tbName, mndShowStr(pShow->type)); - - return 0; -} - -static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; @@ -699,35 +652,35 @@ static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, char *data, int if (pShow->pIter == NULL) break; cols = 0; + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, pShow->bytes[cols]); - cols++; + char name[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(name, pUser->user, pShow->bytes[cols]); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - if (pUser->superUser) { - const char *src = "super"; - STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); - } else { - const char *src = "normal"; - STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); - } - cols++; + colDataAppend(pColInfo, numOfRows, (const char*) name, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pUser->createdTime; cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); + + const char* src = pUser->superUser? "super":"normal"; + char b[10+VARSTR_HEADER_SIZE] = {0}; + STR_WITH_SIZE_TO_VARSTR(b, src, strlen(src)); + colDataAppend(pColInfo, numOfRows, (const char*) b, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->acct, pShow->bytes[cols]); cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); + colDataAppend(pColInfo, numOfRows, (const char*) &pUser->createdTime, false); + + cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); + STR_WITH_MAXSIZE_TO_VARSTR(name, pUser->acct, pShow->bytes[cols]); + colDataAppend(pColInfo, numOfRows, (const char*) name, false); numOfRows++; sdbRelease(pSdb, pUser); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index bbe1760feb..dcb48c95a7 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -35,10 +35,9 @@ static int32_t mndProcessDropVnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessSyncVnodeRsp(SNodeMsg *pRsp); static int32_t mndProcessCompactVnodeRsp(SNodeMsg *pRsp); -static int32_t mndGetVgroupMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); -static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextVgroup(SMnode *pMnode, void *pIter); -static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows); static void mndCancelGetNextVnode(SMnode *pMnode, void *pIter); int32_t mndInitVgroup(SMnode *pMnode) { @@ -499,64 +498,12 @@ static int32_t mndGetVgroupMaxReplica(SMnode *pMnode, char *dbName, int8_t *pRep return 0; } -static int32_t mndGetVgroupMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) { - SMnode *pMnode = pReq->pNode; - SSdb *pSdb = pMnode->pSdb; - - if (mndGetVgroupMaxReplica(pMnode, pShow->db, &pShow->replica, &pShow->numOfRows) != 0) { - return -1; - } - - int32_t cols = 0; - SSchema *pSchema = pMeta->pSchemas; - - pShow->bytes[cols] = 4; - pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "vgId"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 4; - pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "tables"); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - for (int32_t i = 0; i < pShow->replica; ++i) { - pShow->bytes[cols] = 2; - pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT; - snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%d_dnode", i + 1); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - - pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%d_status", i + 1); - pSchema[cols].bytes = pShow->bytes[cols]; - cols++; - } - - pMeta->numOfColumns = cols; - pShow->numOfColumns = cols; - - pShow->offset[0] = 0; - for (int32_t i = 1; i < cols; ++i) { - pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1]; - } - - pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1]; - strcpy(pMeta->tbName, mndShowStr(pShow->type)); - - return 0; -} - -static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; SVgObj *pVgroup = NULL; int32_t cols = 0; - char *pWrite; SDbObj *pDb = NULL; if (strlen(pShow->db) > 0) { @@ -575,46 +522,61 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, i } cols = 0; - - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pVgroup->vgId; - cols++; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false); SName name = {0}; - char db[TSDB_DB_NAME_LEN] = {0}; - tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT|T_NAME_DB); - tNameGetDbName(&name, db); + char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB); + tNameGetDbName(&name, varDataVal(db)); + varDataSetLen(db, strlen(varDataVal(db))); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, db); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)db, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pVgroup->numOfTables; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->numOfTables, false); - //status - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, "ready"); // TODO - cols++; + // status + char buf[10] = {0}; + STR_TO_VARSTR(buf, "ready"); // TODO + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, buf, false); - //onlines - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pVgroup->replica; - cols++; + // onlines + int32_t onlines = pVgroup->replica; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&onlines, false); + // default 3 replica + for (int32_t i = 0; i < 3; ++i) { - for (int32_t i = 0; i < pVgroup->replica; ++i) { - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int16_t *)pWrite = pVgroup->vnodeGid[i].dnodeId; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + if (i < pVgroup->replica) { + colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vnodeGid[i].dnodeId, false); - const char *role = mndGetRoleStr(pVgroup->vnodeGid[i].role); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, role, pShow->bytes[cols]); - cols++; + char buf1[20] = {0}; + const char *role = mndGetRoleStr(pVgroup->vnodeGid[i].role); + STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->bytes[cols]); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)buf1, false); + } else { + colDataAppendNULL(pColInfo, numOfRows); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppendNULL(pColInfo, numOfRows); + } } + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppendNULL(pColInfo, numOfRows); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppendNULL(pColInfo, numOfRows); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); + colDataAppendNULL(pColInfo, numOfRows); + numOfRows++; sdbRelease(pSdb, pVgroup); } @@ -623,8 +585,7 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, i mndReleaseDb(pMnode, pDb); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } @@ -653,12 +614,11 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) { return numOfVnodes; } -static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; SVgObj *pVgroup = NULL; - char *pWrite; int32_t cols = 0; // int32_t dnodeId = pShow->replica; @@ -670,30 +630,29 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(uint32_t *)pWrite = pVgroup->vgId; - cols++; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false); SName name = {0}; - char db[TSDB_DB_NAME_LEN] = {0}; - tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT|T_NAME_DB); - tNameGetDbName(&name, db); + char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB); + tNameGetDbName(&name, varDataVal(db)); + varDataSetLen(db, strlen(varDataVal(db))); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, db); - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)db, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(uint32_t *)pWrite = 0; //todo: Tables - cols++; + uint32_t val = 0; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&val, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndGetRoleStr(pVgid->role)); - cols++; + char buf[20] = {0}; + STR_TO_VARSTR(buf, mndGetRoleStr(pVgid->role)); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)buf, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(uint32_t *)pWrite = pVgroup->replica; //onlines - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->replica, false); // onlines numOfRows++; } @@ -701,8 +660,7 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in sdbRelease(pSdb, pVgroup); } - mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); - pShow->numOfReads += numOfRows; + pShow->numOfRows += numOfRows; return numOfRows; } diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index 0d1e890097..7b299f1f3c 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -73,10 +73,6 @@ int32_t qndProcessFetchMsg(SQnode *pQnode, SRpcMsg *pMsg) { return qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg); case TDMT_VND_DROP_TASK: return qWorkerProcessDropMsg(pQnode, pQnode->pQuery, pMsg); - case TDMT_VND_SHOW_TABLES: - return qWorkerProcessShowMsg(pQnode, pQnode->pQuery, pMsg); - case TDMT_VND_SHOW_TABLES_FETCH: - // return vnodeGetTableList(pQnode, pMsg); case TDMT_VND_TABLE_META: // return vnodeGetTableMeta(pQnode, pMsg); case TDMT_VND_CONSUME: diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index a93e1741bb..6e85c4df64 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -25,82 +25,144 @@ #include "tfs.h" #include "wal.h" +#include "tcommon.h" +#include "tfs.h" #include "tmallocator.h" #include "tmsg.h" #include "trow.h" -#include "tmallocator.h" -#include "tcommon.h" -#include "tfs.h" #ifdef __cplusplus extern "C" { #endif -/* ------------------------ TYPES EXPOSED ------------------------ */ -typedef struct SMgmtWrapper SMgmtWrapper; -typedef struct SVnode SVnode; +// vnode +typedef struct SVnode SVnode; +typedef struct SMetaCfg SMetaCfg; // todo: remove +typedef struct STsdbCfg STsdbCfg; // todo: remove +typedef struct STqCfg STqCfg; // todo: remove +typedef struct SVnodeCfg SVnodeCfg; + +int vnodeInit(); +void vnodeCleanup(); +SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg); +void vnodeClose(SVnode *pVnode); +void vnodeDestroy(const char *path); +void vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs); +int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); +int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); +int vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); +int vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg); +int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo); +int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg); +int32_t vnodeCompact(SVnode *pVnode); +int32_t vnodeSync(SVnode *pVnode); +int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad); +int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName); + +// meta +typedef struct SMeta SMeta; // todo: remove +typedef struct SMTbCursor SMTbCursor; // todo: remove +typedef struct SMCtbCursor SMCtbCursor; // todo: remove +typedef struct SMSmaCursor SMSmaCursor; // todo: remove #define META_SUPER_TABLE TD_SUPER_TABLE #define META_CHILD_TABLE TD_CHILD_TABLE #define META_NORMAL_TABLE TD_NORMAL_TABLE -// Types exported -typedef struct SMeta SMeta; - -typedef struct SMetaCfg { - /// LRU cache size - uint64_t lruSize; -} SMetaCfg; - -typedef struct SMTbCursor SMTbCursor; -typedef struct SMCtbCursor SMCtbCursor; -typedef struct SMSmaCursor SMSmaCursor; - typedef SVCreateTbReq STbCfg; typedef SVCreateTSmaReq SSmaCfg; -typedef struct SDataStatis { - int16_t colId; - int16_t maxIndex; - int16_t minIndex; - int16_t numOfNull; - int64_t sum; - int64_t max; - int64_t min; -} SDataStatis; +SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline); +STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver); +void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode); +STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid); +SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup); +int metaGetTbNum(SMeta *pMeta); +SMTbCursor *metaOpenTbCursor(SMeta *pMeta); +void metaCloseTbCursor(SMTbCursor *pTbCur); +char *metaTbCursorNext(SMTbCursor *pTbCur); +SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid); +void metaCloseCtbCurosr(SMCtbCursor *pCtbCur); +tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur); -typedef struct STsdbQueryCond { - STimeWindow twindow; - int32_t order; // desc|asc order to iterate the data block - int32_t numOfCols; - SColumnInfo *colList; - bool loadExternalRows; // load external rows or not - int32_t type; // data block load type: -} STsdbQueryCond; +SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid); +void metaCloseSmaCursor(SMSmaCursor *pSmaCur); +int64_t metaSmaCursorNext(SMSmaCursor *pSmaCur); -typedef struct { - TSKEY lastKey; - uint64_t uid; -} STableKeyInfo; +// tsdb +typedef struct STsdb STsdb; +typedef struct SDataStatis SDataStatis; +typedef struct STsdbQueryCond STsdbQueryCond; +typedef void *tsdbReaderT; +#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1 +#define BLOCK_LOAD_TABLE_SEQ_ORDER 2 +#define BLOCK_LOAD_TABLE_RR_ORDER 3 +#define TABLE_TID(t) (t)->tid +#define TABLE_UID(t) (t)->uid +STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF, SMeta *pMeta, + STfs *pTfs); +void tsdbClose(STsdb *); +void tsdbRemove(const char *path); +int tsdbInsertData(STsdb *pTsdb, SSubmitReq *pMsg, SSubmitRsp *pRsp); +int tsdbPrepareCommit(STsdb *pTsdb); +int tsdbCommit(STsdb *pTsdb); +int32_t tsdbInitSma(STsdb *pTsdb); +int32_t tsdbCreateTSma(STsdb *pTsdb, char *pMsg); +int32_t tsdbDropTSma(STsdb *pTsdb, char *pMsg); +tsdbReaderT *tsdbQueryTables(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfoGroup, uint64_t qId, + uint64_t taskId); +tsdbReaderT tsdbQueryCacheLast(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, uint64_t qId, + void *pMemRef); +int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT *pReader, STableBlockDistInfo *pTableBlockInfo); +bool isTsdbCacheLastRow(tsdbReaderT *pReader); +int32_t tsdbQuerySTableByTagCond(void *pMeta, uint64_t uid, TSKEY skey, const char *pTagCond, size_t len, + int16_t tagNameRelType, const char *tbnameCond, STableGroupInfo *pGroupInfo, + SColIndex *pColIndex, int32_t numOfCols, uint64_t reqId, uint64_t taskId); +int64_t tsdbGetNumOfRowsInMemTable(tsdbReaderT *pHandle); +bool tsdbNextDataBlock(tsdbReaderT pTsdbReadHandle); +void tsdbRetrieveDataBlockInfo(tsdbReaderT *pTsdbReadHandle, SDataBlockInfo *pBlockInfo); +int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT *pTsdbReadHandle, SDataStatis **pBlockStatis); +SArray *tsdbRetrieveDataBlock(tsdbReaderT *pTsdbReadHandle, SArray *pColumnIdList); +void tsdbDestroyTableGroup(STableGroupInfo *pGroupList); +int32_t tsdbGetOneTableGroup(void *pMeta, uint64_t uid, TSKEY startKey, STableGroupInfo *pGroupInfo); +int32_t tsdbGetTableGroupFromIdList(STsdb *tsdb, SArray *pTableIdList, STableGroupInfo *pGroupInfo); +void tsdbCleanupReadHandle(tsdbReaderT queryHandle); +int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, SSubmitReq *pMsg, int64_t version); +int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg); +int32_t tsdbDropTSmaData(STsdb *pTsdb, int64_t indexUid); +int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg); -typedef struct STable { - uint64_t tid; - uint64_t uid; - STSchema *pSchema; -} STable; +// tq +enum { + TQ_STREAM_TOKEN__DATA = 1, + TQ_STREAM_TOKEN__WATERMARK, + TQ_STREAM_TOKEN__CHECKPOINT, +}; -#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1 -#define BLOCK_LOAD_TABLE_SEQ_ORDER 2 -#define BLOCK_LOAD_TABLE_RR_ORDER 3 +typedef struct STqReadHandle STqReadHandle; -#define TABLE_TID(t) (t)->tid -#define TABLE_UID(t) (t)->uid +STqReadHandle *tqInitSubmitMsgScanner(SMeta *pMeta); -// TYPES EXPOSED -typedef struct STsdb STsdb; +void tqReadHandleSetColIdList(STqReadHandle *pReadHandle, SArray *pColIdList); +int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList); +int tqReadHandleAddTbUidList(STqReadHandle *pHandle, const SArray *tbUidList); +int32_t tqReadHandleSetMsg(STqReadHandle *pHandle, SSubmitReq *pMsg, int64_t ver); +bool tqNextDataBlock(STqReadHandle *pHandle); +int tqRetrieveDataBlockInfo(STqReadHandle *pHandle, SDataBlockInfo *pBlockInfo); +SArray *tqRetrieveDataBlock(STqReadHandle *pHandle); -typedef struct STsdbCfg { +// need to reposition +typedef struct SMgmtWrapper SMgmtWrapper; + +int32_t tdScanAndConvertSubmitMsg(SSubmitReq *pMsg); + +// structs +struct SMetaCfg { + uint64_t lruSize; +}; + +struct STsdbCfg { int8_t precision; int8_t update; int8_t compression; @@ -112,15 +174,13 @@ typedef struct STsdbCfg { int32_t keep2; uint64_t lruCacheSize; SArray *retentions; -} STsdbCfg; +}; - -typedef struct { - // TODO +struct STqCfg { int32_t reserved; -} STqCfg; +}; -typedef struct { +struct SVnodeCfg { int32_t vgId; uint64_t dbId; STfs *pTfs; @@ -140,9 +200,9 @@ typedef struct { uint32_t hashBegin; uint32_t hashEnd; int8_t hashMethod; -} SVnodeCfg; +}; -typedef struct { +struct STqReadHandle { int64_t ver; int64_t tbUid; SHashObj *tbIdHash; @@ -155,133 +215,38 @@ typedef struct { int32_t sver; SSchemaWrapper *pSchemaWrapper; STSchema *pSchema; -} STqReadHandle; - -/* ------------------------ SVnode ------------------------ */ -/** - * @brief Initialize the vnode module - * - * @return int 0 for success and -1 for failure - */ -int vnodeInit(); - -/** - * @brief Cleanup the vnode module - * - */ -void vnodeCleanup(); - -/** - * @brief Open a VNODE. - * - * @param path path of the vnode - * @param pVnodeCfg options of the vnode - * @return SVnode* The vnode object - */ -SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg); - -/** - * @brief Close a VNODE - * - * @param pVnode The vnode object to close - */ -void vnodeClose(SVnode *pVnode); - -/** - * @brief Destroy a VNODE. - * - * @param path Path of the VNODE. - */ -void vnodeDestroy(const char *path); - -/** - * @brief Process an array of write messages. - * - * @param pVnode The vnode object. - * @param pMsgs The array of SRpcMsg - */ -void vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs); - -/** - * @brief Apply a write request message. - * - * @param pVnode The vnode object. - * @param pMsg The request message - * @param pRsp The response message - * @return int 0 for success, -1 for failure - */ -int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); - -/** - * @brief Process a consume message. - * - * @param pVnode The vnode object. - * @param pMsg The request message - * @param pRsp The response message - * @return int 0 for success, -1 for failure - */ -int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); - -/** - * @brief Process the sync request - * - * @param pVnode - * @param pMsg - * @param pRsp - * @return int - */ -int vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); - -/** - * @brief Process a query message. - * - * @param pVnode The vnode object. - * @param pMsg The request message - * @return int 0 for success, -1 for failure - */ -int vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg); - -/** - * @brief Process a fetch message. - * - * @param pVnode The vnode object. - * @param pMsg The request message - * @return int 0 for success, -1 for failure - */ -int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo); - -/* ------------------------ SVnodeCfg ------------------------ */ -/** - * @brief Initialize VNODE options. - * - * @param pOptions The options object to be initialized. It should not be NULL. - */ -void vnodeOptionsInit(SVnodeCfg *pOptions); - -/** - * @brief Clear VNODE options. - * - * @param pOptions Options to clear. - */ -void vnodeOptionsClear(SVnodeCfg *pOptions); - -int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName); - -/* ------------------------ FOR COMPILE ------------------------ */ - -int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg); -int32_t vnodeCompact(SVnode *pVnode); -int32_t vnodeSync(SVnode *pVnode); -int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad); - -/* ------------------------- TQ READ --------------------------- */ - -enum { - TQ_STREAM_TOKEN__DATA = 1, - TQ_STREAM_TOKEN__WATERMARK, - TQ_STREAM_TOKEN__CHECKPOINT, }; +struct SDataStatis { + int16_t colId; + int16_t maxIndex; + int16_t minIndex; + int16_t numOfNull; + int64_t sum; + int64_t max; + int64_t min; +}; + +struct STsdbQueryCond { + STimeWindow twindow; + int32_t order; // desc|asc order to iterate the data block + int32_t numOfCols; + SColumnInfo *colList; + bool loadExternalRows; // load external rows or not + int32_t type; // data block load type: +}; + +typedef struct { + TSKEY lastKey; + uint64_t uid; +} STableKeyInfo; + +typedef struct STable { + uint64_t tid; + uint64_t uid; + STSchema *pSchema; +} STable; + typedef struct { int8_t type; int8_t reserved[7]; @@ -292,294 +257,6 @@ typedef struct { }; } STqStreamToken; -STqReadHandle *tqInitSubmitMsgScanner(SMeta *pMeta); - -static FORCE_INLINE void tqReadHandleSetColIdList(STqReadHandle *pReadHandle, SArray *pColIdList) { - pReadHandle->pColIdList = pColIdList; -} - -// static FORCE_INLINE void tqReadHandleSetTbUid(STqReadHandle* pHandle, int64_t tbUid) { -// pHandle->tbUid = tbUid; -//} - -static FORCE_INLINE int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList) { - if (pHandle->tbIdHash) { - taosHashClear(pHandle->tbIdHash); - } - - pHandle->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - if (pHandle->tbIdHash == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - for (int i = 0; i < taosArrayGetSize(tbUidList); i++) { - int64_t *pKey = (int64_t *)taosArrayGet(tbUidList, i); - taosHashPut(pHandle->tbIdHash, pKey, sizeof(int64_t), NULL, 0); - } - - return 0; -} - -static FORCE_INLINE int tqReadHandleAddTbUidList(STqReadHandle *pHandle, const SArray *tbUidList) { - if (pHandle->tbIdHash == NULL) { - pHandle->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - if (pHandle->tbIdHash == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - } - - for (int i = 0; i < taosArrayGetSize(tbUidList); i++) { - int64_t *pKey = (int64_t *)taosArrayGet(tbUidList, i); - taosHashPut(pHandle->tbIdHash, pKey, sizeof(int64_t), NULL, 0); - } - - return 0; -} - -int32_t tqReadHandleSetMsg(STqReadHandle *pHandle, SSubmitReq *pMsg, int64_t ver); -bool tqNextDataBlock(STqReadHandle *pHandle); -int tqRetrieveDataBlockInfo(STqReadHandle *pHandle, SDataBlockInfo *pBlockInfo); -// return SArray -SArray *tqRetrieveDataBlock(STqReadHandle *pHandle); - -// meta.h -SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF); -void metaClose(SMeta *pMeta); -void metaRemove(const char *path); -int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg); -int metaDropTable(SMeta *pMeta, tb_uid_t uid); -int metaCommit(SMeta *pMeta); -int32_t metaCreateTSma(SMeta *pMeta, SSmaCfg *pCfg); -int32_t metaDropTSma(SMeta *pMeta, int64_t indexUid); -STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid); -STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid); -SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline); -STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver); -void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode); -STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid); -SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup); -int metaGetTbNum(SMeta *pMeta); -SMTbCursor *metaOpenTbCursor(SMeta *pMeta); -void metaCloseTbCursor(SMTbCursor *pTbCur); -char *metaTbCursorNext(SMTbCursor *pTbCur); -SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid); -void metaCloseCtbCurosr(SMCtbCursor *pCtbCur); -tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur); - -SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid); -void metaCloseSmaCursor(SMSmaCursor *pSmaCur); -int64_t metaSmaCursorNext(SMSmaCursor *pSmaCur); - -// Options -void metaOptionsInit(SMetaCfg *pMetaCfg); -void metaOptionsClear(SMetaCfg *pMetaCfg); - -// query condition to build multi-table data block iterator -// STsdb -STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF, SMeta *pMeta, STfs *pTfs); -void tsdbClose(STsdb *); -void tsdbRemove(const char *path); -int tsdbInsertData(STsdb *pTsdb, SSubmitReq *pMsg, SSubmitRsp *pRsp); -int tsdbPrepareCommit(STsdb *pTsdb); -int tsdbCommit(STsdb *pTsdb); - - -int32_t tsdbInitSma(STsdb *pTsdb); -int32_t tsdbCreateTSma(STsdb *pTsdb, char *pMsg); -int32_t tsdbDropTSma(STsdb *pTsdb, char *pMsg); -/** - * @brief When submit msg received, update the relative expired window synchronously. - * - * @param pTsdb - * @param pMsg - * @param version - * @return int32_t - */ -int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, SSubmitReq *pMsg, int64_t version); - -/** - * @brief Insert tSma(Time-range-wise SMA) data from stream computing engine - * - * @param pTsdb - * @param indexUid - * @param msg - * @return int32_t - */ -int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg); - -/** - * @brief Drop tSma data and local cache. - * - * @param pTsdb - * @param indexUid - * @return int32_t - */ -int32_t tsdbDropTSmaData(STsdb *pTsdb, int64_t indexUid); - -/** - * @brief Insert RSma(Rollup SMA) data. - * - * @param pTsdb - * @param msg - * @return int32_t - */ -int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg); - -// TODO: This is the basic params, and should wrap the params to a queryHandle. -/** - * @brief Get tSma(Time-range-wise SMA) data. - * - * @param pTsdb - * @param pData - * @param indexUid - * @param querySKey - * @param nMaxResult - * @return int32_t - */ -int32_t tsdbGetTSmaData(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult); - -// STsdbCfg -int tsdbOptionsInit(STsdbCfg *); -void tsdbOptionsClear(STsdbCfg *); - -typedef void* tsdbReaderT; - -/** - * Get the data block iterator, starting from position according to the query condition - * - * @param tsdb tsdb handle - * @param pCond query condition, including time window, result set order, and basic required columns for each block - * @param tableInfoGroup table object list in the form of set, grouped into different sets according to the - * group by condition - * @param qinfo query info handle from query processor - * @return - */ -tsdbReaderT *tsdbQueryTables(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfoGroup, uint64_t qId, uint64_t taskId); - -/** - * Get the last row of the given query time window for all the tables in STableGroupInfo object. - * Note that only one data block with only row will be returned while invoking retrieve data block function for - * all tables in this group. - * - * @param tsdb tsdb handle - * @param pCond query condition, including time window, result set order, and basic required columns for each block - * @param tableInfo table list. - * @return - */ -//tsdbReaderT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, uint64_t qId, -// SMemRef *pRef); - - -tsdbReaderT tsdbQueryCacheLast(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, uint64_t qId, void* pMemRef); - -int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* pReader, STableBlockDistInfo* pTableBlockInfo); - -bool isTsdbCacheLastRow(tsdbReaderT* pReader); - -/** - * - * @param tsdb - * @param uid - * @param skey - * @param pTagCond - * @param len - * @param tagNameRelType - * @param tbnameCond - * @param pGroupInfo - * @param pColIndex - * @param numOfCols - * @param reqId - * @return - */ -int32_t tsdbQuerySTableByTagCond(void* pMeta, uint64_t uid, TSKEY skey, const char* pTagCond, size_t len, - int16_t tagNameRelType, const char* tbnameCond, STableGroupInfo* pGroupInfo, - SColIndex* pColIndex, int32_t numOfCols, uint64_t reqId, uint64_t taskId); -/** - * get num of rows in mem table - * - * @param pHandle - * @return row size - */ - -int64_t tsdbGetNumOfRowsInMemTable(tsdbReaderT* pHandle); - -/** - * move to next block if exists - * - * @param pTsdbReadHandle - * @return - */ -bool tsdbNextDataBlock(tsdbReaderT pTsdbReadHandle); - -/** - * Get current data block information - * - * @param pTsdbReadHandle - * @param pBlockInfo - * @return - */ -void tsdbRetrieveDataBlockInfo(tsdbReaderT *pTsdbReadHandle, SDataBlockInfo *pBlockInfo); - -/** - * - * Get the pre-calculated information w.r.t. current data block. - * - * In case of data block in cache, the pBlockStatis will always be NULL. - * If a block is not completed loaded from disk, the pBlockStatis will be NULL. - - * @pBlockStatis the pre-calculated value for current data blocks. if the block is a cache block, always return 0 - * @return - */ -int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT *pTsdbReadHandle, SDataStatis **pBlockStatis); - -/** - * - * The query condition with primary timestamp is passed to iterator during its constructor function, - * the returned data block must be satisfied with the time window condition in any cases, - * which means the SData data block is not actually the completed disk data blocks. - * - * @param pTsdbReadHandle query handle - * @param pColumnIdList required data columns id list - * @return - */ -SArray *tsdbRetrieveDataBlock(tsdbReaderT *pTsdbReadHandle, SArray *pColumnIdList); - -/** - * destroy the created table group list, which is generated by tag query - * @param pGroupList - */ -void tsdbDestroyTableGroup(STableGroupInfo *pGroupList); - -/** - * create the table group result including only one table, used to handle the normal table query - * - * @param tsdb tsdbHandle - * @param uid table uid - * @param pGroupInfo the generated result - * @return - */ -int32_t tsdbGetOneTableGroup(void *pMeta, uint64_t uid, TSKEY startKey, STableGroupInfo *pGroupInfo); - -/** - * - * @param tsdb - * @param pTableIdList - * @param pGroupInfo - * @return - */ -int32_t tsdbGetTableGroupFromIdList(STsdb *tsdb, SArray *pTableIdList, STableGroupInfo *pGroupInfo); - -/** - * clean up the query handle - * @param queryHandle - */ -void tsdbCleanupReadHandle(tsdbReaderT queryHandle); - -int32_t tdScanAndConvertSubmitMsg(SSubmitReq *pMsg); - - #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/inc/meta.h b/source/dnode/vnode/src/inc/meta.h index b04364daf8..b3553f5d2d 100644 --- a/source/dnode/vnode/src/inc/meta.h +++ b/source/dnode/vnode/src/inc/meta.h @@ -24,6 +24,17 @@ typedef struct SMetaCache SMetaCache; typedef struct SMetaIdx SMetaIdx; typedef struct SMetaDB SMetaDB; +SMeta* metaOpen(const char* path, const SMetaCfg* pMetaCfg, SMemAllocatorFactory* pMAF); +void metaClose(SMeta* pMeta); +void metaRemove(const char* path); +int metaCreateTable(SMeta* pMeta, STbCfg* pTbCfg); +int metaDropTable(SMeta* pMeta, tb_uid_t uid); +int metaCommit(SMeta* pMeta); +int32_t metaCreateTSma(SMeta* pMeta, SSmaCfg* pCfg); +int32_t metaDropTSma(SMeta* pMeta, int64_t indexUid); +STbCfg* metaGetTbInfoByUid(SMeta* pMeta, tb_uid_t uid); +STbCfg* metaGetTbInfoByName(SMeta* pMeta, char* tbname, tb_uid_t* uid); + // SMetaDB int metaOpenDB(SMeta* pMeta); void metaCloseDB(SMeta* pMeta); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 29a45723c4..7168493666 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -17,6 +17,9 @@ #define _TD_VNODE_DEF_H_ #include "executor.h" +#include "filter.h" +#include "qworker.h" +#include "sync.h" #include "tchecksum.h" #include "tcoding.h" #include "tcompression.h" @@ -25,14 +28,15 @@ #include "tglobal.h" #include "tlist.h" #include "tlockfree.h" +#include "tlosertree.h" #include "tmacro.h" #include "tmallocator.h" #include "tskiplist.h" +#include "tstream.h" #include "ttime.h" #include "ttimer.h" #include "vnode.h" #include "wal.h" -#include "qworker.h" #ifdef __cplusplus extern "C" { diff --git a/source/dnode/vnode/src/meta/metaBDBImpl.c b/source/dnode/vnode/src/meta/metaBDBImpl.c index a8270f746d..249e489029 100644 --- a/source/dnode/vnode/src/meta/metaBDBImpl.c +++ b/source/dnode/vnode/src/meta/metaBDBImpl.c @@ -16,10 +16,7 @@ #define ALLOW_FORBID_FUNC #include "db.h" -#include "metaDef.h" - -#include "tcoding.h" -#include "thash.h" +#include "vnodeInt.h" #define IMPL_WITH_LOCK 1 // #if IMPL_WITH_LOCK @@ -262,7 +259,7 @@ int metaSaveSmaToDB(SMeta *pMeta, STSma *pSmaCfg) { return 0; } -int metaRemoveSmaFromDb(SMeta *pMeta, int64_t indexUid) { +int metaRemoveSmaFromDb(SMeta *pMeta, int64_t indexUid) { // TODO #if 0 DBT key = {0}; @@ -668,7 +665,7 @@ STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid) { } void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) { - STSma * pCfg = NULL; + STSma *pCfg = NULL; SMetaDB *pDB = pMeta->pDB; DBT key = {0}; DBT value = {0}; @@ -711,9 +708,9 @@ static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_ int ret; void *pBuf; // SSchema *pSchema; - SSchemaKey schemaKey = {uid, sver, 0}; - DBT key = {0}; - DBT value = {0}; + SSchemaKey schemaKey = {uid, sver, 0}; + DBT key = {0}; + DBT value = {0}; // Set key/value properties key.data = &schemaKey; @@ -761,14 +758,14 @@ SMTbCursor *metaOpenTbCursor(SMeta *pMeta) { } int metaGetTbNum(SMeta *pMeta) { - SMetaDB *pDB = pMeta->pDB; + SMetaDB *pDB = pMeta->pDB; DB_BTREE_STAT *sp1; pDB->pTbDB->stat(pDB->pNtbIdx, NULL, &sp1, 0); - + DB_BTREE_STAT *sp2; pDB->pTbDB->stat(pDB->pCtbIdx, NULL, &sp2, 0); - + return sp1->bt_nkeys + sp2->bt_nkeys; } diff --git a/source/dnode/vnode/src/meta/metaCfg.c b/source/dnode/vnode/src/meta/metaCfg.c index a5fcb32698..371c20f157 100644 --- a/source/dnode/vnode/src/meta/metaCfg.c +++ b/source/dnode/vnode/src/meta/metaCfg.c @@ -18,11 +18,6 @@ const SMetaCfg defaultMetaOptions = {.lruSize = 0}; /* ------------------------ EXPOSED METHODS ------------------------ */ -void metaOptionsInit(SMetaCfg *pMetaOptions) { metaOptionsCopy(pMetaOptions, &defaultMetaOptions); } - -void metaOptionsClear(SMetaCfg *pMetaOptions) { - // TODO -} int metaValidateOptions(const SMetaCfg *pMetaOptions) { // TODO diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 6dea4a4e57..5022d0e050 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -11,4 +11,6 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - */ \ No newline at end of file + */ + +#include "vnodeInt.h" \ No newline at end of file diff --git a/source/dnode/vnode/src/meta/metaTDBImpl.c b/source/dnode/vnode/src/meta/metaTDBImpl.c index 6f218ad72b..9b9f54b5ba 100644 --- a/source/dnode/vnode/src/meta/metaTDBImpl.c +++ b/source/dnode/vnode/src/meta/metaTDBImpl.c @@ -15,7 +15,6 @@ #include "vnodeInt.h" -#include "tdbInt.h" typedef struct SPoolMem { int64_t size; struct SPoolMem *prev; @@ -27,18 +26,18 @@ typedef struct SPoolMem { static SPoolMem *openPool(); static void clearPool(SPoolMem *pPool); static void closePool(SPoolMem *pPool); -static void * poolMalloc(void *arg, size_t size); +static void *poolMalloc(void *arg, size_t size); static void poolFree(void *arg, void *ptr); struct SMetaDB { TXN txn; - TENV * pEnv; - TDB * pTbDB; - TDB * pSchemaDB; - TDB * pNameIdx; - TDB * pStbIdx; - TDB * pNtbIdx; - TDB * pCtbIdx; + TENV *pEnv; + TDB *pTbDB; + TDB *pSchemaDB; + TDB *pNameIdx; + TDB *pStbIdx; + TDB *pNtbIdx; + TDB *pCtbIdx; SPoolMem *pPool; #ifdef META_TDB_SMA_TEST TDB *pSmaDB; @@ -52,7 +51,7 @@ typedef struct __attribute__((__packed__)) { } SSchemaDbKey; typedef struct { - char * name; + char *name; tb_uid_t uid; } SNameIdxKey; @@ -251,14 +250,14 @@ void metaCloseDB(SMeta *pMeta) { int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { tb_uid_t uid; - SMetaDB * pMetaDb; - void * pKey; - void * pVal; + SMetaDB *pMetaDb; + void *pKey; + void *pVal; int kLen; int vLen; int ret; char buf[512]; - void * pBuf; + void *pBuf; SCtbIdxKey ctbIdxKey; SSchemaDbKey schemaDbKey; SSchemaWrapper schemaWrapper; @@ -375,11 +374,11 @@ int metaRemoveTableFromDb(SMeta *pMeta, tb_uid_t uid) { STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid) { int ret; SMetaDB *pMetaDb = pMeta->pDB; - void * pKey; - void * pVal; + void *pKey; + void *pVal; int kLen; int vLen; - STbCfg * pTbCfg; + STbCfg *pTbCfg; // Fetch pKey = &uid; @@ -431,14 +430,14 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo } static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline, bool isGetEx) { - void * pKey; - void * pVal; + void *pKey; + void *pVal; int kLen; int vLen; int ret; SSchemaDbKey schemaDbKey; SSchemaWrapper *pSchemaWrapper; - void * pBuf; + void *pBuf; // fetch schemaDbKey.uid = uid; @@ -465,9 +464,9 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) { tb_uid_t quid; SSchemaWrapper *pSW; STSchemaBuilder sb; - SSchemaEx * pSchema; - STSchema * pTSchema; - STbCfg * pTbCfg; + SSchemaEx *pSchema; + STSchema *pTSchema; + STbCfg *pTbCfg; pTbCfg = metaGetTbInfoByUid(pMeta, uid); if (pTbCfg->type == META_CHILD_TABLE) { @@ -498,7 +497,7 @@ struct SMTbCursor { SMTbCursor *metaOpenTbCursor(SMeta *pMeta) { SMTbCursor *pTbCur = NULL; - SMetaDB * pDB = pMeta->pDB; + SMetaDB *pDB = pMeta->pDB; pTbCur = (SMTbCursor *)taosMemoryCalloc(1, sizeof(*pTbCur)); if (pTbCur == NULL) { @@ -520,12 +519,12 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) { } char *metaTbCursorNext(SMTbCursor *pTbCur) { - void * pKey = NULL; - void * pVal = NULL; + void *pKey = NULL; + void *pVal = NULL; int kLen; int vLen; int ret; - void * pBuf; + void *pBuf; STbCfg tbCfg; for (;;) { @@ -548,17 +547,17 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) { } struct SMCtbCursor { - TDBC * pCur; + TDBC *pCur; tb_uid_t suid; - void * pKey; - void * pVal; + void *pKey; + void *pVal; int kLen; int vLen; }; SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid) { SMCtbCursor *pCtbCur = NULL; - SMetaDB * pDB = pMeta->pDB; + SMetaDB *pDB = pMeta->pDB; int ret; pCtbCur = (SMCtbCursor *)taosMemoryCalloc(1, sizeof(*pCtbCur)); @@ -654,7 +653,6 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { continue; } - ++pSW->number; STSma *tptr = (STSma *)taosMemoryRealloc(pSW->tSma, pSW->number * sizeof(STSma)); if (tptr == NULL) { @@ -709,10 +707,10 @@ int metaSaveSmaToDB(SMeta *pMeta, STSma *pSmaCfg) { // ASSERT(0); #ifdef META_TDB_SMA_TEST - int32_t ret = 0; + int32_t ret = 0; SMetaDB *pMetaDb = pMeta->pDB; - void *pBuf = NULL, *qBuf = NULL; - void *key = {0}, *val = {0}; + void *pBuf = NULL, *qBuf = NULL; + void *key = {0}, *val = {0}; // save sma info int32_t len = tEncodeTSma(NULL, pSmaCfg); @@ -1103,7 +1101,7 @@ static void closePool(SPoolMem *pPool) { } static void *poolMalloc(void *arg, size_t size) { - void * ptr = NULL; + void *ptr = NULL; SPoolMem *pPool = (SPoolMem *)arg; SPoolMem *pMem; diff --git a/source/dnode/vnode/src/meta/metaTbCfg.c b/source/dnode/vnode/src/meta/metaTbCfg.c index 8ecc808786..9d5012c17f 100644 --- a/source/dnode/vnode/src/meta/metaTbCfg.c +++ b/source/dnode/vnode/src/meta/metaTbCfg.c @@ -14,7 +14,6 @@ */ #include "vnodeInt.h" -#include "tcoding.h" int metaValidateTbCfg(SMeta *pMeta, const STbCfg *pTbOptions) { // TODO diff --git a/source/dnode/vnode/src/meta/metaTbTag.c b/source/dnode/vnode/src/meta/metaTbTag.c index 6dea4a4e57..5022d0e050 100644 --- a/source/dnode/vnode/src/meta/metaTbTag.c +++ b/source/dnode/vnode/src/meta/metaTbTag.c @@ -11,4 +11,6 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - */ \ No newline at end of file + */ + +#include "vnodeInt.h" \ No newline at end of file diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index f48262deba..f57103aab4 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -13,9 +13,6 @@ * along with this program. If not, see . */ -#include "tcompare.h" -#include "tdatablock.h" -#include "tstream.h" #include "vnodeInt.h" int32_t tqInit() { return tqPushMgrInit(); } diff --git a/source/dnode/vnode/src/tq/tqCommit.c b/source/dnode/vnode/src/tq/tqCommit.c index f2f48bbc8a..8e59243a9c 100644 --- a/source/dnode/vnode/src/tq/tqCommit.c +++ b/source/dnode/vnode/src/tq/tqCommit.c @@ -12,3 +12,5 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ + +#include "vnodeInt.h" diff --git a/source/dnode/vnode/src/tq/tqMetaStore.c b/source/dnode/vnode/src/tq/tqMetaStore.c index 84f12f93c6..357917e0ba 100644 --- a/source/dnode/vnode/src/tq/tqMetaStore.c +++ b/source/dnode/vnode/src/tq/tqMetaStore.c @@ -14,13 +14,13 @@ */ #include "vnodeInt.h" // TODO:replace by an abstract file layer -#include -#include -#include -#include "osDir.h" +// #include +// #include +// #include +// #include "osDir.h" #define TQ_META_NAME "tq.meta" -#define TQ_IDX_NAME "tq.idx" +#define TQ_IDX_NAME "tq.idx" static int32_t tqHandlePutCommitted(STqMetaStore*, int64_t key, void* value); static void* tqHandleGetUncommitted(STqMetaStore*, int64_t key); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index c69f8ce09a..9282f7197e 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -13,8 +13,7 @@ * along with this program. If not, see . */ -#include "tdatablock.h" -#include "vnode.h" +#include "vnodeInt.h" STqReadHandle* tqInitSubmitMsgScanner(SMeta* pMeta) { STqReadHandle* pReadHandle = taosMemoryMalloc(sizeof(STqReadHandle)); @@ -88,7 +87,7 @@ int tqRetrieveDataBlockInfo(STqReadHandle* pHandle, SDataBlockInfo* pBlockInfo) pBlockInfo->numOfCols = taosArrayGetSize(pHandle->pColIdList); pBlockInfo->rows = pHandle->pBlock->numOfRows; -// pBlockInfo->uid = pHandle->pBlock->uid; // the uid can not be assigned to pBlockData. + // pBlockInfo->uid = pHandle->pBlock->uid; // the uid can not be assigned to pBlockData. return 0; } @@ -177,3 +176,41 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { } return pArray; } + +void tqReadHandleSetColIdList(STqReadHandle* pReadHandle, SArray* pColIdList) { pReadHandle->pColIdList = pColIdList; } + +int tqReadHandleSetTbUidList(STqReadHandle* pHandle, const SArray* tbUidList) { + if (pHandle->tbIdHash) { + taosHashClear(pHandle->tbIdHash); + } + + pHandle->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); + if (pHandle->tbIdHash == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + for (int i = 0; i < taosArrayGetSize(tbUidList); i++) { + int64_t* pKey = (int64_t*)taosArrayGet(tbUidList, i); + taosHashPut(pHandle->tbIdHash, pKey, sizeof(int64_t), NULL, 0); + } + + return 0; +} + +int tqReadHandleAddTbUidList(STqReadHandle* pHandle, const SArray* tbUidList) { + if (pHandle->tbIdHash == NULL) { + pHandle->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); + if (pHandle->tbIdHash == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + + for (int i = 0; i < taosArrayGetSize(tbUidList); i++) { + int64_t* pKey = (int64_t*)taosArrayGet(tbUidList, i); + taosHashPut(pHandle->tbIdHash, pKey, sizeof(int64_t), NULL, 0); + } + + return 0; +} diff --git a/source/dnode/vnode/src/tsdb/tsdbBDBImpl.c b/source/dnode/vnode/src/tsdb/tsdbBDBImpl.c index 0deef2e4c9..acd9c2dcaa 100644 --- a/source/dnode/vnode/src/tsdb/tsdbBDBImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbBDBImpl.c @@ -16,9 +16,7 @@ #define ALLOW_FORBID_FUNC #include "db.h" -#include "taoserror.h" -#include "tcoding.h" -#include "thash.h" +#include "vnodeInt.h" #define IMPL_WITH_LOCK 1 @@ -139,7 +137,7 @@ int32_t tsdbSaveSmaToDB(SDBFile *pDBF, void *key, uint32_t keySize, void *data, return 0; } -void *tsdbGetSmaDataByKey(SDBFile *pDBF, void* key, uint32_t keySize, uint32_t *valueSize) { +void *tsdbGetSmaDataByKey(SDBFile *pDBF, void *key, uint32_t keySize, uint32_t *valueSize) { void *result = NULL; DBT key1 = {0}; DBT value1 = {0}; diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index eff350ddda..bd3888864d 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -13,9 +13,7 @@ * along with this program. If not, see . */ -#include #include "vnodeInt.h" -#include "os.h" typedef enum { TSDB_TXN_TEMP_FILE = 0, TSDB_TXN_CURR_FILE } TSDB_TXN_FILE_T; static const char *tsdbTxnFname[] = {"current.t", "current"}; @@ -97,8 +95,8 @@ static int tsdbEncodeDFileSetArray(void **buf, SArray *pArray) { return tlen; } -static void *tsdbDecodeDFileSetArray(STsdb*pRepo, void *buf, SArray *pArray) { - uint64_t nset = 0; +static void *tsdbDecodeDFileSetArray(STsdb *pRepo, void *buf, SArray *pArray) { + uint64_t nset = 0; taosArrayClear(pArray); @@ -122,7 +120,7 @@ static int tsdbEncodeFSStatus(void **buf, SFSStatus *pStatus) { return tlen; } -static void *tsdbDecodeFSStatus(STsdb*pRepo, void *buf, SFSStatus *pStatus) { +static void *tsdbDecodeFSStatus(STsdb *pRepo, void *buf, SFSStatus *pStatus) { tsdbResetFSStatus(pStatus); // pStatus->pmf = &(pStatus->mf); @@ -407,8 +405,8 @@ int tsdbUpdateDFileSet(STsdbFS *pfs, const SDFileSet *pSet) { return tsdbAddDFil static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) { SFSHeader fsheader; - void * pBuf = NULL; - void * ptr; + void *pBuf = NULL; + void *ptr; char hbuf[TSDB_FILE_HEAD_SIZE] = "\0"; char tfname[TSDB_FILENAME_LEN] = "\0"; char cfname[TSDB_FILENAME_LEN] = "\0"; @@ -592,7 +590,7 @@ void tsdbFSIterSeek(SFSIter *pIter, int fid) { } SDFileSet *tsdbFSIterNext(SFSIter *pIter) { - STsdbFS * pfs = pIter->pfs; + STsdbFS *pfs = pIter->pfs; SDFileSet *pSet; if (pIter->index < 0) { @@ -651,12 +649,12 @@ static void tsdbGetTxnFname(STsdb *pRepo, TSDB_TXN_FILE_T ftype, char fname[]) { } static int tsdbOpenFSFromCurrent(STsdb *pRepo) { - STsdbFS * pfs = REPO_FS(pRepo); + STsdbFS *pfs = REPO_FS(pRepo); TdFilePtr pFile = NULL; - void * buffer = NULL; + void *buffer = NULL; SFSHeader fsheader; char current[TSDB_FILENAME_LEN] = "\0"; - void * ptr; + void *ptr; tsdbGetTxnFname(pRepo, TSDB_TXN_CURR_FILE, current); @@ -746,7 +744,7 @@ _err: // Scan and try to fix incorrect files static int tsdbScanAndTryFixFS(STsdb *pRepo) { - STsdbFS * pfs = REPO_FS(pRepo); + STsdbFS *pfs = REPO_FS(pRepo); SFSStatus *pStatus = pfs->cstatus; // if (tsdbScanAndTryFixMFile(pRepo) < 0) { @@ -908,9 +906,9 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) { // } static int tsdbScanRootDir(STsdb *pRepo) { - char rootDir[TSDB_FILENAME_LEN]; - char bname[TSDB_FILENAME_LEN]; - STsdbFS * pfs = REPO_FS(pRepo); + char rootDir[TSDB_FILENAME_LEN]; + char bname[TSDB_FILENAME_LEN]; + STsdbFS *pfs = REPO_FS(pRepo); const STfsFile *pf; tsdbGetRootDir(REPO_ID(pRepo), rootDir); @@ -942,9 +940,9 @@ static int tsdbScanRootDir(STsdb *pRepo) { } static int tsdbScanDataDir(STsdb *pRepo) { - char dataDir[TSDB_FILENAME_LEN]; - char bname[TSDB_FILENAME_LEN]; - STsdbFS * pfs = REPO_FS(pRepo); + char dataDir[TSDB_FILENAME_LEN]; + char bname[TSDB_FILENAME_LEN]; + STsdbFS *pfs = REPO_FS(pRepo); const STfsFile *pf; tsdbGetDataDir(REPO_ID(pRepo), dataDir); @@ -1107,14 +1105,14 @@ static bool tsdbIsTFileInFS(STsdbFS *pfs, const STfsFile *pf) { // } static int tsdbRestoreDFileSet(STsdb *pRepo) { - char dataDir[TSDB_FILENAME_LEN]; - char bname[TSDB_FILENAME_LEN]; - STfsDir * tdir = NULL; + char dataDir[TSDB_FILENAME_LEN]; + char bname[TSDB_FILENAME_LEN]; + STfsDir *tdir = NULL; const STfsFile *pf = NULL; - const char * pattern = "^v[0-9]+f[0-9]+\\.(head|data|last|smad|smal)(-ver[0-9]+)?$"; - SArray * fArray = NULL; - regex_t regex; - STsdbFS * pfs = REPO_FS(pRepo); + const char *pattern = "^v[0-9]+f[0-9]+\\.(head|data|last|smad|smal)(-ver[0-9]+)?$"; + SArray *fArray = NULL; + regex_t regex; + STsdbFS *pfs = REPO_FS(pRepo); tsdbGetDataDir(REPO_ID(pRepo), dataDir); @@ -1327,7 +1325,7 @@ static int tsdbComparTFILE(const void *arg1, const void *arg2) { } static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) { - STsdbFS * pfs = REPO_FS(pRepo); + STsdbFS *pfs = REPO_FS(pRepo); SFSStatus *pStatus = pfs->cstatus; SDFInfo info; diff --git a/source/dnode/vnode/src/tsdb/tsdbOptions.c b/source/dnode/vnode/src/tsdb/tsdbOptions.c index da7a1d393f..2c57a7406e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOptions.c +++ b/source/dnode/vnode/src/tsdb/tsdbOptions.c @@ -26,15 +26,6 @@ const STsdbCfg defautlTsdbOptions = {.precision = 0, .update = 0, .compression = TWO_STAGE_COMP}; -int tsdbOptionsInit(STsdbCfg *pTsdbOptions) { - // TODO - return 0; -} - -void tsdbOptionsClear(STsdbCfg *pTsdbOptions) { - // TODO -} - int tsdbValidateOptions(const STsdbCfg *pTsdbOptions) { // TODO return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 550e7cd183..9509dfa462 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -13,18 +13,6 @@ * along with this program. If not, see . */ -#include "os.h" -#include "talgo.h" -#include "tcompare.h" -#include "tdatablock.h" -#include "tdataformat.h" -#include "texception.h" -#include "vnodeInt.h" - -#include "filter.h" -#include "taosdef.h" -#include "tlosertree.h" -#include "tmsg.h" #include "vnodeInt.h" #define EXTRA_BYTES 2 diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 4a70738e86..ef417cabc6 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -18,13 +18,6 @@ const SVnodeCfg defaultVnodeOptions = { .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; /* TODO */ -void vnodeOptionsInit(SVnodeCfg *pVnodeOptions) { /* TODO */ - vnodeOptionsCopy(pVnodeOptions, &defaultVnodeOptions); -} - -void vnodeOptionsClear(SVnodeCfg *pVnodeOptions) { /* TODO */ -} - int vnodeValidateOptions(const SVnodeCfg *pVnodeOptions) { // TODO return 0; @@ -36,14 +29,14 @@ void vnodeOptionsCopy(SVnodeCfg *pDest, const SVnodeCfg *pSrc) { int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName) { uint32_t hashValue = 0; - + switch (pVnodeOptions->hashMethod) { default: hashValue = MurmurHash3_32(tableFName, strlen(tableFName)); break; } - // TODO OPEN THIS !!!!!!! + // TODO OPEN THIS !!!!!!! #if 0 if (hashValue < pVnodeOptions->hashBegin || hashValue > pVnodeOptions->hashEnd) { terrno = TSDB_CODE_VND_HASH_MISMATCH; @@ -53,5 +46,3 @@ int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName) { return TSDB_CODE_SUCCESS; } - - diff --git a/source/dnode/vnode/src/vnd/vnodeInt.c b/source/dnode/vnode/src/vnd/vnodeInt.c index 24294c4b58..270dc377b9 100644 --- a/source/dnode/vnode/src/vnd/vnodeInt.c +++ b/source/dnode/vnode/src/vnd/vnodeInt.c @@ -14,7 +14,6 @@ */ #define _DEFAULT_SOURCE -#include "sync.h" #include "vnodeInt.h" // #include "vnodeInt.h" diff --git a/source/dnode/vnode/src/vnd/vnodeMgr.c b/source/dnode/vnode/src/vnd/vnodeMgr.c index 40f43bcd12..df5e2ceffa 100644 --- a/source/dnode/vnode/src/vnd/vnodeMgr.c +++ b/source/dnode/vnode/src/vnd/vnodeMgr.c @@ -14,7 +14,6 @@ */ #include "vnodeInt.h" -#include "tglobal.h" SVnodeMgr vnodeMgr = {.vnodeInitFlag = TD_MOD_UNINITIALIZED}; diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index f56ded9f15..87ce471de9 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -13,10 +13,8 @@ * along with this program. If not, see . */ -#include "executor.h" #include "vnodeInt.h" -static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg); static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg); int vnodeQueryOpen(SVnode *pVnode) { @@ -57,11 +55,6 @@ int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg); case TDMT_VND_DROP_TASK: return qWorkerProcessDropMsg(pVnode, pVnode->pQuery, pMsg); - case TDMT_VND_SHOW_TABLES: - return qWorkerProcessShowMsg(pVnode, pVnode->pQuery, pMsg); - case TDMT_VND_SHOW_TABLES_FETCH: - return vnodeGetTableList(pVnode, pMsg); - // return qWorkerProcessShowFetchMsg(pVnode->pMeta, pVnode->pQuery, pMsg); case TDMT_VND_TABLE_META: return vnodeGetTableMeta(pVnode, pMsg); case TDMT_VND_CONSUME: @@ -207,74 +200,3 @@ _exit: tmsgSendRsp(&rpcMsg); return TSDB_CODE_SUCCESS; } - -static void freeItemHelper(void *pItem) { - char *p = *(char **)pItem; - taosMemoryFree(p); -} - -/** - * @param pVnode - * @param pMsg - * @param pRsp - */ -static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) { - SMTbCursor *pCur = metaOpenTbCursor(pVnode->pMeta); - SArray *pArray = taosArrayInit(10, POINTER_BYTES); - - char *name = NULL; - int32_t totalLen = 0; - int32_t numOfTables = 0; - while ((name = metaTbCursorNext(pCur)) != NULL) { - if (numOfTables < 10000) { // TODO: temp get tables of vnode, and should del when show tables commad ok. - taosArrayPush(pArray, &name); - totalLen += strlen(name); - } else { - taosMemoryFreeClear(name); - } - - numOfTables++; - } - - // TODO: temp debug, and should del when show tables command ok - vInfo("====vgId:%d, numOfTables: %d", pVnode->vgId, numOfTables); - if (numOfTables > 10000) { - numOfTables = 10000; - } - - metaCloseTbCursor(pCur); - - int32_t rowLen = - (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) + 8 + 2 + (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) + 8 + 4; - // int32_t numOfTables = (int32_t)taosArrayGetSize(pArray); - - int32_t payloadLen = rowLen * numOfTables; - // SVShowTablesFetchReq *pFetchReq = pMsg->pCont; - - SVShowTablesFetchRsp *pFetchRsp = (SVShowTablesFetchRsp *)rpcMallocCont(sizeof(SVShowTablesFetchRsp) + payloadLen); - memset(pFetchRsp, 0, sizeof(SVShowTablesFetchRsp) + payloadLen); - - char *p = pFetchRsp->data; - for (int32_t i = 0; i < numOfTables; ++i) { - char *n = taosArrayGetP(pArray, i); - STR_TO_VARSTR(p, n); - - p += (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE); - // taosMemoryFree(n); - } - - pFetchRsp->numOfRows = htonl(numOfTables); - pFetchRsp->precision = 0; - - SRpcMsg rpcMsg = { - .handle = pMsg->handle, - .ahandle = pMsg->ahandle, - .pCont = pFetchRsp, - .contLen = sizeof(SVShowTablesFetchRsp) + payloadLen, - .code = 0, - }; - - tmsgSendRsp(&rpcMsg); - taosArrayDestroyEx(pArray, freeItemHelper); - return 0; -} diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 0449319dc2..24b5d4bae5 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -81,7 +81,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // TODO: to encapsule a free API taosMemoryFree(vCreateTbReq.stbCfg.pSchema); taosMemoryFree(vCreateTbReq.stbCfg.pTagSchema); - if(vCreateTbReq.stbCfg.pRSmaParam) { + if (vCreateTbReq.stbCfg.pRSmaParam) { taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam->pFuncIds); taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam); } @@ -235,13 +235,13 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { if (tsdbCreateTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { // TODO } - // } break; - // case TDMT_VND_CANCEL_SMA: { // timeRangeSMA - // } break; - // case TDMT_VND_DROP_SMA: { // timeRangeSMA - // if (tsdbDropTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { - // // TODO - // } + // } break; + // case TDMT_VND_CANCEL_SMA: { // timeRangeSMA + // } break; + // case TDMT_VND_DROP_SMA: { // timeRangeSMA + // if (tsdbDropTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { + // // TODO + // } #if 0 tsdbTSmaSub(pVnode->pTsdb, 1); SVDropTSmaReq vDropSmaReq = {0}; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 37bc4b771f..cb787e77a6 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -451,13 +451,13 @@ typedef struct SSysTableScanInfo { int32_t accountId; bool showRewrite; - SNode* pCondition; // db_name filter condition, to discard data that are not in current database + SNode *pCondition; // db_name filter condition, to discard data that are not in current database void *pCur; // cursor for iterate the local table meta store. SArray *scanCols; // SArray scan column id list int32_t type; // show type, TODO remove it SName name; - SSDataBlock* pRes; + SSDataBlock *pRes; int32_t capacity; int64_t numOfBlocks; // extract basic running information. SLoadRemoteDataInfo loadInfo; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 0eac507822..afcffa3d28 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -173,12 +173,12 @@ static void getNextTimeWindow(SInterval* pInterval, int32_t precision, int32_t o int mon = (int)(tm.tm_year * 12 + tm.tm_mon + interval * factor); tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - tw->skey = convertTimePrecision((int64_t)mktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, precision); + tw->skey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, precision); mon = (int)(mon + interval); tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - tw->ekey = convertTimePrecision((int64_t)mktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, precision); + tw->ekey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, precision); tw->ekey -= 1; } @@ -4007,10 +4007,9 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf return TSDB_CODE_SUCCESS; } -// TODO if only one or two columnss required, how to extract data? -int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, - char* pData, int32_t compLen, int32_t numOfOutput, int64_t startTs, - uint64_t* total, SArray* pColList) { +// TODO if only one or two columns required, how to extract data? +int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, char* pData, + int32_t compLen, int32_t numOfOutput, int64_t startTs, uint64_t* total, SArray* pColList) { blockDataEnsureCapacity(pRes, numOfRows); if (pColList == NULL) { // data from other sources @@ -4040,18 +4039,70 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI } } else { // extract data according to pColList ASSERT(numOfOutput == taosArrayGetSize(pColList)); + char* pStart = pData; + + int32_t numOfCols = htonl(*(int32_t*)pStart); + pStart += sizeof(int32_t); + + SSysTableSchema* pSchema = (SSysTableSchema*)pStart; + for(int32_t i = 0; i < numOfCols; ++i) { + SSysTableSchema* p = (SSysTableSchema*)pStart; + + p->colId = htons(p->colId); + p->bytes = htonl(p->bytes); + pStart += sizeof(SSysTableSchema); + } + + SSDataBlock block = {.pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData)), .info.numOfCols = numOfCols}; + for(int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData idata = {0}; + idata.info.type = pSchema[i].type; + idata.info.bytes = pSchema[i].bytes; + idata.info.colId = pSchema[i].colId; + + taosArrayPush(block.pDataBlock, &idata); + if (IS_VAR_DATA_TYPE(idata.info.type)) { + block.info.hasVarCol = true; + } + } + + blockDataEnsureCapacity(&block, numOfRows); + + int32_t* colLen = (int32_t*) pStart; + pStart += sizeof(int32_t) * numOfCols; + + for (int32_t i = 0; i < numOfCols; ++i) { + colLen[i] = htonl(colLen[i]); + ASSERT(colLen[i] >= 0); + + SColumnInfoData* pColInfoData = taosArrayGet(block.pDataBlock, i); + if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { + pColInfoData->varmeta.length = colLen[i]; + pColInfoData->varmeta.allocLen = colLen[i]; + + memcpy(pColInfoData->varmeta.offset, pStart, sizeof(int32_t) * numOfRows); + pStart += sizeof(int32_t) * numOfRows; + + pColInfoData->pData = taosMemoryMalloc(colLen[i]); + } else { + memcpy(pColInfoData->nullbitmap, pStart, BitmapLen(numOfRows)); + pStart += BitmapLen(numOfRows); + } + + memcpy(pColInfoData->pData, pStart, colLen[i]); + pStart += colLen[i]; + } // data from mnode - for (int32_t i = 0; i < numOfOutput; ++i) { + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* pSrc = taosArrayGet(block.pDataBlock, i); + for (int32_t j = 0; j < numOfOutput; ++j) { int16_t colIndex = *(int16_t*)taosArrayGet(pColList, j); + if (colIndex - 1 == i) { SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, j); - - for (int32_t k = 0; k < numOfRows; ++k) { - colDataAppend(pColInfoData, k, pData, false); - pData += pColInfoData->info.bytes; - } + colDataAssign(pColInfoData, pSrc, numOfRows); break; } } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 3ce84077f1..f7f1d470bb 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -685,6 +685,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) { int64_t startTs = taosGetTimestampUs(); + _retry: pInfo->req.type = pInfo->type; strncpy(pInfo->req.tb, tNameGetTableName(&pInfo->name), tListLen(pInfo->req.tb)); if (pInfo->showRewrite) { @@ -738,7 +739,12 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) { setSDataBlockFromFetchRsp(pInfo->pRes, &pInfo->loadInfo, pTableRsp->numOfRows, pTableRsp->data, pTableRsp->compLen, pOperator->numOfOutput, startTs, NULL, pInfo->scanCols); - return doFilterResult(pInfo); + doFilterResult(pInfo); + if (pInfo->pRes->info.rows == 0) { + goto _retry; + } + + return pInfo->pRes; } return NULL; @@ -756,12 +762,12 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB return NULL; } - pInfo->accountId = accountId; + pInfo->accountId = accountId; pInfo->showRewrite = showRewrite; - pInfo->pRes = pResBlock; - pInfo->capacity = 4096; - pInfo->pCondition = pCondition; - pInfo->scanCols = colList; + pInfo->pRes = pResBlock; + pInfo->capacity = 4096; + pInfo->pCondition = pCondition; + pInfo->scanCols = colList; // TODO remove it int32_t tableType = 0; @@ -772,6 +778,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB tableType = TSDB_MGMT_TABLE_USER; } else if (strncasecmp(name, TSDB_INS_TABLE_DNODES, tListLen(pName->tname)) == 0) { tableType = TSDB_MGMT_TABLE_DNODE; + } else if (strncasecmp(name, TSDB_INS_TABLE_LICENCES, tListLen(pName->tname)) == 0) { + tableType = TSDB_MGMT_TABLE_GRANTS; } else if (strncasecmp(name, TSDB_INS_TABLE_MNODES, tListLen(pName->tname)) == 0) { tableType = TSDB_MGMT_TABLE_MNODE; } else if (strncasecmp(name, TSDB_INS_TABLE_MODULES, tListLen(pName->tname)) == 0) { @@ -796,6 +804,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB tableType = TSDB_MGMT_TABLE_VGROUP; } else if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, tListLen(pName->tname)) == 0) { // tableType = TSDB_MGMT_TABLE_DIST; + } else if (strncasecmp(name, TSDB_INS_TABLE_CLUSTER, tListLen(pName->tname)) == 0) { + tableType = TSDB_MGMT_TABLE_CLUSTER; } else { ASSERT(0); } @@ -833,15 +843,15 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB #endif } - pOperator->name = "SysTableScanOperator"; + pOperator->name = "SysTableScanOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN; pOperator->blockingOptr = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->numOfOutput = pResBlock->info.numOfCols; - pOperator->getNextFn = doSysTableScan; - pOperator->closeFn = destroySysScanOperator; - pOperator->pTaskInfo = pTaskInfo; + pOperator->status = OP_NOT_OPENED; + pOperator->info = pInfo; + pOperator->numOfOutput = pResBlock->info.numOfCols; + pOperator->getNextFn = doSysTableScan; + pOperator->closeFn = destroySysScanOperator; + pOperator->pTaskInfo = pTaskInfo; return pOperator; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 8e294f55a9..3c3cea8ea3 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -582,6 +582,7 @@ column_reference(A) ::= column_name(B). column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 81831ab164..9e53eee5c8 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -312,6 +312,8 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time if (pToken->type == TK_NOW) { ts = taosGetTimestamp(timePrec); + } else if (pToken->type == TK_TODAY) { + ts = taosGetTimestampToday(timePrec); } else if (pToken->type == TK_NK_INTEGER) { bool isSigned = false; toInteger(pToken->z, pToken->n, 10, &ts, &isSigned); @@ -376,8 +378,8 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time } static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, uint32_t type, char* tmpTokenBuf, SMsgBuf* pMsgBuf) { - if ((pToken->type != TK_NOW && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL && - pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NK_BIN) || + if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && + pToken->type != TK_NK_BOOL && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NK_BIN) || (pToken->n == 0) || (pToken->type == TK_NK_RP)) { return buildSyntaxErrMsg(pMsgBuf, "invalid data or symbol", pToken->z); } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 5c2f10f810..0493771b61 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -175,6 +175,7 @@ static SKeyword keywordTable[] = { {"TBNAME", TK_TBNAME}, {"TIMESTAMP", TK_TIMESTAMP}, {"TINYINT", TK_TINYINT}, + {"TODAY", TK_TODAY}, {"TOPIC", TK_TOPIC}, {"TOPICS", TK_TOPICS}, {"TSERIES", TK_TSERIES}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index fa91691acc..e2fcbb52d2 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2363,7 +2363,6 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { break; case QUERY_NODE_SHOW_APPS_STMT: case QUERY_NODE_SHOW_CONNECTIONS_STMT: - case QUERY_NODE_SHOW_LICENCE_STMT: case QUERY_NODE_SHOW_QUERIES_STMT: case QUERY_NODE_SHOW_SCORES_STMT: case QUERY_NODE_SHOW_TOPICS_STMT: @@ -2551,6 +2550,8 @@ static const char* getSysTableName(ENodeType type) { return TSDB_INS_TABLE_BNODES; case QUERY_NODE_SHOW_SNODES_STMT: return TSDB_INS_TABLE_SNODES; + case QUERY_NODE_SHOW_LICENCE_STMT: + return TSDB_INS_TABLE_LICENCES; default: break; } @@ -3058,6 +3059,7 @@ static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pQuery->pRoot)) { + case QUERY_NODE_SHOW_LICENCE_STMT: case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_TABLES_STMT: case QUERY_NODE_SHOW_STABLES_STMT: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 7e71f6ef0b..c559ad9192 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 315 +#define YYNOCODE 316 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SToken yy29; - bool yy47; - EFillMode yy144; - EJoinType yy162; - SNode* yy182; - EOrder yy218; - SNodeList* yy334; - EOperatorType yy380; - ENullOrder yy487; - SAlterOption yy515; - int32_t yy550; - SDataType yy574; + SAlterOption yy21; + EFillMode yy22; + EOperatorType yy84; + bool yy121; + SDataType yy160; + ENullOrder yy281; + SToken yy409; + int32_t yy452; + SNodeList* yy488; + SNode* yy504; + EOrder yy522; + EJoinType yy556; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -133,16 +133,16 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYNSTATE 550 -#define YYNRULE 410 -#define YYNTOKEN 209 +#define YYNRULE 411 +#define YYNTOKEN 210 #define YY_MAX_SHIFT 549 -#define YY_MIN_SHIFTREDUCE 809 -#define YY_MAX_SHIFTREDUCE 1218 -#define YY_ERROR_ACTION 1219 -#define YY_ACCEPT_ACTION 1220 -#define YY_NO_ACTION 1221 -#define YY_MIN_REDUCE 1222 -#define YY_MAX_REDUCE 1631 +#define YY_MIN_SHIFTREDUCE 810 +#define YY_MAX_SHIFTREDUCE 1220 +#define YY_ERROR_ACTION 1221 +#define YY_ACCEPT_ACTION 1222 +#define YY_NO_ACTION 1223 +#define YY_MIN_REDUCE 1224 +#define YY_MAX_REDUCE 1634 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,485 +209,487 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1550) +#define YY_ACTTAB_COUNT (1556) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 452, 258, 1483, 270, 25, 195, 1432, 118, 123, 1234, - /* 10 */ 313, 1331, 30, 28, 1479, 1486, 307, 1499, 1483, 1382, - /* 20 */ 267, 464, 1054, 21, 1076, 32, 31, 29, 27, 26, - /* 30 */ 1479, 1485, 23, 32, 31, 29, 27, 26, 1052, 275, - /* 40 */ 239, 1516, 32, 31, 29, 27, 26, 1610, 447, 1074, - /* 50 */ 11, 30, 28, 1161, 349, 407, 1483, 1059, 451, 267, - /* 60 */ 132, 1054, 1470, 1320, 1608, 30, 28, 435, 1479, 1485, - /* 70 */ 431, 9, 8, 267, 1, 1054, 465, 1052, 69, 1500, - /* 80 */ 1501, 1505, 1549, 542, 541, 73, 241, 1545, 1175, 11, - /* 90 */ 1499, 1052, 370, 425, 452, 101, 1059, 546, 1610, 408, - /* 100 */ 1433, 1342, 1261, 11, 32, 31, 29, 27, 26, 1053, - /* 110 */ 1059, 132, 349, 1, 1516, 1608, 32, 31, 29, 27, - /* 120 */ 26, 434, 119, 1389, 385, 278, 1300, 1, 99, 257, - /* 130 */ 1610, 451, 1423, 1425, 1387, 1470, 546, 433, 128, 1556, - /* 140 */ 1557, 271, 1561, 132, 500, 1137, 1055, 1608, 1053, 116, - /* 150 */ 546, 70, 1500, 1501, 1505, 1549, 846, 1344, 845, 260, - /* 160 */ 1545, 127, 1053, 1058, 1078, 1079, 449, 1105, 1106, 1107, - /* 170 */ 1108, 1109, 1110, 1111, 1112, 165, 847, 382, 381, 373, - /* 180 */ 1577, 464, 1563, 1220, 85, 1055, 133, 84, 83, 82, - /* 190 */ 81, 80, 79, 78, 77, 76, 29, 27, 26, 1055, - /* 200 */ 1560, 375, 1058, 1078, 1079, 449, 1105, 1106, 1107, 1108, - /* 210 */ 1109, 1110, 1111, 1112, 1319, 133, 1058, 1078, 1079, 449, - /* 220 */ 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1318, 30, - /* 230 */ 28, 549, 306, 1563, 305, 12, 283, 267, 384, 1054, - /* 240 */ 378, 897, 133, 1215, 383, 214, 464, 98, 96, 379, - /* 250 */ 377, 1559, 380, 116, 538, 1052, 534, 530, 526, 213, - /* 260 */ 899, 1345, 32, 31, 29, 27, 26, 1610, 30, 28, - /* 270 */ 450, 1499, 465, 133, 1059, 210, 267, 500, 1054, 496, - /* 280 */ 132, 311, 30, 28, 1608, 67, 53, 1077, 207, 1075, - /* 290 */ 267, 7, 1054, 1333, 1052, 1516, 66, 1342, 1516, 97, - /* 300 */ 12, 498, 434, 1245, 335, 447, 465, 1337, 1052, 491, - /* 310 */ 102, 1214, 451, 1059, 546, 312, 1470, 1334, 461, 439, - /* 320 */ 495, 494, 493, 1185, 492, 1093, 1053, 1059, 515, 513, - /* 330 */ 7, 1342, 70, 1500, 1501, 1505, 1549, 424, 1470, 396, - /* 340 */ 260, 1545, 127, 1274, 7, 1222, 413, 133, 1470, 172, - /* 350 */ 142, 141, 394, 546, 191, 418, 1183, 1184, 1186, 1187, - /* 360 */ 414, 1576, 502, 1055, 1038, 1053, 169, 546, 1244, 94, - /* 370 */ 93, 92, 91, 90, 89, 88, 87, 86, 1327, 1053, - /* 380 */ 1058, 1078, 1079, 449, 1105, 1106, 1107, 1108, 1109, 1110, - /* 390 */ 1111, 1112, 1080, 431, 1389, 384, 53, 378, 1610, 1329, - /* 400 */ 272, 383, 1055, 133, 98, 1387, 379, 377, 1243, 380, - /* 410 */ 1242, 1609, 406, 1470, 1241, 1608, 1055, 1338, 101, 1058, - /* 420 */ 1078, 1079, 449, 1105, 1106, 1107, 1108, 1109, 1110, 1111, - /* 430 */ 1112, 1078, 1079, 1058, 1078, 1079, 449, 1105, 1106, 1107, - /* 440 */ 1108, 1109, 1110, 1111, 1112, 431, 30, 28, 238, 421, - /* 450 */ 1074, 99, 440, 1470, 267, 1470, 1054, 328, 60, 1470, - /* 460 */ 340, 129, 1556, 1557, 1420, 1561, 1081, 1160, 398, 341, - /* 470 */ 101, 140, 1052, 32, 31, 29, 27, 26, 438, 1335, - /* 480 */ 935, 488, 487, 486, 939, 485, 941, 942, 484, 944, - /* 490 */ 481, 1059, 950, 478, 952, 953, 475, 472, 1223, 1610, - /* 500 */ 1568, 1156, 1563, 99, 426, 422, 9, 8, 1, 465, - /* 510 */ 190, 242, 132, 130, 1556, 1557, 1608, 1561, 320, 85, - /* 520 */ 1558, 1240, 84, 83, 82, 81, 80, 79, 78, 77, - /* 530 */ 76, 546, 217, 1325, 1342, 1372, 1093, 32, 31, 29, - /* 540 */ 27, 26, 339, 1053, 1124, 334, 333, 332, 331, 330, - /* 550 */ 1239, 327, 326, 325, 324, 323, 319, 318, 317, 316, - /* 560 */ 315, 314, 1271, 138, 117, 465, 1470, 1238, 503, 223, - /* 570 */ 1314, 1389, 1389, 6, 321, 32, 31, 29, 27, 26, - /* 580 */ 1055, 221, 1424, 1388, 176, 1168, 170, 448, 1237, 51, - /* 590 */ 1342, 1076, 50, 1125, 143, 1470, 490, 1058, 1078, 1079, - /* 600 */ 449, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1235, - /* 610 */ 1236, 1129, 1470, 242, 522, 521, 520, 519, 282, 1233, + /* 0 */ 452, 258, 1485, 270, 275, 452, 1434, 25, 195, 313, + /* 10 */ 465, 1435, 30, 28, 1481, 1488, 307, 1501, 1485, 311, + /* 20 */ 267, 1485, 1055, 1613, 1335, 32, 31, 29, 27, 26, + /* 30 */ 1481, 1487, 21, 1481, 1487, 1344, 1612, 1078, 1053, 239, + /* 40 */ 1611, 1518, 32, 31, 29, 27, 26, 1613, 447, 464, + /* 50 */ 11, 30, 28, 1163, 118, 407, 1236, 1060, 451, 267, + /* 60 */ 132, 1055, 1472, 1162, 1611, 30, 28, 435, 165, 1472, + /* 70 */ 431, 1075, 373, 267, 1, 1055, 465, 1053, 69, 1502, + /* 80 */ 1503, 1507, 1552, 542, 541, 73, 241, 1548, 1177, 11, + /* 90 */ 1501, 1053, 370, 1518, 375, 101, 1060, 546, 1613, 408, + /* 100 */ 447, 1344, 446, 11, 32, 31, 29, 27, 26, 1054, + /* 110 */ 1060, 132, 23, 1, 1518, 1611, 32, 31, 29, 27, + /* 120 */ 26, 434, 32, 31, 29, 27, 26, 1, 99, 119, + /* 130 */ 1613, 451, 424, 1302, 123, 1472, 546, 433, 128, 1559, + /* 140 */ 1560, 1077, 1564, 132, 464, 1384, 1056, 1611, 1054, 278, + /* 150 */ 546, 70, 1502, 1503, 1507, 1552, 1425, 1427, 349, 260, + /* 160 */ 1548, 127, 1054, 1059, 1079, 1080, 449, 1106, 1107, 1108, + /* 170 */ 1109, 1110, 1111, 1112, 1113, 1114, 29, 27, 26, 1094, + /* 180 */ 1580, 1079, 1080, 1222, 425, 1056, 85, 133, 1276, 84, + /* 190 */ 83, 82, 81, 80, 79, 78, 77, 76, 12, 1056, + /* 200 */ 382, 381, 1059, 1079, 1080, 449, 1106, 1107, 1108, 1109, + /* 210 */ 1110, 1111, 1112, 1113, 1114, 1118, 1059, 1079, 1080, 449, + /* 220 */ 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 30, + /* 230 */ 28, 1217, 442, 398, 1501, 53, 283, 267, 133, 1055, + /* 240 */ 384, 465, 378, 306, 1247, 305, 383, 1161, 97, 98, + /* 250 */ 73, 379, 377, 1322, 380, 1053, 1339, 376, 1518, 32, + /* 260 */ 31, 29, 27, 26, 1613, 434, 1344, 1613, 30, 28, + /* 270 */ 450, 1246, 1055, 133, 1060, 451, 267, 132, 1055, 1472, + /* 280 */ 132, 1611, 30, 28, 1611, 133, 421, 1501, 1053, 1472, + /* 290 */ 267, 7, 1055, 138, 1053, 70, 1502, 1503, 1507, 1552, + /* 300 */ 1216, 464, 349, 260, 1548, 127, 465, 1060, 1053, 1224, + /* 310 */ 898, 1518, 396, 1060, 546, 312, 1472, 191, 447, 51, + /* 320 */ 9, 8, 50, 414, 1579, 394, 1054, 1060, 451, 900, + /* 330 */ 7, 1344, 1472, 94, 93, 92, 91, 90, 89, 88, + /* 340 */ 87, 86, 426, 422, 7, 1225, 271, 546, 71, 1502, + /* 350 */ 1503, 1507, 1552, 546, 116, 12, 1551, 1548, 847, 1054, + /* 360 */ 846, 335, 1346, 1056, 500, 1054, 85, 546, 443, 84, + /* 370 */ 83, 82, 81, 80, 79, 78, 77, 76, 848, 1054, + /* 380 */ 1059, 1079, 1080, 449, 1106, 1107, 1108, 1109, 1110, 1111, + /* 390 */ 1112, 1113, 1114, 431, 1139, 1391, 1056, 32, 31, 29, + /* 400 */ 27, 26, 1056, 384, 133, 378, 1426, 142, 141, 383, + /* 410 */ 1245, 53, 98, 1059, 379, 377, 1056, 380, 101, 1059, + /* 420 */ 1079, 1080, 449, 1106, 1107, 1108, 1109, 1110, 1111, 1112, + /* 430 */ 1113, 1114, 1340, 1059, 1079, 1080, 449, 1106, 1107, 1108, + /* 440 */ 1109, 1110, 1111, 1112, 1113, 1114, 30, 28, 238, 438, + /* 450 */ 1075, 99, 1566, 1566, 267, 1472, 1055, 328, 60, 1422, + /* 460 */ 340, 129, 1559, 1560, 1244, 1564, 140, 1187, 133, 341, + /* 470 */ 1563, 1562, 1053, 32, 31, 29, 27, 26, 1076, 1337, + /* 480 */ 936, 488, 487, 486, 940, 485, 942, 943, 484, 945, + /* 490 */ 481, 1060, 951, 478, 953, 954, 475, 472, 389, 1391, + /* 500 */ 418, 1185, 1186, 1188, 1189, 257, 1391, 465, 1, 1472, + /* 510 */ 1389, 242, 465, 397, 431, 465, 320, 1390, 1243, 1571, + /* 520 */ 1158, 321, 1391, 115, 348, 465, 502, 167, 272, 1081, + /* 530 */ 392, 546, 1344, 1389, 1341, 386, 1094, 1344, 1082, 101, + /* 540 */ 1344, 166, 339, 1054, 1126, 334, 333, 332, 331, 330, + /* 550 */ 1344, 327, 326, 325, 324, 323, 319, 318, 317, 316, + /* 560 */ 315, 314, 1273, 1472, 117, 465, 503, 43, 1316, 223, + /* 570 */ 42, 66, 99, 1566, 462, 32, 31, 29, 27, 26, + /* 580 */ 1056, 221, 130, 1559, 1560, 102, 1564, 465, 6, 1242, + /* 590 */ 1344, 1561, 1336, 1127, 143, 491, 463, 1059, 1079, 1080, + /* 600 */ 449, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, + /* 610 */ 465, 1131, 1344, 242, 522, 521, 520, 519, 282, 209, /* 620 */ 518, 517, 516, 103, 511, 510, 509, 508, 507, 506, - /* 630 */ 505, 504, 109, 1470, 1232, 1499, 24, 265, 1119, 1120, - /* 640 */ 1121, 1122, 1123, 1127, 1128, 465, 1124, 465, 1231, 465, - /* 650 */ 1159, 845, 277, 465, 73, 1470, 348, 68, 1339, 1516, - /* 660 */ 116, 376, 462, 115, 1470, 280, 447, 368, 1344, 1256, - /* 670 */ 1342, 871, 1342, 116, 1342, 465, 451, 437, 1342, 1470, - /* 680 */ 1470, 1344, 1230, 1229, 463, 49, 48, 310, 1499, 137, - /* 690 */ 872, 387, 465, 1470, 304, 1125, 120, 1500, 1501, 1505, - /* 700 */ 1342, 209, 247, 298, 296, 1389, 292, 288, 134, 1301, - /* 710 */ 514, 279, 1516, 1129, 301, 1156, 1387, 1342, 300, 447, - /* 720 */ 158, 1054, 465, 156, 1499, 1228, 1227, 1470, 1470, 451, - /* 730 */ 446, 281, 133, 1470, 436, 1623, 1126, 1052, 24, 265, - /* 740 */ 1119, 1120, 1121, 1122, 1123, 1127, 1128, 1342, 1516, 70, - /* 750 */ 1500, 1501, 1505, 1549, 1130, 447, 1059, 260, 1545, 1622, - /* 760 */ 1499, 1459, 1226, 153, 1225, 451, 126, 192, 1583, 1470, - /* 770 */ 1470, 1470, 366, 344, 362, 358, 354, 152, 160, 22, - /* 780 */ 162, 159, 419, 161, 1516, 70, 1500, 1501, 1505, 1549, - /* 790 */ 1254, 447, 442, 260, 1545, 1622, 546, 290, 1217, 1218, - /* 800 */ 1383, 451, 251, 54, 1606, 1470, 150, 1470, 1053, 1470, - /* 810 */ 1499, 164, 390, 107, 163, 45, 179, 410, 405, 1182, - /* 820 */ 181, 70, 1500, 1501, 1505, 1549, 1490, 185, 165, 260, - /* 830 */ 1545, 1622, 373, 367, 1516, 34, 1579, 1499, 1488, 1131, - /* 840 */ 1567, 447, 432, 1116, 252, 1055, 250, 249, 1062, 372, - /* 850 */ 1517, 451, 1499, 34, 375, 1470, 194, 1089, 1074, 1061, - /* 860 */ 435, 1516, 1058, 149, 2, 122, 34, 146, 447, 285, - /* 870 */ 1021, 229, 1500, 1501, 1505, 289, 1516, 198, 451, 1499, - /* 880 */ 246, 200, 1470, 447, 144, 95, 274, 273, 105, 457, - /* 890 */ 897, 1610, 206, 451, 248, 1030, 1067, 1470, 71, 1500, - /* 900 */ 1501, 1505, 1549, 1516, 132, 322, 1548, 1545, 1608, 215, - /* 910 */ 447, 1422, 1060, 71, 1500, 1501, 1505, 1549, 65, 1065, - /* 920 */ 451, 445, 1545, 431, 1470, 107, 329, 443, 62, 928, - /* 930 */ 1064, 1059, 45, 470, 105, 139, 923, 956, 960, 337, - /* 940 */ 71, 1500, 1501, 1505, 1549, 336, 106, 338, 101, 1546, - /* 950 */ 966, 1085, 342, 107, 105, 1499, 343, 965, 108, 1084, - /* 960 */ 145, 346, 345, 1083, 347, 350, 148, 435, 52, 151, - /* 970 */ 1082, 466, 369, 371, 1332, 155, 374, 1328, 75, 1516, - /* 980 */ 400, 99, 1499, 1063, 401, 402, 447, 256, 409, 157, - /* 990 */ 1499, 188, 1556, 430, 171, 429, 451, 174, 1610, 110, - /* 1000 */ 1470, 111, 1330, 266, 1326, 112, 1516, 113, 1081, 412, - /* 1010 */ 420, 132, 1590, 447, 1516, 1608, 234, 1500, 1501, 1505, - /* 1020 */ 1068, 447, 399, 451, 411, 455, 1059, 1470, 1580, 417, - /* 1030 */ 415, 451, 177, 180, 1499, 1470, 5, 1071, 1589, 416, - /* 1040 */ 259, 423, 428, 234, 1500, 1501, 1505, 4, 100, 1080, - /* 1050 */ 1570, 233, 1500, 1501, 1505, 186, 184, 1156, 1516, 125, - /* 1060 */ 1564, 35, 444, 261, 17, 447, 1431, 1531, 1499, 187, - /* 1070 */ 441, 1430, 458, 459, 61, 451, 1499, 453, 460, 1470, - /* 1080 */ 454, 1499, 269, 427, 202, 204, 1343, 468, 59, 222, - /* 1090 */ 1625, 1315, 1516, 212, 193, 120, 1500, 1501, 1505, 447, - /* 1100 */ 1516, 1607, 216, 497, 218, 1516, 545, 447, 224, 451, - /* 1110 */ 41, 1464, 447, 1470, 225, 220, 264, 451, 1463, 284, - /* 1120 */ 1460, 1470, 451, 1499, 268, 286, 1470, 1048, 1499, 234, - /* 1130 */ 1500, 1501, 1505, 389, 1624, 287, 1499, 234, 1500, 1501, - /* 1140 */ 1505, 1049, 226, 1500, 1501, 1505, 291, 1516, 397, 1458, - /* 1150 */ 135, 295, 1516, 293, 447, 294, 1457, 297, 1456, 447, - /* 1160 */ 1516, 299, 167, 1447, 451, 392, 136, 447, 1470, 451, - /* 1170 */ 386, 302, 303, 1470, 1317, 1441, 166, 451, 1033, 1032, - /* 1180 */ 1499, 1470, 1440, 308, 232, 1500, 1501, 1505, 309, 235, - /* 1190 */ 1500, 1501, 1505, 1439, 1438, 1499, 1004, 227, 1500, 1501, - /* 1200 */ 1505, 1415, 43, 1414, 1516, 42, 1499, 1413, 1412, 1411, - /* 1210 */ 1410, 447, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1516, - /* 1220 */ 1402, 451, 1401, 1400, 104, 1470, 447, 1399, 1398, 1397, - /* 1230 */ 1516, 1499, 1396, 1395, 1394, 210, 451, 447, 1393, 496, - /* 1240 */ 1470, 236, 1500, 1501, 1505, 1392, 1006, 451, 1391, 1390, - /* 1250 */ 1273, 1470, 1455, 1449, 1437, 1516, 228, 1500, 1501, 1505, - /* 1260 */ 1428, 498, 447, 1321, 147, 1499, 1272, 237, 1500, 1501, - /* 1270 */ 1505, 1270, 451, 351, 353, 352, 1470, 864, 1499, 1268, - /* 1280 */ 495, 494, 493, 357, 492, 355, 1266, 356, 1264, 1516, - /* 1290 */ 1253, 360, 1513, 1500, 1501, 1505, 447, 359, 1252, 361, - /* 1300 */ 363, 364, 1516, 1249, 365, 1323, 451, 973, 74, 447, - /* 1310 */ 1470, 154, 1499, 514, 971, 1322, 896, 512, 895, 451, - /* 1320 */ 1499, 894, 893, 1470, 1262, 1499, 1512, 1500, 1501, 1505, - /* 1330 */ 253, 890, 889, 1257, 254, 388, 1516, 1255, 255, 244, - /* 1340 */ 1500, 1501, 1505, 447, 1516, 391, 1248, 393, 1247, 1516, - /* 1350 */ 395, 447, 72, 451, 1454, 168, 447, 1470, 1040, 1448, - /* 1360 */ 403, 451, 114, 1436, 1435, 1470, 451, 1499, 1427, 55, - /* 1370 */ 1470, 124, 1499, 1511, 1500, 1501, 1505, 173, 14, 44, - /* 1380 */ 1499, 245, 1500, 1501, 1505, 3, 243, 1500, 1501, 1505, - /* 1390 */ 34, 1516, 178, 39, 15, 404, 1516, 121, 447, 1488, - /* 1400 */ 175, 1181, 38, 447, 1516, 182, 57, 183, 451, 19, - /* 1410 */ 1203, 447, 1470, 451, 1174, 56, 20, 1470, 1153, 1152, - /* 1420 */ 37, 451, 1208, 16, 1202, 1470, 189, 36, 240, 1500, - /* 1430 */ 1501, 1505, 262, 230, 1500, 1501, 1505, 131, 1207, 1206, - /* 1440 */ 8, 231, 1500, 1501, 1505, 263, 196, 33, 10, 1091, - /* 1450 */ 1117, 1090, 13, 18, 456, 197, 1179, 199, 201, 46, - /* 1460 */ 1426, 203, 205, 58, 1069, 40, 62, 957, 469, 276, - /* 1470 */ 471, 473, 954, 1487, 208, 467, 949, 474, 476, 951, - /* 1480 */ 477, 479, 482, 945, 480, 934, 943, 483, 63, 968, - /* 1490 */ 47, 64, 948, 964, 947, 962, 489, 946, 862, 499, - /* 1500 */ 501, 878, 903, 211, 885, 884, 883, 882, 967, 881, - /* 1510 */ 880, 900, 879, 898, 875, 874, 873, 1269, 870, 869, - /* 1520 */ 868, 867, 523, 524, 1267, 528, 527, 1265, 525, 529, - /* 1530 */ 531, 532, 1263, 533, 535, 536, 537, 1251, 539, 540, - /* 1540 */ 1250, 1246, 543, 544, 1221, 1056, 548, 219, 1221, 547, + /* 630 */ 505, 504, 109, 1128, 1472, 1344, 549, 24, 265, 1121, + /* 640 */ 1122, 1123, 1124, 1125, 1129, 1130, 1126, 190, 1320, 437, + /* 650 */ 214, 1132, 277, 96, 1241, 1240, 176, 68, 280, 538, + /* 660 */ 116, 534, 530, 526, 213, 1391, 116, 846, 1346, 1239, + /* 670 */ 1238, 279, 515, 513, 1346, 251, 1389, 22, 1170, 1235, + /* 680 */ 116, 1234, 439, 368, 1077, 49, 48, 310, 1347, 137, + /* 690 */ 67, 1233, 1333, 207, 304, 1127, 298, 500, 1329, 1472, + /* 700 */ 1472, 165, 247, 465, 296, 373, 292, 288, 134, 1492, + /* 710 */ 1232, 300, 281, 1131, 1472, 1472, 1461, 252, 1231, 250, + /* 720 */ 249, 1490, 372, 461, 1472, 1501, 1472, 375, 1344, 1230, + /* 730 */ 1229, 1158, 1228, 133, 217, 1227, 1472, 1374, 1263, 24, + /* 740 */ 265, 1121, 1122, 1123, 1124, 1125, 1129, 1130, 1063, 1518, + /* 750 */ 1258, 413, 290, 514, 172, 1472, 447, 301, 1331, 158, + /* 760 */ 385, 1501, 156, 1472, 160, 162, 451, 159, 161, 1039, + /* 770 */ 1472, 169, 387, 1501, 1472, 1472, 164, 1472, 1256, 163, + /* 780 */ 1472, 9, 8, 1219, 1220, 1518, 70, 1502, 1503, 1507, + /* 790 */ 1552, 65, 447, 1327, 260, 1548, 1625, 1518, 406, 107, + /* 800 */ 390, 62, 451, 410, 447, 1586, 1472, 45, 179, 1062, + /* 810 */ 170, 1184, 181, 34, 451, 1501, 440, 1133, 1472, 1066, + /* 820 */ 448, 1501, 70, 1502, 1503, 1507, 1552, 490, 1237, 34, + /* 830 */ 260, 1548, 1625, 1090, 70, 1502, 1503, 1507, 1552, 1518, + /* 840 */ 192, 1609, 260, 1548, 1625, 1518, 447, 34, 1303, 419, + /* 850 */ 198, 1022, 447, 1570, 200, 95, 451, 344, 153, 457, + /* 860 */ 1472, 126, 451, 1385, 105, 435, 1472, 366, 206, 362, + /* 870 */ 358, 354, 152, 1501, 405, 185, 229, 1502, 1503, 1507, + /* 880 */ 1065, 872, 71, 1502, 1503, 1507, 1552, 367, 107, 45, + /* 890 */ 445, 1548, 929, 924, 1582, 470, 1613, 1518, 54, 957, + /* 900 */ 873, 150, 432, 105, 447, 1519, 106, 961, 107, 132, + /* 910 */ 967, 105, 966, 1611, 451, 108, 1075, 194, 1472, 2, + /* 920 */ 1501, 285, 289, 246, 248, 898, 1031, 215, 322, 139, + /* 930 */ 1424, 329, 337, 336, 120, 1502, 1503, 1507, 338, 342, + /* 940 */ 1086, 343, 1085, 431, 1518, 1084, 345, 145, 346, 347, + /* 950 */ 148, 447, 52, 350, 151, 1083, 369, 399, 149, 371, + /* 960 */ 122, 451, 146, 75, 1334, 1472, 401, 155, 101, 1330, + /* 970 */ 374, 256, 436, 1626, 400, 1501, 157, 110, 171, 144, + /* 980 */ 111, 71, 1502, 1503, 1507, 1552, 1332, 435, 1328, 112, + /* 990 */ 1549, 113, 402, 174, 1082, 274, 273, 409, 420, 1518, + /* 1000 */ 412, 99, 1501, 411, 1593, 1068, 447, 177, 455, 1592, + /* 1010 */ 1501, 188, 1559, 430, 1060, 429, 451, 5, 1613, 1583, + /* 1020 */ 1472, 1061, 417, 266, 180, 259, 1518, 423, 428, 100, + /* 1030 */ 4, 132, 416, 447, 1518, 1611, 234, 1502, 1503, 1507, + /* 1040 */ 1060, 447, 1158, 451, 1501, 1081, 1567, 1472, 35, 441, + /* 1050 */ 415, 451, 1501, 125, 1573, 1472, 261, 1501, 187, 444, + /* 1060 */ 186, 184, 17, 234, 1502, 1503, 1507, 1610, 1518, 1534, + /* 1070 */ 1433, 233, 1502, 1503, 1507, 447, 1518, 193, 453, 454, + /* 1080 */ 466, 1518, 1432, 447, 269, 451, 1501, 1628, 447, 1472, + /* 1090 */ 458, 460, 1064, 451, 459, 202, 204, 1472, 451, 216, + /* 1100 */ 264, 59, 1472, 427, 1345, 120, 1502, 1503, 1507, 61, + /* 1110 */ 1518, 1501, 468, 234, 1502, 1503, 1507, 447, 226, 1502, + /* 1120 */ 1503, 1507, 497, 218, 1317, 212, 545, 451, 41, 1069, + /* 1130 */ 220, 1472, 224, 225, 268, 1518, 1466, 222, 1465, 284, + /* 1140 */ 1462, 286, 447, 287, 1627, 1049, 1072, 234, 1502, 1503, + /* 1150 */ 1507, 1050, 451, 135, 291, 1460, 1472, 1501, 293, 295, + /* 1160 */ 294, 1459, 297, 1458, 299, 1501, 1449, 136, 302, 303, + /* 1170 */ 1034, 1443, 232, 1502, 1503, 1507, 1033, 1442, 308, 1441, + /* 1180 */ 309, 1518, 1440, 1005, 1417, 1416, 1415, 1414, 447, 1518, + /* 1190 */ 1413, 1412, 1411, 1501, 104, 1401, 447, 1410, 451, 1501, + /* 1200 */ 1007, 1395, 1472, 1409, 1408, 1407, 451, 1406, 1405, 1404, + /* 1210 */ 1472, 1403, 1402, 1400, 1399, 1398, 1397, 1518, 235, 1502, + /* 1220 */ 1503, 1507, 1396, 1518, 447, 1394, 227, 1502, 1503, 1507, + /* 1230 */ 447, 1393, 1392, 1275, 451, 1457, 1451, 1439, 1472, 1430, + /* 1240 */ 451, 147, 1323, 1274, 1472, 1501, 352, 865, 1272, 353, + /* 1250 */ 1501, 1270, 1268, 356, 236, 1502, 1503, 1507, 1501, 351, + /* 1260 */ 228, 1502, 1503, 1507, 355, 359, 357, 361, 1266, 1518, + /* 1270 */ 360, 365, 1255, 1254, 1518, 1251, 447, 364, 363, 1325, + /* 1280 */ 154, 447, 1518, 974, 972, 74, 451, 1324, 897, 447, + /* 1290 */ 1472, 451, 896, 895, 894, 1472, 891, 890, 1264, 451, + /* 1300 */ 1501, 514, 253, 1472, 1259, 254, 237, 1502, 1503, 1507, + /* 1310 */ 388, 1515, 1502, 1503, 1507, 512, 1257, 255, 1250, 1514, + /* 1320 */ 1502, 1503, 1507, 391, 1518, 1501, 1249, 393, 395, 72, + /* 1330 */ 1456, 447, 1041, 1450, 1501, 168, 403, 1438, 1437, 114, + /* 1340 */ 1429, 451, 173, 55, 14, 1472, 1490, 3, 34, 1518, + /* 1350 */ 15, 189, 39, 124, 36, 10, 447, 44, 1518, 178, + /* 1360 */ 121, 244, 1502, 1503, 1507, 447, 451, 404, 1183, 57, + /* 1370 */ 1472, 182, 183, 1205, 19, 451, 38, 1176, 1155, 1472, + /* 1380 */ 175, 56, 20, 1154, 37, 1210, 1513, 1502, 1503, 1507, + /* 1390 */ 16, 1204, 262, 1209, 1208, 245, 1502, 1503, 1507, 263, + /* 1400 */ 8, 131, 1501, 196, 1092, 33, 13, 1501, 1428, 1091, + /* 1410 */ 18, 203, 1119, 1501, 197, 205, 1181, 199, 201, 46, + /* 1420 */ 58, 1070, 40, 469, 456, 276, 1518, 1321, 1489, 473, + /* 1430 */ 476, 1518, 1319, 447, 62, 208, 467, 1518, 447, 958, + /* 1440 */ 471, 479, 955, 451, 447, 474, 477, 1472, 451, 952, + /* 1450 */ 946, 480, 1472, 944, 451, 482, 483, 950, 1472, 1501, + /* 1460 */ 935, 949, 948, 243, 1502, 1503, 1507, 489, 240, 1502, + /* 1470 */ 1503, 1507, 947, 969, 230, 1502, 1503, 1507, 63, 968, + /* 1480 */ 47, 64, 965, 1518, 963, 863, 499, 904, 210, 211, + /* 1490 */ 447, 501, 496, 210, 886, 885, 884, 496, 883, 882, + /* 1500 */ 451, 881, 880, 879, 1472, 901, 899, 876, 875, 874, + /* 1510 */ 871, 870, 869, 868, 498, 1271, 523, 1269, 524, 498, + /* 1520 */ 231, 1502, 1503, 1507, 527, 528, 525, 529, 1267, 531, + /* 1530 */ 532, 533, 1265, 495, 494, 493, 535, 492, 495, 494, + /* 1540 */ 493, 536, 492, 537, 1253, 539, 540, 1252, 1248, 543, + /* 1550 */ 544, 1223, 1057, 219, 547, 548, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 253, 240, 257, 256, 278, 279, 259, 211, 235, 213, - /* 10 */ 218, 237, 12, 13, 269, 270, 262, 212, 257, 246, - /* 20 */ 20, 20, 22, 2, 20, 12, 13, 14, 15, 16, - /* 30 */ 269, 270, 2, 12, 13, 14, 15, 16, 38, 240, - /* 40 */ 248, 236, 12, 13, 14, 15, 16, 293, 243, 20, - /* 50 */ 50, 12, 13, 14, 49, 218, 257, 57, 253, 20, - /* 60 */ 306, 22, 257, 0, 310, 12, 13, 262, 269, 270, - /* 70 */ 218, 1, 2, 20, 74, 22, 218, 38, 273, 274, - /* 80 */ 275, 276, 277, 215, 216, 227, 281, 282, 75, 50, - /* 90 */ 212, 38, 234, 20, 253, 243, 57, 97, 293, 262, - /* 100 */ 259, 243, 0, 50, 12, 13, 14, 15, 16, 109, - /* 110 */ 57, 306, 49, 74, 236, 310, 12, 13, 14, 15, - /* 120 */ 16, 243, 221, 236, 22, 245, 225, 74, 276, 242, - /* 130 */ 293, 253, 252, 253, 247, 257, 97, 285, 286, 287, - /* 140 */ 288, 228, 290, 306, 49, 75, 146, 310, 109, 236, - /* 150 */ 97, 273, 274, 275, 276, 277, 20, 244, 22, 281, - /* 160 */ 282, 283, 109, 163, 164, 165, 166, 167, 168, 169, - /* 170 */ 170, 171, 172, 173, 174, 61, 40, 222, 223, 65, - /* 180 */ 302, 20, 271, 209, 21, 146, 186, 24, 25, 26, - /* 190 */ 27, 28, 29, 30, 31, 32, 14, 15, 16, 146, - /* 200 */ 289, 87, 163, 164, 165, 166, 167, 168, 169, 170, - /* 210 */ 171, 172, 173, 174, 0, 186, 163, 164, 165, 166, - /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 0, 12, - /* 230 */ 13, 19, 145, 271, 147, 74, 262, 20, 52, 22, - /* 240 */ 54, 38, 186, 139, 58, 33, 20, 61, 36, 63, - /* 250 */ 64, 289, 66, 236, 42, 38, 44, 45, 46, 47, - /* 260 */ 57, 244, 12, 13, 14, 15, 16, 293, 12, 13, - /* 270 */ 14, 212, 218, 186, 57, 61, 20, 49, 22, 65, - /* 280 */ 306, 227, 12, 13, 310, 73, 220, 20, 76, 20, - /* 290 */ 20, 74, 22, 212, 38, 236, 217, 243, 236, 233, - /* 300 */ 74, 87, 243, 212, 67, 243, 218, 241, 38, 85, - /* 310 */ 231, 207, 253, 57, 97, 227, 257, 238, 106, 71, - /* 320 */ 106, 107, 108, 163, 110, 75, 109, 57, 222, 223, - /* 330 */ 74, 243, 273, 274, 275, 276, 277, 275, 257, 21, - /* 340 */ 281, 282, 283, 0, 74, 0, 134, 186, 257, 137, - /* 350 */ 113, 114, 34, 97, 295, 195, 196, 197, 198, 199, - /* 360 */ 301, 302, 57, 146, 152, 109, 154, 97, 212, 24, - /* 370 */ 25, 26, 27, 28, 29, 30, 31, 32, 237, 109, + /* 0 */ 254, 241, 258, 257, 241, 254, 260, 279, 280, 219, + /* 10 */ 219, 260, 12, 13, 270, 271, 263, 213, 258, 228, + /* 20 */ 20, 258, 22, 294, 213, 12, 13, 14, 15, 16, + /* 30 */ 270, 271, 2, 270, 271, 244, 307, 20, 38, 249, + /* 40 */ 311, 237, 12, 13, 14, 15, 16, 294, 244, 20, + /* 50 */ 50, 12, 13, 14, 212, 219, 214, 57, 254, 20, + /* 60 */ 307, 22, 258, 4, 311, 12, 13, 263, 61, 258, + /* 70 */ 219, 20, 65, 20, 74, 22, 219, 38, 274, 275, + /* 80 */ 276, 277, 278, 216, 217, 228, 282, 283, 75, 50, + /* 90 */ 213, 38, 235, 237, 87, 244, 57, 97, 294, 263, + /* 100 */ 244, 244, 50, 50, 12, 13, 14, 15, 16, 109, + /* 110 */ 57, 307, 2, 74, 237, 311, 12, 13, 14, 15, + /* 120 */ 16, 244, 12, 13, 14, 15, 16, 74, 277, 222, + /* 130 */ 294, 254, 276, 226, 236, 258, 97, 286, 287, 288, + /* 140 */ 289, 20, 291, 307, 20, 247, 146, 311, 109, 246, + /* 150 */ 97, 274, 275, 276, 277, 278, 253, 254, 49, 282, + /* 160 */ 283, 284, 109, 163, 164, 165, 166, 167, 168, 169, + /* 170 */ 170, 171, 172, 173, 174, 175, 14, 15, 16, 75, + /* 180 */ 303, 164, 165, 210, 20, 146, 21, 187, 0, 24, + /* 190 */ 25, 26, 27, 28, 29, 30, 31, 32, 74, 146, + /* 200 */ 223, 224, 163, 164, 165, 166, 167, 168, 169, 170, + /* 210 */ 171, 172, 173, 174, 175, 163, 163, 164, 165, 166, + /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 175, 12, + /* 230 */ 13, 139, 71, 263, 213, 221, 263, 20, 187, 22, + /* 240 */ 52, 219, 54, 145, 213, 147, 58, 188, 234, 61, + /* 250 */ 228, 63, 64, 0, 66, 38, 242, 235, 237, 12, + /* 260 */ 13, 14, 15, 16, 294, 244, 244, 294, 12, 13, + /* 270 */ 14, 213, 22, 187, 57, 254, 20, 307, 22, 258, + /* 280 */ 307, 311, 12, 13, 311, 187, 136, 213, 38, 258, + /* 290 */ 20, 74, 22, 47, 38, 274, 275, 276, 277, 278, + /* 300 */ 208, 20, 49, 282, 283, 284, 219, 57, 38, 0, + /* 310 */ 38, 237, 21, 57, 97, 228, 258, 296, 244, 73, + /* 320 */ 1, 2, 76, 302, 303, 34, 109, 57, 254, 57, + /* 330 */ 74, 244, 258, 24, 25, 26, 27, 28, 29, 30, + /* 340 */ 31, 32, 192, 193, 74, 0, 229, 97, 274, 275, + /* 350 */ 276, 277, 278, 97, 237, 74, 282, 283, 20, 109, + /* 360 */ 22, 67, 245, 146, 49, 109, 21, 97, 207, 24, + /* 370 */ 25, 26, 27, 28, 29, 30, 31, 32, 40, 109, /* 380 */ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - /* 390 */ 173, 174, 20, 218, 236, 52, 220, 54, 293, 237, - /* 400 */ 242, 58, 146, 186, 61, 247, 63, 64, 212, 66, - /* 410 */ 212, 306, 265, 257, 212, 310, 146, 241, 243, 163, + /* 390 */ 173, 174, 175, 219, 75, 237, 146, 12, 13, 14, + /* 400 */ 15, 16, 146, 52, 187, 54, 248, 113, 114, 58, + /* 410 */ 213, 221, 61, 163, 63, 64, 146, 66, 244, 163, /* 420 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - /* 430 */ 174, 164, 165, 163, 164, 165, 166, 167, 168, 169, - /* 440 */ 170, 171, 172, 173, 174, 218, 12, 13, 18, 136, - /* 450 */ 20, 276, 204, 257, 20, 257, 22, 27, 217, 257, - /* 460 */ 30, 286, 287, 288, 243, 290, 20, 4, 262, 39, - /* 470 */ 243, 250, 38, 12, 13, 14, 15, 16, 3, 238, + /* 430 */ 174, 175, 242, 163, 164, 165, 166, 167, 168, 169, + /* 440 */ 170, 171, 172, 173, 174, 175, 12, 13, 18, 3, + /* 450 */ 20, 277, 272, 272, 20, 258, 22, 27, 218, 244, + /* 460 */ 30, 287, 288, 289, 213, 291, 251, 163, 187, 39, + /* 470 */ 290, 290, 38, 12, 13, 14, 15, 16, 20, 239, /* 480 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - /* 490 */ 98, 57, 100, 101, 102, 103, 104, 105, 0, 293, - /* 500 */ 184, 185, 271, 276, 191, 192, 1, 2, 74, 218, - /* 510 */ 138, 50, 306, 286, 287, 288, 310, 290, 227, 21, - /* 520 */ 289, 212, 24, 25, 26, 27, 28, 29, 30, 31, - /* 530 */ 32, 97, 229, 237, 243, 232, 75, 12, 13, 14, - /* 540 */ 15, 16, 112, 109, 83, 115, 116, 117, 118, 119, - /* 550 */ 212, 121, 122, 123, 124, 125, 126, 127, 128, 129, - /* 560 */ 130, 131, 0, 47, 18, 218, 257, 212, 224, 23, - /* 570 */ 226, 236, 236, 43, 227, 12, 13, 14, 15, 16, - /* 580 */ 146, 35, 247, 247, 138, 14, 237, 237, 212, 73, - /* 590 */ 243, 20, 76, 132, 48, 257, 237, 163, 164, 165, - /* 600 */ 166, 167, 168, 169, 170, 171, 172, 173, 174, 213, - /* 610 */ 212, 150, 257, 50, 52, 53, 54, 55, 56, 212, + /* 490 */ 98, 57, 100, 101, 102, 103, 104, 105, 4, 237, + /* 500 */ 196, 197, 198, 199, 200, 243, 237, 219, 74, 258, + /* 510 */ 248, 50, 219, 19, 219, 219, 228, 248, 213, 185, + /* 520 */ 186, 228, 237, 138, 228, 219, 57, 33, 243, 20, + /* 530 */ 36, 97, 244, 248, 228, 41, 75, 244, 20, 244, + /* 540 */ 244, 47, 112, 109, 83, 115, 116, 117, 118, 119, + /* 550 */ 244, 121, 122, 123, 124, 125, 126, 127, 128, 129, + /* 560 */ 130, 131, 0, 258, 18, 219, 225, 73, 227, 23, + /* 570 */ 76, 218, 277, 272, 228, 12, 13, 14, 15, 16, + /* 580 */ 146, 35, 287, 288, 289, 232, 291, 219, 43, 213, + /* 590 */ 244, 290, 239, 132, 48, 85, 228, 163, 164, 165, + /* 600 */ 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + /* 610 */ 219, 150, 244, 50, 52, 53, 54, 55, 56, 228, /* 620 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 630 */ 68, 69, 70, 257, 212, 212, 175, 176, 177, 178, - /* 640 */ 179, 180, 181, 182, 183, 218, 83, 218, 212, 218, - /* 650 */ 187, 22, 228, 218, 227, 257, 227, 111, 227, 236, - /* 660 */ 236, 234, 227, 138, 257, 228, 243, 38, 244, 0, - /* 670 */ 243, 38, 243, 236, 243, 218, 253, 202, 243, 257, - /* 680 */ 257, 244, 212, 212, 227, 139, 140, 141, 212, 143, - /* 690 */ 57, 22, 218, 257, 148, 132, 273, 274, 275, 276, - /* 700 */ 243, 227, 156, 142, 158, 236, 160, 161, 162, 225, - /* 710 */ 71, 242, 236, 150, 75, 185, 247, 243, 157, 243, - /* 720 */ 78, 22, 218, 81, 212, 212, 212, 257, 257, 253, - /* 730 */ 50, 227, 186, 257, 311, 312, 132, 38, 175, 176, - /* 740 */ 177, 178, 179, 180, 181, 182, 183, 243, 236, 273, - /* 750 */ 274, 275, 276, 277, 150, 243, 57, 281, 282, 283, - /* 760 */ 212, 0, 212, 33, 212, 253, 36, 313, 292, 257, - /* 770 */ 257, 257, 42, 253, 44, 45, 46, 47, 78, 175, - /* 780 */ 78, 81, 304, 81, 236, 273, 274, 275, 276, 277, - /* 790 */ 0, 243, 71, 281, 282, 283, 97, 36, 164, 165, - /* 800 */ 246, 253, 35, 73, 292, 257, 76, 257, 109, 257, - /* 810 */ 212, 78, 22, 71, 81, 71, 71, 75, 253, 75, - /* 820 */ 75, 273, 274, 275, 276, 277, 74, 298, 61, 281, - /* 830 */ 282, 283, 65, 215, 236, 71, 272, 212, 86, 75, - /* 840 */ 292, 243, 291, 163, 77, 146, 79, 80, 38, 82, - /* 850 */ 236, 253, 212, 71, 87, 257, 307, 75, 20, 38, - /* 860 */ 262, 236, 163, 133, 294, 135, 71, 137, 243, 218, - /* 870 */ 75, 273, 274, 275, 276, 36, 236, 71, 253, 212, - /* 880 */ 268, 75, 257, 243, 154, 71, 12, 13, 71, 75, - /* 890 */ 38, 293, 75, 253, 222, 144, 22, 257, 273, 274, - /* 900 */ 275, 276, 277, 236, 306, 218, 281, 282, 310, 263, - /* 910 */ 243, 218, 38, 273, 274, 275, 276, 277, 74, 109, - /* 920 */ 253, 281, 282, 218, 257, 71, 251, 206, 84, 75, - /* 930 */ 109, 57, 71, 71, 71, 120, 75, 75, 75, 132, - /* 940 */ 273, 274, 275, 276, 277, 249, 71, 249, 243, 282, - /* 950 */ 75, 20, 218, 71, 71, 212, 267, 75, 75, 20, - /* 960 */ 220, 243, 261, 20, 254, 218, 220, 262, 220, 220, - /* 970 */ 20, 97, 214, 236, 236, 236, 222, 236, 218, 236, - /* 980 */ 267, 276, 212, 109, 153, 266, 243, 214, 261, 236, - /* 990 */ 212, 286, 287, 288, 217, 290, 253, 217, 293, 236, - /* 1000 */ 257, 236, 236, 260, 236, 236, 236, 236, 20, 254, - /* 1010 */ 194, 306, 303, 243, 236, 310, 273, 274, 275, 276, - /* 1020 */ 146, 243, 243, 253, 243, 193, 57, 257, 272, 257, - /* 1030 */ 260, 253, 258, 258, 212, 257, 201, 163, 303, 189, - /* 1040 */ 257, 257, 200, 273, 274, 275, 276, 188, 243, 20, - /* 1050 */ 300, 273, 274, 275, 276, 296, 299, 185, 236, 297, - /* 1060 */ 271, 120, 205, 208, 74, 243, 258, 280, 212, 284, - /* 1070 */ 203, 258, 135, 255, 74, 253, 212, 257, 254, 257, - /* 1080 */ 257, 212, 257, 305, 243, 217, 243, 239, 217, 210, - /* 1090 */ 314, 226, 236, 217, 308, 273, 274, 275, 276, 243, - /* 1100 */ 236, 309, 232, 222, 218, 236, 214, 243, 230, 253, - /* 1110 */ 264, 0, 243, 257, 230, 219, 260, 253, 0, 64, - /* 1120 */ 0, 257, 253, 212, 260, 38, 257, 38, 212, 273, - /* 1130 */ 274, 275, 276, 4, 312, 159, 212, 273, 274, 275, - /* 1140 */ 276, 38, 273, 274, 275, 276, 159, 236, 19, 0, - /* 1150 */ 38, 159, 236, 38, 243, 38, 0, 38, 0, 243, - /* 1160 */ 236, 38, 33, 0, 253, 36, 74, 243, 257, 253, - /* 1170 */ 41, 150, 149, 257, 0, 0, 47, 253, 109, 146, - /* 1180 */ 212, 257, 0, 53, 273, 274, 275, 276, 142, 273, - /* 1190 */ 274, 275, 276, 0, 0, 212, 86, 273, 274, 275, - /* 1200 */ 276, 0, 73, 0, 236, 76, 212, 0, 0, 0, - /* 1210 */ 0, 243, 0, 0, 0, 0, 0, 0, 0, 236, - /* 1220 */ 0, 253, 0, 0, 120, 257, 243, 0, 0, 0, - /* 1230 */ 236, 212, 0, 0, 0, 61, 253, 243, 0, 65, - /* 1240 */ 257, 273, 274, 275, 276, 0, 22, 253, 0, 0, - /* 1250 */ 0, 257, 0, 0, 0, 236, 273, 274, 275, 276, - /* 1260 */ 0, 87, 243, 0, 43, 212, 0, 273, 274, 275, - /* 1270 */ 276, 0, 253, 38, 43, 36, 257, 51, 212, 0, - /* 1280 */ 106, 107, 108, 43, 110, 38, 0, 36, 0, 236, - /* 1290 */ 0, 36, 273, 274, 275, 276, 243, 38, 0, 43, - /* 1300 */ 38, 36, 236, 0, 43, 0, 253, 38, 83, 243, - /* 1310 */ 257, 81, 212, 71, 22, 0, 38, 71, 38, 253, - /* 1320 */ 212, 38, 38, 257, 0, 212, 273, 274, 275, 276, - /* 1330 */ 22, 38, 38, 0, 22, 39, 236, 0, 22, 273, - /* 1340 */ 274, 275, 276, 243, 236, 38, 0, 22, 0, 236, - /* 1350 */ 22, 243, 20, 253, 0, 155, 243, 257, 38, 0, - /* 1360 */ 22, 253, 151, 0, 0, 257, 253, 212, 0, 74, - /* 1370 */ 257, 135, 212, 273, 274, 275, 276, 43, 190, 138, - /* 1380 */ 212, 273, 274, 275, 276, 71, 273, 274, 275, 276, - /* 1390 */ 71, 236, 75, 71, 190, 138, 236, 74, 243, 86, - /* 1400 */ 133, 75, 138, 243, 236, 74, 4, 71, 253, 74, - /* 1410 */ 38, 243, 257, 253, 75, 74, 71, 257, 75, 75, - /* 1420 */ 71, 253, 75, 71, 38, 257, 86, 184, 273, 274, - /* 1430 */ 275, 276, 38, 273, 274, 275, 276, 86, 38, 38, - /* 1440 */ 2, 273, 274, 275, 276, 38, 86, 74, 190, 75, - /* 1450 */ 163, 75, 74, 74, 136, 75, 75, 74, 74, 74, - /* 1460 */ 0, 43, 133, 74, 22, 74, 84, 75, 38, 38, - /* 1470 */ 74, 38, 75, 86, 86, 85, 99, 74, 38, 75, - /* 1480 */ 74, 38, 38, 75, 74, 22, 75, 74, 74, 38, - /* 1490 */ 74, 74, 99, 38, 99, 22, 87, 99, 51, 50, - /* 1500 */ 72, 22, 57, 71, 38, 38, 38, 38, 109, 38, - /* 1510 */ 38, 57, 38, 38, 38, 38, 38, 0, 38, 38, - /* 1520 */ 38, 38, 38, 36, 0, 36, 38, 0, 43, 43, - /* 1530 */ 38, 36, 0, 43, 38, 36, 43, 0, 38, 37, - /* 1540 */ 0, 0, 22, 21, 315, 22, 20, 22, 315, 21, - /* 1550 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1560 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1570 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1580 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1590 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1600 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1610 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1620 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1630 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1640 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1650 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1660 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1670 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1680 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1690 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1700 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1710 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1720 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1730 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1740 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1750 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, + /* 630 */ 68, 69, 70, 132, 258, 244, 19, 176, 177, 178, + /* 640 */ 179, 180, 181, 182, 183, 184, 83, 138, 0, 203, + /* 650 */ 33, 150, 229, 36, 213, 213, 138, 111, 229, 42, + /* 660 */ 237, 44, 45, 46, 47, 237, 237, 22, 245, 213, + /* 670 */ 213, 243, 223, 224, 245, 35, 248, 176, 14, 213, + /* 680 */ 237, 213, 71, 38, 20, 139, 140, 141, 245, 143, + /* 690 */ 73, 213, 238, 76, 148, 132, 142, 49, 238, 258, + /* 700 */ 258, 61, 156, 219, 158, 65, 160, 161, 162, 74, + /* 710 */ 213, 157, 228, 150, 258, 258, 0, 77, 213, 79, + /* 720 */ 80, 86, 82, 106, 258, 213, 258, 87, 244, 213, + /* 730 */ 213, 186, 213, 187, 230, 213, 258, 233, 0, 176, + /* 740 */ 177, 178, 179, 180, 181, 182, 183, 184, 38, 237, + /* 750 */ 0, 134, 36, 71, 137, 258, 244, 75, 238, 78, + /* 760 */ 22, 213, 81, 258, 78, 78, 254, 81, 81, 152, + /* 770 */ 258, 154, 22, 213, 258, 258, 78, 258, 0, 81, + /* 780 */ 258, 1, 2, 164, 165, 237, 274, 275, 276, 277, + /* 790 */ 278, 74, 244, 238, 282, 283, 284, 237, 266, 71, + /* 800 */ 22, 84, 254, 75, 244, 293, 258, 71, 71, 38, + /* 810 */ 238, 75, 75, 71, 254, 213, 205, 75, 258, 109, + /* 820 */ 238, 213, 274, 275, 276, 277, 278, 238, 214, 71, + /* 830 */ 282, 283, 284, 75, 274, 275, 276, 277, 278, 237, + /* 840 */ 314, 293, 282, 283, 284, 237, 244, 71, 226, 305, + /* 850 */ 71, 75, 244, 293, 75, 71, 254, 254, 33, 75, + /* 860 */ 258, 36, 254, 247, 71, 263, 258, 42, 75, 44, + /* 870 */ 45, 46, 47, 213, 254, 299, 274, 275, 276, 277, + /* 880 */ 109, 38, 274, 275, 276, 277, 278, 216, 71, 71, + /* 890 */ 282, 283, 75, 75, 273, 71, 294, 237, 73, 75, + /* 900 */ 57, 76, 292, 71, 244, 237, 71, 75, 71, 307, + /* 910 */ 75, 71, 75, 311, 254, 75, 20, 308, 258, 295, + /* 920 */ 213, 219, 36, 269, 223, 38, 144, 264, 219, 120, + /* 930 */ 219, 252, 132, 250, 274, 275, 276, 277, 250, 219, + /* 940 */ 20, 268, 20, 219, 237, 20, 262, 221, 244, 255, + /* 950 */ 221, 244, 221, 219, 221, 20, 215, 244, 133, 237, + /* 960 */ 135, 254, 137, 219, 237, 258, 153, 237, 244, 237, + /* 970 */ 223, 215, 312, 313, 268, 213, 237, 237, 218, 154, + /* 980 */ 237, 274, 275, 276, 277, 278, 237, 263, 237, 237, + /* 990 */ 283, 237, 267, 218, 20, 12, 13, 262, 195, 237, + /* 1000 */ 255, 277, 213, 244, 304, 22, 244, 259, 194, 304, + /* 1010 */ 213, 287, 288, 289, 57, 291, 254, 202, 294, 273, + /* 1020 */ 258, 38, 258, 261, 259, 258, 237, 258, 201, 244, + /* 1030 */ 189, 307, 190, 244, 237, 311, 274, 275, 276, 277, + /* 1040 */ 57, 244, 186, 254, 213, 20, 272, 258, 120, 204, + /* 1050 */ 261, 254, 213, 298, 301, 258, 209, 213, 285, 206, + /* 1060 */ 297, 300, 74, 274, 275, 276, 277, 310, 237, 281, + /* 1070 */ 259, 274, 275, 276, 277, 244, 237, 309, 258, 258, + /* 1080 */ 97, 237, 259, 244, 258, 254, 213, 315, 244, 258, + /* 1090 */ 135, 255, 109, 254, 256, 244, 218, 258, 254, 233, + /* 1100 */ 261, 218, 258, 306, 244, 274, 275, 276, 277, 74, + /* 1110 */ 237, 213, 240, 274, 275, 276, 277, 244, 274, 275, + /* 1120 */ 276, 277, 223, 219, 227, 218, 215, 254, 265, 146, + /* 1130 */ 220, 258, 231, 231, 261, 237, 0, 211, 0, 64, + /* 1140 */ 0, 38, 244, 159, 313, 38, 163, 274, 275, 276, + /* 1150 */ 277, 38, 254, 38, 159, 0, 258, 213, 38, 159, + /* 1160 */ 38, 0, 38, 0, 38, 213, 0, 74, 150, 149, + /* 1170 */ 109, 0, 274, 275, 276, 277, 146, 0, 53, 0, + /* 1180 */ 142, 237, 0, 86, 0, 0, 0, 0, 244, 237, + /* 1190 */ 0, 0, 0, 213, 120, 0, 244, 0, 254, 213, + /* 1200 */ 22, 0, 258, 0, 0, 0, 254, 0, 0, 0, + /* 1210 */ 258, 0, 0, 0, 0, 0, 0, 237, 274, 275, + /* 1220 */ 276, 277, 0, 237, 244, 0, 274, 275, 276, 277, + /* 1230 */ 244, 0, 0, 0, 254, 0, 0, 0, 258, 0, + /* 1240 */ 254, 43, 0, 0, 258, 213, 36, 51, 0, 43, + /* 1250 */ 213, 0, 0, 36, 274, 275, 276, 277, 213, 38, + /* 1260 */ 274, 275, 276, 277, 38, 38, 43, 43, 0, 237, + /* 1270 */ 36, 43, 0, 0, 237, 0, 244, 36, 38, 0, + /* 1280 */ 81, 244, 237, 38, 22, 83, 254, 0, 38, 244, + /* 1290 */ 258, 254, 38, 38, 38, 258, 38, 38, 0, 254, + /* 1300 */ 213, 71, 22, 258, 0, 22, 274, 275, 276, 277, + /* 1310 */ 39, 274, 275, 276, 277, 71, 0, 22, 0, 274, + /* 1320 */ 275, 276, 277, 38, 237, 213, 0, 22, 22, 20, + /* 1330 */ 0, 244, 38, 0, 213, 155, 22, 0, 0, 151, + /* 1340 */ 0, 254, 43, 74, 191, 258, 86, 71, 71, 237, + /* 1350 */ 191, 86, 71, 135, 185, 191, 244, 138, 237, 75, + /* 1360 */ 74, 274, 275, 276, 277, 244, 254, 138, 75, 4, + /* 1370 */ 258, 74, 71, 38, 74, 254, 138, 75, 75, 258, + /* 1380 */ 133, 74, 71, 75, 71, 75, 274, 275, 276, 277, + /* 1390 */ 71, 38, 38, 38, 38, 274, 275, 276, 277, 38, + /* 1400 */ 2, 86, 213, 86, 75, 74, 74, 213, 0, 75, + /* 1410 */ 74, 43, 163, 213, 75, 133, 75, 74, 74, 74, + /* 1420 */ 74, 22, 74, 38, 136, 38, 237, 0, 86, 38, + /* 1430 */ 38, 237, 0, 244, 84, 86, 85, 237, 244, 75, + /* 1440 */ 74, 38, 75, 254, 244, 74, 74, 258, 254, 75, + /* 1450 */ 75, 74, 258, 75, 254, 38, 74, 99, 258, 213, + /* 1460 */ 22, 99, 99, 274, 275, 276, 277, 87, 274, 275, + /* 1470 */ 276, 277, 99, 38, 274, 275, 276, 277, 74, 109, + /* 1480 */ 74, 74, 38, 237, 22, 51, 50, 57, 61, 71, + /* 1490 */ 244, 72, 65, 61, 38, 38, 38, 65, 38, 38, + /* 1500 */ 254, 38, 38, 22, 258, 57, 38, 38, 38, 38, + /* 1510 */ 38, 38, 38, 38, 87, 0, 38, 0, 36, 87, + /* 1520 */ 274, 275, 276, 277, 38, 36, 43, 43, 0, 38, + /* 1530 */ 36, 43, 0, 106, 107, 108, 38, 110, 106, 107, + /* 1540 */ 108, 36, 110, 43, 0, 38, 37, 0, 0, 22, + /* 1550 */ 21, 316, 22, 22, 21, 20, 316, 316, 316, 316, + /* 1560 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1570 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1580 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1590 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1600 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1610 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1620 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1630 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1640 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1650 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1660 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1670 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1680 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1690 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1700 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1710 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1720 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1730 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1740 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1750 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 1760 */ 316, 316, 316, 316, 316, 316, }; #define YY_SHIFT_COUNT (549) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1541) +#define YY_SHIFT_MAX (1548) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 546, 0, 39, 53, 53, 53, 53, 217, 53, 53, - /* 10 */ 270, 434, 161, 256, 270, 270, 270, 270, 270, 270, + /* 10 */ 270, 434, 281, 256, 270, 270, 270, 270, 270, 270, /* 20 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 30 */ 270, 270, 270, 270, 270, 226, 226, 226, 29, 874, - /* 40 */ 874, 87, 1, 1, 56, 874, 267, 267, 1, 1, - /* 50 */ 1, 1, 1, 1, 5, 4, 73, 56, 4, 1, - /* 60 */ 1, 4, 1, 4, 4, 4, 1, 95, 430, 461, - /* 70 */ 563, 563, 163, 767, 699, 186, 699, 699, 699, 699, - /* 80 */ 699, 699, 699, 699, 699, 699, 699, 699, 699, 699, - /* 90 */ 699, 699, 699, 699, 699, 267, 136, 63, 203, 372, - /* 100 */ 372, 372, 228, 203, 269, 4, 4, 4, 224, 305, - /* 110 */ 392, 392, 392, 392, 392, 392, 392, 212, 498, 343, - /* 120 */ 104, 160, 267, 114, 267, 313, 629, 446, 316, 530, - /* 130 */ 316, 571, 475, 463, 838, 839, 852, 751, 838, 838, - /* 140 */ 815, 807, 807, 838, 931, 939, 5, 269, 943, 5, - /* 150 */ 5, 838, 5, 950, 4, 4, 4, 4, 4, 4, - /* 160 */ 4, 4, 4, 4, 4, 852, 838, 950, 269, 931, - /* 170 */ 831, 939, 95, 269, 943, 95, 988, 816, 832, 969, - /* 180 */ 816, 832, 969, 969, 835, 842, 850, 859, 872, 269, - /* 190 */ 1029, 941, 855, 857, 867, 990, 4, 832, 969, 969, - /* 200 */ 832, 969, 937, 269, 943, 95, 224, 95, 269, 1000, - /* 210 */ 852, 305, 838, 95, 950, 1550, 1550, 1550, 1550, 1550, - /* 220 */ 562, 730, 345, 1129, 214, 1174, 13, 21, 30, 250, - /* 230 */ 525, 92, 92, 92, 92, 92, 92, 92, 516, 237, - /* 240 */ 182, 70, 604, 182, 182, 182, 761, 561, 639, 642, - /* 250 */ 700, 702, 733, 102, 669, 790, 318, 742, 744, 745, - /* 260 */ 505, 634, 248, 721, 764, 680, 782, 752, 795, 806, - /* 270 */ 814, 817, 854, 810, 821, 861, 862, 863, 875, 882, - /* 280 */ 883, 844, 633, 1111, 1118, 1055, 1120, 1087, 976, 1089, - /* 290 */ 1103, 1112, 987, 1149, 1115, 1117, 992, 1156, 1119, 1158, - /* 300 */ 1123, 1163, 1092, 1021, 1023, 1069, 1033, 1175, 1182, 1130, - /* 310 */ 1046, 1193, 1194, 1110, 1201, 1203, 1207, 1208, 1209, 1210, - /* 320 */ 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1220, 1222, 1223, - /* 330 */ 1104, 1227, 1228, 1229, 1232, 1233, 1234, 1224, 1238, 1245, - /* 340 */ 1248, 1249, 1250, 1252, 1253, 1254, 1260, 1221, 1263, 1226, - /* 350 */ 1266, 1271, 1235, 1239, 1231, 1279, 1247, 1251, 1240, 1286, - /* 360 */ 1259, 1255, 1256, 1288, 1262, 1265, 1261, 1290, 1298, 1303, - /* 370 */ 1305, 1225, 1230, 1269, 1242, 1292, 1315, 1278, 1280, 1283, - /* 380 */ 1284, 1246, 1242, 1293, 1294, 1324, 1308, 1333, 1312, 1296, - /* 390 */ 1337, 1316, 1307, 1346, 1325, 1348, 1328, 1332, 1354, 1241, - /* 400 */ 1200, 1320, 1359, 1211, 1338, 1257, 1236, 1363, 1364, 1264, - /* 410 */ 1368, 1295, 1334, 1267, 1314, 1319, 1188, 1317, 1322, 1326, - /* 420 */ 1323, 1331, 1335, 1339, 1336, 1313, 1341, 1345, 1204, 1343, - /* 430 */ 1344, 1340, 1243, 1349, 1351, 1347, 1352, 1258, 1402, 1372, - /* 440 */ 1386, 1394, 1400, 1401, 1407, 1438, 1287, 1360, 1374, 1373, - /* 450 */ 1376, 1378, 1379, 1380, 1381, 1383, 1384, 1318, 1385, 1460, - /* 460 */ 1418, 1329, 1389, 1382, 1387, 1388, 1442, 1391, 1390, 1392, - /* 470 */ 1430, 1431, 1396, 1397, 1433, 1403, 1404, 1440, 1406, 1408, - /* 480 */ 1443, 1410, 1411, 1444, 1413, 1377, 1393, 1395, 1398, 1463, - /* 490 */ 1409, 1414, 1451, 1399, 1416, 1417, 1455, 1242, 1473, 1447, - /* 500 */ 1449, 1445, 1428, 1432, 1466, 1467, 1468, 1469, 1471, 1472, - /* 510 */ 1474, 1479, 1454, 1246, 1475, 1242, 1476, 1477, 1478, 1480, - /* 520 */ 1481, 1482, 1483, 1517, 1484, 1487, 1485, 1524, 1488, 1489, - /* 530 */ 1486, 1527, 1492, 1495, 1490, 1532, 1496, 1499, 1493, 1537, - /* 540 */ 1500, 1502, 1540, 1541, 1520, 1522, 1523, 1525, 1528, 1526, + /* 30 */ 270, 270, 270, 270, 270, 124, 124, 124, 51, 983, + /* 40 */ 983, 98, 29, 29, 86, 983, 17, 17, 29, 29, + /* 50 */ 29, 29, 29, 29, 109, 121, 164, 86, 121, 29, + /* 60 */ 29, 121, 29, 121, 121, 121, 29, 315, 430, 461, + /* 70 */ 563, 563, 165, 640, 250, 351, 250, 250, 250, 250, + /* 80 */ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + /* 90 */ 250, 250, 250, 250, 250, 17, 338, 253, 272, 509, + /* 100 */ 509, 509, 648, 272, 458, 121, 121, 121, 510, 469, + /* 110 */ 392, 392, 392, 392, 392, 392, 392, 617, 345, 188, + /* 120 */ 92, 304, 17, 7, 17, 150, 645, 518, 334, 545, + /* 130 */ 334, 664, 446, 59, 896, 886, 887, 782, 896, 896, + /* 140 */ 809, 800, 800, 896, 920, 922, 109, 458, 925, 109, + /* 150 */ 109, 896, 109, 935, 121, 121, 121, 121, 121, 121, + /* 160 */ 121, 121, 121, 121, 121, 887, 896, 935, 458, 920, + /* 170 */ 813, 922, 315, 458, 925, 315, 974, 803, 814, 957, + /* 180 */ 803, 814, 957, 957, 815, 827, 842, 841, 856, 458, + /* 190 */ 1025, 928, 847, 853, 845, 988, 121, 814, 957, 957, + /* 200 */ 814, 957, 955, 458, 925, 315, 510, 315, 458, 1035, + /* 210 */ 887, 469, 896, 315, 935, 1556, 1556, 1556, 1556, 1556, + /* 220 */ 562, 825, 309, 494, 1427, 1432, 13, 30, 110, 104, + /* 230 */ 385, 247, 247, 247, 247, 247, 247, 247, 246, 294, + /* 240 */ 162, 319, 501, 162, 162, 162, 716, 554, 682, 681, + /* 250 */ 686, 687, 698, 738, 750, 778, 291, 728, 736, 737, + /* 260 */ 780, 619, 611, 161, 742, 52, 758, 635, 776, 779, + /* 270 */ 784, 793, 817, 710, 771, 818, 824, 832, 835, 837, + /* 280 */ 840, 717, 843, 1136, 1138, 1075, 1140, 1103, 984, 1107, + /* 290 */ 1113, 1115, 995, 1155, 1120, 1122, 1000, 1161, 1124, 1163, + /* 300 */ 1126, 1166, 1093, 1018, 1020, 1061, 1030, 1171, 1177, 1125, + /* 310 */ 1038, 1179, 1182, 1097, 1184, 1185, 1186, 1187, 1190, 1191, + /* 320 */ 1192, 1197, 1203, 1204, 1205, 1207, 1208, 1209, 1211, 1212, + /* 330 */ 1074, 1195, 1213, 1214, 1215, 1216, 1222, 1178, 1201, 1225, + /* 340 */ 1231, 1232, 1233, 1235, 1236, 1237, 1239, 1198, 1242, 1196, + /* 350 */ 1243, 1248, 1221, 1210, 1206, 1251, 1226, 1217, 1223, 1252, + /* 360 */ 1227, 1234, 1224, 1268, 1240, 1241, 1228, 1272, 1273, 1275, + /* 370 */ 1279, 1202, 1199, 1245, 1230, 1262, 1287, 1250, 1254, 1255, + /* 380 */ 1256, 1244, 1230, 1258, 1259, 1298, 1280, 1304, 1283, 1271, + /* 390 */ 1316, 1295, 1285, 1318, 1305, 1326, 1306, 1309, 1330, 1219, + /* 400 */ 1180, 1294, 1333, 1188, 1314, 1229, 1218, 1337, 1338, 1238, + /* 410 */ 1340, 1269, 1299, 1247, 1276, 1277, 1153, 1284, 1281, 1293, + /* 420 */ 1286, 1297, 1300, 1302, 1301, 1260, 1307, 1311, 1159, 1303, + /* 430 */ 1308, 1265, 1169, 1313, 1315, 1310, 1319, 1164, 1365, 1335, + /* 440 */ 1353, 1354, 1355, 1356, 1361, 1398, 1249, 1317, 1329, 1331, + /* 450 */ 1334, 1332, 1336, 1339, 1341, 1343, 1344, 1288, 1345, 1408, + /* 460 */ 1368, 1282, 1346, 1350, 1342, 1349, 1399, 1348, 1351, 1364, + /* 470 */ 1385, 1387, 1366, 1367, 1391, 1371, 1374, 1392, 1372, 1375, + /* 480 */ 1403, 1377, 1378, 1417, 1382, 1358, 1362, 1363, 1373, 1438, + /* 490 */ 1380, 1404, 1435, 1370, 1406, 1407, 1444, 1230, 1462, 1434, + /* 500 */ 1436, 1430, 1419, 1418, 1456, 1457, 1458, 1460, 1461, 1463, + /* 510 */ 1464, 1481, 1448, 1244, 1468, 1230, 1469, 1470, 1471, 1472, + /* 520 */ 1473, 1474, 1475, 1515, 1478, 1482, 1483, 1517, 1486, 1489, + /* 530 */ 1484, 1528, 1491, 1494, 1488, 1532, 1498, 1505, 1500, 1544, + /* 540 */ 1507, 1509, 1547, 1548, 1527, 1529, 1530, 1531, 1533, 1535, }; #define YY_REDUCE_COUNT (219) -#define YY_REDUCE_MIN (-274) -#define YY_REDUCE_MAX (1168) +#define YY_REDUCE_MIN (-272) +#define YY_REDUCE_MAX (1246) static const short yy_reduce_ofst[] = { - /* 0 */ -26, -195, 59, -122, 476, 512, 548, 598, 625, 640, - /* 10 */ 423, 667, 705, 743, 770, 778, 822, 856, 864, 869, - /* 20 */ 911, 916, 924, 968, 983, 994, 1019, 1053, 1066, 1100, - /* 30 */ 1108, 1113, 1155, 1160, 1168, -148, 175, 227, -163, -239, - /* 40 */ -201, -246, -142, 427, 206, -255, -253, -120, 54, 88, - /* 50 */ 291, 347, 429, 431, 66, -113, 62, 105, -87, 435, - /* 60 */ 457, 158, 474, 424, 469, 437, 504, 79, -208, -274, - /* 70 */ -274, -274, -204, -227, 81, -99, 91, 156, 196, 198, - /* 80 */ 202, 309, 338, 355, 376, 398, 407, 422, 436, 470, - /* 90 */ 471, 513, 514, 550, 552, -159, -132, 176, -45, -89, - /* 100 */ -38, 231, 241, 106, 221, 17, 335, 336, 303, 344, - /* 110 */ -226, 141, 162, 296, 349, 350, 359, 147, 396, 484, - /* 120 */ 454, 478, 520, 554, 565, 529, 618, 564, 551, 551, - /* 130 */ 551, 614, 549, 570, 651, 612, 672, 646, 687, 693, - /* 140 */ 675, 696, 698, 734, 689, 701, 740, 718, 710, 746, - /* 150 */ 748, 747, 749, 758, 737, 738, 739, 741, 753, 763, - /* 160 */ 765, 766, 768, 769, 771, 754, 760, 773, 779, 713, - /* 170 */ 719, 727, 777, 781, 755, 780, 756, 709, 774, 772, - /* 180 */ 735, 775, 783, 784, 750, 757, 762, 759, 551, 805, - /* 190 */ 789, 785, 776, 792, 786, 787, 614, 808, 820, 823, - /* 200 */ 813, 825, 818, 841, 824, 868, 870, 871, 843, 848, - /* 210 */ 881, 865, 886, 876, 892, 846, 878, 884, 896, 879, + /* 0 */ -27, -196, 21, -123, 512, 548, 560, 602, 74, 608, + /* 10 */ 660, 707, 724, 762, 789, 797, 831, 839, 873, 844, + /* 20 */ 898, 944, 952, 980, 986, 1032, 1037, 1045, 1087, 1112, + /* 30 */ 1121, 1189, 1194, 1200, 1246, -149, 174, 295, -164, -240, + /* 40 */ -237, -247, -143, 22, -30, -256, -254, -97, -209, 87, + /* 50 */ 288, 293, 296, 306, 14, 262, -144, -271, 117, 346, + /* 60 */ 368, 285, 391, 423, 428, 429, 484, 353, -210, -272, + /* 70 */ -272, -272, -158, -102, -189, -93, 31, 58, 197, 251, + /* 80 */ 305, 376, 441, 442, 456, 457, 466, 468, 478, 497, + /* 90 */ 505, 516, 517, 519, 522, -249, -133, 190, -23, 180, + /* 100 */ 181, 301, 240, 449, 215, 443, 158, 269, 504, 341, + /* 110 */ 454, 460, 520, 555, 572, 582, 589, 532, 614, 622, + /* 120 */ 526, 544, 603, 616, 620, 576, 671, 621, 610, 610, + /* 130 */ 610, 668, 609, 624, 702, 654, 701, 663, 709, 711, + /* 140 */ 679, 683, 688, 720, 673, 684, 726, 704, 694, 729, + /* 150 */ 731, 734, 733, 741, 722, 727, 730, 732, 739, 740, + /* 160 */ 743, 749, 751, 752, 754, 747, 744, 756, 713, 706, + /* 170 */ 725, 735, 760, 759, 745, 775, 746, 700, 748, 764, + /* 180 */ 705, 765, 767, 769, 753, 761, 755, 763, 610, 785, + /* 190 */ 774, 773, 772, 757, 768, 788, 668, 811, 820, 821, + /* 200 */ 823, 826, 838, 851, 836, 878, 866, 883, 860, 872, + /* 210 */ 899, 897, 904, 907, 911, 863, 901, 902, 910, 926, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 10 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 20 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 30 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 40 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 50 */ 1219, 1219, 1219, 1219, 1278, 1219, 1219, 1219, 1219, 1219, - /* 60 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1276, 1416, 1219, - /* 70 */ 1551, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 80 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 90 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1278, 1219, 1562, - /* 100 */ 1562, 1562, 1276, 1219, 1219, 1219, 1219, 1219, 1371, 1219, - /* 110 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1450, 1219, 1219, - /* 120 */ 1626, 1219, 1219, 1324, 1219, 1586, 1219, 1578, 1554, 1568, - /* 130 */ 1555, 1219, 1611, 1571, 1219, 1219, 1219, 1442, 1219, 1219, - /* 140 */ 1421, 1418, 1418, 1219, 1219, 1219, 1278, 1219, 1219, 1278, - /* 150 */ 1278, 1219, 1278, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 160 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 170 */ 1452, 1219, 1276, 1219, 1219, 1276, 1219, 1593, 1591, 1219, - /* 180 */ 1593, 1591, 1219, 1219, 1605, 1601, 1584, 1582, 1568, 1219, - /* 190 */ 1219, 1219, 1629, 1617, 1613, 1219, 1219, 1591, 1219, 1219, - /* 200 */ 1591, 1219, 1429, 1219, 1219, 1276, 1219, 1276, 1219, 1340, - /* 210 */ 1219, 1219, 1219, 1276, 1219, 1444, 1374, 1374, 1279, 1224, - /* 220 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 230 */ 1219, 1515, 1604, 1603, 1514, 1528, 1527, 1526, 1219, 1219, - /* 240 */ 1509, 1219, 1219, 1510, 1508, 1507, 1219, 1219, 1219, 1219, - /* 250 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 260 */ 1552, 1219, 1614, 1618, 1219, 1219, 1219, 1489, 1219, 1219, - /* 270 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 280 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 290 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 300 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 310 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 320 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 330 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 340 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 350 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 360 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 370 */ 1219, 1219, 1219, 1219, 1385, 1219, 1219, 1219, 1219, 1219, - /* 380 */ 1219, 1305, 1304, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 390 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 400 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 410 */ 1219, 1219, 1219, 1219, 1575, 1585, 1219, 1219, 1219, 1219, - /* 420 */ 1219, 1219, 1219, 1219, 1219, 1489, 1219, 1602, 1219, 1561, - /* 430 */ 1557, 1219, 1219, 1553, 1219, 1219, 1612, 1219, 1219, 1219, - /* 440 */ 1219, 1219, 1219, 1219, 1219, 1547, 1219, 1219, 1219, 1219, - /* 450 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 460 */ 1219, 1219, 1219, 1219, 1488, 1219, 1219, 1219, 1219, 1219, - /* 470 */ 1219, 1219, 1368, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 480 */ 1219, 1219, 1219, 1219, 1219, 1353, 1351, 1350, 1349, 1219, - /* 490 */ 1346, 1219, 1219, 1219, 1219, 1219, 1219, 1376, 1219, 1219, - /* 500 */ 1219, 1219, 1219, 1299, 1219, 1219, 1219, 1219, 1219, 1219, - /* 510 */ 1219, 1219, 1219, 1290, 1219, 1289, 1219, 1219, 1219, 1219, - /* 520 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 530 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 540 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, + /* 0 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 10 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 20 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 30 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 40 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 50 */ 1221, 1221, 1221, 1221, 1280, 1221, 1221, 1221, 1221, 1221, + /* 60 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1278, 1418, 1221, + /* 70 */ 1554, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 80 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 90 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1280, 1221, 1565, + /* 100 */ 1565, 1565, 1278, 1221, 1221, 1221, 1221, 1221, 1373, 1221, + /* 110 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1452, 1221, 1221, + /* 120 */ 1629, 1221, 1221, 1326, 1221, 1589, 1221, 1581, 1557, 1571, + /* 130 */ 1558, 1221, 1614, 1574, 1221, 1221, 1221, 1444, 1221, 1221, + /* 140 */ 1423, 1420, 1420, 1221, 1221, 1221, 1280, 1221, 1221, 1280, + /* 150 */ 1280, 1221, 1280, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 160 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 170 */ 1454, 1221, 1278, 1221, 1221, 1278, 1221, 1596, 1594, 1221, + /* 180 */ 1596, 1594, 1221, 1221, 1608, 1604, 1587, 1585, 1571, 1221, + /* 190 */ 1221, 1221, 1632, 1620, 1616, 1221, 1221, 1594, 1221, 1221, + /* 200 */ 1594, 1221, 1431, 1221, 1221, 1278, 1221, 1278, 1221, 1342, + /* 210 */ 1221, 1221, 1221, 1278, 1221, 1446, 1376, 1376, 1281, 1226, + /* 220 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 230 */ 1221, 1517, 1607, 1606, 1516, 1531, 1530, 1529, 1221, 1221, + /* 240 */ 1511, 1221, 1221, 1512, 1510, 1509, 1221, 1221, 1221, 1221, + /* 250 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 260 */ 1555, 1221, 1617, 1621, 1221, 1221, 1221, 1491, 1221, 1221, + /* 270 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 280 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 290 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 300 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 310 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 320 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 330 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 340 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 350 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 360 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 370 */ 1221, 1221, 1221, 1221, 1387, 1221, 1221, 1221, 1221, 1221, + /* 380 */ 1221, 1307, 1306, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 390 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 400 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 410 */ 1221, 1221, 1221, 1221, 1578, 1588, 1221, 1221, 1221, 1221, + /* 420 */ 1221, 1221, 1221, 1221, 1221, 1491, 1221, 1605, 1221, 1564, + /* 430 */ 1560, 1221, 1221, 1556, 1221, 1221, 1615, 1221, 1221, 1221, + /* 440 */ 1221, 1221, 1221, 1221, 1221, 1550, 1221, 1221, 1221, 1221, + /* 450 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 460 */ 1221, 1221, 1221, 1221, 1490, 1221, 1221, 1221, 1221, 1221, + /* 470 */ 1221, 1221, 1370, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 480 */ 1221, 1221, 1221, 1221, 1221, 1355, 1353, 1352, 1351, 1221, + /* 490 */ 1348, 1221, 1221, 1221, 1221, 1221, 1221, 1378, 1221, 1221, + /* 500 */ 1221, 1221, 1221, 1301, 1221, 1221, 1221, 1221, 1221, 1221, + /* 510 */ 1221, 1221, 1221, 1292, 1221, 1291, 1221, 1221, 1221, 1221, + /* 520 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 530 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 540 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, }; /********** End of lemon-generated parsing tables *****************************/ @@ -962,153 +964,154 @@ static const char *const yyTokenName[] = { /* 165 */ "LAST", /* 166 */ "CAST", /* 167 */ "NOW", - /* 168 */ "ROWTS", - /* 169 */ "TBNAME", - /* 170 */ "QSTARTTS", - /* 171 */ "QENDTS", - /* 172 */ "WSTARTTS", - /* 173 */ "WENDTS", - /* 174 */ "WDURATION", - /* 175 */ "BETWEEN", - /* 176 */ "IS", - /* 177 */ "NK_LT", - /* 178 */ "NK_GT", - /* 179 */ "NK_LE", - /* 180 */ "NK_GE", - /* 181 */ "NK_NE", - /* 182 */ "MATCH", - /* 183 */ "NMATCH", - /* 184 */ "JOIN", - /* 185 */ "INNER", - /* 186 */ "SELECT", - /* 187 */ "DISTINCT", - /* 188 */ "WHERE", - /* 189 */ "PARTITION", - /* 190 */ "BY", - /* 191 */ "SESSION", - /* 192 */ "STATE_WINDOW", - /* 193 */ "SLIDING", - /* 194 */ "FILL", - /* 195 */ "VALUE", - /* 196 */ "NONE", - /* 197 */ "PREV", - /* 198 */ "LINEAR", - /* 199 */ "NEXT", - /* 200 */ "GROUP", - /* 201 */ "HAVING", - /* 202 */ "ORDER", - /* 203 */ "SLIMIT", - /* 204 */ "SOFFSET", - /* 205 */ "LIMIT", - /* 206 */ "OFFSET", - /* 207 */ "ASC", - /* 208 */ "NULLS", - /* 209 */ "cmd", - /* 210 */ "account_options", - /* 211 */ "alter_account_options", - /* 212 */ "literal", - /* 213 */ "alter_account_option", - /* 214 */ "user_name", - /* 215 */ "dnode_endpoint", - /* 216 */ "dnode_host_name", - /* 217 */ "not_exists_opt", - /* 218 */ "db_name", - /* 219 */ "db_options", - /* 220 */ "exists_opt", - /* 221 */ "alter_db_options", - /* 222 */ "integer_list", - /* 223 */ "variable_list", - /* 224 */ "retention_list", - /* 225 */ "alter_db_option", - /* 226 */ "retention", - /* 227 */ "full_table_name", - /* 228 */ "column_def_list", - /* 229 */ "tags_def_opt", - /* 230 */ "table_options", - /* 231 */ "multi_create_clause", - /* 232 */ "tags_def", - /* 233 */ "multi_drop_clause", - /* 234 */ "alter_table_clause", - /* 235 */ "alter_table_options", - /* 236 */ "column_name", - /* 237 */ "type_name", - /* 238 */ "create_subtable_clause", - /* 239 */ "specific_tags_opt", - /* 240 */ "literal_list", - /* 241 */ "drop_table_clause", - /* 242 */ "col_name_list", - /* 243 */ "table_name", - /* 244 */ "column_def", - /* 245 */ "func_name_list", - /* 246 */ "alter_table_option", - /* 247 */ "col_name", - /* 248 */ "db_name_cond_opt", - /* 249 */ "like_pattern_opt", - /* 250 */ "table_name_cond", - /* 251 */ "from_db_opt", - /* 252 */ "func_name", - /* 253 */ "function_name", - /* 254 */ "index_name", - /* 255 */ "index_options", - /* 256 */ "func_list", - /* 257 */ "duration_literal", - /* 258 */ "sliding_opt", - /* 259 */ "func", - /* 260 */ "expression_list", - /* 261 */ "topic_name", - /* 262 */ "query_expression", - /* 263 */ "analyze_opt", - /* 264 */ "explain_options", - /* 265 */ "agg_func_opt", - /* 266 */ "bufsize_opt", - /* 267 */ "stream_name", - /* 268 */ "dnode_list", - /* 269 */ "signed", - /* 270 */ "signed_literal", - /* 271 */ "table_alias", - /* 272 */ "column_alias", - /* 273 */ "expression", - /* 274 */ "pseudo_column", - /* 275 */ "column_reference", - /* 276 */ "subquery", - /* 277 */ "predicate", - /* 278 */ "compare_op", - /* 279 */ "in_op", - /* 280 */ "in_predicate_value", - /* 281 */ "boolean_value_expression", - /* 282 */ "boolean_primary", - /* 283 */ "common_expression", - /* 284 */ "from_clause", - /* 285 */ "table_reference_list", - /* 286 */ "table_reference", - /* 287 */ "table_primary", - /* 288 */ "joined_table", - /* 289 */ "alias_opt", - /* 290 */ "parenthesized_joined_table", - /* 291 */ "join_type", - /* 292 */ "search_condition", - /* 293 */ "query_specification", - /* 294 */ "set_quantifier_opt", - /* 295 */ "select_list", - /* 296 */ "where_clause_opt", - /* 297 */ "partition_by_clause_opt", - /* 298 */ "twindow_clause_opt", - /* 299 */ "group_by_clause_opt", - /* 300 */ "having_clause_opt", - /* 301 */ "select_sublist", - /* 302 */ "select_item", - /* 303 */ "fill_opt", - /* 304 */ "fill_mode", - /* 305 */ "group_by_list", - /* 306 */ "query_expression_body", - /* 307 */ "order_by_clause_opt", - /* 308 */ "slimit_clause_opt", - /* 309 */ "limit_clause_opt", - /* 310 */ "query_primary", - /* 311 */ "sort_specification_list", - /* 312 */ "sort_specification", - /* 313 */ "ordering_specification_opt", - /* 314 */ "null_ordering_opt", + /* 168 */ "TODAY", + /* 169 */ "ROWTS", + /* 170 */ "TBNAME", + /* 171 */ "QSTARTTS", + /* 172 */ "QENDTS", + /* 173 */ "WSTARTTS", + /* 174 */ "WENDTS", + /* 175 */ "WDURATION", + /* 176 */ "BETWEEN", + /* 177 */ "IS", + /* 178 */ "NK_LT", + /* 179 */ "NK_GT", + /* 180 */ "NK_LE", + /* 181 */ "NK_GE", + /* 182 */ "NK_NE", + /* 183 */ "MATCH", + /* 184 */ "NMATCH", + /* 185 */ "JOIN", + /* 186 */ "INNER", + /* 187 */ "SELECT", + /* 188 */ "DISTINCT", + /* 189 */ "WHERE", + /* 190 */ "PARTITION", + /* 191 */ "BY", + /* 192 */ "SESSION", + /* 193 */ "STATE_WINDOW", + /* 194 */ "SLIDING", + /* 195 */ "FILL", + /* 196 */ "VALUE", + /* 197 */ "NONE", + /* 198 */ "PREV", + /* 199 */ "LINEAR", + /* 200 */ "NEXT", + /* 201 */ "GROUP", + /* 202 */ "HAVING", + /* 203 */ "ORDER", + /* 204 */ "SLIMIT", + /* 205 */ "SOFFSET", + /* 206 */ "LIMIT", + /* 207 */ "OFFSET", + /* 208 */ "ASC", + /* 209 */ "NULLS", + /* 210 */ "cmd", + /* 211 */ "account_options", + /* 212 */ "alter_account_options", + /* 213 */ "literal", + /* 214 */ "alter_account_option", + /* 215 */ "user_name", + /* 216 */ "dnode_endpoint", + /* 217 */ "dnode_host_name", + /* 218 */ "not_exists_opt", + /* 219 */ "db_name", + /* 220 */ "db_options", + /* 221 */ "exists_opt", + /* 222 */ "alter_db_options", + /* 223 */ "integer_list", + /* 224 */ "variable_list", + /* 225 */ "retention_list", + /* 226 */ "alter_db_option", + /* 227 */ "retention", + /* 228 */ "full_table_name", + /* 229 */ "column_def_list", + /* 230 */ "tags_def_opt", + /* 231 */ "table_options", + /* 232 */ "multi_create_clause", + /* 233 */ "tags_def", + /* 234 */ "multi_drop_clause", + /* 235 */ "alter_table_clause", + /* 236 */ "alter_table_options", + /* 237 */ "column_name", + /* 238 */ "type_name", + /* 239 */ "create_subtable_clause", + /* 240 */ "specific_tags_opt", + /* 241 */ "literal_list", + /* 242 */ "drop_table_clause", + /* 243 */ "col_name_list", + /* 244 */ "table_name", + /* 245 */ "column_def", + /* 246 */ "func_name_list", + /* 247 */ "alter_table_option", + /* 248 */ "col_name", + /* 249 */ "db_name_cond_opt", + /* 250 */ "like_pattern_opt", + /* 251 */ "table_name_cond", + /* 252 */ "from_db_opt", + /* 253 */ "func_name", + /* 254 */ "function_name", + /* 255 */ "index_name", + /* 256 */ "index_options", + /* 257 */ "func_list", + /* 258 */ "duration_literal", + /* 259 */ "sliding_opt", + /* 260 */ "func", + /* 261 */ "expression_list", + /* 262 */ "topic_name", + /* 263 */ "query_expression", + /* 264 */ "analyze_opt", + /* 265 */ "explain_options", + /* 266 */ "agg_func_opt", + /* 267 */ "bufsize_opt", + /* 268 */ "stream_name", + /* 269 */ "dnode_list", + /* 270 */ "signed", + /* 271 */ "signed_literal", + /* 272 */ "table_alias", + /* 273 */ "column_alias", + /* 274 */ "expression", + /* 275 */ "pseudo_column", + /* 276 */ "column_reference", + /* 277 */ "subquery", + /* 278 */ "predicate", + /* 279 */ "compare_op", + /* 280 */ "in_op", + /* 281 */ "in_predicate_value", + /* 282 */ "boolean_value_expression", + /* 283 */ "boolean_primary", + /* 284 */ "common_expression", + /* 285 */ "from_clause", + /* 286 */ "table_reference_list", + /* 287 */ "table_reference", + /* 288 */ "table_primary", + /* 289 */ "joined_table", + /* 290 */ "alias_opt", + /* 291 */ "parenthesized_joined_table", + /* 292 */ "join_type", + /* 293 */ "search_condition", + /* 294 */ "query_specification", + /* 295 */ "set_quantifier_opt", + /* 296 */ "select_list", + /* 297 */ "where_clause_opt", + /* 298 */ "partition_by_clause_opt", + /* 299 */ "twindow_clause_opt", + /* 300 */ "group_by_clause_opt", + /* 301 */ "having_clause_opt", + /* 302 */ "select_sublist", + /* 303 */ "select_item", + /* 304 */ "fill_opt", + /* 305 */ "fill_mode", + /* 306 */ "group_by_list", + /* 307 */ "query_expression_body", + /* 308 */ "order_by_clause_opt", + /* 309 */ "slimit_clause_opt", + /* 310 */ "limit_clause_opt", + /* 311 */ "query_primary", + /* 312 */ "sort_specification_list", + /* 313 */ "sort_specification", + /* 314 */ "ordering_specification_opt", + /* 315 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1413,119 +1416,120 @@ static const char *const yyRuleName[] = { /* 294 */ "column_reference ::= column_name", /* 295 */ "column_reference ::= table_name NK_DOT column_name", /* 296 */ "pseudo_column ::= NOW", - /* 297 */ "pseudo_column ::= ROWTS", - /* 298 */ "pseudo_column ::= TBNAME", - /* 299 */ "pseudo_column ::= QSTARTTS", - /* 300 */ "pseudo_column ::= QENDTS", - /* 301 */ "pseudo_column ::= WSTARTTS", - /* 302 */ "pseudo_column ::= WENDTS", - /* 303 */ "pseudo_column ::= WDURATION", - /* 304 */ "predicate ::= expression compare_op expression", - /* 305 */ "predicate ::= expression BETWEEN expression AND expression", - /* 306 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 307 */ "predicate ::= expression IS NULL", - /* 308 */ "predicate ::= expression IS NOT NULL", - /* 309 */ "predicate ::= expression in_op in_predicate_value", - /* 310 */ "compare_op ::= NK_LT", - /* 311 */ "compare_op ::= NK_GT", - /* 312 */ "compare_op ::= NK_LE", - /* 313 */ "compare_op ::= NK_GE", - /* 314 */ "compare_op ::= NK_NE", - /* 315 */ "compare_op ::= NK_EQ", - /* 316 */ "compare_op ::= LIKE", - /* 317 */ "compare_op ::= NOT LIKE", - /* 318 */ "compare_op ::= MATCH", - /* 319 */ "compare_op ::= NMATCH", - /* 320 */ "in_op ::= IN", - /* 321 */ "in_op ::= NOT IN", - /* 322 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 323 */ "boolean_value_expression ::= boolean_primary", - /* 324 */ "boolean_value_expression ::= NOT boolean_primary", - /* 325 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 326 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 327 */ "boolean_primary ::= predicate", - /* 328 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 329 */ "common_expression ::= expression", - /* 330 */ "common_expression ::= boolean_value_expression", - /* 331 */ "from_clause ::= FROM table_reference_list", - /* 332 */ "table_reference_list ::= table_reference", - /* 333 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 334 */ "table_reference ::= table_primary", - /* 335 */ "table_reference ::= joined_table", - /* 336 */ "table_primary ::= table_name alias_opt", - /* 337 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 338 */ "table_primary ::= subquery alias_opt", - /* 339 */ "table_primary ::= parenthesized_joined_table", - /* 340 */ "alias_opt ::=", - /* 341 */ "alias_opt ::= table_alias", - /* 342 */ "alias_opt ::= AS table_alias", - /* 343 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 344 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 345 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 346 */ "join_type ::=", - /* 347 */ "join_type ::= INNER", - /* 348 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 349 */ "set_quantifier_opt ::=", - /* 350 */ "set_quantifier_opt ::= DISTINCT", - /* 351 */ "set_quantifier_opt ::= ALL", - /* 352 */ "select_list ::= NK_STAR", - /* 353 */ "select_list ::= select_sublist", - /* 354 */ "select_sublist ::= select_item", - /* 355 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 356 */ "select_item ::= common_expression", - /* 357 */ "select_item ::= common_expression column_alias", - /* 358 */ "select_item ::= common_expression AS column_alias", - /* 359 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 360 */ "where_clause_opt ::=", - /* 361 */ "where_clause_opt ::= WHERE search_condition", - /* 362 */ "partition_by_clause_opt ::=", - /* 363 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 364 */ "twindow_clause_opt ::=", - /* 365 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 366 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 367 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 368 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 369 */ "sliding_opt ::=", - /* 370 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 371 */ "fill_opt ::=", - /* 372 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 373 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 374 */ "fill_mode ::= NONE", - /* 375 */ "fill_mode ::= PREV", - /* 376 */ "fill_mode ::= NULL", - /* 377 */ "fill_mode ::= LINEAR", - /* 378 */ "fill_mode ::= NEXT", - /* 379 */ "group_by_clause_opt ::=", - /* 380 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 381 */ "group_by_list ::= expression", - /* 382 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 383 */ "having_clause_opt ::=", - /* 384 */ "having_clause_opt ::= HAVING search_condition", - /* 385 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 386 */ "query_expression_body ::= query_primary", - /* 387 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 388 */ "query_primary ::= query_specification", - /* 389 */ "order_by_clause_opt ::=", - /* 390 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 391 */ "slimit_clause_opt ::=", - /* 392 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 395 */ "limit_clause_opt ::=", - /* 396 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 399 */ "subquery ::= NK_LP query_expression NK_RP", - /* 400 */ "search_condition ::= common_expression", - /* 401 */ "sort_specification_list ::= sort_specification", - /* 402 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 403 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 404 */ "ordering_specification_opt ::=", - /* 405 */ "ordering_specification_opt ::= ASC", - /* 406 */ "ordering_specification_opt ::= DESC", - /* 407 */ "null_ordering_opt ::=", - /* 408 */ "null_ordering_opt ::= NULLS FIRST", - /* 409 */ "null_ordering_opt ::= NULLS LAST", + /* 297 */ "pseudo_column ::= TODAY", + /* 298 */ "pseudo_column ::= ROWTS", + /* 299 */ "pseudo_column ::= TBNAME", + /* 300 */ "pseudo_column ::= QSTARTTS", + /* 301 */ "pseudo_column ::= QENDTS", + /* 302 */ "pseudo_column ::= WSTARTTS", + /* 303 */ "pseudo_column ::= WENDTS", + /* 304 */ "pseudo_column ::= WDURATION", + /* 305 */ "predicate ::= expression compare_op expression", + /* 306 */ "predicate ::= expression BETWEEN expression AND expression", + /* 307 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 308 */ "predicate ::= expression IS NULL", + /* 309 */ "predicate ::= expression IS NOT NULL", + /* 310 */ "predicate ::= expression in_op in_predicate_value", + /* 311 */ "compare_op ::= NK_LT", + /* 312 */ "compare_op ::= NK_GT", + /* 313 */ "compare_op ::= NK_LE", + /* 314 */ "compare_op ::= NK_GE", + /* 315 */ "compare_op ::= NK_NE", + /* 316 */ "compare_op ::= NK_EQ", + /* 317 */ "compare_op ::= LIKE", + /* 318 */ "compare_op ::= NOT LIKE", + /* 319 */ "compare_op ::= MATCH", + /* 320 */ "compare_op ::= NMATCH", + /* 321 */ "in_op ::= IN", + /* 322 */ "in_op ::= NOT IN", + /* 323 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 324 */ "boolean_value_expression ::= boolean_primary", + /* 325 */ "boolean_value_expression ::= NOT boolean_primary", + /* 326 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 327 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 328 */ "boolean_primary ::= predicate", + /* 329 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 330 */ "common_expression ::= expression", + /* 331 */ "common_expression ::= boolean_value_expression", + /* 332 */ "from_clause ::= FROM table_reference_list", + /* 333 */ "table_reference_list ::= table_reference", + /* 334 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 335 */ "table_reference ::= table_primary", + /* 336 */ "table_reference ::= joined_table", + /* 337 */ "table_primary ::= table_name alias_opt", + /* 338 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 339 */ "table_primary ::= subquery alias_opt", + /* 340 */ "table_primary ::= parenthesized_joined_table", + /* 341 */ "alias_opt ::=", + /* 342 */ "alias_opt ::= table_alias", + /* 343 */ "alias_opt ::= AS table_alias", + /* 344 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 345 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 346 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 347 */ "join_type ::=", + /* 348 */ "join_type ::= INNER", + /* 349 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 350 */ "set_quantifier_opt ::=", + /* 351 */ "set_quantifier_opt ::= DISTINCT", + /* 352 */ "set_quantifier_opt ::= ALL", + /* 353 */ "select_list ::= NK_STAR", + /* 354 */ "select_list ::= select_sublist", + /* 355 */ "select_sublist ::= select_item", + /* 356 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 357 */ "select_item ::= common_expression", + /* 358 */ "select_item ::= common_expression column_alias", + /* 359 */ "select_item ::= common_expression AS column_alias", + /* 360 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 361 */ "where_clause_opt ::=", + /* 362 */ "where_clause_opt ::= WHERE search_condition", + /* 363 */ "partition_by_clause_opt ::=", + /* 364 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 365 */ "twindow_clause_opt ::=", + /* 366 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 367 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 368 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 369 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 370 */ "sliding_opt ::=", + /* 371 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 372 */ "fill_opt ::=", + /* 373 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 374 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 375 */ "fill_mode ::= NONE", + /* 376 */ "fill_mode ::= PREV", + /* 377 */ "fill_mode ::= NULL", + /* 378 */ "fill_mode ::= LINEAR", + /* 379 */ "fill_mode ::= NEXT", + /* 380 */ "group_by_clause_opt ::=", + /* 381 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 382 */ "group_by_list ::= expression", + /* 383 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 384 */ "having_clause_opt ::=", + /* 385 */ "having_clause_opt ::= HAVING search_condition", + /* 386 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 387 */ "query_expression_body ::= query_primary", + /* 388 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 389 */ "query_primary ::= query_specification", + /* 390 */ "order_by_clause_opt ::=", + /* 391 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 392 */ "slimit_clause_opt ::=", + /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 395 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 396 */ "limit_clause_opt ::=", + /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 399 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 400 */ "subquery ::= NK_LP query_expression NK_RP", + /* 401 */ "search_condition ::= common_expression", + /* 402 */ "sort_specification_list ::= sort_specification", + /* 403 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 404 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 405 */ "ordering_specification_opt ::=", + /* 406 */ "ordering_specification_opt ::= ASC", + /* 407 */ "ordering_specification_opt ::= DESC", + /* 408 */ "null_ordering_opt ::=", + /* 409 */ "null_ordering_opt ::= NULLS FIRST", + /* 410 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1652,156 +1656,156 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 209: /* cmd */ - case 212: /* literal */ - case 219: /* db_options */ - case 221: /* alter_db_options */ - case 226: /* retention */ - case 227: /* full_table_name */ - case 230: /* table_options */ - case 234: /* alter_table_clause */ - case 235: /* alter_table_options */ - case 238: /* create_subtable_clause */ - case 241: /* drop_table_clause */ - case 244: /* column_def */ - case 247: /* col_name */ - case 248: /* db_name_cond_opt */ - case 249: /* like_pattern_opt */ - case 250: /* table_name_cond */ - case 251: /* from_db_opt */ - case 252: /* func_name */ - case 255: /* index_options */ - case 257: /* duration_literal */ - case 258: /* sliding_opt */ - case 259: /* func */ - case 262: /* query_expression */ - case 264: /* explain_options */ - case 269: /* signed */ - case 270: /* signed_literal */ - case 273: /* expression */ - case 274: /* pseudo_column */ - case 275: /* column_reference */ - case 276: /* subquery */ - case 277: /* predicate */ - case 280: /* in_predicate_value */ - case 281: /* boolean_value_expression */ - case 282: /* boolean_primary */ - case 283: /* common_expression */ - case 284: /* from_clause */ - case 285: /* table_reference_list */ - case 286: /* table_reference */ - case 287: /* table_primary */ - case 288: /* joined_table */ - case 290: /* parenthesized_joined_table */ - case 292: /* search_condition */ - case 293: /* query_specification */ - case 296: /* where_clause_opt */ - case 298: /* twindow_clause_opt */ - case 300: /* having_clause_opt */ - case 302: /* select_item */ - case 303: /* fill_opt */ - case 306: /* query_expression_body */ - case 308: /* slimit_clause_opt */ - case 309: /* limit_clause_opt */ - case 310: /* query_primary */ - case 312: /* sort_specification */ + case 210: /* cmd */ + case 213: /* literal */ + case 220: /* db_options */ + case 222: /* alter_db_options */ + case 227: /* retention */ + case 228: /* full_table_name */ + case 231: /* table_options */ + case 235: /* alter_table_clause */ + case 236: /* alter_table_options */ + case 239: /* create_subtable_clause */ + case 242: /* drop_table_clause */ + case 245: /* column_def */ + case 248: /* col_name */ + case 249: /* db_name_cond_opt */ + case 250: /* like_pattern_opt */ + case 251: /* table_name_cond */ + case 252: /* from_db_opt */ + case 253: /* func_name */ + case 256: /* index_options */ + case 258: /* duration_literal */ + case 259: /* sliding_opt */ + case 260: /* func */ + case 263: /* query_expression */ + case 265: /* explain_options */ + case 270: /* signed */ + case 271: /* signed_literal */ + case 274: /* expression */ + case 275: /* pseudo_column */ + case 276: /* column_reference */ + case 277: /* subquery */ + case 278: /* predicate */ + case 281: /* in_predicate_value */ + case 282: /* boolean_value_expression */ + case 283: /* boolean_primary */ + case 284: /* common_expression */ + case 285: /* from_clause */ + case 286: /* table_reference_list */ + case 287: /* table_reference */ + case 288: /* table_primary */ + case 289: /* joined_table */ + case 291: /* parenthesized_joined_table */ + case 293: /* search_condition */ + case 294: /* query_specification */ + case 297: /* where_clause_opt */ + case 299: /* twindow_clause_opt */ + case 301: /* having_clause_opt */ + case 303: /* select_item */ + case 304: /* fill_opt */ + case 307: /* query_expression_body */ + case 309: /* slimit_clause_opt */ + case 310: /* limit_clause_opt */ + case 311: /* query_primary */ + case 313: /* sort_specification */ { - nodesDestroyNode((yypminor->yy182)); + nodesDestroyNode((yypminor->yy504)); } break; - case 210: /* account_options */ - case 211: /* alter_account_options */ - case 213: /* alter_account_option */ - case 266: /* bufsize_opt */ + case 211: /* account_options */ + case 212: /* alter_account_options */ + case 214: /* alter_account_option */ + case 267: /* bufsize_opt */ { } break; - case 214: /* user_name */ - case 215: /* dnode_endpoint */ - case 216: /* dnode_host_name */ - case 218: /* db_name */ - case 236: /* column_name */ - case 243: /* table_name */ - case 253: /* function_name */ - case 254: /* index_name */ - case 261: /* topic_name */ - case 267: /* stream_name */ - case 271: /* table_alias */ - case 272: /* column_alias */ - case 289: /* alias_opt */ + case 215: /* user_name */ + case 216: /* dnode_endpoint */ + case 217: /* dnode_host_name */ + case 219: /* db_name */ + case 237: /* column_name */ + case 244: /* table_name */ + case 254: /* function_name */ + case 255: /* index_name */ + case 262: /* topic_name */ + case 268: /* stream_name */ + case 272: /* table_alias */ + case 273: /* column_alias */ + case 290: /* alias_opt */ { } break; - case 217: /* not_exists_opt */ - case 220: /* exists_opt */ - case 263: /* analyze_opt */ - case 265: /* agg_func_opt */ - case 294: /* set_quantifier_opt */ + case 218: /* not_exists_opt */ + case 221: /* exists_opt */ + case 264: /* analyze_opt */ + case 266: /* agg_func_opt */ + case 295: /* set_quantifier_opt */ { } break; - case 222: /* integer_list */ - case 223: /* variable_list */ - case 224: /* retention_list */ - case 228: /* column_def_list */ - case 229: /* tags_def_opt */ - case 231: /* multi_create_clause */ - case 232: /* tags_def */ - case 233: /* multi_drop_clause */ - case 239: /* specific_tags_opt */ - case 240: /* literal_list */ - case 242: /* col_name_list */ - case 245: /* func_name_list */ - case 256: /* func_list */ - case 260: /* expression_list */ - case 268: /* dnode_list */ - case 295: /* select_list */ - case 297: /* partition_by_clause_opt */ - case 299: /* group_by_clause_opt */ - case 301: /* select_sublist */ - case 305: /* group_by_list */ - case 307: /* order_by_clause_opt */ - case 311: /* sort_specification_list */ + case 223: /* integer_list */ + case 224: /* variable_list */ + case 225: /* retention_list */ + case 229: /* column_def_list */ + case 230: /* tags_def_opt */ + case 232: /* multi_create_clause */ + case 233: /* tags_def */ + case 234: /* multi_drop_clause */ + case 240: /* specific_tags_opt */ + case 241: /* literal_list */ + case 243: /* col_name_list */ + case 246: /* func_name_list */ + case 257: /* func_list */ + case 261: /* expression_list */ + case 269: /* dnode_list */ + case 296: /* select_list */ + case 298: /* partition_by_clause_opt */ + case 300: /* group_by_clause_opt */ + case 302: /* select_sublist */ + case 306: /* group_by_list */ + case 308: /* order_by_clause_opt */ + case 312: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy334)); + nodesDestroyList((yypminor->yy488)); } break; - case 225: /* alter_db_option */ - case 246: /* alter_table_option */ + case 226: /* alter_db_option */ + case 247: /* alter_table_option */ { } break; - case 237: /* type_name */ + case 238: /* type_name */ { } break; - case 278: /* compare_op */ - case 279: /* in_op */ + case 279: /* compare_op */ + case 280: /* in_op */ { } break; - case 291: /* join_type */ + case 292: /* join_type */ { } break; - case 304: /* fill_mode */ + case 305: /* fill_mode */ { } break; - case 313: /* ordering_specification_opt */ + case 314: /* ordering_specification_opt */ { } break; - case 314: /* null_ordering_opt */ + case 315: /* null_ordering_opt */ { } @@ -2100,416 +2104,417 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 209, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 209, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 210, 0 }, /* (2) account_options ::= */ - { 210, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 210, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 210, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 210, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 210, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 210, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 210, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 210, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 210, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 211, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 211, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 213, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 213, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 213, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 213, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 213, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 213, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 213, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 213, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 213, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 213, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 209, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 209, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 209, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 209, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 209, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ - { 209, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 209, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ - { 209, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ - { 209, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 209, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 209, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ - { 209, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 215, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ - { 216, -1 }, /* (37) dnode_host_name ::= NK_ID */ - { 216, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ - { 209, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ - { 209, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 209, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (43) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (44) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (45) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (46) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (47) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (48) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 209, -5 }, /* (49) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 209, -4 }, /* (50) cmd ::= DROP DATABASE exists_opt db_name */ - { 209, -2 }, /* (51) cmd ::= USE db_name */ - { 209, -4 }, /* (52) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 217, -3 }, /* (53) not_exists_opt ::= IF NOT EXISTS */ - { 217, 0 }, /* (54) not_exists_opt ::= */ - { 220, -2 }, /* (55) exists_opt ::= IF EXISTS */ - { 220, 0 }, /* (56) exists_opt ::= */ - { 219, 0 }, /* (57) db_options ::= */ - { 219, -3 }, /* (58) db_options ::= db_options BLOCKS NK_INTEGER */ - { 219, -3 }, /* (59) db_options ::= db_options CACHE NK_INTEGER */ - { 219, -3 }, /* (60) db_options ::= db_options CACHELAST NK_INTEGER */ - { 219, -3 }, /* (61) db_options ::= db_options COMP NK_INTEGER */ - { 219, -3 }, /* (62) db_options ::= db_options DAYS NK_INTEGER */ - { 219, -3 }, /* (63) db_options ::= db_options DAYS NK_VARIABLE */ - { 219, -3 }, /* (64) db_options ::= db_options FSYNC NK_INTEGER */ - { 219, -3 }, /* (65) db_options ::= db_options MAXROWS NK_INTEGER */ - { 219, -3 }, /* (66) db_options ::= db_options MINROWS NK_INTEGER */ - { 219, -3 }, /* (67) db_options ::= db_options KEEP integer_list */ - { 219, -3 }, /* (68) db_options ::= db_options KEEP variable_list */ - { 219, -3 }, /* (69) db_options ::= db_options PRECISION NK_STRING */ - { 219, -3 }, /* (70) db_options ::= db_options QUORUM NK_INTEGER */ - { 219, -3 }, /* (71) db_options ::= db_options REPLICA NK_INTEGER */ - { 219, -3 }, /* (72) db_options ::= db_options TTL NK_INTEGER */ - { 219, -3 }, /* (73) db_options ::= db_options WAL NK_INTEGER */ - { 219, -3 }, /* (74) db_options ::= db_options VGROUPS NK_INTEGER */ - { 219, -3 }, /* (75) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 219, -3 }, /* (76) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 219, -3 }, /* (77) db_options ::= db_options RETENTIONS retention_list */ - { 221, -1 }, /* (78) alter_db_options ::= alter_db_option */ - { 221, -2 }, /* (79) alter_db_options ::= alter_db_options alter_db_option */ - { 225, -2 }, /* (80) alter_db_option ::= BLOCKS NK_INTEGER */ - { 225, -2 }, /* (81) alter_db_option ::= FSYNC NK_INTEGER */ - { 225, -2 }, /* (82) alter_db_option ::= KEEP integer_list */ - { 225, -2 }, /* (83) alter_db_option ::= KEEP variable_list */ - { 225, -2 }, /* (84) alter_db_option ::= WAL NK_INTEGER */ - { 225, -2 }, /* (85) alter_db_option ::= QUORUM NK_INTEGER */ - { 225, -2 }, /* (86) alter_db_option ::= CACHELAST NK_INTEGER */ - { 225, -2 }, /* (87) alter_db_option ::= REPLICA NK_INTEGER */ - { 222, -1 }, /* (88) integer_list ::= NK_INTEGER */ - { 222, -3 }, /* (89) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 223, -1 }, /* (90) variable_list ::= NK_VARIABLE */ - { 223, -3 }, /* (91) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 224, -1 }, /* (92) retention_list ::= retention */ - { 224, -3 }, /* (93) retention_list ::= retention_list NK_COMMA retention */ - { 226, -3 }, /* (94) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 209, -9 }, /* (95) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 209, -3 }, /* (96) cmd ::= CREATE TABLE multi_create_clause */ - { 209, -9 }, /* (97) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 209, -3 }, /* (98) cmd ::= DROP TABLE multi_drop_clause */ - { 209, -4 }, /* (99) cmd ::= DROP STABLE exists_opt full_table_name */ - { 209, -3 }, /* (100) cmd ::= ALTER TABLE alter_table_clause */ - { 209, -3 }, /* (101) cmd ::= ALTER STABLE alter_table_clause */ - { 234, -2 }, /* (102) alter_table_clause ::= full_table_name alter_table_options */ - { 234, -5 }, /* (103) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 234, -4 }, /* (104) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 234, -5 }, /* (105) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 234, -5 }, /* (106) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 234, -5 }, /* (107) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 234, -4 }, /* (108) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 234, -5 }, /* (109) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 234, -5 }, /* (110) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 234, -6 }, /* (111) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 231, -1 }, /* (112) multi_create_clause ::= create_subtable_clause */ - { 231, -2 }, /* (113) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 238, -9 }, /* (114) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 233, -1 }, /* (115) multi_drop_clause ::= drop_table_clause */ - { 233, -2 }, /* (116) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 241, -2 }, /* (117) drop_table_clause ::= exists_opt full_table_name */ - { 239, 0 }, /* (118) specific_tags_opt ::= */ - { 239, -3 }, /* (119) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 227, -1 }, /* (120) full_table_name ::= table_name */ - { 227, -3 }, /* (121) full_table_name ::= db_name NK_DOT table_name */ - { 228, -1 }, /* (122) column_def_list ::= column_def */ - { 228, -3 }, /* (123) column_def_list ::= column_def_list NK_COMMA column_def */ - { 244, -2 }, /* (124) column_def ::= column_name type_name */ - { 244, -4 }, /* (125) column_def ::= column_name type_name COMMENT NK_STRING */ - { 237, -1 }, /* (126) type_name ::= BOOL */ - { 237, -1 }, /* (127) type_name ::= TINYINT */ - { 237, -1 }, /* (128) type_name ::= SMALLINT */ - { 237, -1 }, /* (129) type_name ::= INT */ - { 237, -1 }, /* (130) type_name ::= INTEGER */ - { 237, -1 }, /* (131) type_name ::= BIGINT */ - { 237, -1 }, /* (132) type_name ::= FLOAT */ - { 237, -1 }, /* (133) type_name ::= DOUBLE */ - { 237, -4 }, /* (134) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 237, -1 }, /* (135) type_name ::= TIMESTAMP */ - { 237, -4 }, /* (136) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 237, -2 }, /* (137) type_name ::= TINYINT UNSIGNED */ - { 237, -2 }, /* (138) type_name ::= SMALLINT UNSIGNED */ - { 237, -2 }, /* (139) type_name ::= INT UNSIGNED */ - { 237, -2 }, /* (140) type_name ::= BIGINT UNSIGNED */ - { 237, -1 }, /* (141) type_name ::= JSON */ - { 237, -4 }, /* (142) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 237, -1 }, /* (143) type_name ::= MEDIUMBLOB */ - { 237, -1 }, /* (144) type_name ::= BLOB */ - { 237, -4 }, /* (145) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 237, -1 }, /* (146) type_name ::= DECIMAL */ - { 237, -4 }, /* (147) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 237, -6 }, /* (148) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 229, 0 }, /* (149) tags_def_opt ::= */ - { 229, -1 }, /* (150) tags_def_opt ::= tags_def */ - { 232, -4 }, /* (151) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 230, 0 }, /* (152) table_options ::= */ - { 230, -3 }, /* (153) table_options ::= table_options COMMENT NK_STRING */ - { 230, -3 }, /* (154) table_options ::= table_options KEEP integer_list */ - { 230, -3 }, /* (155) table_options ::= table_options TTL NK_INTEGER */ - { 230, -5 }, /* (156) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 230, -5 }, /* (157) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 230, -3 }, /* (158) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 230, -3 }, /* (159) table_options ::= table_options DELAY NK_INTEGER */ - { 235, -1 }, /* (160) alter_table_options ::= alter_table_option */ - { 235, -2 }, /* (161) alter_table_options ::= alter_table_options alter_table_option */ - { 246, -2 }, /* (162) alter_table_option ::= COMMENT NK_STRING */ - { 246, -2 }, /* (163) alter_table_option ::= KEEP integer_list */ - { 246, -2 }, /* (164) alter_table_option ::= TTL NK_INTEGER */ - { 242, -1 }, /* (165) col_name_list ::= col_name */ - { 242, -3 }, /* (166) col_name_list ::= col_name_list NK_COMMA col_name */ - { 247, -1 }, /* (167) col_name ::= column_name */ - { 209, -2 }, /* (168) cmd ::= SHOW DNODES */ - { 209, -2 }, /* (169) cmd ::= SHOW USERS */ - { 209, -2 }, /* (170) cmd ::= SHOW DATABASES */ - { 209, -4 }, /* (171) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 209, -4 }, /* (172) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 209, -3 }, /* (173) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 209, -2 }, /* (174) cmd ::= SHOW MNODES */ - { 209, -2 }, /* (175) cmd ::= SHOW MODULES */ - { 209, -2 }, /* (176) cmd ::= SHOW QNODES */ - { 209, -2 }, /* (177) cmd ::= SHOW FUNCTIONS */ - { 209, -5 }, /* (178) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 209, -2 }, /* (179) cmd ::= SHOW STREAMS */ - { 209, -2 }, /* (180) cmd ::= SHOW ACCOUNTS */ - { 209, -2 }, /* (181) cmd ::= SHOW APPS */ - { 209, -2 }, /* (182) cmd ::= SHOW CONNECTIONS */ - { 209, -2 }, /* (183) cmd ::= SHOW LICENCE */ - { 209, -2 }, /* (184) cmd ::= SHOW GRANTS */ - { 209, -4 }, /* (185) cmd ::= SHOW CREATE DATABASE db_name */ - { 209, -4 }, /* (186) cmd ::= SHOW CREATE TABLE full_table_name */ - { 209, -4 }, /* (187) cmd ::= SHOW CREATE STABLE full_table_name */ - { 209, -2 }, /* (188) cmd ::= SHOW QUERIES */ - { 209, -2 }, /* (189) cmd ::= SHOW SCORES */ - { 209, -2 }, /* (190) cmd ::= SHOW TOPICS */ - { 209, -2 }, /* (191) cmd ::= SHOW VARIABLES */ - { 209, -2 }, /* (192) cmd ::= SHOW BNODES */ - { 209, -2 }, /* (193) cmd ::= SHOW SNODES */ - { 248, 0 }, /* (194) db_name_cond_opt ::= */ - { 248, -2 }, /* (195) db_name_cond_opt ::= db_name NK_DOT */ - { 249, 0 }, /* (196) like_pattern_opt ::= */ - { 249, -2 }, /* (197) like_pattern_opt ::= LIKE NK_STRING */ - { 250, -1 }, /* (198) table_name_cond ::= table_name */ - { 251, 0 }, /* (199) from_db_opt ::= */ - { 251, -2 }, /* (200) from_db_opt ::= FROM db_name */ - { 245, -1 }, /* (201) func_name_list ::= func_name */ - { 245, -3 }, /* (202) func_name_list ::= func_name_list NK_COMMA col_name */ - { 252, -1 }, /* (203) func_name ::= function_name */ - { 209, -8 }, /* (204) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 209, -10 }, /* (205) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 209, -6 }, /* (206) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 255, 0 }, /* (207) index_options ::= */ - { 255, -9 }, /* (208) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 255, -11 }, /* (209) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 256, -1 }, /* (210) func_list ::= func */ - { 256, -3 }, /* (211) func_list ::= func_list NK_COMMA func */ - { 259, -4 }, /* (212) func ::= function_name NK_LP expression_list NK_RP */ - { 209, -6 }, /* (213) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 209, -6 }, /* (214) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 209, -4 }, /* (215) cmd ::= DROP TOPIC exists_opt topic_name */ - { 209, -2 }, /* (216) cmd ::= DESC full_table_name */ - { 209, -2 }, /* (217) cmd ::= DESCRIBE full_table_name */ - { 209, -3 }, /* (218) cmd ::= RESET QUERY CACHE */ - { 209, -4 }, /* (219) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 263, 0 }, /* (220) analyze_opt ::= */ - { 263, -1 }, /* (221) analyze_opt ::= ANALYZE */ - { 264, 0 }, /* (222) explain_options ::= */ - { 264, -3 }, /* (223) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 264, -3 }, /* (224) explain_options ::= explain_options RATIO NK_FLOAT */ - { 209, -6 }, /* (225) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 209, -9 }, /* (226) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 209, -3 }, /* (227) cmd ::= DROP FUNCTION function_name */ - { 265, 0 }, /* (228) agg_func_opt ::= */ - { 265, -1 }, /* (229) agg_func_opt ::= AGGREGATE */ - { 266, 0 }, /* (230) bufsize_opt ::= */ - { 266, -2 }, /* (231) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 209, -7 }, /* (232) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ - { 209, -3 }, /* (233) cmd ::= DROP STREAM stream_name */ - { 209, -3 }, /* (234) cmd ::= KILL CONNECTION NK_INTEGER */ - { 209, -3 }, /* (235) cmd ::= KILL QUERY NK_INTEGER */ - { 209, -4 }, /* (236) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 209, -4 }, /* (237) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 209, -3 }, /* (238) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 268, -2 }, /* (239) dnode_list ::= DNODE NK_INTEGER */ - { 268, -3 }, /* (240) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 209, -3 }, /* (241) cmd ::= SYNCDB db_name REPLICA */ - { 209, -1 }, /* (242) cmd ::= query_expression */ - { 212, -1 }, /* (243) literal ::= NK_INTEGER */ - { 212, -1 }, /* (244) literal ::= NK_FLOAT */ - { 212, -1 }, /* (245) literal ::= NK_STRING */ - { 212, -1 }, /* (246) literal ::= NK_BOOL */ - { 212, -2 }, /* (247) literal ::= TIMESTAMP NK_STRING */ - { 212, -1 }, /* (248) literal ::= duration_literal */ - { 212, -1 }, /* (249) literal ::= NULL */ - { 257, -1 }, /* (250) duration_literal ::= NK_VARIABLE */ - { 269, -1 }, /* (251) signed ::= NK_INTEGER */ - { 269, -2 }, /* (252) signed ::= NK_PLUS NK_INTEGER */ - { 269, -2 }, /* (253) signed ::= NK_MINUS NK_INTEGER */ - { 269, -1 }, /* (254) signed ::= NK_FLOAT */ - { 269, -2 }, /* (255) signed ::= NK_PLUS NK_FLOAT */ - { 269, -2 }, /* (256) signed ::= NK_MINUS NK_FLOAT */ - { 270, -1 }, /* (257) signed_literal ::= signed */ - { 270, -1 }, /* (258) signed_literal ::= NK_STRING */ - { 270, -1 }, /* (259) signed_literal ::= NK_BOOL */ - { 270, -2 }, /* (260) signed_literal ::= TIMESTAMP NK_STRING */ - { 270, -1 }, /* (261) signed_literal ::= duration_literal */ - { 270, -1 }, /* (262) signed_literal ::= NULL */ - { 240, -1 }, /* (263) literal_list ::= signed_literal */ - { 240, -3 }, /* (264) literal_list ::= literal_list NK_COMMA signed_literal */ - { 218, -1 }, /* (265) db_name ::= NK_ID */ - { 243, -1 }, /* (266) table_name ::= NK_ID */ - { 236, -1 }, /* (267) column_name ::= NK_ID */ - { 253, -1 }, /* (268) function_name ::= NK_ID */ - { 253, -1 }, /* (269) function_name ::= FIRST */ - { 253, -1 }, /* (270) function_name ::= LAST */ - { 271, -1 }, /* (271) table_alias ::= NK_ID */ - { 272, -1 }, /* (272) column_alias ::= NK_ID */ - { 214, -1 }, /* (273) user_name ::= NK_ID */ - { 254, -1 }, /* (274) index_name ::= NK_ID */ - { 261, -1 }, /* (275) topic_name ::= NK_ID */ - { 267, -1 }, /* (276) stream_name ::= NK_ID */ - { 273, -1 }, /* (277) expression ::= literal */ - { 273, -1 }, /* (278) expression ::= pseudo_column */ - { 273, -1 }, /* (279) expression ::= column_reference */ - { 273, -4 }, /* (280) expression ::= function_name NK_LP expression_list NK_RP */ - { 273, -4 }, /* (281) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 273, -6 }, /* (282) expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 273, -1 }, /* (283) expression ::= subquery */ - { 273, -3 }, /* (284) expression ::= NK_LP expression NK_RP */ - { 273, -2 }, /* (285) expression ::= NK_PLUS expression */ - { 273, -2 }, /* (286) expression ::= NK_MINUS expression */ - { 273, -3 }, /* (287) expression ::= expression NK_PLUS expression */ - { 273, -3 }, /* (288) expression ::= expression NK_MINUS expression */ - { 273, -3 }, /* (289) expression ::= expression NK_STAR expression */ - { 273, -3 }, /* (290) expression ::= expression NK_SLASH expression */ - { 273, -3 }, /* (291) expression ::= expression NK_REM expression */ - { 260, -1 }, /* (292) expression_list ::= expression */ - { 260, -3 }, /* (293) expression_list ::= expression_list NK_COMMA expression */ - { 275, -1 }, /* (294) column_reference ::= column_name */ - { 275, -3 }, /* (295) column_reference ::= table_name NK_DOT column_name */ - { 274, -1 }, /* (296) pseudo_column ::= NOW */ - { 274, -1 }, /* (297) pseudo_column ::= ROWTS */ - { 274, -1 }, /* (298) pseudo_column ::= TBNAME */ - { 274, -1 }, /* (299) pseudo_column ::= QSTARTTS */ - { 274, -1 }, /* (300) pseudo_column ::= QENDTS */ - { 274, -1 }, /* (301) pseudo_column ::= WSTARTTS */ - { 274, -1 }, /* (302) pseudo_column ::= WENDTS */ - { 274, -1 }, /* (303) pseudo_column ::= WDURATION */ - { 277, -3 }, /* (304) predicate ::= expression compare_op expression */ - { 277, -5 }, /* (305) predicate ::= expression BETWEEN expression AND expression */ - { 277, -6 }, /* (306) predicate ::= expression NOT BETWEEN expression AND expression */ - { 277, -3 }, /* (307) predicate ::= expression IS NULL */ - { 277, -4 }, /* (308) predicate ::= expression IS NOT NULL */ - { 277, -3 }, /* (309) predicate ::= expression in_op in_predicate_value */ - { 278, -1 }, /* (310) compare_op ::= NK_LT */ - { 278, -1 }, /* (311) compare_op ::= NK_GT */ - { 278, -1 }, /* (312) compare_op ::= NK_LE */ - { 278, -1 }, /* (313) compare_op ::= NK_GE */ - { 278, -1 }, /* (314) compare_op ::= NK_NE */ - { 278, -1 }, /* (315) compare_op ::= NK_EQ */ - { 278, -1 }, /* (316) compare_op ::= LIKE */ - { 278, -2 }, /* (317) compare_op ::= NOT LIKE */ - { 278, -1 }, /* (318) compare_op ::= MATCH */ - { 278, -1 }, /* (319) compare_op ::= NMATCH */ - { 279, -1 }, /* (320) in_op ::= IN */ - { 279, -2 }, /* (321) in_op ::= NOT IN */ - { 280, -3 }, /* (322) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 281, -1 }, /* (323) boolean_value_expression ::= boolean_primary */ - { 281, -2 }, /* (324) boolean_value_expression ::= NOT boolean_primary */ - { 281, -3 }, /* (325) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 281, -3 }, /* (326) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 282, -1 }, /* (327) boolean_primary ::= predicate */ - { 282, -3 }, /* (328) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 283, -1 }, /* (329) common_expression ::= expression */ - { 283, -1 }, /* (330) common_expression ::= boolean_value_expression */ - { 284, -2 }, /* (331) from_clause ::= FROM table_reference_list */ - { 285, -1 }, /* (332) table_reference_list ::= table_reference */ - { 285, -3 }, /* (333) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 286, -1 }, /* (334) table_reference ::= table_primary */ - { 286, -1 }, /* (335) table_reference ::= joined_table */ - { 287, -2 }, /* (336) table_primary ::= table_name alias_opt */ - { 287, -4 }, /* (337) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 287, -2 }, /* (338) table_primary ::= subquery alias_opt */ - { 287, -1 }, /* (339) table_primary ::= parenthesized_joined_table */ - { 289, 0 }, /* (340) alias_opt ::= */ - { 289, -1 }, /* (341) alias_opt ::= table_alias */ - { 289, -2 }, /* (342) alias_opt ::= AS table_alias */ - { 290, -3 }, /* (343) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 290, -3 }, /* (344) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 288, -6 }, /* (345) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 291, 0 }, /* (346) join_type ::= */ - { 291, -1 }, /* (347) join_type ::= INNER */ - { 293, -9 }, /* (348) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 294, 0 }, /* (349) set_quantifier_opt ::= */ - { 294, -1 }, /* (350) set_quantifier_opt ::= DISTINCT */ - { 294, -1 }, /* (351) set_quantifier_opt ::= ALL */ - { 295, -1 }, /* (352) select_list ::= NK_STAR */ - { 295, -1 }, /* (353) select_list ::= select_sublist */ - { 301, -1 }, /* (354) select_sublist ::= select_item */ - { 301, -3 }, /* (355) select_sublist ::= select_sublist NK_COMMA select_item */ - { 302, -1 }, /* (356) select_item ::= common_expression */ - { 302, -2 }, /* (357) select_item ::= common_expression column_alias */ - { 302, -3 }, /* (358) select_item ::= common_expression AS column_alias */ - { 302, -3 }, /* (359) select_item ::= table_name NK_DOT NK_STAR */ - { 296, 0 }, /* (360) where_clause_opt ::= */ - { 296, -2 }, /* (361) where_clause_opt ::= WHERE search_condition */ - { 297, 0 }, /* (362) partition_by_clause_opt ::= */ - { 297, -3 }, /* (363) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 298, 0 }, /* (364) twindow_clause_opt ::= */ - { 298, -6 }, /* (365) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 298, -4 }, /* (366) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 298, -6 }, /* (367) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 298, -8 }, /* (368) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 258, 0 }, /* (369) sliding_opt ::= */ - { 258, -4 }, /* (370) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 303, 0 }, /* (371) fill_opt ::= */ - { 303, -4 }, /* (372) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 303, -6 }, /* (373) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 304, -1 }, /* (374) fill_mode ::= NONE */ - { 304, -1 }, /* (375) fill_mode ::= PREV */ - { 304, -1 }, /* (376) fill_mode ::= NULL */ - { 304, -1 }, /* (377) fill_mode ::= LINEAR */ - { 304, -1 }, /* (378) fill_mode ::= NEXT */ - { 299, 0 }, /* (379) group_by_clause_opt ::= */ - { 299, -3 }, /* (380) group_by_clause_opt ::= GROUP BY group_by_list */ - { 305, -1 }, /* (381) group_by_list ::= expression */ - { 305, -3 }, /* (382) group_by_list ::= group_by_list NK_COMMA expression */ - { 300, 0 }, /* (383) having_clause_opt ::= */ - { 300, -2 }, /* (384) having_clause_opt ::= HAVING search_condition */ - { 262, -4 }, /* (385) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 306, -1 }, /* (386) query_expression_body ::= query_primary */ - { 306, -4 }, /* (387) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 310, -1 }, /* (388) query_primary ::= query_specification */ - { 307, 0 }, /* (389) order_by_clause_opt ::= */ - { 307, -3 }, /* (390) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 308, 0 }, /* (391) slimit_clause_opt ::= */ - { 308, -2 }, /* (392) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 308, -4 }, /* (393) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 308, -4 }, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 309, 0 }, /* (395) limit_clause_opt ::= */ - { 309, -2 }, /* (396) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 309, -4 }, /* (397) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 309, -4 }, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 276, -3 }, /* (399) subquery ::= NK_LP query_expression NK_RP */ - { 292, -1 }, /* (400) search_condition ::= common_expression */ - { 311, -1 }, /* (401) sort_specification_list ::= sort_specification */ - { 311, -3 }, /* (402) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 312, -3 }, /* (403) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 313, 0 }, /* (404) ordering_specification_opt ::= */ - { 313, -1 }, /* (405) ordering_specification_opt ::= ASC */ - { 313, -1 }, /* (406) ordering_specification_opt ::= DESC */ - { 314, 0 }, /* (407) null_ordering_opt ::= */ - { 314, -2 }, /* (408) null_ordering_opt ::= NULLS FIRST */ - { 314, -2 }, /* (409) null_ordering_opt ::= NULLS LAST */ + { 210, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 210, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 211, 0 }, /* (2) account_options ::= */ + { 211, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 211, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 211, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 211, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 211, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 211, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 211, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 211, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 211, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 212, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 212, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 214, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 214, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 214, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 214, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 214, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 214, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 214, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 214, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 214, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 214, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 210, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 210, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 210, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 210, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 210, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 210, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 210, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 210, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 210, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 210, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 210, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 210, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 216, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 217, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 217, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 210, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 210, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 210, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (43) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (44) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (45) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (46) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (47) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (48) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 210, -5 }, /* (49) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 210, -4 }, /* (50) cmd ::= DROP DATABASE exists_opt db_name */ + { 210, -2 }, /* (51) cmd ::= USE db_name */ + { 210, -4 }, /* (52) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 218, -3 }, /* (53) not_exists_opt ::= IF NOT EXISTS */ + { 218, 0 }, /* (54) not_exists_opt ::= */ + { 221, -2 }, /* (55) exists_opt ::= IF EXISTS */ + { 221, 0 }, /* (56) exists_opt ::= */ + { 220, 0 }, /* (57) db_options ::= */ + { 220, -3 }, /* (58) db_options ::= db_options BLOCKS NK_INTEGER */ + { 220, -3 }, /* (59) db_options ::= db_options CACHE NK_INTEGER */ + { 220, -3 }, /* (60) db_options ::= db_options CACHELAST NK_INTEGER */ + { 220, -3 }, /* (61) db_options ::= db_options COMP NK_INTEGER */ + { 220, -3 }, /* (62) db_options ::= db_options DAYS NK_INTEGER */ + { 220, -3 }, /* (63) db_options ::= db_options DAYS NK_VARIABLE */ + { 220, -3 }, /* (64) db_options ::= db_options FSYNC NK_INTEGER */ + { 220, -3 }, /* (65) db_options ::= db_options MAXROWS NK_INTEGER */ + { 220, -3 }, /* (66) db_options ::= db_options MINROWS NK_INTEGER */ + { 220, -3 }, /* (67) db_options ::= db_options KEEP integer_list */ + { 220, -3 }, /* (68) db_options ::= db_options KEEP variable_list */ + { 220, -3 }, /* (69) db_options ::= db_options PRECISION NK_STRING */ + { 220, -3 }, /* (70) db_options ::= db_options QUORUM NK_INTEGER */ + { 220, -3 }, /* (71) db_options ::= db_options REPLICA NK_INTEGER */ + { 220, -3 }, /* (72) db_options ::= db_options TTL NK_INTEGER */ + { 220, -3 }, /* (73) db_options ::= db_options WAL NK_INTEGER */ + { 220, -3 }, /* (74) db_options ::= db_options VGROUPS NK_INTEGER */ + { 220, -3 }, /* (75) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 220, -3 }, /* (76) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 220, -3 }, /* (77) db_options ::= db_options RETENTIONS retention_list */ + { 222, -1 }, /* (78) alter_db_options ::= alter_db_option */ + { 222, -2 }, /* (79) alter_db_options ::= alter_db_options alter_db_option */ + { 226, -2 }, /* (80) alter_db_option ::= BLOCKS NK_INTEGER */ + { 226, -2 }, /* (81) alter_db_option ::= FSYNC NK_INTEGER */ + { 226, -2 }, /* (82) alter_db_option ::= KEEP integer_list */ + { 226, -2 }, /* (83) alter_db_option ::= KEEP variable_list */ + { 226, -2 }, /* (84) alter_db_option ::= WAL NK_INTEGER */ + { 226, -2 }, /* (85) alter_db_option ::= QUORUM NK_INTEGER */ + { 226, -2 }, /* (86) alter_db_option ::= CACHELAST NK_INTEGER */ + { 226, -2 }, /* (87) alter_db_option ::= REPLICA NK_INTEGER */ + { 223, -1 }, /* (88) integer_list ::= NK_INTEGER */ + { 223, -3 }, /* (89) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 224, -1 }, /* (90) variable_list ::= NK_VARIABLE */ + { 224, -3 }, /* (91) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 225, -1 }, /* (92) retention_list ::= retention */ + { 225, -3 }, /* (93) retention_list ::= retention_list NK_COMMA retention */ + { 227, -3 }, /* (94) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 210, -9 }, /* (95) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 210, -3 }, /* (96) cmd ::= CREATE TABLE multi_create_clause */ + { 210, -9 }, /* (97) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 210, -3 }, /* (98) cmd ::= DROP TABLE multi_drop_clause */ + { 210, -4 }, /* (99) cmd ::= DROP STABLE exists_opt full_table_name */ + { 210, -3 }, /* (100) cmd ::= ALTER TABLE alter_table_clause */ + { 210, -3 }, /* (101) cmd ::= ALTER STABLE alter_table_clause */ + { 235, -2 }, /* (102) alter_table_clause ::= full_table_name alter_table_options */ + { 235, -5 }, /* (103) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 235, -4 }, /* (104) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 235, -5 }, /* (105) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 235, -5 }, /* (106) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 235, -5 }, /* (107) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 235, -4 }, /* (108) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 235, -5 }, /* (109) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 235, -5 }, /* (110) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 235, -6 }, /* (111) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 232, -1 }, /* (112) multi_create_clause ::= create_subtable_clause */ + { 232, -2 }, /* (113) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 239, -9 }, /* (114) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 234, -1 }, /* (115) multi_drop_clause ::= drop_table_clause */ + { 234, -2 }, /* (116) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 242, -2 }, /* (117) drop_table_clause ::= exists_opt full_table_name */ + { 240, 0 }, /* (118) specific_tags_opt ::= */ + { 240, -3 }, /* (119) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 228, -1 }, /* (120) full_table_name ::= table_name */ + { 228, -3 }, /* (121) full_table_name ::= db_name NK_DOT table_name */ + { 229, -1 }, /* (122) column_def_list ::= column_def */ + { 229, -3 }, /* (123) column_def_list ::= column_def_list NK_COMMA column_def */ + { 245, -2 }, /* (124) column_def ::= column_name type_name */ + { 245, -4 }, /* (125) column_def ::= column_name type_name COMMENT NK_STRING */ + { 238, -1 }, /* (126) type_name ::= BOOL */ + { 238, -1 }, /* (127) type_name ::= TINYINT */ + { 238, -1 }, /* (128) type_name ::= SMALLINT */ + { 238, -1 }, /* (129) type_name ::= INT */ + { 238, -1 }, /* (130) type_name ::= INTEGER */ + { 238, -1 }, /* (131) type_name ::= BIGINT */ + { 238, -1 }, /* (132) type_name ::= FLOAT */ + { 238, -1 }, /* (133) type_name ::= DOUBLE */ + { 238, -4 }, /* (134) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 238, -1 }, /* (135) type_name ::= TIMESTAMP */ + { 238, -4 }, /* (136) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 238, -2 }, /* (137) type_name ::= TINYINT UNSIGNED */ + { 238, -2 }, /* (138) type_name ::= SMALLINT UNSIGNED */ + { 238, -2 }, /* (139) type_name ::= INT UNSIGNED */ + { 238, -2 }, /* (140) type_name ::= BIGINT UNSIGNED */ + { 238, -1 }, /* (141) type_name ::= JSON */ + { 238, -4 }, /* (142) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 238, -1 }, /* (143) type_name ::= MEDIUMBLOB */ + { 238, -1 }, /* (144) type_name ::= BLOB */ + { 238, -4 }, /* (145) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 238, -1 }, /* (146) type_name ::= DECIMAL */ + { 238, -4 }, /* (147) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 238, -6 }, /* (148) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 230, 0 }, /* (149) tags_def_opt ::= */ + { 230, -1 }, /* (150) tags_def_opt ::= tags_def */ + { 233, -4 }, /* (151) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 231, 0 }, /* (152) table_options ::= */ + { 231, -3 }, /* (153) table_options ::= table_options COMMENT NK_STRING */ + { 231, -3 }, /* (154) table_options ::= table_options KEEP integer_list */ + { 231, -3 }, /* (155) table_options ::= table_options TTL NK_INTEGER */ + { 231, -5 }, /* (156) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 231, -5 }, /* (157) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 231, -3 }, /* (158) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 231, -3 }, /* (159) table_options ::= table_options DELAY NK_INTEGER */ + { 236, -1 }, /* (160) alter_table_options ::= alter_table_option */ + { 236, -2 }, /* (161) alter_table_options ::= alter_table_options alter_table_option */ + { 247, -2 }, /* (162) alter_table_option ::= COMMENT NK_STRING */ + { 247, -2 }, /* (163) alter_table_option ::= KEEP integer_list */ + { 247, -2 }, /* (164) alter_table_option ::= TTL NK_INTEGER */ + { 243, -1 }, /* (165) col_name_list ::= col_name */ + { 243, -3 }, /* (166) col_name_list ::= col_name_list NK_COMMA col_name */ + { 248, -1 }, /* (167) col_name ::= column_name */ + { 210, -2 }, /* (168) cmd ::= SHOW DNODES */ + { 210, -2 }, /* (169) cmd ::= SHOW USERS */ + { 210, -2 }, /* (170) cmd ::= SHOW DATABASES */ + { 210, -4 }, /* (171) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 210, -4 }, /* (172) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 210, -3 }, /* (173) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 210, -2 }, /* (174) cmd ::= SHOW MNODES */ + { 210, -2 }, /* (175) cmd ::= SHOW MODULES */ + { 210, -2 }, /* (176) cmd ::= SHOW QNODES */ + { 210, -2 }, /* (177) cmd ::= SHOW FUNCTIONS */ + { 210, -5 }, /* (178) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 210, -2 }, /* (179) cmd ::= SHOW STREAMS */ + { 210, -2 }, /* (180) cmd ::= SHOW ACCOUNTS */ + { 210, -2 }, /* (181) cmd ::= SHOW APPS */ + { 210, -2 }, /* (182) cmd ::= SHOW CONNECTIONS */ + { 210, -2 }, /* (183) cmd ::= SHOW LICENCE */ + { 210, -2 }, /* (184) cmd ::= SHOW GRANTS */ + { 210, -4 }, /* (185) cmd ::= SHOW CREATE DATABASE db_name */ + { 210, -4 }, /* (186) cmd ::= SHOW CREATE TABLE full_table_name */ + { 210, -4 }, /* (187) cmd ::= SHOW CREATE STABLE full_table_name */ + { 210, -2 }, /* (188) cmd ::= SHOW QUERIES */ + { 210, -2 }, /* (189) cmd ::= SHOW SCORES */ + { 210, -2 }, /* (190) cmd ::= SHOW TOPICS */ + { 210, -2 }, /* (191) cmd ::= SHOW VARIABLES */ + { 210, -2 }, /* (192) cmd ::= SHOW BNODES */ + { 210, -2 }, /* (193) cmd ::= SHOW SNODES */ + { 249, 0 }, /* (194) db_name_cond_opt ::= */ + { 249, -2 }, /* (195) db_name_cond_opt ::= db_name NK_DOT */ + { 250, 0 }, /* (196) like_pattern_opt ::= */ + { 250, -2 }, /* (197) like_pattern_opt ::= LIKE NK_STRING */ + { 251, -1 }, /* (198) table_name_cond ::= table_name */ + { 252, 0 }, /* (199) from_db_opt ::= */ + { 252, -2 }, /* (200) from_db_opt ::= FROM db_name */ + { 246, -1 }, /* (201) func_name_list ::= func_name */ + { 246, -3 }, /* (202) func_name_list ::= func_name_list NK_COMMA col_name */ + { 253, -1 }, /* (203) func_name ::= function_name */ + { 210, -8 }, /* (204) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 210, -10 }, /* (205) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 210, -6 }, /* (206) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 256, 0 }, /* (207) index_options ::= */ + { 256, -9 }, /* (208) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 256, -11 }, /* (209) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 257, -1 }, /* (210) func_list ::= func */ + { 257, -3 }, /* (211) func_list ::= func_list NK_COMMA func */ + { 260, -4 }, /* (212) func ::= function_name NK_LP expression_list NK_RP */ + { 210, -6 }, /* (213) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 210, -6 }, /* (214) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 210, -4 }, /* (215) cmd ::= DROP TOPIC exists_opt topic_name */ + { 210, -2 }, /* (216) cmd ::= DESC full_table_name */ + { 210, -2 }, /* (217) cmd ::= DESCRIBE full_table_name */ + { 210, -3 }, /* (218) cmd ::= RESET QUERY CACHE */ + { 210, -4 }, /* (219) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 264, 0 }, /* (220) analyze_opt ::= */ + { 264, -1 }, /* (221) analyze_opt ::= ANALYZE */ + { 265, 0 }, /* (222) explain_options ::= */ + { 265, -3 }, /* (223) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 265, -3 }, /* (224) explain_options ::= explain_options RATIO NK_FLOAT */ + { 210, -6 }, /* (225) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 210, -9 }, /* (226) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 210, -3 }, /* (227) cmd ::= DROP FUNCTION function_name */ + { 266, 0 }, /* (228) agg_func_opt ::= */ + { 266, -1 }, /* (229) agg_func_opt ::= AGGREGATE */ + { 267, 0 }, /* (230) bufsize_opt ::= */ + { 267, -2 }, /* (231) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 210, -7 }, /* (232) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ + { 210, -3 }, /* (233) cmd ::= DROP STREAM stream_name */ + { 210, -3 }, /* (234) cmd ::= KILL CONNECTION NK_INTEGER */ + { 210, -3 }, /* (235) cmd ::= KILL QUERY NK_INTEGER */ + { 210, -4 }, /* (236) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 210, -4 }, /* (237) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 210, -3 }, /* (238) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 269, -2 }, /* (239) dnode_list ::= DNODE NK_INTEGER */ + { 269, -3 }, /* (240) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 210, -3 }, /* (241) cmd ::= SYNCDB db_name REPLICA */ + { 210, -1 }, /* (242) cmd ::= query_expression */ + { 213, -1 }, /* (243) literal ::= NK_INTEGER */ + { 213, -1 }, /* (244) literal ::= NK_FLOAT */ + { 213, -1 }, /* (245) literal ::= NK_STRING */ + { 213, -1 }, /* (246) literal ::= NK_BOOL */ + { 213, -2 }, /* (247) literal ::= TIMESTAMP NK_STRING */ + { 213, -1 }, /* (248) literal ::= duration_literal */ + { 213, -1 }, /* (249) literal ::= NULL */ + { 258, -1 }, /* (250) duration_literal ::= NK_VARIABLE */ + { 270, -1 }, /* (251) signed ::= NK_INTEGER */ + { 270, -2 }, /* (252) signed ::= NK_PLUS NK_INTEGER */ + { 270, -2 }, /* (253) signed ::= NK_MINUS NK_INTEGER */ + { 270, -1 }, /* (254) signed ::= NK_FLOAT */ + { 270, -2 }, /* (255) signed ::= NK_PLUS NK_FLOAT */ + { 270, -2 }, /* (256) signed ::= NK_MINUS NK_FLOAT */ + { 271, -1 }, /* (257) signed_literal ::= signed */ + { 271, -1 }, /* (258) signed_literal ::= NK_STRING */ + { 271, -1 }, /* (259) signed_literal ::= NK_BOOL */ + { 271, -2 }, /* (260) signed_literal ::= TIMESTAMP NK_STRING */ + { 271, -1 }, /* (261) signed_literal ::= duration_literal */ + { 271, -1 }, /* (262) signed_literal ::= NULL */ + { 241, -1 }, /* (263) literal_list ::= signed_literal */ + { 241, -3 }, /* (264) literal_list ::= literal_list NK_COMMA signed_literal */ + { 219, -1 }, /* (265) db_name ::= NK_ID */ + { 244, -1 }, /* (266) table_name ::= NK_ID */ + { 237, -1 }, /* (267) column_name ::= NK_ID */ + { 254, -1 }, /* (268) function_name ::= NK_ID */ + { 254, -1 }, /* (269) function_name ::= FIRST */ + { 254, -1 }, /* (270) function_name ::= LAST */ + { 272, -1 }, /* (271) table_alias ::= NK_ID */ + { 273, -1 }, /* (272) column_alias ::= NK_ID */ + { 215, -1 }, /* (273) user_name ::= NK_ID */ + { 255, -1 }, /* (274) index_name ::= NK_ID */ + { 262, -1 }, /* (275) topic_name ::= NK_ID */ + { 268, -1 }, /* (276) stream_name ::= NK_ID */ + { 274, -1 }, /* (277) expression ::= literal */ + { 274, -1 }, /* (278) expression ::= pseudo_column */ + { 274, -1 }, /* (279) expression ::= column_reference */ + { 274, -4 }, /* (280) expression ::= function_name NK_LP expression_list NK_RP */ + { 274, -4 }, /* (281) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 274, -6 }, /* (282) expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 274, -1 }, /* (283) expression ::= subquery */ + { 274, -3 }, /* (284) expression ::= NK_LP expression NK_RP */ + { 274, -2 }, /* (285) expression ::= NK_PLUS expression */ + { 274, -2 }, /* (286) expression ::= NK_MINUS expression */ + { 274, -3 }, /* (287) expression ::= expression NK_PLUS expression */ + { 274, -3 }, /* (288) expression ::= expression NK_MINUS expression */ + { 274, -3 }, /* (289) expression ::= expression NK_STAR expression */ + { 274, -3 }, /* (290) expression ::= expression NK_SLASH expression */ + { 274, -3 }, /* (291) expression ::= expression NK_REM expression */ + { 261, -1 }, /* (292) expression_list ::= expression */ + { 261, -3 }, /* (293) expression_list ::= expression_list NK_COMMA expression */ + { 276, -1 }, /* (294) column_reference ::= column_name */ + { 276, -3 }, /* (295) column_reference ::= table_name NK_DOT column_name */ + { 275, -1 }, /* (296) pseudo_column ::= NOW */ + { 275, -1 }, /* (297) pseudo_column ::= TODAY */ + { 275, -1 }, /* (298) pseudo_column ::= ROWTS */ + { 275, -1 }, /* (299) pseudo_column ::= TBNAME */ + { 275, -1 }, /* (300) pseudo_column ::= QSTARTTS */ + { 275, -1 }, /* (301) pseudo_column ::= QENDTS */ + { 275, -1 }, /* (302) pseudo_column ::= WSTARTTS */ + { 275, -1 }, /* (303) pseudo_column ::= WENDTS */ + { 275, -1 }, /* (304) pseudo_column ::= WDURATION */ + { 278, -3 }, /* (305) predicate ::= expression compare_op expression */ + { 278, -5 }, /* (306) predicate ::= expression BETWEEN expression AND expression */ + { 278, -6 }, /* (307) predicate ::= expression NOT BETWEEN expression AND expression */ + { 278, -3 }, /* (308) predicate ::= expression IS NULL */ + { 278, -4 }, /* (309) predicate ::= expression IS NOT NULL */ + { 278, -3 }, /* (310) predicate ::= expression in_op in_predicate_value */ + { 279, -1 }, /* (311) compare_op ::= NK_LT */ + { 279, -1 }, /* (312) compare_op ::= NK_GT */ + { 279, -1 }, /* (313) compare_op ::= NK_LE */ + { 279, -1 }, /* (314) compare_op ::= NK_GE */ + { 279, -1 }, /* (315) compare_op ::= NK_NE */ + { 279, -1 }, /* (316) compare_op ::= NK_EQ */ + { 279, -1 }, /* (317) compare_op ::= LIKE */ + { 279, -2 }, /* (318) compare_op ::= NOT LIKE */ + { 279, -1 }, /* (319) compare_op ::= MATCH */ + { 279, -1 }, /* (320) compare_op ::= NMATCH */ + { 280, -1 }, /* (321) in_op ::= IN */ + { 280, -2 }, /* (322) in_op ::= NOT IN */ + { 281, -3 }, /* (323) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 282, -1 }, /* (324) boolean_value_expression ::= boolean_primary */ + { 282, -2 }, /* (325) boolean_value_expression ::= NOT boolean_primary */ + { 282, -3 }, /* (326) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 282, -3 }, /* (327) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 283, -1 }, /* (328) boolean_primary ::= predicate */ + { 283, -3 }, /* (329) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 284, -1 }, /* (330) common_expression ::= expression */ + { 284, -1 }, /* (331) common_expression ::= boolean_value_expression */ + { 285, -2 }, /* (332) from_clause ::= FROM table_reference_list */ + { 286, -1 }, /* (333) table_reference_list ::= table_reference */ + { 286, -3 }, /* (334) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 287, -1 }, /* (335) table_reference ::= table_primary */ + { 287, -1 }, /* (336) table_reference ::= joined_table */ + { 288, -2 }, /* (337) table_primary ::= table_name alias_opt */ + { 288, -4 }, /* (338) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 288, -2 }, /* (339) table_primary ::= subquery alias_opt */ + { 288, -1 }, /* (340) table_primary ::= parenthesized_joined_table */ + { 290, 0 }, /* (341) alias_opt ::= */ + { 290, -1 }, /* (342) alias_opt ::= table_alias */ + { 290, -2 }, /* (343) alias_opt ::= AS table_alias */ + { 291, -3 }, /* (344) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 291, -3 }, /* (345) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 289, -6 }, /* (346) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 292, 0 }, /* (347) join_type ::= */ + { 292, -1 }, /* (348) join_type ::= INNER */ + { 294, -9 }, /* (349) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 295, 0 }, /* (350) set_quantifier_opt ::= */ + { 295, -1 }, /* (351) set_quantifier_opt ::= DISTINCT */ + { 295, -1 }, /* (352) set_quantifier_opt ::= ALL */ + { 296, -1 }, /* (353) select_list ::= NK_STAR */ + { 296, -1 }, /* (354) select_list ::= select_sublist */ + { 302, -1 }, /* (355) select_sublist ::= select_item */ + { 302, -3 }, /* (356) select_sublist ::= select_sublist NK_COMMA select_item */ + { 303, -1 }, /* (357) select_item ::= common_expression */ + { 303, -2 }, /* (358) select_item ::= common_expression column_alias */ + { 303, -3 }, /* (359) select_item ::= common_expression AS column_alias */ + { 303, -3 }, /* (360) select_item ::= table_name NK_DOT NK_STAR */ + { 297, 0 }, /* (361) where_clause_opt ::= */ + { 297, -2 }, /* (362) where_clause_opt ::= WHERE search_condition */ + { 298, 0 }, /* (363) partition_by_clause_opt ::= */ + { 298, -3 }, /* (364) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 299, 0 }, /* (365) twindow_clause_opt ::= */ + { 299, -6 }, /* (366) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 299, -4 }, /* (367) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 299, -6 }, /* (368) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 299, -8 }, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 259, 0 }, /* (370) sliding_opt ::= */ + { 259, -4 }, /* (371) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 304, 0 }, /* (372) fill_opt ::= */ + { 304, -4 }, /* (373) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 304, -6 }, /* (374) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 305, -1 }, /* (375) fill_mode ::= NONE */ + { 305, -1 }, /* (376) fill_mode ::= PREV */ + { 305, -1 }, /* (377) fill_mode ::= NULL */ + { 305, -1 }, /* (378) fill_mode ::= LINEAR */ + { 305, -1 }, /* (379) fill_mode ::= NEXT */ + { 300, 0 }, /* (380) group_by_clause_opt ::= */ + { 300, -3 }, /* (381) group_by_clause_opt ::= GROUP BY group_by_list */ + { 306, -1 }, /* (382) group_by_list ::= expression */ + { 306, -3 }, /* (383) group_by_list ::= group_by_list NK_COMMA expression */ + { 301, 0 }, /* (384) having_clause_opt ::= */ + { 301, -2 }, /* (385) having_clause_opt ::= HAVING search_condition */ + { 263, -4 }, /* (386) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 307, -1 }, /* (387) query_expression_body ::= query_primary */ + { 307, -4 }, /* (388) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 311, -1 }, /* (389) query_primary ::= query_specification */ + { 308, 0 }, /* (390) order_by_clause_opt ::= */ + { 308, -3 }, /* (391) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 309, 0 }, /* (392) slimit_clause_opt ::= */ + { 309, -2 }, /* (393) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 309, -4 }, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 309, -4 }, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 310, 0 }, /* (396) limit_clause_opt ::= */ + { 310, -2 }, /* (397) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 310, -4 }, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 310, -4 }, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 277, -3 }, /* (400) subquery ::= NK_LP query_expression NK_RP */ + { 293, -1 }, /* (401) search_condition ::= common_expression */ + { 312, -1 }, /* (402) sort_specification_list ::= sort_specification */ + { 312, -3 }, /* (403) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 313, -3 }, /* (404) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 314, 0 }, /* (405) ordering_specification_opt ::= */ + { 314, -1 }, /* (406) ordering_specification_opt ::= ASC */ + { 314, -1 }, /* (407) ordering_specification_opt ::= DESC */ + { 315, 0 }, /* (408) null_ordering_opt ::= */ + { 315, -2 }, /* (409) null_ordering_opt ::= NULLS FIRST */ + { 315, -2 }, /* (410) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2598,11 +2603,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,210,&yymsp[0].minor); + yy_destructor(yypParser,211,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,211,&yymsp[0].minor); + yy_destructor(yypParser,212,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2616,20 +2621,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,210,&yymsp[-2].minor); +{ yy_destructor(yypParser,211,&yymsp[-2].minor); { } - yy_destructor(yypParser,212,&yymsp[0].minor); + yy_destructor(yypParser,213,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,213,&yymsp[0].minor); +{ yy_destructor(yypParser,214,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,211,&yymsp[-1].minor); +{ yy_destructor(yypParser,212,&yymsp[-1].minor); { } - yy_destructor(yypParser,213,&yymsp[0].minor); + yy_destructor(yypParser,214,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2643,31 +2648,31 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,212,&yymsp[0].minor); + yy_destructor(yypParser,213,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy409); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy29, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy409, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy409); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2696,8 +2701,8 @@ static YYACTIONTYPE yy_reduce( case 274: /* index_name ::= NK_ID */ yytestcase(yyruleno==274); case 275: /* topic_name ::= NK_ID */ yytestcase(yyruleno==275); case 276: /* stream_name ::= NK_ID */ yytestcase(yyruleno==276); -{ yylhsminor.yy29 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy29 = yylhsminor.yy29; +{ yylhsminor.yy409 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy409 = yylhsminor.yy409; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2730,156 +2735,156 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 49: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy47, &yymsp[-1].minor.yy29, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy121, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } break; case 50: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy47, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } break; case 51: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy409); } break; case 52: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } break; case 53: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy47 = true; } +{ yymsp[-2].minor.yy121 = true; } break; case 54: /* not_exists_opt ::= */ case 56: /* exists_opt ::= */ yytestcase(yyruleno==56); case 220: /* analyze_opt ::= */ yytestcase(yyruleno==220); case 228: /* agg_func_opt ::= */ yytestcase(yyruleno==228); - case 349: /* set_quantifier_opt ::= */ yytestcase(yyruleno==349); -{ yymsp[1].minor.yy47 = false; } + case 350: /* set_quantifier_opt ::= */ yytestcase(yyruleno==350); +{ yymsp[1].minor.yy121 = false; } break; case 55: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy47 = true; } +{ yymsp[-1].minor.yy121 = true; } break; case 57: /* db_options ::= */ -{ yymsp[1].minor.yy182 = createDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy504 = createDatabaseOptions(pCxt); } break; case 58: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 59: /* db_options ::= db_options CACHE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 60: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 61: /* db_options ::= db_options COMP NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 62: /* db_options ::= db_options DAYS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 63: /* db_options ::= db_options DAYS NK_VARIABLE */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 64: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 65: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 66: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 67: /* db_options ::= db_options KEEP integer_list */ case 68: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==68); -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pKeep = yymsp[0].minor.yy334; yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 69: /* db_options ::= db_options PRECISION NK_STRING */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 70: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 71: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 72: /* db_options ::= db_options TTL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 73: /* db_options ::= db_options WAL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 74: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 75: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 76: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 77: /* db_options ::= db_options RETENTIONS retention_list */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy182)->pRetentions = yymsp[0].minor.yy334; yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pRetentions = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 78: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy182 = createDatabaseOptions(pCxt); yylhsminor.yy182 = setDatabaseAlterOption(pCxt, yylhsminor.yy182, &yymsp[0].minor.yy515); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createDatabaseOptions(pCxt); yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 79: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy182 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy182, &yymsp[0].minor.yy515); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 80: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 81: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 82: /* alter_db_option ::= KEEP integer_list */ case 83: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==83); -{ yymsp[-1].minor.yy515.type = DB_OPTION_KEEP; yymsp[-1].minor.yy515.pList = yymsp[0].minor.yy334; } +{ yymsp[-1].minor.yy21.type = DB_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } break; case 84: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_WAL; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = DB_OPTION_WAL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 85: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 86: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 87: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 88: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy488 = yylhsminor.yy488; break; case 89: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 240: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==240); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy488 = yylhsminor.yy488; break; case 90: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy488 = yylhsminor.yy488; break; case 91: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy488 = yylhsminor.yy488; break; case 92: /* retention_list ::= retention */ case 112: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==112); @@ -2889,10 +2894,10 @@ static YYACTIONTYPE yy_reduce( case 201: /* func_name_list ::= func_name */ yytestcase(yyruleno==201); case 210: /* func_list ::= func */ yytestcase(yyruleno==210); case 263: /* literal_list ::= signed_literal */ yytestcase(yyruleno==263); - case 354: /* select_sublist ::= select_item */ yytestcase(yyruleno==354); - case 401: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==401); -{ yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy182); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 355: /* select_sublist ::= select_item */ yytestcase(yyruleno==355); + case 402: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==402); +{ yylhsminor.yy488 = createNodeList(pCxt, yymsp[0].minor.yy504); } + yymsp[0].minor.yy488 = yylhsminor.yy488; break; case 93: /* retention_list ::= retention_list NK_COMMA retention */ case 123: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==123); @@ -2900,238 +2905,238 @@ static YYACTIONTYPE yy_reduce( case 202: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); case 211: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==211); case 264: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==264); - case 355: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==355); - case 402: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==402); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy182); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 356: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==356); + case 403: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==403); +{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, yymsp[0].minor.yy504); } + yymsp[-2].minor.yy488 = yylhsminor.yy488; break; case 94: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy182 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 95: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 97: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==97); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy47, yymsp[-5].minor.yy182, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy121, yymsp[-5].minor.yy504, yymsp[-3].minor.yy488, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } break; case 96: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy488); } break; case 98: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy488); } break; case 99: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy47, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } break; case 100: /* cmd ::= ALTER TABLE alter_table_clause */ case 101: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==101); case 242: /* cmd ::= query_expression */ yytestcase(yyruleno==242); -{ pCxt->pRootNode = yymsp[0].minor.yy182; } +{ pCxt->pRootNode = yymsp[0].minor.yy504; } break; case 102: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy182 = createAlterTableOption(pCxt, yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableOption(pCxt, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 103: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy182 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy182, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy29, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 104: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy182 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy182, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy29); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy409); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; case 105: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy182 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy182, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy29, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 106: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy182 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy182, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 107: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy182 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy182, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy29, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 108: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy182 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy182, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy29); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy409); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; case 109: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy182 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy182, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy29, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 110: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy182 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy182, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 111: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy182 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy182, &yymsp[-2].minor.yy29, yymsp[0].minor.yy182); } - yymsp[-5].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy504, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } + yymsp[-5].minor.yy504 = yylhsminor.yy504; break; case 113: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 116: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==116); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy182); } - yymsp[-1].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } + yymsp[-1].minor.yy488 = yylhsminor.yy488; break; case 114: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy182 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy47, yymsp[-7].minor.yy182, yymsp[-5].minor.yy182, yymsp[-4].minor.yy334, yymsp[-1].minor.yy334); } - yymsp[-8].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy121, yymsp[-7].minor.yy504, yymsp[-5].minor.yy504, yymsp[-4].minor.yy488, yymsp[-1].minor.yy488); } + yymsp[-8].minor.yy504 = yylhsminor.yy504; break; case 117: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy182 = createDropTableClause(pCxt, yymsp[-1].minor.yy47, yymsp[0].minor.yy182); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createDropTableClause(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 118: /* specific_tags_opt ::= */ case 149: /* tags_def_opt ::= */ yytestcase(yyruleno==149); - case 362: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==362); - case 379: /* group_by_clause_opt ::= */ yytestcase(yyruleno==379); - case 389: /* order_by_clause_opt ::= */ yytestcase(yyruleno==389); -{ yymsp[1].minor.yy334 = NULL; } + case 363: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==363); + case 380: /* group_by_clause_opt ::= */ yytestcase(yyruleno==380); + case 390: /* order_by_clause_opt ::= */ yytestcase(yyruleno==390); +{ yymsp[1].minor.yy488 = NULL; } break; case 119: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; } +{ yymsp[-2].minor.yy488 = yymsp[-1].minor.yy488; } break; case 120: /* full_table_name ::= table_name */ -{ yylhsminor.yy182 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy29, NULL); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy409, NULL); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 121: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy182 = createRealTableNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, NULL); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, NULL); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 124: /* column_def ::= column_name type_name */ -{ yylhsminor.yy182 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy574, NULL); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160, NULL); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 125: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy182 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-2].minor.yy574, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; case 126: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 127: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 128: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 129: /* type_name ::= INT */ case 130: /* type_name ::= INTEGER */ yytestcase(yyruleno==130); -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_INT); } break; case 131: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 132: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 133: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 134: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 135: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 136: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 137: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 138: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 139: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 140: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 141: /* type_name ::= JSON */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 142: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 143: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 144: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 145: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 146: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 147: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 148: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 150: /* tags_def_opt ::= tags_def */ - case 353: /* select_list ::= select_sublist */ yytestcase(yyruleno==353); -{ yylhsminor.yy334 = yymsp[0].minor.yy334; } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 354: /* select_list ::= select_sublist */ yytestcase(yyruleno==354); +{ yylhsminor.yy488 = yymsp[0].minor.yy488; } + yymsp[0].minor.yy488 = yylhsminor.yy488; break; case 151: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; } +{ yymsp[-3].minor.yy488 = yymsp[-1].minor.yy488; } break; case 152: /* table_options ::= */ -{ yymsp[1].minor.yy182 = createTableOptions(pCxt); } +{ yymsp[1].minor.yy504 = createTableOptions(pCxt); } break; case 153: /* table_options ::= table_options COMMENT NK_STRING */ -{ ((STableOptions*)yymsp[-2].minor.yy182)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-2].minor.yy504)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 154: /* table_options ::= table_options KEEP integer_list */ -{ ((STableOptions*)yymsp[-2].minor.yy182)->pKeep = yymsp[0].minor.yy334; yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 155: /* table_options ::= table_options TTL NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy182)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 156: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy182)->pSma = yymsp[-1].minor.yy334; yylhsminor.yy182 = yymsp[-4].minor.yy182; } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-4].minor.yy504)->pSma = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 157: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy182)->pFuncs = yymsp[-1].minor.yy334; yylhsminor.yy182 = yymsp[-4].minor.yy182; } - yymsp[-4].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-4].minor.yy504)->pFuncs = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; case 158: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ ((STableOptions*)yymsp[-2].minor.yy182)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-2].minor.yy504)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 159: /* table_options ::= table_options DELAY NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy182)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy182 = yymsp[-2].minor.yy182; } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ ((STableOptions*)yymsp[-2].minor.yy504)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 160: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy182 = createTableOptions(pCxt); yylhsminor.yy182 = setTableAlterOption(pCxt, yylhsminor.yy182, &yymsp[0].minor.yy515); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createTableOptions(pCxt); yylhsminor.yy504 = setTableAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 161: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy182 = setTableAlterOption(pCxt, yymsp[-1].minor.yy182, &yymsp[0].minor.yy515); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = setTableAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 162: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy515.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 163: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy515.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy515.pList = yymsp[0].minor.yy334; } +{ yymsp[-1].minor.yy21.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } break; case 164: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy515.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy21.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 167: /* col_name ::= column_name */ -{ yylhsminor.yy182 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 168: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } @@ -3143,13 +3148,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; case 171: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy182, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } break; case 172: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy182, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } break; case 173: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy182, NULL); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy504, NULL); } break; case 174: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } @@ -3164,7 +3169,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; case 178: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } break; case 179: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } @@ -3183,13 +3188,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; case 185: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy409); } break; case 186: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy504); } break; case 187: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy504); } break; case 188: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } @@ -3211,111 +3216,111 @@ static YYACTIONTYPE yy_reduce( break; case 194: /* db_name_cond_opt ::= */ case 199: /* from_db_opt ::= */ yytestcase(yyruleno==199); -{ yymsp[1].minor.yy182 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy504 = createDefaultDatabaseCondValue(pCxt); } break; case 195: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy29); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy409); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 196: /* like_pattern_opt ::= */ case 207: /* index_options ::= */ yytestcase(yyruleno==207); - case 360: /* where_clause_opt ::= */ yytestcase(yyruleno==360); - case 364: /* twindow_clause_opt ::= */ yytestcase(yyruleno==364); - case 369: /* sliding_opt ::= */ yytestcase(yyruleno==369); - case 371: /* fill_opt ::= */ yytestcase(yyruleno==371); - case 383: /* having_clause_opt ::= */ yytestcase(yyruleno==383); - case 391: /* slimit_clause_opt ::= */ yytestcase(yyruleno==391); - case 395: /* limit_clause_opt ::= */ yytestcase(yyruleno==395); -{ yymsp[1].minor.yy182 = NULL; } + case 361: /* where_clause_opt ::= */ yytestcase(yyruleno==361); + case 365: /* twindow_clause_opt ::= */ yytestcase(yyruleno==365); + case 370: /* sliding_opt ::= */ yytestcase(yyruleno==370); + case 372: /* fill_opt ::= */ yytestcase(yyruleno==372); + case 384: /* having_clause_opt ::= */ yytestcase(yyruleno==384); + case 392: /* slimit_clause_opt ::= */ yytestcase(yyruleno==392); + case 396: /* limit_clause_opt ::= */ yytestcase(yyruleno==396); +{ yymsp[1].minor.yy504 = NULL; } break; case 197: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 198: /* table_name_cond ::= table_name */ -{ yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy29); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 200: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy29); } +{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } break; case 203: /* func_name ::= function_name */ -{ yylhsminor.yy182 = createFunctionNode(pCxt, &yymsp[0].minor.yy29, NULL); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[0].minor.yy409, NULL); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 204: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy47, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy29, NULL, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy121, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, NULL, yymsp[0].minor.yy504); } break; case 205: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy47, &yymsp[-5].minor.yy29, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy334, NULL); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488, NULL); } break; case 206: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy47, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409); } break; case 208: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy182 = createIndexOption(pCxt, yymsp[-6].minor.yy334, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), NULL, yymsp[0].minor.yy182); } +{ yymsp[-8].minor.yy504 = createIndexOption(pCxt, yymsp[-6].minor.yy488, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL, yymsp[0].minor.yy504); } break; case 209: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy182 = createIndexOption(pCxt, yymsp[-8].minor.yy334, releaseRawExprNode(pCxt, yymsp[-4].minor.yy182), releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), yymsp[0].minor.yy182); } +{ yymsp[-10].minor.yy504 = createIndexOption(pCxt, yymsp[-8].minor.yy488, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[0].minor.yy504); } break; case 212: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy182 = createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy334); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; case 213: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy47, &yymsp[-2].minor.yy29, yymsp[0].minor.yy182, NULL); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504, NULL); } break; case 214: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy47, &yymsp[-2].minor.yy29, NULL, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, NULL, &yymsp[0].minor.yy409); } break; case 215: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy47, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } break; case 216: /* cmd ::= DESC full_table_name */ case 217: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==217); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy504); } break; case 218: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 219: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy47, yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy121, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } break; case 221: /* analyze_opt ::= ANALYZE */ case 229: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==229); - case 350: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==350); -{ yymsp[0].minor.yy47 = true; } + case 351: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==351); +{ yymsp[0].minor.yy121 = true; } break; case 222: /* explain_options ::= */ -{ yymsp[1].minor.yy182 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy504 = createDefaultExplainOptions(pCxt); } break; case 223: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy182 = setExplainVerbose(pCxt, yymsp[-2].minor.yy182, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = setExplainVerbose(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 224: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy182 = setExplainRatio(pCxt, yymsp[-2].minor.yy182, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = setExplainRatio(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 225: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy334); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy488); } break; case 226: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy47, &yymsp[-5].minor.yy29, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy574, yymsp[0].minor.yy550); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy160, yymsp[0].minor.yy452); } break; case 227: /* cmd ::= DROP FUNCTION function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy409); } break; case 230: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy550 = 0; } +{ yymsp[1].minor.yy452 = 0; } break; case 231: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy550 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy452 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 232: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy29, &yymsp[-2].minor.yy29, yymsp[0].minor.yy182); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy409, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } break; case 233: /* cmd ::= DROP STREAM stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy29); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy409); } break; case 234: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } @@ -3327,36 +3332,36 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 237: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); } +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy488); } break; case 238: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; case 239: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +{ yymsp[-1].minor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 241: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy29); } +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy409); } break; case 243: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 244: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 245: /* literal ::= NK_STRING */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 246: /* literal ::= NK_BOOL */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 247: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 248: /* literal ::= duration_literal */ case 257: /* signed_literal ::= signed */ yytestcase(yyruleno==257); @@ -3364,448 +3369,449 @@ static YYACTIONTYPE yy_reduce( case 278: /* expression ::= pseudo_column */ yytestcase(yyruleno==278); case 279: /* expression ::= column_reference */ yytestcase(yyruleno==279); case 283: /* expression ::= subquery */ yytestcase(yyruleno==283); - case 323: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==323); - case 327: /* boolean_primary ::= predicate */ yytestcase(yyruleno==327); - case 329: /* common_expression ::= expression */ yytestcase(yyruleno==329); - case 330: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==330); - case 332: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==332); - case 334: /* table_reference ::= table_primary */ yytestcase(yyruleno==334); - case 335: /* table_reference ::= joined_table */ yytestcase(yyruleno==335); - case 339: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==339); - case 386: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==386); - case 388: /* query_primary ::= query_specification */ yytestcase(yyruleno==388); -{ yylhsminor.yy182 = yymsp[0].minor.yy182; } - yymsp[0].minor.yy182 = yylhsminor.yy182; + case 324: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==324); + case 328: /* boolean_primary ::= predicate */ yytestcase(yyruleno==328); + case 330: /* common_expression ::= expression */ yytestcase(yyruleno==330); + case 331: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==331); + case 333: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==333); + case 335: /* table_reference ::= table_primary */ yytestcase(yyruleno==335); + case 336: /* table_reference ::= joined_table */ yytestcase(yyruleno==336); + case 340: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==340); + case 387: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==387); + case 389: /* query_primary ::= query_specification */ yytestcase(yyruleno==389); +{ yylhsminor.yy504 = yymsp[0].minor.yy504; } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 249: /* literal ::= NULL */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 250: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 251: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 252: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 253: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 254: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 255: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; case 256: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 258: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 259: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 260: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 261: /* signed_literal ::= duration_literal */ - case 356: /* select_item ::= common_expression */ yytestcase(yyruleno==356); - case 400: /* search_condition ::= common_expression */ yytestcase(yyruleno==400); -{ yylhsminor.yy182 = releaseRawExprNode(pCxt, yymsp[0].minor.yy182); } - yymsp[0].minor.yy182 = yylhsminor.yy182; + case 357: /* select_item ::= common_expression */ yytestcase(yyruleno==357); + case 401: /* search_condition ::= common_expression */ yytestcase(yyruleno==401); +{ yylhsminor.yy504 = releaseRawExprNode(pCxt, yymsp[0].minor.yy504); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 262: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } +{ yymsp[0].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; case 280: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488)); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; case 281: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; case 282: /* expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), yymsp[-1].minor.yy574)); } - yymsp[-5].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy160)); } + yymsp[-5].minor.yy504 = yylhsminor.yy504; break; case 284: /* expression ::= NK_LP expression NK_RP */ - case 328: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==328); -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182)); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 329: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==329); +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 285: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy182)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 286: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy182), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; case 287: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 288: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 289: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 290: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 291: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 292: /* expression_list ::= expression */ -{ yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy182)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } + yymsp[0].minor.yy488 = yylhsminor.yy488; break; case 293: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy182)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } + yymsp[-2].minor.yy488 = yylhsminor.yy488; break; case 294: /* column_reference ::= column_name */ -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy29, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy409, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; case 295: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29)); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409)); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; case 296: /* pseudo_column ::= NOW */ - case 297: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==297); - case 298: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==298); - case 299: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==299); - case 300: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==300); - case 301: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==301); - case 302: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==302); - case 303: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==303); -{ yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; + case 297: /* pseudo_column ::= TODAY */ yytestcase(yyruleno==297); + case 298: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==298); + case 299: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==299); + case 300: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==300); + case 301: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==301); + case 302: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==302); + case 303: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==303); + case 304: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==304); +{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; - case 304: /* predicate ::= expression compare_op expression */ - case 309: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==309); + case 305: /* predicate ::= expression compare_op expression */ + case 310: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==310); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy380, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy84, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 305: /* predicate ::= expression BETWEEN expression AND expression */ + case 306: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy182), releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-4].minor.yy182 = yylhsminor.yy182; + yymsp[-4].minor.yy504 = yylhsminor.yy504; break; - case 306: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 307: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[-5].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-5].minor.yy182 = yylhsminor.yy182; + yymsp[-5].minor.yy504 = yylhsminor.yy504; break; - case 307: /* predicate ::= expression IS NULL */ + case 308: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL)); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 308: /* predicate ::= expression IS NOT NULL */ + case 309: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL)); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; - case 310: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_THAN; } + case 311: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_THAN; } break; - case 311: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_THAN; } + case 312: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_THAN; } break; - case 312: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_EQUAL; } + case 313: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_EQUAL; } break; - case 313: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_EQUAL; } + case 314: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_EQUAL; } break; - case 314: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy380 = OP_TYPE_NOT_EQUAL; } + case 315: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy84 = OP_TYPE_NOT_EQUAL; } break; - case 315: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy380 = OP_TYPE_EQUAL; } + case 316: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy84 = OP_TYPE_EQUAL; } break; - case 316: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy380 = OP_TYPE_LIKE; } + case 317: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy84 = OP_TYPE_LIKE; } break; - case 317: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_LIKE; } + case 318: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_LIKE; } break; - case 318: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy380 = OP_TYPE_MATCH; } + case 319: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy84 = OP_TYPE_MATCH; } break; - case 319: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy380 = OP_TYPE_NMATCH; } + case 320: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy84 = OP_TYPE_NMATCH; } break; - case 320: /* in_op ::= IN */ -{ yymsp[0].minor.yy380 = OP_TYPE_IN; } + case 321: /* in_op ::= IN */ +{ yymsp[0].minor.yy84 = OP_TYPE_IN; } break; - case 321: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_IN; } + case 322: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_IN; } break; - case 322: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 323: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 324: /* boolean_value_expression ::= NOT boolean_primary */ + case 325: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy182), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; - case 325: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 326: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 326: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 327: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); - yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); + yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 331: /* from_clause ::= FROM table_reference_list */ - case 361: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==361); - case 384: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==384); -{ yymsp[-1].minor.yy182 = yymsp[0].minor.yy182; } + case 332: /* from_clause ::= FROM table_reference_list */ + case 362: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==362); + case 385: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==385); +{ yymsp[-1].minor.yy504 = yymsp[0].minor.yy504; } break; - case 333: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy182 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy182, yymsp[0].minor.yy182, NULL); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 334: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy504 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy504, yymsp[0].minor.yy504, NULL); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 336: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy182 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + case 337: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; - case 337: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy182 = createRealTableNode(pCxt, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; + case 338: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; - case 338: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy182 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182), &yymsp[0].minor.yy29); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + case 339: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy504 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; - case 340: /* alias_opt ::= */ -{ yymsp[1].minor.yy29 = nil_token; } + case 341: /* alias_opt ::= */ +{ yymsp[1].minor.yy409 = nil_token; } break; - case 341: /* alias_opt ::= table_alias */ -{ yylhsminor.yy29 = yymsp[0].minor.yy29; } - yymsp[0].minor.yy29 = yylhsminor.yy29; + case 342: /* alias_opt ::= table_alias */ +{ yylhsminor.yy409 = yymsp[0].minor.yy409; } + yymsp[0].minor.yy409 = yylhsminor.yy409; break; - case 342: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy29 = yymsp[0].minor.yy29; } + case 343: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy409 = yymsp[0].minor.yy409; } break; - case 343: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 344: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==344); -{ yymsp[-2].minor.yy182 = yymsp[-1].minor.yy182; } + case 344: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 345: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==345); +{ yymsp[-2].minor.yy504 = yymsp[-1].minor.yy504; } break; - case 345: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy182 = createJoinTableNode(pCxt, yymsp[-4].minor.yy162, yymsp[-5].minor.yy182, yymsp[-2].minor.yy182, yymsp[0].minor.yy182); } - yymsp[-5].minor.yy182 = yylhsminor.yy182; + case 346: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy504 = createJoinTableNode(pCxt, yymsp[-4].minor.yy556, yymsp[-5].minor.yy504, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + yymsp[-5].minor.yy504 = yylhsminor.yy504; break; - case 346: /* join_type ::= */ -{ yymsp[1].minor.yy162 = JOIN_TYPE_INNER; } + case 347: /* join_type ::= */ +{ yymsp[1].minor.yy556 = JOIN_TYPE_INNER; } break; - case 347: /* join_type ::= INNER */ -{ yymsp[0].minor.yy162 = JOIN_TYPE_INNER; } + case 348: /* join_type ::= INNER */ +{ yymsp[0].minor.yy556 = JOIN_TYPE_INNER; } break; - case 348: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 349: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy182 = createSelectStmt(pCxt, yymsp[-7].minor.yy47, yymsp[-6].minor.yy334, yymsp[-5].minor.yy182); - yymsp[-8].minor.yy182 = addWhereClause(pCxt, yymsp[-8].minor.yy182, yymsp[-4].minor.yy182); - yymsp[-8].minor.yy182 = addPartitionByClause(pCxt, yymsp[-8].minor.yy182, yymsp[-3].minor.yy334); - yymsp[-8].minor.yy182 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy182, yymsp[-2].minor.yy182); - yymsp[-8].minor.yy182 = addGroupByClause(pCxt, yymsp[-8].minor.yy182, yymsp[-1].minor.yy334); - yymsp[-8].minor.yy182 = addHavingClause(pCxt, yymsp[-8].minor.yy182, yymsp[0].minor.yy182); + yymsp[-8].minor.yy504 = createSelectStmt(pCxt, yymsp[-7].minor.yy121, yymsp[-6].minor.yy488, yymsp[-5].minor.yy504); + yymsp[-8].minor.yy504 = addWhereClause(pCxt, yymsp[-8].minor.yy504, yymsp[-4].minor.yy504); + yymsp[-8].minor.yy504 = addPartitionByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-3].minor.yy488); + yymsp[-8].minor.yy504 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy504, yymsp[-2].minor.yy504); + yymsp[-8].minor.yy504 = addGroupByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-1].minor.yy488); + yymsp[-8].minor.yy504 = addHavingClause(pCxt, yymsp[-8].minor.yy504, yymsp[0].minor.yy504); } break; - case 351: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy47 = false; } + case 352: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy121 = false; } break; - case 352: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy334 = NULL; } + case 353: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy488 = NULL; } break; - case 357: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy182 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182), &yymsp[0].minor.yy29); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + case 358: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } + yymsp[-1].minor.yy504 = yylhsminor.yy504; break; - case 358: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy182 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), &yymsp[0].minor.yy29); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 359: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), &yymsp[0].minor.yy409); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 359: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy182 = createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 360: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy504 = createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 363: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 380: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==380); - case 390: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==390); -{ yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } + case 364: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 381: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==381); + case 391: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==391); +{ yymsp[-2].minor.yy488 = yymsp[0].minor.yy488; } break; - case 365: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy182 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), releaseRawExprNode(pCxt, yymsp[-1].minor.yy182)); } + case 366: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy504 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } break; - case 366: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy182 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182)); } + case 367: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy504 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } break; - case 367: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy182 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), NULL, yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } + case 368: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } break; - case 368: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy182 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy182), releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } + case 369: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } break; - case 370: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy182 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy182); } + case 371: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy504 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy504); } break; - case 372: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy182 = createFillNode(pCxt, yymsp[-1].minor.yy144, NULL); } + case 373: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy504 = createFillNode(pCxt, yymsp[-1].minor.yy22, NULL); } break; - case 373: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy182 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + case 374: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy504 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } break; - case 374: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy144 = FILL_MODE_NONE; } + case 375: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy22 = FILL_MODE_NONE; } break; - case 375: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy144 = FILL_MODE_PREV; } + case 376: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy22 = FILL_MODE_PREV; } break; - case 376: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy144 = FILL_MODE_NULL; } + case 377: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy22 = FILL_MODE_NULL; } break; - case 377: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy144 = FILL_MODE_LINEAR; } + case 378: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy22 = FILL_MODE_LINEAR; } break; - case 378: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy144 = FILL_MODE_NEXT; } + case 379: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy22 = FILL_MODE_NEXT; } break; - case 381: /* group_by_list ::= expression */ -{ yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 382: /* group_by_list ::= expression */ +{ yylhsminor.yy488 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } + yymsp[0].minor.yy488 = yylhsminor.yy488; break; - case 382: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 383: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } + yymsp[-2].minor.yy488 = yylhsminor.yy488; break; - case 385: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 386: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy182 = addOrderByClause(pCxt, yymsp[-3].minor.yy182, yymsp[-2].minor.yy334); - yylhsminor.yy182 = addSlimitClause(pCxt, yylhsminor.yy182, yymsp[-1].minor.yy182); - yylhsminor.yy182 = addLimitClause(pCxt, yylhsminor.yy182, yymsp[0].minor.yy182); + yylhsminor.yy504 = addOrderByClause(pCxt, yymsp[-3].minor.yy504, yymsp[-2].minor.yy488); + yylhsminor.yy504 = addSlimitClause(pCxt, yylhsminor.yy504, yymsp[-1].minor.yy504); + yylhsminor.yy504 = addLimitClause(pCxt, yylhsminor.yy504, yymsp[0].minor.yy504); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; - case 387: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy182 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy182, yymsp[0].minor.yy182); } - yymsp[-3].minor.yy182 = yylhsminor.yy182; + case 388: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy504 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy504, yymsp[0].minor.yy504); } + yymsp[-3].minor.yy504 = yylhsminor.yy504; break; - case 392: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 396: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==396); -{ yymsp[-1].minor.yy182 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==397); +{ yymsp[-1].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==397); -{ yymsp[-3].minor.yy182 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==398); +{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==398); -{ yymsp[-3].minor.yy182 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 395: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 399: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==399); +{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 399: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy182); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 400: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy504); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 403: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy182 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), yymsp[-1].minor.yy218, yymsp[0].minor.yy487); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 404: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy504 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[-1].minor.yy522, yymsp[0].minor.yy281); } + yymsp[-2].minor.yy504 = yylhsminor.yy504; break; - case 404: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy218 = ORDER_ASC; } + case 405: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy522 = ORDER_ASC; } break; - case 405: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy218 = ORDER_ASC; } + case 406: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy522 = ORDER_ASC; } break; - case 406: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy218 = ORDER_DESC; } + case 407: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy522 = ORDER_DESC; } break; - case 407: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy487 = NULL_ORDER_DEFAULT; } + case 408: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy281 = NULL_ORDER_DEFAULT; } break; - case 408: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy487 = NULL_ORDER_FIRST; } + case 409: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy281 = NULL_ORDER_FIRST; } break; - case 409: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy487 = NULL_ORDER_LAST; } + case 410: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy281 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index db62a6b33d..4d57af822e 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -841,7 +841,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * memmove(fraction, fraction + TSDB_TIME_PRECISION_SEC_DIGITS, TSDB_TIME_PRECISION_SEC_DIGITS); } - struct tm *tmInfo = localtime((const time_t *)&timeVal); + struct tm *tmInfo = taosLocalTime((const time_t *)&timeVal, NULL); strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%z", tmInfo); int32_t len = (int32_t)strlen(buf); diff --git a/source/os/src/osTime.c b/source/os/src/osTime.c index 2b0de94880..9ea49b364e 100644 --- a/source/os/src/osTime.c +++ b/source/os/src/osTime.c @@ -406,7 +406,18 @@ FORCE_INLINE int32_t taosGetTimeOfDay(struct timeval *tv) { #endif } +time_t taosTime(time_t *t) { + return time(t); +} + +time_t taosMktime(struct tm *timep) { + return mktime(timep); +} + struct tm *taosLocalTime(const time_t *timep, struct tm *result) { + if (result == NULL) { + return localtime(timep); + } #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) localtime_s(result, timep); #else diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 35476980b1..082f3adcec 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -56,8 +56,8 @@ # ---- tmq ./test.sh -f tsim/tmq/basic.sim ./test.sh -f tsim/tmq/basic1.sim -./test.sh -f tsim/tmq/oneTopic.sim -./test.sh -f tsim/tmq/multiTopic.sim +#./test.sh -f tsim/tmq/oneTopic.sim +#./test.sh -f tsim/tmq/multiTopic.sim #./test.sh -f tsim/tmq/mainConsumerInMultiTopic.sim #./test.sh -f tsim/tmq/mainConsumerInOneTopic.sim diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index f79bf88ad2..9c7b2f5424 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -74,7 +74,7 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d print ====> dataX_db print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $rows != 2 then +if $rows != 3 then return -1 endi if $data0_db != db then # name diff --git a/tests/script/tsim/db/basic1.sim b/tests/script/tsim/db/basic1.sim index c07ebd0400..49568d64ed 100644 --- a/tests/script/tsim/db/basic1.sim +++ b/tests/script/tsim/db/basic1.sim @@ -6,19 +6,19 @@ sql connect print =============== create database sql create database d1 vgroups 2 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != d1 then +if $data20 != d1 then return -1 endi -if $data02 != 2 then +if $data22 != 2 then return -1 endi -if $data03 != 0 then +if $data23 != 0 then return -1 endi @@ -40,7 +40,7 @@ endi print =============== drop database sql drop database d1 sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -49,7 +49,7 @@ sql create database d2 vgroups 2 sql create database d3 vgroups 3 sql create database d4 vgroups 4 sql show databases -if $rows != 4 then +if $rows != 5 then return -1 endi @@ -111,19 +111,19 @@ print =============== drop database sql drop database d2 sql drop database d3 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != d4 then +if $data20 != d4 then return -1 endi -if $data02 != 4 then +if $data22 != 4 then return -1 endi -if $data03 != 0 then +if $data23 != 0 then return -1 endi @@ -154,7 +154,7 @@ system sh/exec.sh -n dnode1 -s start print =============== show databases sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/db/basic2.sim b/tests/script/tsim/db/basic2.sim index e9222c8d32..0d34506b00 100644 --- a/tests/script/tsim/db/basic2.sim +++ b/tests/script/tsim/db/basic2.sim @@ -33,15 +33,15 @@ sql show databases print rows: $rows print $data00 $data01 $data02 $data03 print $data10 $data11 $data12 $data13 -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != d1 then +if $data20 != d1 then return -1 endi -if $data02 != 2 then # vgroups +if $data22 != 2 then # vgroups return -1 endi @@ -62,7 +62,7 @@ sql create table t2 (ts timestamp, i int); sql create table t3 (ts timestamp, i int); sql show databases -if $rows != 3 then +if $rows != 4 then return -1 endi diff --git a/tests/script/tsim/db/basic3.sim b/tests/script/tsim/db/basic3.sim index 52a587cc16..62d160f1c4 100644 --- a/tests/script/tsim/db/basic3.sim +++ b/tests/script/tsim/db/basic3.sim @@ -29,15 +29,15 @@ sql create table d1.t3 (ts timestamp, i int); sql create table d1.t4 (ts timestamp, i int); sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != d1 then +if $data20 != d1 then return -1 endi -if $data02 != 2 then +if $data22 != 2 then return -1 endi @@ -57,7 +57,7 @@ sql create table d2.t2 (ts timestamp, i int); sql create table d2.t3 (ts timestamp, i int); sql show databases -if $rows != 3 then +if $rows != 4 then return -1 endi diff --git a/tests/script/tsim/db/basic6.sim b/tests/script/tsim/db/basic6.sim index a768a0da38..4d0a1e9ee9 100644 --- a/tests/script/tsim/db/basic6.sim +++ b/tests/script/tsim/db/basic6.sim @@ -20,31 +20,31 @@ sql show databases print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != $db then +if $data20 != $db then return -1 endi -if $data02 != 8 then +if $data22 != 8 then return -1 endi -if $data03 != 0 then +if $data23 != 0 then return -1 endi -if $data04 != 1 then +if $data24 != 1 then return -1 endi -if $data06 != 2880 then +if $data26 != 2880 then return -1 endi -if $data07 != 3650,3650,3650 then +if $data27 != 3650,3650,3650 then return -1 endi -if $data08 != 32 then +if $data28 != 32 then return -1 endi -if $data09 != 12 then +if $data29 != 12 then return -1 endi @@ -52,14 +52,14 @@ print =============== step2 sql_error create database $db sql create database if not exists $db sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi print =============== step3 sql drop database $db sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -70,16 +70,16 @@ print =============== step5 sql create database $db replica 1 days 21600 keep 2160000 sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 -if $data00 != $db then +if $data20 != $db then return -1 endi -if $data03 != 0 then +if $data23 != 0 then return -1 endi -if $data04 != 1 then +if $data24 != 1 then return -1 endi -if $data06 != 21600 then +if $data26 != 21600 then return -1 endi @@ -314,7 +314,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index 7f39474f4d..4dda6cd00f 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -99,7 +99,7 @@ sql create database db sql show databases print rows: $rows print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $rows != 2 then +if $rows != 3 then return -1 endi if $data0_db != db then # name @@ -112,6 +112,7 @@ if $data3_db != 0 then # ntables return -1 endi if $data4_db != 1 then # replica + print expect 1, actual: $data4_db return -1 endi if $data5_db != 1 then # quorum diff --git a/tests/script/tsim/db/error1.sim b/tests/script/tsim/db/error1.sim index 6f62228ae7..2e00143eb9 100644 --- a/tests/script/tsim/db/error1.sim +++ b/tests/script/tsim/db/error1.sim @@ -42,19 +42,19 @@ re-create1: sql create database d1 vgroups 2 -x re-create1 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != d1 then +if $data20 != d1 then return -1 endi -if $data02 != 2 then +if $data22 != 2 then return -1 endi -if $data03 != 0 then +if $data23 != 0 then return -1 endi @@ -81,19 +81,19 @@ re-create2: sql create database d1 vgroups 5 -x re-create2 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != d1 then +if $data20 != d1 then return -1 endi -if $data02 != 5 then +if $data22 != 5 then return -1 endi -if $data03 != 0 then +if $data23 != 0 then return -1 endi diff --git a/tests/script/tsim/dnode/basic1.sim b/tests/script/tsim/dnode/basic1.sim index 6f0d5f88b8..51399e9050 100644 --- a/tests/script/tsim/dnode/basic1.sim +++ b/tests/script/tsim/dnode/basic1.sim @@ -85,7 +85,7 @@ sql create database d1 vgroups 4; sql create database d2; sql show databases -if $rows != 3 then +if $rows != 4 then return -1 endi diff --git a/tests/script/tsim/insert/backquote.sim b/tests/script/tsim/insert/backquote.sim index 71f35fabb2..819b1aea13 100644 --- a/tests/script/tsim/insert/backquote.sim +++ b/tests/script/tsim/insert/backquote.sim @@ -12,16 +12,16 @@ print rows: $rows print $data00 $data01 print $data10 $data11 print $data20 $data21 -if $rows != 3 then +if $rows != 4 then return -1 endi -if $data00 != database then +if $data20 != database then return -1 endi -if $data10 != DataBase then +if $data30 != DataBase then return -1 endi -if $data20 != information_schema then +if $data00 != information_schema then return -1 endi @@ -206,16 +206,16 @@ print rows: $rows print $data00 $data01 print $data10 $data11 print $data20 $data21 -if $rows != 3 then +if $rows != 4 then return -1 endi -if $data00 != database then +if $data20 != database then return -1 endi -if $data10 != DataBase then +if $data30 != DataBase then return -1 endi -if $data20 != information_schema then +if $data00 != information_schema then return -1 endi diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index da74eb95e8..1ae8b372dc 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -7,7 +7,7 @@ sql connect print =============== create database sql create database d0 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/insert/basic1.sim b/tests/script/tsim/insert/basic1.sim index 3a3f8d000e..d98407b380 100644 --- a/tests/script/tsim/insert/basic1.sim +++ b/tests/script/tsim/insert/basic1.sim @@ -7,7 +7,7 @@ sql connect print =============== create database sql create database d1 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/insert/null.sim b/tests/script/tsim/insert/null.sim index fbaef8cc94..fab5335ac5 100644 --- a/tests/script/tsim/insert/null.sim +++ b/tests/script/tsim/insert/null.sim @@ -7,7 +7,7 @@ sql connect print =============== create database sql create database d0 sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/parser/fourArithmetic-basic.sim b/tests/script/tsim/parser/fourArithmetic-basic.sim index bb35df5a90..ebe20924be 100644 --- a/tests/script/tsim/parser/fourArithmetic-basic.sim +++ b/tests/script/tsim/parser/fourArithmetic-basic.sim @@ -28,7 +28,7 @@ print =============== create database sql create database $dbNamme vgroups 1 sql show databases print $data00 $data01 $data02 -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/query/charScalarFunction.sim b/tests/script/tsim/query/charScalarFunction.sim index 13108fecb7..afdb9e0d74 100644 --- a/tests/script/tsim/query/charScalarFunction.sim +++ b/tests/script/tsim/query/charScalarFunction.sim @@ -83,6 +83,14 @@ sql insert into ntb5 values ("2022-01-01 00:00:00.000" , "0123456789" , "0123456 sql insert into ctb5 values ("2022-01-01 00:00:00.001" , NULL , NULL ) sql insert into ntb5 values ("2022-01-01 00:00:00.001" , NULL , NULL ) +sql create table stb3 (ts timestamp, c1 binary(64), c2 nchar(64), c3 nchar(64) ) tags (t1 nchar(64)) +sql create table ctb6 using stb3 tags("tag-nchar-6") +sql create table ntb6 (ts timestamp, c1 binary(64), c2 nchar(64), c3 nchar(64) ) +sql insert into ctb6 values ("2022-01-01 00:00:00.000" , "0123456789" , "中文测试1" , "中文测试2" ) +sql insert into ntb6 values ("2022-01-01 00:00:00.000" , "0123456789" , "中文测试01", "中文测试01" ) +sql insert into ctb6 values ("2022-01-01 00:00:00.001" , NULL , NULL, NULL ) +sql insert into ntb6 values ("2022-01-01 00:00:00.001" , NULL , NULL, NULL ) + $loop_test = 0 loop_test_pos: @@ -150,6 +158,210 @@ if $data01 != 12 then return -1 endi +print ====> select c2 ,length(c2), char_length(c2) from ctb6 +sql select c2 ,length(c2), char_length(c2) from ctb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data01 != 20 then + return -1 +endi +if $data02 != 5 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +print ====> select c2 ,length(c2),char_length(c2) from ntb6 +sql select c2 ,length(c2),char_length(c2) from ntb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data01 != 24 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +print ====> select c2 ,lower(c2), upper(c2) from ctb6 +sql select c2 ,lower(c2), upper(c2) from ctb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data01 != 中文测试1 then + return -1 +endi +if $data02 != 中文测试1 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +print ====> select c2 ,lower(c2), upper(c2) from ntb6 +sql select c2 ,lower(c2), upper(c2) from ntb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data01 != 中文测试01 then + return -1 +endi +if $data02 != 中文测试01 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +print ====> select c2, ltrim(c2), ltrim(c2) from ctb6 +sql select c2, ltrim(c2), ltrim(c2) from ctb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data01 != 中文测试1 then + return -1 +endi +if $data02 != 中文测试1 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +print ====> select c2, ltrim(c2), ltrim(c2) from ntb6 +sql select c2, ltrim(c2), ltrim(c2) from ntb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data01 != 中文测试01 then + return -1 +endi +if $data02 != 中文测试01 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +# print ====> select c2, c3 , concat(c2,c3) from ctb6 +# sql select c2, c3 , concat(c2,c3) from ctb6 +# print ====> rows: $rows +# print ====> $data00 $data01 $data02 +# print ====> $data10 $data11 $data12 +# if $rows != 2 then +# return -1 +# endi +# if $data02 != 中文测试01中文测试01 then +# return -1 +# endi +# if $data12 != NULL then +# return -1 +# endi + +print ====> select c2, c3 , concat(c2,c3) from ntb6 +sql select c2, c3 , concat(c2,c3) from ntb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data02 != 中文测试01中文测试01 then + return -1 +endi +if $data12 != NULL then + return -1 +endi + +print ====> select c2, c3 , concat_ws('_', c2, c3) from ctb6 +sql select c2, c3 , concat_ws('_', c2, c3) from ctb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data02 != 中文测试1_中文测试2 then + return -1 +endi +# if $data12 != NULL then +# return -1 +# endi + +print ====> select c2, c3 , concat_ws('_', c2, c3) from ntb6 +sql select c2, c3 , concat_ws('_', c2, c3) from ntb6 +print ====> rows: $rows +print ====> $data00 $data01 $data02 +print ====> $data10 $data11 $data12 +if $rows != 2 then + return -1 +endi +if $data02 != 中文测试01_中文测试01 then + return -1 +endi +# if $data12 != NULL then +# return -1 +# endi + +print ====> select c2, substr(c2,1, 4) from ctb6 +sql select c2, substr(c2,1, 4) from ctb6 +print ====> rows: $rows +print ====> $data00 $data01 +print ====> $data10 $data11 +if $rows != 2 then + return -1 +endi +if $data00 != 中文测试1 then + return -1 +endi +if $data01 != 中文测试 then + return -1 +endi +# if $data11 != NULL then +# return -1 +# endi + +print ====> select c2, substr(c2,1, 4) from ntb6 +sql select c2, substr(c2,1, 4) from ntb6 +print ====> rows: $rows +print ====> $data00 $data01 +print ====> $data10 $data11 +if $rows != 2 then + return -1 +endi +if $data00 != 中文测试01 then + return -1 +endi +if $data01 != 中文测试 then + return -1 +endi +if $data11 != NULL then + return -1 +endi + #sql_error select c1, length(t1), c2, length(t2) from ctb0 print ====> char_length @@ -493,7 +705,7 @@ if $loop_test == 0 then print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start - + $loop_cnt = 0 check_dnode_ready_0: $loop_cnt = $loop_cnt + 1 @@ -511,7 +723,7 @@ if $loop_test == 0 then goto check_dnode_ready_0 endi - $loop_test = 1 + $loop_test = 1 goto loop_test_pos endi diff --git a/tests/script/tsim/query/complex_group.sim b/tests/script/tsim/query/complex_group.sim index d6ce26b69a..6c9a7c5a7a 100644 --- a/tests/script/tsim/query/complex_group.sim +++ b/tests/script/tsim/query/complex_group.sim @@ -25,7 +25,7 @@ sql connect print =============== create database sql create database db sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/query/complex_having.sim b/tests/script/tsim/query/complex_having.sim index 10283153d8..86d4f7d4ca 100644 --- a/tests/script/tsim/query/complex_having.sim +++ b/tests/script/tsim/query/complex_having.sim @@ -25,7 +25,7 @@ sql connect print =============== create database sql create database db sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/query/complex_limit.sim b/tests/script/tsim/query/complex_limit.sim index ac25135685..1691f2d443 100644 --- a/tests/script/tsim/query/complex_limit.sim +++ b/tests/script/tsim/query/complex_limit.sim @@ -24,11 +24,6 @@ sql connect print =============== create database sql create database db -sql show databases -if $rows != 2 then - return -1 -endi - sql use db print =============== create super table and child table diff --git a/tests/script/tsim/query/complex_select.sim b/tests/script/tsim/query/complex_select.sim index 1696d22da7..1ebcb2f49a 100644 --- a/tests/script/tsim/query/complex_select.sim +++ b/tests/script/tsim/query/complex_select.sim @@ -24,11 +24,6 @@ sql connect print =============== create database sql create database db -sql show databases -if $rows != 2 then - return -1 -endi - sql use db print =============== create super table and child table @@ -114,14 +109,14 @@ print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06 if $rows != 1 then return -1 endi -if $data01 != 2 then +if $data01 != 3 then return -1 endi -sql select * from ct1 limit 2 offset 1 +sql select * from ct1 limit 2 offset 7 print ====> sql : select * from ct1 limit 2 offset 7 print ====> rows: $rows -if $rows != 2 then +if $rows != 1 then return -1 endi if $data01 != 8 then diff --git a/tests/script/tsim/query/complex_where.sim b/tests/script/tsim/query/complex_where.sim index 312c1d98ed..7cd576400f 100644 --- a/tests/script/tsim/query/complex_where.sim +++ b/tests/script/tsim/query/complex_where.sim @@ -25,7 +25,7 @@ sql connect print =============== create database sql create database db sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/query/diff.sim b/tests/script/tsim/query/diff.sim index c55b080e44..7bfeeeba7f 100644 --- a/tests/script/tsim/query/diff.sim +++ b/tests/script/tsim/query/diff.sim @@ -123,7 +123,7 @@ step6: print =============== clear sql drop database $db sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/query/interval-offset.sim b/tests/script/tsim/query/interval-offset.sim index 796944745a..e222077fa4 100644 --- a/tests/script/tsim/query/interval-offset.sim +++ b/tests/script/tsim/query/interval-offset.sim @@ -6,11 +6,6 @@ sql connect print =============== create database sql create database d0 -sql show databases -if $rows != 2 then - return -1 -endi - sql use d0 print =============== create super table and child table diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim index 282d83bc27..3aee838625 100644 --- a/tests/script/tsim/query/session.sim +++ b/tests/script/tsim/query/session.sim @@ -256,7 +256,7 @@ endi # $data0-11 != 1 # $data1-11 != 14 -print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) +#print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) #sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) #if $rows != 2 then # return -1 diff --git a/tests/script/tsim/show/basic.sim b/tests/script/tsim/show/basic.sim index cc92686142..0c0670ff7f 100644 --- a/tests/script/tsim/show/basic.sim +++ b/tests/script/tsim/show/basic.sim @@ -28,8 +28,8 @@ sql connect # select */column from information_schema.xxxx; xxxx include: # dnodes, mnodes, modules, qnodes, -# user_databases, user_functions, user_indexes, user_stables, user_streams, -# user_tables, user_table_distributed, user_users, vgroups, +# user_databases, user_functions, user_indexes, user_stables, user_streams, +# user_tables, user_table_distributed, user_users, vgroups, print =============== add dnode2 into cluster sql create dnode $hostname port 7200 @@ -53,7 +53,7 @@ endi #sql show modules #sql show qnodes sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi #sql show functions @@ -90,7 +90,7 @@ endi #sql select * from information_schema.`modules` #sql select * from information_schema.`qnodes` sql select * from information_schema.user_databases -if $rows != 2 then +if $rows != 3 then return -1 endi #sql select * from information_schema.user_functions @@ -151,7 +151,7 @@ endi #sql show modules #sql show qnodes sql show databases -if $rows != 2 then +if $rows != 3 then return -1 endi #sql show functions @@ -188,7 +188,7 @@ endi #sql select * from information_schema.`modules` #sql select * from information_schema.`qnodes` sql select * from information_schema.user_databases -if $rows != 2 then +if $rows != 3 then return -1 endi #sql select * from information_schema.user_functions diff --git a/tests/script/tsim/sma/tsmaCreateInsertData.sim b/tests/script/tsim/sma/tsmaCreateInsertData.sim index 9fc3700da1..b7a127e1b0 100644 --- a/tests/script/tsim/sma/tsmaCreateInsertData.sim +++ b/tests/script/tsim/sma/tsmaCreateInsertData.sim @@ -6,13 +6,6 @@ sql connect print =============== create database sql create database d1 -sql show databases -if $rows != 2 then - return -1 -endi - -print $data00 $data01 $data02 - sql use d1 print =============== create super table, include column type for count/sum/min/max/first diff --git a/tests/script/tsim/stable/disk.sim b/tests/script/tsim/stable/disk.sim index 0e33c2066d..9f445cb6a8 100644 --- a/tests/script/tsim/stable/disk.sim +++ b/tests/script/tsim/stable/disk.sim @@ -199,7 +199,7 @@ print =============== step11 print =============== clear sql drop database $db sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/stable/dnode3.sim b/tests/script/tsim/stable/dnode3.sim index c2243b1ac8..e388bd9b31 100644 --- a/tests/script/tsim/stable/dnode3.sim +++ b/tests/script/tsim/stable/dnode3.sim @@ -206,7 +206,7 @@ print =============== step11 print =============== clear sql drop database $db sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/stable/metrics.sim b/tests/script/tsim/stable/metrics.sim index 948af72d09..c49de0e803 100644 --- a/tests/script/tsim/stable/metrics.sim +++ b/tests/script/tsim/stable/metrics.sim @@ -4,7 +4,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 2000 +sleep 1000 sql connect $dbPrefix = m_me_db @@ -95,8 +95,8 @@ $i = 2 $tb = $tbPrefix . $i sql insert into $tb values (now + 1m , 1 ) -print sleep 8000 -sleep 8000 +print sleep 2000 +sleep 2000 print =============== step6 @@ -130,7 +130,7 @@ endi sql drop database $db sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/stable/refcount.sim b/tests/script/tsim/stable/refcount.sim index 1f00483090..fffa6f75a4 100644 --- a/tests/script/tsim/stable/refcount.sim +++ b/tests/script/tsim/stable/refcount.sim @@ -20,7 +20,7 @@ sql insert into d1.t2 values(now, 1); sql drop database d1; sql show databases; -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -49,7 +49,7 @@ endi sql drop database d2; sql show databases; -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -78,7 +78,7 @@ endi sql drop database d3; sql show databases; -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -106,7 +106,7 @@ endi sql drop database d4; sql show databases; -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -123,7 +123,7 @@ sql insert into d5.t1 values(now, 1); sql drop database d5; sql show databases; -if $rows != 1 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/stable/show.sim b/tests/script/tsim/stable/show.sim index 8ebb765a78..823aefe9d8 100644 --- a/tests/script/tsim/stable/show.sim +++ b/tests/script/tsim/stable/show.sim @@ -27,8 +27,9 @@ while $m < 128 $filter = ' . $tb $filter = $filter . ' sql show stables like $filter - # print sql : show stables like $filter ==> $rows + print sql : show stables like $filter if $rows != 1 then + print expect 1, actual: $rows return -1 endi $m = $m + 1 diff --git a/tests/script/tsim/stable/vnode3.sim b/tests/script/tsim/stable/vnode3.sim index 2d408b4191..97a8203883 100644 --- a/tests/script/tsim/stable/vnode3.sim +++ b/tests/script/tsim/stable/vnode3.sim @@ -174,7 +174,7 @@ print =============== step11 print =============== clear sql drop database $db sql show databases -if $rows != 1 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/table/basic1.sim b/tests/script/tsim/table/basic1.sim index bdb49cc9cd..75cd0c8744 100644 --- a/tests/script/tsim/table/basic1.sim +++ b/tests/script/tsim/table/basic1.sim @@ -29,7 +29,7 @@ endi print =============== create database sql create database d1 sql show databases -if $rows != 5 then +if $rows != 6 then return -1 endi diff --git a/tests/script/tsim/tmq/basic.sim b/tests/script/tsim/tmq/basic.sim index 1eeec46d53..9f55847965 100644 --- a/tests/script/tsim/tmq/basic.sim +++ b/tests/script/tsim/tmq/basic.sim @@ -50,10 +50,10 @@ endi sql show databases print ===> $rows $data00 $data01 $data02 $data03 -if $rows != 2 then +if $rows != 3 then return -1 endi -if $data00 != tmqdb then +if $data20 != tmqdb then return -1 endi diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index bc827d79f4..ec33e89e84 100644 --- a/tests/script/tsim/tmq/basic1.sim +++ b/tests/script/tsim/tmq/basic1.sim @@ -36,12 +36,6 @@ sql connect $dbNamme = d0 print =============== create database , vgroup 1 sql create database $dbNamme vgroups 1 -sql show databases -print $data00 $data01 $data02 -if $rows != 2 then - return -1 -endi - sql use $dbNamme print =============== create super table diff --git a/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim index c301219ad6..68c2d5a891 100644 --- a/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim +++ b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim @@ -43,35 +43,6 @@ loop_vgroups: print =============== create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 2 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - sql use $dbNamme print =============== create super table diff --git a/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim index 0f38a8b58b..1b98bcdd5d 100644 --- a/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim +++ b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim @@ -42,36 +42,6 @@ $dbNamme = d0 loop_vgroups: print =============== create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 2 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - sql use $dbNamme print =============== create super table diff --git a/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim index 99d1c6e442..9f2b204b60 100644 --- a/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim +++ b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim @@ -42,36 +42,6 @@ $dbNamme = d0 loop_vgroups: print =============== create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 2 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - sql use $dbNamme print =============== create super table diff --git a/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim index 76ad75aead..45dd4fd187 100644 --- a/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim +++ b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim @@ -42,36 +42,6 @@ $dbNamme = d0 loop_vgroups: print =============== create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 2 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - sql use $dbNamme print =============== create super table diff --git a/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim b/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim index 095809abe9..2e2534d104 100644 --- a/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim +++ b/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim @@ -42,36 +42,6 @@ $dbNamme = d0 loop_vgroups: print =============== create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 1 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - sql use $dbNamme print =============== create super table @@ -197,6 +167,7 @@ system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamm print cmd result----> $system_content #if $system_content != @{consume success: 20000, 0}@ then if $system_content != $expect_result then + print expect @{consume success: 20000, 0}@ , actual @system_content return -1 endi diff --git a/tests/script/tsim/tmq/mainConsumerInOneTopic.sim b/tests/script/tsim/tmq/mainConsumerInOneTopic.sim index fc20e2db23..d307723878 100644 --- a/tests/script/tsim/tmq/mainConsumerInOneTopic.sim +++ b/tests/script/tsim/tmq/mainConsumerInOneTopic.sim @@ -42,36 +42,6 @@ $dbNamme = d0 loop_vgroups: print =============== create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 1 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - sql use $dbNamme print =============== create super table diff --git a/tests/script/tsim/tmq/multiTopic.sim b/tests/script/tsim/tmq/multiTopic.sim index cd977e5909..0ce6304799 100644 --- a/tests/script/tsim/tmq/multiTopic.sim +++ b/tests/script/tsim/tmq/multiTopic.sim @@ -48,24 +48,24 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 if $loop_cnt == 0 then - if $rows != 2 then + if $rows != 3 then return -1 endi - if $data02 != 1 then # vgroups + if $data22 != 1 then # vgroups print vgroups: $data02 return -1 endi else - if $rows != 3 then + if $rows != 4 then return -1 endi - if $data00 == d1 then - if $data02 != 4 then # vgroups + if $data20 == d1 then + if $data22 != 4 then # vgroups print vgroups: $data02 return -1 endi else - if $data12 != 4 then # vgroups + if $data32 != 4 then # vgroups print vgroups: $data12 return -1 endi diff --git a/tests/script/tsim/tmq/oneTopic.sim b/tests/script/tsim/tmq/oneTopic.sim index 8e8d00977c..e3f9d727b9 100644 --- a/tests/script/tsim/tmq/oneTopic.sim +++ b/tests/script/tsim/tmq/oneTopic.sim @@ -48,24 +48,24 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 if $loop_cnt == 0 then - if $rows != 2 then + if $rows != 3 then return -1 endi - if $data02 != 1 then # vgroups + if $data22 != 1 then # vgroups print vgroups: $data02 return -1 endi else - if $rows != 3 then + if $rows != 4 then return -1 endi - if $data00 == d1 then - if $data02 != 4 then # vgroups + if $data20 == d1 then + if $data22 != 4 then # vgroups print vgroups: $data02 return -1 endi else - if $data12 != 4 then # vgroups + if $data32 != 4 then # vgroups print vgroups: $data12 return -1 endi diff --git a/tests/test/c/tmqDemo.c b/tests/test/c/tmqDemo.c index 756893f217..16f6c42d87 100644 --- a/tests/test/c/tmqDemo.c +++ b/tests/test/c/tmqDemo.c @@ -13,76 +13,71 @@ * along with this program. If not, see . */ -// clang-format off +#define ALLOW_FORBID_FUNC #include +#include #include +#include #include -#include #include #include +#include #include -#include -#include #include "taos.h" #include "taoserror.h" #include "tlog.h" -#define GREEN "\033[1;32m" -#define NC "\033[0m" +#define GREEN "\033[1;32m" +#define NC "\033[0m" #define min(a, b) (((a) < (b)) ? (a) : (b)) -#define MAX_SQL_STR_LEN (1024 * 1024) -#define MAX_ROW_STR_LEN (16 * 1024) +#define MAX_SQL_STR_LEN (1024 * 1024) +#define MAX_ROW_STR_LEN (16 * 1024) -enum _RUN_MODE { - TMQ_RUN_INSERT_AND_CONSUME, - TMQ_RUN_ONLY_INSERT, - TMQ_RUN_ONLY_CONSUME, - TMQ_RUN_MODE_BUTT -}; +enum _RUN_MODE { TMQ_RUN_INSERT_AND_CONSUME, TMQ_RUN_ONLY_INSERT, TMQ_RUN_ONLY_CONSUME, TMQ_RUN_MODE_BUTT }; typedef struct { - char dbName[32]; - char stbName[64]; - char resultFileName[256]; - char vnodeWalPath[256]; - int32_t numOfThreads; - int32_t numOfTables; - int32_t numOfVgroups; - int32_t runMode; - int32_t numOfColumn; - double ratio; - int32_t batchNumOfRow; - int32_t totalRowsOfPerTbl; - int64_t startTimestamp; - int32_t showMsgFlag; - int32_t simCase; - - int32_t totalRowsOfT2; + char dbName[32]; + char stbName[64]; + char resultFileName[256]; + char vnodeWalPath[256]; + int32_t numOfThreads; + int32_t numOfTables; + int32_t numOfVgroups; + int32_t runMode; + int32_t numOfColumn; + double ratio; + int32_t batchNumOfRow; + int32_t totalRowsOfPerTbl; + int64_t startTimestamp; + int32_t showMsgFlag; + int32_t simCase; + + int32_t totalRowsOfT2; } SConfInfo; static SConfInfo g_stConfInfo = { "tmqdb", "stb", - "./tmqResult.txt", // output_file + "./tmqResult.txt", // output_file "", // /data2/dnode/data/vnode/vnode2/wal", - 1, // threads - 1, // tables - 1, // vgroups - 0, // run mode - 1, // columns - 1, // ratio - 1, // batch size - 10000, // total rows for per table - 0, // 2020-01-01 00:00:00.000 - 0, // show consume msg switch - 0, // if run in sim case + 1, // threads + 1, // tables + 1, // vgroups + 0, // run mode + 1, // columns + 1, // ratio + 1, // batch size + 10000, // total rows for per table + 0, // 2020-01-01 00:00:00.000 + 0, // show consume msg switch + 0, // if run in sim case 10000, }; -char* g_pRowValue = NULL; +char* g_pRowValue = NULL; TdFilePtr g_fp = NULL; static void printHelp() { @@ -125,10 +120,8 @@ static void printHelp() { exit(EXIT_SUCCESS); } -void parseArgument(int32_t argc, char *argv[]) { - +void parseArgument(int32_t argc, char* argv[]) { g_stConfInfo.startTimestamp = 1640966400000; // 2020-01-01 00:00:00.000 - for (int32_t i = 1; i < argc; i++) { if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { @@ -156,7 +149,7 @@ void parseArgument(int32_t argc, char *argv[]) { g_stConfInfo.batchNumOfRow = atoi(argv[++i]); } else if (strcmp(argv[i], "-r") == 0) { g_stConfInfo.totalRowsOfPerTbl = atoi(argv[++i]); - } else if (strcmp(argv[i], "-l") == 0) { + } else if (strcmp(argv[i], "-l") == 0) { g_stConfInfo.numOfColumn = atoi(argv[++i]); } else if (strcmp(argv[i], "-q") == 0) { g_stConfInfo.ratio = atof(argv[++i]); @@ -168,7 +161,7 @@ void parseArgument(int32_t argc, char *argv[]) { g_stConfInfo.simCase = atol(argv[++i]); } else { printf("%s unknow para: %s %s", GREEN, argv[++i], NC); - exit(-1); + exit(-1); } } @@ -191,73 +184,71 @@ void parseArgument(int32_t argc, char *argv[]) { pPrint("%s totalRowsOfT2:%d %s", GREEN, g_stConfInfo.totalRowsOfT2, NC); pPrint("%s startTimestamp:%" PRId64" %s", GREEN, g_stConfInfo.startTimestamp, NC); pPrint("%s showMsgFlag:%d %s", GREEN, g_stConfInfo.showMsgFlag, NC); -#endif +#endif } -static int running = 1; +static int running = 1; /*static void msg_process(tmq_message_t* message) { tmqShowMsg(message); }*/ // calc dir size (not include itself 4096Byte) -int64_t getDirectorySize(char *dir) -{ - TdDirPtr pDir; - TdDirEntryPtr pDirEntry; - int64_t totalSize=0; +int64_t getDirectorySize(char* dir) { + TdDirPtr pDir; + TdDirEntryPtr pDirEntry; + int64_t totalSize = 0; - if ((pDir = taosOpenDir(dir)) == NULL) { - fprintf(stderr, "Cannot open dir: %s\n", dir); - return -1; + if ((pDir = taosOpenDir(dir)) == NULL) { + fprintf(stderr, "Cannot open dir: %s\n", dir); + return -1; + } + + // lstat(dir, &statbuf); + // totalSize+=statbuf.st_size; + + while ((pDirEntry = taosReadDir(pDir)) != NULL) { + char subdir[1024]; + char* fileName = taosGetDirEntryName(pDirEntry); + sprintf(subdir, "%s/%s", dir, fileName); + + // printf("===d_name: %s\n", entry->d_name); + if (taosIsDir(subdir)) { + if (strcmp(".", fileName) == 0 || strcmp("..", fileName) == 0) { + continue; + } + + int64_t subDirSize = getDirectorySize(subdir); + totalSize += subDirSize; + } else if (0 == strcmp(strchr(fileName, '.'), ".log")) { // only calc .log file size, and not include .idx file + int64_t file_size = 0; + taosStatFile(subdir, &file_size, NULL); + totalSize += file_size; } + } - //lstat(dir, &statbuf); - //totalSize+=statbuf.st_size; - - while ((pDirEntry = taosReadDir(pDir)) != NULL) { - char subdir[1024]; - char* fileName = taosGetDirEntryName(pDirEntry); - sprintf(subdir, "%s/%s", dir, fileName); - - //printf("===d_name: %s\n", entry->d_name); - if (taosIsDir(subdir)) { - if (strcmp(".", fileName) == 0 || strcmp("..", fileName) == 0) { - continue; - } - - int64_t subDirSize = getDirectorySize(subdir); - totalSize+=subDirSize; - } else if (0 == strcmp(strchr(fileName, '.'), ".log")) { // only calc .log file size, and not include .idx file - int64_t file_size = 0; - taosStatFile(subdir, &file_size, NULL); - totalSize+=file_size; - } - } - - taosCloseDir(pDir); - return totalSize; + taosCloseDir(pDir); + return totalSize; } - -int queryDB(TAOS *taos, char *command) { - TAOS_RES *pRes = taos_query(taos, command); - int code = taos_errno(pRes); - //if ((code != 0) && (code != TSDB_CODE_RPC_AUTH_REQUIRED)) { - if (code != 0) { - pError("failed to reason:%s, sql: %s", tstrerror(code), command); - taos_free_result(pRes); - return -1; - } - taos_free_result(pRes); - return 0 ; +int queryDB(TAOS* taos, char* command) { + TAOS_RES* pRes = taos_query(taos, command); + int code = taos_errno(pRes); + // if ((code != 0) && (code != TSDB_CODE_RPC_AUTH_REQUIRED)) { + if (code != 0) { + pError("failed to reason:%s, sql: %s", tstrerror(code), command); + taos_free_result(pRes); + return -1; + } + taos_free_result(pRes); + return 0; } int32_t init_env() { char sqlStr[1024] = {0}; - + TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); if (pConn == NULL) { return -1; } - + sprintf(sqlStr, "create database if not exists %s vgroups %d", g_stConfInfo.dbName, g_stConfInfo.numOfVgroups); TAOS_RES* pRes = taos_query(pConn, sqlStr); if (taos_errno(pRes) != 0) { @@ -282,19 +273,19 @@ int32_t init_env() { int32_t dataLen = 0; int32_t sqlLen = 0; - sqlLen += sprintf(sqlStr+sqlLen, "create stable if not exists %s (ts timestamp, ", g_stConfInfo.stbName); + sqlLen += sprintf(sqlStr + sqlLen, "create stable if not exists %s (ts timestamp, ", g_stConfInfo.stbName); for (int32_t i = 0; i < g_stConfInfo.numOfColumn; i++) { - if (i == g_stConfInfo.numOfColumn - 1) { - sqlLen += sprintf(sqlStr+sqlLen, "c%d int) ", i); - memcpy(g_pRowValue + dataLen, "66778899", strlen("66778899")); - dataLen += strlen("66778899"); - } else { - sqlLen += sprintf(sqlStr+sqlLen, "c%d int, ", i); - memcpy(g_pRowValue + dataLen, "66778899, ", strlen("66778899, ")); - dataLen += strlen("66778899, "); - } + if (i == g_stConfInfo.numOfColumn - 1) { + sqlLen += sprintf(sqlStr + sqlLen, "c%d int) ", i); + memcpy(g_pRowValue + dataLen, "66778899", strlen("66778899")); + dataLen += strlen("66778899"); + } else { + sqlLen += sprintf(sqlStr + sqlLen, "c%d int, ", i); + memcpy(g_pRowValue + dataLen, "66778899, ", strlen("66778899, ")); + dataLen += strlen("66778899, "); + } } - sqlLen += sprintf(sqlStr+sqlLen, "tags (t0 int)"); + sqlLen += sprintf(sqlStr + sqlLen, "tags (t0 int)"); pRes = taos_query(pConn, sqlStr); if (taos_errno(pRes) != 0) { @@ -313,7 +304,7 @@ int32_t init_env() { taos_free_result(pRes); } - //const char* sql = "select * from tu1"; + // const char* sql = "select * from tu1"; sprintf(sqlStr, "create topic test_stb_topic_1 as select ts,c0 from %s", g_stConfInfo.stbName); /*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sqlStr, strlen(sqlStr));*/ pRes = taos_query(pConn, sqlStr); @@ -327,6 +318,7 @@ int32_t init_env() { } tmq_t* build_consumer() { +#if 0 char sqlStr[1024] = {0}; TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); @@ -338,10 +330,15 @@ tmq_t* build_consumer() { printf("error in use db, reason:%s\n", taos_errstr(pRes)); } taos_free_result(pRes); +#endif tmq_conf_t* conf = tmq_conf_new(); tmq_conf_set(conf, "group.id", "tg2"); - tmq_t* tmq = tmq_consumer_new(pConn, conf, NULL, 0); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "td.connect.db", g_stConfInfo.dbName); + tmq_t* tmq = tmq_consumer_new1(conf, NULL, 0); + tmq_conf_destroy(conf); return tmq; } @@ -396,20 +393,20 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics, int32_t totalMsgs, int64_t walLog if (tmqmessage) { batchCnt++; /*skipLogNum += tmqGetSkipLogNum(tmqmessage);*/ - if (0 != g_stConfInfo.showMsgFlag) { + if (0 != g_stConfInfo.showMsgFlag) { /*msg_process(tmqmessage);*/ - } + } tmq_message_destroy(tmqmessage); } else { break; } } int64_t endTime = taosGetTimestampUs(); - double consumeTime = (double)(endTime - startTime) / 1000000; + double consumeTime = (double)(endTime - startTime) / 1000000; if (batchCnt != totalMsgs) { - printf("%s inserted msgs: %d and consume msgs: %d mismatch %s", GREEN, totalMsgs, batchCnt, NC); - /*exit(-1);*/ + printf("%s inserted msgs: %d and consume msgs: %d mismatch %s", GREEN, totalMsgs, batchCnt, NC); + /*exit(-1);*/ } if (0 == g_stConfInfo.simCase) { @@ -417,12 +414,14 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics, int32_t totalMsgs, int64_t walLog } else { printf("{consume success: %d}", totalMsgs); } - taosFprintfFile(g_fp, "|%10d | %10.3f | %8.2f | %10.2f| %10.2f |\n", batchCnt, consumeTime, (double)batchCnt / consumeTime, (double)walLogSize / (1024 * 1024.0) / consumeTime, (double)walLogSize / 1024.0 / batchCnt); + taosFprintfFile(g_fp, "|%10d | %10.3f | %8.2f | %10.2f| %10.2f |\n", batchCnt, consumeTime, + (double)batchCnt / consumeTime, (double)walLogSize / (1024 * 1024.0) / consumeTime, + (double)walLogSize / 1024.0 / batchCnt); err = tmq_consumer_close(tmq); if (err) { fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(err)); - exit(-1); + exit(-1); } } @@ -430,7 +429,7 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics, int32_t totalMsgs, int64_t walLog int32_t syncWriteData() { TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); if (pConn == NULL) { - return -1; + return -1; } char sqlStr[1024] = {0}; @@ -449,11 +448,11 @@ int32_t syncWriteData() { } int32_t totalMsgs = 0; - + int64_t time_counter = g_stConfInfo.startTimestamp; for (int i = 0; i < g_stConfInfo.totalRowsOfPerTbl;) { for (int tID = 0; tID <= g_stConfInfo.numOfTables - 1; tID++) { - int inserted = i; + int inserted = i; int64_t tmp_time = time_counter; int32_t data_len = 0; @@ -465,22 +464,22 @@ int32_t syncWriteData() { k++; if (inserted >= g_stConfInfo.totalRowsOfPerTbl) { - break; + break; } - if (data_len > MAX_SQL_STR_LEN - MAX_ROW_STR_LEN) { + if (data_len > MAX_SQL_STR_LEN - MAX_ROW_STR_LEN) { break; - } + } } int code = queryDB(pConn, buffer); - if (0 != code){ + if (0 != code) { fprintf(stderr, "insert data error!\n"); - taosMemoryFreeClear(buffer); - return -1; - } + taosMemoryFreeClear(buffer); + return -1; + } - totalMsgs++; + totalMsgs++; if (tID == g_stConfInfo.numOfTables - 1) { i = inserted; @@ -492,12 +491,11 @@ int32_t syncWriteData() { return totalMsgs; } - // sync insertion int32_t syncWriteDataByRatio() { TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); if (pConn == NULL) { - return -1; + return -1; } char sqlStr[1024] = {0}; @@ -518,27 +516,27 @@ int32_t syncWriteDataByRatio() { int32_t totalMsgs = 0; int32_t insertedOfT1 = 0; - int32_t insertedOfT2 = 0; + int32_t insertedOfT2 = 0; int64_t tsOfT1 = g_stConfInfo.startTimestamp; int64_t tsOfT2 = g_stConfInfo.startTimestamp; int64_t tmp_time; - + for (;;) { - if ((insertedOfT1 >= g_stConfInfo.totalRowsOfPerTbl) && (insertedOfT2 >= g_stConfInfo.totalRowsOfT2)) { + if ((insertedOfT1 >= g_stConfInfo.totalRowsOfPerTbl) && (insertedOfT2 >= g_stConfInfo.totalRowsOfT2)) { break; - } - + } + for (int tID = 0; tID <= g_stConfInfo.numOfTables - 1; tID++) { if (0 == tID) { - tmp_time = tsOfT1; + tmp_time = tsOfT1; if (insertedOfT1 >= g_stConfInfo.totalRowsOfPerTbl) { - continue; + continue; } - } else if (1 == tID){ - tmp_time = tsOfT2; + } else if (1 == tID) { + tmp_time = tsOfT2; if (insertedOfT2 >= g_stConfInfo.totalRowsOfT2) { - continue; + continue; } } @@ -548,79 +546,86 @@ int32_t syncWriteDataByRatio() { for (k = 0; k < g_stConfInfo.batchNumOfRow;) { data_len += sprintf(buffer + data_len, "(%" PRId64 ", %s) ", tmp_time++, g_pRowValue); k++; - if (0 == tID) { + if (0 == tID) { insertedOfT1++; - if (insertedOfT1 >= g_stConfInfo.totalRowsOfPerTbl) { - break; - } - } else if (1 == tID){ + if (insertedOfT1 >= g_stConfInfo.totalRowsOfPerTbl) { + break; + } + } else if (1 == tID) { insertedOfT2++; - if (insertedOfT2 >= g_stConfInfo.totalRowsOfT2) { - break; - } - } + if (insertedOfT2 >= g_stConfInfo.totalRowsOfT2) { + break; + } + } - if (data_len > MAX_SQL_STR_LEN - MAX_ROW_STR_LEN) { + if (data_len > MAX_SQL_STR_LEN - MAX_ROW_STR_LEN) { break; - } + } } int code = queryDB(pConn, buffer); - if (0 != code){ + if (0 != code) { fprintf(stderr, "insert data error!\n"); - taosMemoryFreeClear(buffer); - return -1; - } - - if (0 == tID) { - tsOfT1 = tmp_time; - } else if (1 == tID){ - tsOfT2 = tmp_time; + taosMemoryFreeClear(buffer); + return -1; } - totalMsgs++; + if (0 == tID) { + tsOfT1 = tmp_time; + } else if (1 == tID) { + tsOfT2 = tmp_time; + } + + totalMsgs++; } } - pPrint("expect insert rows: T1[%d] T2[%d], actual insert rows: T1[%d] T2[%d]\n", g_stConfInfo.totalRowsOfPerTbl, g_stConfInfo.totalRowsOfT2, insertedOfT1, insertedOfT2); + pPrint("expect insert rows: T1[%d] T2[%d], actual insert rows: T1[%d] T2[%d]\n", g_stConfInfo.totalRowsOfPerTbl, + g_stConfInfo.totalRowsOfT2, insertedOfT1, insertedOfT2); taosMemoryFreeClear(buffer); return totalMsgs; } void printParaIntoFile() { // FILE *fp = fopen(g_stConfInfo.resultFileName, "a"); - TdFilePtr pFile = taosOpenFile(g_stConfInfo.resultFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_STREAM); + TdFilePtr pFile = + taosOpenFile(g_stConfInfo.resultFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_STREAM); if (NULL == pFile) { fprintf(stderr, "Failed to open %s for save result\n", g_stConfInfo.resultFileName); - exit -1; + exit - 1; }; g_fp = pFile; - time_t tTime = taosGetTimestampSec(); + time_t tTime = taosGetTimestampSec(); struct tm tm = *localtime(&tTime); taosFprintfFile(pFile, "###################################################################\n"); - taosFprintfFile(pFile, "# configDir: %s\n", configDir); - taosFprintfFile(pFile, "# dbName: %s\n", g_stConfInfo.dbName); - taosFprintfFile(pFile, "# stbName: %s\n", g_stConfInfo.stbName); - taosFprintfFile(pFile, "# vnodeWalPath: %s\n", g_stConfInfo.vnodeWalPath); - taosFprintfFile(pFile, "# numOfTables: %d\n", g_stConfInfo.numOfTables); - taosFprintfFile(pFile, "# numOfThreads: %d\n", g_stConfInfo.numOfThreads); - taosFprintfFile(pFile, "# numOfVgroups: %d\n", g_stConfInfo.numOfVgroups); - taosFprintfFile(pFile, "# runMode: %d\n", g_stConfInfo.runMode); - taosFprintfFile(pFile, "# ratio: %f\n", g_stConfInfo.ratio); - taosFprintfFile(pFile, "# numOfColumn: %d\n", g_stConfInfo.numOfColumn); - taosFprintfFile(pFile, "# batchNumOfRow: %d\n", g_stConfInfo.batchNumOfRow); - taosFprintfFile(pFile, "# totalRowsOfPerTbl: %d\n", g_stConfInfo.totalRowsOfPerTbl); - taosFprintfFile(pFile, "# totalRowsOfT2: %d\n", g_stConfInfo.totalRowsOfT2); + taosFprintfFile(pFile, "# configDir: %s\n", configDir); + taosFprintfFile(pFile, "# dbName: %s\n", g_stConfInfo.dbName); + taosFprintfFile(pFile, "# stbName: %s\n", g_stConfInfo.stbName); + taosFprintfFile(pFile, "# vnodeWalPath: %s\n", g_stConfInfo.vnodeWalPath); + taosFprintfFile(pFile, "# numOfTables: %d\n", g_stConfInfo.numOfTables); + taosFprintfFile(pFile, "# numOfThreads: %d\n", g_stConfInfo.numOfThreads); + taosFprintfFile(pFile, "# numOfVgroups: %d\n", g_stConfInfo.numOfVgroups); + taosFprintfFile(pFile, "# runMode: %d\n", g_stConfInfo.runMode); + taosFprintfFile(pFile, "# ratio: %f\n", g_stConfInfo.ratio); + taosFprintfFile(pFile, "# numOfColumn: %d\n", g_stConfInfo.numOfColumn); + taosFprintfFile(pFile, "# batchNumOfRow: %d\n", g_stConfInfo.batchNumOfRow); + taosFprintfFile(pFile, "# totalRowsOfPerTbl: %d\n", g_stConfInfo.totalRowsOfPerTbl); + taosFprintfFile(pFile, "# totalRowsOfT2: %d\n", g_stConfInfo.totalRowsOfT2); taosFprintfFile(pFile, "# Test time: %d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year + 1900, tm.tm_mon + 1, - tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); taosFprintfFile(pFile, "###################################################################\n"); - taosFprintfFile(pFile, "|-------------------------------insert info-----------------------------|--------------------------------consume info---------------------------------|\n"); - taosFprintfFile(pFile, "|batch size| insert msgs | insert time(s) | msgs/s | walLogSize(MB) | consume msgs | consume time(s) | msgs/s | MB/s | avg msg size(KB) |\n"); + taosFprintfFile(pFile, + "|-------------------------------insert " + "info-----------------------------|--------------------------------consume " + "info---------------------------------|\n"); + taosFprintfFile(pFile, + "|batch size| insert msgs | insert time(s) | msgs/s | walLogSize(MB) | consume msgs | consume " + "time(s) | msgs/s | MB/s | avg msg size(KB) |\n"); taosFprintfFile(g_fp, "|%10d", g_stConfInfo.batchNumOfRow); } -int main(int32_t argc, char *argv[]) { +int main(int32_t argc, char* argv[]) { parseArgument(argc, argv); printParaIntoFile(); @@ -630,70 +635,70 @@ int main(int32_t argc, char *argv[]) { code = init_env(); if (code != 0) { fprintf(stderr, "%% init_env error!\n"); - return -1; + return -1; } int32_t totalMsgs = 0; if (g_stConfInfo.runMode != TMQ_RUN_ONLY_CONSUME) { - int64_t startTs = taosGetTimestampUs(); if (1 == g_stConfInfo.ratio) { - totalMsgs = syncWriteData(); + totalMsgs = syncWriteData(); } else { - totalMsgs = syncWriteDataByRatio(); - } - - if (totalMsgs <= 0) { - pError("inset data error!\n"); - return -1; - } - int64_t endTs = taosGetTimestampUs(); - int64_t delay = endTs - startTs; - - int32_t totalRows = 0; - if (1 == g_stConfInfo.ratio) { - totalRows = g_stConfInfo.totalRowsOfPerTbl * g_stConfInfo.numOfTables; - } else { - totalRows = g_stConfInfo.totalRowsOfPerTbl * (1 + g_stConfInfo.ratio); - } - - float seconds = delay / 1000000.0; - float rowsSpeed = totalRows / seconds; - float msgsSpeed = totalMsgs / seconds; - - - if ((0 == g_stConfInfo.simCase) && (strlen(g_stConfInfo.vnodeWalPath))) { - walLogSize = getDirectorySize(g_stConfInfo.vnodeWalPath); - if (walLogSize <= 0) { - printf("%s size incorrect!", g_stConfInfo.vnodeWalPath); - exit(-1); - } else { - pPrint(".log file size in vnode2/wal: %.3f MBytes\n", (double)walLogSize/(1024 * 1024.0)); - } - } - - if (0 == g_stConfInfo.simCase) { - pPrint("insert result: %d rows, %d msgs, time:%.3f sec, speed:%.1f rows/second, %.1f msgs/second\n", totalRows, totalMsgs, seconds, rowsSpeed, msgsSpeed); + totalMsgs = syncWriteDataByRatio(); } - taosFprintfFile(g_fp, "|%10d | %10.3f | %8.2f | %10.3f ", totalMsgs, seconds, msgsSpeed, (double)walLogSize/(1024 * 1024.0)); + + if (totalMsgs <= 0) { + pError("inset data error!\n"); + return -1; + } + int64_t endTs = taosGetTimestampUs(); + int64_t delay = endTs - startTs; + + int32_t totalRows = 0; + if (1 == g_stConfInfo.ratio) { + totalRows = g_stConfInfo.totalRowsOfPerTbl * g_stConfInfo.numOfTables; + } else { + totalRows = g_stConfInfo.totalRowsOfPerTbl * (1 + g_stConfInfo.ratio); + } + + float seconds = delay / 1000000.0; + float rowsSpeed = totalRows / seconds; + float msgsSpeed = totalMsgs / seconds; + + if ((0 == g_stConfInfo.simCase) && (strlen(g_stConfInfo.vnodeWalPath))) { + walLogSize = getDirectorySize(g_stConfInfo.vnodeWalPath); + if (walLogSize <= 0) { + printf("%s size incorrect!", g_stConfInfo.vnodeWalPath); + exit(-1); + } else { + pPrint(".log file size in vnode2/wal: %.3f MBytes\n", (double)walLogSize / (1024 * 1024.0)); + } + } + + if (0 == g_stConfInfo.simCase) { + pPrint("insert result: %d rows, %d msgs, time:%.3f sec, speed:%.1f rows/second, %.1f msgs/second\n", totalRows, + totalMsgs, seconds, rowsSpeed, msgsSpeed); + } + taosFprintfFile(g_fp, "|%10d | %10.3f | %8.2f | %10.3f ", totalMsgs, seconds, msgsSpeed, + (double)walLogSize / (1024 * 1024.0)); } if (g_stConfInfo.runMode == TMQ_RUN_ONLY_INSERT) { return 0; } - - tmq_t* tmq = build_consumer(); + + tmq_t* tmq = build_consumer(); tmq_list_t* topic_list = build_topic_list(); - if ((NULL == tmq) || (NULL == topic_list)){ + if ((NULL == tmq) || (NULL == topic_list)) { return -1; } - + perf_loop(tmq, topic_list, totalMsgs, walLogSize); taosMemoryFreeClear(g_pRowValue); - taosFprintfFile(g_fp, "\n"); - taosCloseFile(&g_fp); + taosFprintfFile(g_fp, "\n"); + taosCloseFile(&g_fp); return 0; } diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 7862788a71..eaca8f151e 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -35,8 +35,8 @@ #define MAX_ROW_STR_LEN (16 * 1024) typedef struct { - int32_t expectMsgCnt; - int32_t consumeMsgCnt; + int32_t expectMsgCnt; + int32_t consumeMsgCnt; TdThread thread; } SThreadInfo; @@ -45,12 +45,12 @@ typedef struct { char dbName[32]; char topicString[256]; char keyString[1024]; - char topicString1[256]; - char keyString1[1024]; + char topicString1[256]; + char keyString1[1024]; int32_t showMsgFlag; int32_t consumeDelay; // unit s int32_t consumeMsgCnt; - int32_t checkMode; + int32_t checkMode; // save result after parse agrvs int32_t numOfTopic; @@ -59,13 +59,13 @@ typedef struct { int32_t numOfKey; char key[32][64]; char value[32][64]; - - int32_t numOfTopic1; - char topics1[32][64]; - - int32_t numOfKey1; - char key1[32][64]; - char value1[32][64]; + + int32_t numOfTopic1; + char topics1[32][64]; + + int32_t numOfKey1; + char key1[32][64]; + char value1[32][64]; } SConfInfo; static SConfInfo g_stConfInfo; @@ -186,18 +186,18 @@ void parseInputString() { ltrim(g_stConfInfo.topics[g_stConfInfo.numOfTopic]); // printf("%s\n", g_stConfInfo.topics[g_stConfInfo.numOfTopic]); g_stConfInfo.numOfTopic++; - + token = strtok(NULL, delim); - } + } token = strtok(g_stConfInfo.topicString1, delim); - while(token != NULL) { - //printf("%s\n", token ); - strcpy(g_stConfInfo.topics1[g_stConfInfo.numOfTopic1], token); + while (token != NULL) { + // printf("%s\n", token ); + strcpy(g_stConfInfo.topics1[g_stConfInfo.numOfTopic1], token); ltrim(g_stConfInfo.topics1[g_stConfInfo.numOfTopic1]); - //printf("%s\n", g_stConfInfo.topics[g_stConfInfo.numOfTopic]); - g_stConfInfo.numOfTopic1++; - + // printf("%s\n", g_stConfInfo.topics[g_stConfInfo.numOfTopic]); + g_stConfInfo.numOfTopic1++; + token = strtok(NULL, delim); } @@ -214,28 +214,28 @@ void parseInputString() { // g_stConfInfo.value[g_stConfInfo.numOfKey]); g_stConfInfo.numOfKey++; } - + token = strtok(NULL, delim); } token = strtok(g_stConfInfo.keyString1, delim); - while(token != NULL) { - //printf("%s\n", token ); - { - char* pstr = token; - ltrim(pstr); - char *ret = strchr(pstr, ch); - memcpy(g_stConfInfo.key1[g_stConfInfo.numOfKey1], pstr, ret-pstr); - strcpy(g_stConfInfo.value1[g_stConfInfo.numOfKey1], ret+1); - //printf("key: %s, value: %s\n", g_stConfInfo.key[g_stConfInfo.numOfKey], g_stConfInfo.value[g_stConfInfo.numOfKey]); - g_stConfInfo.numOfKey1++; + while (token != NULL) { + // printf("%s\n", token ); + { + char* pstr = token; + ltrim(pstr); + char* ret = strchr(pstr, ch); + memcpy(g_stConfInfo.key1[g_stConfInfo.numOfKey1], pstr, ret - pstr); + strcpy(g_stConfInfo.value1[g_stConfInfo.numOfKey1], ret + 1); + // printf("key: %s, value: %s\n", g_stConfInfo.key[g_stConfInfo.numOfKey], + // g_stConfInfo.value[g_stConfInfo.numOfKey]); + g_stConfInfo.numOfKey1++; } - + token = strtok(NULL, delim); } } - static int running = 1; /*static void msg_process(tmq_message_t* message) { tmqShowMsg(message); }*/ @@ -253,6 +253,7 @@ int queryDB(TAOS* taos, char* command) { } tmq_t* build_consumer() { +#if 0 char sqlStr[1024] = {0}; TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); @@ -266,13 +267,19 @@ tmq_t* build_consumer() { exit(-1); } taos_free_result(pRes); +#endif tmq_conf_t* conf = tmq_conf_new(); // tmq_conf_set(conf, "group.id", "tg2"); for (int32_t i = 0; i < g_stConfInfo.numOfKey; i++) { tmq_conf_set(conf, g_stConfInfo.key[i], g_stConfInfo.value[i]); } - tmq_t* tmq = tmq_consumer_new(pConn, conf, NULL, 0); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "td.connect.db", g_stConfInfo.dbName); + tmq_t* tmq = tmq_consumer_new1(conf, NULL, 0); + assert(tmq); + tmq_conf_destroy(conf); return tmq; } @@ -285,10 +292,10 @@ tmq_list_t* build_topic_list() { return topic_list; } - tmq_t* build_consumer_x() { +#if 0 char sqlStr[1024] = {0}; - + TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); assert(pConn != NULL); @@ -296,23 +303,29 @@ tmq_t* build_consumer_x() { TAOS_RES* pRes = taos_query(pConn, sqlStr); if (taos_errno(pRes) != 0) { printf("error in use db, reason:%s\n", taos_errstr(pRes)); - taos_free_result(pRes); - exit(-1); + taos_free_result(pRes); + exit(-1); } taos_free_result(pRes); +#endif tmq_conf_t* conf = tmq_conf_new(); - //tmq_conf_set(conf, "group.id", "tg2"); + // tmq_conf_set(conf, "group.id", "tg2"); for (int32_t i = 0; i < g_stConfInfo.numOfKey1; i++) { tmq_conf_set(conf, g_stConfInfo.key1[i], g_stConfInfo.value1[i]); } - tmq_t* tmq = tmq_consumer_new(pConn, conf, NULL, 0); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "td.connect.db", g_stConfInfo.dbName); + tmq_t* tmq = tmq_consumer_new1(conf, NULL, 0); + assert(tmq); + tmq_conf_destroy(conf); return tmq; } tmq_list_t* build_topic_list_x() { tmq_list_t* topic_list = tmq_list_new(); - //tmq_list_append(topic_list, "test_stb_topic_1"); + // tmq_list_append(topic_list, "test_stb_topic_1"); for (int32_t i = 0; i < g_stConfInfo.numOfTopic1; i++) { tmq_list_append(topic_list, g_stConfInfo.topics1[i]); } @@ -367,9 +380,9 @@ int32_t parallel_consume(tmq_t* tmq, int threadLable) { if (tmqMsg) { totalMsgs++; - //printf("threadFlag: %d, totalMsgs: %d\n", threadLable, totalMsgs); + // printf("threadFlag: %d, totalMsgs: %d\n", threadLable, totalMsgs); - #if 0 +#if 0 TAOS_ROW row; while (NULL != (row = tmq_get_row(tmqMsg))) { totalRows++; @@ -396,65 +409,63 @@ int32_t parallel_consume(tmq_t* tmq, int threadLable) { exit(-1); } - //printf("%d", totalMsgs); // output to sim for check result + // printf("%d", totalMsgs); // output to sim for check result return totalMsgs; } - -void *threadFunc(void *param) { +void* threadFunc(void* param) { int32_t totalMsgs = 0; - SThreadInfo *pInfo = (SThreadInfo *)param; + SThreadInfo* pInfo = (SThreadInfo*)param; - tmq_t* tmq = build_consumer_x(); + tmq_t* tmq = build_consumer_x(); tmq_list_t* topic_list = build_topic_list_x(); - if ((NULL == tmq) || (NULL == topic_list)){ + if ((NULL == tmq) || (NULL == topic_list)) { return NULL; } - + tmq_resp_err_t err = tmq_subscribe(tmq, topic_list); if (err) { printf("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err)); exit(-1); } - //if (0 == g_stConfInfo.consumeMsgCnt) { - // loop_consume(tmq); - //} else { - pInfo->consumeMsgCnt = parallel_consume(tmq, 1); + // if (0 == g_stConfInfo.consumeMsgCnt) { + // loop_consume(tmq); + // } else { + pInfo->consumeMsgCnt = parallel_consume(tmq, 1); //} err = tmq_unsubscribe(tmq); if (err) { printf("tmq_unsubscribe() fail, reason: %s\n", tmq_err2str(err)); - pInfo->consumeMsgCnt = -1; + pInfo->consumeMsgCnt = -1; return NULL; } return NULL; } - int main(int32_t argc, char* argv[]) { parseArgument(argc, argv); parseInputString(); - int32_t numOfThreads = 1; + int32_t numOfThreads = 1; TdThreadAttr thattr; taosThreadAttrInit(&thattr); taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE); - SThreadInfo *pInfo = (SThreadInfo *)taosMemoryCalloc(numOfThreads, sizeof(SThreadInfo)); + SThreadInfo* pInfo = (SThreadInfo*)taosMemoryCalloc(numOfThreads, sizeof(SThreadInfo)); if (g_stConfInfo.numOfTopic1) { // pthread_create one thread to consume for (int32_t i = 0; i < numOfThreads; ++i) { pInfo[i].expectMsgCnt = 0; pInfo[i].consumeMsgCnt = 0; - taosThreadCreate(&(pInfo[i].thread), &thattr, threadFunc, (void *)(pInfo + i)); + taosThreadCreate(&(pInfo[i].thread), &thattr, threadFunc, (void*)(pInfo + i)); } } - int32_t totalMsgs = 0; + int32_t totalMsgs = 0; tmq_t* tmq = build_consumer(); tmq_list_t* topic_list = build_topic_list(); if ((NULL == tmq) || (NULL == topic_list)) { @@ -479,48 +490,48 @@ int main(int32_t argc, char* argv[]) { exit(-1); } - if (g_stConfInfo.numOfTopic1) { + if (g_stConfInfo.numOfTopic1) { for (int32_t i = 0; i < numOfThreads; i++) { taosThreadJoin(pInfo[i].thread, NULL); } - //printf("consumer: %d, cosumer1: %d\n", totalMsgs, pInfo->consumeMsgCnt); - if (0 == g_stConfInfo.checkMode) { - if ((totalMsgs + pInfo->consumeMsgCnt) == g_stConfInfo.consumeMsgCnt) { - printf("success"); + // printf("consumer: %d, cosumer1: %d\n", totalMsgs, pInfo->consumeMsgCnt); + if (0 == g_stConfInfo.checkMode) { + if ((totalMsgs + pInfo->consumeMsgCnt) == g_stConfInfo.consumeMsgCnt) { + printf("success"); } else { - printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); - } - } else if (1 == g_stConfInfo.checkMode) { + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } else if (1 == g_stConfInfo.checkMode) { if ((totalMsgs == g_stConfInfo.consumeMsgCnt) && (pInfo->consumeMsgCnt == g_stConfInfo.consumeMsgCnt)) { - printf("success"); + printf("success"); } else { - printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); - } - } else if (2 == g_stConfInfo.checkMode) { - if ((totalMsgs + pInfo->consumeMsgCnt) == 3 * g_stConfInfo.consumeMsgCnt) { - printf("success"); + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } else if (2 == g_stConfInfo.checkMode) { + if ((totalMsgs + pInfo->consumeMsgCnt) == 3 * g_stConfInfo.consumeMsgCnt) { + printf("success"); } else { - printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); - } - } else if (3 == g_stConfInfo.checkMode) { + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } else if (3 == g_stConfInfo.checkMode) { if ((totalMsgs == 2 * g_stConfInfo.consumeMsgCnt) && (pInfo->consumeMsgCnt == 2 * g_stConfInfo.consumeMsgCnt)) { - printf("success"); + printf("success"); } else { - printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); - } - } else if (4 == g_stConfInfo.checkMode) { - if (((totalMsgs == 0) && (pInfo->consumeMsgCnt == 3 * g_stConfInfo.consumeMsgCnt)) - || ((pInfo->consumeMsgCnt == 0) && (totalMsgs == 3 * g_stConfInfo.consumeMsgCnt)) - || ((pInfo->consumeMsgCnt == g_stConfInfo.consumeMsgCnt) && (totalMsgs == 2 * g_stConfInfo.consumeMsgCnt)) - || ((pInfo->consumeMsgCnt == 2 * g_stConfInfo.consumeMsgCnt) && (totalMsgs == g_stConfInfo.consumeMsgCnt))) { - printf("success"); + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } else if (4 == g_stConfInfo.checkMode) { + if (((totalMsgs == 0) && (pInfo->consumeMsgCnt == 3 * g_stConfInfo.consumeMsgCnt)) || + ((pInfo->consumeMsgCnt == 0) && (totalMsgs == 3 * g_stConfInfo.consumeMsgCnt)) || + ((pInfo->consumeMsgCnt == g_stConfInfo.consumeMsgCnt) && (totalMsgs == 2 * g_stConfInfo.consumeMsgCnt)) || + ((pInfo->consumeMsgCnt == 2 * g_stConfInfo.consumeMsgCnt) && (totalMsgs == g_stConfInfo.consumeMsgCnt))) { + printf("success"); } else { - printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); - } - } else { - printf("fail, check mode unknow. consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); - } + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } else { + printf("fail, check mode unknow. consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } } return 0; diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index 8ef5c816c8..d713233362 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -678,7 +678,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { if (tt < 0) tt = 0; #endif - tp = localtime(&tt); + tp = taosLocalTime(&tt, NULL); strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", tp); if (precision == TSDB_TIME_PRECISION_MILLI) { sprintf(value, "%s.%03d", timeStr, (int32_t)(*((int64_t *)row[i]) % 1000)); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index b89d517ad3..1809d99209 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -452,7 +452,7 @@ static char *formatTimestamp(char *buf, int64_t val, int precision) { } } - struct tm *ptm = localtime(&tt); + struct tm *ptm = taosLocalTime(&tt, NULL); size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", ptm); if (precision == TSDB_TIME_PRECISION_NANO) { diff --git a/tools/taosTools-1.4.1-Linux-x64.tar.gz b/tools/taosTools-1.4.1-Linux-x64.tar.gz new file mode 100644 index 0000000000..caefa3d957 Binary files /dev/null and b/tools/taosTools-1.4.1-Linux-x64.tar.gz differ