提交 aa2faab1 编写于 作者: C Cary Xu

Merge branch '3.0' into feature/TD-13066-3.0

...@@ -106,8 +106,8 @@ int32_t create_topic() { ...@@ -106,8 +106,8 @@ int32_t create_topic() {
} }
taos_free_result(pRes); taos_free_result(pRes);
pRes = taos_query(pConn, "create topic topic_ctb_column as abc1"); /*pRes = taos_query(pConn, "create topic topic_ctb_column as abc1");*/
/*pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");*/ pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes)); printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes));
return -1; return -1;
......
...@@ -60,9 +60,9 @@ typedef struct { ...@@ -60,9 +60,9 @@ typedef struct {
ReportStartup reportStartupFp; ReportStartup reportStartupFp;
} SMsgCb; } SMsgCb;
void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb); void tmsgSetDefault(const SMsgCb* msgcb);
int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pMsg); int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg);
int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype); int32_t tmsgGetQueueSize(const SMsgCb* msgcb, int32_t vgId, EQueueType qtype);
int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg); int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg);
void tmsgSendRsp(SRpcMsg* pMsg); void tmsgSendRsp(SRpcMsg* pMsg);
void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet); void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet);
......
...@@ -179,6 +179,8 @@ typedef struct { ...@@ -179,6 +179,8 @@ typedef struct {
} \ } \
} while (0) } while (0)
//TODO: use varchar(0) to represent NULL type
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT) #define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT) #define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE) #define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
......
...@@ -208,6 +208,7 @@ typedef enum ENodeType { ...@@ -208,6 +208,7 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_SORT, QUERY_NODE_PHYSICAL_PLAN_SORT,
QUERY_NODE_PHYSICAL_PLAN_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_INTERVAL,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL,
QUERY_NODE_PHYSICAL_PLAN_FILL, QUERY_NODE_PHYSICAL_PLAN_FILL,
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW, QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW,
QUERY_NODE_PHYSICAL_PLAN_STATE_WINDOW, QUERY_NODE_PHYSICAL_PLAN_STATE_WINDOW,
......
...@@ -248,6 +248,7 @@ typedef struct SSetOperator { ...@@ -248,6 +248,7 @@ typedef struct SSetOperator {
SNode* pRight; SNode* pRight;
SNodeList* pOrderByList; // SOrderByExprNode SNodeList* pOrderByList; // SOrderByExprNode
SNode* pLimit; SNode* pLimit;
char stmtName[TSDB_TABLE_NAME_LEN];
} SSetOperator; } SSetOperator;
typedef enum ESqlClause { typedef enum ESqlClause {
......
...@@ -223,19 +223,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ...@@ -223,19 +223,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define qDebug(...) \ #define qDebug(...) \
do { \ do { \
if (qDebugFlag & DEBUG_DEBUG) { \ if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qTrace(...) \ #define qTrace(...) \
do { \ do { \
if (qDebugFlag & DEBUG_TRACE) { \ if (qDebugFlag & DEBUG_TRACE) { \
taosPrintLog("QRY ", DEBUG_TRACE, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qDebugL(...) \ #define qDebugL(...) \
do { \ do { \
if (qDebugFlag & DEBUG_DEBUG) { \ if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLongString("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
......
...@@ -646,6 +646,7 @@ int32_t* taosGetErrno(); ...@@ -646,6 +646,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_ALTER_TABLE TAOS_DEF_ERROR_CODE(0, 0x2649) #define TSDB_CODE_PAR_INVALID_ALTER_TABLE TAOS_DEF_ERROR_CODE(0, 0x2649)
#define TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY TAOS_DEF_ERROR_CODE(0, 0x264A) #define TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY TAOS_DEF_ERROR_CODE(0, 0x264A)
#define TSDB_CODE_PAR_INVALID_MODIFY_COL TAOS_DEF_ERROR_CODE(0, 0x264B) #define TSDB_CODE_PAR_INVALID_MODIFY_COL TAOS_DEF_ERROR_CODE(0, 0x264B)
#define TSDB_CODE_PAR_INVALID_TBNAME TAOS_DEF_ERROR_CODE(0, 0x264C)
//planner //planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700) #define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
......
...@@ -17,46 +17,46 @@ ...@@ -17,46 +17,46 @@
#include "tmsgcb.h" #include "tmsgcb.h"
#include "taoserror.h" #include "taoserror.h"
static SMsgCb tsDefaultMsgCb; static SMsgCb defaultMsgCb;
void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb) { tsDefaultMsgCb = *pMsgCb; } void tmsgSetDefault(const SMsgCb* msgcb) { defaultMsgCb = *msgcb; }
int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pMsg) { int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg) {
PutToQueueFp fp = pMsgCb->queueFps[qtype]; PutToQueueFp fp = msgcb->queueFps[qtype];
return (*fp)(pMsgCb->mgmt, pMsg); return (*fp)(msgcb->mgmt, pMsg);
} }
int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype) { int32_t tmsgGetQueueSize(const SMsgCb* msgcb, int32_t vgId, EQueueType qtype) {
GetQueueSizeFp fp = pMsgCb->qsizeFp; GetQueueSizeFp fp = msgcb->qsizeFp;
return (*fp)(pMsgCb->mgmt, vgId, qtype); return (*fp)(msgcb->mgmt, vgId, qtype);
} }
int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg) { int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg) {
SendReqFp fp = tsDefaultMsgCb.sendReqFp; SendReqFp fp = defaultMsgCb.sendReqFp;
return (*fp)(epSet, pMsg); return (*fp)(epSet, pMsg);
} }
void tmsgSendRsp(SRpcMsg* pMsg) { void tmsgSendRsp(SRpcMsg* pMsg) {
SendRspFp fp = tsDefaultMsgCb.sendRspFp; SendRspFp fp = defaultMsgCb.sendRspFp;
return (*fp)(pMsg); return (*fp)(pMsg);
} }
void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet) { void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet) {
SendRedirectRspFp fp = tsDefaultMsgCb.sendRedirectRspFp; SendRedirectRspFp fp = defaultMsgCb.sendRedirectRspFp;
(*fp)(pMsg, pNewEpSet); (*fp)(pMsg, pNewEpSet);
} }
void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg) { void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg) {
RegisterBrokenLinkArgFp fp = tsDefaultMsgCb.registerBrokenLinkArgFp; RegisterBrokenLinkArgFp fp = defaultMsgCb.registerBrokenLinkArgFp;
(*fp)(pMsg); (*fp)(pMsg);
} }
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type) { void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type) {
ReleaseHandleFp fp = tsDefaultMsgCb.releaseHandleFp; ReleaseHandleFp fp = defaultMsgCb.releaseHandleFp;
(*fp)(pHandle, type); (*fp)(pHandle, type);
} }
void tmsgReportStartup(const char* name, const char* desc) { void tmsgReportStartup(const char* name, const char* desc) {
ReportStartup fp = tsDefaultMsgCb.reportStartupFp; ReportStartup fp = defaultMsgCb.reportStartupFp;
(*fp)(name, desc); (*fp)(name, desc);
} }
\ No newline at end of file
...@@ -38,9 +38,9 @@ static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) { ...@@ -38,9 +38,9 @@ static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) {
static inline void bmSendRsp(SRpcMsg *pMsg, int32_t code) { static inline void bmSendRsp(SRpcMsg *pMsg, int32_t code) {
SRpcMsg rsp = { SRpcMsg rsp = {
.code = code, .code = code,
.info = pMsg->info,
.pCont = pMsg->info.rsp, .pCont = pMsg->info.rsp,
.contLen = pMsg->info.rspLen, .contLen = pMsg->info.rspLen,
.info = pMsg->info,
}; };
tmsgSendRsp(&rsp); tmsgSendRsp(&rsp);
} }
...@@ -63,7 +63,7 @@ static void bmProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -63,7 +63,7 @@ static void bmProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
bmSendRsp(pMsg, code); bmSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pRpc->pCont); rpcFreeCont(pRpc->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
......
...@@ -86,7 +86,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { ...@@ -86,7 +86,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527}; SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527};
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
dTrace("send status msg to mnode, app:%p", rpcMsg.info.ahandle); dTrace("send status msg to mnode");
SEpSet epSet = {0}; SEpSet epSet = {0};
dmGetMnodeEpSet(pMgmt->pData, &epSet); dmGetMnodeEpSet(pMgmt->pData, &epSet);
...@@ -116,8 +116,7 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) { ...@@ -116,8 +116,7 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) {
SServerStatusRsp statusRsp = {0}; SServerStatusRsp statusRsp = {0};
SMonMloadInfo minfo = {0}; SMonMloadInfo minfo = {0};
dmGetMnodeLoads(pMgmt, &minfo); dmGetMnodeLoads(pMgmt, &minfo);
if (minfo.isMnode && minfo.load.syncState != TAOS_SYNC_STATE_LEADER && if (minfo.isMnode && minfo.load.syncState == TAOS_SYNC_STATE_ERROR) {
minfo.load.syncState != TAOS_SYNC_STATE_CANDIDATE) {
pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED; pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED;
snprintf(pStatus->details, sizeof(pStatus->details), "mnode sync state is %s", syncStr(minfo.load.syncState)); snprintf(pStatus->details, sizeof(pStatus->details), "mnode sync state is %s", syncStr(minfo.load.syncState));
return; return;
...@@ -127,7 +126,7 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) { ...@@ -127,7 +126,7 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) {
dmGetVnodeLoads(pMgmt, &vinfo); dmGetVnodeLoads(pMgmt, &vinfo);
for (int32_t i = 0; i < taosArrayGetSize(vinfo.pVloads); ++i) { for (int32_t i = 0; i < taosArrayGetSize(vinfo.pVloads); ++i) {
SVnodeLoad *pLoad = taosArrayGet(vinfo.pVloads, i); SVnodeLoad *pLoad = taosArrayGet(vinfo.pVloads, i);
if (pLoad->syncState != TAOS_SYNC_STATE_LEADER && pLoad->syncState != TAOS_SYNC_STATE_FOLLOWER) { if (pLoad->syncState == TAOS_SYNC_STATE_ERROR) {
pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED; pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED;
snprintf(pStatus->details, sizeof(pStatus->details), "vnode:%d sync state is %s", pLoad->vgId, snprintf(pStatus->details, sizeof(pStatus->details), "vnode:%d sync state is %s", pLoad->vgId,
syncStr(pLoad->syncState)); syncStr(pLoad->syncState));
......
...@@ -153,14 +153,14 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -153,14 +153,14 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
if (code != 0 && terrno != 0) code = terrno; if (code != 0 && terrno != 0) code = terrno;
SRpcMsg rsp = { SRpcMsg rsp = {
.code = code, .code = code,
.info = pMsg->info,
.pCont = pMsg->info.rsp, .pCont = pMsg->info.rsp,
.contLen = pMsg->info.rspLen, .contLen = pMsg->info.rspLen,
.info = pMsg->info,
}; };
rpcSendResponse(&rsp); rpcSendResponse(&rsp);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
static inline void mmSendRsp(SRpcMsg *pMsg, int32_t code) { static inline void mmSendRsp(SRpcMsg *pMsg, int32_t code) {
SRpcMsg rsp = { SRpcMsg rsp = {
.code = code, .code = code,
.info = pMsg->info,
.pCont = pMsg->info.rsp, .pCont = pMsg->info.rsp,
.contLen = pMsg->info.rspLen, .contLen = pMsg->info.rspLen,
.info = pMsg->info,
}; };
tmsgSendRsp(&rsp); tmsgSendRsp(&rsp);
} }
...@@ -29,7 +29,7 @@ static inline void mmSendRsp(SRpcMsg *pMsg, int32_t code) { ...@@ -29,7 +29,7 @@ static inline void mmSendRsp(SRpcMsg *pMsg, int32_t code) {
static void mmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { static void mmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
SMnodeMgmt *pMgmt = pInfo->ahandle; SMnodeMgmt *pMgmt = pInfo->ahandle;
int32_t code = -1; int32_t code = -1;
dTrace("msg:%p, get from mnode queue, type:%s", pMsg, TMSG_INFO(pMsg->msgType)); dTrace("msg:%p, get from mnode queue", pMsg);
switch (pMsg->msgType) { switch (pMsg->msgType) {
case TDMT_DND_ALTER_MNODE: case TDMT_DND_ALTER_MNODE:
...@@ -51,7 +51,7 @@ static void mmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -51,7 +51,7 @@ static void mmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
mmSendRsp(pMsg, code); mmSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -73,7 +73,7 @@ static void mmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -73,7 +73,7 @@ static void mmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
} }
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -84,13 +84,20 @@ static int32_t mmPutNodeMsgToWorker(SSingleWorker *pWorker, SRpcMsg *pMsg) { ...@@ -84,13 +84,20 @@ static int32_t mmPutNodeMsgToWorker(SSingleWorker *pWorker, SRpcMsg *pMsg) {
return 0; return 0;
} }
int32_t mmPutNodeMsgToWriteQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { return mmPutNodeMsgToWorker(&pMgmt->writeWorker, pMsg); } int32_t mmPutNodeMsgToWriteQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutNodeMsgToWorker(&pMgmt->writeWorker, pMsg);
}
int32_t mmPutNodeMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { return mmPutNodeMsgToWorker(&pMgmt->syncWorker, pMsg); } int32_t mmPutNodeMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutNodeMsgToWorker(&pMgmt->syncWorker, pMsg);
}
int32_t mmPutNodeMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { return mmPutNodeMsgToWorker(&pMgmt->readWorker, pMsg); } int32_t mmPutNodeMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutNodeMsgToWorker(&pMgmt->readWorker, pMsg);
}
int32_t mmPutNodeMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { return mmPutNodeMsgToWorker(&pMgmt->queryWorker, pMsg); int32_t mmPutNodeMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutNodeMsgToWorker(&pMgmt->queryWorker, pMsg);
} }
int32_t mmPutNodeMsgToMonitorQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t mmPutNodeMsgToMonitorQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...@@ -101,25 +108,25 @@ static inline int32_t mmPutRpcMsgToWorker(SSingleWorker *pWorker, SRpcMsg *pRpc) ...@@ -101,25 +108,25 @@ static inline int32_t mmPutRpcMsgToWorker(SSingleWorker *pWorker, SRpcMsg *pRpc)
SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM);
if (pMsg == NULL) return -1; if (pMsg == NULL) return -1;
dTrace("msg:%p, is created and put into worker:%s, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, create and put into worker:%s, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType));
memcpy(pMsg, pRpc, sizeof(SRpcMsg)); memcpy(pMsg, pRpc, sizeof(SRpcMsg));
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
int32_t mmPutRpcMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pRpc) { int32_t mmPutRpcMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutRpcMsgToWorker(&pMgmt->queryWorker, pRpc); return mmPutRpcMsgToWorker(&pMgmt->queryWorker, pMsg);
} }
int32_t mmPutRpcMsgToWriteQueue(SMnodeMgmt *pMgmt, SRpcMsg *pRpc) { int32_t mmPutRpcMsgToWriteQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutRpcMsgToWorker(&pMgmt->writeWorker, pRpc); return mmPutRpcMsgToWorker(&pMgmt->writeWorker, pMsg);
} }
int32_t mmPutRpcMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pRpc) { int32_t mmPutRpcMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return mmPutRpcMsgToWorker(&pMgmt->readWorker, pRpc); return mmPutRpcMsgToWorker(&pMgmt->readWorker, pMsg);
} }
int32_t mmPutMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pRpc) { return mmPutRpcMsgToWorker(&pMgmt->syncWorker, pRpc); } int32_t mmPutMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { return mmPutRpcMsgToWorker(&pMgmt->syncWorker, pMsg); }
int32_t mmStartWorker(SMnodeMgmt *pMgmt) { int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
SSingleWorkerCfg qCfg = { SSingleWorkerCfg qCfg = {
......
...@@ -44,7 +44,7 @@ static void qmProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -44,7 +44,7 @@ static void qmProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
qmSendRsp(pMsg, code); qmSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pRpc->pCont); rpcFreeCont(pRpc->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -60,7 +60,7 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -60,7 +60,7 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
qmSendRsp(pMsg, code); qmSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -76,7 +76,7 @@ static void qmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -76,7 +76,7 @@ static void qmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
qmSendRsp(pMsg, code); qmSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -105,7 +105,7 @@ static int32_t qmPutRpcMsgToWorker(SQnodeMgmt *pMgmt, SSingleWorker *pWorker, SR ...@@ -105,7 +105,7 @@ static int32_t qmPutRpcMsgToWorker(SQnodeMgmt *pMgmt, SSingleWorker *pWorker, SR
return -1; return -1;
} }
dTrace("msg:%p, is created and put into worker:%s, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, create and put into worker:%s, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType));
memcpy(pMsg, pRpc, sizeof(SRpcMsg)); memcpy(pMsg, pRpc, sizeof(SRpcMsg));
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
static inline void smSendRsp(SRpcMsg *pMsg, int32_t code) { static inline void smSendRsp(SRpcMsg *pMsg, int32_t code) {
SRpcMsg rsp = { SRpcMsg rsp = {
.code = code, .code = code,
.info = pMsg->info,
.pCont = pMsg->info.rsp, .pCont = pMsg->info.rsp,
.contLen = pMsg->info.rspLen, .contLen = pMsg->info.rspLen,
.info = pMsg->info,
}; };
tmsgSendRsp(&rsp); tmsgSendRsp(&rsp);
} }
...@@ -44,7 +44,7 @@ static void smProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -44,7 +44,7 @@ static void smProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
smSendRsp(pMsg, code); smSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pRpc->pCont); rpcFreeCont(pRpc->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -166,7 +166,7 @@ int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { ...@@ -166,7 +166,7 @@ int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return -1; return -1;
} }
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name); dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
...@@ -174,7 +174,7 @@ int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { ...@@ -174,7 +174,7 @@ int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t smPutNodeMsgToMonitorQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t smPutNodeMsgToMonitorQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SSingleWorker *pWorker = &pMgmt->monitorWorker; SSingleWorker *pWorker = &pMgmt->monitorWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name); dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
...@@ -187,7 +187,7 @@ int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { ...@@ -187,7 +187,7 @@ int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return -1; return -1;
} }
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name); dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
...@@ -195,7 +195,7 @@ int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { ...@@ -195,7 +195,7 @@ int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t smPutNodeMsgToSharedQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t smPutNodeMsgToSharedQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SSingleWorker *pWorker = &pMgmt->sharedWorker; SSingleWorker *pWorker = &pMgmt->sharedWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name); dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
......
...@@ -51,7 +51,7 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -51,7 +51,7 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
break; break;
default: default:
terrno = TSDB_CODE_MSG_NOT_PROCESSED; terrno = TSDB_CODE_MSG_NOT_PROCESSED;
dError("msg:%p, not processed in vnode-mgmt/monitor queue", pMsg); dError("msg:%p, not processed in vnode queue", pMsg);
} }
if (msgType & 1u) { if (msgType & 1u) {
...@@ -59,7 +59,7 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -59,7 +59,7 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
vmSendRsp(pMsg, code); vmSendRsp(pMsg, code);
} }
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -67,13 +67,13 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -67,13 +67,13 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
SVnodeObj *pVnode = pInfo->ahandle; SVnodeObj *pVnode = pInfo->ahandle;
dTrace("msg:%p, will be processed in vnode-query queue", pMsg); dTrace("msg:%p, get from vnode-query queue", pMsg);
int32_t code = vnodeProcessQueryMsg(pVnode->pImpl, pMsg); int32_t code = vnodeProcessQueryMsg(pVnode->pImpl, pMsg);
if (code != 0) { if (code != 0) {
if (terrno != 0) code = terrno; if (terrno != 0) code = terrno;
vmSendRsp(pMsg, code); vmSendRsp(pMsg, code);
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -82,13 +82,13 @@ static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -82,13 +82,13 @@ static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
SVnodeObj *pVnode = pInfo->ahandle; SVnodeObj *pVnode = pInfo->ahandle;
dTrace("msg:%p, will be processed in vnode-fetch queue", pMsg); dTrace("msg:%p, get from vnode-fetch queue", pMsg);
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo); int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
if (code != 0) { if (code != 0) {
if (terrno != 0) code = terrno; if (terrno != 0) code = terrno;
vmSendRsp(pMsg, code); vmSendRsp(pMsg, code);
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -96,7 +96,6 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { ...@@ -96,7 +96,6 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
SVnodeObj *pVnode = pInfo->ahandle; SVnodeObj *pVnode = pInfo->ahandle;
SRpcMsg rsp;
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SRpcMsg *)); SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SRpcMsg *));
if (pArray == NULL) { if (pArray == NULL) {
...@@ -108,7 +107,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO ...@@ -108,7 +107,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
SRpcMsg *pMsg = NULL; SRpcMsg *pMsg = NULL;
if (taosGetQitem(qall, (void **)&pMsg) == 0) continue; if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
dTrace("msg:%p, will be processed in vnode-write queue", pMsg); dTrace("msg:%p, get from vnode-write queue", pMsg);
if (taosArrayPush(pArray, &pMsg) == NULL) { if (taosArrayPush(pArray, &pMsg) == NULL) {
dTrace("msg:%p, failed to process since %s", pMsg, terrstr()); dTrace("msg:%p, failed to process since %s", pMsg, terrstr());
vmSendRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY); vmSendRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY);
...@@ -116,21 +115,12 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO ...@@ -116,21 +115,12 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
} }
for (int i = 0; i < taosArrayGetSize(pArray); i++) { for (int i = 0; i < taosArrayGetSize(pArray); i++) {
SRpcMsg *pMsg; SRpcMsg *pMsg = *(SRpcMsg **)taosArrayGet(pArray, i);
SRpcMsg *pRpc; SRpcMsg rsp = {.info = pMsg->info, .pCont = NULL, .contLen = 0};
pMsg = *(SRpcMsg **)taosArrayGet(pArray, i);
pRpc = pMsg;
rsp.info = pRpc->info;
rsp.pCont = NULL;
rsp.contLen = 0;
int32_t ret = syncPropose(vnodeGetSyncHandle(pVnode->pImpl), pRpc, false); int32_t ret = syncPropose(vnodeGetSyncHandle(pVnode->pImpl), pMsg, false);
if (ret == TAOS_SYNC_PROPOSE_NOT_LEADER) { if (ret == TAOS_SYNC_PROPOSE_NOT_LEADER) {
// rsp.code = TSDB_CODE_SYN_NOT_LEADER; dTrace("msg:%p, is redirect since not leader, vgId:%d ", pMsg, pVnode->vgId);
// tmsgSendRsp(&rsp);
dTrace("syncPropose not leader redirect, vgId:%d ", syncGetVgId(vnodeGetSyncHandle(pVnode->pImpl)));
rsp.code = TSDB_CODE_RPC_REDIRECT; rsp.code = TSDB_CODE_RPC_REDIRECT;
SEpSet newEpSet; SEpSet newEpSet;
syncGetEpSet(vnodeGetSyncHandle(pVnode->pImpl), &newEpSet); syncGetEpSet(vnodeGetSyncHandle(pVnode->pImpl), &newEpSet);
...@@ -181,7 +171,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO ...@@ -181,7 +171,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
// apply data into tsdb // apply data into tsdb
if (vnodeProcessWriteReq(pVnode->pImpl, &originalRpcMsg, pSyncApplyMsg->fsmMeta.index, &rsp) < 0) { if (vnodeProcessWriteReq(pVnode->pImpl, &originalRpcMsg, pSyncApplyMsg->fsmMeta.index, &rsp) < 0) {
rsp.code = terrno; rsp.code = terrno;
dTrace("vnodeProcessWriteReq error, code:%d", terrno); dTrace("msg:%p, process write error since %s", pMsg, terrstr());
} }
syncApplyMsgDestroy(pSyncApplyMsg); syncApplyMsgDestroy(pSyncApplyMsg);
...@@ -215,7 +205,7 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf ...@@ -215,7 +205,7 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
rsp.code = terrno; rsp.code = terrno;
rsp.info = pMsg->info; rsp.info = pMsg->info;
dTrace("vmProcessSyncQueue error, code:%d", terrno); dTrace("msg:%p, process sync queue error since code:%s", pMsg, terrstr());
tmsgSendRsp(&rsp); tmsgSendRsp(&rsp);
} }
} }
...@@ -232,13 +222,13 @@ static void vmProcessMergeQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO ...@@ -232,13 +222,13 @@ static void vmProcessMergeQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
for (int32_t i = 0; i < numOfMsgs; ++i) { for (int32_t i = 0; i < numOfMsgs; ++i) {
taosGetQitem(qall, (void **)&pMsg); taosGetQitem(qall, (void **)&pMsg);
dTrace("msg:%p, will be processed in vnode-merge queue", pMsg); dTrace("msg:%p, get from vnode-merge queue", pMsg);
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo); int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
if (code != 0) { if (code != 0) {
if (terrno != 0) code = terrno; if (terrno != 0) code = terrno;
vmSendRsp(pMsg, code); vmSendRsp(pMsg, code);
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code)); dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
...@@ -255,29 +245,29 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType ...@@ -255,29 +245,29 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId); SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId);
if (pVnode == NULL) { if (pVnode == NULL) {
dError("vgId:%d, failed to write msg:%p to vnode-queue since %s", pHead->vgId, pMsg, terrstr()); dError("vgId:%d, failed to put msg:%p into vnode-queue since %s", pHead->vgId, pMsg, terrstr());
return terrno != 0 ? terrno : -1; return terrno != 0 ? terrno : -1;
} }
switch (qtype) { switch (qtype) {
case QUERY_QUEUE: case QUERY_QUEUE:
dTrace("msg:%p, type:%s will be written into vnode-query queue", pMsg, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, put into vnode-query worker, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pQueryQ, pMsg); taosWriteQitem(pVnode->pQueryQ, pMsg);
break; break;
case FETCH_QUEUE: case FETCH_QUEUE:
dTrace("msg:%p, type:%s will be written into vnode-fetch queue", pMsg, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, put into vnode-fetch worker, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pFetchQ, pMsg); taosWriteQitem(pVnode->pFetchQ, pMsg);
break; break;
case WRITE_QUEUE: case WRITE_QUEUE:
dTrace("msg:%p, type:%s will be written into vnode-write queue", pMsg, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, put into vnode-write worker, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pWriteQ, pMsg); taosWriteQitem(pVnode->pWriteQ, pMsg);
break; break;
case SYNC_QUEUE: case SYNC_QUEUE:
dTrace("msg:%p, type:%s will be written into vnode-sync queue", pMsg, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, put into vnode-sync worker, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pSyncQ, pMsg); taosWriteQitem(pVnode->pSyncQ, pMsg);
break; break;
case MERGE_QUEUE: case MERGE_QUEUE:
dTrace("msg:%p, type:%s will be written into vnode-merge queue", pMsg, TMSG_INFO(pRpc->msgType)); dTrace("msg:%p, put into vnode-merge worker, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pMergeQ, pMsg); taosWriteQitem(pVnode->pMergeQ, pMsg);
break; break;
default: default:
...@@ -312,7 +302,7 @@ int32_t vmPutNodeMsgToMergeQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { ...@@ -312,7 +302,7 @@ int32_t vmPutNodeMsgToMergeQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t vmPutNodeMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t vmPutNodeMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SSingleWorker *pWorker = &pMgmt->mgmtWorker; SSingleWorker *pWorker = &pMgmt->mgmtWorker;
dTrace("msg:%p, will be put into vnode-mgmt queue, worker:%s", pMsg, pWorker->name); dTrace("msg:%p, put into vnode-mgmt worker, type:%s", pMsg, TMSG_INFO(pMsg->msgType));
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
...@@ -320,7 +310,7 @@ int32_t vmPutNodeMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { ...@@ -320,7 +310,7 @@ int32_t vmPutNodeMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t vmPutNodeMsgToMonitorQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t vmPutNodeMsgToMonitorQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SSingleWorker *pWorker = &pMgmt->monitorWorker; SSingleWorker *pWorker = &pMgmt->monitorWorker;
dTrace("msg:%p, will be put into vnode-monitor queue, worker:%s", pMsg, pWorker->name); dTrace("msg:%p, put into vnode-monitor worker, type:%s", pMsg, TMSG_INFO(pMsg->msgType));
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
return 0; return 0;
} }
...@@ -335,32 +325,30 @@ static int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pRpc, EQueueType q ...@@ -335,32 +325,30 @@ static int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pRpc, EQueueType q
int32_t code = 0; int32_t code = 0;
if (pMsg != NULL) { if (pMsg != NULL) {
dTrace("msg:%p, is created, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
memcpy(pMsg, pRpc, sizeof(SRpcMsg)); memcpy(pMsg, pRpc, sizeof(SRpcMsg));
// if (pMsg->handle != NULL) assert(pMsg->refId != 0);
switch (qtype) { switch (qtype) {
case WRITE_QUEUE: case WRITE_QUEUE:
dTrace("msg:%p, will be put into vnode-write queue", pMsg); dTrace("msg:%p, create and put into vnode-write worker, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pWriteQ, pMsg); taosWriteQitem(pVnode->pWriteQ, pMsg);
break; break;
case QUERY_QUEUE: case QUERY_QUEUE:
dTrace("msg:%p, will be put into vnode-query queue", pMsg); dTrace("msg:%p, create and put into vnode-query queue, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pQueryQ, pMsg); taosWriteQitem(pVnode->pQueryQ, pMsg);
break; break;
case FETCH_QUEUE: case FETCH_QUEUE:
dTrace("msg:%p, will be put into vnode-fetch queue", pMsg); dTrace("msg:%p, create and put into vnode-fetch queue, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pFetchQ, pMsg); taosWriteQitem(pVnode->pFetchQ, pMsg);
break; break;
case APPLY_QUEUE: case APPLY_QUEUE:
dTrace("msg:%p, will be put into vnode-apply queue", pMsg); dTrace("msg:%p, create and put into vnode-apply queue, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pApplyQ, pMsg); taosWriteQitem(pVnode->pApplyQ, pMsg);
break; break;
case MERGE_QUEUE: case MERGE_QUEUE:
dTrace("msg:%p, will be put into vnode-merge queue", pMsg); dTrace("msg:%p, create and put into vnode-merge queue, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pMergeQ, pMsg); taosWriteQitem(pVnode->pMergeQ, pMsg);
break; break;
case SYNC_QUEUE: case SYNC_QUEUE:
dTrace("msg:%p, will be put into vnode-sync queue", pMsg); dTrace("msg:%p, create and put into vnode-sync queue, type:%s", pMsg, TMSG_INFO(pRpc->msgType));
taosWriteQitem(pVnode->pSyncQ, pMsg); taosWriteQitem(pVnode->pSyncQ, pMsg);
break; break;
default: default:
......
...@@ -274,25 +274,24 @@ static void dmGetServerStartupStatus(SDnode *pDnode, SServerStatusRsp *pStatus) ...@@ -274,25 +274,24 @@ static void dmGetServerStartupStatus(SDnode *pDnode, SServerStatusRsp *pStatus)
} }
} }
void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pReq) { void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pMsg) {
dDebug("net test req is received"); dDebug("msg:%p, net test req will be processed", pMsg);
SRpcMsg rsp = {.code = 0, .info = pReq->info}; SRpcMsg rsp = {.code = 0, .info = pMsg->info};
rsp.pCont = rpcMallocCont(pReq->contLen); rsp.pCont = rpcMallocCont(pMsg->contLen);
if (rsp.pCont == NULL) { if (rsp.pCont == NULL) {
rsp.code = TSDB_CODE_OUT_OF_MEMORY; rsp.code = TSDB_CODE_OUT_OF_MEMORY;
} else { } else {
rsp.contLen = pReq->contLen; rsp.contLen = pMsg->contLen;
} }
rpcSendResponse(&rsp); rpcSendResponse(&rsp);
} }
void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pReq) { void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg) {
dDebug("server startup status req is received"); dDebug("msg:%p, server startup status req will be processed", pMsg);
SServerStatusRsp statusRsp = {0}; SServerStatusRsp statusRsp = {0};
dmGetServerStartupStatus(pDnode, &statusRsp); dmGetServerStartupStatus(pDnode, &statusRsp);
SRpcMsg rspMsg = {.info = pReq->info}; SRpcMsg rspMsg = {.info = pMsg->info};
int32_t rspLen = tSerializeSServerStatusRsp(NULL, 0, &statusRsp); int32_t rspLen = tSerializeSServerStatusRsp(NULL, 0, &statusRsp);
if (rspLen < 0) { if (rspLen < 0) {
rspMsg.code = TSDB_CODE_OUT_OF_MEMORY; rspMsg.code = TSDB_CODE_OUT_OF_MEMORY;
......
...@@ -37,6 +37,7 @@ static int32_t dmCreateShm(SMgmtWrapper *pWrapper) { ...@@ -37,6 +37,7 @@ static int32_t dmCreateShm(SMgmtWrapper *pWrapper) {
dError("node:%s, failed to create shm size:%d since %s", pWrapper->name, shmsize, terrstr()); dError("node:%s, failed to create shm size:%d since %s", pWrapper->name, shmsize, terrstr());
return -1; return -1;
} }
dInfo("node:%s, shm:%d is created, size:%d", pWrapper->name, pWrapper->proc.shm.id, shmsize); dInfo("node:%s, shm:%d is created, size:%d", pWrapper->name, pWrapper->proc.shm.id, shmsize);
return 0; return 0;
} }
...@@ -60,7 +61,7 @@ static int32_t dmNewProc(SMgmtWrapper *pWrapper, EDndNodeType ntype) { ...@@ -60,7 +61,7 @@ static int32_t dmNewProc(SMgmtWrapper *pWrapper, EDndNodeType ntype) {
taosIgnSignal(SIGCHLD); taosIgnSignal(SIGCHLD);
pWrapper->proc.pid = pid; pWrapper->proc.pid = pid;
dInfo("node:%s, continue running in new process:%d", pWrapper->name, pid); dInfo("node:%s, continue running in new pid:%d", pWrapper->name, pid);
return 0; return 0;
} }
...@@ -77,7 +78,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) { ...@@ -77,7 +78,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper); SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper);
if (pWrapper->ntype == DNODE || InChildProc(pWrapper)) { if (pWrapper->ntype == DNODE || InChildProc(pWrapper)) {
tmsgSetDefaultMsgCb(&input.msgCb); tmsgSetDefault(&input.msgCb);
} }
if (OnlyInSingleProc(pWrapper)) { if (OnlyInSingleProc(pWrapper)) {
...@@ -177,11 +178,11 @@ void dmCloseNode(SMgmtWrapper *pWrapper) { ...@@ -177,11 +178,11 @@ void dmCloseNode(SMgmtWrapper *pWrapper) {
if (OnlyInParentProc(pWrapper)) { if (OnlyInParentProc(pWrapper)) {
int32_t pid = pWrapper->proc.pid; int32_t pid = pWrapper->proc.pid;
if (pid > 0 && taosProcExist(pid)) { if (pid > 0 && taosProcExist(pid)) {
dInfo("node:%s, send kill signal to the child process:%d", pWrapper->name, pid); dInfo("node:%s, send kill signal to the child pid:%d", pWrapper->name, pid);
taosKillProc(pid); taosKillProc(pid);
dInfo("node:%s, wait for child process:%d to stop", pWrapper->name, pid); dInfo("node:%s, wait for child pid:%d to stop", pWrapper->name, pid);
taosWaitProc(pid); taosWaitProc(pid);
dInfo("node:%s, child process:%d is stopped", pWrapper->name, pid); dInfo("node:%s, child pid:%d is stopped", pWrapper->name, pid);
} }
} }
...@@ -255,7 +256,7 @@ static void dmWatchNodes(SDnode *pDnode) { ...@@ -255,7 +256,7 @@ static void dmWatchNodes(SDnode *pDnode) {
if (!OnlyInParentProc(pWrapper)) continue; if (!OnlyInParentProc(pWrapper)) continue;
if (proc->pid <= 0 || !taosProcExist(proc->pid)) { if (proc->pid <= 0 || !taosProcExist(proc->pid)) {
dError("node:%s, process:%d is killed and needs to restart", pWrapper->name, proc->pid); dError("node:%s, pid:%d is killed and needs to restart", pWrapper->name, proc->pid);
dmCloseProcRpcHandles(&pWrapper->proc); dmCloseProcRpcHandles(&pWrapper->proc);
dmNewProc(pWrapper, ntype); dmNewProc(pWrapper, ntype);
} }
......
...@@ -162,7 +162,7 @@ static inline int32_t dmPushToProcQueue(SProc *proc, SProcQueue *queue, SRpcMsg ...@@ -162,7 +162,7 @@ static inline int32_t dmPushToProcQueue(SProc *proc, SProcQueue *queue, SRpcMsg
return 0; return 0;
} }
static int32_t dmPopFromProcQueue(SProcQueue *queue, SRpcMsg **ppMsg, EProcFuncType *pFuncType) { static inline int32_t dmPopFromProcQueue(SProcQueue *queue, SRpcMsg **ppMsg, EProcFuncType *pFuncType) {
tsem_wait(&queue->sem); tsem_wait(&queue->sem);
taosThreadMutexLock(&queue->mutex); taosThreadMutexLock(&queue->mutex);
...@@ -412,7 +412,7 @@ void dmCleanupProc(struct SMgmtWrapper *pWrapper) { ...@@ -412,7 +412,7 @@ void dmCleanupProc(struct SMgmtWrapper *pWrapper) {
SProc *proc = &pWrapper->proc; SProc *proc = &pWrapper->proc;
if (proc->name == NULL) return; if (proc->name == NULL) return;
dDebug("node:%s, start to clean up proc", pWrapper->name); dDebug("node:%s, start to cleanup proc", pWrapper->name);
dmStopProc(proc); dmStopProc(proc);
dmCleanupProcQueue(proc->cqueue); dmCleanupProcQueue(proc->cqueue);
dmCleanupProcQueue(proc->pqueue); dmCleanupProcQueue(proc->pqueue);
...@@ -433,7 +433,7 @@ void dmCloseProcRpcHandles(SProc *proc) { ...@@ -433,7 +433,7 @@ void dmCloseProcRpcHandles(SProc *proc) {
SRpcHandleInfo *pInfo = taosHashIterate(proc->hash, NULL); SRpcHandleInfo *pInfo = taosHashIterate(proc->hash, NULL);
while (pInfo != NULL) { while (pInfo != NULL) {
dError("node:%s, the child process dies and send an offline rsp to handle:%p", proc->name, pInfo->handle); dError("node:%s, the child process dies and send an offline rsp to handle:%p", proc->name, pInfo->handle);
SRpcMsg rpcMsg = {.info = *pInfo, .code = TSDB_CODE_NODE_OFFLINE}; SRpcMsg rpcMsg = {.code = TSDB_CODE_NODE_OFFLINE, .info = *pInfo};
rpcSendResponse(&rpcMsg); rpcSendResponse(&rpcMsg);
pInfo = taosHashIterate(proc->hash, pInfo); pInfo = taosHashIterate(proc->hash, pInfo);
} }
......
...@@ -43,8 +43,8 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) { ...@@ -43,8 +43,8 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
return -1; return -1;
} }
dTrace("msg:%p, will be processed by %s", pMsg, pWrapper->name);
pMsg->info.wrapper = pWrapper; pMsg->info.wrapper = pWrapper;
dTrace("msg:%p, will be processed by %s, handle:%p", pMsg, pWrapper->name, pMsg->info.handle);
return (*msgFp)(pWrapper->pMgmt, pMsg); return (*msgFp)(pWrapper->pMgmt, pMsg);
} }
...@@ -56,8 +56,8 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { ...@@ -56,8 +56,8 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
SDnodeHandle *pHandle = &pTrans->msgHandles[TMSG_INDEX(pRpc->msgType)]; SDnodeHandle *pHandle = &pTrans->msgHandles[TMSG_INDEX(pRpc->msgType)];
SMgmtWrapper *pWrapper = NULL; SMgmtWrapper *pWrapper = NULL;
dTrace("msg:%s is received, handle:%p cont:%p len:%d code:0x%04x app:%p refId:%" PRId64, TMSG_INFO(pRpc->msgType), dTrace("msg:%s is received, handle:%p len:%d code:0x%x app:%p refId:%" PRId64, TMSG_INFO(pRpc->msgType),
pRpc->info.handle, pRpc->pCont, pRpc->contLen, pRpc->code, pRpc->info.ahandle, pRpc->info.refId); pRpc->info.handle, pRpc->contLen, pRpc->code, pRpc->info.ahandle, pRpc->info.refId);
pRpc->info.noResp = 0; pRpc->info.noResp = 0;
pRpc->info.persistHandle = 0; pRpc->info.persistHandle = 0;
pRpc->info.wrapper = NULL; pRpc->info.wrapper = NULL;
...@@ -344,66 +344,6 @@ void dmCleanupClient(SDnode *pDnode) { ...@@ -344,66 +344,6 @@ void dmCleanupClient(SDnode *pDnode) {
} }
} }
static inline int32_t dmGetHideUserAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
int32_t code = 0;
char pass[TSDB_PASSWORD_LEN + 1] = {0};
if (strcmp(user, INTERNAL_USER) == 0) {
taosEncryptPass_c((uint8_t *)(INTERNAL_SECRET), strlen(INTERNAL_SECRET), pass);
} else if (strcmp(user, TSDB_NETTEST_USER) == 0) {
taosEncryptPass_c((uint8_t *)(TSDB_NETTEST_USER), strlen(TSDB_NETTEST_USER), pass);
} else {
code = -1;
}
if (code == 0) {
memcpy(secret, pass, TSDB_PASSWORD_LEN);
*spi = 1;
*encrypt = 0;
*ckey = 0;
}
return code;
}
static inline int32_t dmRetrieveUserAuthInfo(SDnode *pDnode, char *user, char *spi, char *encrypt, char *secret,
char *ckey) {
if (dmGetHideUserAuth(user, spi, encrypt, secret, ckey) == 0) {
dTrace("user:%s, get auth from mnode, spi:%d encrypt:%d", user, *spi, *encrypt);
return 0;
}
SAuthReq authReq = {0};
tstrncpy(authReq.user, user, TSDB_USER_LEN);
int32_t contLen = tSerializeSAuthReq(NULL, 0, &authReq);
void *pReq = rpcMallocCont(contLen);
tSerializeSAuthReq(pReq, contLen, &authReq);
SRpcMsg rpcMsg = {.pCont = pReq, .contLen = contLen, .msgType = TDMT_MND_AUTH, .info.ahandle = (void *)9528};
SRpcMsg rpcRsp = {0};
SEpSet epSet = {0};
dTrace("user:%s, send user auth req to other mnodes, spi:%d encrypt:%d", user, authReq.spi, authReq.encrypt);
dmGetMnodeEpSet(&pDnode->data, &epSet);
dmSendRecv(&epSet, &rpcMsg, &rpcRsp);
if (rpcRsp.code != 0) {
terrno = rpcRsp.code;
dError("user:%s, failed to get user auth from other mnodes since %s", user, terrstr());
} else {
SAuthRsp authRsp = {0};
tDeserializeSAuthReq(rpcRsp.pCont, rpcRsp.contLen, &authRsp);
memcpy(secret, authRsp.secret, TSDB_PASSWORD_LEN);
memcpy(ckey, authRsp.ckey, TSDB_PASSWORD_LEN);
*spi = authRsp.spi;
*encrypt = authRsp.encrypt;
dTrace("user:%s, success to get user auth from other mnodes, spi:%d encrypt:%d", user, authRsp.spi,
authRsp.encrypt);
}
rpcFreeCont(rpcRsp.pCont);
return rpcRsp.code;
}
int32_t dmInitServer(SDnode *pDnode) { int32_t dmInitServer(SDnode *pDnode) {
SDnodeTrans *pTrans = &pDnode->trans; SDnodeTrans *pTrans = &pDnode->trans;
...@@ -416,7 +356,6 @@ int32_t dmInitServer(SDnode *pDnode) { ...@@ -416,7 +356,6 @@ int32_t dmInitServer(SDnode *pDnode) {
rpcInit.sessions = tsMaxShellConns; rpcInit.sessions = tsMaxShellConns;
rpcInit.connType = TAOS_CONN_SERVER; rpcInit.connType = TAOS_CONN_SERVER;
rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.idleTime = tsShellActivityTimer * 1000;
rpcInit.afp = (RpcAfp)dmRetrieveUserAuthInfo;
rpcInit.parent = pDnode; rpcInit.parent = pDnode;
pTrans->serverRpc = rpcOpen(&rpcInit); pTrans->serverRpc = rpcOpen(&rpcInit);
......
...@@ -37,7 +37,7 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray ...@@ -37,7 +37,7 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray
void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
void *mndBuildAlterVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildAlterVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -261,8 +261,7 @@ void mndReleaseDb(SMnode *pMnode, SDbObj *pDb) { ...@@ -261,8 +261,7 @@ void mndReleaseDb(SMnode *pMnode, SDbObj *pDb) {
sdbRelease(pSdb, pDb); sdbRelease(pSdb, pDb);
} }
static int32_t mndAddCreateVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, static int32_t mndAddCreateVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid) {
bool isRedo) {
STransAction action = {0}; STransAction action = {0};
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgid->dnodeId); SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgid->dnodeId);
...@@ -279,49 +278,30 @@ static int32_t mndAddCreateVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *p ...@@ -279,49 +278,30 @@ static int32_t mndAddCreateVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *p
action.msgType = TDMT_DND_CREATE_VNODE; action.msgType = TDMT_DND_CREATE_VNODE;
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED; action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
if (isRedo) {
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq); taosMemoryFree(pReq);
return -1; return -1;
} }
} else {
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq);
return -1;
}
}
return 0; return 0;
} }
static int32_t mndAddAlterVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, static int32_t mndAddAlterVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup) {
bool isRedo) {
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgid->dnodeId);
if (pDnode == NULL) return -1;
action.epSet = mndGetDnodeEpset(pDnode);
mndReleaseDnode(pMnode, pDnode);
int32_t contLen = 0; int32_t contLen = 0;
void *pReq = mndBuildAlterVnodeReq(pMnode, pDnode, pDb, pVgroup, &contLen); void *pReq = mndBuildAlterVnodeReq(pMnode, pDb, pVgroup, &contLen);
if (pReq == NULL) return -1; if (pReq == NULL) return -1;
action.pCont = pReq; action.pCont = pReq;
action.contLen = contLen; action.contLen = contLen;
action.msgType = TDMT_VND_ALTER_VNODE; action.msgType = TDMT_VND_ALTER_VNODE;
if (isRedo) {
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq); taosMemoryFree(pReq);
return -1; return -1;
} }
} else {
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq);
return -1;
}
}
return 0; return 0;
} }
...@@ -487,7 +467,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -487,7 +467,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
for (int32_t vn = 0; vn < pVgroup->replica; ++vn) { for (int32_t vn = 0; vn < pVgroup->replica; ++vn) {
SVnodeGid *pVgid = pVgroup->vnodeGid + vn; SVnodeGid *pVgid = pVgroup->vnodeGid + vn;
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, pVgroup, pVgid, true) != 0) { if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, pVgroup, pVgid) != 0) {
return -1; return -1;
} }
} }
...@@ -726,12 +706,9 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p ...@@ -726,12 +706,9 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
static int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SArray *pArray) { static int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SArray *pArray) {
if (pVgroup->replica <= 0 || pVgroup->replica == pDb->cfg.replications) { if (pVgroup->replica <= 0 || pVgroup->replica == pDb->cfg.replications) {
for (int32_t vn = 0; vn < pVgroup->replica; ++vn) { if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, pVgroup) != 0) {
SVnodeGid *pVgid = pVgroup->vnodeGid + vn;
if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, pVgroup, pVgid, true) != 0) {
return -1; return -1;
} }
}
} else { } else {
SVgObj newVgroup = {0}; SVgObj newVgroup = {0};
memcpy(&newVgroup, pVgroup, sizeof(SVgObj)); memcpy(&newVgroup, pVgroup, sizeof(SVgObj));
...@@ -744,9 +721,9 @@ static int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -744,9 +721,9 @@ static int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
return -1; return -1;
} }
newVgroup.replica = pDb->cfg.replications; newVgroup.replica = pDb->cfg.replications;
if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, &newVgroup, &newVgroup.vnodeGid[0], true) != 0) return -1; if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, &newVgroup) != 0) return -1;
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVgroup, &newVgroup.vnodeGid[1], true) != 0) return -1; if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1;
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVgroup, &newVgroup.vnodeGid[2], true) != 0) return -1; if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVgroup, &newVgroup.vnodeGid[2]) != 0) return -1;
} else { } else {
mInfo("db:%s, vgId:%d, will remove 2 vnodes", pVgroup->dbName, pVgroup->vgId); mInfo("db:%s, vgId:%d, will remove 2 vnodes", pVgroup->dbName, pVgroup->vgId);
...@@ -757,7 +734,7 @@ static int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -757,7 +734,7 @@ static int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
return -1; return -1;
} }
newVgroup.replica = pDb->cfg.replications; newVgroup.replica = pDb->cfg.replications;
if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, &newVgroup, &newVgroup.vnodeGid[0], true) != 0) return -1; if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, &newVgroup) != 0) return -1;
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVgroup, &del1, true) != 0) return -1; if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVgroup, &del1, true) != 0) return -1;
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVgroup, &del2, true) != 0) return -1; if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVgroup, &del2, true) != 0) return -1;
} }
......
...@@ -197,8 +197,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { ...@@ -197,8 +197,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
goto CONN_OVER; goto CONN_OVER;
} }
if (0 != strncmp(connReq.passwd, pUser->pass, TSDB_PASSWORD_LEN - 1)) { if (0 != strncmp(connReq.passwd, pUser->pass, TSDB_PASSWORD_LEN - 1)) {
mError("user:%s, failed to auth while acquire user, input:%s saved:%s", pReq->conn.user, connReq.passwd, mError("user:%s, failed to auth while acquire user, input:%s", pReq->conn.user, connReq.passwd);
pUser->pass);
code = TSDB_CODE_RPC_AUTH_FAILURE; code = TSDB_CODE_RPC_AUTH_FAILURE;
goto CONN_OVER; goto CONN_OVER;
} }
......
...@@ -206,7 +206,7 @@ static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) { ...@@ -206,7 +206,7 @@ static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput) { static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput) {
int32_t totalVgNum = pOutput->pSub->vgNum; int32_t totalVgNum = pOutput->pSub->vgNum;
mInfo("mq rebalance subscription: %s, vgNum: %d", pOutput->pSub->key, pOutput->pSub->vgNum); mInfo("mq rebalance: subscription: %s, vgNum: %d", pOutput->pSub->key, pOutput->pSub->vgNum);
// 1. build temporary hash(vgId -> SMqRebOutputVg) to store modified vg // 1. build temporary hash(vgId -> SMqRebOutputVg) to store modified vg
SHashObj *pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); SHashObj *pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
...@@ -231,6 +231,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -231,6 +231,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp, .pVgEp = pVgEp,
}; };
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg));
mInfo("mq rebalance: remove vg %d from consumer %ld", pVgEp->vgId, consumerId);
} }
taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t));
// put into removed // put into removed
...@@ -250,6 +251,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -250,6 +251,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp, .pVgEp = pVgEp,
}; };
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &rebOutput, sizeof(SMqRebOutputVg)); taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &rebOutput, sizeof(SMqRebOutputVg));
mInfo("mq rebalance: remove vg %d from unassigned", pVgEp->vgId);
} }
} }
...@@ -263,6 +265,8 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -263,6 +265,8 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
minVgCnt = totalVgNum / afterRebConsumerNum; minVgCnt = totalVgNum / afterRebConsumerNum;
imbConsumerNum = totalVgNum % afterRebConsumerNum; imbConsumerNum = totalVgNum % afterRebConsumerNum;
} }
mInfo("mq rebalance: %d consumer after rebalance, at least %d vg each, %d consumer has more vg", afterRebConsumerNum,
minVgCnt, imbConsumerNum);
// 4. first scan: remove consumer more than wanted, put to remove hash // 4. first scan: remove consumer more than wanted, put to remove hash
int32_t imbCnt = 0; int32_t imbCnt = 0;
...@@ -290,6 +294,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -290,6 +294,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp, .pVgEp = pVgEp,
}; };
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg));
mInfo("mq rebalance: remove vg %d from consumer %ld (first scan)", pVgEp->vgId, pConsumerEp->consumerId);
} }
imbCnt++; imbCnt++;
} }
...@@ -303,6 +308,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -303,6 +308,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp, .pVgEp = pVgEp,
}; };
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg));
mInfo("mq rebalance: remove vg %d from consumer %ld (first scan)", pVgEp->vgId, pConsumerEp->consumerId);
} }
} }
} }
...@@ -319,6 +325,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -319,6 +325,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
newConsumerEp.vgs = taosArrayInit(0, sizeof(void *)); newConsumerEp.vgs = taosArrayInit(0, sizeof(void *));
taosHashPut(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t), &newConsumerEp, sizeof(SMqConsumerEp)); taosHashPut(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t), &newConsumerEp, sizeof(SMqConsumerEp));
taosArrayPush(pOutput->newConsumers, &consumerId); taosArrayPush(pOutput->newConsumers, &consumerId);
mInfo("mq rebalance: add new consumer %ld", consumerId);
} }
} }
...@@ -343,6 +350,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -343,6 +350,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp);
pRebVg->newConsumerId = pConsumerEp->consumerId; pRebVg->newConsumerId = pConsumerEp->consumerId;
taosArrayPush(pOutput->rebVgs, pRebVg); taosArrayPush(pOutput->rebVgs, pRebVg);
mInfo("mq rebalance: add vg %d to consumer %ld (second scan)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId);
} }
} }
...@@ -360,6 +368,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -360,6 +368,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp);
pRebVg->newConsumerId = pConsumerEp->consumerId; pRebVg->newConsumerId = pConsumerEp->consumerId;
taosArrayPush(pOutput->rebVgs, pRebVg); taosArrayPush(pOutput->rebVgs, pRebVg);
mInfo("mq rebalance: add vg %d to consumer %ld (second scan)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId);
} }
} else { } else {
// if all consumer is removed, put all vg into unassigned // if all consumer is removed, put all vg into unassigned
...@@ -372,6 +381,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR ...@@ -372,6 +381,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
ASSERT(pRebOutput->newConsumerId == -1); ASSERT(pRebOutput->newConsumerId == -1);
taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp); taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp);
taosArrayPush(pOutput->rebVgs, pRebOutput); taosArrayPush(pOutput->rebVgs, pRebOutput);
mInfo("mq rebalance: unassign vg %d (second scan)", pRebOutput->pVgEp->vgId);
} }
} }
......
...@@ -842,13 +842,12 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) { ...@@ -842,13 +842,12 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
} }
taosMemoryFree(pTrans->rpcRsp); taosMemoryFree(pTrans->rpcRsp);
mDebug("trans:%d, send rsp, code:0x%04x stage:%d app:%p", pTrans->id, code & 0xFFFF, pTrans->stage, mDebug("trans:%d, send rsp, code:0x%x stage:%d app:%p", pTrans->id, code, pTrans->stage, pTrans->rpcInfo.ahandle);
pTrans->rpcInfo.ahandle);
SRpcMsg rspMsg = { SRpcMsg rspMsg = {
.info = pTrans->rpcInfo,
.code = code, .code = code,
.pCont = rpcCont, .pCont = rpcCont,
.contLen = pTrans->rpcRspLen, .contLen = pTrans->rpcRspLen,
.info = pTrans->rpcInfo,
}; };
tmsgSendRsp(&rspMsg); tmsgSendRsp(&rspMsg);
pTrans->rpcInfo.handle = NULL; pTrans->rpcInfo.handle = NULL;
...@@ -899,7 +898,7 @@ void mndTransProcessRsp(SRpcMsg *pRsp) { ...@@ -899,7 +898,7 @@ void mndTransProcessRsp(SRpcMsg *pRsp) {
} }
} }
mDebug("trans:%d, action:%d response is received, code:0x%04x, accept:0x%04x", transId, action, pRsp->code, mDebug("trans:%d, action:%d response is received, code:0x%x, accept:0x%04x", transId, action, pRsp->code,
pAction->acceptableCode); pAction->acceptableCode);
mndTransExecute(pMnode, pTrans); mndTransExecute(pMnode, pTrans);
...@@ -986,7 +985,8 @@ static int32_t mndTransSendActionMsg(SMnode *pMnode, STrans *pTrans, SArray *pAr ...@@ -986,7 +985,8 @@ static int32_t mndTransSendActionMsg(SMnode *pMnode, STrans *pTrans, SArray *pAr
memcpy(rpcMsg.pCont, pAction->pCont, pAction->contLen); memcpy(rpcMsg.pCont, pAction->pCont, pAction->contLen);
if (tmsgSendReq(&pAction->epSet, &rpcMsg) == 0) { if (tmsgSendReq(&pAction->epSet, &rpcMsg) == 0) {
mDebug("trans:%d, action:%d is sent", pTrans->id, action); mDebug("trans:%d, action:%d is sent to %s:%u", pTrans->id, action, pAction->epSet.eps[pAction->epSet.inUse].fqdn,
pAction->epSet.eps[pAction->epSet.inUse].port);
pAction->msgSent = 1; pAction->msgSent = 1;
pAction->msgReceived = 0; pAction->msgReceived = 0;
pAction->errCode = 0; pAction->errCode = 0;
...@@ -1031,7 +1031,7 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA ...@@ -1031,7 +1031,7 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
mDebug("trans:%d, all %d actions execute successfully", pTrans->id, numOfActions); mDebug("trans:%d, all %d actions execute successfully", pTrans->id, numOfActions);
return 0; return 0;
} else { } else {
mError("trans:%d, all %d actions executed, code:0x%04x", pTrans->id, numOfActions, errCode & 0XFFFF); mError("trans:%d, all %d actions executed, code:0x%x", pTrans->id, numOfActions, errCode & 0XFFFF);
mndTransResetActions(pMnode, pTrans, pArray); mndTransResetActions(pMnode, pTrans, pArray);
terrno = errCode; terrno = errCode;
return errCode; return errCode;
...@@ -1222,7 +1222,7 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) { ...@@ -1222,7 +1222,7 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
mError("trans:%d, failed to write sdb since %s", pTrans->id, terrstr()); mError("trans:%d, failed to write sdb since %s", pTrans->id, terrstr());
} }
mDebug("trans:%d, finished, code:0x%04x, failedTimes:%d", pTrans->id, pTrans->code, pTrans->failedTimes); mDebug("trans:%d, finished, code:0x%x, failedTimes:%d", pTrans->id, pTrans->code, pTrans->failedTimes);
return continueExec; return continueExec;
} }
......
...@@ -256,7 +256,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg ...@@ -256,7 +256,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
return pReq; return pReq;
} }
void *mndBuildAlterVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen) { void *mndBuildAlterVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen) {
SAlterVnodeReq alterReq = {0}; SAlterVnodeReq alterReq = {0};
alterReq.vgVersion = pVgroup->version; alterReq.vgVersion = pVgroup->version;
alterReq.buffer = pDb->cfg.buffer; alterReq.buffer = pDb->cfg.buffer;
...@@ -285,16 +285,14 @@ void *mndBuildAlterVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgO ...@@ -285,16 +285,14 @@ void *mndBuildAlterVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgO
pReplica->port = pVgidDnode->port; pReplica->port = pVgidDnode->port;
memcpy(pReplica->fqdn, pVgidDnode->fqdn, TSDB_FQDN_LEN); memcpy(pReplica->fqdn, pVgidDnode->fqdn, TSDB_FQDN_LEN);
mndReleaseDnode(pMnode, pVgidDnode); mndReleaseDnode(pMnode, pVgidDnode);
if (pDnode->id == pVgid->dnodeId) {
alterReq.selfIndex = v;
}
} }
#if 0
if (alterReq.selfIndex == -1) { if (alterReq.selfIndex == -1) {
terrno = TSDB_CODE_MND_APP_ERROR; terrno = TSDB_CODE_MND_APP_ERROR;
return NULL; return NULL;
} }
#endif
int32_t contLen = tSerializeSAlterVnodeReq(NULL, 0, &alterReq); int32_t contLen = tSerializeSAlterVnodeReq(NULL, 0, &alterReq);
if (contLen < 0) { if (contLen < 0) {
......
...@@ -343,20 +343,21 @@ void mndStop(SMnode *pMnode) { return mndCleanupTimer(pMnode); } ...@@ -343,20 +343,21 @@ void mndStop(SMnode *pMnode) { return mndCleanupTimer(pMnode); }
int32_t mndProcessMsg(SRpcMsg *pMsg) { int32_t mndProcessMsg(SRpcMsg *pMsg) {
SMnode *pMnode = pMsg->info.node; SMnode *pMnode = pMsg->info.node;
void *ahandle = pMsg->info.ahandle; void *ahandle = pMsg->info.ahandle;
mTrace("msg:%p, will be processed, type:%s app:%p", pMsg, TMSG_INFO(pMsg->msgType), ahandle); mTrace("msg:%p, will be processed, type:%s app:%p", pMsg, TMSG_INFO(pMsg->msgType), ahandle);
if (IsReq(pMsg) && !mndIsMaster(pMnode)) { if (IsReq(pMsg)) {
if (!mndIsMaster(pMnode)) {
terrno = TSDB_CODE_APP_NOT_READY; terrno = TSDB_CODE_APP_NOT_READY;
mDebug("msg:%p, failed to process since %s, app:%p", pMsg, terrstr(), ahandle); mDebug("msg:%p, failed to process since %s, app:%p", pMsg, terrstr(), ahandle);
return -1; return -1;
} }
if (IsReq(pMsg) && (pMsg->contLen == 0 || pMsg->pCont == NULL)) { if (pMsg->contLen == 0 || pMsg->pCont == NULL) {
terrno = TSDB_CODE_INVALID_MSG_LEN; terrno = TSDB_CODE_INVALID_MSG_LEN;
mError("msg:%p, failed to process since %s, app:%p", pMsg, terrstr(), ahandle); mError("msg:%p, failed to process since %s, app:%p", pMsg, terrstr(), ahandle);
return -1; return -1;
} }
}
MndMsgFp fp = pMnode->msgFp[TMSG_INDEX(pMsg->msgType)]; MndMsgFp fp = pMnode->msgFp[TMSG_INDEX(pMsg->msgType)];
if (fp == NULL) { if (fp == NULL) {
...@@ -488,7 +489,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr ...@@ -488,7 +489,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
tstrncpy(desc.status, "ready", sizeof(desc.status)); tstrncpy(desc.status, "ready", sizeof(desc.status));
pClusterInfo->vgroups_alive++; pClusterInfo->vgroups_alive++;
} }
if (pVgid->role == TAOS_SYNC_STATE_LEADER || pVgid->role == TAOS_SYNC_STATE_CANDIDATE) { if (pVgid->role != TAOS_SYNC_STATE_ERROR) {
pClusterInfo->vnodes_alive++; pClusterInfo->vnodes_alive++;
} }
pClusterInfo->vnodes_total++; pClusterInfo->vnodes_total++;
......
...@@ -56,7 +56,7 @@ class MndTestTrans2 : public ::testing::Test { ...@@ -56,7 +56,7 @@ class MndTestTrans2 : public ::testing::Test {
msgCb.sendReqFp = sendReq; msgCb.sendReqFp = sendReq;
msgCb.sendRspFp = sendRsp; msgCb.sendRspFp = sendRsp;
msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack
tmsgSetDefaultMsgCb(&msgCb); tmsgSetDefault(&msgCb);
SMnodeOpt opt = {0}; SMnodeOpt opt = {0};
opt.deploy = 1; opt.deploy = 1;
......
...@@ -179,6 +179,7 @@ struct STQ { ...@@ -179,6 +179,7 @@ struct STQ {
SHashObj* pStreamTasks; SHashObj* pStreamTasks;
SVnode* pVnode; SVnode* pVnode;
SWal* pWal; SWal* pWal;
// TDB* pTdb;
}; };
typedef struct { typedef struct {
......
...@@ -443,6 +443,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl ...@@ -443,6 +443,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
entry.version = version; entry.version = version;
int tlen; int tlen;
SSchema *pNewSchema = NULL;
switch (pAlterTbReq->action) { switch (pAlterTbReq->action) {
case TSDB_ALTER_TABLE_ADD_COLUMN: case TSDB_ALTER_TABLE_ADD_COLUMN:
if (pColumn) { if (pColumn) {
...@@ -451,8 +452,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl ...@@ -451,8 +452,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
} }
pSchema->sver++; pSchema->sver++;
pSchema->nCols++; pSchema->nCols++;
pSchema->pSchema = pNewSchema = taosMemoryMalloc(sizeof(SSchema) * pSchema->nCols);
taosMemoryRealloc(entry.ntbEntry.schema.pSchema, sizeof(SSchema) * entry.ntbEntry.schema.nCols); memcpy(pNewSchema, pSchema->pSchema, sizeof(SSchema) * (pSchema->nCols - 1));
pSchema->pSchema = pNewSchema;
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].bytes = pAlterTbReq->bytes; pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].bytes = pAlterTbReq->bytes;
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].type = pAlterTbReq->type; pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].type = pAlterTbReq->type;
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].flags = pAlterTbReq->flags; pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].flags = pAlterTbReq->flags;
...@@ -511,6 +513,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl ...@@ -511,6 +513,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
metaULock(pMeta); metaULock(pMeta);
if (pNewSchema) taosMemoryFree(pNewSchema);
tDecoderClear(&dc); tDecoderClear(&dc);
tdbTbcClose(pTbDbc); tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); tdbTbcClose(pUidIdxc);
......
...@@ -32,6 +32,9 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal) { ...@@ -32,6 +32,9 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal) {
pTq->path = strdup(path); pTq->path = strdup(path);
pTq->pVnode = pVnode; pTq->pVnode = pVnode;
pTq->pWal = pWal; pTq->pWal = pWal;
/*if (tdbOpen(path, 4096, 1, &pTq->pTdb) < 0) {*/
/*ASSERT(0);*/
/*}*/
#if 0 #if 0
pTq->tqMeta = tqStoreOpen(pTq, path, (FTqSerialize)tqSerializeConsumer, (FTqDeserialize)tqDeserializeConsumer, pTq->tqMeta = tqStoreOpen(pTq, path, (FTqSerialize)tqSerializeConsumer, (FTqDeserialize)tqDeserializeConsumer,
......
...@@ -378,6 +378,13 @@ typedef enum EStreamScanMode { ...@@ -378,6 +378,13 @@ typedef enum EStreamScanMode {
STREAM_SCAN_FROM_DATAREADER, STREAM_SCAN_FROM_DATAREADER,
} EStreamScanMode; } EStreamScanMode;
typedef struct SCatchSupporter {
SHashObj* pWindowHashTable; // quick locate the window object for each window
SDiskbasedBuf* pDataBuf; // buffer based on blocked-wised disk file
int32_t keySize;
int64_t* pKeyBuf;
} SCatchSupporter;
typedef struct SStreamBlockScanInfo { typedef struct SStreamBlockScanInfo {
SArray* pBlockLists; // multiple SSDatablock. SArray* pBlockLists; // multiple SSDatablock.
SSDataBlock* pRes; // result SSDataBlock SSDataBlock* pRes; // result SSDataBlock
...@@ -400,6 +407,8 @@ typedef struct SStreamBlockScanInfo { ...@@ -400,6 +407,8 @@ typedef struct SStreamBlockScanInfo {
EStreamScanMode scanMode; EStreamScanMode scanMode;
SOperatorInfo* pOperatorDumy; SOperatorInfo* pOperatorDumy;
SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. SInterval interval; // if the upstream is an interval operator, the interval info is also kept here.
SCatchSupporter childAggSup;
SArray* childIds;
} SStreamBlockScanInfo; } SStreamBlockScanInfo;
typedef struct SSysTableScanInfo { typedef struct SSysTableScanInfo {
...@@ -460,6 +469,16 @@ typedef struct SIntervalAggOperatorInfo { ...@@ -460,6 +469,16 @@ typedef struct SIntervalAggOperatorInfo {
bool invertible; bool invertible;
} SIntervalAggOperatorInfo; } SIntervalAggOperatorInfo;
typedef struct SStreamFinalIntervalOperatorInfo {
SOptrBasicInfo binfo; // basic info
SGroupResInfo groupResInfo; // multiple results build supporter
SInterval interval; // interval info
int32_t primaryTsIndex; // primary time stamp slot id from result of downstream operator.
SAggSupporter aggSup; // aggregate supporter
int32_t order; // current SSDataBlock scan order
STimeWindowAggSupp twAggSup;
} SStreamFinalIntervalOperatorInfo;
typedef struct SAggOperatorInfo { typedef struct SAggOperatorInfo {
SOptrBasicInfo binfo; SOptrBasicInfo binfo;
SAggSupporter aggSup; SAggSupporter aggSup;
...@@ -696,6 +715,9 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB ...@@ -696,6 +715,9 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId, SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
STimeWindowAggSupp *pTwAggSupp, const STableGroupInfo* pTableGroupInfo, SExecTaskInfo* pTaskInfo); STimeWindowAggSupp *pTwAggSupp, const STableGroupInfo* pTableGroupInfo, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
STimeWindowAggSupp *pTwAggSupp, const STableGroupInfo* pTableGroupInfo, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId, SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
...@@ -771,9 +793,8 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary ...@@ -771,9 +793,8 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary
TSKEY ekey, __block_search_fn_t searchFn, STableQueryInfo* item, TSKEY ekey, __block_search_fn_t searchFn, STableQueryInfo* item,
int32_t order); int32_t order);
int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order); int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order);
int32_t initCatchSupporter(SCatchSupporter* pCatchSup, size_t rowSize, size_t keyBufSize,
void doClearWindow(SIntervalAggOperatorInfo* pInfo, char* pData, int16_t bytes, const char* pKey, const char* pDir);
uint64_t groupId, int32_t numOfOutput);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -106,7 +106,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) { ...@@ -106,7 +106,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) {
pMsg->contentLen = pMsg->contentLen; pMsg->contentLen = pMsg->contentLen;
#endif #endif
qDebugL("stream task string %s", (const char*)msg); /*qDebugL("stream task string %s", (const char*)msg);*/
struct SSubplan* plan = NULL; struct SSubplan* plan = NULL;
int32_t code = qStringToSubplan(msg, &plan); int32_t code = qStringToSubplan(msg, &plan);
......
...@@ -133,6 +133,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) { ...@@ -133,6 +133,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) {
if (ret != TSDB_CODE_SUCCESS) { if (ret != TSDB_CODE_SUCCESS) {
publishQueryAbortEvent(pTaskInfo, ret); publishQueryAbortEvent(pTaskInfo, ret);
pTaskInfo->code = ret; pTaskInfo->code = ret;
cleanUpUdfs();
qDebug("%s task abort due to error/cancel occurs, code:%s", GET_TASKID(pTaskInfo), qDebug("%s task abort due to error/cancel occurs, code:%s", GET_TASKID(pTaskInfo),
tstrerror(pTaskInfo->code)); tstrerror(pTaskInfo->code));
return pTaskInfo->code; return pTaskInfo->code;
......
...@@ -342,28 +342,6 @@ SResultRow* getNewResultRow_rv(SDiskbasedBuf* pResultBuf, int64_t tableGroupId, ...@@ -342,28 +342,6 @@ SResultRow* getNewResultRow_rv(SDiskbasedBuf* pResultBuf, int64_t tableGroupId,
return pResultRow; return pResultRow;
} }
void doClearWindow(SIntervalAggOperatorInfo* pInfo, char* pData, int16_t bytes,
uint64_t groupId, int32_t numOfOutput) {
SAggSupporter* pSup = &pInfo->aggSup;
SET_RES_WINDOW_KEY(pSup->keyBuf, pData, bytes, groupId);
SResultRowPosition* p1 =
(SResultRowPosition*)taosHashGet(pSup->pResultRowHashTable, pSup->keyBuf,
GET_RES_WINDOW_KEY_LEN(bytes));
SResultRow* pResult = getResultRowByPos(pSup->pResultBuf, p1);
SqlFunctionCtx* pCtx = pInfo->binfo.pCtx;
for (int32_t i = 0; i < numOfOutput; ++i) {
pCtx[i].resultInfo = getResultCell(pResult, i, pInfo->binfo.rowCellInfoOffset);
struct SResultRowEntryInfo* pResInfo = pCtx[i].resultInfo;
if (fmIsWindowPseudoColumnFunc(pCtx[i].functionId)) {
continue;
}
pResInfo->initialized = false;
if (pCtx[i].functionId != -1) {
pCtx[i].fpSet.init(&pCtx[i], pResInfo);
}
}
}
/** /**
* the struct of key in hash table * the struct of key in hash table
* +----------+---------------+ * +----------+---------------+
...@@ -5321,3 +5299,16 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo ...@@ -5321,3 +5299,16 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t initCatchSupporter(SCatchSupporter* pCatchSup, size_t rowSize, size_t keyBufSize,
const char* pKey, const char* pDir) {
pCatchSup->keySize = sizeof(int64_t) + sizeof(int64_t) + sizeof(TSKEY);
pCatchSup->pKeyBuf = taosMemoryCalloc(1, pCatchSup->keySize);
int32_t pageSize = rowSize * 32;
int32_t bufSize = pageSize * 4096;
createDiskbasedBuf(&pCatchSup->pDataBuf, pageSize, bufSize, pKey, pDir);
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pCatchSup->pWindowHashTable = taosHashInit(10000, hashFn, true, HASH_NO_LOCK);;
return TSDB_CODE_SUCCESS;
}
...@@ -36,6 +36,11 @@ ...@@ -36,6 +36,11 @@
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN) #define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC)) #define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
typedef struct SWindowPosition {
int32_t pageId;
int32_t rowId;
} SWindowPosition;
static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity); static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity);
static int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size, static int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size,
const char* dbName); const char* dbName);
...@@ -675,6 +680,96 @@ static SSDataBlock* getUpdateDataBlock(SStreamBlockScanInfo* pInfo, bool inverti ...@@ -675,6 +680,96 @@ static SSDataBlock* getUpdateDataBlock(SStreamBlockScanInfo* pInfo, bool inverti
return NULL; return NULL;
} }
void static setSupKeyBuf(SCatchSupporter* pSup, int64_t groupId, int64_t childId, TSKEY ts) {
int64_t* pKey = (int64_t*)pSup->pKeyBuf;
pKey[0] = groupId;
pKey[1] = childId;
pKey[2] = ts;
}
static int32_t catchWidonwInfo(SSDataBlock* pDataBlock, SCatchSupporter* pSup,
int32_t pageId, int32_t tsIndex, int64_t childId) {
SColumnInfoData* pColDataInfo = taosArrayGet(pDataBlock->pDataBlock, tsIndex);
TSKEY* tsCols = (int64_t*)pColDataInfo->pData;
for (int32_t i = 0; i < pDataBlock->info.rows; i++) {
setSupKeyBuf(pSup, pDataBlock->info.groupId, childId, tsCols[i]);
SWindowPosition* p1 = (SWindowPosition*)taosHashGet(pSup->pWindowHashTable,
pSup->pKeyBuf, pSup->keySize);
if (p1 == NULL) {
SWindowPosition pos = {.pageId = pageId, .rowId = i};
int32_t code = taosHashPut(pSup->pWindowHashTable, pSup->pKeyBuf, pSup->keySize, &pos,
sizeof(SWindowPosition));
if (code != TSDB_CODE_SUCCESS ) {
return code;
}
} else {
p1->pageId = pageId;
p1->rowId = i;
}
}
return TSDB_CODE_SUCCESS;
}
static int32_t catchDatablock(SSDataBlock* pDataBlock, SCatchSupporter* pSup,
int32_t tsIndex, int64_t childId) {
int32_t start = 0;
int32_t stop = 0;
int32_t pageSize = getBufPageSize(pSup->pDataBuf);
while(start < pDataBlock->info.rows) {
blockDataSplitRows(pDataBlock, pDataBlock->info.hasVarCol, start, &stop, pageSize);
SSDataBlock* pDB = blockDataExtractBlock(pDataBlock, start, stop - start + 1);
if (pDB == NULL) {
return terrno;
}
int32_t pageId = -1;
void* pPage = getNewBufPage(pSup->pDataBuf, pDataBlock->info.groupId, &pageId);
if (pPage == NULL) {
blockDataDestroy(pDB);
return terrno;
}
int32_t size = blockDataGetSize(pDB) + sizeof(int32_t) + pDB->info.numOfCols * sizeof(int32_t);
assert(size <= pageSize);
blockDataToBuf(pPage, pDB);
setBufPageDirty(pPage, true);
releaseBufPage(pSup->pDataBuf, pPage);
blockDataDestroy(pDB);
start = stop + 1;
int32_t code = catchWidonwInfo(pDB, pSup, pageId, tsIndex, childId);
if (code != TSDB_CODE_SUCCESS ) {
return code;
}
}
return TSDB_CODE_SUCCESS;
}
static SSDataBlock* getDataFromCatch(SStreamBlockScanInfo* pInfo) {
SSDataBlock* pBlock = pInfo->pUpdateRes;
if (pInfo->updateResIndex < pBlock->info.rows) {
blockDataCleanup(pInfo->pRes);
SCatchSupporter* pCSup = &pInfo->childAggSup;
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, 0);
TSKEY *tsCols = (TSKEY*)pColDataInfo->pData;
int32_t size = taosArrayGetSize(pInfo->childIds);
for (int32_t i = 0; i < size; i++) {
int64_t id = *(int64_t *)taosArrayGet(pInfo->childIds, i);
setSupKeyBuf(pCSup, pBlock->info.groupId, id,
tsCols[pInfo->updateResIndex]);
SWindowPosition* pos = (SWindowPosition*)taosHashGet(pCSup->pWindowHashTable,
pCSup->pKeyBuf, pCSup->keySize);
void* buf = getBufPage(pCSup->pDataBuf, pos->pageId);
SSDataBlock* pDB = createOneDataBlock(pInfo->pRes, false);
blockDataFromBuf(pDB, buf);
SSDataBlock* pSub = blockDataExtractBlock(pDB, pos->rowId, 1);
blockDataMerge(pInfo->pRes, pSub, NULL);
blockDataDestroy(pDB);
blockDataDestroy(pSub);
}
pInfo->updateResIndex++;
return pInfo->pRes;
}
return NULL;
}
static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) { static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
// NOTE: this operator does never check if current status is done or not // NOTE: this operator does never check if current status is done or not
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
...@@ -688,6 +783,15 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) { ...@@ -688,6 +783,15 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
size_t total = taosArrayGetSize(pInfo->pBlockLists); size_t total = taosArrayGetSize(pInfo->pBlockLists);
if (pInfo->blockType == STREAM_DATA_TYPE_SSDATA_BLOCK) { if (pInfo->blockType == STREAM_DATA_TYPE_SSDATA_BLOCK) {
if (pInfo->scanMode == STREAM_SCAN_FROM_UPDATERES) {
SSDataBlock* pDB = getDataFromCatch(pInfo);
if (pDB != NULL) {
return pDB;
} else {
pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE;
}
}
if (pInfo->validBlockIndex >= total) { if (pInfo->validBlockIndex >= total) {
doClearBufferedBlocks(pInfo); doClearBufferedBlocks(pInfo);
pOperator->status = OP_EXEC_DONE; pOperator->status = OP_EXEC_DONE;
...@@ -695,7 +799,17 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) { ...@@ -695,7 +799,17 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
} }
int32_t current = pInfo->validBlockIndex++; int32_t current = pInfo->validBlockIndex++;
return taosArrayGetP(pInfo->pBlockLists, current); SSDataBlock* pBlock = taosArrayGetP(pInfo->pBlockLists, current);
if (pBlock->info.type == STREAM_REPROCESS) {
pInfo->scanMode = STREAM_SCAN_FROM_UPDATERES;
} else {
int32_t code = catchDatablock(pBlock, &pInfo->childAggSup, pInfo->primaryTsIndex, 0);
if (code != TDB_CODE_SUCCESS) {
pTaskInfo->code = code;
longjmp(pTaskInfo->env, code);
}
}
return pBlock;
} else { } else {
if (pInfo->scanMode == STREAM_SCAN_FROM_RES) { if (pInfo->scanMode == STREAM_SCAN_FROM_RES) {
blockDataDestroy(pInfo->pUpdateRes); blockDataDestroy(pInfo->pUpdateRes);
...@@ -857,6 +971,10 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, void* pDataR ...@@ -857,6 +971,10 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, void* pDataR
pInfo->pOperatorDumy = pOperatorDumy; pInfo->pOperatorDumy = pOperatorDumy;
pInfo->interval = pSTInfo->interval; pInfo->interval = pSTInfo->interval;
size_t childKeyBufSize = sizeof(int64_t) + sizeof(int64_t) + sizeof(TSKEY);
initCatchSupporter(&pInfo->childAggSup, 1024, childKeyBufSize,
"StreamFinalInterval", "/tmp/"); // TODO(liuyao) get row size from phy plan
pOperator->name = "StreamBlockScanOperator"; pOperator->name = "StreamBlockScanOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN;
pOperator->blocking = false; pOperator->blocking = false;
......
...@@ -8,6 +8,8 @@ typedef enum SResultTsInterpType { ...@@ -8,6 +8,8 @@ typedef enum SResultTsInterpType {
RESULT_ROW_END_INTERP = 2, RESULT_ROW_END_INTERP = 2,
} SResultTsInterpType; } SResultTsInterpType;
static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator);
/* /*
* There are two cases to handle: * There are two cases to handle:
* *
...@@ -473,8 +475,7 @@ static bool setTimeWindowInterpolationEndTs(SOperatorInfo* pOperatorInfo, SqlFun ...@@ -473,8 +475,7 @@ static bool setTimeWindowInterpolationEndTs(SOperatorInfo* pOperatorInfo, SqlFun
} }
static int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo, static int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo,
TSKEY* primaryKeys, int32_t prevPosition, SIntervalAggOperatorInfo* pInfo) { TSKEY* primaryKeys, int32_t prevPosition, int32_t order) {
int32_t order = pInfo->order;
bool ascQuery = (order == TSDB_ORDER_ASC); bool ascQuery = (order == TSDB_ORDER_ASC);
int32_t precision = pInterval->precision; int32_t precision = pInterval->precision;
...@@ -723,7 +724,7 @@ static SArray* hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe ...@@ -723,7 +724,7 @@ static SArray* hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe
STimeWindow nextWin = win; STimeWindow nextWin = win;
while (1) { while (1) {
int32_t prevEndPos = (forwardStep - 1) * step + startPos; int32_t prevEndPos = (forwardStep - 1) * step + startPos;
startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, pInfo); startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, pInfo->order);
if (startPos < 0) { if (startPos < 0) {
break; break;
} }
...@@ -1031,18 +1032,41 @@ static void setInverFunction(SqlFunctionCtx* pCtx, int32_t num, EStreamType type ...@@ -1031,18 +1032,41 @@ static void setInverFunction(SqlFunctionCtx* pCtx, int32_t num, EStreamType type
} }
} }
} }
static void doClearWindows(SIntervalAggOperatorInfo* pInfo, int32_t numOfOutput, SSDataBlock* pBlock) {
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); void doClearWindow(SAggSupporter* pSup, SOptrBasicInfo* pBinfo, char* pData,
int16_t bytes, uint64_t groupId, int32_t numOfOutput) {
SET_RES_WINDOW_KEY(pSup->keyBuf, pData, bytes, groupId);
SResultRowPosition* p1 =
(SResultRowPosition*)taosHashGet(pSup->pResultRowHashTable, pSup->keyBuf,
GET_RES_WINDOW_KEY_LEN(bytes));
SResultRow* pResult = getResultRowByPos(pSup->pResultBuf, p1);
SqlFunctionCtx* pCtx = pBinfo->pCtx;
for (int32_t i = 0; i < numOfOutput; ++i) {
pCtx[i].resultInfo = getResultCell(pResult, i, pBinfo->rowCellInfoOffset);
struct SResultRowEntryInfo* pResInfo = pCtx[i].resultInfo;
if (fmIsWindowPseudoColumnFunc(pCtx[i].functionId)) {
continue;
}
pResInfo->initialized = false;
if (pCtx[i].functionId != -1) {
pCtx[i].fpSet.init(&pCtx[i], pResInfo);
}
}
}
static void doClearWindows(SAggSupporter* pSup, SOptrBasicInfo* pBinfo,
SInterval* pIntrerval, int32_t tsIndex, int32_t numOfOutput, SSDataBlock* pBlock) {
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, tsIndex);
TSKEY *tsCols = (TSKEY*)pColDataInfo->pData; TSKEY *tsCols = (TSKEY*)pColDataInfo->pData;
int32_t step = 0; int32_t step = 0;
for (int32_t i = 0; i < pBlock->info.rows; i += step) { for (int32_t i = 0; i < pBlock->info.rows; i += step) {
SResultRowInfo dumyInfo; SResultRowInfo dumyInfo;
dumyInfo.cur.pageId = -1; dumyInfo.cur.pageId = -1;
STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCols[i], &pInfo->interval, STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCols[i], pIntrerval,
pInfo->interval.precision, NULL); pIntrerval->precision, NULL);
step = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, i, step = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, i,
win.ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC); win.ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC);
doClearWindow(pInfo, (char*)&win.skey, sizeof(TKEY), pBlock->info.groupId, numOfOutput); doClearWindow(pSup, pBinfo, (char*)&win.skey, sizeof(TKEY), pBlock->info.groupId, numOfOutput);
} }
} }
...@@ -1084,7 +1108,8 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { ...@@ -1084,7 +1108,8 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
setInverFunction(pInfo->binfo.pCtx, pOperator->numOfExprs, pBlock->info.type); setInverFunction(pInfo->binfo.pCtx, pOperator->numOfExprs, pBlock->info.type);
} }
if (pBlock->info.type == STREAM_REPROCESS) { if (pBlock->info.type == STREAM_REPROCESS) {
doClearWindows(pInfo, pOperator->numOfExprs, pBlock); doClearWindows(&pInfo->aggSup, &pInfo->binfo, &pInfo->interval,
pInfo->primaryTsIndex, pOperator->numOfExprs, pBlock);
continue; continue;
} }
pInfo->order = TSDB_ORDER_ASC; pInfo->order = TSDB_ORDER_ASC;
...@@ -1097,8 +1122,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { ...@@ -1097,8 +1122,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
// TODO: remove for stream
/*ASSERT(pInfo->binfo.pRes->info.rows > 0);*/
pOperator->status = OP_RES_TO_RETURN; pOperator->status = OP_RES_TO_RETURN;
return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes; return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes;
...@@ -1116,6 +1139,12 @@ void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput) { ...@@ -1116,6 +1139,12 @@ void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput) {
cleanupAggSup(&pInfo->aggSup); cleanupAggSup(&pInfo->aggSup);
} }
void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) {
SStreamFinalIntervalOperatorInfo* pInfo = (SStreamFinalIntervalOperatorInfo *)param;
doDestroyBasicInfo(&pInfo->binfo, numOfOutput);
cleanupAggSup(&pInfo->aggSup);
}
bool allInvertible(SqlFunctionCtx* pFCtx, int32_t numOfCols) { bool allInvertible(SqlFunctionCtx* pFCtx, int32_t numOfCols) {
for (int32_t i = 0; i < numOfCols; i++) { for (int32_t i = 0; i < numOfCols; i++) {
if (!fmIsInvertible(pFCtx[i].functionId)) { if (!fmIsInvertible(pFCtx[i].functionId)) {
...@@ -1185,6 +1214,63 @@ _error: ...@@ -1185,6 +1214,63 @@ _error:
return NULL; return NULL;
} }
SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
STimeWindowAggSupp* pTwAggSupp, const STableGroupInfo* pTableGroupInfo,
SExecTaskInfo* pTaskInfo) {
SStreamFinalIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFinalIntervalOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
goto _error;
}
pInfo->order = TSDB_ORDER_ASC;
pInfo->interval = *pInterval;
pInfo->twAggSup = *pTwAggSupp;
pInfo->primaryTsIndex = primaryTsSlotId;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initResultSizeInfo(pOperator, 4096);
int32_t code =
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, pResBlock,
keyBufSize, pTaskInfo->id.str);
initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
initResultRowInfo(&pInfo->binfo.resultRowInfo, (int32_t)1);
pOperator->name = "StreamFinalIntervalOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
pOperator->pExpr = pExprInfo;
pOperator->pTaskInfo = pTaskInfo;
pOperator->numOfExprs = numOfCols;
pOperator->info = pInfo;
pOperator->fpSet = createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL,
destroyStreamFinalIntervalOperatorInfo, aggEncodeResultRow, aggDecodeResultRow,
NULL);
code = appendDownstream(pOperator, &downstream, 1);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
return pOperator;
_error:
destroyStreamFinalIntervalOperatorInfo(pInfo, numOfCols);
taosMemoryFreeClear(pInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
}
SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId, SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
STimeWindowAggSupp* pTwAggSupp, const STableGroupInfo* pTableGroupInfo, STimeWindowAggSupp* pTwAggSupp, const STableGroupInfo* pTableGroupInfo,
...@@ -1548,3 +1634,91 @@ _error: ...@@ -1548,3 +1634,91 @@ _error:
pTaskInfo->code = code; pTaskInfo->code = code;
return NULL; return NULL;
} }
static SArray* doHashInterval(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResultRowInfo, SSDataBlock* pSDataBlock,
int32_t tableGroupId) {
SStreamFinalIntervalOperatorInfo* pInfo = (SStreamFinalIntervalOperatorInfo*)pOperatorInfo->info;
SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo;
int32_t numOfOutput = pOperatorInfo->numOfExprs;
SArray* pUpdated = taosArrayInit(4, POINTER_BYTES);
int32_t step = 1;
bool ascScan = true;
TSKEY* tsCols = NULL;
SResultRow* pResult = NULL;
int32_t forwardStep = 0;
if (pSDataBlock->pDataBlock != NULL) {
SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex);
tsCols = (int64_t*)pColDataInfo->pData;
}
int32_t startPos = ascScan ? 0 : (pSDataBlock->info.rows - 1);
TSKEY ts = getStartTsKey(&pSDataBlock->info.window, tsCols, pSDataBlock->info.rows, ascScan);
STimeWindow nextWin = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts,
&pInfo->interval, pInfo->interval.precision, NULL);
while (1) {
int32_t code =
setTimeWindowOutputBuf(pResultRowInfo, &nextWin, true, &pResult, tableGroupId, pInfo->binfo.pCtx,
numOfOutput, pInfo->binfo.rowCellInfoOffset, &pInfo->aggSup, pTaskInfo);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
SResKeyPos* pos = taosMemoryMalloc(sizeof(SResKeyPos) + sizeof(uint64_t));
pos->groupId = tableGroupId;
pos->pos = (SResultRowPosition){.pageId = pResult->pageId, .offset = pResult->offset};
*(int64_t*)pos->key = pResult->win.skey;
taosArrayPush(pUpdated, &pos);
forwardStep =
getNumOfRowsInTimeWindow(&pSDataBlock->info, tsCols, startPos, nextWin.ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC);
// window start(end) key interpolation
doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->binfo.pCtx, pResult, &nextWin, startPos, forwardStep,
pInfo->order, false);
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, true);
doApplyFunctions(pTaskInfo, pInfo->binfo.pCtx, &nextWin, &pInfo->twAggSup.timeWindowData, startPos, forwardStep, tsCols,
pSDataBlock->info.rows, numOfOutput, TSDB_ORDER_ASC);
int32_t prevEndPos = (forwardStep - 1) * step + startPos;
startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, pInfo->order);
if (startPos < 0) {
break;
}
}
return pUpdated;
}
static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
SStreamFinalIntervalOperatorInfo* pInfo = pOperator->info;
SOperatorInfo* downstream = pOperator->pDownstream[0];
SArray* pUpdated = NULL;
if (pOperator->status == OP_EXEC_DONE) {
return NULL;
} else if (pOperator->status == OP_RES_TO_RETURN) {
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
if (pInfo->binfo.pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pInfo->groupResInfo)) {
pOperator->status = OP_EXEC_DONE;
}
return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes;
}
while (1) {
publishOperatorProfEvent(downstream, QUERY_PROF_BEFORE_OPERATOR_EXEC);
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
publishOperatorProfEvent(downstream, QUERY_PROF_AFTER_OPERATOR_EXEC);
if (pBlock == NULL) {
break;
}
setInputDataBlock(pOperator, pInfo->binfo.pCtx, pBlock, pInfo->order, MAIN_SCAN, true);
if (pBlock->info.type == STREAM_REPROCESS) {
doClearWindows(&pInfo->aggSup, &pInfo->binfo, &pInfo->interval,
pInfo->primaryTsIndex, pOperator->numOfExprs, pBlock);
continue;
}
pUpdated = doHashInterval(pOperator, &pInfo->binfo.resultRowInfo, pBlock, 0);
}
finalizeUpdatedResult(pOperator->numOfExprs, pInfo->aggSup.pResultBuf, pUpdated, pInfo->binfo.rowCellInfoOffset);
initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated);
blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
pOperator->status = OP_RES_TO_RETURN;
return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes;
}
...@@ -74,6 +74,7 @@ int32_t diffFunction(SqlFunctionCtx *pCtx); ...@@ -74,6 +74,7 @@ int32_t diffFunction(SqlFunctionCtx *pCtx);
bool getFirstLastFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); bool getFirstLastFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
int32_t firstFunction(SqlFunctionCtx *pCtx); int32_t firstFunction(SqlFunctionCtx *pCtx);
int32_t lastFunction(SqlFunctionCtx *pCtx); int32_t lastFunction(SqlFunctionCtx *pCtx);
int32_t lastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv); bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
int32_t topFunction(SqlFunctionCtx *pCtx); int32_t topFunction(SqlFunctionCtx *pCtx);
......
...@@ -47,8 +47,10 @@ static int32_t translateInOutNum(SFunctionNode* pFunc, char* pErrBuf, int32_t le ...@@ -47,8 +47,10 @@ static int32_t translateInOutNum(SFunctionNode* pFunc, char* pErrBuf, int32_t le
} }
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
if (!IS_NUMERIC_TYPE(paraType)) { if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
} else if (IS_NULL_TYPE(paraType)) {
paraType = TSDB_DATA_TYPE_BIGINT;
} }
pFunc->node.resType = (SDataType){.bytes = tDataTypes[paraType].bytes, .type = paraType}; pFunc->node.resType = (SDataType){.bytes = tDataTypes[paraType].bytes, .type = paraType};
...@@ -62,7 +64,7 @@ static int32_t translateInNumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t ...@@ -62,7 +64,7 @@ static int32_t translateInNumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t
} }
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
if (!IS_NUMERIC_TYPE(paraType)) { if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
} }
...@@ -115,18 +117,19 @@ static int32_t translateSum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { ...@@ -115,18 +117,19 @@ static int32_t translateSum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
} }
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
if (!IS_NUMERIC_TYPE(paraType)) { if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
} }
uint8_t resType = 0; uint8_t resType = 0;
if (IS_SIGNED_NUMERIC_TYPE(paraType) || paraType == TSDB_DATA_TYPE_BOOL) { if (IS_SIGNED_NUMERIC_TYPE(paraType) || TSDB_DATA_TYPE_BOOL == paraType || IS_NULL_TYPE(paraType)) {
resType = TSDB_DATA_TYPE_BIGINT; resType = TSDB_DATA_TYPE_BIGINT;
} else if (IS_UNSIGNED_NUMERIC_TYPE(paraType)) { } else if (IS_UNSIGNED_NUMERIC_TYPE(paraType)) {
resType = TSDB_DATA_TYPE_UBIGINT; resType = TSDB_DATA_TYPE_UBIGINT;
} else if (IS_FLOAT_TYPE(paraType)) { } else if (IS_FLOAT_TYPE(paraType)) {
resType = TSDB_DATA_TYPE_DOUBLE; resType = TSDB_DATA_TYPE_DOUBLE;
} }
pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType};
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -872,7 +875,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -872,7 +875,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.getEnvFunc = getFirstLastFuncEnv, .getEnvFunc = getFirstLastFuncEnv,
.initFunc = functionSetup, .initFunc = functionSetup,
.processFunc = lastFunction, .processFunc = lastFunction,
.finalizeFunc = functionFinalize .finalizeFunc = lastFinalize
}, },
{ {
.name = "diff", .name = "diff",
......
...@@ -255,7 +255,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { ...@@ -255,7 +255,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0; //pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0;
char* in = GET_ROWCELL_INTERBUF(pResInfo); char* in = GET_ROWCELL_INTERBUF(pResInfo);
colDataAppend(pCol, pBlock->info.rows, in, pResInfo->isNullRes); colDataAppend(pCol, pBlock->info.rows, in, pResInfo->isNullRes);
...@@ -331,8 +331,18 @@ static FORCE_INLINE int32_t getNumofElem(SqlFunctionCtx* pCtx) { ...@@ -331,8 +331,18 @@ static FORCE_INLINE int32_t getNumofElem(SqlFunctionCtx* pCtx) {
int32_t countFunction(SqlFunctionCtx* pCtx) { int32_t countFunction(SqlFunctionCtx* pCtx) {
int32_t numOfElem = getNumofElem(pCtx); int32_t numOfElem = getNumofElem(pCtx);
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SInputColumnInfoData* pInput = &pCtx->input;
int32_t type = pInput->pData[0]->info.type;
char* buf = GET_ROWCELL_INTERBUF(pResInfo); char* buf = GET_ROWCELL_INTERBUF(pResInfo);
if (IS_NULL_TYPE(type)) {
//select count(NULL) returns 0
numOfElem = 1;
*((int64_t*)buf) = 0;
} else {
*((int64_t*)buf) += numOfElem; *((int64_t*)buf) += numOfElem;
}
SET_VAL(pResInfo, numOfElem, 1); SET_VAL(pResInfo, numOfElem, 1);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -383,6 +393,12 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { ...@@ -383,6 +393,12 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) {
SSumRes* pSumRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); SSumRes* pSumRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
if (IS_NULL_TYPE(type)) {
GET_RES_INFO(pCtx)->isNullRes = 1;
numOfElem = 1;
goto _sum_over;
}
if (pInput->colDataAggIsSet) { if (pInput->colDataAggIsSet) {
numOfElem = pInput->numOfRows - pAgg->numOfNull; numOfElem = pInput->numOfRows - pAgg->numOfNull;
ASSERT(numOfElem >= 0); ASSERT(numOfElem >= 0);
...@@ -427,6 +443,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { ...@@ -427,6 +443,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) {
} }
} }
_sum_over:
// data in the check operation are all null, not output // data in the check operation are all null, not output
SET_VAL(GET_RES_INFO(pCtx), numOfElem, 1); SET_VAL(GET_RES_INFO(pCtx), numOfElem, 1);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -526,6 +543,12 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { ...@@ -526,6 +543,12 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) {
int32_t start = pInput->startRowIndex; int32_t start = pInput->startRowIndex;
int32_t numOfRows = pInput->numOfRows; int32_t numOfRows = pInput->numOfRows;
if (IS_NULL_TYPE(type)) {
GET_RES_INFO(pCtx)->isNullRes = 1;
numOfElem = 1;
goto _avg_over;
}
switch (type) { switch (type) {
case TSDB_DATA_TYPE_TINYINT: { case TSDB_DATA_TYPE_TINYINT: {
int8_t* plist = (int8_t*)pCol->pData; int8_t* plist = (int8_t*)pCol->pData;
...@@ -617,6 +640,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { ...@@ -617,6 +640,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) {
break; break;
} }
_avg_over:
// data in the check operation are all null, not output // data in the check operation are all null, not output
SET_VAL(GET_RES_INFO(pCtx), numOfElem, 1); SET_VAL(GET_RES_INFO(pCtx), numOfElem, 1);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -783,6 +807,12 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { ...@@ -783,6 +807,12 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SMinmaxResInfo *pBuf = GET_ROWCELL_INTERBUF(pResInfo); SMinmaxResInfo *pBuf = GET_ROWCELL_INTERBUF(pResInfo);
if (IS_NULL_TYPE(type)) {
GET_RES_INFO(pCtx)->isNullRes = 1;
numOfElems = 1;
goto _min_max_over;
}
// data in current data block are qualified to the query // data in current data block are qualified to the query
if (pInput->colDataAggIsSet) { if (pInput->colDataAggIsSet) {
numOfElems = pInput->numOfRows - pAgg->numOfNull; numOfElems = pInput->numOfRows - pAgg->numOfNull;
...@@ -1183,6 +1213,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { ...@@ -1183,6 +1213,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
} }
} }
_min_max_over:
return numOfElems; return numOfElems;
} }
...@@ -1215,9 +1246,9 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { ...@@ -1215,9 +1246,9 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) { if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) {
float v = *(double*) &pRes->v; float v = *(double*) &pRes->v;
colDataAppend(pCol, currentRow, (const char*)&v, false); colDataAppend(pCol, currentRow, (const char*)&v, pEntryInfo->isNullRes);
} else { } else {
colDataAppend(pCol, currentRow, (const char*)&pRes->v, false); colDataAppend(pCol, currentRow, (const char*)&pRes->v, pEntryInfo->isNullRes);
} }
setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow); setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow);
...@@ -1287,6 +1318,12 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) { ...@@ -1287,6 +1318,12 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
int32_t start = pInput->startRowIndex; int32_t start = pInput->startRowIndex;
int32_t numOfRows = pInput->numOfRows; int32_t numOfRows = pInput->numOfRows;
if (IS_NULL_TYPE(type)) {
GET_RES_INFO(pCtx)->isNullRes = 1;
numOfElem = 1;
goto _stddev_over;
}
switch (type) { switch (type) {
case TSDB_DATA_TYPE_TINYINT: { case TSDB_DATA_TYPE_TINYINT: {
int8_t* plist = (int8_t*)pCol->pData; int8_t* plist = (int8_t*)pCol->pData;
...@@ -1384,6 +1421,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) { ...@@ -1384,6 +1421,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
break; break;
} }
_stddev_over:
// data in the check operation are all null, not output // data in the check operation are all null, not output
SET_VAL(GET_RES_INFO(pCtx), numOfElem, 1); SET_VAL(GET_RES_INFO(pCtx), numOfElem, 1);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -1943,6 +1981,19 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { ...@@ -1943,6 +1981,19 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t lastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0;
char* in = GET_ROWCELL_INTERBUF(pResInfo);
colDataAppend(pCol, pBlock->info.rows, in, pResInfo->isNullRes);
return pResInfo->numOfRes;
}
bool getDiffFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { bool getDiffFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) {
pEnv->calcMemSize = sizeof(SDiffInfo); pEnv->calcMemSize = sizeof(SDiffInfo);
return true; return true;
......
...@@ -1364,9 +1364,12 @@ void releaseUdfFuncHandle(char* udfName) { ...@@ -1364,9 +1364,12 @@ void releaseUdfFuncHandle(char* udfName) {
SUdfcFuncStub key = {0}; SUdfcFuncStub key = {0};
strcpy(key.udfName, udfName); strcpy(key.udfName, udfName);
SUdfcFuncStub *foundStub = taosArraySearch(gUdfdProxy.udfStubs, &key, compareUdfcFuncSub, TD_EQ); SUdfcFuncStub *foundStub = taosArraySearch(gUdfdProxy.udfStubs, &key, compareUdfcFuncSub, TD_EQ);
ASSERT(foundStub); if (!foundStub) {
return;
}
if (foundStub->refCount > 0) {
--foundStub->refCount; --foundStub->refCount;
ASSERT(foundStub->refCount>=0); }
uv_mutex_unlock(&gUdfdProxy.udfStubsMutex); uv_mutex_unlock(&gUdfdProxy.udfStubsMutex);
} }
...@@ -1377,7 +1380,7 @@ int32_t cleanUpUdfs() { ...@@ -1377,7 +1380,7 @@ int32_t cleanUpUdfs() {
while (i < taosArrayGetSize(gUdfdProxy.udfStubs)) { while (i < taosArrayGetSize(gUdfdProxy.udfStubs)) {
SUdfcFuncStub *stub = taosArrayGet(gUdfdProxy.udfStubs, i); SUdfcFuncStub *stub = taosArrayGet(gUdfdProxy.udfStubs, i);
if (stub->refCount == 0) { if (stub->refCount == 0) {
fnInfo("tear down udf. udf name: %s, handle: %p", stub->udfName, stub->handle); fnInfo("tear down udf. udf name: %s, handle: %p, ref count: %d", stub->udfName, stub->handle, stub->refCount);
doTeardownUdf(stub->handle); doTeardownUdf(stub->handle);
} else { } else {
fnInfo("udf still in use. udf name: %s, ref count: %d, last ref time: %"PRId64", handle: %p", fnInfo("udf still in use. udf name: %s, ref count: %d, last ref time: %"PRId64", handle: %p",
...@@ -1530,12 +1533,15 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, ...@@ -1530,12 +1533,15 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols,
} }
SUdfcUvSession *session = handle; SUdfcUvSession *session = handle;
code = doCallUdfScalarFunc(handle, input, numOfCols, output); code = doCallUdfScalarFunc(handle, input, numOfCols, output);
if (session->outputType != output->columnData->info.type if (output->columnData == NULL) {
|| session->outputLen != output->columnData->info.bytes) { fnError("udfc scalar function calculate error. no column data");
fnError("udfc scalar function calculate error, session type: %d(%d), output type: %d(%d)",
session->outputType, session->outputLen,
output->columnData->info.type, output->columnData->info.bytes);
code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE; code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE;
} else {
if (session->outputType != output->columnData->info.type || session->outputLen != output->columnData->info.bytes) {
fnError("udfc scalar function calculate error. type mismatch. session type: %d(%d), output type: %d(%d)", session->outputType,
session->outputLen, output->columnData->info.type, output->columnData->info.bytes);
code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE;
}
} }
releaseUdfFuncHandle(udfName); releaseUdfFuncHandle(udfName);
return code; return code;
...@@ -1565,7 +1571,7 @@ int32_t doTeardownUdf(UdfcFuncHandle handle) { ...@@ -1565,7 +1571,7 @@ int32_t doTeardownUdf(UdfcFuncHandle handle) {
fnInfo("tear down udf. udf name: %s, udf func handle: %p", session->udfName, handle); fnInfo("tear down udf. udf name: %s, udf func handle: %p", session->udfName, handle);
taosMemoryFree(task->session); taosMemoryFree(session);
taosMemoryFree(task); taosMemoryFree(task);
return err; return err;
...@@ -1573,7 +1579,6 @@ int32_t doTeardownUdf(UdfcFuncHandle handle) { ...@@ -1573,7 +1579,6 @@ int32_t doTeardownUdf(UdfcFuncHandle handle) {
//memory layout |---SUdfAggRes----|-----final result-----|---inter result----| //memory layout |---SUdfAggRes----|-----final result-----|---inter result----|
typedef struct SUdfAggRes { typedef struct SUdfAggRes {
SUdfcUvSession *session;
int8_t finalResNum; int8_t finalResNum;
int8_t interResNum; int8_t interResNum;
char* finalResBuf; char* finalResBuf;
...@@ -1606,7 +1611,6 @@ bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo* pResult ...@@ -1606,7 +1611,6 @@ bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo* pResult
udfRes->finalResBuf = (char*)udfRes + sizeof(SUdfAggRes); udfRes->finalResBuf = (char*)udfRes + sizeof(SUdfAggRes);
udfRes->interResBuf = (char*)udfRes + sizeof(SUdfAggRes) + session->outputLen; udfRes->interResBuf = (char*)udfRes + sizeof(SUdfAggRes) + session->outputLen;
udfRes->session = (SUdfcUvSession *)handle;
SUdfInterBuf buf = {0}; SUdfInterBuf buf = {0};
if ((udfCode = doCallUdfAggInit(handle, &buf)) != 0) { if ((udfCode = doCallUdfAggInit(handle, &buf)) != 0) {
fnError("udfAggInit error. step doCallUdfAggInit. udf code: %d", udfCode); fnError("udfAggInit error. step doCallUdfAggInit. udf code: %d", udfCode);
...@@ -1621,22 +1625,26 @@ bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo* pResult ...@@ -1621,22 +1625,26 @@ bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo* pResult
releaseUdfFuncHandle(pCtx->udfName); releaseUdfFuncHandle(pCtx->udfName);
return false; return false;
} }
releaseUdfFuncHandle(pCtx->udfName);
freeUdfInterBuf(&buf); freeUdfInterBuf(&buf);
return true; return true;
} }
int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) { int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
SInputColumnInfoData* pInput = &pCtx->input; int32_t udfCode = 0;
int32_t numOfCols = pInput->numOfInputCols; UdfcFuncHandle handle = 0;
if ((udfCode = acquireUdfFuncHandle((char *)pCtx->udfName, &handle)) != 0) {
fnError("udfAggProcess error. step acquireUdfFuncHandle. udf code: %d", udfCode);
return udfCode;
}
SUdfcUvSession *session = handle;
SUdfAggRes* udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); SUdfAggRes* udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
SUdfcUvSession *session = udfRes->session;
if (session == NULL) {
return TSDB_CODE_UDF_NO_FUNC_HANDLE;
}
udfRes->finalResBuf = (char*)udfRes + sizeof(SUdfAggRes); udfRes->finalResBuf = (char*)udfRes + sizeof(SUdfAggRes);
udfRes->interResBuf = (char*)udfRes + sizeof(SUdfAggRes) + session->outputLen; udfRes->interResBuf = (char*)udfRes + sizeof(SUdfAggRes) + session->outputLen;
SInputColumnInfoData* pInput = &pCtx->input;
int32_t numOfCols = pInput->numOfInputCols;
int32_t start = pInput->startRowIndex; int32_t start = pInput->startRowIndex;
int32_t numOfRows = pInput->numOfRows; int32_t numOfRows = pInput->numOfRows;
...@@ -1664,7 +1672,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) { ...@@ -1664,7 +1672,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
.numOfResult = udfRes->interResNum}; .numOfResult = udfRes->interResNum};
SUdfInterBuf newState = {0}; SUdfInterBuf newState = {0};
int32_t udfCode = doCallUdfAggProcess(session, inputBlock, &state, &newState); udfCode = doCallUdfAggProcess(session, inputBlock, &state, &newState);
if (udfCode != 0) { if (udfCode != 0) {
fnError("udfAggProcess error. code: %d", udfCode); fnError("udfAggProcess error. code: %d", udfCode);
newState.numOfResult = 0; newState.numOfResult = 0;
...@@ -1684,19 +1692,21 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) { ...@@ -1684,19 +1692,21 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
blockDataDestroy(inputBlock); blockDataDestroy(inputBlock);
taosArrayDestroy(tempBlock.pDataBlock); taosArrayDestroy(tempBlock.pDataBlock);
if (udfCode != 0) {
releaseUdfFuncHandle(pCtx->udfName); releaseUdfFuncHandle(pCtx->udfName);
}
freeUdfInterBuf(&newState); freeUdfInterBuf(&newState);
return udfCode; return udfCode;
} }
int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock) { int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock) {
SUdfAggRes* udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); int32_t udfCode = 0;
SUdfcUvSession *session = udfRes->session; UdfcFuncHandle handle = 0;
if (session == NULL) { if ((udfCode = acquireUdfFuncHandle((char *)pCtx->udfName, &handle)) != 0) {
return TSDB_CODE_UDF_NO_FUNC_HANDLE; fnError("udfAggProcess error. step acquireUdfFuncHandle. udf code: %d", udfCode);
return udfCode;
} }
SUdfcUvSession *session = handle;
SUdfAggRes* udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
udfRes->finalResBuf = (char*)udfRes + sizeof(SUdfAggRes); udfRes->finalResBuf = (char*)udfRes + sizeof(SUdfAggRes);
udfRes->interResBuf = (char*)udfRes + sizeof(SUdfAggRes) + session->outputLen; udfRes->interResBuf = (char*)udfRes + sizeof(SUdfAggRes) + session->outputLen;
......
...@@ -621,6 +621,7 @@ column_reference(A) ::= table_name(B) NK_DOT column_name(C). ...@@ -621,6 +621,7 @@ column_reference(A) ::= table_name(B) NK_DOT column_name(C).
pseudo_column(A) ::= ROWTS(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) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= table_name(B) NK_DOT TBNAME(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &C, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)))); }
pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
......
...@@ -155,9 +155,9 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t ...@@ -155,9 +155,9 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t
return TSDB_CODE_SUCCESS == pCxt->errCode; return TSDB_CODE_SUCCESS == pCxt->errCode;
} }
static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool query) { static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool demandDb) {
if (NULL == pDbName) { if (NULL == pDbName) {
if (query && NULL == pCxt->pQueryCxt->db) { if (demandDb && NULL == pCxt->pQueryCxt->db) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DB_NOT_SPECIFIED); pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DB_NOT_SPECIFIED);
} }
} else { } else {
...@@ -457,6 +457,8 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok ...@@ -457,6 +457,8 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok
} }
if (QUERY_NODE_SELECT_STMT == nodeType(pSubquery)) { if (QUERY_NODE_SELECT_STMT == nodeType(pSubquery)) {
strcpy(((SSelectStmt*)pSubquery)->stmtName, tempTable->table.tableAlias); strcpy(((SSelectStmt*)pSubquery)->stmtName, tempTable->table.tableAlias);
} else if (QUERY_NODE_SET_OPERATOR == nodeType(pSubquery)) {
strcpy(((SSetOperator*)pSubquery)->stmtName, tempTable->table.tableAlias);
} }
return (SNode*)tempTable; return (SNode*)tempTable;
} }
...@@ -637,6 +639,7 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* ...@@ -637,6 +639,7 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode*
setOp->opType = type; setOp->opType = type;
setOp->pLeft = pLeft; setOp->pLeft = pLeft;
setOp->pRight = pRight; setOp->pRight = pRight;
sprintf(setOp->stmtName, "%p", setOp);
return (SNode*)setOp; return (SNode*)setOp;
} }
...@@ -1140,7 +1143,7 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const ...@@ -1140,7 +1143,7 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName, SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName,
SToken* pTableName, SNodeList* pCols, SNode* pOptions) { SToken* pTableName, SNodeList* pCols, SNode* pOptions) {
if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName)) { if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName) || !checkDbName(pCxt, NULL, true)) {
return NULL; return NULL;
} }
SCreateIndexStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT); SCreateIndexStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT);
......
...@@ -766,6 +766,20 @@ static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc) ...@@ -766,6 +766,20 @@ static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc)
pCxt->pCurrStmt->hasRepeatScanFuncs = true; pCxt->pCurrStmt->hasRepeatScanFuncs = true;
} }
} }
if (TSDB_CODE_SUCCESS == pCxt->errCode && fmIsScanPseudoColumnFunc(pFunc->funcId)) {
if (0 == LIST_LENGTH(pFunc->pParameterList)) {
if (QUERY_NODE_REAL_TABLE != nodeType(pCxt->pCurrStmt->pFromTable)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_TBNAME);
}
} else {
SValueNode* pVal = nodesListGetNode(pFunc->pParameterList, 0);
STableNode* pTable = NULL;
pCxt->errCode = findTable(pCxt, pVal->literal, &pTable);
if (TSDB_CODE_SUCCESS == pCxt->errCode && (NULL == pTable || QUERY_NODE_REAL_TABLE != nodeType(pTable))) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_TBNAME);
}
}
}
return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
} }
...@@ -1758,12 +1772,13 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) { ...@@ -1758,12 +1772,13 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
return code; return code;
} }
static SNode* createSetOperProject(SNode* pNode) { static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) {
SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) { if (NULL == pCol) {
return NULL; return NULL;
} }
pCol->node.resType = ((SExprNode*)pNode)->resType; pCol->node.resType = ((SExprNode*)pNode)->resType;
strcpy(pCol->tableAlias, pTableAlias);
strcpy(pCol->colName, ((SExprNode*)pNode)->aliasName); strcpy(pCol->colName, ((SExprNode*)pNode)->aliasName);
strcpy(pCol->node.aliasName, pCol->colName); strcpy(pCol->node.aliasName, pCol->colName);
return (SNode*)pCol; return (SNode*)pCol;
...@@ -1817,7 +1832,8 @@ static int32_t translateSetOperatorImpl(STranslateContext* pCxt, SSetOperator* p ...@@ -1817,7 +1832,8 @@ static int32_t translateSetOperatorImpl(STranslateContext* pCxt, SSetOperator* p
} }
strcpy(pRightExpr->aliasName, pLeftExpr->aliasName); strcpy(pRightExpr->aliasName, pLeftExpr->aliasName);
pRightExpr->aliasName[strlen(pLeftExpr->aliasName)] = '\0'; pRightExpr->aliasName[strlen(pLeftExpr->aliasName)] = '\0';
if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSetOperator->pProjectionList, createSetOperProject(pLeft))) { if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSetOperator->pProjectionList,
createSetOperProject(pSetOperator->stmtName, pLeft))) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
} }
......
...@@ -158,6 +158,8 @@ static char* getSyntaxErrFormat(int32_t errCode) { ...@@ -158,6 +158,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "Primary timestamp column cannot be dropped"; return "Primary timestamp column cannot be dropped";
case TSDB_CODE_PAR_INVALID_MODIFY_COL: case TSDB_CODE_PAR_INVALID_MODIFY_COL:
return "Only binary/nchar column length could be modified"; return "Only binary/nchar column length could be modified";
case TSDB_CODE_PAR_INVALID_TBNAME:
return "Invalid tbname pseudo column";
case TSDB_CODE_OUT_OF_MEMORY: case TSDB_CODE_OUT_OF_MEMORY:
return "Out of memory"; return "Out of memory";
default: default:
......
...@@ -134,17 +134,17 @@ typedef union { ...@@ -134,17 +134,17 @@ typedef union {
#define ParseCTX_FETCH #define ParseCTX_FETCH
#define ParseCTX_STORE #define ParseCTX_STORE
#define YYFALLBACK 1 #define YYFALLBACK 1
#define YYNSTATE 603 #define YYNSTATE 605
#define YYNRULE 451 #define YYNRULE 452
#define YYNTOKEN 238 #define YYNTOKEN 238
#define YY_MAX_SHIFT 602 #define YY_MAX_SHIFT 604
#define YY_MIN_SHIFTREDUCE 890 #define YY_MIN_SHIFTREDUCE 893
#define YY_MAX_SHIFTREDUCE 1340 #define YY_MAX_SHIFTREDUCE 1344
#define YY_ERROR_ACTION 1341 #define YY_ERROR_ACTION 1345
#define YY_ACCEPT_ACTION 1342 #define YY_ACCEPT_ACTION 1346
#define YY_NO_ACTION 1343 #define YY_NO_ACTION 1347
#define YY_MIN_REDUCE 1344 #define YY_MIN_REDUCE 1348
#define YY_MAX_REDUCE 1794 #define YY_MAX_REDUCE 1799
/************* End control #defines *******************************************/ /************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
...@@ -213,223 +213,223 @@ typedef union { ...@@ -213,223 +213,223 @@ typedef union {
*********** Begin parsing tables **********************************************/ *********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (2167) #define YY_ACTTAB_COUNT (2167)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 382, 76, 383, 1376, 390, 517, 383, 1376, 1627, 28, /* 0 */ 383, 76, 384, 1380, 391, 519, 384, 1380, 1631, 28,
/* 10 */ 221, 1463, 35, 33, 113, 1459, 342, 346, 1642, 1772, /* 10 */ 223, 1467, 35, 33, 113, 1463, 343, 347, 1646, 1777,
/* 20 */ 300, 1466, 1156, 1623, 1631, 1629, 36, 34, 32, 31, /* 20 */ 301, 1470, 1159, 1627, 1635, 1633, 36, 34, 32, 31,
/* 30 */ 30, 1724, 1771, 1474, 94, 520, 1769, 93, 92, 91, /* 30 */ 30, 1729, 1776, 1478, 94, 522, 1774, 93, 92, 91,
/* 40 */ 90, 89, 88, 87, 86, 85, 1658, 1154, 1519, 291, /* 40 */ 90, 89, 88, 87, 86, 85, 1662, 1157, 1523, 292,
/* 50 */ 32, 31, 30, 501, 290, 1721, 1772, 477, 14, 1517, /* 50 */ 32, 31, 30, 503, 291, 1726, 1777, 479, 14, 1521,
/* 60 */ 35, 33, 1281, 500, 1162, 516, 1627, 1613, 300, 144, /* 60 */ 35, 33, 1285, 502, 1165, 518, 1631, 1617, 301, 145,
/* 70 */ 1156, 348, 273, 1769, 397, 36, 34, 32, 31, 30, /* 70 */ 1159, 349, 274, 1774, 398, 36, 34, 32, 31, 30,
/* 80 */ 1, 1623, 1630, 1629, 1670, 112, 24, 132, 1643, 503, /* 80 */ 1, 1627, 1634, 1633, 1675, 112, 24, 132, 1647, 505,
/* 90 */ 1645, 1646, 499, 520, 520, 1154, 36, 34, 32, 31, /* 90 */ 1649, 1650, 501, 522, 522, 1157, 36, 34, 32, 31,
/* 100 */ 30, 61, 599, 1243, 270, 481, 14, 517, 35, 33, /* 100 */ 30, 61, 601, 1247, 271, 483, 14, 519, 35, 33,
/* 110 */ 595, 594, 1162, 1155, 108, 516, 300, 304, 1156, 104, /* 110 */ 597, 596, 1165, 1158, 108, 518, 301, 305, 1159, 104,
/* 120 */ 1178, 273, 1469, 110, 936, 128, 418, 130, 2, 1356, /* 120 */ 1181, 274, 1473, 110, 939, 128, 419, 130, 2, 1360,
/* 130 */ 54, 482, 1786, 1476, 1772, 1474, 517, 69, 210, 1717, /* 130 */ 54, 484, 1791, 1480, 1777, 1478, 519, 69, 212, 1722,
/* 140 */ 476, 1344, 475, 1154, 1193, 1772, 1772, 145, 104, 416, /* 140 */ 478, 1348, 477, 1157, 1196, 1777, 1777, 146, 104, 417,
/* 150 */ 599, 1769, 1243, 1244, 14, 423, 1157, 1467, 146, 1770, /* 150 */ 601, 1774, 1247, 1248, 14, 424, 1160, 1471, 147, 1775,
/* 160 */ 1162, 1155, 1769, 1769, 1474, 103, 102, 101, 100, 99, /* 160 */ 1165, 1158, 1774, 1774, 1478, 103, 102, 101, 100, 99,
/* 170 */ 98, 97, 96, 95, 1249, 38, 2, 552, 1160, 1161, /* 170 */ 98, 97, 96, 95, 1253, 38, 2, 554, 1163, 1164,
/* 180 */ 54, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 496, 518, /* 180 */ 54, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520,
/* 190 */ 1220, 1221, 1222, 1223, 1224, 1225, 551, 550, 599, 549, /* 190 */ 1224, 1225, 1226, 1227, 1228, 1229, 553, 552, 601, 551,
/* 200 */ 548, 547, 1244, 493, 1157, 341, 1305, 340, 147, 1155, /* 200 */ 550, 549, 1248, 495, 1160, 342, 1309, 341, 148, 1158,
/* 210 */ 27, 298, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1248, /* 210 */ 27, 299, 1242, 1243, 1244, 1245, 1246, 1250, 1251, 1252,
/* 220 */ 131, 1180, 504, 1249, 1431, 303, 1160, 1161, 1564, 1206, /* 220 */ 131, 1183, 506, 1253, 1435, 304, 1163, 1164, 1568, 1209,
/* 230 */ 1207, 1208, 1209, 1210, 1211, 1212, 496, 518, 1220, 1221, /* 230 */ 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, 1224, 1225,
/* 240 */ 1222, 1223, 1224, 1225, 1403, 464, 1303, 1304, 1306, 1307, /* 240 */ 1226, 1227, 1228, 1229, 1407, 465, 1307, 1308, 1310, 1311,
/* 250 */ 55, 54, 1157, 36, 34, 32, 31, 30, 147, 27, /* 250 */ 55, 54, 1160, 36, 34, 32, 31, 30, 148, 27,
/* 260 */ 298, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1248, 63, /* 260 */ 299, 1242, 1243, 1244, 1245, 1246, 1250, 1251, 1252, 63,
/* 270 */ 288, 477, 554, 187, 1160, 1161, 1342, 1206, 1207, 1208, /* 270 */ 289, 479, 1284, 188, 1163, 1164, 1346, 1209, 1210, 1212,
/* 280 */ 1209, 1210, 1211, 1212, 496, 518, 1220, 1221, 1222, 1223, /* 280 */ 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, 1226, 1227,
/* 290 */ 1224, 1225, 35, 33, 36, 34, 32, 31, 30, 112, /* 290 */ 1228, 1229, 35, 33, 36, 34, 32, 31, 30, 112,
/* 300 */ 300, 1452, 1156, 147, 575, 574, 573, 315, 147, 572, /* 300 */ 301, 1456, 1159, 148, 577, 576, 575, 316, 148, 574,
/* 310 */ 571, 570, 114, 565, 564, 563, 562, 561, 560, 559, /* 310 */ 573, 572, 114, 567, 566, 565, 564, 563, 562, 561,
/* 320 */ 558, 121, 1295, 1235, 1519, 312, 54, 1154, 988, 1658, /* 320 */ 560, 121, 1299, 1239, 1523, 313, 54, 1157, 991, 1662,
/* 330 */ 305, 1642, 1555, 1557, 316, 1517, 501, 110, 138, 310, /* 330 */ 306, 1646, 1559, 1561, 317, 1521, 472, 110, 140, 311,
/* 340 */ 35, 33, 1226, 471, 1162, 990, 920, 128, 300, 1513, /* 340 */ 35, 33, 1230, 473, 1165, 993, 923, 128, 301, 1517,
/* 350 */ 1156, 479, 140, 1717, 1718, 1476, 1722, 26, 397, 1658, /* 350 */ 1159, 481, 142, 1722, 1723, 1480, 1727, 26, 398, 1662,
/* 360 */ 8, 36, 34, 32, 31, 30, 501, 36, 34, 32, /* 360 */ 8, 36, 34, 32, 31, 30, 503, 36, 34, 32,
/* 370 */ 31, 30, 470, 467, 1772, 1154, 500, 1406, 313, 147, /* 370 */ 31, 30, 471, 468, 1777, 1157, 502, 1410, 314, 148,
/* 380 */ 1613, 53, 599, 461, 924, 925, 128, 144, 35, 33, /* 380 */ 1617, 556, 601, 462, 927, 928, 128, 145, 35, 33,
/* 390 */ 333, 1769, 1162, 1155, 1476, 516, 300, 1670, 1156, 1182, /* 390 */ 334, 1774, 1165, 1158, 1480, 518, 301, 1675, 1159, 53,
/* 400 */ 267, 1643, 503, 1645, 1646, 499, 381, 520, 9, 385, /* 400 */ 268, 1647, 505, 1649, 1650, 501, 382, 522, 9, 386,
/* 410 */ 335, 331, 1026, 543, 542, 541, 1030, 540, 1032, 1033, /* 410 */ 336, 332, 1029, 545, 544, 543, 1033, 542, 1035, 1036,
/* 420 */ 539, 1035, 536, 1154, 1041, 533, 1043, 1044, 530, 527, /* 420 */ 541, 1038, 538, 1157, 1044, 535, 1046, 1047, 532, 529,
/* 430 */ 599, 36, 34, 32, 31, 30, 1157, 432, 431, 128, /* 430 */ 601, 36, 34, 32, 31, 30, 1160, 433, 432, 548,
/* 440 */ 1162, 1155, 430, 472, 468, 109, 427, 1477, 517, 426, /* 440 */ 1165, 1158, 431, 474, 469, 109, 428, 1454, 519, 427,
/* 450 */ 425, 424, 1183, 153, 147, 39, 9, 1724, 1160, 1161, /* 450 */ 426, 425, 1185, 1469, 148, 39, 9, 1729, 1163, 1164,
/* 460 */ 347, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 496, 518, /* 460 */ 348, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520,
/* 470 */ 1220, 1221, 1222, 1223, 1224, 1225, 1474, 59, 599, 387, /* 470 */ 1224, 1225, 1226, 1227, 1228, 1229, 1478, 1283, 601, 1292,
/* 480 */ 58, 1720, 432, 431, 1157, 1178, 1465, 430, 147, 1155, /* 480 */ 1235, 1725, 433, 432, 1160, 1183, 1183, 431, 148, 1158,
/* 490 */ 109, 427, 1519, 446, 426, 425, 424, 1337, 311, 546, /* 490 */ 109, 428, 1523, 447, 427, 426, 425, 1341, 312, 1637,
/* 500 */ 1193, 1156, 1367, 1517, 372, 454, 1160, 1161, 308, 1206, /* 500 */ 1196, 1159, 1617, 1521, 556, 455, 1163, 1164, 309, 1209,
/* 510 */ 1207, 1208, 1209, 1210, 1211, 1212, 496, 518, 1220, 1221, /* 510 */ 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, 1224, 1225,
/* 520 */ 1222, 1223, 1224, 1225, 212, 1627, 1154, 36, 34, 32, /* 520 */ 1226, 1227, 1228, 1229, 154, 1631, 1157, 36, 34, 32,
/* 530 */ 31, 30, 1157, 1772, 389, 1613, 1519, 385, 504, 1366, /* 530 */ 31, 30, 1160, 1777, 390, 1639, 1523, 386, 388, 1371,
/* 540 */ 1623, 1630, 1629, 1162, 1565, 1365, 144, 1518, 157, 156, /* 540 */ 1627, 1634, 1633, 1165, 1181, 373, 145, 1522, 59, 1370,
/* 550 */ 1769, 1613, 520, 455, 1160, 1161, 1642, 1206, 1207, 1208, /* 550 */ 1774, 58, 522, 456, 1163, 1164, 1646, 1209, 1210, 1212,
/* 560 */ 1209, 1210, 1211, 1212, 496, 518, 1220, 1221, 1222, 1223, /* 560 */ 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, 1226, 1227,
/* 570 */ 1224, 1225, 35, 33, 269, 517, 1178, 198, 1336, 61, /* 570 */ 1228, 1229, 35, 33, 270, 519, 1181, 214, 1340, 61,
/* 580 */ 300, 599, 1156, 365, 1658, 517, 377, 357, 1613, 429, /* 580 */ 301, 601, 1159, 366, 1662, 519, 378, 358, 1617, 158,
/* 590 */ 428, 501, 1155, 1772, 1613, 1364, 173, 514, 1363, 1362, /* 590 */ 157, 503, 1158, 1777, 128, 1369, 174, 516, 1617, 1729,
/* 600 */ 1470, 500, 483, 1474, 378, 1613, 144, 1154, 137, 517, /* 600 */ 1474, 502, 1481, 1478, 379, 1617, 145, 1157, 139, 519,
/* 610 */ 1769, 481, 1361, 1474, 414, 410, 406, 402, 172, 282, /* 610 */ 1774, 483, 1368, 1478, 415, 411, 407, 403, 173, 283,
/* 620 */ 1181, 358, 1670, 1280, 1162, 258, 1643, 503, 1645, 1646, /* 620 */ 485, 359, 1675, 1724, 1165, 259, 1647, 505, 1649, 1650,
/* 630 */ 499, 517, 520, 1117, 937, 1157, 936, 1474, 477, 1450, /* 630 */ 501, 519, 522, 1120, 940, 1160, 939, 1478, 479, 445,
/* 640 */ 2, 1119, 62, 396, 1613, 170, 1360, 1613, 1613, 569, /* 640 */ 2, 1122, 62, 397, 1617, 171, 1367, 1211, 1211, 11,
/* 650 */ 567, 1772, 1179, 11, 10, 1556, 1557, 1160, 1161, 1474, /* 650 */ 10, 1777, 443, 1366, 430, 429, 7, 1163, 1164, 1478,
/* 660 */ 127, 1613, 599, 938, 146, 1359, 112, 283, 1769, 281, /* 660 */ 127, 1617, 601, 941, 147, 1365, 112, 284, 1774, 282,
/* 670 */ 280, 7, 420, 1155, 376, 1358, 422, 371, 370, 369, /* 670 */ 281, 1184, 421, 1158, 377, 1364, 423, 372, 371, 370,
/* 680 */ 368, 367, 364, 363, 362, 361, 360, 356, 355, 354, /* 680 */ 369, 368, 365, 364, 363, 362, 361, 357, 356, 355,
/* 690 */ 353, 352, 351, 350, 349, 1613, 554, 517, 517, 421, /* 690 */ 354, 353, 352, 351, 350, 1617, 1183, 519, 519, 422,
/* 700 */ 517, 1118, 485, 169, 110, 164, 1451, 166, 477, 1471, /* 700 */ 519, 1121, 1617, 170, 110, 165, 1455, 167, 479, 1475,
/* 710 */ 1593, 1355, 515, 1245, 1613, 1354, 1157, 1353, 1352, 141, /* 710 */ 1597, 1186, 517, 1249, 1617, 1363, 1160, 1362, 1359, 143,
/* 720 */ 1717, 1718, 444, 1722, 1613, 1474, 1474, 162, 1474, 1351, /* 720 */ 1722, 1723, 487, 1727, 1617, 1478, 1478, 163, 1478, 1261,
/* 730 */ 1642, 1350, 1349, 1257, 1250, 442, 112, 1348, 1160, 1161, /* 730 */ 1646, 1358, 1357, 1356, 1254, 490, 112, 1355, 1163, 1164,
/* 740 */ 422, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 496, 518, /* 740 */ 1182, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520,
/* 750 */ 1220, 1221, 1222, 1223, 1224, 1225, 517, 568, 1658, 517, /* 750 */ 1224, 1225, 1226, 1227, 1228, 1229, 519, 246, 1662, 519,
/* 760 */ 1613, 1347, 1552, 421, 1613, 501, 1613, 1613, 235, 155, /* 760 */ 1508, 1354, 1353, 1352, 1617, 503, 1617, 1617, 236, 1556,
/* 770 */ 25, 314, 924, 925, 110, 500, 1729, 1276, 1613, 1613, /* 770 */ 25, 315, 571, 569, 110, 502, 156, 927, 928, 1617,
/* 780 */ 1613, 1613, 1288, 1724, 1474, 481, 1613, 1474, 1180, 142, /* 780 */ 1617, 1617, 1617, 1351, 1478, 483, 1617, 1478, 506, 144,
/* 790 */ 1717, 1718, 245, 1722, 1602, 1504, 1670, 336, 552, 79, /* 790 */ 1722, 1723, 1606, 1727, 1569, 559, 1675, 1450, 554, 79,
/* 800 */ 1643, 503, 1645, 1646, 499, 1642, 520, 1719, 178, 1710, /* 800 */ 1647, 505, 1649, 1650, 501, 1646, 522, 423, 570, 1715,
/* 810 */ 1613, 176, 180, 272, 1706, 179, 182, 551, 550, 181, /* 810 */ 1617, 1617, 1617, 273, 1711, 1560, 1561, 553, 552, 1397,
/* 820 */ 549, 548, 547, 1393, 557, 1772, 1446, 184, 1279, 1231, /* 820 */ 551, 550, 549, 1734, 1280, 1777, 1280, 558, 179, 1392,
/* 830 */ 183, 1388, 118, 1658, 1386, 1180, 1141, 1142, 146, 323, /* 830 */ 422, 177, 1617, 1662, 1144, 1145, 199, 324, 147, 1465,
/* 840 */ 501, 1276, 1769, 45, 129, 433, 201, 46, 271, 251, /* 840 */ 503, 434, 1774, 181, 129, 1390, 180, 1461, 337, 252,
/* 850 */ 500, 11, 10, 435, 1613, 1633, 438, 1339, 1340, 37, /* 850 */ 502, 436, 183, 185, 1617, 182, 184, 118, 1211, 45,
/* 860 */ 481, 249, 52, 488, 556, 51, 1642, 1461, 37, 1457, /* 860 */ 483, 250, 52, 46, 272, 51, 1646, 439, 202, 11,
/* 870 */ 37, 1670, 456, 190, 79, 1643, 503, 1645, 1646, 499, /* 870 */ 10, 1675, 1343, 1344, 79, 1647, 505, 1649, 1650, 501,
/* 880 */ 437, 520, 158, 1302, 1710, 224, 203, 486, 272, 1706, /* 880 */ 438, 522, 159, 37, 1715, 37, 191, 37, 273, 1711,
/* 890 */ 116, 1635, 75, 117, 1658, 445, 495, 545, 1357, 1251, /* 890 */ 225, 497, 75, 116, 1662, 446, 547, 457, 454, 1306,
/* 900 */ 1772, 480, 71, 453, 118, 1165, 54, 1164, 1213, 186, /* 900 */ 1777, 482, 71, 1361, 117, 1168, 54, 488, 204, 187,
/* 910 */ 1112, 500, 45, 144, 216, 1613, 1449, 1769, 1432, 1642, /* 910 */ 1436, 502, 118, 145, 1167, 1617, 1453, 1774, 218, 1646,
/* 920 */ 525, 440, 117, 465, 447, 226, 434, 118, 207, 1377, /* 920 */ 45, 441, 491, 1255, 209, 1217, 435, 1115, 466, 1663,
/* 930 */ 509, 185, 1670, 232, 415, 80, 1643, 503, 1645, 1646, /* 930 */ 227, 186, 1675, 511, 448, 80, 1647, 505, 1649, 1650,
/* 940 */ 499, 119, 520, 78, 1019, 1710, 117, 1658, 1659, 293, /* 940 */ 501, 527, 522, 78, 233, 1715, 117, 1662, 1381, 294,
/* 950 */ 1706, 139, 244, 1514, 501, 50, 1740, 478, 49, 215, /* 950 */ 1711, 141, 1022, 416, 503, 50, 1518, 480, 49, 1745,
/* 960 */ 1047, 961, 1051, 213, 500, 218, 220, 1058, 1613, 460, /* 960 */ 245, 217, 220, 215, 502, 118, 3, 1181, 1617, 461,
/* 970 */ 1737, 1168, 1642, 1167, 57, 56, 345, 3, 962, 152, /* 970 */ 1742, 1171, 1646, 119, 57, 56, 346, 222, 117, 153,
/* 980 */ 1178, 1056, 318, 322, 339, 1670, 120, 278, 262, 1643, /* 980 */ 1170, 1050, 319, 323, 340, 1675, 1054, 964, 263, 1647,
/* 990 */ 503, 1645, 1646, 499, 988, 520, 268, 279, 359, 329, /* 990 */ 505, 1649, 1650, 501, 279, 522, 269, 991, 280, 330,
/* 1000 */ 1658, 325, 321, 149, 240, 1125, 1554, 480, 552, 154, /* 1000 */ 1662, 326, 322, 150, 965, 1061, 241, 482, 554, 1128,
/* 1010 */ 366, 374, 379, 1184, 380, 373, 388, 500, 375, 1187, /* 1010 */ 360, 155, 1558, 1059, 367, 374, 375, 502, 120, 376,
/* 1020 */ 391, 1613, 161, 392, 1186, 163, 473, 551, 550, 393, /* 1020 */ 380, 1617, 1187, 381, 389, 1190, 475, 553, 552, 392,
/* 1030 */ 549, 548, 547, 165, 147, 394, 1185, 168, 1670, 1345, /* 1030 */ 551, 550, 549, 393, 148, 162, 164, 1189, 1675, 1349,
/* 1040 */ 395, 80, 1643, 503, 1645, 1646, 499, 1642, 520, 60, /* 1040 */ 394, 80, 1647, 505, 1649, 1650, 501, 1646, 522, 166,
/* 1050 */ 489, 1710, 398, 417, 171, 293, 1706, 139, 419, 1464, /* 1050 */ 395, 1715, 1188, 396, 169, 294, 1711, 141, 60, 399,
/* 1060 */ 94, 175, 1460, 93, 92, 91, 90, 89, 88, 87, /* 1060 */ 94, 172, 420, 93, 92, 91, 90, 89, 88, 87,
/* 1070 */ 86, 85, 177, 84, 1162, 1658, 1738, 122, 123, 287, /* 1070 */ 86, 85, 1468, 418, 288, 1662, 1743, 1165, 176, 1464,
/* 1080 */ 1642, 188, 501, 1462, 241, 1458, 124, 1597, 125, 448, /* 1080 */ 1646, 84, 503, 178, 122, 1601, 123, 242, 189, 1466,
/* 1090 */ 1183, 191, 500, 452, 193, 449, 1613, 457, 196, 466, /* 1090 */ 1462, 124, 502, 125, 449, 1186, 1617, 450, 192, 453,
/* 1100 */ 1751, 1750, 507, 6, 1731, 206, 474, 242, 1658, 462, /* 1100 */ 1746, 243, 194, 467, 458, 197, 1756, 509, 1662, 6,
/* 1110 */ 463, 458, 5, 1670, 135, 501, 80, 1643, 503, 1645, /* 1110 */ 459, 1755, 476, 1675, 1736, 503, 80, 1647, 505, 1649,
/* 1120 */ 1646, 499, 292, 520, 199, 500, 1710, 208, 202, 1613, /* 1120 */ 1650, 501, 464, 522, 293, 502, 1715, 200, 470, 1617,
/* 1130 */ 293, 1706, 1785, 111, 1276, 469, 1182, 1741, 40, 490, /* 1130 */ 294, 1711, 1790, 463, 203, 5, 208, 1280, 135, 210,
/* 1140 */ 487, 1744, 1642, 1725, 1788, 18, 1670, 294, 510, 80, /* 1140 */ 111, 1749, 1646, 1185, 40, 492, 1675, 295, 1730, 80,
/* 1150 */ 1643, 503, 1645, 1646, 499, 1563, 520, 505, 506, 1710, /* 1150 */ 1647, 505, 1649, 1650, 501, 216, 522, 1567, 489, 1715,
/* 1160 */ 1562, 511, 512, 293, 1706, 1785, 228, 302, 209, 230, /* 1160 */ 18, 1566, 211, 294, 1711, 1790, 512, 229, 507, 244,
/* 1170 */ 1658, 243, 68, 1475, 1767, 70, 523, 501, 1691, 1447, /* 1170 */ 1662, 508, 303, 513, 1772, 514, 70, 503, 231, 1696,
/* 1180 */ 246, 237, 598, 47, 134, 252, 289, 500, 259, 248, /* 1180 */ 68, 525, 1793, 1479, 247, 1451, 238, 502, 600, 1611,
/* 1190 */ 1768, 1613, 253, 214, 1607, 250, 1642, 1606, 484, 217, /* 1190 */ 290, 1617, 47, 1773, 249, 134, 1646, 253, 251, 1610,
/* 1200 */ 317, 1603, 319, 320, 219, 1642, 491, 1150, 1670, 1151, /* 1200 */ 486, 219, 260, 318, 221, 1646, 254, 1607, 1675, 493,
/* 1210 */ 150, 80, 1643, 503, 1645, 1646, 499, 324, 520, 1601, /* 1210 */ 320, 80, 1647, 505, 1649, 1650, 501, 321, 522, 1153,
/* 1220 */ 326, 1710, 327, 328, 1658, 293, 1706, 1785, 1600, 330, /* 1220 */ 1154, 1715, 151, 325, 1662, 294, 1711, 1790, 1605, 327,
/* 1230 */ 1599, 501, 332, 1658, 1598, 334, 1728, 1583, 151, 337, /* 1230 */ 328, 503, 1604, 1662, 329, 331, 1733, 1603, 333, 1602,
/* 1240 */ 501, 500, 338, 1128, 1127, 1613, 343, 344, 1575, 1574, /* 1240 */ 503, 502, 335, 1587, 152, 1617, 338, 339, 1131, 1130,
/* 1250 */ 500, 1577, 1576, 1095, 1613, 1547, 1546, 1545, 1544, 1642, /* 1250 */ 502, 1581, 1580, 344, 1617, 1579, 345, 1578, 1098, 1646,
/* 1260 */ 481, 1543, 1670, 1542, 1541, 132, 1643, 503, 1645, 1646, /* 1260 */ 483, 1551, 1675, 1550, 1549, 132, 1647, 505, 1649, 1650,
/* 1270 */ 499, 1670, 520, 1540, 258, 1643, 503, 1645, 1646, 499, /* 1270 */ 501, 1675, 522, 1548, 259, 1647, 505, 1649, 1650, 501,
/* 1280 */ 1539, 520, 1538, 1537, 1536, 1535, 1534, 1658, 1533, 1532, /* 1280 */ 1547, 522, 1546, 1545, 1544, 1543, 1542, 1662, 1541, 1540,
/* 1290 */ 1531, 1530, 1529, 115, 501, 1528, 1527, 1526, 1525, 1642, /* 1290 */ 1539, 1538, 1537, 1536, 503, 1535, 1534, 1533, 115, 1646,
/* 1300 */ 1772, 1524, 1523, 1097, 500, 1522, 1521, 1520, 1613, 159, /* 1300 */ 1777, 1532, 1531, 1530, 502, 1529, 1528, 1527, 1617, 1100,
/* 1310 */ 1787, 1405, 1373, 144, 106, 136, 384, 1769, 1642, 386, /* 1310 */ 1792, 1526, 1525, 145, 1524, 1409, 1377, 1774, 1646, 160,
/* 1320 */ 1372, 1591, 927, 1585, 926, 1670, 1569, 1658, 81, 1643, /* 1320 */ 1376, 385, 138, 401, 930, 1675, 1595, 1662, 81, 1647,
/* 1330 */ 503, 1645, 1646, 499, 501, 520, 1560, 160, 1710, 400, /* 1330 */ 505, 1649, 1650, 501, 503, 522, 106, 929, 1715, 405,
/* 1340 */ 107, 167, 1709, 1706, 500, 1453, 1658, 1404, 1613, 1402, /* 1340 */ 1402, 107, 1714, 1711, 502, 1589, 1662, 1573, 1617, 1564,
/* 1350 */ 1400, 401, 955, 498, 405, 1398, 1396, 1385, 1384, 409, /* 1350 */ 1457, 161, 387, 500, 168, 1408, 1406, 958, 402, 1404,
/* 1360 */ 399, 404, 403, 500, 413, 1670, 407, 1613, 81, 1643, /* 1360 */ 1400, 406, 410, 502, 414, 1675, 400, 1617, 81, 1647,
/* 1370 */ 503, 1645, 1646, 499, 1642, 520, 408, 411, 1710, 412, /* 1370 */ 505, 1649, 1650, 501, 1646, 522, 404, 408, 1715, 409,
/* 1380 */ 1371, 1455, 492, 1706, 1670, 1062, 1454, 266, 1643, 503, /* 1380 */ 412, 413, 494, 1711, 1675, 1389, 1388, 267, 1647, 505,
/* 1390 */ 1645, 1646, 499, 497, 520, 494, 1682, 1061, 987, 986, /* 1390 */ 1649, 1650, 501, 499, 522, 496, 1687, 1375, 1459, 1065,
/* 1400 */ 985, 984, 1658, 602, 566, 1394, 568, 83, 981, 501, /* 1400 */ 1064, 1458, 1662, 604, 990, 989, 568, 83, 988, 503,
/* 1410 */ 284, 174, 1389, 980, 979, 285, 436, 239, 1387, 500, /* 1410 */ 987, 570, 1398, 984, 983, 175, 285, 240, 982, 502,
/* 1420 */ 286, 439, 1370, 1613, 441, 1369, 443, 82, 1590, 105, /* 1420 */ 437, 286, 1391, 1617, 1393, 287, 440, 1374, 442, 105,
/* 1430 */ 1135, 1584, 48, 1642, 1568, 591, 587, 583, 579, 238, /* 1430 */ 1373, 444, 1594, 1646, 82, 593, 589, 585, 581, 239,
/* 1440 */ 1670, 450, 192, 81, 1643, 503, 1645, 1646, 499, 1567, /* 1440 */ 1675, 1588, 1138, 81, 1647, 505, 1649, 1650, 501, 1572,
/* 1450 */ 520, 1559, 64, 1710, 195, 4, 37, 15, 1707, 200, /* 1450 */ 522, 451, 1571, 1715, 1563, 64, 196, 4, 1712, 37,
/* 1460 */ 1301, 1658, 43, 77, 205, 133, 233, 204, 501, 197, /* 1460 */ 15, 1662, 201, 77, 43, 207, 234, 48, 503, 1305,
/* 1470 */ 22, 1633, 1294, 451, 65, 10, 23, 16, 500, 42, /* 1470 */ 133, 205, 22, 41, 1298, 206, 452, 193, 502, 1637,
/* 1480 */ 1273, 1272, 1613, 211, 41, 297, 126, 1642, 143, 1330, /* 1480 */ 65, 198, 1617, 23, 16, 298, 1277, 1646, 1276, 213,
/* 1490 */ 1319, 307, 306, 17, 1325, 1324, 19, 295, 148, 1670, /* 1490 */ 136, 308, 307, 126, 42, 1329, 1334, 17, 1323, 1675,
/* 1500 */ 513, 1170, 267, 1643, 503, 1645, 1646, 499, 1329, 520, /* 1500 */ 515, 1173, 268, 1647, 505, 1649, 1650, 501, 1328, 522,
/* 1510 */ 1328, 296, 29, 1236, 1215, 1658, 222, 1642, 1214, 1201, /* 1510 */ 296, 1333, 13, 1332, 297, 1662, 10, 1646, 19, 1219,
/* 1520 */ 12, 20, 498, 502, 223, 459, 1163, 1299, 194, 1558, /* 1520 */ 1240, 1218, 500, 29, 137, 460, 1166, 12, 195, 149,
/* 1530 */ 229, 1632, 500, 21, 234, 508, 1613, 225, 227, 66, /* 1530 */ 20, 1204, 502, 504, 1562, 21, 1617, 230, 224, 1303,
/* 1540 */ 67, 231, 1673, 1162, 13, 1658, 1133, 1217, 189, 519, /* 1540 */ 226, 71, 228, 1165, 1175, 1662, 1136, 510, 190, 66,
/* 1550 */ 1642, 44, 501, 1670, 1172, 71, 266, 1643, 503, 1645, /* 1550 */ 1646, 232, 503, 1675, 67, 1636, 267, 1647, 505, 1649,
/* 1560 */ 1646, 499, 500, 520, 524, 1683, 1613, 522, 309, 299, /* 1560 */ 1650, 501, 502, 522, 235, 1688, 1617, 1678, 521, 300,
/* 1570 */ 1048, 526, 528, 1045, 529, 531, 1042, 1036, 1658, 532, /* 1570 */ 1221, 44, 524, 1051, 526, 310, 528, 530, 1662, 1048,
/* 1580 */ 1642, 521, 534, 1670, 535, 501, 267, 1643, 503, 1645, /* 1580 */ 1646, 523, 531, 1675, 1045, 503, 268, 1647, 505, 1649,
/* 1590 */ 1646, 499, 1166, 520, 1034, 500, 537, 1025, 538, 1613, /* 1590 */ 1650, 501, 1169, 522, 533, 502, 1039, 534, 536, 1617,
/* 1600 */ 544, 1057, 301, 72, 1040, 1054, 1039, 1038, 1658, 1037, /* 1600 */ 1037, 537, 302, 539, 540, 1028, 1060, 1058, 1662, 1043,
/* 1610 */ 1642, 73, 477, 74, 1053, 501, 1670, 994, 953, 267, /* 1610 */ 1646, 1042, 479, 72, 1041, 503, 1675, 1040, 546, 268,
/* 1620 */ 1643, 503, 1645, 1646, 499, 500, 520, 1055, 553, 1613, /* 1620 */ 1647, 505, 1649, 1650, 501, 502, 522, 1057, 73, 1617,
/* 1630 */ 555, 236, 975, 974, 973, 1171, 972, 970, 1658, 1401, /* 1630 */ 74, 1056, 956, 555, 997, 1174, 557, 237, 1662, 978,
/* 1640 */ 112, 971, 969, 968, 991, 501, 1670, 989, 965, 254, /* 1640 */ 112, 977, 976, 973, 975, 503, 1675, 974, 972, 255,
/* 1650 */ 1643, 503, 1645, 1646, 499, 500, 520, 1174, 964, 1613, /* 1650 */ 1647, 505, 1649, 1650, 501, 502, 522, 1177, 971, 1617,
/* 1660 */ 481, 1642, 578, 963, 960, 959, 958, 576, 518, 1220, /* 1660 */ 483, 1646, 994, 992, 968, 967, 966, 963, 520, 1224,
/* 1670 */ 1221, 1399, 577, 582, 581, 580, 1670, 1642, 110, 261, /* 1670 */ 1225, 962, 961, 1405, 578, 579, 1675, 1646, 110, 262,
/* 1680 */ 1643, 503, 1645, 1646, 499, 1397, 520, 584, 585, 1658, /* 1680 */ 1647, 505, 1649, 1650, 501, 580, 522, 1403, 582, 1662,
/* 1690 */ 586, 1395, 588, 210, 1717, 476, 501, 475, 590, 589, /* 1690 */ 583, 584, 1401, 212, 1722, 478, 503, 477, 586, 588,
/* 1700 */ 1772, 1383, 592, 593, 1382, 1658, 500, 1368, 596, 597, /* 1700 */ 1777, 1399, 587, 591, 592, 1662, 502, 590, 1387, 595,
/* 1710 */ 1613, 1158, 501, 144, 247, 600, 601, 1769, 1343, 1343, /* 1710 */ 1617, 594, 503, 145, 1386, 1372, 598, 1774, 599, 1347,
/* 1720 */ 1343, 1343, 500, 1343, 1642, 1343, 1613, 1670, 1343, 1343, /* 1720 */ 1161, 248, 502, 602, 1646, 603, 1617, 1675, 1347, 1347,
/* 1730 */ 263, 1643, 503, 1645, 1646, 499, 1343, 520, 1343, 1343, /* 1730 */ 264, 1647, 505, 1649, 1650, 501, 1347, 522, 1347, 1347,
/* 1740 */ 1343, 1343, 1642, 1670, 1343, 1343, 255, 1643, 503, 1645, /* 1740 */ 1347, 1347, 1646, 1675, 1347, 1347, 256, 1647, 505, 1649,
/* 1750 */ 1646, 499, 1658, 520, 1343, 1343, 1343, 1642, 1343, 501, /* 1750 */ 1650, 501, 1662, 522, 1347, 1347, 1347, 1646, 1347, 503,
/* 1760 */ 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 500, /* 1760 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 502,
/* 1770 */ 1658, 1343, 1343, 1613, 1343, 1343, 1343, 501, 1343, 1343, /* 1770 */ 1662, 1347, 1347, 1617, 1347, 1347, 1347, 503, 1347, 1347,
/* 1780 */ 1343, 1343, 1343, 1343, 1343, 1658, 1343, 500, 1343, 1343, /* 1780 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 502, 1347, 1347,
/* 1790 */ 1670, 1613, 501, 264, 1643, 503, 1645, 1646, 499, 1343, /* 1790 */ 1675, 1617, 503, 265, 1647, 505, 1649, 1650, 501, 1347,
/* 1800 */ 520, 1343, 500, 1343, 1642, 1343, 1613, 1343, 1670, 1343, /* 1800 */ 522, 1347, 502, 1347, 1646, 1347, 1617, 1347, 1675, 1347,
/* 1810 */ 1343, 256, 1643, 503, 1645, 1646, 499, 1343, 520, 1343, /* 1810 */ 1347, 257, 1647, 505, 1649, 1650, 501, 1347, 522, 1347,
/* 1820 */ 1642, 1343, 1343, 1670, 1343, 1343, 265, 1643, 503, 1645, /* 1820 */ 1646, 1347, 1347, 1675, 1347, 1347, 266, 1647, 505, 1649,
/* 1830 */ 1646, 499, 1658, 520, 1343, 1343, 1343, 1343, 1343, 501, /* 1830 */ 1650, 501, 1662, 522, 1347, 1347, 1347, 1347, 1347, 503,
/* 1840 */ 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1658, 500, /* 1840 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1662, 502,
/* 1850 */ 1343, 1343, 1343, 1613, 1343, 501, 1343, 1343, 1343, 1343, /* 1850 */ 1347, 1347, 1347, 1617, 1347, 503, 1347, 1347, 1347, 1347,
/* 1860 */ 1343, 1343, 1343, 1343, 1343, 500, 1343, 1642, 1343, 1613, /* 1860 */ 1347, 1347, 1347, 1347, 1347, 502, 1347, 1646, 1347, 1617,
/* 1870 */ 1670, 1343, 1343, 257, 1643, 503, 1645, 1646, 499, 1343, /* 1870 */ 1675, 1347, 1347, 258, 1647, 505, 1649, 1650, 501, 1347,
/* 1880 */ 520, 1343, 1343, 1343, 1343, 1343, 1670, 1343, 1343, 1654, /* 1880 */ 522, 1347, 1347, 1347, 1347, 1347, 1675, 1347, 1347, 1658,
/* 1890 */ 1643, 503, 1645, 1646, 499, 1658, 520, 1642, 1343, 1343, /* 1890 */ 1647, 505, 1649, 1650, 501, 1662, 522, 1646, 1347, 1347,
/* 1900 */ 1343, 1343, 501, 1343, 1343, 1343, 1343, 1343, 1343, 1343, /* 1900 */ 1347, 1347, 503, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 1910 */ 1343, 1343, 500, 1343, 1343, 1343, 1613, 1343, 1343, 1343, /* 1910 */ 1347, 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347,
/* 1920 */ 1343, 1343, 1343, 1343, 1343, 1658, 1343, 1343, 1343, 1343, /* 1920 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 1347, 1347, 1347,
/* 1930 */ 1343, 1343, 501, 1670, 1343, 1343, 1653, 1643, 503, 1645, /* 1930 */ 1347, 1347, 503, 1675, 1347, 1347, 1657, 1647, 505, 1649,
/* 1940 */ 1646, 499, 500, 520, 1343, 1343, 1613, 1642, 1343, 1343, /* 1940 */ 1650, 501, 502, 522, 1347, 1347, 1617, 1646, 1347, 1347,
/* 1950 */ 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, /* 1950 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 1960 */ 1343, 1343, 1343, 1670, 1343, 1343, 1652, 1643, 503, 1645, /* 1960 */ 1347, 1347, 1347, 1675, 1347, 1347, 1656, 1647, 505, 1649,
/* 1970 */ 1646, 499, 1343, 520, 1343, 1658, 1343, 1642, 1343, 1343, /* 1970 */ 1650, 501, 1347, 522, 1347, 1662, 1347, 1646, 1347, 1347,
/* 1980 */ 1343, 1343, 501, 1343, 1343, 1343, 1343, 1343, 1343, 1343, /* 1980 */ 1347, 1347, 503, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 1990 */ 1343, 1343, 500, 1343, 1343, 1343, 1613, 1343, 1343, 1343, /* 1990 */ 1347, 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347,
/* 2000 */ 1343, 1343, 1343, 1343, 1343, 1658, 1343, 1343, 1343, 1343, /* 2000 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 1347, 1347, 1347,
/* 2010 */ 1343, 1343, 501, 1670, 1343, 1343, 276, 1643, 503, 1645, /* 2010 */ 1347, 1347, 503, 1675, 1347, 1347, 277, 1647, 505, 1649,
/* 2020 */ 1646, 499, 500, 520, 1343, 1343, 1613, 1642, 1343, 1343, /* 2020 */ 1650, 501, 502, 522, 1347, 1347, 1617, 1646, 1347, 1347,
/* 2030 */ 1343, 1343, 1343, 1343, 1343, 1343, 1642, 1343, 1343, 1343, /* 2030 */ 1347, 1347, 1347, 1347, 1347, 1347, 1646, 1347, 1347, 1347,
/* 2040 */ 1343, 1343, 1343, 1670, 1343, 1343, 275, 1643, 503, 1645, /* 2040 */ 1347, 1347, 1347, 1675, 1347, 1347, 276, 1647, 505, 1649,
/* 2050 */ 1646, 499, 1343, 520, 1343, 1658, 1343, 1343, 1343, 1343, /* 2050 */ 1650, 501, 1347, 522, 1347, 1662, 1347, 1347, 1347, 1347,
/* 2060 */ 1343, 1343, 501, 1343, 1658, 1343, 1343, 1343, 1343, 1343, /* 2060 */ 1347, 1347, 503, 1347, 1662, 1347, 1347, 1347, 1347, 1347,
/* 2070 */ 1343, 501, 500, 1343, 1343, 1343, 1613, 1343, 1343, 1343, /* 2070 */ 1347, 503, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347,
/* 2080 */ 1343, 500, 1343, 1343, 1343, 1613, 1343, 1343, 1343, 1343, /* 2080 */ 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347, 1347,
/* 2090 */ 1642, 1343, 1343, 1670, 1343, 1343, 277, 1643, 503, 1645, /* 2090 */ 1646, 1347, 1347, 1675, 1347, 1347, 278, 1647, 505, 1649,
/* 2100 */ 1646, 499, 1670, 520, 1343, 274, 1643, 503, 1645, 1646, /* 2100 */ 1650, 501, 1675, 522, 1347, 275, 1647, 505, 1649, 1650,
/* 2110 */ 499, 1343, 520, 1343, 1343, 1343, 1343, 1343, 1658, 1343, /* 2110 */ 501, 1347, 522, 1347, 1347, 1347, 1347, 1347, 1662, 1347,
/* 2120 */ 1343, 1343, 1343, 1343, 1343, 501, 1343, 1343, 1343, 1343, /* 2120 */ 1347, 1347, 1347, 1347, 1347, 503, 1347, 1347, 1347, 1347,
/* 2130 */ 1343, 1343, 1343, 1343, 1343, 500, 1343, 1343, 1343, 1613, /* 2130 */ 1347, 1347, 1347, 1347, 1347, 502, 1347, 1347, 1347, 1617,
/* 2140 */ 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, /* 2140 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 2150 */ 1343, 1343, 1343, 1343, 1343, 1343, 1670, 1343, 1343, 260, /* 2150 */ 1347, 1347, 1347, 1347, 1347, 1347, 1675, 1347, 1347, 261,
/* 2160 */ 1643, 503, 1645, 1646, 499, 1343, 520, /* 2160 */ 1647, 505, 1649, 1650, 501, 1347, 522,
}; };
static const YYCODETYPE yy_lookahead[] = { static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 244, 251, 246, 247, 244, 248, 246, 247, 290, 321, /* 0 */ 244, 251, 246, 247, 244, 248, 246, 247, 290, 321,
...@@ -459,7 +459,7 @@ static const YYCODETYPE yy_lookahead[] = { ...@@ -459,7 +459,7 @@ static const YYCODETYPE yy_lookahead[] = {
/* 240 */ 192, 193, 194, 195, 0, 217, 218, 219, 220, 221, /* 240 */ 192, 193, 194, 195, 0, 217, 218, 219, 220, 221,
/* 250 */ 4, 80, 156, 12, 13, 14, 15, 16, 208, 196, /* 250 */ 4, 80, 156, 12, 13, 14, 15, 16, 208, 196,
/* 260 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 165, /* 260 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 165,
/* 270 */ 166, 248, 57, 169, 178, 179, 238, 181, 182, 183, /* 270 */ 166, 248, 4, 169, 178, 179, 238, 181, 182, 183,
/* 280 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, /* 280 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
/* 290 */ 194, 195, 12, 13, 12, 13, 14, 15, 16, 276, /* 290 */ 194, 195, 12, 13, 12, 13, 14, 15, 16, 276,
/* 300 */ 20, 0, 22, 208, 60, 61, 62, 63, 208, 65, /* 300 */ 20, 0, 22, 208, 60, 61, 62, 63, 208, 65,
...@@ -470,141 +470,141 @@ static const YYCODETYPE yy_lookahead[] = { ...@@ -470,141 +470,141 @@ static const YYCODETYPE yy_lookahead[] = {
/* 350 */ 22, 328, 329, 330, 331, 277, 333, 2, 57, 269, /* 350 */ 22, 328, 329, 330, 331, 277, 333, 2, 57, 269,
/* 360 */ 80, 12, 13, 14, 15, 16, 276, 12, 13, 14, /* 360 */ 80, 12, 13, 14, 15, 16, 276, 12, 13, 14,
/* 370 */ 15, 16, 312, 143, 336, 47, 286, 0, 261, 208, /* 370 */ 15, 16, 312, 143, 336, 47, 286, 0, 261, 208,
/* 380 */ 290, 3, 102, 293, 42, 43, 269, 349, 12, 13, /* 380 */ 290, 57, 102, 293, 42, 43, 269, 349, 12, 13,
/* 390 */ 151, 353, 64, 113, 277, 20, 20, 307, 22, 20, /* 390 */ 151, 353, 64, 113, 277, 20, 20, 307, 22, 3,
/* 400 */ 310, 311, 312, 313, 314, 315, 245, 317, 80, 248, /* 400 */ 310, 311, 312, 313, 314, 315, 245, 317, 80, 248,
/* 410 */ 171, 172, 93, 94, 95, 96, 97, 98, 99, 100, /* 410 */ 171, 172, 93, 94, 95, 96, 97, 98, 99, 100,
/* 420 */ 101, 102, 103, 47, 105, 106, 107, 108, 109, 110, /* 420 */ 101, 102, 103, 47, 105, 106, 107, 108, 109, 110,
/* 430 */ 102, 12, 13, 14, 15, 16, 156, 60, 61, 269, /* 430 */ 102, 12, 13, 14, 15, 16, 156, 60, 61, 91,
/* 440 */ 64, 113, 65, 213, 214, 68, 69, 277, 248, 72, /* 440 */ 64, 113, 65, 213, 214, 68, 69, 0, 248, 72,
/* 450 */ 73, 74, 20, 55, 208, 80, 80, 308, 178, 179, /* 450 */ 73, 74, 20, 241, 208, 80, 80, 308, 178, 179,
/* 460 */ 260, 181, 182, 183, 184, 185, 186, 187, 188, 189, /* 460 */ 260, 181, 182, 183, 184, 185, 186, 187, 188, 189,
/* 470 */ 190, 191, 192, 193, 194, 195, 276, 79, 102, 14, /* 470 */ 190, 191, 192, 193, 194, 195, 276, 209, 102, 14,
/* 480 */ 82, 332, 60, 61, 156, 20, 241, 65, 208, 113, /* 480 */ 14, 332, 60, 61, 156, 20, 20, 65, 208, 113,
/* 490 */ 68, 69, 269, 296, 72, 73, 74, 148, 275, 91, /* 490 */ 68, 69, 269, 296, 72, 73, 74, 148, 275, 44,
/* 500 */ 81, 22, 241, 280, 75, 248, 178, 179, 273, 181, /* 500 */ 81, 22, 290, 280, 57, 248, 178, 179, 273, 181,
/* 510 */ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, /* 510 */ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
/* 520 */ 192, 193, 194, 195, 145, 290, 47, 12, 13, 14, /* 520 */ 192, 193, 194, 195, 55, 290, 47, 12, 13, 14,
/* 530 */ 15, 16, 156, 336, 245, 290, 269, 248, 286, 241, /* 530 */ 15, 16, 156, 336, 245, 80, 269, 248, 14, 241,
/* 540 */ 305, 306, 307, 64, 292, 241, 349, 280, 119, 120, /* 540 */ 305, 306, 307, 64, 20, 75, 349, 280, 79, 241,
/* 550 */ 353, 290, 317, 296, 178, 179, 241, 181, 182, 183, /* 550 */ 353, 82, 317, 296, 178, 179, 241, 181, 182, 183,
/* 560 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, /* 560 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
/* 570 */ 194, 195, 12, 13, 18, 248, 20, 145, 229, 253, /* 570 */ 194, 195, 12, 13, 18, 248, 20, 145, 229, 253,
/* 580 */ 20, 102, 22, 27, 269, 248, 30, 260, 290, 255, /* 580 */ 20, 102, 22, 27, 269, 248, 30, 260, 290, 119,
/* 590 */ 256, 276, 113, 336, 290, 241, 33, 260, 241, 241, /* 590 */ 120, 276, 113, 336, 269, 241, 33, 260, 290, 308,
/* 600 */ 274, 286, 224, 276, 48, 290, 349, 47, 45, 248, /* 600 */ 274, 286, 277, 276, 48, 290, 349, 47, 45, 248,
/* 610 */ 353, 296, 241, 276, 51, 52, 53, 54, 55, 35, /* 610 */ 353, 296, 241, 276, 51, 52, 53, 54, 55, 35,
/* 620 */ 20, 260, 307, 4, 64, 310, 311, 312, 313, 314, /* 620 */ 224, 260, 307, 332, 64, 310, 311, 312, 313, 314,
/* 630 */ 315, 248, 317, 79, 20, 156, 22, 276, 248, 0, /* 630 */ 315, 248, 317, 79, 20, 156, 22, 276, 248, 21,
/* 640 */ 80, 87, 79, 260, 290, 82, 241, 290, 290, 255, /* 640 */ 80, 87, 79, 260, 290, 82, 241, 182, 182, 1,
/* 650 */ 256, 336, 20, 1, 2, 285, 286, 178, 179, 276, /* 650 */ 2, 336, 34, 241, 255, 256, 37, 178, 179, 276,
/* 660 */ 145, 290, 102, 49, 349, 241, 276, 83, 353, 85, /* 660 */ 145, 290, 102, 49, 349, 241, 276, 83, 353, 85,
/* 670 */ 86, 37, 88, 113, 118, 241, 92, 121, 122, 123, /* 670 */ 86, 20, 88, 113, 118, 241, 92, 121, 122, 123,
/* 680 */ 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, /* 680 */ 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
/* 690 */ 134, 135, 136, 137, 138, 290, 57, 248, 248, 115, /* 690 */ 134, 135, 136, 137, 138, 290, 20, 248, 248, 115,
/* 700 */ 248, 147, 41, 140, 314, 142, 0, 144, 248, 260, /* 700 */ 248, 147, 290, 140, 314, 142, 0, 144, 248, 260,
/* 710 */ 260, 241, 260, 139, 290, 241, 156, 241, 241, 329, /* 710 */ 260, 20, 260, 139, 290, 241, 156, 241, 241, 329,
/* 720 */ 330, 331, 21, 333, 290, 276, 276, 164, 276, 241, /* 720 */ 330, 331, 41, 333, 290, 276, 276, 164, 276, 81,
/* 730 */ 241, 241, 241, 81, 160, 34, 276, 241, 178, 179, /* 730 */ 241, 241, 241, 241, 160, 41, 276, 241, 178, 179,
/* 740 */ 92, 181, 182, 183, 184, 185, 186, 187, 188, 189, /* 740 */ 20, 181, 182, 183, 184, 185, 186, 187, 188, 189,
/* 750 */ 190, 191, 192, 193, 194, 195, 248, 41, 269, 248, /* 750 */ 190, 191, 192, 193, 194, 195, 248, 262, 269, 248,
/* 760 */ 290, 241, 276, 115, 290, 276, 290, 290, 260, 283, /* 760 */ 265, 241, 241, 241, 290, 276, 290, 290, 260, 276,
/* 770 */ 196, 260, 42, 43, 314, 286, 206, 207, 290, 290, /* 770 */ 196, 260, 255, 256, 314, 286, 283, 42, 43, 290,
/* 780 */ 290, 290, 14, 308, 276, 296, 290, 276, 20, 329, /* 780 */ 290, 290, 290, 241, 276, 296, 290, 276, 286, 329,
/* 790 */ 330, 331, 262, 333, 0, 265, 307, 81, 92, 310, /* 790 */ 330, 331, 0, 333, 292, 257, 307, 259, 92, 310,
/* 800 */ 311, 312, 313, 314, 315, 241, 317, 332, 84, 320, /* 800 */ 311, 312, 313, 314, 315, 241, 317, 92, 41, 320,
/* 810 */ 290, 87, 84, 324, 325, 87, 84, 111, 112, 87, /* 810 */ 290, 290, 290, 324, 325, 285, 286, 111, 112, 0,
/* 820 */ 114, 115, 116, 0, 257, 336, 259, 84, 209, 14, /* 820 */ 114, 115, 116, 206, 207, 336, 207, 64, 84, 0,
/* 830 */ 87, 0, 41, 269, 0, 20, 167, 168, 349, 45, /* 830 */ 115, 87, 290, 269, 167, 168, 145, 45, 349, 270,
/* 840 */ 276, 207, 353, 41, 18, 22, 41, 145, 146, 23, /* 840 */ 276, 22, 353, 84, 18, 0, 87, 270, 81, 23,
/* 850 */ 286, 1, 2, 22, 290, 44, 22, 193, 194, 41, /* 850 */ 286, 22, 84, 84, 290, 87, 87, 41, 182, 41,
/* 860 */ 296, 35, 36, 41, 64, 39, 241, 270, 41, 270, /* 860 */ 296, 35, 36, 145, 146, 39, 241, 22, 41, 1,
/* 870 */ 41, 307, 81, 270, 310, 311, 312, 313, 314, 315, /* 870 */ 2, 307, 193, 194, 310, 311, 312, 313, 314, 315,
/* 880 */ 4, 317, 56, 81, 320, 41, 81, 226, 324, 325, /* 880 */ 4, 317, 56, 41, 320, 41, 270, 41, 324, 325,
/* 890 */ 41, 80, 80, 41, 269, 19, 270, 270, 242, 81, /* 890 */ 41, 270, 80, 41, 269, 19, 270, 81, 299, 81,
/* 900 */ 336, 276, 90, 299, 41, 47, 80, 47, 81, 33, /* 900 */ 336, 276, 90, 242, 41, 47, 80, 226, 81, 33,
/* 910 */ 81, 286, 41, 349, 356, 290, 0, 353, 258, 241, /* 910 */ 258, 286, 41, 349, 47, 290, 0, 353, 356, 241,
/* 920 */ 41, 45, 41, 347, 303, 81, 50, 41, 341, 247, /* 920 */ 41, 45, 228, 81, 341, 81, 50, 81, 347, 269,
/* 930 */ 81, 55, 307, 81, 249, 310, 311, 312, 313, 314, /* 930 */ 81, 55, 307, 81, 303, 310, 311, 312, 313, 314,
/* 940 */ 315, 41, 317, 117, 81, 320, 41, 269, 269, 324, /* 940 */ 315, 41, 317, 117, 81, 320, 41, 269, 247, 324,
/* 950 */ 325, 326, 81, 279, 276, 79, 309, 334, 82, 350, /* 950 */ 325, 326, 81, 249, 276, 79, 279, 334, 82, 309,
/* 960 */ 81, 47, 81, 338, 286, 350, 350, 81, 290, 344, /* 960 */ 81, 350, 350, 338, 286, 41, 337, 20, 290, 344,
/* 970 */ 345, 113, 241, 113, 148, 149, 150, 337, 64, 153, /* 970 */ 345, 113, 241, 41, 148, 149, 150, 350, 41, 153,
/* 980 */ 20, 81, 248, 45, 158, 307, 81, 304, 310, 311, /* 980 */ 113, 81, 248, 45, 158, 307, 81, 47, 310, 311,
/* 990 */ 312, 313, 314, 315, 47, 317, 170, 255, 248, 173, /* 990 */ 312, 313, 314, 315, 304, 317, 170, 47, 255, 173,
/* 1000 */ 269, 175, 176, 177, 297, 154, 248, 276, 92, 40, /* 1000 */ 269, 175, 176, 177, 64, 81, 297, 276, 92, 154,
/* 1010 */ 284, 139, 248, 20, 243, 282, 243, 286, 282, 20, /* 1010 */ 248, 40, 248, 81, 284, 282, 139, 286, 81, 282,
/* 1020 */ 301, 290, 253, 286, 20, 253, 348, 111, 112, 294, /* 1020 */ 248, 290, 20, 243, 243, 20, 348, 111, 112, 301,
/* 1030 */ 114, 115, 116, 253, 208, 276, 20, 253, 307, 0, /* 1030 */ 114, 115, 116, 286, 208, 253, 253, 20, 307, 0,
/* 1040 */ 287, 310, 311, 312, 313, 314, 315, 241, 317, 253, /* 1040 */ 294, 310, 311, 312, 313, 314, 315, 241, 317, 253,
/* 1050 */ 228, 320, 248, 243, 253, 324, 325, 326, 269, 269, /* 1050 */ 276, 320, 20, 287, 253, 324, 325, 326, 253, 248,
/* 1060 */ 21, 269, 269, 24, 25, 26, 27, 28, 29, 30, /* 1060 */ 21, 253, 269, 24, 25, 26, 27, 28, 29, 30,
/* 1070 */ 31, 32, 269, 248, 64, 269, 345, 269, 269, 243, /* 1070 */ 31, 32, 269, 243, 243, 269, 345, 64, 269, 269,
/* 1080 */ 241, 251, 276, 269, 301, 269, 269, 290, 269, 163, /* 1080 */ 241, 248, 276, 269, 269, 290, 269, 301, 251, 269,
/* 1090 */ 20, 251, 286, 286, 251, 300, 290, 276, 251, 216, /* 1090 */ 269, 269, 286, 269, 163, 20, 290, 300, 251, 286,
/* 1100 */ 346, 346, 215, 223, 343, 342, 222, 294, 269, 211, /* 1100 */ 309, 294, 251, 216, 276, 251, 346, 215, 269, 223,
/* 1110 */ 290, 287, 210, 307, 340, 276, 310, 311, 312, 313, /* 1110 */ 287, 346, 222, 307, 343, 276, 310, 311, 312, 313,
/* 1120 */ 314, 315, 290, 317, 291, 286, 320, 339, 291, 290, /* 1120 */ 314, 315, 290, 317, 290, 286, 320, 291, 290, 290,
/* 1130 */ 324, 325, 326, 276, 207, 290, 20, 309, 40, 227, /* 1130 */ 324, 325, 326, 211, 291, 210, 342, 207, 340, 339,
/* 1140 */ 225, 335, 241, 308, 357, 80, 307, 230, 142, 310, /* 1140 */ 276, 335, 241, 20, 40, 227, 307, 230, 308, 310,
/* 1150 */ 311, 312, 313, 314, 315, 291, 317, 290, 290, 320, /* 1150 */ 311, 312, 313, 314, 315, 351, 317, 291, 225, 320,
/* 1160 */ 291, 288, 287, 324, 325, 326, 276, 290, 327, 251, /* 1160 */ 80, 291, 327, 324, 325, 326, 142, 276, 290, 265,
/* 1170 */ 269, 265, 251, 276, 335, 80, 272, 276, 323, 259, /* 1170 */ 269, 290, 290, 288, 335, 287, 80, 276, 251, 323,
/* 1180 */ 248, 251, 243, 298, 302, 263, 295, 286, 263, 252, /* 1180 */ 251, 272, 357, 276, 248, 259, 251, 286, 243, 0,
/* 1190 */ 352, 290, 263, 351, 0, 239, 241, 0, 352, 351, /* 1190 */ 295, 290, 298, 352, 252, 302, 241, 263, 239, 0,
/* 1200 */ 72, 0, 47, 174, 351, 241, 352, 47, 307, 47, /* 1200 */ 352, 351, 263, 72, 351, 241, 263, 0, 307, 352,
/* 1210 */ 47, 310, 311, 312, 313, 314, 315, 174, 317, 0, /* 1210 */ 47, 310, 311, 312, 313, 314, 315, 174, 317, 47,
/* 1220 */ 47, 320, 47, 174, 269, 324, 325, 326, 0, 47, /* 1220 */ 47, 320, 47, 174, 269, 324, 325, 326, 0, 47,
/* 1230 */ 0, 276, 47, 269, 0, 47, 335, 0, 80, 160, /* 1230 */ 47, 276, 0, 269, 174, 47, 335, 0, 47, 0,
/* 1240 */ 276, 286, 159, 113, 156, 290, 152, 151, 0, 0, /* 1240 */ 276, 286, 47, 0, 80, 290, 160, 159, 113, 156,
/* 1250 */ 286, 0, 0, 44, 290, 0, 0, 0, 0, 241, /* 1250 */ 286, 0, 0, 152, 290, 0, 151, 0, 44, 241,
/* 1260 */ 296, 0, 307, 0, 0, 310, 311, 312, 313, 314, /* 1260 */ 296, 0, 307, 0, 0, 310, 311, 312, 313, 314,
/* 1270 */ 315, 307, 317, 0, 310, 311, 312, 313, 314, 315, /* 1270 */ 315, 307, 317, 0, 310, 311, 312, 313, 314, 315,
/* 1280 */ 0, 317, 0, 0, 0, 0, 0, 269, 0, 0, /* 1280 */ 0, 317, 0, 0, 0, 0, 0, 269, 0, 0,
/* 1290 */ 0, 0, 0, 40, 276, 0, 0, 0, 0, 241, /* 1290 */ 0, 0, 0, 0, 276, 0, 0, 0, 40, 241,
/* 1300 */ 336, 0, 0, 22, 286, 0, 0, 0, 290, 40, /* 1300 */ 336, 0, 0, 0, 286, 0, 0, 0, 290, 22,
/* 1310 */ 355, 0, 0, 349, 37, 41, 44, 353, 241, 44, /* 1310 */ 355, 0, 0, 349, 0, 0, 0, 353, 241, 40,
/* 1320 */ 0, 0, 14, 0, 14, 307, 0, 269, 310, 311, /* 1320 */ 0, 44, 41, 45, 14, 307, 0, 269, 310, 311,
/* 1330 */ 312, 313, 314, 315, 276, 317, 0, 38, 320, 45, /* 1330 */ 312, 313, 314, 315, 276, 317, 37, 14, 320, 45,
/* 1340 */ 37, 37, 324, 325, 286, 0, 269, 0, 290, 0, /* 1340 */ 0, 37, 324, 325, 286, 0, 269, 0, 290, 0,
/* 1350 */ 0, 37, 59, 276, 37, 0, 0, 0, 0, 37, /* 1350 */ 0, 38, 44, 276, 37, 0, 0, 59, 37, 0,
/* 1360 */ 47, 45, 47, 286, 37, 307, 47, 290, 310, 311, /* 1360 */ 0, 37, 37, 286, 37, 307, 47, 290, 310, 311,
/* 1370 */ 312, 313, 314, 315, 241, 317, 45, 47, 320, 45, /* 1370 */ 312, 313, 314, 315, 241, 317, 47, 47, 320, 45,
/* 1380 */ 0, 0, 324, 325, 307, 47, 0, 310, 311, 312, /* 1380 */ 47, 45, 324, 325, 307, 0, 0, 310, 311, 312,
/* 1390 */ 313, 314, 315, 316, 317, 318, 319, 22, 47, 47, /* 1390 */ 313, 314, 315, 316, 317, 318, 319, 0, 0, 47,
/* 1400 */ 47, 47, 269, 19, 41, 0, 41, 89, 47, 276, /* 1400 */ 22, 0, 269, 19, 47, 47, 41, 89, 47, 276,
/* 1410 */ 22, 87, 0, 47, 47, 22, 48, 33, 0, 286, /* 1410 */ 47, 41, 0, 47, 47, 87, 22, 33, 47, 286,
/* 1420 */ 22, 47, 0, 290, 22, 0, 22, 20, 0, 45, /* 1420 */ 48, 22, 0, 290, 0, 22, 47, 0, 22, 45,
/* 1430 */ 47, 0, 145, 241, 0, 51, 52, 53, 54, 55, /* 1430 */ 0, 22, 0, 241, 20, 51, 52, 53, 54, 55,
/* 1440 */ 307, 22, 142, 310, 311, 312, 313, 314, 315, 0, /* 1440 */ 307, 0, 47, 310, 311, 312, 313, 314, 315, 0,
/* 1450 */ 317, 0, 80, 320, 37, 41, 41, 212, 325, 81, /* 1450 */ 317, 22, 0, 320, 0, 80, 37, 41, 325, 41,
/* 1460 */ 81, 269, 41, 79, 41, 80, 82, 80, 276, 140, /* 1460 */ 212, 269, 81, 79, 41, 44, 82, 145, 276, 81,
/* 1470 */ 80, 44, 81, 145, 80, 2, 41, 212, 286, 41, /* 1470 */ 80, 80, 80, 206, 81, 41, 145, 142, 286, 44,
/* 1480 */ 81, 81, 290, 44, 206, 293, 161, 241, 44, 81, /* 1480 */ 80, 140, 290, 41, 212, 293, 81, 241, 81, 44,
/* 1490 */ 81, 12, 13, 41, 47, 47, 41, 47, 44, 307, /* 1490 */ 44, 12, 13, 161, 41, 47, 81, 41, 81, 307,
/* 1500 */ 116, 22, 310, 311, 312, 313, 314, 315, 47, 317, /* 1500 */ 116, 22, 310, 311, 312, 313, 314, 315, 47, 317,
/* 1510 */ 47, 47, 80, 178, 81, 269, 44, 241, 81, 22, /* 1510 */ 47, 47, 212, 47, 47, 269, 2, 241, 41, 81,
/* 1520 */ 80, 80, 276, 180, 81, 141, 47, 81, 144, 0, /* 1520 */ 178, 81, 276, 80, 44, 141, 47, 80, 144, 44,
/* 1530 */ 37, 44, 286, 80, 44, 143, 290, 80, 80, 80, /* 1530 */ 80, 22, 286, 180, 0, 80, 290, 37, 81, 81,
/* 1540 */ 80, 140, 80, 64, 212, 269, 162, 81, 164, 80, /* 1540 */ 80, 90, 80, 64, 22, 269, 162, 143, 164, 80,
/* 1550 */ 241, 80, 276, 307, 22, 90, 310, 311, 312, 313, /* 1550 */ 241, 140, 276, 307, 80, 44, 310, 311, 312, 313,
/* 1560 */ 314, 315, 286, 317, 47, 319, 290, 91, 47, 293, /* 1560 */ 314, 315, 286, 317, 44, 319, 290, 80, 80, 293,
/* 1570 */ 81, 80, 47, 81, 80, 47, 81, 81, 269, 80, /* 1570 */ 81, 80, 91, 81, 47, 47, 80, 47, 269, 81,
/* 1580 */ 241, 102, 47, 307, 80, 276, 310, 311, 312, 313, /* 1580 */ 241, 102, 80, 307, 81, 276, 310, 311, 312, 313,
/* 1590 */ 314, 315, 113, 317, 81, 286, 47, 22, 80, 290, /* 1590 */ 314, 315, 113, 317, 47, 286, 81, 80, 47, 290,
/* 1600 */ 92, 47, 293, 80, 104, 47, 104, 104, 269, 104, /* 1600 */ 81, 80, 293, 47, 80, 22, 47, 113, 269, 104,
/* 1610 */ 241, 80, 248, 80, 22, 276, 307, 64, 59, 310, /* 1610 */ 241, 104, 248, 80, 104, 276, 307, 104, 92, 310,
/* 1620 */ 311, 312, 313, 314, 315, 286, 317, 113, 58, 290, /* 1620 */ 311, 312, 313, 314, 315, 286, 317, 47, 80, 290,
/* 1630 */ 78, 41, 47, 47, 47, 156, 47, 22, 269, 0, /* 1630 */ 80, 22, 59, 58, 64, 156, 78, 41, 269, 47,
/* 1640 */ 276, 47, 47, 47, 64, 276, 307, 47, 47, 310, /* 1640 */ 276, 47, 47, 22, 47, 276, 307, 47, 47, 310,
/* 1650 */ 311, 312, 313, 314, 315, 286, 317, 178, 47, 290, /* 1650 */ 311, 312, 313, 314, 315, 286, 317, 178, 47, 290,
/* 1660 */ 296, 241, 37, 47, 47, 47, 47, 47, 189, 190, /* 1660 */ 296, 241, 64, 47, 47, 47, 47, 47, 189, 190,
/* 1670 */ 191, 0, 45, 37, 45, 47, 307, 241, 314, 310, /* 1670 */ 191, 47, 47, 0, 47, 45, 307, 241, 314, 310,
/* 1680 */ 311, 312, 313, 314, 315, 0, 317, 47, 45, 269, /* 1680 */ 311, 312, 313, 314, 315, 37, 317, 0, 47, 269,
/* 1690 */ 37, 0, 47, 329, 330, 331, 276, 333, 37, 45, /* 1690 */ 45, 37, 0, 329, 330, 331, 276, 333, 47, 37,
/* 1700 */ 336, 0, 47, 46, 0, 269, 286, 0, 22, 21, /* 1700 */ 336, 0, 45, 45, 37, 269, 286, 47, 0, 46,
/* 1710 */ 290, 22, 276, 349, 22, 21, 20, 353, 358, 358, /* 1710 */ 290, 47, 276, 349, 0, 0, 22, 353, 21, 358,
/* 1720 */ 358, 358, 286, 358, 241, 358, 290, 307, 358, 358, /* 1720 */ 22, 22, 286, 21, 241, 20, 290, 307, 358, 358,
/* 1730 */ 310, 311, 312, 313, 314, 315, 358, 317, 358, 358, /* 1730 */ 310, 311, 312, 313, 314, 315, 358, 317, 358, 358,
/* 1740 */ 358, 358, 241, 307, 358, 358, 310, 311, 312, 313, /* 1740 */ 358, 358, 241, 307, 358, 358, 310, 311, 312, 313,
/* 1750 */ 314, 315, 269, 317, 358, 358, 358, 241, 358, 276, /* 1750 */ 314, 315, 269, 317, 358, 358, 358, 241, 358, 276,
...@@ -650,9 +650,9 @@ static const YYCODETYPE yy_lookahead[] = { ...@@ -650,9 +650,9 @@ static const YYCODETYPE yy_lookahead[] = {
/* 2150 */ 358, 358, 358, 358, 358, 358, 307, 358, 358, 310, /* 2150 */ 358, 358, 358, 358, 358, 358, 307, 358, 358, 310,
/* 2160 */ 311, 312, 313, 314, 315, 358, 317, /* 2160 */ 311, 312, 313, 314, 315, 358, 317,
}; };
#define YY_SHIFT_COUNT (602) #define YY_SHIFT_COUNT (604)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (1707) #define YY_SHIFT_MAX (1715)
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 826, 0, 0, 48, 96, 96, 96, 96, 280, 280, /* 0 */ 826, 0, 0, 48, 96, 96, 96, 96, 280, 280,
/* 10 */ 96, 96, 328, 376, 560, 376, 376, 376, 376, 376, /* 10 */ 96, 96, 328, 376, 560, 376, 376, 376, 376, 376,
...@@ -660,63 +660,63 @@ static const unsigned short int yy_shift_ofst[] = { ...@@ -660,63 +660,63 @@ static const unsigned short int yy_shift_ofst[] = {
/* 30 */ 376, 376, 376, 376, 376, 376, 376, 376, 95, 95, /* 30 */ 376, 376, 376, 376, 376, 376, 376, 376, 95, 95,
/* 40 */ 375, 375, 375, 1479, 1479, 1479, 100, 50, 171, 45, /* 40 */ 375, 375, 375, 1479, 1479, 1479, 100, 50, 171, 45,
/* 50 */ 45, 342, 342, 246, 171, 171, 45, 45, 45, 45, /* 50 */ 45, 342, 342, 246, 171, 171, 45, 45, 45, 45,
/* 60 */ 45, 45, 17, 45, 201, 323, 600, 201, 45, 45, /* 60 */ 45, 45, 17, 45, 201, 323, 651, 201, 45, 45,
/* 70 */ 201, 45, 201, 201, 600, 201, 45, 215, 556, 63, /* 70 */ 201, 45, 201, 201, 651, 201, 45, 324, 556, 63,
/* 80 */ 14, 14, 13, 479, 422, 479, 479, 479, 479, 479, /* 80 */ 14, 14, 13, 479, 422, 479, 479, 479, 479, 479,
/* 90 */ 479, 479, 479, 479, 479, 479, 479, 479, 479, 479, /* 90 */ 479, 479, 479, 479, 479, 479, 479, 479, 479, 479,
/* 100 */ 479, 479, 479, 479, 584, 614, 465, 465, 301, 281, /* 100 */ 479, 479, 479, 479, 584, 614, 524, 524, 301, 281,
/* 110 */ 379, 379, 379, 639, 281, 632, 600, 201, 201, 600, /* 110 */ 432, 432, 432, 447, 281, 720, 651, 201, 201, 651,
/* 120 */ 408, 800, 319, 319, 319, 319, 319, 319, 319, 1384, /* 120 */ 348, 763, 319, 319, 319, 319, 319, 319, 319, 1384,
/* 130 */ 1039, 377, 349, 28, 104, 230, 730, 102, 648, 432, /* 130 */ 1039, 377, 349, 28, 104, 230, 465, 466, 735, 102,
/* 140 */ 570, 634, 570, 768, 378, 378, 378, 619, 815, 960, /* 140 */ 715, 691, 617, 619, 617, 396, 396, 396, 268, 676,
/* 150 */ 938, 947, 851, 960, 960, 969, 872, 872, 960, 993, /* 150 */ 947, 938, 950, 855, 947, 947, 971, 877, 877, 947,
/* 160 */ 993, 999, 17, 600, 17, 1004, 17, 632, 1016, 17, /* 160 */ 1002, 1002, 1005, 17, 651, 17, 1017, 17, 720, 1032,
/* 170 */ 17, 960, 17, 993, 201, 201, 201, 201, 201, 201, /* 170 */ 17, 17, 947, 17, 1002, 201, 201, 201, 201, 201,
/* 180 */ 201, 201, 201, 201, 201, 960, 993, 1010, 999, 215, /* 180 */ 201, 201, 201, 201, 201, 201, 947, 1002, 1013, 1005,
/* 190 */ 926, 600, 215, 1004, 215, 632, 1016, 215, 1070, 883, /* 190 */ 324, 931, 651, 324, 1017, 324, 720, 1032, 324, 1075,
/* 200 */ 887, 1010, 883, 887, 1010, 1010, 880, 884, 898, 902, /* 200 */ 887, 892, 1013, 887, 892, 1013, 1013, 201, 886, 890,
/* 210 */ 927, 632, 1116, 1098, 912, 915, 917, 912, 915, 912, /* 210 */ 922, 925, 930, 720, 1123, 1104, 918, 933, 917, 918,
/* 220 */ 915, 1065, 201, 887, 1010, 1010, 887, 1010, 1006, 632, /* 220 */ 933, 918, 933, 1080, 892, 1013, 1013, 892, 1013, 1024,
/* 230 */ 1016, 215, 408, 215, 632, 1095, 800, 960, 215, 993, /* 230 */ 720, 1032, 324, 348, 324, 720, 1096, 763, 947, 324,
/* 240 */ 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 244, 563, /* 240 */ 1002, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 244,
/* 250 */ 141, 876, 706, 916, 241, 84, 355, 515, 419, 85, /* 250 */ 563, 141, 876, 706, 916, 241, 84, 355, 515, 419,
/* 260 */ 282, 282, 282, 282, 282, 282, 282, 282, 239, 398, /* 260 */ 85, 282, 282, 282, 282, 282, 282, 282, 282, 239,
/* 270 */ 429, 554, 652, 574, 36, 36, 36, 36, 794, 716, /* 270 */ 469, 470, 554, 648, 574, 36, 36, 36, 36, 792,
/* 280 */ 724, 728, 732, 743, 823, 831, 834, 701, 669, 702, /* 280 */ 767, 744, 759, 768, 769, 819, 829, 845, 618, 667,
/* 290 */ 791, 802, 805, 850, 664, 661, 822, 818, 145, 827, /* 290 */ 718, 816, 818, 827, 868, 679, 681, 694, 842, 145,
/* 300 */ 811, 829, 844, 849, 852, 863, 858, 860, 871, 879, /* 300 */ 844, 455, 846, 849, 852, 863, 871, 858, 867, 879,
/* 310 */ 881, 886, 900, 905, 812, 914, 1194, 1197, 1128, 1201, /* 310 */ 900, 905, 924, 932, 937, 812, 940, 1189, 1199, 1131,
/* 320 */ 1155, 1029, 1160, 1162, 1163, 1043, 1219, 1173, 1175, 1049, /* 320 */ 1207, 1163, 1043, 1172, 1173, 1175, 1049, 1228, 1182, 1183,
/* 330 */ 1228, 1182, 1230, 1185, 1234, 1188, 1237, 1158, 1079, 1083, /* 330 */ 1060, 1232, 1188, 1237, 1191, 1239, 1195, 1243, 1164, 1086,
/* 340 */ 1130, 1088, 1251, 1252, 1094, 1096, 1248, 1249, 1209, 1255, /* 340 */ 1088, 1135, 1093, 1251, 1252, 1101, 1105, 1255, 1257, 1214,
/* 350 */ 1256, 1257, 1258, 1261, 1263, 1264, 1273, 1280, 1282, 1283, /* 350 */ 1261, 1263, 1264, 1273, 1280, 1282, 1283, 1284, 1285, 1286,
/* 360 */ 1284, 1285, 1286, 1288, 1289, 1290, 1291, 1253, 1292, 1295, /* 360 */ 1288, 1289, 1290, 1291, 1292, 1293, 1295, 1296, 1258, 1297,
/* 370 */ 1296, 1297, 1298, 1301, 1281, 1302, 1305, 1306, 1307, 1311, /* 370 */ 1301, 1302, 1303, 1305, 1306, 1287, 1307, 1311, 1312, 1314,
/* 380 */ 1312, 1269, 1277, 1274, 1308, 1272, 1310, 1275, 1320, 1299, /* 380 */ 1315, 1316, 1279, 1299, 1281, 1310, 1277, 1323, 1308, 1320,
/* 390 */ 1303, 1321, 1323, 1326, 1336, 1304, 1345, 1293, 1347, 1349, /* 390 */ 1313, 1304, 1326, 1345, 1347, 1349, 1317, 1350, 1298, 1355,
/* 400 */ 1313, 1294, 1314, 1350, 1315, 1316, 1317, 1355, 1319, 1331, /* 400 */ 1356, 1319, 1278, 1321, 1359, 1329, 1294, 1324, 1340, 1330,
/* 410 */ 1322, 1356, 1330, 1334, 1327, 1357, 1358, 1380, 1381, 1318, /* 410 */ 1334, 1325, 1360, 1333, 1336, 1327, 1385, 1386, 1397, 1398,
/* 420 */ 1324, 1338, 1375, 1386, 1351, 1352, 1353, 1354, 1363, 1365, /* 420 */ 1318, 1328, 1352, 1378, 1401, 1357, 1358, 1361, 1363, 1365,
/* 430 */ 1361, 1366, 1367, 1405, 1388, 1412, 1393, 1368, 1418, 1398, /* 430 */ 1370, 1366, 1367, 1371, 1412, 1394, 1424, 1399, 1372, 1422,
/* 440 */ 1374, 1422, 1402, 1425, 1404, 1407, 1428, 1287, 1383, 1431, /* 440 */ 1403, 1379, 1427, 1406, 1430, 1409, 1414, 1432, 1322, 1395,
/* 450 */ 1325, 1419, 1328, 1300, 1434, 1449, 1451, 1372, 1417, 1329, /* 450 */ 1441, 1332, 1429, 1331, 1335, 1449, 1452, 1454, 1375, 1419,
/* 460 */ 1414, 1415, 1245, 1378, 1421, 1379, 1385, 1387, 1390, 1391, /* 460 */ 1341, 1416, 1418, 1248, 1381, 1423, 1388, 1390, 1391, 1392,
/* 470 */ 1423, 1427, 1394, 1435, 1265, 1399, 1400, 1439, 1278, 1438, /* 470 */ 1393, 1434, 1421, 1435, 1400, 1442, 1272, 1405, 1407, 1445,
/* 480 */ 1444, 1408, 1452, 1332, 1409, 1447, 1448, 1450, 1461, 1463, /* 480 */ 1267, 1453, 1446, 1415, 1456, 1300, 1417, 1448, 1461, 1463,
/* 490 */ 1464, 1409, 1473, 1335, 1455, 1433, 1432, 1437, 1454, 1440, /* 490 */ 1464, 1466, 1467, 1417, 1514, 1342, 1477, 1438, 1443, 1440,
/* 500 */ 1441, 1472, 1497, 1343, 1453, 1443, 1446, 1457, 1458, 1392, /* 500 */ 1480, 1447, 1450, 1485, 1509, 1353, 1455, 1457, 1458, 1460,
/* 510 */ 1459, 1529, 1493, 1401, 1460, 1465, 1487, 1490, 1462, 1466, /* 510 */ 1462, 1404, 1469, 1534, 1500, 1411, 1474, 1451, 1511, 1520,
/* 520 */ 1469, 1532, 1471, 1476, 1489, 1517, 1521, 1491, 1492, 1525, /* 520 */ 1487, 1489, 1488, 1522, 1491, 1481, 1492, 1527, 1528, 1496,
/* 530 */ 1494, 1495, 1528, 1499, 1496, 1535, 1504, 1513, 1549, 1518, /* 530 */ 1498, 1530, 1502, 1503, 1547, 1517, 1515, 1551, 1521, 1519,
/* 540 */ 1500, 1502, 1503, 1505, 1575, 1508, 1523, 1531, 1554, 1533, /* 540 */ 1556, 1524, 1505, 1507, 1510, 1513, 1583, 1526, 1533, 1548,
/* 550 */ 1514, 1558, 1592, 1559, 1570, 1553, 1552, 1590, 1585, 1586, /* 550 */ 1559, 1550, 1494, 1580, 1609, 1573, 1575, 1570, 1558, 1596,
/* 560 */ 1587, 1589, 1594, 1615, 1595, 1596, 1580, 1363, 1600, 1365, /* 560 */ 1592, 1594, 1595, 1597, 1600, 1621, 1601, 1611, 1598, 1365,
/* 570 */ 1601, 1611, 1616, 1617, 1618, 1619, 1639, 1620, 1627, 1625, /* 570 */ 1616, 1370, 1617, 1618, 1619, 1620, 1624, 1625, 1673, 1627,
/* 580 */ 1671, 1628, 1629, 1636, 1685, 1640, 1643, 1653, 1691, 1645, /* 580 */ 1630, 1648, 1687, 1641, 1645, 1654, 1692, 1651, 1657, 1662,
/* 590 */ 1654, 1661, 1701, 1655, 1657, 1704, 1707, 1686, 1688, 1689, /* 590 */ 1701, 1660, 1658, 1667, 1708, 1664, 1663, 1714, 1715, 1694,
/* 600 */ 1692, 1694, 1696, /* 600 */ 1697, 1698, 1699, 1702, 1705,
}; };
#define YY_REDUCE_COUNT (247) #define YY_REDUCE_COUNT (248)
#define YY_REDUCE_MIN (-317) #define YY_REDUCE_MIN (-317)
#define YY_REDUCE_MAX (1849) #define YY_REDUCE_MAX (1849)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
...@@ -728,86 +728,86 @@ static const short yy_reduce_ofst[] = { ...@@ -728,86 +728,86 @@ static const short yy_reduce_ofst[] = {
/* 50 */ -112, -244, -240, -317, -202, -190, -243, 200, 327, 361, /* 50 */ -112, -244, -240, -317, -202, -190, -243, 200, 327, 361,
/* 60 */ 383, 449, -152, 450, -221, 60, -64, -144, 337, 452, /* 60 */ 383, 449, -152, 450, -221, 60, -64, -144, 337, 452,
/* 70 */ 55, 508, 78, 223, 47, 117, 511, -250, -177, -312, /* 70 */ 55, 508, 78, 223, 47, 117, 511, -250, -177, -312,
/* 80 */ -312, -312, -113, 245, -34, 261, 298, 304, 354, 357, /* 80 */ -312, -312, -113, 212, -34, 298, 308, 354, 371, 405,
/* 90 */ 358, 371, 405, 424, 434, 470, 474, 476, 477, 488, /* 90 */ 412, 424, 434, 474, 476, 477, 490, 491, 492, 496,
/* 100 */ 490, 491, 496, 520, 70, -139, 161, 289, 326, 334, /* 100 */ 520, 521, 522, 542, 70, -139, 161, 289, 326, 399,
/* 110 */ -277, 149, 475, -114, 394, 486, 252, 170, 267, 370, /* 110 */ -277, 149, 291, -114, 517, 493, 502, 325, 267, 530,
/* 120 */ 530, 567, -259, -255, 597, 599, 603, 626, 627, 604, /* 120 */ 495, 538, -259, -255, 569, 577, 616, 621, 626, 599,
/* 130 */ 656, 660, 558, 576, 621, 587, 682, 685, 674, 647, /* 130 */ 661, 652, 562, 581, 631, 583, 660, 660, 701, 704,
/* 140 */ 623, 623, 623, 679, 609, 615, 616, 640, 679, 734, /* 140 */ 677, 650, 623, 623, 623, 611, 612, 627, 629, 660,
/* 150 */ 683, 742, 707, 750, 758, 726, 733, 736, 764, 771, /* 150 */ 734, 690, 743, 709, 762, 764, 730, 733, 737, 772,
/* 160 */ 773, 719, 769, 737, 772, 735, 780, 759, 753, 784, /* 160 */ 780, 781, 728, 782, 747, 783, 746, 796, 774, 766,
/* 170 */ 796, 804, 801, 810, 789, 790, 792, 793, 803, 808, /* 170 */ 801, 805, 811, 808, 830, 793, 803, 809, 810, 814,
/* 180 */ 809, 814, 816, 817, 819, 825, 836, 797, 783, 830, /* 180 */ 815, 817, 820, 821, 822, 824, 833, 831, 795, 786,
/* 190 */ 795, 807, 840, 813, 843, 821, 824, 847, 828, 754, /* 190 */ 837, 797, 813, 847, 807, 851, 828, 823, 854, 791,
/* 200 */ 833, 820, 755, 837, 832, 845, 761, 763, 774, 788, /* 200 */ 760, 836, 832, 765, 843, 834, 838, 660, 771, 794,
/* 210 */ 623, 857, 835, 841, 838, 842, 787, 846, 848, 854, /* 210 */ 798, 800, 623, 864, 840, 835, 841, 804, 825, 848,
/* 220 */ 853, 855, 679, 864, 867, 868, 869, 877, 873, 890, /* 220 */ 850, 857, 853, 856, 866, 878, 881, 870, 882, 885,
/* 230 */ 875, 918, 906, 921, 897, 904, 920, 932, 930, 939, /* 230 */ 891, 888, 927, 904, 929, 907, 909, 926, 936, 935,
/* 240 */ 885, 882, 891, 922, 925, 929, 937, 956, /* 240 */ 945, 894, 893, 895, 934, 939, 943, 942, 959,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 0 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 10 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 10 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 20 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 20 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 30 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 30 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 40 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 40 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 50 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 50 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 60 */ 1341, 1341, 1410, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 60 */ 1345, 1345, 1414, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 70 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1408, 1548, 1341, /* 70 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1412, 1552, 1345,
/* 80 */ 1712, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 80 */ 1717, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 90 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 90 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 100 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1410, 1341, /* 100 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1414, 1345,
/* 110 */ 1723, 1723, 1723, 1408, 1341, 1341, 1341, 1341, 1341, 1341, /* 110 */ 1728, 1728, 1728, 1412, 1345, 1345, 1345, 1345, 1345, 1345,
/* 120 */ 1503, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1586, /* 120 */ 1507, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1590,
/* 130 */ 1341, 1341, 1789, 1341, 1592, 1747, 1341, 1341, 1456, 1739, /* 130 */ 1345, 1345, 1794, 1345, 1596, 1752, 1345, 1345, 1345, 1345,
/* 140 */ 1715, 1729, 1716, 1341, 1774, 1774, 1774, 1732, 1341, 1341, /* 140 */ 1460, 1744, 1720, 1734, 1721, 1779, 1779, 1779, 1737, 1345,
/* 150 */ 1341, 1341, 1578, 1341, 1341, 1553, 1550, 1550, 1341, 1341, /* 150 */ 1345, 1345, 1345, 1582, 1345, 1345, 1557, 1554, 1554, 1345,
/* 160 */ 1341, 1341, 1410, 1341, 1410, 1341, 1410, 1341, 1341, 1410, /* 160 */ 1345, 1345, 1345, 1414, 1345, 1414, 1345, 1414, 1345, 1345,
/* 170 */ 1410, 1341, 1410, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 170 */ 1414, 1414, 1345, 1414, 1345, 1345, 1345, 1345, 1345, 1345,
/* 180 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1408, /* 180 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 190 */ 1588, 1341, 1408, 1341, 1408, 1341, 1341, 1408, 1341, 1754, /* 190 */ 1412, 1592, 1345, 1412, 1345, 1412, 1345, 1345, 1412, 1345,
/* 200 */ 1752, 1341, 1754, 1752, 1341, 1341, 1766, 1762, 1745, 1743, /* 200 */ 1759, 1757, 1345, 1759, 1757, 1345, 1345, 1345, 1771, 1767,
/* 210 */ 1729, 1341, 1341, 1341, 1780, 1776, 1792, 1780, 1776, 1780, /* 210 */ 1750, 1748, 1734, 1345, 1345, 1345, 1785, 1781, 1797, 1785,
/* 220 */ 1776, 1341, 1341, 1752, 1341, 1341, 1752, 1341, 1561, 1341, /* 220 */ 1781, 1785, 1781, 1345, 1757, 1345, 1345, 1757, 1345, 1565,
/* 230 */ 1341, 1408, 1341, 1408, 1341, 1472, 1341, 1341, 1408, 1341, /* 230 */ 1345, 1345, 1412, 1345, 1412, 1345, 1476, 1345, 1345, 1412,
/* 240 */ 1580, 1594, 1570, 1506, 1506, 1506, 1411, 1346, 1341, 1341, /* 240 */ 1345, 1584, 1598, 1574, 1510, 1510, 1510, 1415, 1350, 1345,
/* 250 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1468, /* 250 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 260 */ 1657, 1765, 1764, 1688, 1687, 1686, 1684, 1656, 1341, 1341, /* 260 */ 1472, 1661, 1770, 1769, 1693, 1692, 1691, 1689, 1660, 1345,
/* 270 */ 1341, 1341, 1341, 1341, 1650, 1651, 1649, 1648, 1341, 1341, /* 270 */ 1345, 1345, 1345, 1345, 1345, 1654, 1655, 1653, 1652, 1345,
/* 280 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 280 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 290 */ 1341, 1341, 1341, 1713, 1341, 1777, 1781, 1341, 1341, 1341, /* 290 */ 1345, 1345, 1345, 1345, 1718, 1345, 1782, 1786, 1345, 1345,
/* 300 */ 1634, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 300 */ 1345, 1638, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 310 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 310 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 320 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 320 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 330 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 330 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 340 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 340 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 350 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 350 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 360 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 360 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 370 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 370 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 380 */ 1341, 1341, 1341, 1375, 1341, 1341, 1341, 1341, 1341, 1341, /* 380 */ 1345, 1345, 1345, 1345, 1379, 1345, 1345, 1345, 1345, 1345,
/* 390 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 390 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 400 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 400 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 410 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 410 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 420 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1437, 1436, /* 420 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1441,
/* 430 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 430 */ 1440, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 440 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 440 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 450 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 450 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 460 */ 1736, 1746, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 460 */ 1345, 1741, 1751, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 470 */ 1341, 1634, 1341, 1763, 1341, 1722, 1718, 1341, 1341, 1714, /* 470 */ 1345, 1345, 1345, 1638, 1345, 1768, 1345, 1727, 1723, 1345,
/* 480 */ 1341, 1341, 1775, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 480 */ 1345, 1719, 1345, 1345, 1780, 1345, 1345, 1345, 1345, 1345,
/* 490 */ 1341, 1341, 1708, 1341, 1681, 1341, 1341, 1341, 1341, 1341, /* 490 */ 1345, 1345, 1345, 1345, 1713, 1345, 1686, 1345, 1345, 1345,
/* 500 */ 1341, 1341, 1341, 1644, 1341, 1341, 1341, 1341, 1341, 1341, /* 500 */ 1345, 1345, 1345, 1345, 1345, 1648, 1345, 1345, 1345, 1345,
/* 510 */ 1341, 1341, 1341, 1341, 1341, 1341, 1633, 1341, 1672, 1341, /* 510 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1637, 1345,
/* 520 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1500, 1341, 1341, /* 520 */ 1677, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1504,
/* 530 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 530 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 540 */ 1485, 1483, 1482, 1481, 1341, 1478, 1341, 1341, 1341, 1341, /* 540 */ 1345, 1345, 1489, 1487, 1486, 1485, 1345, 1482, 1345, 1345,
/* 550 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1430, 1341, 1341, /* 550 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1434,
/* 560 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1421, 1341, 1420, /* 560 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1425,
/* 570 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 570 */ 1345, 1424, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 580 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 580 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 590 */ 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1341, /* 590 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 600 */ 1341, 1341, 1341, /* 600 */ 1345, 1345, 1345, 1345, 1345,
}; };
/********** End of lemon-generated parsing tables *****************************/ /********** End of lemon-generated parsing tables *****************************/
...@@ -1835,139 +1835,140 @@ static const char *const yyRuleName[] = { ...@@ -1835,139 +1835,140 @@ static const char *const yyRuleName[] = {
/* 315 */ "column_reference ::= table_name NK_DOT column_name", /* 315 */ "column_reference ::= table_name NK_DOT column_name",
/* 316 */ "pseudo_column ::= ROWTS", /* 316 */ "pseudo_column ::= ROWTS",
/* 317 */ "pseudo_column ::= TBNAME", /* 317 */ "pseudo_column ::= TBNAME",
/* 318 */ "pseudo_column ::= QSTARTTS", /* 318 */ "pseudo_column ::= table_name NK_DOT TBNAME",
/* 319 */ "pseudo_column ::= QENDTS", /* 319 */ "pseudo_column ::= QSTARTTS",
/* 320 */ "pseudo_column ::= WSTARTTS", /* 320 */ "pseudo_column ::= QENDTS",
/* 321 */ "pseudo_column ::= WENDTS", /* 321 */ "pseudo_column ::= WSTARTTS",
/* 322 */ "pseudo_column ::= WDURATION", /* 322 */ "pseudo_column ::= WENDTS",
/* 323 */ "function_expression ::= function_name NK_LP expression_list NK_RP", /* 323 */ "pseudo_column ::= WDURATION",
/* 324 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", /* 324 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
/* 325 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", /* 325 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
/* 326 */ "function_expression ::= literal_func", /* 326 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
/* 327 */ "literal_func ::= noarg_func NK_LP NK_RP", /* 327 */ "function_expression ::= literal_func",
/* 328 */ "literal_func ::= NOW", /* 328 */ "literal_func ::= noarg_func NK_LP NK_RP",
/* 329 */ "noarg_func ::= NOW", /* 329 */ "literal_func ::= NOW",
/* 330 */ "noarg_func ::= TODAY", /* 330 */ "noarg_func ::= NOW",
/* 331 */ "noarg_func ::= TIMEZONE", /* 331 */ "noarg_func ::= TODAY",
/* 332 */ "star_func ::= COUNT", /* 332 */ "noarg_func ::= TIMEZONE",
/* 333 */ "star_func ::= FIRST", /* 333 */ "star_func ::= COUNT",
/* 334 */ "star_func ::= LAST", /* 334 */ "star_func ::= FIRST",
/* 335 */ "star_func ::= LAST_ROW", /* 335 */ "star_func ::= LAST",
/* 336 */ "star_func_para_list ::= NK_STAR", /* 336 */ "star_func ::= LAST_ROW",
/* 337 */ "star_func_para_list ::= other_para_list", /* 337 */ "star_func_para_list ::= NK_STAR",
/* 338 */ "other_para_list ::= star_func_para", /* 338 */ "star_func_para_list ::= other_para_list",
/* 339 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", /* 339 */ "other_para_list ::= star_func_para",
/* 340 */ "star_func_para ::= expression", /* 340 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
/* 341 */ "star_func_para ::= table_name NK_DOT NK_STAR", /* 341 */ "star_func_para ::= expression",
/* 342 */ "predicate ::= expression compare_op expression", /* 342 */ "star_func_para ::= table_name NK_DOT NK_STAR",
/* 343 */ "predicate ::= expression BETWEEN expression AND expression", /* 343 */ "predicate ::= expression compare_op expression",
/* 344 */ "predicate ::= expression NOT BETWEEN expression AND expression", /* 344 */ "predicate ::= expression BETWEEN expression AND expression",
/* 345 */ "predicate ::= expression IS NULL", /* 345 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 346 */ "predicate ::= expression IS NOT NULL", /* 346 */ "predicate ::= expression IS NULL",
/* 347 */ "predicate ::= expression in_op in_predicate_value", /* 347 */ "predicate ::= expression IS NOT NULL",
/* 348 */ "compare_op ::= NK_LT", /* 348 */ "predicate ::= expression in_op in_predicate_value",
/* 349 */ "compare_op ::= NK_GT", /* 349 */ "compare_op ::= NK_LT",
/* 350 */ "compare_op ::= NK_LE", /* 350 */ "compare_op ::= NK_GT",
/* 351 */ "compare_op ::= NK_GE", /* 351 */ "compare_op ::= NK_LE",
/* 352 */ "compare_op ::= NK_NE", /* 352 */ "compare_op ::= NK_GE",
/* 353 */ "compare_op ::= NK_EQ", /* 353 */ "compare_op ::= NK_NE",
/* 354 */ "compare_op ::= LIKE", /* 354 */ "compare_op ::= NK_EQ",
/* 355 */ "compare_op ::= NOT LIKE", /* 355 */ "compare_op ::= LIKE",
/* 356 */ "compare_op ::= MATCH", /* 356 */ "compare_op ::= NOT LIKE",
/* 357 */ "compare_op ::= NMATCH", /* 357 */ "compare_op ::= MATCH",
/* 358 */ "compare_op ::= CONTAINS", /* 358 */ "compare_op ::= NMATCH",
/* 359 */ "in_op ::= IN", /* 359 */ "compare_op ::= CONTAINS",
/* 360 */ "in_op ::= NOT IN", /* 360 */ "in_op ::= IN",
/* 361 */ "in_predicate_value ::= NK_LP expression_list NK_RP", /* 361 */ "in_op ::= NOT IN",
/* 362 */ "boolean_value_expression ::= boolean_primary", /* 362 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 363 */ "boolean_value_expression ::= NOT boolean_primary", /* 363 */ "boolean_value_expression ::= boolean_primary",
/* 364 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", /* 364 */ "boolean_value_expression ::= NOT boolean_primary",
/* 365 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", /* 365 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 366 */ "boolean_primary ::= predicate", /* 366 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 367 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", /* 367 */ "boolean_primary ::= predicate",
/* 368 */ "common_expression ::= expression", /* 368 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 369 */ "common_expression ::= boolean_value_expression", /* 369 */ "common_expression ::= expression",
/* 370 */ "from_clause ::= FROM table_reference_list", /* 370 */ "common_expression ::= boolean_value_expression",
/* 371 */ "table_reference_list ::= table_reference", /* 371 */ "from_clause ::= FROM table_reference_list",
/* 372 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", /* 372 */ "table_reference_list ::= table_reference",
/* 373 */ "table_reference ::= table_primary", /* 373 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 374 */ "table_reference ::= joined_table", /* 374 */ "table_reference ::= table_primary",
/* 375 */ "table_primary ::= table_name alias_opt", /* 375 */ "table_reference ::= joined_table",
/* 376 */ "table_primary ::= db_name NK_DOT table_name alias_opt", /* 376 */ "table_primary ::= table_name alias_opt",
/* 377 */ "table_primary ::= subquery alias_opt", /* 377 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 378 */ "table_primary ::= parenthesized_joined_table", /* 378 */ "table_primary ::= subquery alias_opt",
/* 379 */ "alias_opt ::=", /* 379 */ "table_primary ::= parenthesized_joined_table",
/* 380 */ "alias_opt ::= table_alias", /* 380 */ "alias_opt ::=",
/* 381 */ "alias_opt ::= AS table_alias", /* 381 */ "alias_opt ::= table_alias",
/* 382 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", /* 382 */ "alias_opt ::= AS table_alias",
/* 383 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", /* 383 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 384 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", /* 384 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 385 */ "join_type ::=", /* 385 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 386 */ "join_type ::= INNER", /* 386 */ "join_type ::=",
/* 387 */ "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", /* 387 */ "join_type ::= INNER",
/* 388 */ "set_quantifier_opt ::=", /* 388 */ "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",
/* 389 */ "set_quantifier_opt ::= DISTINCT", /* 389 */ "set_quantifier_opt ::=",
/* 390 */ "set_quantifier_opt ::= ALL", /* 390 */ "set_quantifier_opt ::= DISTINCT",
/* 391 */ "select_list ::= NK_STAR", /* 391 */ "set_quantifier_opt ::= ALL",
/* 392 */ "select_list ::= select_sublist", /* 392 */ "select_list ::= NK_STAR",
/* 393 */ "select_sublist ::= select_item", /* 393 */ "select_list ::= select_sublist",
/* 394 */ "select_sublist ::= select_sublist NK_COMMA select_item", /* 394 */ "select_sublist ::= select_item",
/* 395 */ "select_item ::= common_expression", /* 395 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 396 */ "select_item ::= common_expression column_alias", /* 396 */ "select_item ::= common_expression",
/* 397 */ "select_item ::= common_expression AS column_alias", /* 397 */ "select_item ::= common_expression column_alias",
/* 398 */ "select_item ::= table_name NK_DOT NK_STAR", /* 398 */ "select_item ::= common_expression AS column_alias",
/* 399 */ "where_clause_opt ::=", /* 399 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 400 */ "where_clause_opt ::= WHERE search_condition", /* 400 */ "where_clause_opt ::=",
/* 401 */ "partition_by_clause_opt ::=", /* 401 */ "where_clause_opt ::= WHERE search_condition",
/* 402 */ "partition_by_clause_opt ::= PARTITION BY expression_list", /* 402 */ "partition_by_clause_opt ::=",
/* 403 */ "twindow_clause_opt ::=", /* 403 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 404 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", /* 404 */ "twindow_clause_opt ::=",
/* 405 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", /* 405 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
/* 406 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", /* 406 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
/* 407 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", /* 407 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 408 */ "sliding_opt ::=", /* 408 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 409 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", /* 409 */ "sliding_opt ::=",
/* 410 */ "fill_opt ::=", /* 410 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 411 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", /* 411 */ "fill_opt ::=",
/* 412 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", /* 412 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 413 */ "fill_mode ::= NONE", /* 413 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 414 */ "fill_mode ::= PREV", /* 414 */ "fill_mode ::= NONE",
/* 415 */ "fill_mode ::= NULL", /* 415 */ "fill_mode ::= PREV",
/* 416 */ "fill_mode ::= LINEAR", /* 416 */ "fill_mode ::= NULL",
/* 417 */ "fill_mode ::= NEXT", /* 417 */ "fill_mode ::= LINEAR",
/* 418 */ "group_by_clause_opt ::=", /* 418 */ "fill_mode ::= NEXT",
/* 419 */ "group_by_clause_opt ::= GROUP BY group_by_list", /* 419 */ "group_by_clause_opt ::=",
/* 420 */ "group_by_list ::= expression", /* 420 */ "group_by_clause_opt ::= GROUP BY group_by_list",
/* 421 */ "group_by_list ::= group_by_list NK_COMMA expression", /* 421 */ "group_by_list ::= expression",
/* 422 */ "having_clause_opt ::=", /* 422 */ "group_by_list ::= group_by_list NK_COMMA expression",
/* 423 */ "having_clause_opt ::= HAVING search_condition", /* 423 */ "having_clause_opt ::=",
/* 424 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", /* 424 */ "having_clause_opt ::= HAVING search_condition",
/* 425 */ "query_expression_body ::= query_primary", /* 425 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 426 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", /* 426 */ "query_expression_body ::= query_primary",
/* 427 */ "query_expression_body ::= query_expression_body UNION query_expression_body", /* 427 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 428 */ "query_primary ::= query_specification", /* 428 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
/* 429 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", /* 429 */ "query_primary ::= query_specification",
/* 430 */ "order_by_clause_opt ::=", /* 430 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
/* 431 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", /* 431 */ "order_by_clause_opt ::=",
/* 432 */ "slimit_clause_opt ::=", /* 432 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 433 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", /* 433 */ "slimit_clause_opt ::=",
/* 434 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", /* 434 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 435 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", /* 435 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 436 */ "limit_clause_opt ::=", /* 436 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 437 */ "limit_clause_opt ::= LIMIT NK_INTEGER", /* 437 */ "limit_clause_opt ::=",
/* 438 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", /* 438 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 439 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", /* 439 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 440 */ "subquery ::= NK_LP query_expression NK_RP", /* 440 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 441 */ "search_condition ::= common_expression", /* 441 */ "subquery ::= NK_LP query_expression NK_RP",
/* 442 */ "sort_specification_list ::= sort_specification", /* 442 */ "search_condition ::= common_expression",
/* 443 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", /* 443 */ "sort_specification_list ::= sort_specification",
/* 444 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", /* 444 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 445 */ "ordering_specification_opt ::=", /* 445 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 446 */ "ordering_specification_opt ::= ASC", /* 446 */ "ordering_specification_opt ::=",
/* 447 */ "ordering_specification_opt ::= DESC", /* 447 */ "ordering_specification_opt ::= ASC",
/* 448 */ "null_ordering_opt ::=", /* 448 */ "ordering_specification_opt ::= DESC",
/* 449 */ "null_ordering_opt ::= NULLS FIRST", /* 449 */ "null_ordering_opt ::=",
/* 450 */ "null_ordering_opt ::= NULLS LAST", /* 450 */ "null_ordering_opt ::= NULLS FIRST",
/* 451 */ "null_ordering_opt ::= NULLS LAST",
}; };
#endif /* NDEBUG */ #endif /* NDEBUG */
...@@ -2878,139 +2879,140 @@ static const struct { ...@@ -2878,139 +2879,140 @@ static const struct {
{ 312, -3 }, /* (315) column_reference ::= table_name NK_DOT column_name */ { 312, -3 }, /* (315) column_reference ::= table_name NK_DOT column_name */
{ 311, -1 }, /* (316) pseudo_column ::= ROWTS */ { 311, -1 }, /* (316) pseudo_column ::= ROWTS */
{ 311, -1 }, /* (317) pseudo_column ::= TBNAME */ { 311, -1 }, /* (317) pseudo_column ::= TBNAME */
{ 311, -1 }, /* (318) pseudo_column ::= QSTARTTS */ { 311, -3 }, /* (318) pseudo_column ::= table_name NK_DOT TBNAME */
{ 311, -1 }, /* (319) pseudo_column ::= QENDTS */ { 311, -1 }, /* (319) pseudo_column ::= QSTARTTS */
{ 311, -1 }, /* (320) pseudo_column ::= WSTARTTS */ { 311, -1 }, /* (320) pseudo_column ::= QENDTS */
{ 311, -1 }, /* (321) pseudo_column ::= WENDTS */ { 311, -1 }, /* (321) pseudo_column ::= WSTARTTS */
{ 311, -1 }, /* (322) pseudo_column ::= WDURATION */ { 311, -1 }, /* (322) pseudo_column ::= WENDTS */
{ 313, -4 }, /* (323) function_expression ::= function_name NK_LP expression_list NK_RP */ { 311, -1 }, /* (323) pseudo_column ::= WDURATION */
{ 313, -4 }, /* (324) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ { 313, -4 }, /* (324) function_expression ::= function_name NK_LP expression_list NK_RP */
{ 313, -6 }, /* (325) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ { 313, -4 }, /* (325) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
{ 313, -1 }, /* (326) function_expression ::= literal_func */ { 313, -6 }, /* (326) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
{ 307, -3 }, /* (327) literal_func ::= noarg_func NK_LP NK_RP */ { 313, -1 }, /* (327) function_expression ::= literal_func */
{ 307, -1 }, /* (328) literal_func ::= NOW */ { 307, -3 }, /* (328) literal_func ::= noarg_func NK_LP NK_RP */
{ 317, -1 }, /* (329) noarg_func ::= NOW */ { 307, -1 }, /* (329) literal_func ::= NOW */
{ 317, -1 }, /* (330) noarg_func ::= TODAY */ { 317, -1 }, /* (330) noarg_func ::= NOW */
{ 317, -1 }, /* (331) noarg_func ::= TIMEZONE */ { 317, -1 }, /* (331) noarg_func ::= TODAY */
{ 315, -1 }, /* (332) star_func ::= COUNT */ { 317, -1 }, /* (332) noarg_func ::= TIMEZONE */
{ 315, -1 }, /* (333) star_func ::= FIRST */ { 315, -1 }, /* (333) star_func ::= COUNT */
{ 315, -1 }, /* (334) star_func ::= LAST */ { 315, -1 }, /* (334) star_func ::= FIRST */
{ 315, -1 }, /* (335) star_func ::= LAST_ROW */ { 315, -1 }, /* (335) star_func ::= LAST */
{ 316, -1 }, /* (336) star_func_para_list ::= NK_STAR */ { 315, -1 }, /* (336) star_func ::= LAST_ROW */
{ 316, -1 }, /* (337) star_func_para_list ::= other_para_list */ { 316, -1 }, /* (337) star_func_para_list ::= NK_STAR */
{ 318, -1 }, /* (338) other_para_list ::= star_func_para */ { 316, -1 }, /* (338) star_func_para_list ::= other_para_list */
{ 318, -3 }, /* (339) other_para_list ::= other_para_list NK_COMMA star_func_para */ { 318, -1 }, /* (339) other_para_list ::= star_func_para */
{ 319, -1 }, /* (340) star_func_para ::= expression */ { 318, -3 }, /* (340) other_para_list ::= other_para_list NK_COMMA star_func_para */
{ 319, -3 }, /* (341) star_func_para ::= table_name NK_DOT NK_STAR */ { 319, -1 }, /* (341) star_func_para ::= expression */
{ 320, -3 }, /* (342) predicate ::= expression compare_op expression */ { 319, -3 }, /* (342) star_func_para ::= table_name NK_DOT NK_STAR */
{ 320, -5 }, /* (343) predicate ::= expression BETWEEN expression AND expression */ { 320, -3 }, /* (343) predicate ::= expression compare_op expression */
{ 320, -6 }, /* (344) predicate ::= expression NOT BETWEEN expression AND expression */ { 320, -5 }, /* (344) predicate ::= expression BETWEEN expression AND expression */
{ 320, -3 }, /* (345) predicate ::= expression IS NULL */ { 320, -6 }, /* (345) predicate ::= expression NOT BETWEEN expression AND expression */
{ 320, -4 }, /* (346) predicate ::= expression IS NOT NULL */ { 320, -3 }, /* (346) predicate ::= expression IS NULL */
{ 320, -3 }, /* (347) predicate ::= expression in_op in_predicate_value */ { 320, -4 }, /* (347) predicate ::= expression IS NOT NULL */
{ 321, -1 }, /* (348) compare_op ::= NK_LT */ { 320, -3 }, /* (348) predicate ::= expression in_op in_predicate_value */
{ 321, -1 }, /* (349) compare_op ::= NK_GT */ { 321, -1 }, /* (349) compare_op ::= NK_LT */
{ 321, -1 }, /* (350) compare_op ::= NK_LE */ { 321, -1 }, /* (350) compare_op ::= NK_GT */
{ 321, -1 }, /* (351) compare_op ::= NK_GE */ { 321, -1 }, /* (351) compare_op ::= NK_LE */
{ 321, -1 }, /* (352) compare_op ::= NK_NE */ { 321, -1 }, /* (352) compare_op ::= NK_GE */
{ 321, -1 }, /* (353) compare_op ::= NK_EQ */ { 321, -1 }, /* (353) compare_op ::= NK_NE */
{ 321, -1 }, /* (354) compare_op ::= LIKE */ { 321, -1 }, /* (354) compare_op ::= NK_EQ */
{ 321, -2 }, /* (355) compare_op ::= NOT LIKE */ { 321, -1 }, /* (355) compare_op ::= LIKE */
{ 321, -1 }, /* (356) compare_op ::= MATCH */ { 321, -2 }, /* (356) compare_op ::= NOT LIKE */
{ 321, -1 }, /* (357) compare_op ::= NMATCH */ { 321, -1 }, /* (357) compare_op ::= MATCH */
{ 321, -1 }, /* (358) compare_op ::= CONTAINS */ { 321, -1 }, /* (358) compare_op ::= NMATCH */
{ 322, -1 }, /* (359) in_op ::= IN */ { 321, -1 }, /* (359) compare_op ::= CONTAINS */
{ 322, -2 }, /* (360) in_op ::= NOT IN */ { 322, -1 }, /* (360) in_op ::= IN */
{ 323, -3 }, /* (361) in_predicate_value ::= NK_LP expression_list NK_RP */ { 322, -2 }, /* (361) in_op ::= NOT IN */
{ 324, -1 }, /* (362) boolean_value_expression ::= boolean_primary */ { 323, -3 }, /* (362) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 324, -2 }, /* (363) boolean_value_expression ::= NOT boolean_primary */ { 324, -1 }, /* (363) boolean_value_expression ::= boolean_primary */
{ 324, -3 }, /* (364) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { 324, -2 }, /* (364) boolean_value_expression ::= NOT boolean_primary */
{ 324, -3 }, /* (365) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { 324, -3 }, /* (365) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 325, -1 }, /* (366) boolean_primary ::= predicate */ { 324, -3 }, /* (366) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 325, -3 }, /* (367) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ { 325, -1 }, /* (367) boolean_primary ::= predicate */
{ 326, -1 }, /* (368) common_expression ::= expression */ { 325, -3 }, /* (368) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 326, -1 }, /* (369) common_expression ::= boolean_value_expression */ { 326, -1 }, /* (369) common_expression ::= expression */
{ 327, -2 }, /* (370) from_clause ::= FROM table_reference_list */ { 326, -1 }, /* (370) common_expression ::= boolean_value_expression */
{ 328, -1 }, /* (371) table_reference_list ::= table_reference */ { 327, -2 }, /* (371) from_clause ::= FROM table_reference_list */
{ 328, -3 }, /* (372) table_reference_list ::= table_reference_list NK_COMMA table_reference */ { 328, -1 }, /* (372) table_reference_list ::= table_reference */
{ 329, -1 }, /* (373) table_reference ::= table_primary */ { 328, -3 }, /* (373) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 329, -1 }, /* (374) table_reference ::= joined_table */ { 329, -1 }, /* (374) table_reference ::= table_primary */
{ 330, -2 }, /* (375) table_primary ::= table_name alias_opt */ { 329, -1 }, /* (375) table_reference ::= joined_table */
{ 330, -4 }, /* (376) table_primary ::= db_name NK_DOT table_name alias_opt */ { 330, -2 }, /* (376) table_primary ::= table_name alias_opt */
{ 330, -2 }, /* (377) table_primary ::= subquery alias_opt */ { 330, -4 }, /* (377) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 330, -1 }, /* (378) table_primary ::= parenthesized_joined_table */ { 330, -2 }, /* (378) table_primary ::= subquery alias_opt */
{ 332, 0 }, /* (379) alias_opt ::= */ { 330, -1 }, /* (379) table_primary ::= parenthesized_joined_table */
{ 332, -1 }, /* (380) alias_opt ::= table_alias */ { 332, 0 }, /* (380) alias_opt ::= */
{ 332, -2 }, /* (381) alias_opt ::= AS table_alias */ { 332, -1 }, /* (381) alias_opt ::= table_alias */
{ 333, -3 }, /* (382) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ { 332, -2 }, /* (382) alias_opt ::= AS table_alias */
{ 333, -3 }, /* (383) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ { 333, -3 }, /* (383) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 331, -6 }, /* (384) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { 333, -3 }, /* (384) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 334, 0 }, /* (385) join_type ::= */ { 331, -6 }, /* (385) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 334, -1 }, /* (386) join_type ::= INNER */ { 334, 0 }, /* (386) join_type ::= */
{ 336, -9 }, /* (387) 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 */ { 334, -1 }, /* (387) join_type ::= INNER */
{ 337, 0 }, /* (388) set_quantifier_opt ::= */ { 336, -9 }, /* (388) 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 */
{ 337, -1 }, /* (389) set_quantifier_opt ::= DISTINCT */ { 337, 0 }, /* (389) set_quantifier_opt ::= */
{ 337, -1 }, /* (390) set_quantifier_opt ::= ALL */ { 337, -1 }, /* (390) set_quantifier_opt ::= DISTINCT */
{ 338, -1 }, /* (391) select_list ::= NK_STAR */ { 337, -1 }, /* (391) set_quantifier_opt ::= ALL */
{ 338, -1 }, /* (392) select_list ::= select_sublist */ { 338, -1 }, /* (392) select_list ::= NK_STAR */
{ 344, -1 }, /* (393) select_sublist ::= select_item */ { 338, -1 }, /* (393) select_list ::= select_sublist */
{ 344, -3 }, /* (394) select_sublist ::= select_sublist NK_COMMA select_item */ { 344, -1 }, /* (394) select_sublist ::= select_item */
{ 345, -1 }, /* (395) select_item ::= common_expression */ { 344, -3 }, /* (395) select_sublist ::= select_sublist NK_COMMA select_item */
{ 345, -2 }, /* (396) select_item ::= common_expression column_alias */ { 345, -1 }, /* (396) select_item ::= common_expression */
{ 345, -3 }, /* (397) select_item ::= common_expression AS column_alias */ { 345, -2 }, /* (397) select_item ::= common_expression column_alias */
{ 345, -3 }, /* (398) select_item ::= table_name NK_DOT NK_STAR */ { 345, -3 }, /* (398) select_item ::= common_expression AS column_alias */
{ 339, 0 }, /* (399) where_clause_opt ::= */ { 345, -3 }, /* (399) select_item ::= table_name NK_DOT NK_STAR */
{ 339, -2 }, /* (400) where_clause_opt ::= WHERE search_condition */ { 339, 0 }, /* (400) where_clause_opt ::= */
{ 340, 0 }, /* (401) partition_by_clause_opt ::= */ { 339, -2 }, /* (401) where_clause_opt ::= WHERE search_condition */
{ 340, -3 }, /* (402) partition_by_clause_opt ::= PARTITION BY expression_list */ { 340, 0 }, /* (402) partition_by_clause_opt ::= */
{ 341, 0 }, /* (403) twindow_clause_opt ::= */ { 340, -3 }, /* (403) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 341, -6 }, /* (404) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { 341, 0 }, /* (404) twindow_clause_opt ::= */
{ 341, -4 }, /* (405) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ { 341, -6 }, /* (405) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
{ 341, -6 }, /* (406) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { 341, -4 }, /* (406) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
{ 341, -8 }, /* (407) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { 341, -6 }, /* (407) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 291, 0 }, /* (408) sliding_opt ::= */ { 341, -8 }, /* (408) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 291, -4 }, /* (409) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { 291, 0 }, /* (409) sliding_opt ::= */
{ 346, 0 }, /* (410) fill_opt ::= */ { 291, -4 }, /* (410) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 346, -4 }, /* (411) fill_opt ::= FILL NK_LP fill_mode NK_RP */ { 346, 0 }, /* (411) fill_opt ::= */
{ 346, -6 }, /* (412) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { 346, -4 }, /* (412) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 347, -1 }, /* (413) fill_mode ::= NONE */ { 346, -6 }, /* (413) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 347, -1 }, /* (414) fill_mode ::= PREV */ { 347, -1 }, /* (414) fill_mode ::= NONE */
{ 347, -1 }, /* (415) fill_mode ::= NULL */ { 347, -1 }, /* (415) fill_mode ::= PREV */
{ 347, -1 }, /* (416) fill_mode ::= LINEAR */ { 347, -1 }, /* (416) fill_mode ::= NULL */
{ 347, -1 }, /* (417) fill_mode ::= NEXT */ { 347, -1 }, /* (417) fill_mode ::= LINEAR */
{ 342, 0 }, /* (418) group_by_clause_opt ::= */ { 347, -1 }, /* (418) fill_mode ::= NEXT */
{ 342, -3 }, /* (419) group_by_clause_opt ::= GROUP BY group_by_list */ { 342, 0 }, /* (419) group_by_clause_opt ::= */
{ 348, -1 }, /* (420) group_by_list ::= expression */ { 342, -3 }, /* (420) group_by_clause_opt ::= GROUP BY group_by_list */
{ 348, -3 }, /* (421) group_by_list ::= group_by_list NK_COMMA expression */ { 348, -1 }, /* (421) group_by_list ::= expression */
{ 343, 0 }, /* (422) having_clause_opt ::= */ { 348, -3 }, /* (422) group_by_list ::= group_by_list NK_COMMA expression */
{ 343, -2 }, /* (423) having_clause_opt ::= HAVING search_condition */ { 343, 0 }, /* (423) having_clause_opt ::= */
{ 296, -4 }, /* (424) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { 343, -2 }, /* (424) having_clause_opt ::= HAVING search_condition */
{ 349, -1 }, /* (425) query_expression_body ::= query_primary */ { 296, -4 }, /* (425) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 349, -4 }, /* (426) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { 349, -1 }, /* (426) query_expression_body ::= query_primary */
{ 349, -3 }, /* (427) query_expression_body ::= query_expression_body UNION query_expression_body */ { 349, -4 }, /* (427) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 353, -1 }, /* (428) query_primary ::= query_specification */ { 349, -3 }, /* (428) query_expression_body ::= query_expression_body UNION query_expression_body */
{ 353, -6 }, /* (429) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ { 353, -1 }, /* (429) query_primary ::= query_specification */
{ 350, 0 }, /* (430) order_by_clause_opt ::= */ { 353, -6 }, /* (430) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
{ 350, -3 }, /* (431) order_by_clause_opt ::= ORDER BY sort_specification_list */ { 350, 0 }, /* (431) order_by_clause_opt ::= */
{ 351, 0 }, /* (432) slimit_clause_opt ::= */ { 350, -3 }, /* (432) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 351, -2 }, /* (433) slimit_clause_opt ::= SLIMIT NK_INTEGER */ { 351, 0 }, /* (433) slimit_clause_opt ::= */
{ 351, -4 }, /* (434) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ { 351, -2 }, /* (434) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 351, -4 }, /* (435) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ { 351, -4 }, /* (435) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 352, 0 }, /* (436) limit_clause_opt ::= */ { 351, -4 }, /* (436) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 352, -2 }, /* (437) limit_clause_opt ::= LIMIT NK_INTEGER */ { 352, 0 }, /* (437) limit_clause_opt ::= */
{ 352, -4 }, /* (438) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ { 352, -2 }, /* (438) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 352, -4 }, /* (439) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ { 352, -4 }, /* (439) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 314, -3 }, /* (440) subquery ::= NK_LP query_expression NK_RP */ { 352, -4 }, /* (440) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 335, -1 }, /* (441) search_condition ::= common_expression */ { 314, -3 }, /* (441) subquery ::= NK_LP query_expression NK_RP */
{ 354, -1 }, /* (442) sort_specification_list ::= sort_specification */ { 335, -1 }, /* (442) search_condition ::= common_expression */
{ 354, -3 }, /* (443) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ { 354, -1 }, /* (443) sort_specification_list ::= sort_specification */
{ 355, -3 }, /* (444) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { 354, -3 }, /* (444) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 356, 0 }, /* (445) ordering_specification_opt ::= */ { 355, -3 }, /* (445) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 356, -1 }, /* (446) ordering_specification_opt ::= ASC */ { 356, 0 }, /* (446) ordering_specification_opt ::= */
{ 356, -1 }, /* (447) ordering_specification_opt ::= DESC */ { 356, -1 }, /* (447) ordering_specification_opt ::= ASC */
{ 357, 0 }, /* (448) null_ordering_opt ::= */ { 356, -1 }, /* (448) ordering_specification_opt ::= DESC */
{ 357, -2 }, /* (449) null_ordering_opt ::= NULLS FIRST */ { 357, 0 }, /* (449) null_ordering_opt ::= */
{ 357, -2 }, /* (450) null_ordering_opt ::= NULLS LAST */ { 357, -2 }, /* (450) null_ordering_opt ::= NULLS FIRST */
{ 357, -2 }, /* (451) null_ordering_opt ::= NULLS LAST */
}; };
static void yy_accept(yyParser*); /* Forward Declaration */ static void yy_accept(yyParser*); /* Forward Declaration */
...@@ -3227,13 +3229,13 @@ static YYACTIONTYPE yy_reduce( ...@@ -3227,13 +3229,13 @@ static YYACTIONTYPE yy_reduce(
case 295: /* index_name ::= NK_ID */ yytestcase(yyruleno==295); case 295: /* index_name ::= NK_ID */ yytestcase(yyruleno==295);
case 296: /* topic_name ::= NK_ID */ yytestcase(yyruleno==296); case 296: /* topic_name ::= NK_ID */ yytestcase(yyruleno==296);
case 297: /* stream_name ::= NK_ID */ yytestcase(yyruleno==297); case 297: /* stream_name ::= NK_ID */ yytestcase(yyruleno==297);
case 329: /* noarg_func ::= NOW */ yytestcase(yyruleno==329); case 330: /* noarg_func ::= NOW */ yytestcase(yyruleno==330);
case 330: /* noarg_func ::= TODAY */ yytestcase(yyruleno==330); case 331: /* noarg_func ::= TODAY */ yytestcase(yyruleno==331);
case 331: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==331); case 332: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==332);
case 332: /* star_func ::= COUNT */ yytestcase(yyruleno==332); case 333: /* star_func ::= COUNT */ yytestcase(yyruleno==333);
case 333: /* star_func ::= FIRST */ yytestcase(yyruleno==333); case 334: /* star_func ::= FIRST */ yytestcase(yyruleno==334);
case 334: /* star_func ::= LAST */ yytestcase(yyruleno==334); case 335: /* star_func ::= LAST */ yytestcase(yyruleno==335);
case 335: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==335); case 336: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==336);
{ yylhsminor.yy105 = yymsp[0].minor.yy0; } { yylhsminor.yy105 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy105 = yylhsminor.yy105; yymsp[0].minor.yy105 = yylhsminor.yy105;
break; break;
...@@ -3286,7 +3288,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3286,7 +3288,7 @@ static YYACTIONTYPE yy_reduce(
case 66: /* exists_opt ::= */ yytestcase(yyruleno==66); case 66: /* exists_opt ::= */ yytestcase(yyruleno==66);
case 234: /* analyze_opt ::= */ yytestcase(yyruleno==234); case 234: /* analyze_opt ::= */ yytestcase(yyruleno==234);
case 242: /* agg_func_opt ::= */ yytestcase(yyruleno==242); case 242: /* agg_func_opt ::= */ yytestcase(yyruleno==242);
case 388: /* set_quantifier_opt ::= */ yytestcase(yyruleno==388); case 389: /* set_quantifier_opt ::= */ yytestcase(yyruleno==389);
{ yymsp[1].minor.yy617 = false; } { yymsp[1].minor.yy617 = false; }
break; break;
case 65: /* exists_opt ::= IF EXISTS */ case 65: /* exists_opt ::= IF EXISTS */
...@@ -3423,9 +3425,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -3423,9 +3425,9 @@ static YYACTIONTYPE yy_reduce(
case 211: /* func_name_list ::= func_name */ yytestcase(yyruleno==211); case 211: /* func_name_list ::= func_name */ yytestcase(yyruleno==211);
case 220: /* func_list ::= func */ yytestcase(yyruleno==220); case 220: /* func_list ::= func */ yytestcase(yyruleno==220);
case 286: /* literal_list ::= signed_literal */ yytestcase(yyruleno==286); case 286: /* literal_list ::= signed_literal */ yytestcase(yyruleno==286);
case 338: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==338); case 339: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==339);
case 393: /* select_sublist ::= select_item */ yytestcase(yyruleno==393); case 394: /* select_sublist ::= select_item */ yytestcase(yyruleno==394);
case 442: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==442); case 443: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==443);
{ yylhsminor.yy60 = createNodeList(pCxt, yymsp[0].minor.yy172); } { yylhsminor.yy60 = createNodeList(pCxt, yymsp[0].minor.yy172); }
yymsp[0].minor.yy60 = yylhsminor.yy60; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
...@@ -3435,9 +3437,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -3435,9 +3437,9 @@ static YYACTIONTYPE yy_reduce(
case 212: /* func_name_list ::= func_name_list NK_COMMA func_name */ yytestcase(yyruleno==212); case 212: /* func_name_list ::= func_name_list NK_COMMA func_name */ yytestcase(yyruleno==212);
case 221: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==221); case 221: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==221);
case 287: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==287); case 287: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==287);
case 339: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==339); case 340: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==340);
case 394: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==394); case 395: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==395);
case 443: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==443); case 444: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==444);
{ yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, yymsp[0].minor.yy172); } { yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, yymsp[0].minor.yy172); }
yymsp[-2].minor.yy60 = yylhsminor.yy60; yymsp[-2].minor.yy60 = yylhsminor.yy60;
break; break;
...@@ -3518,9 +3520,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -3518,9 +3520,9 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 128: /* specific_tags_opt ::= */ case 128: /* specific_tags_opt ::= */
case 159: /* tags_def_opt ::= */ yytestcase(yyruleno==159); case 159: /* tags_def_opt ::= */ yytestcase(yyruleno==159);
case 401: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==401); case 402: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==402);
case 418: /* group_by_clause_opt ::= */ yytestcase(yyruleno==418); case 419: /* group_by_clause_opt ::= */ yytestcase(yyruleno==419);
case 430: /* order_by_clause_opt ::= */ yytestcase(yyruleno==430); case 431: /* order_by_clause_opt ::= */ yytestcase(yyruleno==431);
{ yymsp[1].minor.yy60 = NULL; } { yymsp[1].minor.yy60 = NULL; }
break; break;
case 129: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ case 129: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */
...@@ -3610,8 +3612,8 @@ static YYACTIONTYPE yy_reduce( ...@@ -3610,8 +3612,8 @@ static YYACTIONTYPE yy_reduce(
{ yymsp[-5].minor.yy248 = createDataType(TSDB_DATA_TYPE_DECIMAL); } { yymsp[-5].minor.yy248 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break; break;
case 160: /* tags_def_opt ::= tags_def */ case 160: /* tags_def_opt ::= tags_def */
case 337: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==337); case 338: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==338);
case 392: /* select_list ::= select_sublist */ yytestcase(yyruleno==392); case 393: /* select_list ::= select_sublist */ yytestcase(yyruleno==393);
{ yylhsminor.yy60 = yymsp[0].minor.yy60; } { yylhsminor.yy60 = yymsp[0].minor.yy60; }
yymsp[0].minor.yy60 = yylhsminor.yy60; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
...@@ -3756,13 +3758,13 @@ static YYACTIONTYPE yy_reduce( ...@@ -3756,13 +3758,13 @@ static YYACTIONTYPE yy_reduce(
case 206: /* like_pattern_opt ::= */ case 206: /* like_pattern_opt ::= */
case 217: /* index_options ::= */ yytestcase(yyruleno==217); case 217: /* index_options ::= */ yytestcase(yyruleno==217);
case 248: /* into_opt ::= */ yytestcase(yyruleno==248); case 248: /* into_opt ::= */ yytestcase(yyruleno==248);
case 399: /* where_clause_opt ::= */ yytestcase(yyruleno==399); case 400: /* where_clause_opt ::= */ yytestcase(yyruleno==400);
case 403: /* twindow_clause_opt ::= */ yytestcase(yyruleno==403); case 404: /* twindow_clause_opt ::= */ yytestcase(yyruleno==404);
case 408: /* sliding_opt ::= */ yytestcase(yyruleno==408); case 409: /* sliding_opt ::= */ yytestcase(yyruleno==409);
case 410: /* fill_opt ::= */ yytestcase(yyruleno==410); case 411: /* fill_opt ::= */ yytestcase(yyruleno==411);
case 422: /* having_clause_opt ::= */ yytestcase(yyruleno==422); case 423: /* having_clause_opt ::= */ yytestcase(yyruleno==423);
case 432: /* slimit_clause_opt ::= */ yytestcase(yyruleno==432); case 433: /* slimit_clause_opt ::= */ yytestcase(yyruleno==433);
case 436: /* limit_clause_opt ::= */ yytestcase(yyruleno==436); case 437: /* limit_clause_opt ::= */ yytestcase(yyruleno==437);
{ yymsp[1].minor.yy172 = NULL; } { yymsp[1].minor.yy172 = NULL; }
break; break;
case 207: /* like_pattern_opt ::= LIKE NK_STRING */ case 207: /* like_pattern_opt ::= LIKE NK_STRING */
...@@ -3834,7 +3836,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3834,7 +3836,7 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 235: /* analyze_opt ::= ANALYZE */ case 235: /* analyze_opt ::= ANALYZE */
case 243: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==243); case 243: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==243);
case 389: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==389); case 390: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==390);
{ yymsp[0].minor.yy617 = true; } { yymsp[0].minor.yy617 = true; }
break; break;
case 236: /* explain_options ::= */ case 236: /* explain_options ::= */
...@@ -3870,9 +3872,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -3870,9 +3872,9 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy617, &yymsp[0].minor.yy105); } { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy617, &yymsp[0].minor.yy105); }
break; break;
case 249: /* into_opt ::= INTO full_table_name */ case 249: /* into_opt ::= INTO full_table_name */
case 370: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==370); case 371: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==371);
case 400: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==400); case 401: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==401);
case 423: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==423); case 424: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==424);
{ yymsp[-1].minor.yy172 = yymsp[0].minor.yy172; } { yymsp[-1].minor.yy172 = yymsp[0].minor.yy172; }
break; break;
case 250: /* stream_options ::= */ case 250: /* stream_options ::= */
...@@ -3941,17 +3943,17 @@ static YYACTIONTYPE yy_reduce( ...@@ -3941,17 +3943,17 @@ static YYACTIONTYPE yy_reduce(
case 300: /* expression ::= column_reference */ yytestcase(yyruleno==300); case 300: /* expression ::= column_reference */ yytestcase(yyruleno==300);
case 301: /* expression ::= function_expression */ yytestcase(yyruleno==301); case 301: /* expression ::= function_expression */ yytestcase(yyruleno==301);
case 302: /* expression ::= subquery */ yytestcase(yyruleno==302); case 302: /* expression ::= subquery */ yytestcase(yyruleno==302);
case 326: /* function_expression ::= literal_func */ yytestcase(yyruleno==326); case 327: /* function_expression ::= literal_func */ yytestcase(yyruleno==327);
case 362: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==362); case 363: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==363);
case 366: /* boolean_primary ::= predicate */ yytestcase(yyruleno==366); case 367: /* boolean_primary ::= predicate */ yytestcase(yyruleno==367);
case 368: /* common_expression ::= expression */ yytestcase(yyruleno==368); case 369: /* common_expression ::= expression */ yytestcase(yyruleno==369);
case 369: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==369); case 370: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==370);
case 371: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==371); case 372: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==372);
case 373: /* table_reference ::= table_primary */ yytestcase(yyruleno==373); case 374: /* table_reference ::= table_primary */ yytestcase(yyruleno==374);
case 374: /* table_reference ::= joined_table */ yytestcase(yyruleno==374); case 375: /* table_reference ::= joined_table */ yytestcase(yyruleno==375);
case 378: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==378); case 379: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==379);
case 425: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==425); case 426: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==426);
case 428: /* query_primary ::= query_specification */ yytestcase(yyruleno==428); case 429: /* query_primary ::= query_specification */ yytestcase(yyruleno==429);
{ yylhsminor.yy172 = yymsp[0].minor.yy172; } { yylhsminor.yy172 = yymsp[0].minor.yy172; }
yymsp[0].minor.yy172 = yylhsminor.yy172; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
...@@ -4010,9 +4012,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -4010,9 +4012,9 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 283: /* signed_literal ::= duration_literal */ case 283: /* signed_literal ::= duration_literal */
case 285: /* signed_literal ::= literal_func */ yytestcase(yyruleno==285); case 285: /* signed_literal ::= literal_func */ yytestcase(yyruleno==285);
case 340: /* star_func_para ::= expression */ yytestcase(yyruleno==340); case 341: /* star_func_para ::= expression */ yytestcase(yyruleno==341);
case 395: /* select_item ::= common_expression */ yytestcase(yyruleno==395); case 396: /* select_item ::= common_expression */ yytestcase(yyruleno==396);
case 441: /* search_condition ::= common_expression */ yytestcase(yyruleno==441); case 442: /* search_condition ::= common_expression */ yytestcase(yyruleno==442);
{ yylhsminor.yy172 = releaseRawExprNode(pCxt, yymsp[0].minor.yy172); } { yylhsminor.yy172 = releaseRawExprNode(pCxt, yymsp[0].minor.yy172); }
yymsp[0].minor.yy172 = yylhsminor.yy172; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
...@@ -4021,7 +4023,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -4021,7 +4023,7 @@ static YYACTIONTYPE yy_reduce(
yymsp[0].minor.yy172 = yylhsminor.yy172; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
case 303: /* expression ::= NK_LP expression NK_RP */ case 303: /* expression ::= NK_LP expression NK_RP */
case 367: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==367); case 368: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==368);
{ yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); } { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
...@@ -4104,39 +4106,43 @@ static YYACTIONTYPE yy_reduce( ...@@ -4104,39 +4106,43 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 316: /* pseudo_column ::= ROWTS */ case 316: /* pseudo_column ::= ROWTS */
case 317: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==317); case 317: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==317);
case 318: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==318); case 319: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==319);
case 319: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==319); case 320: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==320);
case 320: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==320); case 321: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==321);
case 321: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==321); case 322: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==322);
case 322: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==322); case 323: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==323);
case 328: /* literal_func ::= NOW */ yytestcase(yyruleno==328); case 329: /* literal_func ::= NOW */ yytestcase(yyruleno==329);
{ yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } { yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
yymsp[0].minor.yy172 = yylhsminor.yy172; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
case 323: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 318: /* pseudo_column ::= table_name NK_DOT TBNAME */
case 324: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==324); { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy105)))); }
yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
case 324: /* function_expression ::= function_name NK_LP expression_list NK_RP */
case 325: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==325);
{ yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy105, yymsp[-1].minor.yy60)); } { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy105, yymsp[-1].minor.yy60)); }
yymsp[-3].minor.yy172 = yylhsminor.yy172; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 325: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ case 326: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
{ yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), yymsp[-1].minor.yy248)); } { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), yymsp[-1].minor.yy248)); }
yymsp[-5].minor.yy172 = yylhsminor.yy172; yymsp[-5].minor.yy172 = yylhsminor.yy172;
break; break;
case 327: /* literal_func ::= noarg_func NK_LP NK_RP */ case 328: /* literal_func ::= noarg_func NK_LP NK_RP */
{ yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy105, NULL)); } { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy105, NULL)); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 336: /* star_func_para_list ::= NK_STAR */ case 337: /* star_func_para_list ::= NK_STAR */
{ yylhsminor.yy60 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } { yylhsminor.yy60 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy60 = yylhsminor.yy60; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
case 341: /* star_func_para ::= table_name NK_DOT NK_STAR */ case 342: /* star_func_para ::= table_name NK_DOT NK_STAR */
case 398: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==398); case 399: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==399);
{ yylhsminor.yy172 = createColumnNode(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy0); } { yylhsminor.yy172 = createColumnNode(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 342: /* predicate ::= expression compare_op expression */ case 343: /* predicate ::= expression compare_op expression */
case 347: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==347); case 348: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==348);
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
...@@ -4144,7 +4150,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -4144,7 +4150,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 343: /* predicate ::= expression BETWEEN expression AND expression */ case 344: /* predicate ::= expression BETWEEN expression AND expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
...@@ -4152,7 +4158,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -4152,7 +4158,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-4].minor.yy172 = yylhsminor.yy172; yymsp[-4].minor.yy172 = yylhsminor.yy172;
break; break;
case 344: /* predicate ::= expression NOT BETWEEN expression AND expression */ case 345: /* predicate ::= expression NOT BETWEEN expression AND expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
...@@ -4160,71 +4166,71 @@ static YYACTIONTYPE yy_reduce( ...@@ -4160,71 +4166,71 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-5].minor.yy172 = yylhsminor.yy172; yymsp[-5].minor.yy172 = yylhsminor.yy172;
break; break;
case 345: /* predicate ::= expression IS NULL */ case 346: /* predicate ::= expression IS NULL */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), NULL));
} }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 346: /* predicate ::= expression IS NOT NULL */ case 347: /* predicate ::= expression IS NOT NULL */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy172);
yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), NULL));
} }
yymsp[-3].minor.yy172 = yylhsminor.yy172; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 348: /* compare_op ::= NK_LT */ case 349: /* compare_op ::= NK_LT */
{ yymsp[0].minor.yy572 = OP_TYPE_LOWER_THAN; } { yymsp[0].minor.yy572 = OP_TYPE_LOWER_THAN; }
break; break;
case 349: /* compare_op ::= NK_GT */ case 350: /* compare_op ::= NK_GT */
{ yymsp[0].minor.yy572 = OP_TYPE_GREATER_THAN; } { yymsp[0].minor.yy572 = OP_TYPE_GREATER_THAN; }
break; break;
case 350: /* compare_op ::= NK_LE */ case 351: /* compare_op ::= NK_LE */
{ yymsp[0].minor.yy572 = OP_TYPE_LOWER_EQUAL; } { yymsp[0].minor.yy572 = OP_TYPE_LOWER_EQUAL; }
break; break;
case 351: /* compare_op ::= NK_GE */ case 352: /* compare_op ::= NK_GE */
{ yymsp[0].minor.yy572 = OP_TYPE_GREATER_EQUAL; } { yymsp[0].minor.yy572 = OP_TYPE_GREATER_EQUAL; }
break; break;
case 352: /* compare_op ::= NK_NE */ case 353: /* compare_op ::= NK_NE */
{ yymsp[0].minor.yy572 = OP_TYPE_NOT_EQUAL; } { yymsp[0].minor.yy572 = OP_TYPE_NOT_EQUAL; }
break; break;
case 353: /* compare_op ::= NK_EQ */ case 354: /* compare_op ::= NK_EQ */
{ yymsp[0].minor.yy572 = OP_TYPE_EQUAL; } { yymsp[0].minor.yy572 = OP_TYPE_EQUAL; }
break; break;
case 354: /* compare_op ::= LIKE */ case 355: /* compare_op ::= LIKE */
{ yymsp[0].minor.yy572 = OP_TYPE_LIKE; } { yymsp[0].minor.yy572 = OP_TYPE_LIKE; }
break; break;
case 355: /* compare_op ::= NOT LIKE */ case 356: /* compare_op ::= NOT LIKE */
{ yymsp[-1].minor.yy572 = OP_TYPE_NOT_LIKE; } { yymsp[-1].minor.yy572 = OP_TYPE_NOT_LIKE; }
break; break;
case 356: /* compare_op ::= MATCH */ case 357: /* compare_op ::= MATCH */
{ yymsp[0].minor.yy572 = OP_TYPE_MATCH; } { yymsp[0].minor.yy572 = OP_TYPE_MATCH; }
break; break;
case 357: /* compare_op ::= NMATCH */ case 358: /* compare_op ::= NMATCH */
{ yymsp[0].minor.yy572 = OP_TYPE_NMATCH; } { yymsp[0].minor.yy572 = OP_TYPE_NMATCH; }
break; break;
case 358: /* compare_op ::= CONTAINS */ case 359: /* compare_op ::= CONTAINS */
{ yymsp[0].minor.yy572 = OP_TYPE_JSON_CONTAINS; } { yymsp[0].minor.yy572 = OP_TYPE_JSON_CONTAINS; }
break; break;
case 359: /* in_op ::= IN */ case 360: /* in_op ::= IN */
{ yymsp[0].minor.yy572 = OP_TYPE_IN; } { yymsp[0].minor.yy572 = OP_TYPE_IN; }
break; break;
case 360: /* in_op ::= NOT IN */ case 361: /* in_op ::= NOT IN */
{ yymsp[-1].minor.yy572 = OP_TYPE_NOT_IN; } { yymsp[-1].minor.yy572 = OP_TYPE_NOT_IN; }
break; break;
case 361: /* in_predicate_value ::= NK_LP expression_list NK_RP */ case 362: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy60)); } { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy60)); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 363: /* boolean_value_expression ::= NOT boolean_primary */ case 364: /* boolean_value_expression ::= NOT boolean_primary */
{ {
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy172), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy172), NULL));
} }
yymsp[-1].minor.yy172 = yylhsminor.yy172; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 364: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ case 365: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
...@@ -4232,7 +4238,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -4232,7 +4238,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 365: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ case 366: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
...@@ -4240,47 +4246,47 @@ static YYACTIONTYPE yy_reduce( ...@@ -4240,47 +4246,47 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 372: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ case 373: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ yylhsminor.yy172 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy172, yymsp[0].minor.yy172, NULL); } { yylhsminor.yy172 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy172, yymsp[0].minor.yy172, NULL); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 375: /* table_primary ::= table_name alias_opt */ case 376: /* table_primary ::= table_name alias_opt */
{ yylhsminor.yy172 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); } { yylhsminor.yy172 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); }
yymsp[-1].minor.yy172 = yylhsminor.yy172; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 376: /* table_primary ::= db_name NK_DOT table_name alias_opt */ case 377: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ yylhsminor.yy172 = createRealTableNode(pCxt, &yymsp[-3].minor.yy105, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); } { yylhsminor.yy172 = createRealTableNode(pCxt, &yymsp[-3].minor.yy105, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); }
yymsp[-3].minor.yy172 = yylhsminor.yy172; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 377: /* table_primary ::= subquery alias_opt */ case 378: /* table_primary ::= subquery alias_opt */
{ yylhsminor.yy172 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172), &yymsp[0].minor.yy105); } { yylhsminor.yy172 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172), &yymsp[0].minor.yy105); }
yymsp[-1].minor.yy172 = yylhsminor.yy172; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 379: /* alias_opt ::= */ case 380: /* alias_opt ::= */
{ yymsp[1].minor.yy105 = nil_token; } { yymsp[1].minor.yy105 = nil_token; }
break; break;
case 380: /* alias_opt ::= table_alias */ case 381: /* alias_opt ::= table_alias */
{ yylhsminor.yy105 = yymsp[0].minor.yy105; } { yylhsminor.yy105 = yymsp[0].minor.yy105; }
yymsp[0].minor.yy105 = yylhsminor.yy105; yymsp[0].minor.yy105 = yylhsminor.yy105;
break; break;
case 381: /* alias_opt ::= AS table_alias */ case 382: /* alias_opt ::= AS table_alias */
{ yymsp[-1].minor.yy105 = yymsp[0].minor.yy105; } { yymsp[-1].minor.yy105 = yymsp[0].minor.yy105; }
break; break;
case 382: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 383: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case 383: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==383); case 384: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==384);
{ yymsp[-2].minor.yy172 = yymsp[-1].minor.yy172; } { yymsp[-2].minor.yy172 = yymsp[-1].minor.yy172; }
break; break;
case 384: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ case 385: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ yylhsminor.yy172 = createJoinTableNode(pCxt, yymsp[-4].minor.yy636, yymsp[-5].minor.yy172, yymsp[-2].minor.yy172, yymsp[0].minor.yy172); } { yylhsminor.yy172 = createJoinTableNode(pCxt, yymsp[-4].minor.yy636, yymsp[-5].minor.yy172, yymsp[-2].minor.yy172, yymsp[0].minor.yy172); }
yymsp[-5].minor.yy172 = yylhsminor.yy172; yymsp[-5].minor.yy172 = yylhsminor.yy172;
break; break;
case 385: /* join_type ::= */ case 386: /* join_type ::= */
{ yymsp[1].minor.yy636 = JOIN_TYPE_INNER; } { yymsp[1].minor.yy636 = JOIN_TYPE_INNER; }
break; break;
case 386: /* join_type ::= INNER */ case 387: /* join_type ::= INNER */
{ yymsp[0].minor.yy636 = JOIN_TYPE_INNER; } { yymsp[0].minor.yy636 = JOIN_TYPE_INNER; }
break; break;
case 387: /* 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 388: /* 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.yy172 = createSelectStmt(pCxt, yymsp[-7].minor.yy617, yymsp[-6].minor.yy60, yymsp[-5].minor.yy172); yymsp[-8].minor.yy172 = createSelectStmt(pCxt, yymsp[-7].minor.yy617, yymsp[-6].minor.yy60, yymsp[-5].minor.yy172);
yymsp[-8].minor.yy172 = addWhereClause(pCxt, yymsp[-8].minor.yy172, yymsp[-4].minor.yy172); yymsp[-8].minor.yy172 = addWhereClause(pCxt, yymsp[-8].minor.yy172, yymsp[-4].minor.yy172);
...@@ -4290,70 +4296,70 @@ static YYACTIONTYPE yy_reduce( ...@@ -4290,70 +4296,70 @@ static YYACTIONTYPE yy_reduce(
yymsp[-8].minor.yy172 = addHavingClause(pCxt, yymsp[-8].minor.yy172, yymsp[0].minor.yy172); yymsp[-8].minor.yy172 = addHavingClause(pCxt, yymsp[-8].minor.yy172, yymsp[0].minor.yy172);
} }
break; break;
case 390: /* set_quantifier_opt ::= ALL */ case 391: /* set_quantifier_opt ::= ALL */
{ yymsp[0].minor.yy617 = false; } { yymsp[0].minor.yy617 = false; }
break; break;
case 391: /* select_list ::= NK_STAR */ case 392: /* select_list ::= NK_STAR */
{ yymsp[0].minor.yy60 = NULL; } { yymsp[0].minor.yy60 = NULL; }
break; break;
case 396: /* select_item ::= common_expression column_alias */ case 397: /* select_item ::= common_expression column_alias */
{ yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172), &yymsp[0].minor.yy105); } { yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172), &yymsp[0].minor.yy105); }
yymsp[-1].minor.yy172 = yylhsminor.yy172; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 397: /* select_item ::= common_expression AS column_alias */ case 398: /* select_item ::= common_expression AS column_alias */
{ yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), &yymsp[0].minor.yy105); } { yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), &yymsp[0].minor.yy105); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 402: /* partition_by_clause_opt ::= PARTITION BY expression_list */ case 403: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 419: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==419); case 420: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==420);
case 431: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==431); case 432: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==432);
{ yymsp[-2].minor.yy60 = yymsp[0].minor.yy60; } { yymsp[-2].minor.yy60 = yymsp[0].minor.yy60; }
break; break;
case 404: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ case 405: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
{ yymsp[-5].minor.yy172 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); } { yymsp[-5].minor.yy172 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); }
break; break;
case 405: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ case 406: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
{ yymsp[-3].minor.yy172 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); } { yymsp[-3].minor.yy172 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); }
break; break;
case 406: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ case 407: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ yymsp[-5].minor.yy172 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), NULL, yymsp[-1].minor.yy172, yymsp[0].minor.yy172); } { yymsp[-5].minor.yy172 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), NULL, yymsp[-1].minor.yy172, yymsp[0].minor.yy172); }
break; break;
case 407: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ case 408: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ yymsp[-7].minor.yy172 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy172), releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), yymsp[-1].minor.yy172, yymsp[0].minor.yy172); } { yymsp[-7].minor.yy172 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy172), releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), yymsp[-1].minor.yy172, yymsp[0].minor.yy172); }
break; break;
case 409: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ case 410: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ yymsp[-3].minor.yy172 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy172); } { yymsp[-3].minor.yy172 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy172); }
break; break;
case 411: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ case 412: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ yymsp[-3].minor.yy172 = createFillNode(pCxt, yymsp[-1].minor.yy202, NULL); } { yymsp[-3].minor.yy172 = createFillNode(pCxt, yymsp[-1].minor.yy202, NULL); }
break; break;
case 412: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ case 413: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ yymsp[-5].minor.yy172 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy60)); } { yymsp[-5].minor.yy172 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy60)); }
break; break;
case 413: /* fill_mode ::= NONE */ case 414: /* fill_mode ::= NONE */
{ yymsp[0].minor.yy202 = FILL_MODE_NONE; } { yymsp[0].minor.yy202 = FILL_MODE_NONE; }
break; break;
case 414: /* fill_mode ::= PREV */ case 415: /* fill_mode ::= PREV */
{ yymsp[0].minor.yy202 = FILL_MODE_PREV; } { yymsp[0].minor.yy202 = FILL_MODE_PREV; }
break; break;
case 415: /* fill_mode ::= NULL */ case 416: /* fill_mode ::= NULL */
{ yymsp[0].minor.yy202 = FILL_MODE_NULL; } { yymsp[0].minor.yy202 = FILL_MODE_NULL; }
break; break;
case 416: /* fill_mode ::= LINEAR */ case 417: /* fill_mode ::= LINEAR */
{ yymsp[0].minor.yy202 = FILL_MODE_LINEAR; } { yymsp[0].minor.yy202 = FILL_MODE_LINEAR; }
break; break;
case 417: /* fill_mode ::= NEXT */ case 418: /* fill_mode ::= NEXT */
{ yymsp[0].minor.yy202 = FILL_MODE_NEXT; } { yymsp[0].minor.yy202 = FILL_MODE_NEXT; }
break; break;
case 420: /* group_by_list ::= expression */ case 421: /* group_by_list ::= expression */
{ yylhsminor.yy60 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172))); } { yylhsminor.yy60 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172))); }
yymsp[0].minor.yy60 = yylhsminor.yy60; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
case 421: /* group_by_list ::= group_by_list NK_COMMA expression */ case 422: /* group_by_list ::= group_by_list NK_COMMA expression */
{ yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172))); } { yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172))); }
yymsp[-2].minor.yy60 = yylhsminor.yy60; yymsp[-2].minor.yy60 = yylhsminor.yy60;
break; break;
case 424: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ case 425: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ {
yylhsminor.yy172 = addOrderByClause(pCxt, yymsp[-3].minor.yy172, yymsp[-2].minor.yy60); yylhsminor.yy172 = addOrderByClause(pCxt, yymsp[-3].minor.yy172, yymsp[-2].minor.yy60);
yylhsminor.yy172 = addSlimitClause(pCxt, yylhsminor.yy172, yymsp[-1].minor.yy172); yylhsminor.yy172 = addSlimitClause(pCxt, yylhsminor.yy172, yymsp[-1].minor.yy172);
...@@ -4361,56 +4367,56 @@ static YYACTIONTYPE yy_reduce( ...@@ -4361,56 +4367,56 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-3].minor.yy172 = yylhsminor.yy172; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 426: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ case 427: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ yylhsminor.yy172 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy172, yymsp[0].minor.yy172); } { yylhsminor.yy172 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy172, yymsp[0].minor.yy172); }
yymsp[-3].minor.yy172 = yylhsminor.yy172; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 427: /* query_expression_body ::= query_expression_body UNION query_expression_body */ case 428: /* query_expression_body ::= query_expression_body UNION query_expression_body */
{ yylhsminor.yy172 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy172, yymsp[0].minor.yy172); } { yylhsminor.yy172 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy172, yymsp[0].minor.yy172); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 429: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ case 430: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
{ yymsp[-5].minor.yy172 = yymsp[-4].minor.yy172; } { yymsp[-5].minor.yy172 = yymsp[-4].minor.yy172; }
yy_destructor(yypParser,350,&yymsp[-3].minor); yy_destructor(yypParser,350,&yymsp[-3].minor);
yy_destructor(yypParser,351,&yymsp[-2].minor); yy_destructor(yypParser,351,&yymsp[-2].minor);
yy_destructor(yypParser,352,&yymsp[-1].minor); yy_destructor(yypParser,352,&yymsp[-1].minor);
break; break;
case 433: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ case 434: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 437: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==437); case 438: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==438);
{ yymsp[-1].minor.yy172 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } { yymsp[-1].minor.yy172 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break; break;
case 434: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 435: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 438: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==438); case 439: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==439);
{ yymsp[-3].minor.yy172 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } { yymsp[-3].minor.yy172 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break; break;
case 435: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 436: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case 439: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==439); case 440: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==440);
{ yymsp[-3].minor.yy172 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } { yymsp[-3].minor.yy172 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break; break;
case 440: /* subquery ::= NK_LP query_expression NK_RP */ case 441: /* subquery ::= NK_LP query_expression NK_RP */
{ yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy172); } { yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy172); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 444: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ case 445: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ yylhsminor.yy172 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), yymsp[-1].minor.yy14, yymsp[0].minor.yy17); } { yylhsminor.yy172 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), yymsp[-1].minor.yy14, yymsp[0].minor.yy17); }
yymsp[-2].minor.yy172 = yylhsminor.yy172; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 445: /* ordering_specification_opt ::= */ case 446: /* ordering_specification_opt ::= */
{ yymsp[1].minor.yy14 = ORDER_ASC; } { yymsp[1].minor.yy14 = ORDER_ASC; }
break; break;
case 446: /* ordering_specification_opt ::= ASC */ case 447: /* ordering_specification_opt ::= ASC */
{ yymsp[0].minor.yy14 = ORDER_ASC; } { yymsp[0].minor.yy14 = ORDER_ASC; }
break; break;
case 447: /* ordering_specification_opt ::= DESC */ case 448: /* ordering_specification_opt ::= DESC */
{ yymsp[0].minor.yy14 = ORDER_DESC; } { yymsp[0].minor.yy14 = ORDER_DESC; }
break; break;
case 448: /* null_ordering_opt ::= */ case 449: /* null_ordering_opt ::= */
{ yymsp[1].minor.yy17 = NULL_ORDER_DEFAULT; } { yymsp[1].minor.yy17 = NULL_ORDER_DEFAULT; }
break; break;
case 449: /* null_ordering_opt ::= NULLS FIRST */ case 450: /* null_ordering_opt ::= NULLS FIRST */
{ yymsp[-1].minor.yy17 = NULL_ORDER_FIRST; } { yymsp[-1].minor.yy17 = NULL_ORDER_FIRST; }
break; break;
case 450: /* null_ordering_opt ::= NULLS LAST */ case 451: /* null_ordering_opt ::= NULLS LAST */
{ yymsp[-1].minor.yy17 = NULL_ORDER_LAST; } { yymsp[-1].minor.yy17 = NULL_ORDER_LAST; }
break; break;
default: default:
......
...@@ -70,6 +70,12 @@ TEST_F(ParserSelectTest, pseudoColumn) { ...@@ -70,6 +70,12 @@ TEST_F(ParserSelectTest, pseudoColumn) {
run("SELECT _WSTARTTS, _WENDTS, COUNT(*) FROM t1 INTERVAL(10s)"); run("SELECT _WSTARTTS, _WENDTS, COUNT(*) FROM t1 INTERVAL(10s)");
} }
TEST_F(ParserSelectTest, pseudoColumnSemanticCheck) {
useDb("root", "test");
run("SELECT TBNAME FROM (SELECT * FROM st1s1)", TSDB_CODE_PAR_INVALID_TBNAME, PARSER_STAGE_TRANSLATE);
}
TEST_F(ParserSelectTest, multiResFunc) { TEST_F(ParserSelectTest, multiResFunc) {
useDb("root", "test"); useDb("root", "test");
......
...@@ -32,6 +32,7 @@ extern "C" { ...@@ -32,6 +32,7 @@ extern "C" {
#define planWarn(param, ...) qWarn("PLAN: " param, __VA_ARGS__) #define planWarn(param, ...) qWarn("PLAN: " param, __VA_ARGS__)
#define planInfo(param, ...) qInfo("PLAN: " param, __VA_ARGS__) #define planInfo(param, ...) qInfo("PLAN: " param, __VA_ARGS__)
#define planDebug(param, ...) qDebug("PLAN: " param, __VA_ARGS__) #define planDebug(param, ...) qDebug("PLAN: " param, __VA_ARGS__)
#define planDebugL(param, ...) qDebugL("PLAN: " param, __VA_ARGS__)
#define planTrace(param, ...) qTrace("PLAN: " param, __VA_ARGS__) #define planTrace(param, ...) qTrace("PLAN: " param, __VA_ARGS__)
int32_t generateUsageErrMsg(char* pBuf, int32_t len, int32_t errCode, ...); int32_t generateUsageErrMsg(char* pBuf, int32_t len, int32_t errCode, ...);
......
...@@ -310,12 +310,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect ...@@ -310,12 +310,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
static int32_t createSubqueryLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, STempTableNode* pTable, static int32_t createSubqueryLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, STempTableNode* pTable,
SLogicNode** pLogicNode) { SLogicNode** pLogicNode) {
int32_t code = createQueryLogicNode(pCxt, pTable->pSubquery, pLogicNode); return createQueryLogicNode(pCxt, pTable->pSubquery, pLogicNode);
if (TSDB_CODE_SUCCESS == code) {
SNode* pNode;
FOREACH(pNode, (*pLogicNode)->pTargets) { strcpy(((SColumnNode*)pNode)->tableAlias, pTable->table.tableAlias); }
}
return code;
} }
static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SJoinTableNode* pJoinTable, static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SJoinTableNode* pJoinTable,
...@@ -879,7 +874,8 @@ static int32_t createSetOpProjectLogicNode(SLogicPlanContext* pCxt, SSetOperator ...@@ -879,7 +874,8 @@ static int32_t createSetOpProjectLogicNode(SLogicPlanContext* pCxt, SSetOperator
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createColumnByProjections(pCxt, NULL, pSetOperator->pProjectionList, &pProject->node.pTargets); code = createColumnByProjections(pCxt, pSetOperator->stmtName, pSetOperator->pProjectionList,
&pProject->node.pTargets);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
...@@ -933,7 +929,7 @@ static int32_t createSetOpLogicNode(SLogicPlanContext* pCxt, SSetOperator* pSetO ...@@ -933,7 +929,7 @@ static int32_t createSetOpLogicNode(SLogicPlanContext* pCxt, SSetOperator* pSetO
code = createSetOpAggLogicNode(pCxt, pSetOperator, &pSetOp); code = createSetOpAggLogicNode(pCxt, pSetOperator, &pSetOp);
break; break;
default: default:
code = -1; code = TSDB_CODE_FAILED;
break; break;
} }
......
...@@ -598,39 +598,63 @@ static bool cpdIsPrimaryKeyEqualCond(SJoinLogicNode* pJoin, SNode* pCond) { ...@@ -598,39 +598,63 @@ static bool cpdIsPrimaryKeyEqualCond(SJoinLogicNode* pJoin, SNode* pCond) {
return false; return false;
} }
static int32_t cpdCheckOpCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin, SNode* pOnCond) { static bool cpdContainPrimaryKeyEqualCond(SJoinLogicNode* pJoin, SNode* pCond) {
if (!cpdIsPrimaryKeyEqualCond(pJoin, pOnCond)) { if (QUERY_NODE_LOGIC_CONDITION == nodeType(pCond)) {
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL); SLogicConditionNode* pLogicCond = (SLogicConditionNode*)pCond;
} if (LOGIC_COND_TYPE_AND != pLogicCond->condType) {
return TSDB_CODE_SUCCESS; return false;
}
static int32_t cpdCheckLogicCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin, SLogicConditionNode* pOnCond) {
if (LOGIC_COND_TYPE_AND != pOnCond->condType) {
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
} }
bool hasPrimaryKeyEqualCond = false; bool hasPrimaryKeyEqualCond = false;
SNode* pCond = NULL; SNode* pCond = NULL;
FOREACH(pCond, pOnCond->pParameterList) { FOREACH(pCond, pLogicCond->pParameterList) {
if (cpdIsPrimaryKeyEqualCond(pJoin, pCond)) { if (cpdContainPrimaryKeyEqualCond(pJoin, pCond)) {
hasPrimaryKeyEqualCond = true; hasPrimaryKeyEqualCond = true;
break;
} }
} }
if (!hasPrimaryKeyEqualCond) { return hasPrimaryKeyEqualCond;
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL); } else {
} return cpdIsPrimaryKeyEqualCond(pJoin, pCond);
return TSDB_CODE_SUCCESS; }
} }
// static int32_t cpdCheckOpCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin, SNode* pOnCond) {
// if (!cpdIsPrimaryKeyEqualCond(pJoin, pOnCond)) {
// return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
// }
// return TSDB_CODE_SUCCESS;
// }
// static int32_t cpdCheckLogicCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin, SLogicConditionNode* pOnCond) {
// if (LOGIC_COND_TYPE_AND != pOnCond->condType) {
// return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
// }
// bool hasPrimaryKeyEqualCond = false;
// SNode* pCond = NULL;
// FOREACH(pCond, pOnCond->pParameterList) {
// if (cpdIsPrimaryKeyEqualCond(pJoin, pCond)) {
// hasPrimaryKeyEqualCond = true;
// }
// }
// if (!hasPrimaryKeyEqualCond) {
// return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
// }
// return TSDB_CODE_SUCCESS;
// }
static int32_t cpdCheckJoinOnCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) { static int32_t cpdCheckJoinOnCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) {
if (NULL == pJoin->pOnConditions) { if (NULL == pJoin->pOnConditions) {
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_NOT_SUPPORT_CROSS_JOIN); return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_NOT_SUPPORT_CROSS_JOIN);
} }
if (QUERY_NODE_LOGIC_CONDITION == nodeType(pJoin->pOnConditions)) { if (!cpdContainPrimaryKeyEqualCond(pJoin, pJoin->pOnConditions)) {
return cpdCheckLogicCond(pCxt, pJoin, (SLogicConditionNode*)pJoin->pOnConditions); return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
} else {
return cpdCheckOpCond(pCxt, pJoin, pJoin->pOnConditions);
} }
return TSDB_CODE_SUCCESS;
// if (QUERY_NODE_LOGIC_CONDITION == nodeType(pJoin->pOnConditions)) {
// return cpdCheckLogicCond(pCxt, pJoin, (SLogicConditionNode*)pJoin->pOnConditions);
// } else {
// return cpdCheckOpCond(pCxt, pJoin, pJoin->pOnConditions);
// }
} }
static int32_t cpdPushJoinCondition(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) { static int32_t cpdPushJoinCondition(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) {
......
...@@ -204,6 +204,75 @@ static int32_t ctjSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { ...@@ -204,6 +204,75 @@ static int32_t ctjSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
return code; return code;
} }
static bool unionIsChildSubplan(SLogicNode* pLogicNode, int32_t groupId) {
if (QUERY_NODE_LOGIC_PLAN_EXCHANGE == nodeType(pLogicNode)) {
return ((SExchangeLogicNode*)pLogicNode)->srcGroupId == groupId;
}
SNode* pChild;
FOREACH(pChild, pLogicNode->pChildren) {
bool isChild = unionIsChildSubplan((SLogicNode*)pChild, groupId);
if (isChild) {
return isChild;
}
}
return false;
}
static int32_t unionMountSubplan(SLogicSubplan* pParent, SNodeList* pChildren) {
SNode* pChild = NULL;
WHERE_EACH(pChild, pChildren) {
if (unionIsChildSubplan(pParent->pNode, ((SLogicSubplan*)pChild)->id.groupId)) {
int32_t code = nodesListMakeAppend(&pParent->pChildren, pChild);
if (TSDB_CODE_SUCCESS == code) {
REPLACE_NODE(NULL);
ERASE_NODE(pChildren);
continue;
} else {
return code;
}
}
WHERE_NEXT;
}
return TSDB_CODE_SUCCESS;
}
static SLogicSubplan* unionCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode) {
SLogicSubplan* pSubplan = nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN);
if (NULL == pSubplan) {
return NULL;
}
pSubplan->id.groupId = pCxt->groupId;
pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
pSubplan->pNode = pNode;
return pSubplan;
}
static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubplan, SLogicNode* pSplitNode) {
SNodeList* pSubplanChildren = pUnionSubplan->pChildren;
pUnionSubplan->pChildren = NULL;
int32_t code = TSDB_CODE_SUCCESS;
SNode* pChild = NULL;
FOREACH(pChild, pSplitNode->pChildren) {
SLogicSubplan* pNewSubplan = unionCreateSubplan(pCxt, (SLogicNode*)pChild);
code = nodesListMakeStrictAppend(&pUnionSubplan->pChildren, pNewSubplan);
if (TSDB_CODE_SUCCESS == code) {
REPLACE_NODE(NULL);
code = unionMountSubplan(pNewSubplan, pSubplanChildren);
}
if (TSDB_CODE_SUCCESS != code) {
break;
}
}
if (TSDB_CODE_SUCCESS == code) {
nodesDestroyList(pSubplanChildren);
DESTORY_LIST(pSplitNode->pChildren);
}
return code;
}
static SLogicNode* uaMatchByNode(SLogicNode* pNode) { static SLogicNode* uaMatchByNode(SLogicNode* pNode) {
if (QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pNode) && LIST_LENGTH(pNode->pChildren) > 1) { if (QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pNode) && LIST_LENGTH(pNode->pChildren) > 1) {
return pNode; return pNode;
...@@ -227,17 +296,6 @@ static bool uaFindSplitNode(SLogicSubplan* pSubplan, SUaInfo* pInfo) { ...@@ -227,17 +296,6 @@ static bool uaFindSplitNode(SLogicSubplan* pSubplan, SUaInfo* pInfo) {
return NULL != pSplitNode; return NULL != pSplitNode;
} }
static SLogicSubplan* uaCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode) {
SLogicSubplan* pSubplan = nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN);
if (NULL == pSubplan) {
return NULL;
}
pSubplan->id.groupId = pCxt->groupId;
pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
pSubplan->pNode = pNode;
return pSubplan;
}
static int32_t uaCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SProjectLogicNode* pProject) { static int32_t uaCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SProjectLogicNode* pProject) {
SExchangeLogicNode* pExchange = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); SExchangeLogicNode* pExchange = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE);
if (NULL == pExchange) { if (NULL == pExchange) {
...@@ -276,20 +334,8 @@ static int32_t uaSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { ...@@ -276,20 +334,8 @@ static int32_t uaSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t code = TSDB_CODE_SUCCESS; int32_t code = unionSplitSubplan(pCxt, info.pSubplan, (SLogicNode*)info.pProject);
SNode* pChild = NULL;
FOREACH(pChild, info.pProject->node.pChildren) {
code = nodesListMakeStrictAppend(&info.pSubplan->pChildren, uaCreateSubplan(pCxt, (SLogicNode*)pChild));
if (TSDB_CODE_SUCCESS == code) {
REPLACE_NODE(NULL);
} else {
break;
}
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
nodesClearList(info.pProject->node.pChildren);
info.pProject->node.pChildren = NULL;
code = uaCreateExchangeNode(pCxt, info.pSubplan, info.pProject); code = uaCreateExchangeNode(pCxt, info.pSubplan, info.pProject);
} }
++(pCxt->groupId); ++(pCxt->groupId);
...@@ -343,20 +389,8 @@ static int32_t unSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { ...@@ -343,20 +389,8 @@ static int32_t unSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t code = TSDB_CODE_SUCCESS; int32_t code = unionSplitSubplan(pCxt, info.pSubplan, (SLogicNode*)info.pAgg);
SNode* pChild = NULL;
FOREACH(pChild, info.pAgg->node.pChildren) {
code = nodesListMakeStrictAppend(&info.pSubplan->pChildren, uaCreateSubplan(pCxt, (SLogicNode*)pChild));
if (TSDB_CODE_SUCCESS == code) {
REPLACE_NODE(NULL);
} else {
break;
}
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
nodesClearList(info.pAgg->node.pChildren);
info.pAgg->node.pChildren = NULL;
code = unCreateExchangeNode(pCxt, info.pSubplan, info.pAgg); code = unCreateExchangeNode(pCxt, info.pSubplan, info.pAgg);
} }
++(pCxt->groupId); ++(pCxt->groupId);
......
...@@ -30,6 +30,14 @@ TEST_F(PlanJoinTest, basic) { ...@@ -30,6 +30,14 @@ TEST_F(PlanJoinTest, basic) {
run("SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts"); run("SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts");
} }
TEST_F(PlanJoinTest, complex) {
useDb("root", "test");
run("SELECT t1.c1, t2.c2 FROM st1s1 t1, st1s2 t2 "
"WHERE t1.ts = t2.ts AND t1.c1 BETWEEN -10 AND 10 AND t2.c1 BETWEEN -100 AND 100 AND "
"(t1.c2 LIKE 'nchar%' OR t1.c1 = 0 OR t2.c2 LIKE 'nchar%' OR t2.c1 = 0)");
}
TEST_F(PlanJoinTest, withWhere) { TEST_F(PlanJoinTest, withWhere) {
useDb("root", "test"); useDb("root", "test");
......
...@@ -23,11 +23,33 @@ class PlanSetOpTest : public PlannerTestBase {}; ...@@ -23,11 +23,33 @@ class PlanSetOpTest : public PlannerTestBase {};
TEST_F(PlanSetOpTest, unionAll) { TEST_F(PlanSetOpTest, unionAll) {
useDb("root", "test"); useDb("root", "test");
run("select c1, c2 from t1 where c1 > 10 union all select c1, c2 from t1 where c1 > 20"); run("SELECT c1, c2 FROM t1 WHERE c1 > 10 UNION ALL SELECT c1, c2 FROM t1 WHERE c1 > 20");
}
TEST_F(PlanSetOpTest, unionAllSubquery) {
useDb("root", "test");
run("SELECT * FROM (SELECT c1, c2 FROM t1 UNION ALL SELECT c1, c2 FROM t1)");
} }
TEST_F(PlanSetOpTest, union) { TEST_F(PlanSetOpTest, union) {
useDb("root", "test"); useDb("root", "test");
run("select c1, c2 from t1 where c1 > 10 union select c1, c2 from t1 where c1 > 20"); run("SELECT c1, c2 FROM t1 WHERE c1 > 10 UNION SELECT c1, c2 FROM t1 WHERE c1 > 20");
}
TEST_F(PlanSetOpTest, unionContainJoin) {
useDb("root", "test");
run("SELECT t1.c1 FROM st1s1 t1 join st1s2 t2 on t1.ts = t2.ts "
"WHERE t1.c1 IS NOT NULL GROUP BY t1.c1 HAVING t1.c1 IS NOT NULL "
"UNION "
"SELECT t1.c1 FROM st1s1 t1 join st1s2 t2 on t1.ts = t2.ts "
"WHERE t1.c1 IS NOT NULL GROUP BY t1.c1 HAVING t1.c1 IS NOT NULL");
}
TEST_F(PlanSetOpTest, unionSubquery) {
useDb("root", "test");
run("SELECT * FROM (SELECT c1, c2 FROM t1 UNION SELECT c1, c2 FROM t1)");
} }
...@@ -110,9 +110,9 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) { ...@@ -110,9 +110,9 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) {
QW_LOCK(QW_READ, &mgmt->schLock); QW_LOCK(QW_READ, &mgmt->schLock);
QW_DUMP("total remain schduler num:%d", taosHashGetSize(mgmt->schHash)); /*QW_DUMP("total remain schduler num:%d", taosHashGetSize(mgmt->schHash));*/
void * key = NULL; void *key = NULL;
size_t keyLen = 0; size_t keyLen = 0;
int32_t i = 0; int32_t i = 0;
SQWSchStatus *sch = NULL; SQWSchStatus *sch = NULL;
...@@ -127,7 +127,7 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) { ...@@ -127,7 +127,7 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) {
QW_UNLOCK(QW_READ, &mgmt->schLock); QW_UNLOCK(QW_READ, &mgmt->schLock);
QW_DUMP("total remain ctx num:%d", taosHashGetSize(mgmt->ctxHash)); /*QW_DUMP("total remain ctx num:%d", taosHashGetSize(mgmt->ctxHash));*/
} }
char *qwPhaseStr(int32_t phase) { char *qwPhaseStr(int32_t phase) {
...@@ -462,7 +462,7 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { ...@@ -462,7 +462,7 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
} }
int32_t qwDropTaskStatus(QW_FPARAMS_DEF) { int32_t qwDropTaskStatus(QW_FPARAMS_DEF) {
SQWSchStatus * sch = NULL; SQWSchStatus *sch = NULL;
SQWTaskStatus *task = NULL; SQWTaskStatus *task = NULL;
int32_t code = 0; int32_t code = 0;
...@@ -499,7 +499,7 @@ _return: ...@@ -499,7 +499,7 @@ _return:
} }
int32_t qwUpdateTaskStatus(QW_FPARAMS_DEF, int8_t status) { int32_t qwUpdateTaskStatus(QW_FPARAMS_DEF, int8_t status) {
SQWSchStatus * sch = NULL; SQWSchStatus *sch = NULL;
SQWTaskStatus *task = NULL; SQWTaskStatus *task = NULL;
int32_t code = 0; int32_t code = 0;
...@@ -550,11 +550,11 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { ...@@ -550,11 +550,11 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryEnd) { int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryEnd) {
int32_t code = 0; int32_t code = 0;
bool qcontinue = true; bool qcontinue = true;
SSDataBlock * pRes = NULL; SSDataBlock *pRes = NULL;
uint64_t useconds = 0; uint64_t useconds = 0;
int32_t i = 0; int32_t i = 0;
int32_t execNum = 0; int32_t execNum = 0;
qTaskInfo_t * taskHandle = &ctx->taskHandle; qTaskInfo_t *taskHandle = &ctx->taskHandle;
DataSinkHandle sinkHandle = ctx->sinkHandle; DataSinkHandle sinkHandle = ctx->sinkHandle;
while (true) { while (true) {
...@@ -632,7 +632,7 @@ int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) ...@@ -632,7 +632,7 @@ int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo)
return TSDB_CODE_QRY_OUT_OF_MEMORY; return TSDB_CODE_QRY_OUT_OF_MEMORY;
} }
void * key = NULL; void *key = NULL;
size_t keyLen = 0; size_t keyLen = 0;
int32_t i = 0; int32_t i = 0;
STaskStatus status = {0}; STaskStatus status = {0};
...@@ -720,7 +720,7 @@ int32_t qwGetResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, void ...@@ -720,7 +720,7 @@ int32_t qwGetResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, void
int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *input, SQWPhaseOutput *output) { int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *input, SQWPhaseOutput *output) {
int32_t code = 0; int32_t code = 0;
SQWTaskCtx * ctx = NULL; SQWTaskCtx *ctx = NULL;
SRpcHandleInfo *dropConnection = NULL; SRpcHandleInfo *dropConnection = NULL;
SRpcHandleInfo *cancelConnection = NULL; SRpcHandleInfo *cancelConnection = NULL;
...@@ -927,11 +927,11 @@ _return: ...@@ -927,11 +927,11 @@ _return:
int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t explain) { int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t explain) {
int32_t code = 0; int32_t code = 0;
bool queryRsped = false; bool queryRsped = false;
SSubplan* plan = NULL; SSubplan *plan = NULL;
SQWPhaseInput input = {0}; SQWPhaseInput input = {0};
qTaskInfo_t pTaskInfo = NULL; qTaskInfo_t pTaskInfo = NULL;
DataSinkHandle sinkHandle = NULL; DataSinkHandle sinkHandle = NULL;
SQWTaskCtx * ctx = NULL; SQWTaskCtx *ctx = NULL;
QW_ERR_JRET(qwRegisterQueryBrokenLinkArg(QW_FPARAMS(), &qwMsg->connInfo)); QW_ERR_JRET(qwRegisterQueryBrokenLinkArg(QW_FPARAMS(), &qwMsg->connInfo));
...@@ -944,7 +944,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex ...@@ -944,7 +944,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex
ctx->ctrlConnInfo = qwMsg->connInfo; ctx->ctrlConnInfo = qwMsg->connInfo;
QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg); /*QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg);*/
code = qStringToSubplan(qwMsg->msg, &plan); code = qStringToSubplan(qwMsg->msg, &plan);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
...@@ -1055,10 +1055,10 @@ _return: ...@@ -1055,10 +1055,10 @@ _return:
} }
int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
SQWTaskCtx * ctx = NULL; SQWTaskCtx *ctx = NULL;
int32_t code = 0; int32_t code = 0;
SQWPhaseInput input = {0}; SQWPhaseInput input = {0};
void * rsp = NULL; void *rsp = NULL;
int32_t dataLen = 0; int32_t dataLen = 0;
bool queryEnd = false; bool queryEnd = false;
...@@ -1138,8 +1138,8 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) { ...@@ -1138,8 +1138,8 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
int32_t code = 0; int32_t code = 0;
int32_t dataLen = 0; int32_t dataLen = 0;
bool locked = false; bool locked = false;
SQWTaskCtx * ctx = NULL; SQWTaskCtx *ctx = NULL;
void * rsp = NULL; void *rsp = NULL;
SQWPhaseInput input = {0}; SQWPhaseInput input = {0};
QW_ERR_JRET(qwHandlePrePhaseEvents(QW_FPARAMS(), QW_PHASE_PRE_FETCH, &input, NULL)); QW_ERR_JRET(qwHandlePrePhaseEvents(QW_FPARAMS(), QW_PHASE_PRE_FETCH, &input, NULL));
...@@ -1274,7 +1274,7 @@ _return: ...@@ -1274,7 +1274,7 @@ _return:
int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) {
int32_t code = 0; int32_t code = 0;
SSchedulerHbRsp rsp = {0}; SSchedulerHbRsp rsp = {0};
SQWSchStatus * sch = NULL; SQWSchStatus *sch = NULL;
QW_ERR_RET(qwAcquireAddScheduler(mgmt, req->sId, QW_READ, &sch)); QW_ERR_RET(qwAcquireAddScheduler(mgmt, req->sId, QW_READ, &sch));
...@@ -1300,7 +1300,7 @@ int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *re ...@@ -1300,7 +1300,7 @@ int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *re
int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) {
int32_t code = 0; int32_t code = 0;
SSchedulerHbRsp rsp = {0}; SSchedulerHbRsp rsp = {0};
SQWSchStatus * sch = NULL; SQWSchStatus *sch = NULL;
if (qwMsg->code) { if (qwMsg->code) {
QW_RET(qwProcessHbLinkBroken(mgmt, qwMsg, req)); QW_RET(qwProcessHbLinkBroken(mgmt, qwMsg, req));
...@@ -1338,13 +1338,13 @@ _return: ...@@ -1338,13 +1338,13 @@ _return:
qwMsg->connInfo.handle = NULL; qwMsg->connInfo.handle = NULL;
} }
QW_DLOG("hb rsp send, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code)); /*QW_DLOG("hb rsp send, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));*/
QW_RET(TSDB_CODE_SUCCESS); QW_RET(TSDB_CODE_SUCCESS);
} }
void qwProcessHbTimerEvent(void *param, void *tmrId) { void qwProcessHbTimerEvent(void *param, void *tmrId) {
SQWHbParam* hbParam = (SQWHbParam*)param; SQWHbParam *hbParam = (SQWHbParam *)param;
if (hbParam->qwrId != atomic_load_32(&gQwMgmt.qwRef)) { if (hbParam->qwrId != atomic_load_32(&gQwMgmt.qwRef)) {
return; return;
} }
...@@ -1359,7 +1359,7 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { ...@@ -1359,7 +1359,7 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) {
SQWSchStatus *sch = NULL; SQWSchStatus *sch = NULL;
int32_t taskNum = 0; int32_t taskNum = 0;
SQWHbInfo * rspList = NULL; SQWHbInfo *rspList = NULL;
int32_t code = 0; int32_t code = 0;
qwDbgDumpMgmtInfo(mgmt); qwDbgDumpMgmtInfo(mgmt);
...@@ -1383,7 +1383,7 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { ...@@ -1383,7 +1383,7 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) {
return; return;
} }
void * key = NULL; void *key = NULL;
size_t keyLen = 0; size_t keyLen = 0;
int32_t i = 0; int32_t i = 0;
...@@ -1413,8 +1413,8 @@ _return: ...@@ -1413,8 +1413,8 @@ _return:
for (int32_t j = 0; j < i; ++j) { for (int32_t j = 0; j < i; ++j) {
qwBuildAndSendHbRsp(&rspList[j].connInfo, &rspList[j].rsp, code); qwBuildAndSendHbRsp(&rspList[j].connInfo, &rspList[j].rsp, code);
QW_DLOG("hb rsp send, handle:%p, code:%x - %s, taskNum:%d", rspList[j].connInfo.handle, code, tstrerror(code), /*QW_DLOG("hb rsp send, handle:%p, code:%x - %s, taskNum:%d", rspList[j].connInfo.handle, code, tstrerror(code),*/
(rspList[j].rsp.taskStatus ? (int32_t)taosArrayGetSize(rspList[j].rsp.taskStatus) : 0)); /*(rspList[j].rsp.taskStatus ? (int32_t)taosArrayGetSize(rspList[j].rsp.taskStatus) : 0));*/
tFreeSSchedulerHbRsp(&rspList[j].rsp); tFreeSSchedulerHbRsp(&rspList[j].rsp);
} }
...@@ -1428,14 +1428,12 @@ void qwCloseRef(void) { ...@@ -1428,14 +1428,12 @@ void qwCloseRef(void) {
taosWLockLatch(&gQwMgmt.lock); taosWLockLatch(&gQwMgmt.lock);
if (atomic_load_32(&gQwMgmt.qwNum) <= 0 && gQwMgmt.qwRef >= 0) { if (atomic_load_32(&gQwMgmt.qwNum) <= 0 && gQwMgmt.qwRef >= 0) {
taosCloseRef(gQwMgmt.qwRef); taosCloseRef(gQwMgmt.qwRef);
gQwMgmt.qwRef= -1; gQwMgmt.qwRef = -1;
} }
taosWUnLockLatch(&gQwMgmt.lock); taosWUnLockLatch(&gQwMgmt.lock);
} }
void qwDestroySchStatus(SQWSchStatus *pStatus) { void qwDestroySchStatus(SQWSchStatus *pStatus) { taosHashCleanup(pStatus->tasksHash); }
taosHashCleanup(pStatus->tasksHash);
}
void qwDestroyImpl(void *pMgmt) { void qwDestroyImpl(void *pMgmt) {
SQWorker *mgmt = (SQWorker *)pMgmt; SQWorker *mgmt = (SQWorker *)pMgmt;
...@@ -1467,7 +1465,7 @@ void qwDestroyImpl(void *pMgmt) { ...@@ -1467,7 +1465,7 @@ void qwDestroyImpl(void *pMgmt) {
int32_t qwOpenRef(void) { int32_t qwOpenRef(void) {
taosWLockLatch(&gQwMgmt.lock); taosWLockLatch(&gQwMgmt.lock);
if (gQwMgmt.qwRef < 0) { if (gQwMgmt.qwRef < 0) {
gQwMgmt.qwRef= taosOpenRef(100, qwDestroyImpl); gQwMgmt.qwRef = taosOpenRef(100, qwDestroyImpl);
if (gQwMgmt.qwRef < 0) { if (gQwMgmt.qwRef < 0) {
taosWUnLockLatch(&gQwMgmt.lock); taosWUnLockLatch(&gQwMgmt.lock);
qError("init qworker ref failed"); qError("init qworker ref failed");
...@@ -1577,7 +1575,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qW ...@@ -1577,7 +1575,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qW
SQWHbParam *param = NULL; SQWHbParam *param = NULL;
qwSetHbParam(mgmt->refId, &param); qwSetHbParam(mgmt->refId, &param);
mgmt->hbTimer = taosTmrStart(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, (void*)param, mgmt->timer); mgmt->hbTimer = taosTmrStart(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, (void *)param, mgmt->timer);
if (NULL == mgmt->hbTimer) { if (NULL == mgmt->hbTimer) {
qError("start hb timer failed"); qError("start hb timer failed");
QW_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); QW_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
...@@ -1678,7 +1676,7 @@ int32_t qwUpdateSchLastAccess(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64 ...@@ -1678,7 +1676,7 @@ int32_t qwUpdateSchLastAccess(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64
} }
int32_t qwGetTaskStatus(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int8_t *taskStatus) { int32_t qwGetTaskStatus(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int8_t *taskStatus) {
SQWSchStatus * sch = NULL; SQWSchStatus *sch = NULL;
SQWTaskStatus *task = NULL; SQWTaskStatus *task = NULL;
int32_t code = 0; int32_t code = 0;
...@@ -1705,7 +1703,7 @@ int32_t qwGetTaskStatus(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId ...@@ -1705,7 +1703,7 @@ int32_t qwGetTaskStatus(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId
} }
int32_t qwCancelTask(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId) { int32_t qwCancelTask(SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId) {
SQWSchStatus * sch = NULL; SQWSchStatus *sch = NULL;
SQWTaskStatus *task = NULL; SQWTaskStatus *task = NULL;
int32_t code = 0; int32_t code = 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
extern "C" { extern "C" {
#endif #endif
typedef int (*tdb_cmpr_fn_t)(const void *pKey1, int kLen1, const void *pKey2, int kLen2); typedef int (*tdb_cmpr_fn_t)(const void *pKey1, int32_t kLen1, const void *pKey2, int32_t kLen2);
// exposed types // exposed types
typedef struct STDB TDB; typedef struct STDB TDB;
...@@ -31,42 +31,42 @@ typedef struct STBC TBC; ...@@ -31,42 +31,42 @@ typedef struct STBC TBC;
typedef struct STxn TXN; typedef struct STxn TXN;
// TDB // TDB
int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb); int32_t tdbOpen(const char *dbname, int szPage, int pages, TDB **ppDb);
int tdbClose(TDB *pDb); int32_t tdbClose(TDB *pDb);
int tdbBegin(TDB *pDb, TXN *pTxn); int32_t tdbBegin(TDB *pDb, TXN *pTxn);
int tdbCommit(TDB *pDb, TXN *pTxn); int32_t tdbCommit(TDB *pDb, TXN *pTxn);
// TTB // TTB
int tdbTbOpen(const char *fname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn, TDB *pEnv, TTB **ppTb); int32_t tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn, TDB *pEnv, TTB **ppTb);
int tdbTbClose(TTB *pTb); int32_t tdbTbClose(TTB *pTb);
int tdbTbDrop(TTB *pTb); int32_t tdbTbDrop(TTB *pTb);
int tdbTbInsert(TTB *pTb, const void *pKey, int keyLen, const void *pVal, int valLen, TXN *pTxn); int32_t tdbTbInsert(TTB *pTb, const void *pKey, int keyLen, const void *pVal, int valLen, TXN *pTxn);
int tdbTbDelete(TTB *pTb, const void *pKey, int kLen, TXN *pTxn); int32_t tdbTbDelete(TTB *pTb, const void *pKey, int kLen, TXN *pTxn);
int tdbTbUpsert(TTB *pTb, const void *pKey, int kLen, const void *pVal, int vLen, TXN *pTxn); int32_t tdbTbUpsert(TTB *pTb, const void *pKey, int kLen, const void *pVal, int vLen, TXN *pTxn);
int tdbTbGet(TTB *pTb, const void *pKey, int kLen, void **ppVal, int *vLen); int32_t tdbTbGet(TTB *pTb, const void *pKey, int kLen, void **ppVal, int *vLen);
int tdbTbPGet(TTB *pTb, const void *pKey, int kLen, void **ppKey, int *pkLen, void **ppVal, int *vLen); int32_t tdbTbPGet(TTB *pTb, const void *pKey, int kLen, void **ppKey, int *pkLen, void **ppVal, int *vLen);
// TBC // TBC
int tdbTbcOpen(TTB *pTb, TBC **ppTbc, TXN *pTxn); int32_t tdbTbcOpen(TTB *pTb, TBC **ppTbc, TXN *pTxn);
int tdbTbcClose(TBC *pTbc); int32_t tdbTbcClose(TBC *pTbc);
int tdbTbcIsValid(TBC *pTbc); int32_t tdbTbcIsValid(TBC *pTbc);
int tdbTbcMoveTo(TBC *pTbc, const void *pKey, int kLen, int *c); int32_t tdbTbcMoveTo(TBC *pTbc, const void *pKey, int kLen, int *c);
int tdbTbcMoveToFirst(TBC *pTbc); int32_t tdbTbcMoveToFirst(TBC *pTbc);
int tdbTbcMoveToLast(TBC *pTbc); int32_t tdbTbcMoveToLast(TBC *pTbc);
int tdbTbcMoveToNext(TBC *pTbc); int32_t tdbTbcMoveToNext(TBC *pTbc);
int tdbTbcMoveToPrev(TBC *pTbc); int32_t tdbTbcMoveToPrev(TBC *pTbc);
int tdbTbcGet(TBC *pTbc, const void **ppKey, int *pkLen, const void **ppVal, int *pvLen); int32_t tdbTbcGet(TBC *pTbc, const void **ppKey, int *pkLen, const void **ppVal, int *pvLen);
int tdbTbcDelete(TBC *pTbc); int32_t tdbTbcDelete(TBC *pTbc);
int tdbTbcNext(TBC *pTbc, void **ppKey, int *kLen, void **ppVal, int *vLen); int32_t tdbTbcNext(TBC *pTbc, void **ppKey, int *kLen, void **ppVal, int *vLen);
int tdbTbcUpsert(TBC *pTbc, const void *pKey, int nKey, const void *pData, int nData, int insert); int32_t tdbTbcUpsert(TBC *pTbc, const void *pKey, int nKey, const void *pData, int nData, int insert);
// TXN // TXN
#define TDB_TXN_WRITE 0x1 #define TDB_TXN_WRITE 0x1
#define TDB_TXN_READ_UNCOMMITTED 0x2 #define TDB_TXN_READ_UNCOMMITTED 0x2
int tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void (*xFree)(void *, void *), void *xArg, int32_t tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void (*xFree)(void *, void *),
int flags); void *xArg, int flags);
int tdbTxnClose(TXN *pTxn); int32_t tdbTxnClose(TXN *pTxn);
// other // other
void tdbFree(void *); void tdbFree(void *);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "tdbInt.h" #include "tdbInt.h"
int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) { int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb) {
TDB *pDb; TDB *pDb;
int dsize; int dsize;
int zsize; int zsize;
...@@ -25,7 +25,7 @@ int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) { ...@@ -25,7 +25,7 @@ int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) {
*ppDb = NULL; *ppDb = NULL;
dsize = strlen(rootDir); dsize = strlen(dbname);
zsize = sizeof(*pDb) + dsize * 2 + strlen(TDB_JOURNAL_NAME) + 3; zsize = sizeof(*pDb) + dsize * 2 + strlen(TDB_JOURNAL_NAME) + 3;
pPtr = (uint8_t *)tdbOsCalloc(1, zsize); pPtr = (uint8_t *)tdbOsCalloc(1, zsize);
...@@ -36,16 +36,16 @@ int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) { ...@@ -36,16 +36,16 @@ int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) {
pDb = (TDB *)pPtr; pDb = (TDB *)pPtr;
pPtr += sizeof(*pDb); pPtr += sizeof(*pDb);
// pDb->rootDir // pDb->rootDir
pDb->rootDir = pPtr; pDb->dbName = pPtr;
memcpy(pDb->rootDir, rootDir, dsize); memcpy(pDb->dbName, dbname, dsize);
pDb->rootDir[dsize] = '\0'; pDb->dbName[dsize] = '\0';
pPtr = pPtr + dsize + 1; pPtr = pPtr + dsize + 1;
// pDb->jfname // pDb->jfname
pDb->jfname = pPtr; pDb->jnName = pPtr;
memcpy(pDb->jfname, rootDir, dsize); memcpy(pDb->jnName, dbname, dsize);
pDb->jfname[dsize] = '/'; pDb->jnName[dsize] = '/';
memcpy(pDb->jfname + dsize + 1, TDB_JOURNAL_NAME, strlen(TDB_JOURNAL_NAME)); memcpy(pDb->jnName + dsize + 1, TDB_JOURNAL_NAME, strlen(TDB_JOURNAL_NAME));
pDb->jfname[dsize + 1 + strlen(TDB_JOURNAL_NAME)] = '\0'; pDb->jnName[dsize + 1 + strlen(TDB_JOURNAL_NAME)] = '\0';
pDb->jfd = -1; pDb->jfd = -1;
...@@ -62,7 +62,7 @@ int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) { ...@@ -62,7 +62,7 @@ int tdbOpen(const char *rootDir, int szPage, int pages, TDB **ppDb) {
} }
memset(pDb->pgrHash, 0, tsize); memset(pDb->pgrHash, 0, tsize);
mkdir(rootDir, 0755); mkdir(dbname, 0755);
*ppDb = pDb; *ppDb = pDb;
return 0; return 0;
......
...@@ -24,7 +24,7 @@ struct STBC { ...@@ -24,7 +24,7 @@ struct STBC {
SBTC btc; SBTC btc;
}; };
int tdbTbOpen(const char *fname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn, TDB *pEnv, TTB **ppTb) { int tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn, TDB *pEnv, TTB **ppTb) {
TTB *pTb; TTB *pTb;
SPager *pPager; SPager *pPager;
int ret; int ret;
...@@ -42,9 +42,9 @@ int tdbTbOpen(const char *fname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn ...@@ -42,9 +42,9 @@ int tdbTbOpen(const char *fname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn
// pTb->pEnv // pTb->pEnv
pTb->pEnv = pEnv; pTb->pEnv = pEnv;
pPager = tdbEnvGetPager(pEnv, fname); pPager = tdbEnvGetPager(pEnv, tbname);
if (pPager == NULL) { if (pPager == NULL) {
snprintf(fFullName, TDB_FILENAME_LEN, "%s/%s", pEnv->rootDir, fname); snprintf(fFullName, TDB_FILENAME_LEN, "%s/%s", pEnv->dbName, tbname);
ret = tdbPagerOpen(pEnv->pCache, fFullName, &pPager); ret = tdbPagerOpen(pEnv->pCache, fFullName, &pPager);
if (ret < 0) { if (ret < 0) {
return -1; return -1;
......
...@@ -335,8 +335,8 @@ static inline SCell *tdbPageGetCell(SPage *pPage, int idx) { ...@@ -335,8 +335,8 @@ static inline SCell *tdbPageGetCell(SPage *pPage, int idx) {
} }
struct STDB { struct STDB {
char *rootDir; char *dbName;
char *jfname; char *jnName;
int jfd; int jfd;
SPCache *pCache; SPCache *pCache;
SPager *pgrList; SPager *pgrList;
......
...@@ -24,7 +24,7 @@ sql insert into t1 values(1648791233002,3,2,3,2.1); ...@@ -24,7 +24,7 @@ sql insert into t1 values(1648791233002,3,2,3,2.1);
sql insert into t1 values(1648791243003,4,2,3,3.1); sql insert into t1 values(1648791243003,4,2,3,3.1);
sql insert into t1 values(1648791213004,4,2,3,4.1); sql insert into t1 values(1648791213004,4,2,3,4.1);
sleep 1000 sleep 1000
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
if $rows != 4 then if $rows != 4 then
print ======$rows print ======$rows
...@@ -137,7 +137,7 @@ endi ...@@ -137,7 +137,7 @@ endi
sql insert into t1 values(1648791223001,12,14,13,11.1); sql insert into t1 values(1648791223001,12,14,13,11.1);
sleep 500 sleep 500
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
if $rows != 4 then if $rows != 4 then
print ======$rows print ======$rows
...@@ -250,7 +250,7 @@ endi ...@@ -250,7 +250,7 @@ endi
sql insert into t1 values(1648791223002,12,14,13,11.1); sql insert into t1 values(1648791223002,12,14,13,11.1);
sleep 100 sleep 100
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 1 # row 1
if $data11 != 2 then if $data11 != 2 then
...@@ -280,7 +280,7 @@ endi ...@@ -280,7 +280,7 @@ endi
sql insert into t1 values(1648791223003,12,14,13,11.1); sql insert into t1 values(1648791223003,12,14,13,11.1);
sleep 100 sleep 100
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 1 # row 1
if $data11 != 3 then if $data11 != 3 then
...@@ -312,7 +312,7 @@ sql insert into t1 values(1648791223001,1,1,1,1.1); ...@@ -312,7 +312,7 @@ sql insert into t1 values(1648791223001,1,1,1,1.1);
sql insert into t1 values(1648791223002,2,2,2,2.1); sql insert into t1 values(1648791223002,2,2,2,2.1);
sql insert into t1 values(1648791223003,3,3,3,3.1); sql insert into t1 values(1648791223003,3,3,3,3.1);
sleep 100 sleep 100
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 1 # row 1
if $data11 != 3 then if $data11 != 3 then
...@@ -344,7 +344,7 @@ sql insert into t1 values(1648791233003,3,2,3,2.1); ...@@ -344,7 +344,7 @@ sql insert into t1 values(1648791233003,3,2,3,2.1);
sql insert into t1 values(1648791233002,5,6,7,8.1); sql insert into t1 values(1648791233002,5,6,7,8.1);
sql insert into t1 values(1648791233002,3,2,3,2.1); sql insert into t1 values(1648791233002,3,2,3,2.1);
sleep 100 sleep 100
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 2 # row 2
if $data21 != 2 then if $data21 != 2 then
...@@ -374,7 +374,7 @@ endi ...@@ -374,7 +374,7 @@ endi
sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1); sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1);
sleep 100 sleep 100
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 0 # row 0
if $data01 != 4 then if $data01 != 4 then
...@@ -404,7 +404,7 @@ endi ...@@ -404,7 +404,7 @@ endi
sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1); sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1);
sleep 100 sleep 100
sql select _wstartts, c1, c2 ,c3 ,c4, c5 from streamt; sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 1 # row 1
if $data11 != 4 then if $data11 != 4 then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册