提交 37021822 编写于 作者: G Ganlin Zhao

[TD-14388]<feature>: Support value type parameter processing in scalar function

...@@ -5,7 +5,6 @@ AccessModifierOffset: -1 ...@@ -5,7 +5,6 @@ AccessModifierOffset: -1
AlignAfterOpenBracket: Align AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlinesLeft: true AlignEscapedNewlinesLeft: true
AlignOperands: true AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
......
...@@ -80,8 +80,9 @@ int32_t create_topic() { ...@@ -80,8 +80,9 @@ int32_t create_topic() {
} }
taos_free_result(pRes); taos_free_result(pRes);
const char* sql = "select * from tu1"; /*const char* sql = "select * from tu1";*/
pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql)); /*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql));*/
pRes = taos_query(pConn, "create topic test_stb_topic_1 as select * from tu1");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
printf("failed to create topic test_stb_topic_1, reason:%s\n", taos_errstr(pRes)); printf("failed to create topic test_stb_topic_1, reason:%s\n", taos_errstr(pRes));
return -1; return -1;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "taos.h" #include "taos.h"
int32_t init_env() { int32_t init_env() {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 7010);
if (pConn == NULL) { if (pConn == NULL) {
return -1; return -1;
} }
...@@ -65,7 +65,7 @@ int32_t init_env() { ...@@ -65,7 +65,7 @@ int32_t init_env() {
int32_t create_stream() { int32_t create_stream() {
printf("create stream\n"); printf("create stream\n");
TAOS_RES* pRes; TAOS_RES* pRes;
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 7010);
if (pConn == NULL) { if (pConn == NULL) {
return -1; return -1;
} }
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_CONSUMER_H_
#define _TD_CONSUMER_H_
#include "tlist.h"
#include "tarray.h"
#include "hash.h"
#ifdef __cplusplus
extern "C" {
#endif
//consumer handle
struct tmq_consumer_t;
typedef struct tmq_consumer_t tmq_consumer_t;
//consumer config
struct tmq_consumer_config_t;
typedef struct tmq_consumer_config_t tmq_consumer_config_t;
//response err
struct tmq_resp_err_t;
typedef struct tmq_resp_err_t tmq_resp_err_t;
struct tmq_message_t;
typedef struct tmq_message_t tmq_message_t;
struct tmq_col_batch_t;
typedef struct tmq_col_batch_t tmq_col_batch_t;
//get content of message
tmq_col_batch_t* tmq_get_msg_col_by_idx(tmq_message_t*, int32_t col_id);
tmq_col_batch_t* tmq_get_msg_col_by_name(tmq_message_t*, const char*);
//consumer config
int32_t tmq_conf_set(tmq_consumer_config_t* , const char* config_key, const char* config_value, char* errstr, int32_t errstr_cap);
//consumer initialization
//resouces are supposed to be free by users by calling tmq_consumer_destroy
tmq_consumer_t* tmq_consumer_new(tmq_consumer_config_t* , char* errstr, int32_t errstr_cap);
//subscribe
tmq_resp_err_t tmq_subscribe(tmq_consumer_t*, const SList*);
tmq_resp_err_t tmq_unsubscribe(tmq_consumer_t*);
//consume
//resouces are supposed to be free by users by calling tmq_message_destroy
tmq_message_t* tmq_consume_poll(tmq_consumer_t*, int64_t blocking_time);
//destroy message and free memory
void tmq_message_destroy(tmq_message_t*);
//close consumer
int32_t tmq_consumer_close(tmq_consumer_t*);
//destroy consumer
void tmq_consumer_destroy(tmq_message_t*);
#ifdef __cplusplus
}
#endif
#endif /*_TD_CONSUMER_H_*/
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_STREAM_H_
#define _TD_STREAM_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /*_TD_STREAM_H_*/
\ No newline at end of file
...@@ -26,9 +26,11 @@ extern "C" { ...@@ -26,9 +26,11 @@ extern "C" {
typedef void TAOS; typedef void TAOS;
typedef void TAOS_STMT; typedef void TAOS_STMT;
typedef void TAOS_RES; typedef void TAOS_RES;
typedef void **TAOS_ROW;
#if 0
typedef void TAOS_STREAM; typedef void TAOS_STREAM;
#endif
typedef void TAOS_SUB; typedef void TAOS_SUB;
typedef void **TAOS_ROW;
// Data type definition // Data type definition
#define TSDB_DATA_TYPE_NULL 0 // 1 bytes #define TSDB_DATA_TYPE_NULL 0 // 1 bytes
...@@ -149,6 +151,7 @@ DLL_EXPORT int taos_stmt_execute(TAOS_STMT *stmt); ...@@ -149,6 +151,7 @@ DLL_EXPORT int taos_stmt_execute(TAOS_STMT *stmt);
DLL_EXPORT TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt); DLL_EXPORT TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt);
DLL_EXPORT int taos_stmt_close(TAOS_STMT *stmt); DLL_EXPORT int taos_stmt_close(TAOS_STMT *stmt);
DLL_EXPORT char *taos_stmt_errstr(TAOS_STMT *stmt); DLL_EXPORT char *taos_stmt_errstr(TAOS_STMT *stmt);
DLL_EXPORT int taos_stmt_affected_rows(TAOS_STMT *stmt);
DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql); DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql);
DLL_EXPORT TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen); DLL_EXPORT TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen);
...@@ -179,15 +182,20 @@ DLL_EXPORT int taos_errno(TAOS_RES *tres); ...@@ -179,15 +182,20 @@ DLL_EXPORT int taos_errno(TAOS_RES *tres);
DLL_EXPORT void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param); DLL_EXPORT void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param);
DLL_EXPORT void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param); DLL_EXPORT void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param);
// Shuduo: temporary enable for app build
#if 1
typedef void (*__taos_sub_fn_t)(TAOS_SUB *tsub, TAOS_RES *res, void *param, int code); typedef void (*__taos_sub_fn_t)(TAOS_SUB *tsub, TAOS_RES *res, void *param, int code);
DLL_EXPORT TAOS_SUB *taos_subscribe(TAOS *taos, int restart, const char *topic, const char *sql, __taos_sub_fn_t fp, DLL_EXPORT TAOS_SUB *taos_subscribe(TAOS *taos, int restart, const char *topic, const char *sql, __taos_sub_fn_t fp,
void *param, int interval); void *param, int interval);
DLL_EXPORT TAOS_RES *taos_consume(TAOS_SUB *tsub); DLL_EXPORT TAOS_RES *taos_consume(TAOS_SUB *tsub);
DLL_EXPORT void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress); DLL_EXPORT void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress);
#endif
#if 0
DLL_EXPORT TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sql, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), DLL_EXPORT TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sql, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row),
int64_t stime, void *param, void (*callback)(void *)); int64_t stime, void *param, void (*callback)(void *));
DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr); DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr);
#endif
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList); DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision); DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
...@@ -215,8 +223,12 @@ DLL_EXPORT tmq_list_t *tmq_list_new(); ...@@ -215,8 +223,12 @@ DLL_EXPORT tmq_list_t *tmq_list_new();
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *); DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
DLL_EXPORT void tmq_list_destroy(tmq_list_t *); DLL_EXPORT void tmq_list_destroy(tmq_list_t *);
DLL_EXPORT tmq_t *tmq_consumer_new(void *conn, tmq_conf_t *conf, char *errstr, int32_t errstrLen); // will be removed in 3.0
DLL_EXPORT tmq_t *tmq_consumer_new1(tmq_conf_t *conf, char *errstr, int32_t errstrLen); DLL_EXPORT tmq_t *tmq_consumer_new(void *conn, tmq_conf_t *conf, char *errstr, int32_t errstrLen);
// will replace last one
DLL_EXPORT tmq_t *tmq_consumer_new1(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t); DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t);
/* ------------------------TMQ CONSUMER INTERFACE------------------------ */ /* ------------------------TMQ CONSUMER INTERFACE------------------------ */
...@@ -255,20 +267,26 @@ int32_t tmqGetSkipLogNum(tmq_message_t *tmq_message); ...@@ -255,20 +267,26 @@ int32_t tmqGetSkipLogNum(tmq_message_t *tmq_message);
/* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */ /* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */
DLL_EXPORT TAOS_ROW tmq_get_row(tmq_message_t *message); DLL_EXPORT TAOS_ROW tmq_get_row(tmq_message_t *message);
DLL_EXPORT char *tmq_get_topic_name(tmq_message_t *message); DLL_EXPORT char *tmq_get_topic_name(tmq_message_t *message);
DLL_EXPORT void *tmq_get_topic_schema(tmq_t *tmq, const char *topic); DLL_EXPORT int32_t tmq_get_vgroup_id(tmq_message_t *message);
DLL_EXPORT void tmq_message_destroy(tmq_message_t *tmq_message); DLL_EXPORT int64_t tmq_get_request_offset(tmq_message_t *message);
DLL_EXPORT int64_t tmq_get_response_offset(tmq_message_t *message);
DLL_EXPORT TAOS_FIELD *tmq_get_fields(tmq_t *tmq, const char *topic);
DLL_EXPORT int32_t tmq_field_count(tmq_t *tmq, const char *topic);
DLL_EXPORT void tmq_message_destroy(tmq_message_t *tmq_message);
/* --------------------TMPORARY INTERFACE FOR TESTING--------------------- */ /* --------------------TMPORARY INTERFACE FOR TESTING--------------------- */
#if 0
DLL_EXPORT TAOS_RES *tmq_create_topic(TAOS *taos, const char *name, const char *sql, int sqlLen); DLL_EXPORT TAOS_RES *tmq_create_topic(TAOS *taos, const char *name, const char *sql, int sqlLen);
#endif
DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const char *tbName, const char *sql); DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const char *tbName, const char *sql);
/* -------------------------------- OTHER -------------------------------- */ /* ------------------------------ TMQ END -------------------------------- */
#if 1 // Shuduo: temporary enable for app build
typedef void (*TAOS_SUBSCRIBE_CALLBACK)(TAOS_SUB *tsub, TAOS_RES *res, void *param, int code); typedef void (*TAOS_SUBSCRIBE_CALLBACK)(TAOS_SUB *tsub, TAOS_RES *res, void *param, int code);
#endif
DLL_EXPORT int taos_stmt_affected_rows(TAOS_STMT *stmt);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -2215,23 +2215,6 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) { ...@@ -2215,23 +2215,6 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
return buf; return buf;
} }
typedef struct {
int64_t uid;
int32_t numOfRows;
char* colData;
} SMqTbData;
typedef struct {
char topicName[TSDB_TOPIC_FNAME_LEN];
int64_t committedOffset;
int64_t reqOffset;
int64_t rspOffset;
int32_t skipLogNum;
int32_t bodyLen;
int32_t numOfTb;
SMqTbData* tbData;
} SMqTopicData;
typedef struct { typedef struct {
int8_t mqMsgType; int8_t mqMsgType;
int32_t code; int32_t code;
...@@ -2259,8 +2242,11 @@ typedef struct { ...@@ -2259,8 +2242,11 @@ typedef struct {
} SMqSubVgEp; } SMqSubVgEp;
typedef struct { typedef struct {
char topic[TSDB_TOPIC_FNAME_LEN]; char topic[TSDB_TOPIC_FNAME_LEN];
SArray* vgs; // SArray<SMqSubVgEp> int8_t isSchemaAdaptive;
SArray* vgs; // SArray<SMqSubVgEp>
int32_t numOfFields;
TAOS_FIELD* fields;
} SMqSubTopicEp; } SMqSubTopicEp;
typedef struct { typedef struct {
...@@ -2281,32 +2267,6 @@ typedef struct { ...@@ -2281,32 +2267,6 @@ typedef struct {
SArray* topics; // SArray<SMqSubTopicEp> SArray* topics; // SArray<SMqSubTopicEp>
} SMqCMGetSubEpRsp; } SMqCMGetSubEpRsp;
typedef struct {
int32_t curBlock;
int32_t curRow;
void** uData;
} SMqRowIter;
struct tmq_message_t {
SMqPollRsp msg;
void* vg;
SMqRowIter iter;
};
#if 0
struct tmq_message_t {
SMqRspHead head;
union {
SMqPollRsp consumeRsp;
SMqCMGetSubEpRsp getEpRsp;
};
void* extra;
int32_t curBlock;
int32_t curRow;
void** uData;
};
#endif
static FORCE_INLINE void tDeleteSMqSubTopicEp(SMqSubTopicEp* pSubTopicEp) { taosArrayDestroy(pSubTopicEp->vgs); } static FORCE_INLINE void tDeleteSMqSubTopicEp(SMqSubTopicEp* pSubTopicEp) { taosArrayDestroy(pSubTopicEp->vgs); }
static FORCE_INLINE int32_t tEncodeSMqSubVgEp(void** buf, const SMqSubVgEp* pVgEp) { static FORCE_INLINE int32_t tEncodeSMqSubVgEp(void** buf, const SMqSubVgEp* pVgEp) {
...@@ -2331,17 +2291,21 @@ static FORCE_INLINE void tDeleteSMqCMGetSubEpRsp(SMqCMGetSubEpRsp* pRsp) { ...@@ -2331,17 +2291,21 @@ static FORCE_INLINE void tDeleteSMqCMGetSubEpRsp(SMqCMGetSubEpRsp* pRsp) {
static FORCE_INLINE int32_t tEncodeSMqSubTopicEp(void** buf, const SMqSubTopicEp* pTopicEp) { static FORCE_INLINE int32_t tEncodeSMqSubTopicEp(void** buf, const SMqSubTopicEp* pTopicEp) {
int32_t tlen = 0; int32_t tlen = 0;
tlen += taosEncodeString(buf, pTopicEp->topic); tlen += taosEncodeString(buf, pTopicEp->topic);
tlen += taosEncodeFixedI8(buf, pTopicEp->isSchemaAdaptive);
int32_t sz = taosArrayGetSize(pTopicEp->vgs); int32_t sz = taosArrayGetSize(pTopicEp->vgs);
tlen += taosEncodeFixedI32(buf, sz); tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) { for (int32_t i = 0; i < sz; i++) {
SMqSubVgEp* pVgEp = (SMqSubVgEp*)taosArrayGet(pTopicEp->vgs, i); SMqSubVgEp* pVgEp = (SMqSubVgEp*)taosArrayGet(pTopicEp->vgs, i);
tlen += tEncodeSMqSubVgEp(buf, pVgEp); tlen += tEncodeSMqSubVgEp(buf, pVgEp);
} }
tlen += taosEncodeFixedI32(buf, pTopicEp->numOfFields);
// tlen += taosEncodeBinary(buf, pTopicEp->fields, pTopicEp->numOfFields * sizeof(TAOS_FIELD));
return tlen; return tlen;
} }
static FORCE_INLINE void* tDecodeSMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicEp) { static FORCE_INLINE void* tDecodeSMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicEp) {
buf = taosDecodeStringTo(buf, pTopicEp->topic); buf = taosDecodeStringTo(buf, pTopicEp->topic);
buf = taosDecodeFixedI8(buf, &pTopicEp->isSchemaAdaptive);
int32_t sz; int32_t sz;
buf = taosDecodeFixedI32(buf, &sz); buf = taosDecodeFixedI32(buf, &sz);
pTopicEp->vgs = taosArrayInit(sz, sizeof(SMqSubVgEp)); pTopicEp->vgs = taosArrayInit(sz, sizeof(SMqSubVgEp));
...@@ -2353,6 +2317,8 @@ static FORCE_INLINE void* tDecodeSMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicE ...@@ -2353,6 +2317,8 @@ static FORCE_INLINE void* tDecodeSMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicE
buf = tDecodeSMqSubVgEp(buf, &vgEp); buf = tDecodeSMqSubVgEp(buf, &vgEp);
taosArrayPush(pTopicEp->vgs, &vgEp); taosArrayPush(pTopicEp->vgs, &vgEp);
} }
buf = taosDecodeFixedI32(buf, &pTopicEp->numOfFields);
// buf = taosDecodeBinary(buf, (void**)&pTopicEp->fields, pTopicEp->numOfFields * sizeof(TAOS_FIELD));
return buf; return buf;
} }
......
...@@ -25,6 +25,7 @@ extern "C" { ...@@ -25,6 +25,7 @@ extern "C" {
typedef struct SRpcMsg SRpcMsg; typedef struct SRpcMsg SRpcMsg;
typedef struct SEpSet SEpSet; typedef struct SEpSet SEpSet;
typedef struct SMgmtWrapper SMgmtWrapper; typedef struct SMgmtWrapper SMgmtWrapper;
typedef enum { typedef enum {
QUERY_QUEUE, QUERY_QUEUE,
FETCH_QUEUE, FETCH_QUEUE,
...@@ -38,24 +39,30 @@ typedef enum { ...@@ -38,24 +39,30 @@ typedef enum {
typedef int32_t (*PutToQueueFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq); typedef int32_t (*PutToQueueFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq);
typedef int32_t (*GetQueueSizeFp)(SMgmtWrapper* pWrapper, int32_t vgId, EQueueType qtype); typedef int32_t (*GetQueueSizeFp)(SMgmtWrapper* pWrapper, int32_t vgId, EQueueType qtype);
typedef int32_t (*SendReqFp)(SMgmtWrapper* pWrapper, SEpSet* epSet, SRpcMsg* pReq); typedef int32_t (*SendReqFp)(SMgmtWrapper* pWrapper, const SEpSet* epSet, SRpcMsg* pReq);
typedef int32_t (*SendMnodeReqFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq); typedef int32_t (*SendMnodeReqFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq);
typedef void (*SendRspFp)(SMgmtWrapper* pWrapper, SRpcMsg* pRsp); typedef void (*SendRspFp)(SMgmtWrapper* pWrapper, const SRpcMsg* pRsp);
typedef void (*RegisterBrokenLinkArgFp)(SMgmtWrapper* pWrapper, SRpcMsg* pMsg);
typedef void (*ReleaseHandleFp)(SMgmtWrapper* pWrapper, void* handle, int8_t type);
typedef struct { typedef struct {
SMgmtWrapper* pWrapper; SMgmtWrapper* pWrapper;
PutToQueueFp queueFps[QUEUE_MAX]; PutToQueueFp queueFps[QUEUE_MAX];
GetQueueSizeFp qsizeFp; GetQueueSizeFp qsizeFp;
SendReqFp sendReqFp; SendReqFp sendReqFp;
SendMnodeReqFp sendMnodeReqFp; SendMnodeReqFp sendMnodeReqFp;
SendRspFp sendRspFp; SendRspFp sendRspFp;
RegisterBrokenLinkArgFp registerBrokenLinkArgFp;
ReleaseHandleFp releaseHandleFp;
} SMsgCb; } SMsgCb;
int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pReq); int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pReq);
int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype); int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype);
int32_t tmsgSendReq(const SMsgCb* pMsgCb, SEpSet* epSet, SRpcMsg* pReq); int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq);
int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq); int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq);
void tmsgSendRsp(const SMsgCb* pMsgCb, SRpcMsg* pRsp); void tmsgSendRsp(const SMsgCb* pMsgCb, const SRpcMsg* pRsp);
void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg);
void tmsgReleaseHandle(const SMsgCb* pMsgCb, void* handle, int8_t type);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -139,18 +139,18 @@ ...@@ -139,18 +139,18 @@
#define TK_TOPIC 121 #define TK_TOPIC 121
#define TK_AS 122 #define TK_AS 122
#define TK_NK_BOOL 123 #define TK_NK_BOOL 123
#define TK_NK_VARIABLE 124 #define TK_NULL 124
#define TK_NK_UNDERLINE 125 #define TK_NK_VARIABLE 125
#define TK_ROWTS 126 #define TK_NK_UNDERLINE 126
#define TK_TBNAME 127 #define TK_ROWTS 127
#define TK_QSTARTTS 128 #define TK_TBNAME 128
#define TK_QENDTS 129 #define TK_QSTARTTS 129
#define TK_WSTARTTS 130 #define TK_QENDTS 130
#define TK_WENDTS 131 #define TK_WSTARTTS 131
#define TK_WDURATION 132 #define TK_WENDTS 132
#define TK_BETWEEN 133 #define TK_WDURATION 133
#define TK_IS 134 #define TK_BETWEEN 134
#define TK_NULL 135 #define TK_IS 135
#define TK_NK_LT 136 #define TK_NK_LT 136
#define TK_NK_GT 137 #define TK_NK_GT 137
#define TK_NK_LE 138 #define TK_NK_LE 138
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
extern "C" { extern "C" {
#endif #endif
#include "tcommon.h"
#include "query.h" #include "query.h"
#include "tcommon.h"
typedef void* qTaskInfo_t; typedef void* qTaskInfo_t;
typedef void* DataSinkHandle; typedef void* DataSinkHandle;
...@@ -36,7 +36,7 @@ typedef struct SReadHandle { ...@@ -36,7 +36,7 @@ typedef struct SReadHandle {
#define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1 #define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1
#define STREAM_DATA_TYPE_SSDATA_BLOCK 0x2 #define STREAM_DATA_TYPE_SSDATA_BLOCK 0x2
/** /**
* Create the exec task for streaming mode * Create the exec task for streaming mode
* @param pMsg * @param pMsg
...@@ -62,7 +62,7 @@ int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type); ...@@ -62,7 +62,7 @@ int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type);
* @param type * @param type
* @return * @return
*/ */
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, void** pBlocks, size_t numOfBlocks, int32_t type); int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type);
/** /**
* Update the table id list, add or remove. * Update the table id list, add or remove.
...@@ -167,7 +167,6 @@ int32_t qUpdateQueriedTableIdList(qTaskInfo_t tinfo, int64_t uid, int32_t type); ...@@ -167,7 +167,6 @@ int32_t qUpdateQueriedTableIdList(qTaskInfo_t tinfo, int64_t uid, int32_t type);
*/ */
void** qReleaseTask(void* pMgmt, void* pQInfo, bool freeHandle); void** qReleaseTask(void* pMgmt, void* pQInfo, bool freeHandle);
void qProcessFetchRsp(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet); void qProcessFetchRsp(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -121,6 +121,7 @@ typedef enum ENodeType { ...@@ -121,6 +121,7 @@ typedef enum ENodeType {
QUERY_NODE_LOGIC_PLAN_EXCHANGE, QUERY_NODE_LOGIC_PLAN_EXCHANGE,
QUERY_NODE_LOGIC_PLAN_WINDOW, QUERY_NODE_LOGIC_PLAN_WINDOW,
QUERY_NODE_LOGIC_PLAN_SORT, QUERY_NODE_LOGIC_PLAN_SORT,
QUERY_NODE_LOGIC_PLAN_PARTITION,
QUERY_NODE_LOGIC_SUBPLAN, QUERY_NODE_LOGIC_SUBPLAN,
QUERY_NODE_LOGIC_PLAN, QUERY_NODE_LOGIC_PLAN,
......
...@@ -66,7 +66,11 @@ typedef struct SAggLogicNode { ...@@ -66,7 +66,11 @@ typedef struct SAggLogicNode {
typedef struct SProjectLogicNode { typedef struct SProjectLogicNode {
SLogicNode node; SLogicNode node;
SNodeList* pProjections; SNodeList* pProjections;
char stmtName[TSDB_TABLE_NAME_LEN]; char stmtName[TSDB_TABLE_NAME_LEN];
int64_t limit;
int64_t offset;
int64_t slimit;
int64_t soffset;
} SProjectLogicNode; } SProjectLogicNode;
typedef struct SVnodeModifLogicNode { typedef struct SVnodeModifLogicNode {
...@@ -106,6 +110,11 @@ typedef struct SSortLogicNode { ...@@ -106,6 +110,11 @@ typedef struct SSortLogicNode {
SNodeList* pSortKeys; SNodeList* pSortKeys;
} SSortLogicNode; } SSortLogicNode;
typedef struct SPartitionLogicNode {
SLogicNode node;
SNodeList* pPartitionKeys;
} SPartitionLogicNode;
typedef enum ESubplanType { typedef enum ESubplanType {
SUBPLAN_TYPE_MERGE = 1, SUBPLAN_TYPE_MERGE = 1,
SUBPLAN_TYPE_PARTIAL, SUBPLAN_TYPE_PARTIAL,
...@@ -150,7 +159,8 @@ typedef struct SDataBlockDescNode { ...@@ -150,7 +159,8 @@ typedef struct SDataBlockDescNode {
ENodeType type; ENodeType type;
int16_t dataBlockId; int16_t dataBlockId;
SNodeList* pSlots; SNodeList* pSlots;
int32_t resultRowSize; int32_t totalRowSize;
int32_t outputRowSize;
int16_t precision; int16_t precision;
} SDataBlockDescNode; } SDataBlockDescNode;
...@@ -195,6 +205,10 @@ typedef STableScanPhysiNode STableSeqScanPhysiNode; ...@@ -195,6 +205,10 @@ typedef STableScanPhysiNode STableSeqScanPhysiNode;
typedef struct SProjectPhysiNode { typedef struct SProjectPhysiNode {
SPhysiNode node; SPhysiNode node;
SNodeList* pProjections; SNodeList* pProjections;
int64_t limit;
int64_t offset;
int64_t slimit;
int64_t soffset;
} SProjectPhysiNode; } SProjectPhysiNode;
typedef struct SJoinPhysiNode { typedef struct SJoinPhysiNode {
...@@ -283,10 +297,17 @@ typedef struct SSubplan { ...@@ -283,10 +297,17 @@ typedef struct SSubplan {
SDataSinkNode* pDataSink; // data of the subplan flow into the datasink SDataSinkNode* pDataSink; // data of the subplan flow into the datasink
} SSubplan; } SSubplan;
typedef enum EQueryMode {
QUERY_MODE_NORMAL = 1,
QUERY_MODE_EXPLAIN,
QUERY_MODE_EXPLAIN_AN
} EQueryMode;
typedef struct SQueryPlan { typedef struct SQueryPlan {
ENodeType type; ENodeType type;
uint64_t queryId; uint64_t queryId;
int32_t numOfSubplans; int32_t numOfSubplans;
SNodeList* pSubplans; // Element is SNodeListNode. The execution level of subplan, starting from 0. SNodeList* pSubplans; // Element is SNodeListNode. The execution level of subplan, starting from 0.
} SQueryPlan; } SQueryPlan;
......
...@@ -180,8 +180,8 @@ typedef struct SOrderByExprNode { ...@@ -180,8 +180,8 @@ typedef struct SOrderByExprNode {
typedef struct SLimitNode { typedef struct SLimitNode {
ENodeType type; // QUERY_NODE_LIMIT ENodeType type; // QUERY_NODE_LIMIT
uint64_t limit; int64_t limit;
uint64_t offset; int64_t offset;
} SLimitNode; } SLimitNode;
typedef struct SStateWindowNode { typedef struct SStateWindowNode {
......
...@@ -30,6 +30,11 @@ enum { ...@@ -30,6 +30,11 @@ enum {
STREAM_TASK_STATUS__STOP, STREAM_TASK_STATUS__STOP,
}; };
enum {
STREAM_CREATED_BY__USER = 1,
STREAM_CREATED_BY__SMA,
};
#if 0 #if 0
// pipe -> fetch/pipe queue // pipe -> fetch/pipe queue
// merge -> merge queue // merge -> merge queue
......
...@@ -49,11 +49,13 @@ typedef struct SRpcMsg { ...@@ -49,11 +49,13 @@ typedef struct SRpcMsg {
} SRpcMsg; } SRpcMsg;
typedef struct { typedef struct {
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
SRpcMsg rpcMsg; uint32_t clientIp;
int32_t rspLen; uint16_t clientPort;
void * pRsp; SRpcMsg rpcMsg;
void * pNode; int32_t rspLen;
void *pRsp;
void *pNode;
} SNodeMsg; } SNodeMsg;
typedef struct SRpcInit { typedef struct SRpcInit {
...@@ -105,20 +107,20 @@ void rpcClose(void *); ...@@ -105,20 +107,20 @@ void rpcClose(void *);
void * rpcMallocCont(int contLen); void * rpcMallocCont(int contLen);
void rpcFreeCont(void *pCont); void rpcFreeCont(void *pCont);
void * rpcReallocCont(void *ptr, int contLen); void * rpcReallocCont(void *ptr, int contLen);
void rpcSendRequest(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid);
void rpcSendRequestWithCtx(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid, SRpcCtx *ctx);
// Because taosd supports multi-process mode
// These functions should not be used on the server side
// Please use tmsg<xx> functions, which are defined in tmsgcb.h
void rpcSendRequest(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid);
void rpcSendResponse(const SRpcMsg *pMsg); void rpcSendResponse(const SRpcMsg *pMsg);
void rpcRegisterBrokenLinkArg(SRpcMsg *msg);
void rpcReleaseHandle(void *handle, int8_t type); // just release client conn to rpc instance, no close sock
// These functions will not be called in the child process
void rpcSendRedirectRsp(void *pConn, const SEpSet *pEpSet); void rpcSendRedirectRsp(void *pConn, const SEpSet *pEpSet);
void rpcSendRequestWithCtx(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid, SRpcCtx *ctx);
int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo); int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo);
void rpcSendRecv(void *shandle, SEpSet *pEpSet, SRpcMsg *pReq, SRpcMsg *pRsp); void rpcSendRecv(void *shandle, SEpSet *pEpSet, SRpcMsg *pReq, SRpcMsg *pRsp);
int rpcReportProgress(void *pConn, char *pCont, int contLen);
void rpcCancelRequest(int64_t rid);
void rpcRegisterBrokenLinkArg(SRpcMsg *msg);
// just release client conn to rpc instance, no close sock
void rpcReleaseHandle(void *handle, int8_t type); //
void rpcRefHandle(void *handle, int8_t type);
void rpcUnrefHandle(void *handle, int8_t type);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -22,11 +22,14 @@ ...@@ -22,11 +22,14 @@
extern "C" { extern "C" {
#endif #endif
typedef enum { PROC_REQ, PROC_RSP, PROC_REGISTER } ProcFuncType;
typedef struct SProcQueue SProcQueue; typedef struct SProcQueue SProcQueue;
typedef struct SProcObj SProcObj; typedef struct SProcObj SProcObj;
typedef void *(*ProcMallocFp)(int32_t contLen); typedef void *(*ProcMallocFp)(int32_t contLen);
typedef void *(*ProcFreeFp)(void *pCont); typedef void *(*ProcFreeFp)(void *pCont);
typedef void *(*ProcConsumeFp)(void *pParent, void *pHead, int32_t headLen, void *pBody, int32_t bodyLen); typedef void *(*ProcConsumeFp)(void *pParent, void *pHead, int16_t headLen, void *pBody, int32_t bodyLen,
ProcFuncType ftype);
typedef struct { typedef struct {
int32_t childQueueSize; int32_t childQueueSize;
...@@ -52,9 +55,10 @@ int32_t taosProcRun(SProcObj *pProc); ...@@ -52,9 +55,10 @@ int32_t taosProcRun(SProcObj *pProc);
void taosProcStop(SProcObj *pProc); void taosProcStop(SProcObj *pProc);
bool taosProcIsChild(SProcObj *pProc); bool taosProcIsChild(SProcObj *pProc);
int32_t taosProcChildId(SProcObj *pProc); int32_t taosProcChildId(SProcObj *pProc);
int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen,
int32_t taosProcPutToChildQueue(SProcObj *pProc, void *pHead, int32_t headLen, void *pBody, int32_t bodyLen); ProcFuncType ftype);
int32_t taosProcPutToParentQueue(SProcObj *pProc, void *pHead, int32_t headLen, void *pBody, int32_t bodyLen); int32_t taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen,
ProcFuncType ftype);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
#include "os.h" /*
#include "tref.h" * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
#include "trpc.h" *
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalog.h"
#include "clientInt.h" #include "clientInt.h"
#include "clientLog.h" #include "clientLog.h"
#include "os.h"
#include "query.h" #include "query.h"
#include "tmsg.h"
#include "tglobal.h" #include "tglobal.h"
#include "catalog.h" #include "tmsg.h"
#include "tref.h"
#include "trpc.h"
#include "version.h" #include "version.h"
#define TSC_VAR_NOT_RELEASE 1 #define TSC_VAR_NOT_RELEASE 1
...@@ -24,7 +39,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) { ...@@ -24,7 +39,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
} }
} }
int ret = taos_options_imp(option, (const char*)arg); int ret = taos_options_imp(option, (const char *)arg);
atomic_store_32(&lock, 0); atomic_store_32(&lock, 0);
return ret; return ret;
} }
...@@ -69,13 +84,13 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha ...@@ -69,13 +84,13 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
return taos_connect_internal(ip, user, pass, NULL, db, port); return taos_connect_internal(ip, user, pass, NULL, db, port);
} }
void taos_close(TAOS* taos) { void taos_close(TAOS *taos) {
if (taos == NULL) { if (taos == NULL) {
return; return;
} }
STscObj *pTscObj = (STscObj *)taos; STscObj *pTscObj = (STscObj *)taos;
tscDebug("0x%"PRIx64" try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs); tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs);
/*taosRemoveRef(clientConnRefPool, pTscObj->id);*/ /*taosRemoveRef(clientConnRefPool, pTscObj->id);*/
} }
...@@ -85,48 +100,46 @@ int taos_errno(TAOS_RES *tres) { ...@@ -85,48 +100,46 @@ int taos_errno(TAOS_RES *tres) {
return terrno; return terrno;
} }
return ((SRequestObj*) tres)->code; return ((SRequestObj *)tres)->code;
} }
const char *taos_errstr(TAOS_RES *res) { const char *taos_errstr(TAOS_RES *res) {
SRequestObj *pRequest = (SRequestObj *) res; SRequestObj *pRequest = (SRequestObj *)res;
if (pRequest == NULL) { if (pRequest == NULL) {
return (const char*) tstrerror(terrno); return (const char *)tstrerror(terrno);
} }
if (strlen(pRequest->msgBuf) > 0 || pRequest->code == TSDB_CODE_RPC_FQDN_ERROR) { if (strlen(pRequest->msgBuf) > 0 || pRequest->code == TSDB_CODE_RPC_FQDN_ERROR) {
return pRequest->msgBuf; return pRequest->msgBuf;
} else { } else {
return (const char*)tstrerror(pRequest->code); return (const char *)tstrerror(pRequest->code);
} }
} }
void taos_free_result(TAOS_RES *res) { void taos_free_result(TAOS_RES *res) {
SRequestObj* pRequest = (SRequestObj*) res; SRequestObj *pRequest = (SRequestObj *)res;
destroyRequest(pRequest); destroyRequest(pRequest);
} }
int taos_field_count(TAOS_RES *res) { int taos_field_count(TAOS_RES *res) {
if (res == NULL) { if (res == NULL) {
return 0; return 0;
} }
SRequestObj* pRequest = (SRequestObj*) res; SRequestObj *pRequest = (SRequestObj *)res;
SReqResultInfo* pResInfo = &pRequest->body.resInfo; SReqResultInfo *pResInfo = &pRequest->body.resInfo;
return pResInfo->numOfCols; return pResInfo->numOfCols;
} }
int taos_num_fields(TAOS_RES *res) { int taos_num_fields(TAOS_RES *res) { return taos_field_count(res); }
return taos_field_count(res);
}
TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
if (taos_num_fields(res) == 0) { if (taos_num_fields(res) == 0) {
return NULL; return NULL;
} }
SReqResultInfo* pResInfo = &(((SRequestObj*) res)->body.resInfo); SReqResultInfo *pResInfo = &(((SRequestObj *)res)->body.resInfo);
return pResInfo->fields; return pResInfo->fields;
} }
...@@ -135,7 +148,7 @@ TAOS_RES *taos_query(TAOS *taos, const char *sql) { ...@@ -135,7 +148,7 @@ TAOS_RES *taos_query(TAOS *taos, const char *sql) {
return NULL; return NULL;
} }
return taos_query_l(taos, sql, (int32_t) strlen(sql)); return taos_query_l(taos, sql, (int32_t)strlen(sql));
} }
TAOS_ROW taos_fetch_row(TAOS_RES *res) { TAOS_ROW taos_fetch_row(TAOS_RES *res) {
...@@ -143,18 +156,16 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { ...@@ -143,18 +156,16 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
return NULL; return NULL;
} }
SRequestObj *pRequest = (SRequestObj *) res; SRequestObj *pRequest = (SRequestObj *)res;
if (pRequest->type == TSDB_SQL_RETRIEVE_EMPTY_RESULT || if (pRequest->type == TSDB_SQL_RETRIEVE_EMPTY_RESULT || pRequest->type == TSDB_SQL_INSERT ||
pRequest->type == TSDB_SQL_INSERT || pRequest->code != TSDB_CODE_SUCCESS || taos_num_fields(res) == 0) {
pRequest->code != TSDB_CODE_SUCCESS ||
taos_num_fields(res) == 0) {
return NULL; return NULL;
} }
return doFetchRow(pRequest, true); return doFetchRow(pRequest, true);
} }
int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) {
int32_t len = 0; int32_t len = 0;
for (int i = 0; i < num_fields; ++i) { for (int i = 0; i < num_fields; ++i) {
if (i > 0) { if (i > 0) {
...@@ -213,7 +224,7 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) ...@@ -213,7 +224,7 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
int32_t charLen = varDataLen((char*)row[i] - VARSTR_HEADER_SIZE); int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE);
if (fields[i].type == TSDB_DATA_TYPE_BINARY) { if (fields[i].type == TSDB_DATA_TYPE_BINARY) {
assert(charLen <= fields[i].bytes && charLen >= 0); assert(charLen <= fields[i].bytes && charLen >= 0);
} else { } else {
...@@ -238,31 +249,44 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) ...@@ -238,31 +249,44 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
return len; return len;
} }
int* taos_fetch_lengths(TAOS_RES *res) { int *taos_fetch_lengths(TAOS_RES *res) {
if (res == NULL) { if (res == NULL) {
return NULL; return NULL;
} }
return ((SRequestObj*) res)->body.resInfo.length; return ((SRequestObj *)res)->body.resInfo.length;
} }
// todo intergrate with tDataTypes // todo intergrate with tDataTypes
const char *taos_data_type(int type) { const char *taos_data_type(int type) {
switch (type) { switch (type) {
case TSDB_DATA_TYPE_NULL: return "TSDB_DATA_TYPE_NULL"; case TSDB_DATA_TYPE_NULL:
case TSDB_DATA_TYPE_BOOL: return "TSDB_DATA_TYPE_BOOL"; return "TSDB_DATA_TYPE_NULL";
case TSDB_DATA_TYPE_TINYINT: return "TSDB_DATA_TYPE_TINYINT"; case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_SMALLINT: return "TSDB_DATA_TYPE_SMALLINT"; return "TSDB_DATA_TYPE_BOOL";
case TSDB_DATA_TYPE_INT: return "TSDB_DATA_TYPE_INT"; case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_BIGINT: return "TSDB_DATA_TYPE_BIGINT"; return "TSDB_DATA_TYPE_TINYINT";
case TSDB_DATA_TYPE_FLOAT: return "TSDB_DATA_TYPE_FLOAT"; case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_DOUBLE: return "TSDB_DATA_TYPE_DOUBLE"; return "TSDB_DATA_TYPE_SMALLINT";
case TSDB_DATA_TYPE_VARCHAR: return "TSDB_DATA_TYPE_VARCHAR"; case TSDB_DATA_TYPE_INT:
// case TSDB_DATA_TYPE_BINARY: return "TSDB_DATA_TYPE_VARCHAR"; return "TSDB_DATA_TYPE_INT";
case TSDB_DATA_TYPE_TIMESTAMP: return "TSDB_DATA_TYPE_TIMESTAMP"; case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_NCHAR: return "TSDB_DATA_TYPE_NCHAR"; return "TSDB_DATA_TYPE_BIGINT";
case TSDB_DATA_TYPE_JSON: return "TSDB_DATA_TYPE_JSON"; case TSDB_DATA_TYPE_FLOAT:
default: return "UNKNOWN"; return "TSDB_DATA_TYPE_FLOAT";
case TSDB_DATA_TYPE_DOUBLE:
return "TSDB_DATA_TYPE_DOUBLE";
case TSDB_DATA_TYPE_VARCHAR:
return "TSDB_DATA_TYPE_VARCHAR";
// case TSDB_DATA_TYPE_BINARY: return "TSDB_DATA_TYPE_VARCHAR";
case TSDB_DATA_TYPE_TIMESTAMP:
return "TSDB_DATA_TYPE_TIMESTAMP";
case TSDB_DATA_TYPE_NCHAR:
return "TSDB_DATA_TYPE_NCHAR";
case TSDB_DATA_TYPE_JSON:
return "TSDB_DATA_TYPE_JSON";
default:
return "UNKNOWN";
} }
} }
...@@ -273,8 +297,8 @@ int taos_affected_rows(TAOS_RES *res) { ...@@ -273,8 +297,8 @@ int taos_affected_rows(TAOS_RES *res) {
return 0; return 0;
} }
SRequestObj* pRequest = (SRequestObj*) res; SRequestObj *pRequest = (SRequestObj *)res;
SReqResultInfo* pResInfo = &pRequest->body.resInfo; SReqResultInfo *pResInfo = &pRequest->body.resInfo;
return pResInfo->numOfRows; return pResInfo->numOfRows;
} }
...@@ -295,8 +319,8 @@ int taos_select_db(TAOS *taos, const char *db) { ...@@ -295,8 +319,8 @@ int taos_select_db(TAOS *taos, const char *db) {
char sql[256] = {0}; char sql[256] = {0};
snprintf(sql, tListLen(sql), "use %s", db); snprintf(sql, tListLen(sql), "use %s", db);
TAOS_RES* pRequest = taos_query(taos, sql); TAOS_RES *pRequest = taos_query(taos, sql);
int32_t code = taos_errno(pRequest); int32_t code = taos_errno(pRequest);
taos_free_result(pRequest); taos_free_result(pRequest);
return code; return code;
...@@ -307,61 +331,57 @@ void taos_stop_query(TAOS_RES *res) { ...@@ -307,61 +331,57 @@ void taos_stop_query(TAOS_RES *res) {
return; return;
} }
SRequestObj* pRequest = (SRequestObj*) res; SRequestObj *pRequest = (SRequestObj *)res;
int32_t numOfFields = taos_num_fields(pRequest); int32_t numOfFields = taos_num_fields(pRequest);
// It is not a query, no need to stop. // It is not a query, no need to stop.
if (numOfFields == 0) { if (numOfFields == 0) {
return; return;
} }
// scheduleCancelJob(pRequest->body.pQueryJob); // scheduleCancelJob(pRequest->body.pQueryJob);
} }
bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) { bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
SRequestObj* pRequestObj = res; SRequestObj *pRequestObj = res;
SReqResultInfo* pResultInfo = &pRequestObj->body.resInfo; SReqResultInfo *pResultInfo = &pRequestObj->body.resInfo;
if (col >= pResultInfo->numOfCols || col < 0 || row >= pResultInfo->numOfRows || row < 0) { if (col >= pResultInfo->numOfCols || col < 0 || row >= pResultInfo->numOfRows || row < 0) {
return true; return true;
} }
SResultColumn* pCol = &pRequestObj->body.resInfo.pCol[col]; SResultColumn *pCol = &pRequestObj->body.resInfo.pCol[col];
return colDataIsNull_f(pCol->nullbitmap, row); return colDataIsNull_f(pCol->nullbitmap, row);
} }
int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
if (res == NULL) { if (res == NULL) {
return 0; return 0;
} }
SRequestObj *pRequest = (SRequestObj *) res; SRequestObj *pRequest = (SRequestObj *)res;
if (pRequest->type == TSDB_SQL_RETRIEVE_EMPTY_RESULT || if (pRequest->type == TSDB_SQL_RETRIEVE_EMPTY_RESULT || pRequest->type == TSDB_SQL_INSERT ||
pRequest->type == TSDB_SQL_INSERT || pRequest->code != TSDB_CODE_SUCCESS || taos_num_fields(res) == 0) {
pRequest->code != TSDB_CODE_SUCCESS ||
taos_num_fields(res) == 0) {
return 0; return 0;
} }
doFetchRow(pRequest, false); doFetchRow(pRequest, false);
// TODO refactor // TODO refactor
SReqResultInfo* pResultInfo = &pRequest->body.resInfo; SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
pResultInfo->current = pResultInfo->numOfRows; pResultInfo->current = pResultInfo->numOfRows;
*rows = pResultInfo->row; *rows = pResultInfo->row;
return pResultInfo->numOfRows; return pResultInfo->numOfRows;
} }
int taos_validate_sql(TAOS *taos, const char *sql) { int taos_validate_sql(TAOS *taos, const char *sql) { return true; }
return true;
}
const char *taos_get_server_info(TAOS *taos) { const char *taos_get_server_info(TAOS *taos) {
if (taos == NULL) { if (taos == NULL) {
return NULL; return NULL;
} }
STscObj* pTscObj = (STscObj*) taos; STscObj *pTscObj = (STscObj *)taos;
return pTscObj->ver; return pTscObj->ver;
} }
...@@ -387,52 +407,62 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) { ...@@ -387,52 +407,62 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
// TODO // TODO
} }
TAOS_STMT* taos_stmt_init(TAOS* taos) { TAOS_STMT *taos_stmt_init(TAOS *taos) {
// TODO // TODO
return NULL; return NULL;
} }
int taos_stmt_close(TAOS_STMT* stmt) { int taos_stmt_close(TAOS_STMT *stmt) {
// TODO // TODO
return -1; return -1;
} }
int taos_stmt_execute(TAOS_STMT* stmt) { int taos_stmt_execute(TAOS_STMT *stmt) {
// TODO // TODO
return -1; return -1;
} }
char *taos_stmt_errstr(TAOS_STMT *stmt) { char *taos_stmt_errstr(TAOS_STMT *stmt) {
// TODO // TODO
return NULL; return NULL;
} }
int taos_stmt_affected_rows(TAOS_STMT* stmt) { int taos_stmt_affected_rows(TAOS_STMT *stmt) {
// TODO // TODO
return -1; return -1;
} }
TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol, int precision) { TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) {
// TODO // TODO
return NULL; return NULL;
} }
int taos_stmt_bind_param(TAOS_STMT* stmt, TAOS_BIND* bind) { int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) {
// TODO // TODO
return -1; return -1;
} }
int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) {
// TODO // TODO
return -1; return -1;
}
int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags) {
// TODO
return -1;
}
int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
// TODO
return -1;
} }
int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags) { int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) {
// TODO // TODO
return -1; return -1;
} }
int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) { int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
// TODO // TODO
return -1; return -1;
} }
...@@ -442,6 +472,11 @@ int taos_stmt_add_batch(TAOS_STMT* stmt) { ...@@ -442,6 +472,11 @@ int taos_stmt_add_batch(TAOS_STMT* stmt) {
return -1; return -1;
} }
TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) {
// TODO
return NULL;
}
int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind) { int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind) {
// TODO // TODO
return -1; return -1;
......
...@@ -26,6 +26,18 @@ ...@@ -26,6 +26,18 @@
#include "tqueue.h" #include "tqueue.h"
#include "tref.h" #include "tref.h"
typedef struct {
int32_t curBlock;
int32_t curRow;
void** uData;
} SMqRowIter;
struct tmq_message_t {
SMqPollRsp msg;
void* vg;
SMqRowIter iter;
};
struct tmq_list_t { struct tmq_list_t {
SArray container; SArray container;
}; };
...@@ -99,13 +111,14 @@ typedef struct { ...@@ -99,13 +111,14 @@ typedef struct {
typedef struct { typedef struct {
// subscribe info // subscribe info
int32_t sqlLen; int32_t sqlLen;
char* sql; char* sql;
char* topicName; char* topicName;
int64_t topicId; int64_t topicId;
int32_t nextVgIdx; SArray* vgs; // SArray<SMqClientVg>
SArray* vgs; // SArray<SMqClientVg> int8_t isSchemaAdaptive;
SSchemaWrapper schema; int32_t numOfFields;
TAOS_FIELD* fields;
} SMqClientTopic; } SMqClientTopic;
typedef struct { typedef struct {
...@@ -130,11 +143,11 @@ typedef struct { ...@@ -130,11 +143,11 @@ typedef struct {
} SMqPollCbParam; } SMqPollCbParam;
typedef struct { typedef struct {
tmq_t* tmq; tmq_t* tmq;
/*SMqClientVg* pVg;*/
int32_t async; int32_t async;
tsem_t rspSem; tsem_t rspSem;
tmq_resp_err_t rspErr; tmq_resp_err_t rspErr;
/*SMqClientVg* pVg;*/
} SMqCommitCbParam; } SMqCommitCbParam;
tmq_conf_t* tmq_conf_new() { tmq_conf_t* tmq_conf_new() {
...@@ -471,7 +484,12 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) { ...@@ -471,7 +484,12 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
tNameExtractFullName(&name, topicFname); tNameExtractFullName(&name, topicFname);
tscDebug("subscribe topic: %s", topicFname); tscDebug("subscribe topic: %s", topicFname);
SMqClientTopic topic = { SMqClientTopic topic = {
.nextVgIdx = 0, .sql = NULL, .sqlLen = 0, .topicId = 0, .topicName = topicFname, .vgs = NULL}; .sql = NULL,
.sqlLen = 0,
.topicId = 0,
.topicName = topicFname,
.vgs = NULL,
};
topic.vgs = taosArrayInit(0, sizeof(SMqClientVg)); topic.vgs = taosArrayInit(0, sizeof(SMqClientVg));
taosArrayPush(tmq->clientTopics, &topic); taosArrayPush(tmq->clientTopics, &topic);
taosArrayPush(req.topicNames, &topicFname); taosArrayPush(req.topicNames, &topicFname);
...@@ -615,6 +633,7 @@ _return: ...@@ -615,6 +633,7 @@ _return:
return pRequest; return pRequest;
} }
#if 0
TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, int sqlLen) { TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, int sqlLen) {
STscObj* pTscObj = (STscObj*)taos; STscObj* pTscObj = (STscObj*)taos;
SRequestObj* pRequest = NULL; SRequestObj* pRequest = NULL;
...@@ -700,6 +719,7 @@ _return: ...@@ -700,6 +719,7 @@ _return:
return pRequest; return pRequest;
} }
#endif
static char* formatTimestamp(char* buf, int64_t val, int precision) { static char* formatTimestamp(char* buf, int64_t val, int precision) {
time_t tt; time_t tt;
......
...@@ -35,7 +35,7 @@ int main(int argc, char** argv) { ...@@ -35,7 +35,7 @@ int main(int argc, char** argv) {
TEST(testCase, driverInit_Test) { TEST(testCase, driverInit_Test) {
// taosInitGlobalCfg(); // taosInitGlobalCfg();
// taos_init(); // taos_init();
} }
TEST(testCase, create_topic_ctb_Test) { TEST(testCase, create_topic_ctb_Test) {
...@@ -55,8 +55,9 @@ TEST(testCase, create_topic_ctb_Test) { ...@@ -55,8 +55,9 @@ TEST(testCase, create_topic_ctb_Test) {
taos_free_result(pRes); taos_free_result(pRes);
char* sql = "select * from tu"; // char* sql = "select * from tu";
pRes = tmq_create_topic(pConn, "test_ctb_topic_1", sql, strlen(sql)); // pRes = tmq_create_topic(pConn, "test_ctb_topic_1", sql, strlen(sql));
pRes = taos_query(pConn, "create test_ctb_topic_1 as select * from tu");
taos_free_result(pRes); taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
...@@ -69,7 +70,7 @@ TEST(testCase, create_topic_stb_Test) { ...@@ -69,7 +70,7 @@ TEST(testCase, create_topic_stb_Test) {
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
printf("error in use db, reason:%s\n", taos_errstr(pRes)); printf("error in use db, reason:%s\n", taos_errstr(pRes));
} }
//taos_free_result(pRes); // taos_free_result(pRes);
TAOS_FIELD* pFields = taos_fetch_fields(pRes); TAOS_FIELD* pFields = taos_fetch_fields(pRes);
ASSERT_TRUE(pFields == nullptr); ASSERT_TRUE(pFields == nullptr);
...@@ -79,8 +80,9 @@ TEST(testCase, create_topic_stb_Test) { ...@@ -79,8 +80,9 @@ TEST(testCase, create_topic_stb_Test) {
taos_free_result(pRes); taos_free_result(pRes);
char* sql = "select * from st1"; // char* sql = "select * from st1";
pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql)); // pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql));
pRes = taos_query(pConn, "create test_ctb_topic_1 as select * from st1");
taos_free_result(pRes); taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
......
...@@ -24,7 +24,7 @@ int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype) { ...@@ -24,7 +24,7 @@ int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype) {
return (*pMsgCb->qsizeFp)(pMsgCb->pWrapper, vgId, qtype); return (*pMsgCb->qsizeFp)(pMsgCb->pWrapper, vgId, qtype);
} }
int32_t tmsgSendReq(const SMsgCb* pMsgCb, SEpSet* epSet, SRpcMsg* pReq) { int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq) {
return (*pMsgCb->sendReqFp)(pMsgCb->pWrapper, epSet, pReq); return (*pMsgCb->sendReqFp)(pMsgCb->pWrapper, epSet, pReq);
} }
...@@ -32,4 +32,12 @@ int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq) { ...@@ -32,4 +32,12 @@ int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq) {
return (*pMsgCb->sendMnodeReqFp)(pMsgCb->pWrapper, pReq); return (*pMsgCb->sendMnodeReqFp)(pMsgCb->pWrapper, pReq);
} }
void tmsgSendRsp(const SMsgCb* pMsgCb, SRpcMsg* pRsp) { return (*pMsgCb->sendRspFp)(pMsgCb->pWrapper, pRsp); } void tmsgSendRsp(const SMsgCb* pMsgCb, const SRpcMsg* pRsp) { return (*pMsgCb->sendRspFp)(pMsgCb->pWrapper, pRsp); }
void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) {
(*pMsgCb->registerBrokenLinkArgFp)(pMsgCb->pWrapper, pMsg);
}
void tmsgReleaseHandle(const SMsgCb* pMsgCb, void* handle, int8_t type) {
(*pMsgCb->releaseHandleFp)(pMsgCb->pWrapper, handle, type);
}
\ No newline at end of file
...@@ -24,6 +24,7 @@ static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) { ...@@ -24,6 +24,7 @@ static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) {
msgCb.sendReqFp = dndSendReqToDnode; msgCb.sendReqFp = dndSendReqToDnode;
msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendMnodeReqFp = dndSendReqToMnode;
msgCb.sendRspFp = dndSendRsp; msgCb.sendRspFp = dndSendRsp;
msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg;
pOption->msgCb = msgCb; pOption->msgCb = msgCb;
} }
......
...@@ -137,8 +137,9 @@ void dndReportStartup(SDnode *pDnode, const char *pName, const char *pDesc ...@@ -137,8 +137,9 @@ void dndReportStartup(SDnode *pDnode, const char *pName, const char *pDesc
void dndSendMonitorReport(SDnode *pDnode); void dndSendMonitorReport(SDnode *pDnode);
int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, SEpSet *pEpSet, SRpcMsg *pMsg); int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pMsg);
void dndSendRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp); void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp);
void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
int32_t dndProcessNodeMsg(SDnode *pDnode, SNodeMsg *pMsg); int32_t dndProcessNodeMsg(SDnode *pDnode, SNodeMsg *pMsg);
int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed); int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed);
......
...@@ -56,6 +56,7 @@ void dndCleanupServer(SDnode *pDnode); ...@@ -56,6 +56,7 @@ void dndCleanupServer(SDnode *pDnode);
int32_t dndInitClient(SDnode *pDnode); int32_t dndInitClient(SDnode *pDnode);
void dndCleanupClient(SDnode *pDnode); void dndCleanupClient(SDnode *pDnode);
int32_t dndInitMsgHandle(SDnode *pDnode); int32_t dndInitMsgHandle(SDnode *pDnode);
void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -116,11 +116,12 @@ static void dndClearNodesExecpt(SDnode *pDnode, ENodeType except) { ...@@ -116,11 +116,12 @@ static void dndClearNodesExecpt(SDnode *pDnode, ENodeType except) {
} }
} }
static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen) { static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen,
ProcFuncType ftype) {
SRpcMsg *pRpc = &pMsg->rpcMsg; SRpcMsg *pRpc = &pMsg->rpcMsg;
pRpc->pCont = pCont; pRpc->pCont = pCont;
dTrace("msg:%p, get from child process queue, type:%s handle:%p app:%p", pMsg, TMSG_INFO(pRpc->msgType), dTrace("msg:%p, get from child queue, type:%s handle:%p app:%p", pMsg, TMSG_INFO(pRpc->msgType), pRpc->handle,
pRpc->handle, pRpc->ahandle); pRpc->ahandle);
NodeMsgFp msgFp = pWrapper->msgFps[TMSG_INDEX(pRpc->msgType)]; NodeMsgFp msgFp = pWrapper->msgFps[TMSG_INDEX(pRpc->msgType)];
int32_t code = (*msgFp)(pWrapper, pMsg); int32_t code = (*msgFp)(pWrapper, pMsg);
...@@ -138,13 +139,21 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t ...@@ -138,13 +139,21 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t
} }
} }
static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, int32_t msgLen, void *pCont, int32_t contLen) { static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen,
pRpc->pCont = pCont; ProcFuncType ftype) {
dTrace("msg:%p, get from parent process queue, type:%s handle:%p app:%p", pRpc, TMSG_INFO(pRpc->msgType), pMsg->pCont = pCont;
pRpc->handle, pRpc->ahandle); dTrace("msg:%p, get from parent queue, type:%s handle:%p app:%p", pMsg, TMSG_INFO(pMsg->msgType), pMsg->handle,
pMsg->ahandle);
dndSendRsp(pWrapper, pRpc); switch (ftype) {
taosMemoryFree(pRpc); case PROC_REGISTER:
rpcRegisterBrokenLinkArg(pMsg);
break;
default:
dndSendRpcRsp(pWrapper, pMsg);
break;
}
taosMemoryFree(pMsg);
} }
static int32_t dndRunInMultiProcess(SDnode *pDnode) { static int32_t dndRunInMultiProcess(SDnode *pDnode) {
......
...@@ -42,6 +42,8 @@ static inline int32_t dndBuildMsg(SNodeMsg *pMsg, SRpcMsg *pRpc) { ...@@ -42,6 +42,8 @@ static inline int32_t dndBuildMsg(SNodeMsg *pMsg, SRpcMsg *pRpc) {
} }
memcpy(pMsg->user, connInfo.user, TSDB_USER_LEN); memcpy(pMsg->user, connInfo.user, TSDB_USER_LEN);
pMsg->clientIp = connInfo.clientIp;
pMsg->clientPort = connInfo.clientPort;
memcpy(&pMsg->rpcMsg, pRpc, sizeof(SRpcMsg)); memcpy(&pMsg->rpcMsg, pRpc, sizeof(SRpcMsg));
return 0; return 0;
} }
...@@ -66,7 +68,7 @@ void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpSet) { ...@@ -66,7 +68,7 @@ void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpSet) {
} else if (pWrapper->procType == PROC_PARENT) { } else if (pWrapper->procType == PROC_PARENT) {
dTrace("msg:%p, is created and will put into child queue, handle:%p app:%p user:%s", pMsg, pRpc->handle, dTrace("msg:%p, is created and will put into child queue, handle:%p app:%p user:%s", pMsg, pRpc->handle,
pRpc->ahandle, pMsg->user); pRpc->ahandle, pMsg->user);
code = taosProcPutToChildQueue(pWrapper->pProc, pMsg, sizeof(SNodeMsg), pRpc->pCont, pRpc->contLen); code = taosProcPutToChildQ(pWrapper->pProc, pMsg, sizeof(SNodeMsg), pRpc->pCont, pRpc->contLen, PROC_REQ);
} else { } else {
dTrace("msg:%p, should not processed in child process, handle:%p app:%p user:%s", pMsg, pRpc->handle, pRpc->ahandle, dTrace("msg:%p, should not processed in child process, handle:%p app:%p user:%s", pMsg, pRpc->handle, pRpc->ahandle,
pMsg->user); pMsg->user);
......
...@@ -309,7 +309,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) { ...@@ -309,7 +309,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
return 0; return 0;
} }
static int32_t dndSendRpcReq(STransMgmt *pMgmt, SEpSet *pEpSet, SRpcMsg *pReq) { static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *pReq) {
if (pMgmt->clientRpc == NULL) { if (pMgmt->clientRpc == NULL) {
terrno = TSDB_CODE_DND_OFFLINE; terrno = TSDB_CODE_DND_OFFLINE;
return -1; return -1;
...@@ -319,7 +319,7 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, SEpSet *pEpSet, SRpcMsg *pReq) { ...@@ -319,7 +319,7 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, SEpSet *pEpSet, SRpcMsg *pReq) {
return 0; return 0;
} }
int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, SEpSet *pEpSet, SRpcMsg *pReq) { int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
} else { } else {
SDnode *pDnode = pWrapper->pDnode; SDnode *pDnode = pWrapper->pDnode;
...@@ -348,7 +348,7 @@ int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) { ...@@ -348,7 +348,7 @@ int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) {
} }
} }
static void dndSendRpcRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) { void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
if (pRsp->code == TSDB_CODE_APP_NOT_READY) { if (pRsp->code == TSDB_CODE_APP_NOT_READY) {
SMgmtWrapper *pDnodeWrapper = dndAcquireWrapper(pWrapper->pDnode, DNODE); SMgmtWrapper *pDnodeWrapper = dndAcquireWrapper(pWrapper->pDnode, DNODE);
if (pDnodeWrapper != NULL) { if (pDnodeWrapper != NULL) {
...@@ -362,11 +362,11 @@ static void dndSendRpcRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) { ...@@ -362,11 +362,11 @@ static void dndSendRpcRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) {
} }
} }
void dndSendRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) { void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
int32_t code = -1; int32_t code = -1;
do { do {
code = taosProcPutToParentQueue(pWrapper->pProc, pRsp, sizeof(SRpcMsg), pRsp->pCont, pRsp->contLen); code = taosProcPutToParentQ(pWrapper->pProc, pRsp, sizeof(SRpcMsg), pRsp->pCont, pRsp->contLen, PROC_RSP);
if (code != 0) { if (code != 0) {
taosMsleep(10); taosMsleep(10);
} }
...@@ -375,3 +375,17 @@ void dndSendRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) { ...@@ -375,3 +375,17 @@ void dndSendRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) {
dndSendRpcRsp(pWrapper, pRsp); dndSendRpcRsp(pWrapper, pRsp);
} }
} }
void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
if (pWrapper->procType == PROC_CHILD) {
int32_t code = -1;
do {
code = taosProcPutToParentQ(pWrapper->pProc, pMsg, sizeof(SRpcMsg), pMsg->pCont, pMsg->contLen, PROC_REGISTER);
if (code != 0) {
taosMsleep(10);
}
} while (code != 0);
} else {
rpcRegisterBrokenLinkArg(pMsg);
}
}
\ No newline at end of file
...@@ -29,7 +29,7 @@ void dmInitMsgHandles(SMgmtWrapper *pWrapper); ...@@ -29,7 +29,7 @@ void dmInitMsgHandles(SMgmtWrapper *pWrapper);
void dmGetMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet); void dmGetMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet);
void dmUpdateMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet); void dmUpdateMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet);
void dmSendRedirectRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); void dmSendRedirectRsp(SDnodeMgmt *pMgmt, const SRpcMsg *pMsg);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -54,7 +54,7 @@ void dmGetDnodeEp(SMgmtWrapper *pWrapper, int32_t dnodeId, char *pEp, char *pFqd ...@@ -54,7 +54,7 @@ void dmGetDnodeEp(SMgmtWrapper *pWrapper, int32_t dnodeId, char *pEp, char *pFqd
taosRUnLockLatch(&pMgmt->latch); taosRUnLockLatch(&pMgmt->latch);
} }
void dmSendRedirectRsp(SDnodeMgmt *pMgmt, SRpcMsg *pReq) { void dmSendRedirectRsp(SDnodeMgmt *pMgmt, const SRpcMsg *pReq) {
SDnode *pDnode = pMgmt->pDnode; SDnode *pDnode = pMgmt->pDnode;
SEpSet epSet = {0}; SEpSet epSet = {0};
......
...@@ -52,6 +52,7 @@ static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { ...@@ -52,6 +52,7 @@ static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
msgCb.sendReqFp = dndSendReqToDnode; msgCb.sendReqFp = dndSendReqToDnode;
msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendMnodeReqFp = dndSendReqToMnode;
msgCb.sendRspFp = dndSendRsp; msgCb.sendRspFp = dndSendRsp;
msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg;
pOption->msgCb = msgCb; pOption->msgCb = msgCb;
} }
......
...@@ -27,6 +27,7 @@ static void qmInitOption(SQnodeMgmt *pMgmt, SQnodeOpt *pOption) { ...@@ -27,6 +27,7 @@ static void qmInitOption(SQnodeMgmt *pMgmt, SQnodeOpt *pOption) {
msgCb.sendReqFp = dndSendReqToDnode; msgCb.sendReqFp = dndSendReqToDnode;
msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendMnodeReqFp = dndSendReqToMnode;
msgCb.sendRspFp = dndSendRsp; msgCb.sendRspFp = dndSendRsp;
msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg;
pOption->msgCb = msgCb; pOption->msgCb = msgCb;
} }
......
...@@ -24,6 +24,7 @@ static void smInitOption(SSnodeMgmt *pMgmt, SSnodeOpt *pOption) { ...@@ -24,6 +24,7 @@ static void smInitOption(SSnodeMgmt *pMgmt, SSnodeOpt *pOption) {
msgCb.sendReqFp = dndSendReqToDnode; msgCb.sendReqFp = dndSendReqToDnode;
msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendMnodeReqFp = dndSendReqToMnode;
msgCb.sendRspFp = dndSendRsp; msgCb.sendRspFp = dndSendRsp;
msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg;
pOption->msgCb = msgCb; pOption->msgCb = msgCb;
} }
......
...@@ -137,6 +137,7 @@ static void *vmOpenVnodeFunc(void *param) { ...@@ -137,6 +137,7 @@ static void *vmOpenVnodeFunc(void *param) {
msgCb.sendReqFp = dndSendReqToDnode; msgCb.sendReqFp = dndSendReqToDnode;
msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendMnodeReqFp = dndSendReqToMnode;
msgCb.sendRspFp = dndSendRsp; msgCb.sendRspFp = dndSendRsp;
msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg;
SVnodeCfg cfg = {.msgCb = msgCb, .pTfs = pMgmt->pTfs, .vgId = pCfg->vgId, .dbId = pCfg->dbUid}; SVnodeCfg cfg = {.msgCb = msgCb, .pTfs = pMgmt->pTfs, .vgId = pCfg->vgId, .dbId = pCfg->dbUid};
SVnode *pImpl = vnodeOpen(pCfg->path, &cfg); SVnode *pImpl = vnodeOpen(pCfg->path, &cfg);
if (pImpl == NULL) { if (pImpl == NULL) {
......
...@@ -91,6 +91,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { ...@@ -91,6 +91,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
msgCb.sendReqFp = dndSendReqToDnode; msgCb.sendReqFp = dndSendReqToDnode;
msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendMnodeReqFp = dndSendReqToMnode;
msgCb.sendRspFp = dndSendRsp; msgCb.sendRspFp = dndSendRsp;
msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg;
vnodeCfg.msgCb = msgCb; vnodeCfg.msgCb = msgCb;
vnodeCfg.pTfs = pMgmt->pTfs; vnodeCfg.pTfs = pMgmt->pTfs;
......
...@@ -731,10 +731,10 @@ typedef struct { ...@@ -731,10 +731,10 @@ typedef struct {
int32_t vgNum; int32_t vgNum;
SRWLatch lock; SRWLatch lock;
int8_t status; int8_t status;
int8_t sourceType;
int8_t sinkType;
// int32_t sqlLen; // int32_t sqlLen;
int32_t sinkVgId; // 0 for automatic int8_t createdBy; // STREAM_CREATED_BY__USER or SMA
int32_t fixedSinkVgId; // 0 for shuffle
int64_t smaId; // 0 for unused
char* sql; char* sql;
char* logicalPlan; char* logicalPlan;
char* physicalPlan; char* physicalPlan;
......
...@@ -27,7 +27,7 @@ void mndCleanupScheduler(SMnode* pMnode); ...@@ -27,7 +27,7 @@ void mndCleanupScheduler(SMnode* pMnode);
int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscribeObj* pSub); int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscribeObj* pSub);
int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, int64_t smaId); int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -31,7 +31,7 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream); ...@@ -31,7 +31,7 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream);
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream); SSdbRaw *mndStreamActionEncode(SStreamObj *pStream);
SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw); SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw);
int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast, STrans *pTrans, int64_t smaId); int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast, STrans *pTrans);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -26,8 +26,11 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) { ...@@ -26,8 +26,11 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
if (tEncodeI64(pEncoder, pObj->dbUid) < 0) return -1; if (tEncodeI64(pEncoder, pObj->dbUid) < 0) return -1;
if (tEncodeI32(pEncoder, pObj->version) < 0) return -1; if (tEncodeI32(pEncoder, pObj->version) < 0) return -1;
if (tEncodeI8(pEncoder, pObj->status) < 0) return -1; if (tEncodeI8(pEncoder, pObj->status) < 0) return -1;
if (tEncodeI8(pEncoder, pObj->createdBy) < 0) return -1;
if (tEncodeI32(pEncoder, pObj->fixedSinkVgId) < 0) return -1;
if (tEncodeI64(pEncoder, pObj->smaId) < 0) return -1;
if (tEncodeCStr(pEncoder, pObj->sql) < 0) return -1; if (tEncodeCStr(pEncoder, pObj->sql) < 0) return -1;
if (tEncodeCStr(pEncoder, pObj->logicalPlan) < 0) return -1; /*if (tEncodeCStr(pEncoder, pObj->logicalPlan) < 0) return -1;*/
if (tEncodeCStr(pEncoder, pObj->physicalPlan) < 0) return -1; if (tEncodeCStr(pEncoder, pObj->physicalPlan) < 0) return -1;
// TODO encode tasks // TODO encode tasks
if (pObj->tasks) { if (pObj->tasks) {
...@@ -69,8 +72,11 @@ int32_t tDecodeSStreamObj(SCoder *pDecoder, SStreamObj *pObj) { ...@@ -69,8 +72,11 @@ int32_t tDecodeSStreamObj(SCoder *pDecoder, SStreamObj *pObj) {
if (tDecodeI64(pDecoder, &pObj->dbUid) < 0) return -1; if (tDecodeI64(pDecoder, &pObj->dbUid) < 0) return -1;
if (tDecodeI32(pDecoder, &pObj->version) < 0) return -1; if (tDecodeI32(pDecoder, &pObj->version) < 0) return -1;
if (tDecodeI8(pDecoder, &pObj->status) < 0) return -1; if (tDecodeI8(pDecoder, &pObj->status) < 0) return -1;
if (tDecodeI8(pDecoder, &pObj->createdBy) < 0) return -1;
if (tDecodeI32(pDecoder, &pObj->fixedSinkVgId) < 0) return -1;
if (tDecodeI64(pDecoder, &pObj->smaId) < 0) return -1;
if (tDecodeCStrAlloc(pDecoder, &pObj->sql) < 0) return -1; if (tDecodeCStrAlloc(pDecoder, &pObj->sql) < 0) return -1;
if (tDecodeCStrAlloc(pDecoder, &pObj->logicalPlan) < 0) return -1; /*if (tDecodeCStrAlloc(pDecoder, &pObj->logicalPlan) < 0) return -1;*/
if (tDecodeCStrAlloc(pDecoder, &pObj->physicalPlan) < 0) return -1; if (tDecodeCStrAlloc(pDecoder, &pObj->physicalPlan) < 0) return -1;
pObj->tasks = NULL; pObj->tasks = NULL;
int32_t sz; int32_t sz;
......
...@@ -20,138 +20,178 @@ ...@@ -20,138 +20,178 @@
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE) #define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
//!!!! Note: only APPEND columns in below tables, NO insert !!!! //!!!! Note: only APPEND columns in below tables, NO insert !!!!
static const SInfosTableSchema dnodesSchema[] = {{.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, static const SInfosTableSchema dnodesSchema[] = {
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
}; {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
static const SInfosTableSchema mnodesSchema[] = {{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, };
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, static const SInfosTableSchema mnodesSchema[] = {
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "role_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
}; {.name = "role_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
static const SInfosTableSchema modulesSchema[] = {{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY}, };
{.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, static const SInfosTableSchema modulesSchema[] = {
}; {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
static const SInfosTableSchema qnodesSchema[] = {{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY}, {.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, };
}; static const SInfosTableSchema qnodesSchema[] = {
static const SInfosTableSchema userDBSchema[] = {{.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
{.name = "vgroups", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, };
{.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, static const SInfosTableSchema userDBSchema[] = {
{.name = "quorum", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "days", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "vgroups", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "cache", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
{.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "quorum", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "days", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
{.name = "wallevel", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "cache", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "precision", .bytes = 3 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update {.name = "wallevel", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
}; {.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
static const SInfosTableSchema userFuncSchema[] = {{.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY}, {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
{.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "precision", .bytes = 3 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_BINARY}, // {.name = "update", .bytes = 1, .type =
{.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, // TSDB_DATA_TYPE_TINYINT}, // disable update
}; };
static const SInfosTableSchema userIdxSchema[] = {{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY}, static const SInfosTableSchema userFuncSchema[] = {
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
{.name = "index_database", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "index_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "column_name", .bytes = 64, .type = TSDB_DATA_TYPE_BINARY}, {.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_BINARY},
{.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, {.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
{.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_BINARY}, };
}; static const SInfosTableSchema userIdxSchema[] = {
static const SInfosTableSchema userStbsSchema[] = {{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "index_database", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
{.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "index_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "tags", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "column_name", .bytes = 64, .type = TSDB_DATA_TYPE_BINARY},
{.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
{.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_BINARY},
{.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_INT}, };
}; static const SInfosTableSchema userStbsSchema[] = {
static const SInfosTableSchema userStreamsSchema[] = {{.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_BINARY}, {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY}, {.name = "tags", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
}; {.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_INT},
};
static const SInfosTableSchema userStreamsSchema[] = {
{.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_BINARY},
{.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY},
};
static const SInfosTableSchema userTblsSchema[] = { static const SInfosTableSchema userTblsSchema[] = {
{.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "uid", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, {.name = "uid", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "table_comment", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "table_comment", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
}; };
static const SInfosTableSchema userTblDistSchema[] = {{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY}, static const SInfosTableSchema userTblDistSchema[] = {
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, {.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
{.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_BINARY}, {.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_BINARY},
{.name = "max_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "avg_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "max_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "stddev_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "avg_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "rows", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, {.name = "stddev_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "rows", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
{.name = "storage_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "compression_ratio", .bytes = 8, .type = TSDB_DATA_TYPE_DOUBLE}, {.name = "storage_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
{.name = "rows_in_mem", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "compression_ratio", .bytes = 8, .type = TSDB_DATA_TYPE_DOUBLE},
{.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "rows_in_mem", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
}; {.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
static const SInfosTableSchema userUsersSchema[] = {{.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, };
{.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, static const SInfosTableSchema userUsersSchema[] = {
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
}; {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
static const SInfosTableSchema vgroupsSchema[] = {{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, };
{.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, static const SInfosTableSchema vgroupsSchema[] = {
{.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "onlines", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "v1_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "v1_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, {.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
{.name = "v2_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "onlines", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "v2_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, {.name = "v1_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "v3_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "v1_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
{.name = "v3_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY}, {.name = "v2_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "compacting", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "v2_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
{.name = "nfiles", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "v3_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "v3_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
}; {.name = "compacting", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "nfiles", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
static const SInfosTableMeta infosMeta[] = {{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema)}, {.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)}, };
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)}, // TODO put into perf schema
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)}, static const SInfosTableSchema topicSchema[] = {
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)}, {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)}, {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{TSDB_INS_TABLE_USER_STABLES, userStbsSchema, tListLen(userStbsSchema)}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
{TSDB_INS_TABLE_USER_STREAMS, userStreamsSchema, tListLen(userStreamsSchema)}, {.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY},
{TSDB_INS_TABLE_USER_TABLES, userTblsSchema, tListLen(userTblsSchema)}, {.name = "row_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)}, };
{TSDB_INS_TABLE_USER_USERS, userUsersSchema, tListLen(userUsersSchema)},
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)}, static const SInfosTableSchema consumerSchema[] = {
}; {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
//connection/application/ {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "status", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
// ep
// up time
// topics
};
static const SInfosTableSchema subscribeSchema[] = {
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
};
static const SInfosTableMeta infosMeta[] = {
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema)},
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
{TSDB_INS_TABLE_USER_STABLES, userStbsSchema, tListLen(userStbsSchema)},
{TSDB_INS_TABLE_USER_STREAMS, userStreamsSchema, tListLen(userStreamsSchema)},
{TSDB_INS_TABLE_USER_TABLES, userTblsSchema, tListLen(userTblsSchema)},
{TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
{TSDB_INS_TABLE_USER_USERS, userUsersSchema, tListLen(userUsersSchema)},
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)},
};
// connection/application/
int32_t mndInitInfosTableSchema(const SInfosTableSchema *pSrc, int32_t colNum, SSchema **pDst) { int32_t mndInitInfosTableSchema(const SInfosTableSchema *pSrc, int32_t colNum, SSchema **pDst) {
SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema)); SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema));
if (NULL == schema) { if (NULL == schema) {
...@@ -161,7 +201,7 @@ int32_t mndInitInfosTableSchema(const SInfosTableSchema *pSrc, int32_t colNum, S ...@@ -161,7 +201,7 @@ int32_t mndInitInfosTableSchema(const SInfosTableSchema *pSrc, int32_t colNum, S
for (int32_t i = 0; i < colNum; ++i) { for (int32_t i = 0; i < colNum; ++i) {
strcpy(schema[i].name, pSrc[i].name); strcpy(schema[i].name, pSrc[i].name);
schema[i].type = pSrc[i].type; schema[i].type = pSrc[i].type;
schema[i].colId = i + 1; schema[i].colId = i + 1;
schema[i].bytes = pSrc[i].bytes; schema[i].bytes = pSrc[i].bytes;
...@@ -182,11 +222,11 @@ int32_t mndInsInitMeta(SHashObj *hash) { ...@@ -182,11 +222,11 @@ int32_t mndInsInitMeta(SHashObj *hash) {
for (int32_t i = 0; i < tListLen(infosMeta); ++i) { for (int32_t i = 0; i < tListLen(infosMeta); ++i) {
strcpy(meta.tbName, infosMeta[i].name); strcpy(meta.tbName, infosMeta[i].name);
meta.numOfColumns = infosMeta[i].colNum; meta.numOfColumns = infosMeta[i].colNum;
if (mndInitInfosTableSchema(infosMeta[i].schema, infosMeta[i].colNum, &meta.pSchemas)) { if (mndInitInfosTableSchema(infosMeta[i].schema, infosMeta[i].colNum, &meta.pSchemas)) {
return -1; return -1;
} }
if (taosHashPut(hash, meta.tbName, strlen(meta.tbName), &meta, sizeof(meta))) { if (taosHashPut(hash, meta.tbName, strlen(meta.tbName), &meta, sizeof(meta))) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -210,7 +250,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char * ...@@ -210,7 +250,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
} }
*pRsp = *meta; *pRsp = *meta;
pRsp->pSchemas = taosMemoryCalloc(meta->numOfColumns, sizeof(SSchema)); pRsp->pSchemas = taosMemoryCalloc(meta->numOfColumns, sizeof(SSchema));
if (pRsp->pSchemas == NULL) { if (pRsp->pSchemas == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
...@@ -237,13 +277,13 @@ void mndCleanupInfos(SMnode *pMnode) { ...@@ -237,13 +277,13 @@ void mndCleanupInfos(SMnode *pMnode) {
if (NULL == pMnode->infosMeta) { if (NULL == pMnode->infosMeta) {
return; return;
} }
void *pIter = taosHashIterate(pMnode->infosMeta, NULL); void *pIter = taosHashIterate(pMnode->infosMeta, NULL);
while (pIter) { while (pIter) {
STableMetaRsp *meta = (STableMetaRsp *)pIter; STableMetaRsp *meta = (STableMetaRsp *)pIter;
taosMemoryFreeClear(meta->pSchemas); taosMemoryFreeClear(meta->pSchemas);
pIter = taosHashIterate(pMnode->infosMeta, pIter); pIter = taosHashIterate(pMnode->infosMeta, pIter);
} }
...@@ -251,5 +291,3 @@ void mndCleanupInfos(SMnode *pMnode) { ...@@ -251,5 +291,3 @@ void mndCleanupInfos(SMnode *pMnode) {
pMnode->infosMeta = NULL; pMnode->infosMeta = NULL;
} }
...@@ -44,7 +44,8 @@ typedef struct { ...@@ -44,7 +44,8 @@ typedef struct {
SQueryDesc *pQueries; SQueryDesc *pQueries;
} SConnObj; } SConnObj;
static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid, const char *app, int64_t startTime); static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, uint16_t port, int32_t pid,
const char *app, int64_t startTime);
static void mndFreeConn(SConnObj *pConn); static void mndFreeConn(SConnObj *pConn);
static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId); static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId);
static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn); static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn);
...@@ -94,7 +95,8 @@ void mndCleanupProfile(SMnode *pMnode) { ...@@ -94,7 +95,8 @@ void mndCleanupProfile(SMnode *pMnode) {
} }
} }
static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid, const char *app, int64_t startTime) { static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, uint16_t port, int32_t pid,
const char *app, int64_t startTime) {
SProfileMgmt *pMgmt = &pMnode->profileMgmt; SProfileMgmt *pMgmt = &pMnode->profileMgmt;
int32_t connId = atomic_add_fetch_32(&pMgmt->connId, 1); int32_t connId = atomic_add_fetch_32(&pMgmt->connId, 1);
...@@ -104,8 +106,8 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid, ...@@ -104,8 +106,8 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid,
SConnObj connObj = {.id = connId, SConnObj connObj = {.id = connId,
.appStartTimeMs = startTime, .appStartTimeMs = startTime,
.pid = pid, .pid = pid,
.ip = pInfo->clientIp, .ip = ip,
.port = pInfo->clientPort, .port = port,
.killed = 0, .killed = 0,
.loginTimeMs = taosGetTimestampMs(), .loginTimeMs = taosGetTimestampMs(),
.lastAccessTimeMs = 0, .lastAccessTimeMs = 0,
...@@ -114,17 +116,17 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid, ...@@ -114,17 +116,17 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid,
.pQueries = NULL}; .pQueries = NULL};
connObj.lastAccessTimeMs = connObj.loginTimeMs; connObj.lastAccessTimeMs = connObj.loginTimeMs;
tstrncpy(connObj.user, pInfo->user, TSDB_USER_LEN); tstrncpy(connObj.user, user, TSDB_USER_LEN);
tstrncpy(connObj.app, app, TSDB_APP_NAME_LEN); tstrncpy(connObj.app, app, TSDB_APP_NAME_LEN);
int32_t keepTime = tsShellActivityTimer * 3; int32_t keepTime = tsShellActivityTimer * 3;
SConnObj *pConn = taosCachePut(pMgmt->cache, &connId, sizeof(int32_t), &connObj, sizeof(connObj), keepTime * 1000); SConnObj *pConn = taosCachePut(pMgmt->cache, &connId, sizeof(int32_t), &connObj, sizeof(connObj), keepTime * 1000);
if (pConn == NULL) { if (pConn == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
mError("conn:%d, failed to put into cache since %s, user:%s", connId, pInfo->user, terrstr()); mError("conn:%d, failed to put into cache since %s, user:%s", connId, user, terrstr());
return NULL; return NULL;
} else { } else {
mTrace("conn:%d, is created, data:%p user:%s", pConn->id, pConn, pInfo->user); mTrace("conn:%d, is created, data:%p user:%s", pConn->id, pConn, user);
return pConn; return pConn;
} }
} }
...@@ -184,20 +186,14 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { ...@@ -184,20 +186,14 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
SConnObj *pConn = NULL; SConnObj *pConn = NULL;
int32_t code = -1; int32_t code = -1;
SConnectReq connReq = {0}; SConnectReq connReq = {0};
char ip[30] = {0};
if (tDeserializeSConnectReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &connReq) != 0) { if (tDeserializeSConnectReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &connReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG; terrno = TSDB_CODE_INVALID_MSG;
goto CONN_OVER; goto CONN_OVER;
} }
SRpcConnInfo info = {0}; taosIp2String(pReq->clientIp, ip);
if (rpcGetConnInfo(pReq->rpcMsg.handle, &info) != 0) {
mError("user:%s, failed to login while get connection info since %s", pReq->user, terrstr());
goto CONN_OVER;
}
char ip[30];
taosIp2String(info.clientIp, ip);
pUser = mndAcquireUser(pMnode, pReq->user); pUser = mndAcquireUser(pMnode, pReq->user);
if (pUser == NULL) { if (pUser == NULL) {
...@@ -216,7 +212,8 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { ...@@ -216,7 +212,8 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
} }
} }
pConn = mndCreateConn(pMnode, &info, connReq.pid, connReq.app, connReq.startTime); pConn =
mndCreateConn(pMnode, pReq->user, pReq->clientIp, pReq->clientPort, connReq.pid, connReq.app, connReq.startTime);
if (pConn == NULL) { if (pConn == NULL) {
mError("user:%s, failed to login from %s while create connection since %s", pReq->user, ip, terrstr()); mError("user:%s, failed to login from %s while create connection since %s", pReq->user, ip, terrstr());
goto CONN_OVER; goto CONN_OVER;
...@@ -241,7 +238,7 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { ...@@ -241,7 +238,7 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
pReq->rspLen = contLen; pReq->rspLen = contLen;
pReq->pRsp = pRsp; pReq->pRsp = pRsp;
mDebug("user:%s, login from %s, conn:%d, app:%s", info.user, ip, pConn->id, connReq.app); mDebug("user:%s, login from %s, conn:%d, app:%s", pReq->user, ip, pConn->id, connReq.app);
code = 0; code = 0;
......
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
*/ */
#include "mndQuery.h" #include "mndQuery.h"
#include "mndMnode.h"
#include "executor.h" #include "executor.h"
#include "mndMnode.h"
#include "qworker.h" #include "qworker.h"
int32_t mndProcessQueryMsg(SNodeMsg *pReq) { int32_t mndProcessQueryMsg(SNodeMsg *pReq) {
mTrace("message in query queue is processing"); SMnode *pMnode = pReq->pNode;
SMnode *pMnode = pReq->pNode;
SReadHandle handle = {0}; SReadHandle handle = {0};
mTrace("msg:%p, in query queue is processing", pReq);
switch (pReq->rpcMsg.msgType) { switch (pReq->rpcMsg.msgType) {
case TDMT_VND_QUERY: case TDMT_VND_QUERY:
return qWorkerProcessQueryMsg(&handle, pMnode->pQuery, &pReq->rpcMsg); return qWorkerProcessQueryMsg(&handle, pMnode->pQuery, &pReq->rpcMsg);
...@@ -35,9 +35,9 @@ int32_t mndProcessQueryMsg(SNodeMsg *pReq) { ...@@ -35,9 +35,9 @@ int32_t mndProcessQueryMsg(SNodeMsg *pReq) {
} }
int32_t mndProcessFetchMsg(SNodeMsg *pReq) { int32_t mndProcessFetchMsg(SNodeMsg *pReq) {
mTrace("message in fetch queue is processing");
SMnode *pMnode = pReq->pNode; SMnode *pMnode = pReq->pNode;
mTrace("msg:%p, in fetch queue is processing", pReq);
switch (pReq->rpcMsg.msgType) { switch (pReq->rpcMsg.msgType) {
case TDMT_VND_FETCH: case TDMT_VND_FETCH:
return qWorkerProcessFetchMsg(pMnode, pMnode->pQuery, &pReq->rpcMsg); return qWorkerProcessFetchMsg(pMnode, pMnode->pQuery, &pReq->rpcMsg);
...@@ -52,9 +52,9 @@ int32_t mndProcessFetchMsg(SNodeMsg *pReq) { ...@@ -52,9 +52,9 @@ int32_t mndProcessFetchMsg(SNodeMsg *pReq) {
} }
int32_t mndInitQuery(SMnode *pMnode) { int32_t mndInitQuery(SMnode *pMnode) {
int32_t code = qWorkerInit(NODE_TYPE_MNODE, MND_VGID, NULL, (void **)&pMnode->pQuery, &pMnode->msgCb); if (qWorkerInit(NODE_TYPE_MNODE, MND_VGID, NULL, (void **)&pMnode->pQuery, &pMnode->msgCb) != 0) {
if (code) { mError("failed to init qworker in mnode since %s", terrstr());
return code; return -1;
} }
mndSetMsgHandle(pMnode, TDMT_VND_QUERY, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_VND_QUERY, mndProcessQueryMsg);
...@@ -67,4 +67,3 @@ int32_t mndInitQuery(SMnode *pMnode) { ...@@ -67,4 +67,3 @@ int32_t mndInitQuery(SMnode *pMnode) {
} }
void mndCleanupQuery(SMnode *pMnode) { qWorkerDestroy((void **)&pMnode->pQuery); } void mndCleanupQuery(SMnode *pMnode) { qWorkerDestroy((void **)&pMnode->pQuery); }
...@@ -119,7 +119,7 @@ SVgObj* mndSchedFetchOneVg(SMnode* pMnode, int64_t dbUid) { ...@@ -119,7 +119,7 @@ SVgObj* mndSchedFetchOneVg(SMnode* pMnode, int64_t dbUid) {
return pVgroup; return pVgroup;
} }
int32_t mndAddSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, int64_t smaId) { int32_t mndAddShuffledSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
SSdb* pSdb = pMnode->pSdb; SSdb* pSdb = pMnode->pSdb;
void* pIter = NULL; void* pIter = NULL;
SArray* tasks = taosArrayGetP(pStream->tasks, 0); SArray* tasks = taosArrayGetP(pStream->tasks, 0);
...@@ -151,9 +151,9 @@ int32_t mndAddSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, ...@@ -151,9 +151,9 @@ int32_t mndAddSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream,
pTask->execType = TASK_EXEC__NONE; pTask->execType = TASK_EXEC__NONE;
// sink // sink
if (smaId != -1) { if (pStream->createdBy == STREAM_CREATED_BY__SMA) {
pTask->sinkType = TASK_SINK__SMA; pTask->sinkType = TASK_SINK__SMA;
pTask->smaSink.smaId = smaId; pTask->smaSink.smaId = pStream->smaId;
} else { } else {
pTask->sinkType = TASK_SINK__TABLE; pTask->sinkType = TASK_SINK__TABLE;
} }
...@@ -166,7 +166,45 @@ int32_t mndAddSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, ...@@ -166,7 +166,45 @@ int32_t mndAddSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream,
return 0; return 0;
} }
int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, int64_t smaId) { int32_t mndAddFixedSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
ASSERT(pStream->fixedSinkVgId != 0);
SArray* tasks = taosArrayGetP(pStream->tasks, 0);
SStreamTask* pTask = tNewSStreamTask(pStream->uid);
if (pTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
taosArrayPush(tasks, &pTask);
pTask->nodeId = pStream->fixedSinkVgId;
SVgObj* pVgroup = mndAcquireVgroup(pMnode, pStream->fixedSinkVgId);
if (pVgroup == NULL) {
return -1;
}
pTask->epSet = mndGetVgroupEpset(pMnode, pVgroup);
// source
pTask->sourceType = TASK_SOURCE__MERGE;
// exec
pTask->execType = TASK_EXEC__NONE;
// sink
if (pStream->createdBy == STREAM_CREATED_BY__SMA) {
pTask->sinkType = TASK_SINK__SMA;
pTask->smaSink.smaId = pStream->smaId;
} else {
pTask->sinkType = TASK_SINK__TABLE;
}
//
// dispatch
pTask->dispatchType = TASK_DISPATCH__NONE;
mndPersistTaskDeployReq(pTrans, pTask, &pTask->epSet, TDMT_VND_TASK_DEPLOY, pVgroup->vgId);
return 0;
}
int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
SSdb* pSdb = pMnode->pSdb; SSdb* pSdb = pMnode->pSdb;
SQueryPlan* pPlan = qStringToQueryPlan(pStream->physicalPlan); SQueryPlan* pPlan = qStringToQueryPlan(pStream->physicalPlan);
if (pPlan == NULL) { if (pPlan == NULL) {
...@@ -185,7 +223,11 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, i ...@@ -185,7 +223,11 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, i
taosArrayPush(pStream->tasks, &taskOneLevel); taosArrayPush(pStream->tasks, &taskOneLevel);
// add extra sink // add extra sink
hasExtraSink = true; hasExtraSink = true;
mndAddSinkToStream(pMnode, pTrans, pStream, smaId); if (pStream->fixedSinkVgId == 0) {
mndAddShuffledSinkToStream(pMnode, pTrans, pStream);
} else {
mndAddFixedSinkToStream(pMnode, pTrans, pStream);
}
} }
for (int32_t level = 0; level < totLevel; level++) { for (int32_t level = 0; level < totLevel; level++) {
...@@ -221,12 +263,14 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, i ...@@ -221,12 +263,14 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, i
pTask->sinkType = TASK_SINK__SHOW; pTask->sinkType = TASK_SINK__SHOW;
pTask->showSink.reserved = 0; pTask->showSink.reserved = 0;
if (!hasExtraSink) { if (!hasExtraSink) {
if (smaId != -1) { #if 1
if (pStream->createdBy == STREAM_CREATED_BY__SMA) {
pTask->sinkType = TASK_SINK__SMA; pTask->sinkType = TASK_SINK__SMA;
pTask->smaSink.smaId = smaId; pTask->smaSink.smaId = pStream->smaId;
} else { } else {
pTask->sinkType = TASK_SINK__TABLE; pTask->sinkType = TASK_SINK__TABLE;
} }
#endif
} }
} else { } else {
pTask->sinkType = TASK_SINK__NONE; pTask->sinkType = TASK_SINK__NONE;
...@@ -286,35 +330,47 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, i ...@@ -286,35 +330,47 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, i
if (hasExtraSink) { if (hasExtraSink) {
// add dispatcher // add dispatcher
pTask->dispatchType = TASK_DISPATCH__SHUFFLE; if (pStream->fixedSinkVgId == 0) {
pTask->dispatchType = TASK_DISPATCH__SHUFFLE;
pTask->dispatchMsgType = TDMT_VND_TASK_WRITE_EXEC;
SDbObj* pDb = mndAcquireDb(pMnode, pStream->db); pTask->dispatchMsgType = TDMT_VND_TASK_WRITE_EXEC;
ASSERT(pDb); SDbObj* pDb = mndAcquireDb(pMnode, pStream->db);
if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) { ASSERT(pDb);
if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) {
sdbRelease(pSdb, pDb);
qDestroyQueryPlan(pPlan);
return -1;
}
sdbRelease(pSdb, pDb); sdbRelease(pSdb, pDb);
qDestroyQueryPlan(pPlan);
return -1; // put taskId to useDbRsp
} // TODO: optimize
sdbRelease(pSdb, pDb); SArray* pVgs = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
int32_t sz = taosArrayGetSize(pVgs);
// put taskId to useDbRsp SArray* sinkLv = taosArrayGetP(pStream->tasks, 0);
// TODO: optimize int32_t sinkLvSize = taosArrayGetSize(sinkLv);
SArray* pVgs = pTask->shuffleDispatcher.dbInfo.pVgroupInfos; for (int32_t i = 0; i < sz; i++) {
int32_t sz = taosArrayGetSize(pVgs); SVgroupInfo* pVgInfo = taosArrayGet(pVgs, i);
SArray* sinkLv = taosArrayGetP(pStream->tasks, 0); for (int32_t j = 0; j < sinkLvSize; j++) {
int32_t sinkLvSize = taosArrayGetSize(sinkLv); SStreamTask* pLastLevelTask = taosArrayGetP(sinkLv, j);
for (int32_t i = 0; i < sz; i++) { /*printf("vgid %d node id %d\n", pVgInfo->vgId, pTask->nodeId);*/
SVgroupInfo* pVgInfo = taosArrayGet(pVgs, i); if (pLastLevelTask->nodeId == pVgInfo->vgId) {
for (int32_t j = 0; j < sinkLvSize; j++) { pVgInfo->taskId = pLastLevelTask->taskId;
SStreamTask* pLastLevelTask = taosArrayGetP(sinkLv, j); /*printf("taskid %d set to %d\n", pVgInfo->taskId, pTask->taskId);*/
/*printf("vgid %d node id %d\n", pVgInfo->vgId, pTask->nodeId);*/ break;
if (pLastLevelTask->nodeId == pVgInfo->vgId) { }
pVgInfo->taskId = pLastLevelTask->taskId;
/*printf("taskid %d set to %d\n", pVgInfo->taskId, pTask->taskId);*/
break;
} }
} }
} else {
pTask->dispatchType = TASK_DISPATCH__FIXED;
pTask->dispatchMsgType = TDMT_VND_TASK_WRITE_EXEC;
SArray* pArray = taosArrayGetP(pStream->tasks, 0);
// one sink only
ASSERT(taosArrayGetSize(pArray) == 1);
SStreamTask* lastLevelTask = taosArrayGetP(pArray, 0);
pTask->fixedEpDispatcher.taskId = lastLevelTask->taskId;
pTask->fixedEpDispatcher.nodeId = lastLevelTask->nodeId;
pTask->fixedEpDispatcher.epSet = lastLevelTask->epSet;
} }
} }
#endif #endif
......
...@@ -415,6 +415,10 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre ...@@ -415,6 +415,10 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre
streamObj.dbUid = pDb->uid; streamObj.dbUid = pDb->uid;
streamObj.version = 1; streamObj.version = 1;
streamObj.sql = pCreate->sql; streamObj.sql = pCreate->sql;
streamObj.createdBy = STREAM_CREATED_BY__SMA;
// TODO
streamObj.fixedSinkVgId = 0;
streamObj.smaId = smaObj.uid;
/*streamObj.physicalPlan = "";*/ /*streamObj.physicalPlan = "";*/
streamObj.logicalPlan = "not implemented"; streamObj.logicalPlan = "not implemented";
...@@ -428,7 +432,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre ...@@ -428,7 +432,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre
if (mndSetCreateSmaRedoLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER; if (mndSetCreateSmaRedoLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER;
if (mndSetCreateSmaCommitLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER; if (mndSetCreateSmaCommitLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER;
if (mndSetCreateSmaRedoActions(pMnode, pTrans, pDb, &smaObj) != 0) goto _OVER; if (mndSetCreateSmaRedoActions(pMnode, pTrans, pDb, &smaObj) != 0) goto _OVER;
if (mndAddStreamToTrans(pMnode, &streamObj, pCreate->ast, pTrans, smaObj.uid) != 0) goto _OVER; if (mndAddStreamToTrans(pMnode, &streamObj, pCreate->ast, pTrans) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = 0; code = 0;
......
...@@ -246,7 +246,7 @@ static int32_t mndStreamGetPlanString(const char *ast, char **pStr) { ...@@ -246,7 +246,7 @@ static int32_t mndStreamGetPlanString(const char *ast, char **pStr) {
return code; return code;
} }
int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast, STrans *pTrans, int64_t smaId) { int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast, STrans *pTrans) {
SNode *pAst = NULL; SNode *pAst = NULL;
if (nodesStringToNode(ast, &pAst) < 0) { if (nodesStringToNode(ast, &pAst) < 0) {
...@@ -271,7 +271,7 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast ...@@ -271,7 +271,7 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
return -1; return -1;
} }
if (mndScheduleStream(pMnode, pTrans, pStream, smaId) < 0) { if (mndScheduleStream(pMnode, pTrans, pStream) < 0) {
mError("stream:%ld, schedule stream since %s", pStream->uid, terrstr()); mError("stream:%ld, schedule stream since %s", pStream->uid, terrstr());
return -1; return -1;
} }
...@@ -300,6 +300,10 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe ...@@ -300,6 +300,10 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
streamObj.dbUid = pDb->uid; streamObj.dbUid = pDb->uid;
streamObj.version = 1; streamObj.version = 1;
streamObj.sql = pCreate->sql; streamObj.sql = pCreate->sql;
streamObj.createdBy = STREAM_CREATED_BY__USER;
// TODO
streamObj.fixedSinkVgId = 0;
streamObj.smaId = 0;
/*streamObj.physicalPlan = "";*/ /*streamObj.physicalPlan = "";*/
streamObj.logicalPlan = "not implemented"; streamObj.logicalPlan = "not implemented";
...@@ -310,7 +314,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe ...@@ -310,7 +314,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
} }
mDebug("trans:%d, used to create stream:%s", pTrans->id, pCreate->name); mDebug("trans:%d, used to create stream:%s", pTrans->id, pCreate->name);
if (mndAddStreamToTrans(pMnode, &streamObj, pCreate->ast, pTrans, -1) != 0) { if (mndAddStreamToTrans(pMnode, &streamObj, pCreate->ast, pTrans) != 0) {
mError("trans:%d, failed to add stream since %s", pTrans->id, terrstr()); mError("trans:%d, failed to add stream since %s", pTrans->id, terrstr());
mndTransDrop(pTrans); mndTransDrop(pTrans);
return -1; return -1;
......
...@@ -62,8 +62,6 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT ...@@ -62,8 +62,6 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT
static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp); static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp);
static int32_t mndInitUnassignedVg(SMnode *pMnode, const SMqTopicObj *pTopic, SMqSubscribeObj *pSub);
int32_t mndInitSubscribe(SMnode *pMnode) { int32_t mndInitSubscribe(SMnode *pMnode) {
SSdbTable table = {.sdbType = SDB_SUBSCRIBE, SSdbTable table = {.sdbType = SDB_SUBSCRIBE,
.keyType = SDB_KEY_BINARY, .keyType = SDB_KEY_BINARY,
...@@ -98,14 +96,6 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj ...@@ -98,14 +96,6 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj
return NULL; return NULL;
} }
#if 0
if (mndInitUnassignedVg(pMnode, pTopic, pSub) < 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
tDeleteSMqSubscribeObj(pSub);
taosMemoryFree(pSub);
return NULL;
}
#endif
// TODO: disable alter subscribed table // TODO: disable alter subscribed table
return pSub; return pSub;
} }
...@@ -210,45 +200,6 @@ static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMq ...@@ -210,45 +200,6 @@ static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMq
return 0; return 0;
} }
#if 0
static int32_t mndProcessResetOffsetReq(SNodeMsg *pMsg) {
SMnode *pMnode = pMsg->pNode;
uint8_t *str = pMsg->rpcMsg.pCont;
SMqCMResetOffsetReq req;
SCoder decoder;
tCoderInit(&decoder, TD_LITTLE_ENDIAN, str, pMsg->rpcMsg.contLen, TD_DECODER);
tDecodeSMqCMResetOffsetReq(&decoder, &req);
SHashObj *pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (pHash == NULL) {
return -1;
}
for (int32_t i = 0; i < req.num; i++) {
SMqOffset *pOffset = &req.offsets[i];
SMqVgOffsets *pVgOffset = taosHashGet(pHash, &pOffset->vgId, sizeof(int32_t));
if (pVgOffset == NULL) {
pVgOffset = taosMemoryMalloc(sizeof(SMqVgOffsets));
if (pVgOffset == NULL) {
return -1;
}
pVgOffset->offsets = taosArrayInit(0, sizeof(void *));
taosArrayPush(pVgOffset->offsets, &pOffset);
}
taosHashPut(pHash, &pOffset->vgId, sizeof(int32_t), &pVgOffset, sizeof(void *));
}
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pMsg->rpcMsg);
if (pTrans == NULL) {
mError("mq-reset-offset: failed since %s", terrstr());
return -1;
}
return 0;
}
#endif
static int32_t mndProcessGetSubEpReq(SNodeMsg *pMsg) { static int32_t mndProcessGetSubEpReq(SNodeMsg *pMsg) {
SMnode *pMnode = pMsg->pNode; SMnode *pMnode = pMsg->pNode;
SMqCMGetSubEpReq *pReq = (SMqCMGetSubEpReq *)pMsg->rpcMsg.pCont; SMqCMGetSubEpReq *pReq = (SMqCMGetSubEpReq *)pMsg->rpcMsg.pCont;
...@@ -574,251 +525,6 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { ...@@ -574,251 +525,6 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) {
return 0; return 0;
} }
#if 0
for (int32_t j = 0; j < consumerNum; j++) {
bool changed = false;
bool unfished = false;
bool canUseLeft = imbalanceSolved < imbalanceVg;
bool mustUseLeft = canUseLeft && (imbalanceVg - imbalanceSolved >= consumerNum - j);
ASSERT(imbalanceVg - imbalanceSolved <= consumerNum - j);
int32_t maxVg = vgEachConsumer + canUseLeft;
int32_t minVg = vgEachConsumer + mustUseLeft;
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, j);
int32_t vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo);
int32_t vgThisConsumerAfterRb;
if (vgThisConsumerBeforeRb > maxVg) {
vgThisConsumerAfterRb = maxVg;
imbalanceSolved++;
changed = true;
} else if (vgThisConsumerBeforeRb < minVg) {
vgThisConsumerAfterRb = minVg;
if (mustUseLeft) imbalanceSolved++;
changed = true;
} else {
vgThisConsumerAfterRb = vgThisConsumerBeforeRb;
}
if (vgThisConsumerBeforeRb > vgThisConsumerAfterRb) {
while (taosArrayGetSize(pSubConsumer->vgInfo) > vgThisConsumerAfterRb) {
// put into unassigned
SMqConsumerEp *pConsumerEp = taosArrayPop(pSubConsumer->vgInfo);
ASSERT(pConsumerEp != NULL);
ASSERT(pConsumerEp->consumerId == pSubConsumer->consumerId);
taosArrayPush(unassignedVgStash, pConsumerEp);
}
} else if (vgThisConsumerBeforeRb < vgThisConsumerAfterRb) {
// assign from unassigned
while (taosArrayGetSize(pSubConsumer->vgInfo) < vgThisConsumerAfterRb) {
// if no unassgined, save j
if (taosArrayGetSize(unassignedVgStash) == 0) {
taosArrayPush(unassignedConsumerIdx, &j);
unfished = true;
break;
}
// assign vg to consumer
SMqConsumerEp *pConsumerEp = taosArrayPop(unassignedVgStash);
ASSERT(pConsumerEp != NULL);
pConsumerEp->oldConsumerId = pConsumerEp->consumerId;
pConsumerEp->consumerId = pSubConsumer->consumerId;
taosArrayPush(pSubConsumer->vgInfo, pConsumerEp);
// build msg and persist into trans
}
}
if (changed && !unfished) {
SMqConsumerObj *pRebConsumer = mndAcquireConsumer(pMnode, pSubConsumer->consumerId);
pRebConsumer->epoch++;
if (vgThisConsumerAfterRb != 0) {
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE);
} else {
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__IDLE);
}
SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pRebConsumer);
sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY);
mndTransAppendRedolog(pTrans, pConsumerRaw);
mndReleaseConsumer(pMnode, pRebConsumer);
// TODO: save history
}
}
for (int32_t j = 0; j < taosArrayGetSize(unassignedConsumerIdx); j++) {
bool canUseLeft = imbalanceSolved < imbalanceVg;
int32_t consumerIdx = *(int32_t *)taosArrayGet(unassignedConsumerIdx, j);
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, consumerIdx);
if (canUseLeft) imbalanceSolved++;
// must use
int32_t vgThisConsumerAfterRb = taosArrayGetSize(pSubConsumer->vgInfo) + canUseLeft;
while (taosArrayGetSize(pSubConsumer->vgInfo) < vgEachConsumer + canUseLeft) {
// assign vg to consumer
SMqConsumerEp *pConsumerEp = taosArrayPop(unassignedVgStash);
ASSERT(pConsumerEp != NULL);
pConsumerEp->oldConsumerId = pConsumerEp->consumerId;
pConsumerEp->consumerId = pSubConsumer->consumerId;
taosArrayPush(pSubConsumer->vgInfo, pConsumerEp);
// build msg and persist into trans
}
SMqConsumerObj *pRebConsumer = mndAcquireConsumer(pMnode, pSubConsumer->consumerId);
pRebConsumer->epoch++;
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE);
SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pRebConsumer);
sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY);
mndTransAppendRedolog(pTrans, pConsumerRaw);
mndReleaseConsumer(pMnode, pRebConsumer);
// TODO: save history
}
#endif
#if 0
//update consumer status for the subscribption
for (int32_t i = 0; i < taosArrayGetSize(pSub->assigned); i++) {
SMqConsumerEp *pCEp = taosArrayGet(pSub->assigned, i);
int64_t consumerId = pCEp->consumerId;
if (pCEp->status != -1) {
int32_t consumerHbStatus = atomic_fetch_add_32(&pCEp->consumerHbStatus, 1);
if (consumerHbStatus < MND_SUBSCRIBE_REBALANCE_CNT) {
continue;
}
// put consumer into lostConsumer
SMqConsumerEp* lostConsumer = taosArrayPush(pSub->lostConsumer, pCEp);
lostConsumer->qmsg = NULL;
// put vg into unassigned
taosArrayPush(pSub->unassignedVg, pCEp);
// remove from assigned
// TODO: swap with last one, reduce size and reset i
taosArrayRemove(pSub->assigned, i);
// remove from available consumer
for (int32_t j = 0; j < taosArrayGetSize(pSub->availConsumer); j++) {
if (*(int64_t *)taosArrayGet(pSub->availConsumer, i) == pCEp->consumerId) {
taosArrayRemove(pSub->availConsumer, j);
break;
}
// TODO: acquire consumer, set status to unavail
}
#if 0
SMqConsumerObj* pConsumer = mndAcquireConsumer(pMnode, consumerId);
pConsumer->epoch++;
printf("current epoch %ld size %ld", pConsumer->epoch, pConsumer->topics->size);
SSdbRaw* pRaw = mndConsumerActionEncode(pConsumer);
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
sdbWriteNotFree(pMnode->pSdb, pRaw);
mndReleaseConsumer(pMnode, pConsumer);
#endif
}
}
// no available consumer, skip rebalance
if (taosArrayGetSize(pSub->availConsumer) == 0) {
continue;
}
taosArrayGet(pSub->availConsumer, 0);
// rebalance condition1 : have unassigned vg
// assign vg to a consumer, trying to find the least assigned one
if ((sz = taosArrayGetSize(pSub->unassignedVg)) > 0) {
char *topic = NULL;
char *cgroup = NULL;
mndSplitSubscribeKey(pSub->key, &topic, &cgroup);
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pMsg->rpcMsg);
for (int32_t i = 0; i < sz; i++) {
int64_t consumerId = *(int64_t *)taosArrayGet(pSub->availConsumer, pSub->nextConsumerIdx);
pSub->nextConsumerIdx = (pSub->nextConsumerIdx + 1) % taosArrayGetSize(pSub->availConsumer);
SMqConsumerEp *pCEp = taosArrayPop(pSub->unassignedVg);
pCEp->oldConsumerId = pCEp->consumerId;
pCEp->consumerId = consumerId;
taosArrayPush(pSub->assigned, pCEp);
SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, consumerId);
pConsumer->epoch++;
SSdbRaw* pConsumerRaw = mndConsumerActionEncode(pConsumer);
sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY);
sdbWrite(pMnode->pSdb, pConsumerRaw);
mndReleaseConsumer(pMnode, pConsumer);
void* msg;
int32_t msgLen;
mndBuildRebalanceMsg(&msg, &msgLen, pTopic, pCEp, cgroup, topic);
// persist msg
STransAction action = {0};
action.epSet = pCEp->epSet;
action.pCont = msg;
action.contLen = sizeof(SMsgHead) + msgLen;
action.msgType = TDMT_VND_MQ_SET_CONN;
mndTransAppendRedoAction(pTrans, &action);
// persist data
SSdbRaw *pRaw = mndSubActionEncode(pSub);
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
mndTransAppendRedolog(pTrans, pRaw);
}
if (mndTransPrepare(pMnode, pTrans) != 0) {
mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
}
mndReleaseTopic(pMnode, pTopic);
mndTransDrop(pTrans);
taosMemoryFreeClear(topic);
taosMemoryFreeClear(cgroup);
}
// rebalance condition2 : imbalance assignment
}
return 0;
}
#endif
#if 0
static int32_t mndInitUnassignedVg(SMnode *pMnode, const SMqTopicObj *pTopic, SMqSubscribeObj *pSub) {
SSdb *pSdb = pMnode->pSdb;
SVgObj *pVgroup = NULL;
SQueryPlan *pPlan = qStringToQueryPlan(pTopic->physicalPlan);
SArray *pArray = NULL;
SNodeListNode *inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0);
SSubplan *plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0);
SArray *unassignedVg = pSub->unassignedVg;
void *pIter = NULL;
while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
if (pIter == NULL) break;
if (pVgroup->dbUid != pTopic->dbUid) {
sdbRelease(pSdb, pVgroup);
continue;
}
pSub->vgNum++;
plan->execNode.nodeId = pVgroup->vgId;
plan->execNode.epset = mndGetVgroupEpset(pMnode, pVgroup);
if (schedulerConvertDagToTaskList(pPlan, &pArray) < 0) {
terrno = TSDB_CODE_MND_UNSUPPORTED_TOPIC;
mError("unsupport topic: %s, sql: %s", pTopic->name, pTopic->sql);
return -1;
}
SMqConsumerEp consumerEp = {0};
consumerEp.status = 0;
consumerEp.consumerId = -1;
STaskInfo *pTaskInfo = taosArrayGet(pArray, 0);
consumerEp.epSet = pTaskInfo->addr.epset;
consumerEp.vgId = pTaskInfo->addr.nodeId;
ASSERT(consumerEp.vgId == pVgroup->vgId);
consumerEp.qmsg = strdup(pTaskInfo->msg->msg);
taosArrayPush(unassignedVg, &consumerEp);
// TODO: free taskInfo
taosArrayDestroy(pArray);
}
/*qDestroyQueryDag(pDag);*/
return 0;
}
#endif
static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqTopicObj *pTopic, const char *cgroup, static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqTopicObj *pTopic, const char *cgroup,
const SMqConsumerEp *pConsumerEp) { const SMqConsumerEp *pConsumerEp) {
ASSERT(pConsumerEp->oldConsumerId == -1); ASSERT(pConsumerEp->oldConsumerId == -1);
...@@ -1140,7 +846,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) { ...@@ -1140,7 +846,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) {
} }
} }
if (oldSub) taosArrayDestroyEx(oldSub, (void (*)(void*))taosMemoryFree); if (oldSub) taosArrayDestroyEx(oldSub, (void (*)(void *))taosMemoryFree);
// persist consumerObj // persist consumerObj
SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pConsumer); SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pConsumer);
......
...@@ -65,9 +65,11 @@ void mndCleanupTopic(SMnode *pMnode) {} ...@@ -65,9 +65,11 @@ void mndCleanupTopic(SMnode *pMnode) {}
SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) { SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
int32_t logicalPlanLen = strlen(pTopic->logicalPlan) + 1; int32_t logicalPlanLen = strlen(pTopic->logicalPlan) + 1;
int32_t physicalPlanLen = strlen(pTopic->physicalPlan) + 1; int32_t physicalPlanLen = strlen(pTopic->physicalPlan) + 1;
int32_t size = sizeof(SMqTopicObj) + logicalPlanLen + physicalPlanLen + pTopic->sqlLen + MND_TOPIC_RESERVE_SIZE; int32_t swLen = taosEncodeSSchemaWrapper(NULL, &pTopic->schema);
int32_t size =
sizeof(SMqTopicObj) + logicalPlanLen + physicalPlanLen + pTopic->sqlLen + swLen + MND_TOPIC_RESERVE_SIZE;
SSdbRaw *pRaw = sdbAllocRaw(SDB_TOPIC, MND_TOPIC_VER_NUMBER, size); SSdbRaw *pRaw = sdbAllocRaw(SDB_TOPIC, MND_TOPIC_VER_NUMBER, size);
if (pRaw == NULL) goto TOPIC_ENCODE_OVER; if (pRaw == NULL) goto TOPIC_ENCODE_OVER;
...@@ -86,8 +88,7 @@ SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) { ...@@ -86,8 +88,7 @@ SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
SDB_SET_INT32(pRaw, dataPos, physicalPlanLen, TOPIC_ENCODE_OVER); SDB_SET_INT32(pRaw, dataPos, physicalPlanLen, TOPIC_ENCODE_OVER);
SDB_SET_BINARY(pRaw, dataPos, pTopic->physicalPlan, physicalPlanLen, TOPIC_ENCODE_OVER); SDB_SET_BINARY(pRaw, dataPos, pTopic->physicalPlan, physicalPlanLen, TOPIC_ENCODE_OVER);
int32_t swLen = taosEncodeSSchemaWrapper(NULL, &pTopic->schema); void *swBuf = taosMemoryMalloc(swLen);
void *swBuf = taosMemoryMalloc(swLen);
if (swBuf == NULL) { if (swBuf == NULL) {
goto TOPIC_ENCODE_OVER; goto TOPIC_ENCODE_OVER;
} }
......
...@@ -54,7 +54,7 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans); ...@@ -54,7 +54,7 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans); static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
static void mndTransExecute(SMnode *pMnode, STrans *pTrans); static void mndTransExecute(SMnode *pMnode, STrans *pTrans);
static void mndTransSendRpcRsp(STrans *pTrans); static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans);
static int32_t mndProcessTransReq(SNodeMsg *pReq); static int32_t mndProcessTransReq(SNodeMsg *pReq);
static int32_t mndProcessKillTransReq(SNodeMsg *pReq); static int32_t mndProcessKillTransReq(SNodeMsg *pReq);
...@@ -737,7 +737,7 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) { ...@@ -737,7 +737,7 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) {
return 0; return 0;
} }
static void mndTransSendRpcRsp(STrans *pTrans) { static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
bool sendRsp = false; bool sendRsp = false;
if (pTrans->stage == TRN_STAGE_FINISHED) { if (pTrans->stage == TRN_STAGE_FINISHED) {
...@@ -771,7 +771,7 @@ static void mndTransSendRpcRsp(STrans *pTrans) { ...@@ -771,7 +771,7 @@ static void mndTransSendRpcRsp(STrans *pTrans) {
.ahandle = pTrans->rpcAHandle, .ahandle = pTrans->rpcAHandle,
.pCont = rpcCont, .pCont = rpcCont,
.contLen = pTrans->rpcRspLen}; .contLen = pTrans->rpcRspLen};
rpcSendResponse(&rspMsg); tmsgSendRsp(&pMnode->msgCb, &rspMsg);
pTrans->rpcHandle = NULL; pTrans->rpcHandle = NULL;
pTrans->rpcRsp = NULL; pTrans->rpcRsp = NULL;
pTrans->rpcRspLen = 0; pTrans->rpcRspLen = 0;
...@@ -1158,7 +1158,7 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) { ...@@ -1158,7 +1158,7 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
} }
} }
mndTransSendRpcRsp(pTrans); mndTransSendRpcRsp(pMnode, pTrans);
} }
static int32_t mndProcessTransReq(SNodeMsg *pReq) { static int32_t mndProcessTransReq(SNodeMsg *pReq) {
......
...@@ -275,6 +275,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { ...@@ -275,6 +275,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
pMsg->pCont = NULL; pMsg->pCont = NULL;
pMsg->contLen = 0; pMsg->contLen = 0;
pMsg->code = -1; pMsg->code = -1;
ASSERT(0);
rpcSendResponse(pMsg); rpcSendResponse(pMsg);
return 0; return 0;
} }
...@@ -356,6 +357,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { ...@@ -356,6 +357,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
void* buf = rpcMallocCont(tlen); void* buf = rpcMallocCont(tlen);
if (buf == NULL) { if (buf == NULL) {
pMsg->code = -1; pMsg->code = -1;
ASSERT(0);
return -1; return -1;
} }
((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP; ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP;
......
...@@ -114,10 +114,9 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { ...@@ -114,10 +114,9 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
SSchemaWrapper* pSchemaWrapper = pHandle->pSchemaWrapper; SSchemaWrapper* pSchemaWrapper = pHandle->pSchemaWrapper;
int32_t numOfRows = pHandle->pBlock->numOfRows; int32_t numOfRows = pHandle->pBlock->numOfRows;
int32_t numOfCols = pHandle->pSchema->numOfCols; /*int32_t numOfCols = pHandle->pSchema->numOfCols;*/
int32_t colNumNeed = taosArrayGetSize(pHandle->pColIdList); int32_t colNumNeed = taosArrayGetSize(pHandle->pColIdList);
// TODO: stable case
if (colNumNeed > pSchemaWrapper->nCols) { if (colNumNeed > pSchemaWrapper->nCols) {
colNumNeed = pSchemaWrapper->nCols; colNumNeed = pSchemaWrapper->nCols;
} }
...@@ -138,56 +137,24 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { ...@@ -138,56 +137,24 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
colNeed++; colNeed++;
} else { } else {
SColumnInfoData colInfo = {0}; SColumnInfoData colInfo = {0};
int sz = numOfRows * pColSchema->bytes; /*int sz = numOfRows * pColSchema->bytes;*/
colInfo.info.bytes = pColSchema->bytes; colInfo.info.bytes = pColSchema->bytes;
colInfo.info.colId = pColSchema->colId; colInfo.info.colId = pColSchema->colId;
colInfo.info.type = pColSchema->type; colInfo.info.type = pColSchema->type;
colInfo.pData = taosMemoryCalloc(1, sz); if (blockDataEnsureColumnCapacity(&colInfo, numOfRows) < 0) {
if (colInfo.pData == NULL) { taosArrayDestroyEx(pArray, (void (*)(void*))tDeleteSSDataBlock);
// TODO free
taosArrayDestroy(pArray);
return NULL; return NULL;
} }
blockDataEnsureColumnCapacity(&colInfo, numOfRows);
taosArrayPush(pArray, &colInfo); taosArrayPush(pArray, &colInfo);
colMeta++; colMeta++;
colNeed++; colNeed++;
} }
} }
int j = 0;
for (int32_t i = 0; i < colNumNeed; i++) {
col_id_t colId = *(col_id_t*)taosArrayGet(pHandle->pColIdList, i);
while (j < pSchemaWrapper->nCols && pSchemaWrapper->pSchema[j].colId < colId) {
j++;
}
if (j >= pSchemaWrapper->nCols) {
continue;
}
SSchema* pColSchema = &pSchemaWrapper->pSchema[j];
SColumnInfoData colInfo = {0};
int sz = numOfRows * pColSchema->bytes;
colInfo.info.bytes = pColSchema->bytes;
colInfo.info.colId = colId;
colInfo.info.type = pColSchema->type;
colInfo.pData = taosMemoryCalloc(1, sz);
if (colInfo.pData == NULL) {
// TODO free
taosArrayDestroy(pArray);
return NULL;
}
blockDataEnsureColumnCapacity(&colInfo, numOfRows);
taosArrayPush(pArray, &colInfo);
}
STSRowIter iter = {0}; STSRowIter iter = {0};
tdSTSRowIterInit(&iter, pTschema); tdSTSRowIterInit(&iter, pTschema);
STSRow* row; STSRow* row;
// int32_t kvIdx = 0;
int32_t curRow = 0; int32_t curRow = 0;
tInitSubmitBlkIter(pHandle->pBlock, &pHandle->blkIter); tInitSubmitBlkIter(pHandle->pBlock, &pHandle->blkIter);
while ((row = tGetSubmitBlkNext(&pHandle->blkIter)) != NULL) { while ((row = tGetSubmitBlkNext(&pHandle->blkIter)) != NULL) {
...@@ -200,25 +167,9 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { ...@@ -200,25 +167,9 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
if (!tdSTSRowIterNext(&iter, pColData->info.colId, pColData->info.type, &sVal)) { if (!tdSTSRowIterNext(&iter, pColData->info.colId, pColData->info.type, &sVal)) {
break; break;
} }
memcpy(POINTER_SHIFT(pColData->pData, curRow * pColData->info.bytes), sVal.val, pColData->info.bytes); // TODO handle null
} colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL);
#if 0
for (int32_t i = 0; i < colNumNeed; i++) {
SColumnInfoData* pColData = taosArrayGet(pArray, i);
STColumn* pCol = schemaColAt(pTschema, i);
// TODO
if(pCol->colId != pColData->info.colId) {
continue;
}
// void* val = tdGetMemRowDataOfColEx(row, pCol->colId, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset, &kvIdx);
SCellVal sVal = {0};
if (!tdSTSRowIterNext(&iter, pCol->colId, pCol->type, &sVal)) {
// TODO: reach end
break;
}
memcpy(POINTER_SHIFT(pColData->pData, curRow * pCol->bytes), sVal.val, pCol->bytes);
} }
#endif
curRow++; curRow++;
} }
return pArray; return pArray;
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
*/ */
#include "executor.h" #include "executor.h"
#include "tdatablock.h"
#include "executorimpl.h" #include "executorimpl.h"
#include "planner.h" #include "planner.h"
#include "tdatablock.h"
#include "vnode.h" #include "vnode.h"
static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void** input, size_t numOfBlocks, int32_t type, char* id) { static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) {
ASSERT(pOperator != NULL); ASSERT(pOperator != NULL);
if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
if (pOperator->numOfDownstream == 0) { if (pOperator->numOfDownstream == 0) {
...@@ -44,17 +44,18 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void** input, size_t n ...@@ -44,17 +44,18 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void** input, size_t n
} }
if (type == STREAM_DATA_TYPE_SUBMIT_BLOCK) { if (type == STREAM_DATA_TYPE_SUBMIT_BLOCK) {
if (tqReadHandleSetMsg(pInfo->readerHandle, input[0], 0) < 0) { if (tqReadHandleSetMsg(pInfo->readerHandle, input, 0) < 0) {
qError("submit msg messed up when initing stream block, %s" PRIx64, id); qError("submit msg messed up when initing stream block, %s" PRIx64, id);
return TSDB_CODE_QRY_APP_ERROR; return TSDB_CODE_QRY_APP_ERROR;
} }
} else { } else {
for (int32_t i = 0; i < numOfBlocks; ++i) { for (int32_t i = 0; i < numOfBlocks; ++i) {
SSDataBlock* pDataBlock = input[i]; SSDataBlock* pDataBlock = &((SSDataBlock*)input)[i];
SSDataBlock* p = createOneDataBlock(pDataBlock); SSDataBlock* p = createOneDataBlock(pDataBlock);
p->info = pDataBlock->info; p->info = pDataBlock->info;
taosArrayClear(p->pDataBlock);
taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock); taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock);
taosArrayPush(pInfo->pBlockLists, &p); taosArrayPush(pInfo->pBlockLists, &p);
} }
...@@ -65,10 +66,10 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void** input, size_t n ...@@ -65,10 +66,10 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void** input, size_t n
} }
int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type) { int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type) {
qSetMultiStreamInput(tinfo, (void**) &input, 1, type); return qSetMultiStreamInput(tinfo, input, 1, type);
} }
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, void** pBlocks, size_t numOfBlocks, int32_t type) { int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) {
if (tinfo == NULL) { if (tinfo == NULL) {
return TSDB_CODE_QRY_APP_ERROR; return TSDB_CODE_QRY_APP_ERROR;
} }
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -21,9 +21,9 @@ extern "C" { ...@@ -21,9 +21,9 @@ extern "C" {
#endif #endif
#include "indexInt.h" #include "indexInt.h"
#include "index_fst_node.h"
#include "index_fst_automation.h" #include "index_fst_automation.h"
#include "index_fst_counting_writer.h" #include "index_fst_counting_writer.h"
#include "index_fst_node.h"
#include "index_fst_registry.h" #include "index_fst_registry.h"
#include "index_fst_util.h" #include "index_fst_util.h"
...@@ -257,9 +257,9 @@ typedef struct FstMeta { ...@@ -257,9 +257,9 @@ typedef struct FstMeta {
} FstMeta; } FstMeta;
typedef struct Fst { typedef struct Fst {
FstMeta* meta; FstMeta* meta;
FstSlice* data; // FstSlice* data; //
FstNode* root; // FstNode* root; //
TdThreadMutex mtx; TdThreadMutex mtx;
} Fst; } Fst;
...@@ -325,10 +325,10 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb ...@@ -325,10 +325,10 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
FstStreamBuilder* fstStreamBuilderCreate(Fst* fst, AutomationCtx* aut); FstStreamBuilder* fstStreamBuilderCreate(Fst* fst, AutomationCtx* aut);
void fstStreamBuilderDestroy(FstStreamBuilder* b); void fstStreamBuilderDestroy(FstStreamBuilder* b);
// set up bound range
// refator, simple code by marco
FstStreamBuilder* fstStreamBuilderRange(FstStreamBuilder* b, FstSlice* val, RangeType type); // set up bound range
// refator later: to simple code by marco
void fstStreamBuilderSetRange(FstStreamBuilder* b, FstSlice* val, RangeType type);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -1184,7 +1184,7 @@ StreamWithState* streamWithStateCreate(Fst* fst, AutomationCtx* automation, FstB ...@@ -1184,7 +1184,7 @@ StreamWithState* streamWithStateCreate(Fst* fst, AutomationCtx* automation, FstB
sws->aut = automation; sws->aut = automation;
sws->inp = (SArray*)taosArrayInit(256, sizeof(uint8_t)); sws->inp = (SArray*)taosArrayInit(256, sizeof(uint8_t));
sws->emptyOutput.null = false; sws->emptyOutput.null = true;
sws->emptyOutput.out = 0; sws->emptyOutput.out = 0;
sws->stack = (SArray*)taosArrayInit(256, sizeof(StreamState)); sws->stack = (SArray*)taosArrayInit(256, sizeof(StreamState));
...@@ -1239,8 +1239,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) { ...@@ -1239,8 +1239,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
for (uint32_t i = 0; i < len; i++) { for (uint32_t i = 0; i < len; i++) {
uint8_t b = data[i]; uint8_t b = data[i];
uint64_t res = 0; uint64_t res = 0;
bool null = fstNodeFindInput(node, b, &res); bool find = fstNodeFindInput(node, b, &res);
if (null == false) { if (find == true) {
FstTransition trn; FstTransition trn;
fstNodeGetTransitionAt(node, res, &trn); fstNodeGetTransitionAt(node, res, &trn);
void* preState = autState; void* preState = autState;
...@@ -1293,7 +1293,6 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) { ...@@ -1293,7 +1293,6 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
return false; return false;
} }
StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallback callback) { StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallback callback) {
AutomationCtx* aut = sws->aut; AutomationCtx* aut = sws->aut;
FstOutput output = sws->emptyOutput; FstOutput output = sws->emptyOutput;
...@@ -1356,6 +1355,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb ...@@ -1356,6 +1355,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
sws->stack = (SArray*)taosArrayInit(256, sizeof(StreamState)); sws->stack = (SArray*)taosArrayInit(256, sizeof(StreamState));
taosMemoryFreeClear(buf); taosMemoryFreeClear(buf);
fstSliceDestroy(&slice); fstSliceDestroy(&slice);
taosArrayDestroy(nodes);
return NULL; return NULL;
} }
if (FST_NODE_IS_FINAL(nextNode) && isMatch) { if (FST_NODE_IS_FINAL(nextNode) && isMatch) {
...@@ -1364,15 +1364,12 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb ...@@ -1364,15 +1364,12 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
taosMemoryFreeClear(buf); taosMemoryFreeClear(buf);
fstSliceDestroy(&slice); fstSliceDestroy(&slice);
taosArrayDestroy(nodes); taosArrayDestroy(nodes);
nodes = NULL;
return result; return result;
} }
taosMemoryFreeClear(buf); taosMemoryFreeClear(buf);
fstSliceDestroy(&slice); fstSliceDestroy(&slice);
} };
for (size_t i = 0; i < taosArrayGetSize(nodes); i++) {
FstNode** node = (FstNode**)taosArrayGet(nodes, i);
fstNodeDestroy(*node);
}
taosArrayDestroy(nodes); taosArrayDestroy(nodes);
return NULL; return NULL;
} }
...@@ -1425,9 +1422,9 @@ void fstStreamBuilderDestroy(FstStreamBuilder* b) { ...@@ -1425,9 +1422,9 @@ void fstStreamBuilderDestroy(FstStreamBuilder* b) {
taosMemoryFreeClear(b->max); taosMemoryFreeClear(b->max);
taosMemoryFree(b); taosMemoryFree(b);
} }
FstStreamBuilder* fstStreamBuilderRange(FstStreamBuilder* b, FstSlice* val, RangeType type) { void fstStreamBuilderSetRange(FstStreamBuilder* b, FstSlice* val, RangeType type) {
if (b == NULL) { if (b == NULL) {
return NULL; return;
} }
if (type == GE) { if (type == GE) {
b->min->type = Included; b->min->type = Included;
...@@ -1446,5 +1443,4 @@ FstStreamBuilder* fstStreamBuilderRange(FstStreamBuilder* b, FstSlice* val, Rang ...@@ -1446,5 +1443,4 @@ FstStreamBuilder* fstStreamBuilderRange(FstStreamBuilder* b, FstSlice* val, Rang
fstSliceDestroy(&(b->max->data)); fstSliceDestroy(&(b->max->data));
b->max->data = fstSliceDeepCopy(val, 0, FST_SLICE_LEN(val) - 1); b->max->data = fstSliceDeepCopy(val, 0, FST_SLICE_LEN(val) - 1);
} }
return b;
} }
...@@ -85,10 +85,20 @@ static void* prefixStart(AutomationCtx* ctx) { ...@@ -85,10 +85,20 @@ static void* prefixStart(AutomationCtx* ctx) {
}; };
static bool prefixIsMatch(AutomationCtx* ctx, void* sv) { static bool prefixIsMatch(AutomationCtx* ctx, void* sv) {
StartWithStateValue* ssv = (StartWithStateValue*)sv; StartWithStateValue* ssv = (StartWithStateValue*)sv;
return ssv->val == strlen(ctx->data); if (ssv == NULL) {
return false;
}
if (ssv->type == FST_INT) {
return ssv->val == strlen(ctx->data);
} else {
return false;
}
} }
static bool prefixCanMatch(AutomationCtx* ctx, void* sv) { static bool prefixCanMatch(AutomationCtx* ctx, void* sv) {
StartWithStateValue* ssv = (StartWithStateValue*)sv; StartWithStateValue* ssv = (StartWithStateValue*)sv;
if (ssv == NULL) {
return false;
}
return ssv->val >= 0; return ssv->val >= 0;
} }
static bool prefixWillAlwaysMatch(AutomationCtx* ctx, void* state) { return true; } static bool prefixWillAlwaysMatch(AutomationCtx* ctx, void* state) { return true; }
...@@ -154,15 +164,7 @@ AutomationCtx* automCtxCreate(void* data, AutomationType atype) { ...@@ -154,15 +164,7 @@ AutomationCtx* automCtxCreate(void* data, AutomationType atype) {
// add more search type // add more search type
} }
char* dst = NULL; ctx->data = (data != NULL ? strdup((char*)data) : NULL);
if (data != NULL) {
char* src = (char*)data;
size_t len = strlen(src);
dst = (char*)taosMemoryCalloc(1, len * sizeof(char) + 1);
memcpy(dst, src, len);
}
ctx->data = dst;
ctx->type = atype; ctx->type = atype;
ctx->stdata = (void*)sv; ctx->stdata = (void*)sv;
return ctx; return ctx;
......
...@@ -96,11 +96,41 @@ class FstReadMemory { ...@@ -96,11 +96,41 @@ class FstReadMemory {
char* ch = (char*)fstSliceData(s, &sz); char* ch = (char*)fstSliceData(s, &sz);
std::string key(ch, sz); std::string key(ch, sz);
printf("key: %s, val: %" PRIu64 "\n", key.c_str(), (uint64_t)(rt->out.out)); printf("key: %s, val: %" PRIu64 "\n", key.c_str(), (uint64_t)(rt->out.out));
result.push_back(rt->out.out);
swsResultDestroy(rt); swsResultDestroy(rt);
} }
for (size_t i = 0; i < result.size(); i++) { streamWithStateDestroy(st);
fstStreamBuilderDestroy(sb);
return true;
}
bool SearchRange(AutomationCtx* ctx, const std::string& low, RangeType lowType, const std::string& high,
RangeType highType, std::vector<uint64_t>& result) {
FstStreamBuilder* sb = fstSearch(_fst, ctx);
FstSlice l = fstSliceCreate((uint8_t*)low.c_str(), low.size());
FstSlice h = fstSliceCreate((uint8_t*)high.c_str(), high.size());
// range [low, high);
fstStreamBuilderSetRange(sb, &l, lowType);
fstStreamBuilderSetRange(sb, &h, highType);
fstSliceDestroy(&l);
fstSliceDestroy(&h);
StreamWithState* st = streamBuilderIntoStream(sb);
StreamWithStateResult* rt = NULL;
while ((rt = streamWithStateNextWith(st, NULL)) != NULL) {
// result.push_back((uint64_t)(rt->out.out));
FstSlice* s = &rt->data;
int32_t sz = 0;
char* ch = (char*)fstSliceData(s, &sz);
std::string key(ch, sz);
printf("key: %s, val: %" PRIu64 "\n", key.c_str(), (uint64_t)(rt->out.out));
result.push_back(rt->out.out);
swsResultDestroy(rt);
} }
std::cout << std::endl; streamWithStateDestroy(st);
fstStreamBuilderDestroy(sb);
return true; return true;
} }
bool SearchWithTimeCostUs(AutomationCtx* ctx, std::vector<uint64_t>& result) { bool SearchWithTimeCostUs(AutomationCtx* ctx, std::vector<uint64_t>& result) {
...@@ -233,7 +263,7 @@ void checkFstLongTerm() { ...@@ -233,7 +263,7 @@ void checkFstLongTerm() {
// taosMemoryFree(ctx); // taosMemoryFree(ctx);
// delete m; // delete m;
} }
void checkFstCheckIterator() { void checkFstCheckIterator1() {
FstWriter* fw = new FstWriter; FstWriter* fw = new FstWriter;
int64_t s = taosGetTimestampUs(); int64_t s = taosGetTimestampUs();
int count = 2; int count = 2;
...@@ -243,8 +273,7 @@ void checkFstCheckIterator() { ...@@ -243,8 +273,7 @@ void checkFstCheckIterator() {
std::cout << "insert data count : " << count << "elapas time: " << e - s << std::endl; std::cout << "insert data count : " << count << "elapas time: " << e - s << std::endl;
fw->Put("Hello world", 1); fw->Put("Hello world", 1);
fw->Put("hello world", 2); fw->Put("Hello worle", 2);
fw->Put("hello worle", 3);
fw->Put("hello worlf", 4); fw->Put("hello worlf", 4);
delete fw; delete fw;
...@@ -258,15 +287,227 @@ void checkFstCheckIterator() { ...@@ -258,15 +287,227 @@ void checkFstCheckIterator() {
// prefix search // prefix search
std::vector<uint64_t> result; std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"H", AUTOMATION_PREFIX); AutomationCtx* ctx = automCtxCreate((void*)"He", AUTOMATION_ALWAYS);
m->Search(ctx, result); m->Search(ctx, result);
std::cout << "size: " << result.size() << std::endl; std::cout << "size: " << result.size() << std::endl;
// assert(result.size() == count); // assert(result.size() == count);
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
// assert(result[i] == i); // check result // assert(result[i] == i); // check result
} }
automCtxDestroy(ctx);
delete m;
}
void checkFstCheckIterator2() {
FstWriter* fw = new FstWriter;
int64_t s = taosGetTimestampUs();
int count = 2;
// Performance_fstWriteRecords(fw);
int64_t e = taosGetTimestampUs();
std::cout << "insert data count : " << count << "elapas time: " << e - s << std::endl;
fw->Put("a", 1);
fw->Put("b", 2);
fw->Put("c", 4);
delete fw;
FstReadMemory* m = new FstReadMemory(1024 * 64);
if (m->init() == false) {
std::cout << "init readMemory failed" << std::endl;
delete m;
return;
}
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"He", AUTOMATION_ALWAYS);
m->Search(ctx, result);
std::cout << "size: " << result.size() << std::endl;
// assert(result.size() == count);
for (int i = 0; i < result.size(); i++) {
// assert(result[i] == i); // check result
}
automCtxDestroy(ctx);
delete m;
}
void checkFstCheckIteratorPrefix() {
FstWriter* fw = new FstWriter;
int64_t s = taosGetTimestampUs();
int count = 2;
// Performance_fstWriteRecords(fw);
int64_t e = taosGetTimestampUs();
std::cout << "insert data count : " << count << "elapas time: " << e - s << std::endl;
fw->Put("Hello world", 1);
fw->Put("Hello worle", 2);
fw->Put("hello worlf", 4);
fw->Put("ja", 4);
fw->Put("jb", 4);
fw->Put("jc", 4);
fw->Put("jddddddddd", 4);
fw->Put("jefffffff", 4);
delete fw;
FstReadMemory* m = new FstReadMemory(1024 * 64);
if (m->init() == false) {
std::cout << "init readMemory failed" << std::endl;
delete m;
return;
}
{
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_PREFIX);
m->Search(ctx, result);
assert(result.size() == 1);
automCtxDestroy(ctx);
}
{
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"Hello", AUTOMATION_PREFIX);
m->Search(ctx, result);
assert(result.size() == 2);
automCtxDestroy(ctx);
}
{
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"jddd", AUTOMATION_PREFIX);
m->Search(ctx, result);
assert(result.size() == 1);
automCtxDestroy(ctx);
}
delete m;
}
void checkFstCheckIteratorRange1() {
FstWriter* fw = new FstWriter;
int64_t s = taosGetTimestampUs();
int count = 2;
// Performance_fstWriteRecords(fw);
int64_t e = taosGetTimestampUs();
std::cout << "insert data count : " << count << "elapas time: " << e - s << std::endl;
fw->Put("a", 1);
fw->Put("b", 2);
fw->Put("c", 3);
fw->Put("d", 4);
fw->Put("e", 5);
fw->Put("f", 5);
fw->Put("G", 5);
delete fw;
taosMemoryFree(ctx); FstReadMemory* m = new FstReadMemory(1024 * 64);
if (m->init() == false) {
std::cout << "init readMemory failed" << std::endl;
delete m;
return;
}
{
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GE, "e", LT, result);
assert(result.size() == 3);
automCtxDestroy(ctx);
}
{
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GT, "e", LT, result);
assert(result.size() == 2);
automCtxDestroy(ctx);
}
{
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GT, "e", LE, result);
assert(result.size() == 3);
automCtxDestroy(ctx);
}
{
// prefix search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GE, "e", LE, result);
assert(result.size() == 4);
automCtxDestroy(ctx);
}
delete m;
}
void checkFstCheckIteratorRange2() {
FstWriter* fw = new FstWriter;
int64_t s = taosGetTimestampUs();
int count = 2;
// Performance_fstWriteRecords(fw);
int64_t e = taosGetTimestampUs();
std::cout << "insert data count : " << count << "elapas time: " << e - s << std::endl;
fw->Put("ab", 1);
fw->Put("b", 2);
fw->Put("cdd", 3);
fw->Put("cde", 3);
fw->Put("ddd", 4);
fw->Put("ed", 5);
delete fw;
FstReadMemory* m = new FstReadMemory(1024 * 64);
if (m->init() == false) {
std::cout << "init readMemory failed" << std::endl;
delete m;
return;
}
{
// range search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GE, "ed", LT, result);
assert(result.size() == 4);
automCtxDestroy(ctx);
}
{
// range search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GE, "ed", LE, result);
assert(result.size() == 5);
automCtxDestroy(ctx);
// taosMemoryFree(ctx);
}
{
// range search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GT, "ed", LE, result);
assert(result.size() == 4);
automCtxDestroy(ctx);
}
{
// range search
std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e)
m->SearchRange(ctx, "b", GT, "ed", LT, result);
assert(result.size() == 3);
automCtxDestroy(ctx);
}
delete m; delete m;
} }
...@@ -332,7 +573,11 @@ int main(int argc, char* argv[]) { ...@@ -332,7 +573,11 @@ int main(int argc, char* argv[]) {
// path suid colName ver // path suid colName ver
// iterTFileReader(argv[1], argv[2], argv[3], argv[4]); // iterTFileReader(argv[1], argv[2], argv[3], argv[4]);
//} //}
checkFstCheckIterator(); checkFstCheckIterator1();
checkFstCheckIterator2();
checkFstCheckIteratorPrefix();
checkFstCheckIteratorRange1();
checkFstCheckIteratorRange2();
// checkFstLongTerm(); // checkFstLongTerm();
// checkFstPrefixSearch(); // checkFstPrefixSearch();
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include "index_fst_util.h" #include "index_fst_util.h"
#include "index_tfile.h" #include "index_tfile.h"
#include "tglobal.h" #include "tglobal.h"
#include "tlog.h"
#include "tskiplist.h" #include "tskiplist.h"
#include "tutil.h" #include "tutil.h"
#include "tlog.h"
static std::string dir = "/tmp/index"; static std::string dir = "/tmp/index";
......
...@@ -260,9 +260,9 @@ static SNode* logicAggCopy(const SAggLogicNode* pSrc, SAggLogicNode* pDst) { ...@@ -260,9 +260,9 @@ static SNode* logicAggCopy(const SAggLogicNode* pSrc, SAggLogicNode* pDst) {
} }
static SNode* logicProjectCopy(const SProjectLogicNode* pSrc, SProjectLogicNode* pDst) { static SNode* logicProjectCopy(const SProjectLogicNode* pSrc, SProjectLogicNode* pDst) {
COPY_ALL_SCALAR_FIELDS;
COPY_BASE_OBJECT_FIELD(node, logicNodeCopy); COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
CLONE_NODE_LIST_FIELD(pProjections); CLONE_NODE_LIST_FIELD(pProjections);
COPY_CHAR_ARRAY_FIELD(stmtName);
return (SNode*)pDst; return (SNode*)pDst;
} }
...@@ -307,10 +307,8 @@ static SNode* logicSubplanCopy(const SLogicSubplan* pSrc, SLogicSubplan* pDst) { ...@@ -307,10 +307,8 @@ static SNode* logicSubplanCopy(const SLogicSubplan* pSrc, SLogicSubplan* pDst) {
} }
static SNode* dataBlockDescCopy(const SDataBlockDescNode* pSrc, SDataBlockDescNode* pDst) { static SNode* dataBlockDescCopy(const SDataBlockDescNode* pSrc, SDataBlockDescNode* pDst) {
COPY_SCALAR_FIELD(dataBlockId); COPY_ALL_SCALAR_FIELDS;
CLONE_NODE_LIST_FIELD(pSlots); CLONE_NODE_LIST_FIELD(pSlots);
COPY_SCALAR_FIELD(resultRowSize);
COPY_SCALAR_FIELD(precision);
return (SNode*)pDst; return (SNode*)pDst;
} }
......
...@@ -475,6 +475,10 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) { ...@@ -475,6 +475,10 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) {
} }
static const char* jkProjectLogicPlanProjections = "Projections"; static const char* jkProjectLogicPlanProjections = "Projections";
static const char* jkProjectLogicPlanLimit = "Limit";
static const char* jkProjectLogicPlanOffset = "Offset";
static const char* jkProjectLogicPlanSlimit = "SLimit";
static const char* jkProjectLogicPlanSoffset = "SOffset";
static int32_t logicProjectNodeToJson(const void* pObj, SJson* pJson) { static int32_t logicProjectNodeToJson(const void* pObj, SJson* pJson) {
const SProjectLogicNode* pNode = (const SProjectLogicNode*)pObj; const SProjectLogicNode* pNode = (const SProjectLogicNode*)pObj;
...@@ -483,6 +487,18 @@ static int32_t logicProjectNodeToJson(const void* pObj, SJson* pJson) { ...@@ -483,6 +487,18 @@ static int32_t logicProjectNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkProjectLogicPlanProjections, pNode->pProjections); code = nodeListToJson(pJson, jkProjectLogicPlanProjections, pNode->pProjections);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectLogicPlanLimit, pNode->limit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectLogicPlanOffset, pNode->offset);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectLogicPlanSlimit, pNode->slimit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkScanLogicPlanTableMetaSize, pNode->soffset);
}
return code; return code;
} }
...@@ -494,6 +510,18 @@ static int32_t jsonToLogicProjectNode(const SJson* pJson, void* pObj) { ...@@ -494,6 +510,18 @@ static int32_t jsonToLogicProjectNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkProjectLogicPlanProjections, &pNode->pProjections); code = jsonToNodeList(pJson, jkProjectLogicPlanProjections, &pNode->pProjections);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectLogicPlanLimit, &pNode->limit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectLogicPlanOffset, &pNode->offset);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectLogicPlanSlimit, &pNode->slimit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkScanLogicPlanTableMetaSize, &pNode->soffset);
}
return code; return code;
} }
...@@ -802,6 +830,10 @@ static int32_t jsonToPhysiSysTableScanNode(const SJson* pJson, void* pObj) { ...@@ -802,6 +830,10 @@ static int32_t jsonToPhysiSysTableScanNode(const SJson* pJson, void* pObj) {
} }
static const char* jkProjectPhysiPlanProjections = "Projections"; static const char* jkProjectPhysiPlanProjections = "Projections";
static const char* jkProjectPhysiPlanLimit = "Limit";
static const char* jkProjectPhysiPlanOffset = "Offset";
static const char* jkProjectPhysiPlanSlimit = "SLimit";
static const char* jkProjectPhysiPlanSoffset = "SOffset";
static int32_t physiProjectNodeToJson(const void* pObj, SJson* pJson) { static int32_t physiProjectNodeToJson(const void* pObj, SJson* pJson) {
const SProjectPhysiNode* pNode = (const SProjectPhysiNode*)pObj; const SProjectPhysiNode* pNode = (const SProjectPhysiNode*)pObj;
...@@ -810,6 +842,18 @@ static int32_t physiProjectNodeToJson(const void* pObj, SJson* pJson) { ...@@ -810,6 +842,18 @@ static int32_t physiProjectNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkProjectPhysiPlanProjections, pNode->pProjections); code = nodeListToJson(pJson, jkProjectPhysiPlanProjections, pNode->pProjections);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectPhysiPlanLimit, pNode->limit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectPhysiPlanOffset, pNode->offset);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectPhysiPlanSlimit, pNode->slimit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkProjectPhysiPlanSoffset, pNode->soffset);
}
return code; return code;
} }
...@@ -821,6 +865,18 @@ static int32_t jsonToPhysiProjectNode(const SJson* pJson, void* pObj) { ...@@ -821,6 +865,18 @@ static int32_t jsonToPhysiProjectNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkProjectPhysiPlanProjections, &pNode->pProjections); code = jsonToNodeList(pJson, jkProjectPhysiPlanProjections, &pNode->pProjections);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectPhysiPlanLimit, &pNode->limit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectPhysiPlanOffset, &pNode->offset);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectPhysiPlanSlimit, &pNode->slimit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkProjectPhysiPlanSoffset, &pNode->soffset);
}
return code; return code;
} }
...@@ -2057,19 +2113,26 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) { ...@@ -2057,19 +2113,26 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) {
static const char* jkDataBlockDescDataBlockId = "DataBlockId"; static const char* jkDataBlockDescDataBlockId = "DataBlockId";
static const char* jkDataBlockDescSlots = "Slots"; static const char* jkDataBlockDescSlots = "Slots";
static const char* jkDataBlockResultRowSize = "ResultRowSize"; static const char* jkDataBlockTotalRowSize = "TotalRowSize";
static const char* jkDataBlockOutputRowSize = "OutputRowSize";
static const char* jkDataBlockPrecision = "Precision";
static int32_t dataBlockDescNodeToJson(const void* pObj, SJson* pJson) { static int32_t dataBlockDescNodeToJson(const void* pObj, SJson* pJson) {
const SDataBlockDescNode* pNode = (const SDataBlockDescNode*)pObj; const SDataBlockDescNode* pNode = (const SDataBlockDescNode*)pObj;
int32_t code = tjsonAddIntegerToObject(pJson, jkDataBlockDescDataBlockId, pNode->dataBlockId); int32_t code = tjsonAddIntegerToObject(pJson, jkDataBlockDescDataBlockId, pNode->dataBlockId);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkDataBlockResultRowSize, pNode->resultRowSize); code = tjsonAddIntegerToObject(pJson, jkDataBlockTotalRowSize, pNode->totalRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkDataBlockOutputRowSize, pNode->outputRowSize);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkDataBlockDescSlots, pNode->pSlots); code = nodeListToJson(pJson, jkDataBlockDescSlots, pNode->pSlots);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkDataBlockPrecision, pNode->precision);
}
return code; return code;
} }
...@@ -2079,12 +2142,17 @@ static int32_t jsonToDataBlockDescNode(const SJson* pJson, void* pObj) { ...@@ -2079,12 +2142,17 @@ static int32_t jsonToDataBlockDescNode(const SJson* pJson, void* pObj) {
int32_t code = tjsonGetSmallIntValue(pJson, jkDataBlockDescDataBlockId, &pNode->dataBlockId); int32_t code = tjsonGetSmallIntValue(pJson, jkDataBlockDescDataBlockId, &pNode->dataBlockId);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetIntValue(pJson, jkDataBlockResultRowSize, &pNode->resultRowSize); code = tjsonGetIntValue(pJson, jkDataBlockTotalRowSize, &pNode->totalRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetIntValue(pJson, jkDataBlockOutputRowSize, &pNode->outputRowSize);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkDataBlockDescSlots, &pNode->pSlots); code = jsonToNodeList(pJson, jkDataBlockDescSlots, &pNode->pSlots);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetSmallIntValue(pJson, jkDataBlockPrecision, &pNode->precision);
}
return code; return code;
} }
......
...@@ -582,11 +582,11 @@ int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char* ...@@ -582,11 +582,11 @@ int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char*
nodesWalkSelectStmt(pSelect, clause, collectColumns, &cxt); nodesWalkSelectStmt(pSelect, clause, collectColumns, &cxt);
taosHashCleanup(cxt.pColIdHash); taosHashCleanup(cxt.pColIdHash);
if (TSDB_CODE_SUCCESS != cxt.errCode) { if (TSDB_CODE_SUCCESS != cxt.errCode) {
nodesDestroyList(cxt.pCols); nodesClearList(cxt.pCols);
return cxt.errCode; return cxt.errCode;
} }
if (0 == LIST_LENGTH(cxt.pCols)) { if (0 == LIST_LENGTH(cxt.pCols)) {
nodesDestroyList(cxt.pCols); nodesClearList(cxt.pCols);
cxt.pCols = NULL; cxt.pCols = NULL;
} }
*pCols = cxt.pCols; *pCols = cxt.pCols;
......
...@@ -349,6 +349,7 @@ literal(A) ::= NK_STRING(B). ...@@ -349,6 +349,7 @@ literal(A) ::= NK_STRING(B).
literal(A) ::= NK_BOOL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); } literal(A) ::= NK_BOOL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); }
literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); } literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); }
literal(A) ::= duration_literal(B). { A = B; } literal(A) ::= duration_literal(B). { A = B; }
literal(A) ::= NULL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); }
duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); } duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
...@@ -372,6 +373,7 @@ signed_literal(A) ::= NK_STRING(B). ...@@ -372,6 +373,7 @@ signed_literal(A) ::= NK_STRING(B).
signed_literal(A) ::= NK_BOOL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B); } signed_literal(A) ::= NK_BOOL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B); }
signed_literal(A) ::= TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } signed_literal(A) ::= TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
signed_literal(A) ::= duration_literal(B). { A = releaseRawExprNode(pCxt, B); } signed_literal(A) ::= duration_literal(B). { A = releaseRawExprNode(pCxt, B); }
signed_literal(A) ::= NULL. { A = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); }
%type literal_list { SNodeList* } %type literal_list { SNodeList* }
%destructor literal_list { nodesDestroyList($$); } %destructor literal_list { nodesDestroyList($$); }
......
...@@ -577,11 +577,13 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC ...@@ -577,11 +577,13 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral) { SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral) {
SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
CHECK_OUT_OF_MEM(val); CHECK_OUT_OF_MEM(val);
val->literal = strndup(pLiteral->z, pLiteral->n); if (NULL != pLiteral) {
if (TK_NK_ID != pLiteral->type && (IS_VAR_DATA_TYPE(dataType) || TSDB_DATA_TYPE_TIMESTAMP == dataType)) { val->literal = strndup(pLiteral->z, pLiteral->n);
trimString(pLiteral->z, pLiteral->n, val->literal, pLiteral->n); if (TK_NK_ID != pLiteral->type && (IS_VAR_DATA_TYPE(dataType) || TSDB_DATA_TYPE_TIMESTAMP == dataType)) {
trimString(pLiteral->z, pLiteral->n, val->literal, pLiteral->n);
}
CHECK_OUT_OF_MEM(val->literal);
} }
CHECK_OUT_OF_MEM(val->literal);
val->node.resType.type = dataType; val->node.resType.type = dataType;
val->node.resType.bytes = IS_VAR_DATA_TYPE(dataType) ? strlen(val->literal) : tDataTypes[dataType].bytes; val->node.resType.bytes = IS_VAR_DATA_TYPE(dataType) ? strlen(val->literal) : tDataTypes[dataType].bytes;
if (TSDB_DATA_TYPE_TIMESTAMP == dataType) { if (TSDB_DATA_TYPE_TIMESTAMP == dataType) {
...@@ -717,8 +719,10 @@ SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft ...@@ -717,8 +719,10 @@ SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset) { SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset) {
SLimitNode* limitNode = (SLimitNode*)nodesMakeNode(QUERY_NODE_LIMIT); SLimitNode* limitNode = (SLimitNode*)nodesMakeNode(QUERY_NODE_LIMIT);
CHECK_OUT_OF_MEM(limitNode); CHECK_OUT_OF_MEM(limitNode);
// limitNode->limit = limit; limitNode->limit = strtol(pLimit->z, NULL, 10);
// limitNode->offset = offset; if (NULL != pOffset) {
limitNode->offset = strtol(pOffset->z, NULL, 10);
}
return (SNode*)limitNode; return (SNode*)limitNode;
} }
......
...@@ -99,6 +99,7 @@ static SKeyword keywordTable[] = { ...@@ -99,6 +99,7 @@ static SKeyword keywordTable[] = {
{"ON", TK_ON}, {"ON", TK_ON},
{"OR", TK_OR}, {"OR", TK_OR},
{"ORDER", TK_ORDER}, {"ORDER", TK_ORDER},
{"PARTITION", TK_PARTITION},
{"PASS", TK_PASS}, {"PASS", TK_PASS},
{"PORT", TK_PORT}, {"PORT", TK_PORT},
{"PRECISION", TK_PRECISION}, {"PRECISION", TK_PRECISION},
......
...@@ -235,6 +235,8 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol ...@@ -235,6 +235,8 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol
nodesListAppend(pExpr->pAssociationList, (SNode*)pCol); nodesListAppend(pExpr->pAssociationList, (SNode*)pCol);
if (NULL != pTable) { if (NULL != pTable) {
strcpy(pCol->tableAlias, pTable->tableAlias); strcpy(pCol->tableAlias, pTable->tableAlias);
} else if (QUERY_NODE_COLUMN == nodeType(pExpr)) {
strcpy(pCol->tableAlias, ((SColumnNode*)pExpr)->tableAlias);
} }
strcpy(pCol->colName, pExpr->aliasName); strcpy(pCol->colName, pExpr->aliasName);
pCol->node.resType = pExpr->resType; pCol->node.resType = pExpr->resType;
...@@ -617,7 +619,6 @@ static int32_t toVgroupsInfo(SArray* pVgs, SVgroupsInfo** pVgsInfo) { ...@@ -617,7 +619,6 @@ static int32_t toVgroupsInfo(SArray* pVgs, SVgroupsInfo** pVgsInfo) {
} }
static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) { static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
// todo release
if (0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLES)) { if (0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLES)) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -631,11 +632,6 @@ static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRea ...@@ -631,11 +632,6 @@ static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRea
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
// todo remove
//if (NULL != vgroupList && taosArrayGetSize(vgroupList) > 0 && 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLES)) {
// taosArrayPopTailBatch(vgroupList, taosArrayGetSize(vgroupList) - 1);
//}
code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList); code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList);
} }
taosArrayDestroy(vgroupList); taosArrayDestroy(vgroupList);
...@@ -1488,12 +1484,6 @@ static int32_t nodeTypeToShowType(ENodeType nt) { ...@@ -1488,12 +1484,6 @@ static int32_t nodeTypeToShowType(ENodeType nt) {
static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) { static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) {
SShowReq showReq = { .type = nodeTypeToShowType(nodeType(pStmt)) }; SShowReq showReq = { .type = nodeTypeToShowType(nodeType(pStmt)) };
// if ('\0' != pStmt->dbName[0]) {
// SName name = {0};
// tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
// char dbFname[TSDB_DB_FNAME_LEN] = {0};
// tNameGetFullDbName(&name, showReq.db);
// }
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) { if (NULL == pCxt->pCmdMsg) {
......
...@@ -133,16 +133,16 @@ typedef union { ...@@ -133,16 +133,16 @@ typedef union {
#define ParseCTX_FETCH #define ParseCTX_FETCH
#define ParseCTX_STORE #define ParseCTX_STORE
#define YYNSTATE 432 #define YYNSTATE 432
#define YYNRULE 346 #define YYNRULE 348
#define YYNTOKEN 172 #define YYNTOKEN 172
#define YY_MAX_SHIFT 431 #define YY_MAX_SHIFT 431
#define YY_MIN_SHIFTREDUCE 673 #define YY_MIN_SHIFTREDUCE 675
#define YY_MAX_SHIFTREDUCE 1018 #define YY_MAX_SHIFTREDUCE 1022
#define YY_ERROR_ACTION 1019 #define YY_ERROR_ACTION 1023
#define YY_ACCEPT_ACTION 1020 #define YY_ACCEPT_ACTION 1024
#define YY_NO_ACTION 1021 #define YY_NO_ACTION 1025
#define YY_MIN_REDUCE 1022 #define YY_MIN_REDUCE 1026
#define YY_MAX_REDUCE 1367 #define YY_MAX_REDUCE 1373
/************* 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])))
...@@ -209,270 +209,269 @@ typedef union { ...@@ -209,270 +209,269 @@ typedef union {
** yy_default[] Default action for each state. ** yy_default[] Default action for each state.
** **
*********** Begin parsing tables **********************************************/ *********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (1291) #define YY_ACTTAB_COUNT (1282)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 1225, 43, 306, 1237, 1114, 350, 1221, 1227, 238, 1110, /* 0 */ 1230, 43, 306, 1243, 1118, 350, 1226, 1233, 238, 1114,
/* 10 */ 89, 1201, 31, 29, 27, 26, 25, 1253, 1120, 24, /* 10 */ 89, 1205, 31, 29, 27, 26, 25, 1259, 1124, 24,
/* 20 */ 170, 1346, 226, 1253, 347, 31, 29, 27, 26, 25, /* 20 */ 170, 1352, 226, 1259, 347, 31, 29, 27, 26, 25,
/* 30 */ 347, 363, 363, 1103, 1345, 362, 66, 270, 1344, 1225, /* 30 */ 347, 363, 363, 251, 1351, 362, 66, 270, 1350, 1230,
/* 40 */ 349, 1237, 307, 280, 1213, 1221, 1226, 212, 1065, 335, /* 40 */ 349, 1243, 307, 280, 1217, 1226, 1232, 212, 1069, 335,
/* 50 */ 321, 362, 1125, 1125, 61, 1238, 1239, 1242, 1285, 879, /* 50 */ 321, 362, 1129, 1129, 61, 1244, 1245, 1248, 1291, 210,
/* 60 */ 212, 1253, 211, 1281, 246, 363, 271, 1346, 347, 894, /* 60 */ 212, 1259, 211, 1287, 246, 363, 1065, 1352, 347, 898,
/* 70 */ 1122, 1192, 1194, 239, 1346, 106, 1092, 924, 349, 271, /* 70 */ 1126, 1196, 1198, 239, 1352, 106, 1096, 928, 349, 350,
/* 80 */ 117, 104, 1213, 12, 1344, 189, 1125, 117, 1155, 1127, /* 80 */ 117, 104, 1217, 12, 1350, 1206, 1129, 117, 293, 1131,
/* 90 */ 924, 1344, 107, 1238, 1239, 1242, 1023, 416, 415, 414, /* 90 */ 928, 1350, 107, 1244, 1245, 1248, 1027, 416, 415, 414,
/* 100 */ 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, /* 100 */ 413, 412, 411, 410, 409, 408, 407, 406, 405, 404,
/* 110 */ 403, 402, 401, 400, 399, 43, 925, 78, 926, 346, /* 110 */ 403, 402, 401, 400, 399, 189, 929, 77, 1159, 1120,
/* 120 */ 77, 76, 75, 74, 73, 72, 71, 70, 69, 925, /* 120 */ 76, 75, 74, 73, 72, 71, 70, 69, 68, 929,
/* 130 */ 336, 1359, 1121, 23, 233, 21, 919, 920, 921, 922, /* 130 */ 336, 1365, 424, 423, 23, 233, 923, 924, 925, 926,
/* 140 */ 923, 927, 928, 929, 883, 930, 23, 233, 1102, 919, /* 140 */ 927, 931, 932, 933, 27, 26, 25, 23, 233, 923,
/* 150 */ 920, 921, 922, 923, 927, 928, 929, 9, 8, 1237, /* 150 */ 924, 925, 926, 927, 931, 932, 933, 9, 8, 1243,
/* 160 */ 362, 782, 386, 385, 384, 786, 383, 788, 789, 382, /* 160 */ 1217, 784, 386, 385, 384, 788, 383, 790, 791, 382,
/* 170 */ 791, 379, 309, 797, 376, 799, 800, 373, 370, 1253, /* 170 */ 793, 379, 883, 799, 376, 801, 802, 373, 370, 1259,
/* 180 */ 30, 28, 363, 1172, 98, 118, 334, 360, 235, 225, /* 180 */ 30, 28, 105, 1176, 1038, 243, 334, 1049, 235, 225,
/* 190 */ 861, 30, 28, 961, 1170, 105, 349, 1034, 284, 235, /* 190 */ 863, 30, 28, 965, 1174, 271, 349, 362, 1259, 235,
/* 200 */ 1213, 861, 283, 1125, 1237, 395, 859, 916, 12, 394, /* 200 */ 1217, 863, 1230, 1243, 885, 347, 861, 1107, 1226, 1232,
/* 210 */ 62, 1238, 1239, 1242, 1285, 11, 251, 859, 228, 1281, /* 210 */ 62, 1244, 1245, 1248, 1291, 11, 363, 861, 228, 1287,
/* 220 */ 112, 1253, 363, 285, 1253, 937, 11, 66, 347, 1116, /* 220 */ 112, 360, 712, 1259, 711, 941, 11, 339, 1217, 1105,
/* 230 */ 396, 334, 166, 881, 286, 52, 1, 109, 313, 1312, /* 230 */ 347, 324, 166, 30, 28, 1024, 1, 1129, 313, 1318,
/* 240 */ 219, 349, 210, 1125, 243, 1213, 165, 1, 1165, 393, /* 240 */ 349, 235, 713, 863, 1217, 12, 320, 1, 31, 29,
/* 250 */ 392, 391, 1118, 390, 324, 62, 1238, 1239, 1242, 1285, /* 250 */ 27, 26, 25, 271, 62, 1244, 1245, 1248, 1291, 861,
/* 260 */ 428, 1225, 284, 228, 1281, 112, 283, 1221, 1226, 1172, /* 260 */ 428, 338, 228, 1287, 1364, 1310, 960, 1048, 11, 363,
/* 270 */ 1213, 428, 860, 325, 1237, 240, 220, 104, 218, 217, /* 270 */ 930, 428, 862, 1325, 66, 398, 1176, 326, 322, 1243,
/* 280 */ 1170, 282, 118, 860, 1313, 1128, 118, 285, 710, 1299, /* 280 */ 1047, 286, 240, 862, 250, 242, 241, 1174, 21, 1,
/* 290 */ 709, 862, 865, 201, 1253, 907, 31, 29, 27, 26, /* 290 */ 1129, 864, 867, 868, 201, 876, 911, 934, 118, 1259,
/* 300 */ 25, 347, 862, 865, 201, 882, 907, 1296, 711, 1101, /* 300 */ 325, 109, 864, 867, 868, 201, 334, 911, 1217, 1352,
/* 310 */ 1237, 349, 1045, 78, 118, 1213, 77, 76, 75, 74, /* 310 */ 340, 869, 1169, 428, 118, 1243, 349, 1046, 1176, 1045,
/* 320 */ 73, 72, 71, 70, 69, 62, 1238, 1239, 1242, 1285, /* 320 */ 1217, 1217, 117, 118, 247, 862, 1350, 259, 1060, 1174,
/* 330 */ 1253, 424, 423, 228, 1281, 1358, 363, 347, 245, 350, /* 330 */ 62, 1244, 1245, 1248, 1291, 1259, 363, 1305, 228, 1287,
/* 340 */ 1237, 361, 30, 28, 1319, 1202, 104, 349, 30, 28, /* 340 */ 112, 361, 347, 363, 864, 867, 868, 201, 184, 911,
/* 350 */ 235, 1213, 861, 1213, 1127, 398, 235, 1125, 861, 709, /* 350 */ 295, 1243, 349, 30, 28, 1302, 1217, 1129, 1217, 1319,
/* 360 */ 1253, 62, 1238, 1239, 1242, 1285, 985, 347, 859, 228, /* 360 */ 1217, 235, 1305, 863, 1129, 364, 62, 1244, 1245, 1248,
/* 370 */ 1281, 1358, 968, 1172, 859, 278, 338, 349, 881, 247, /* 370 */ 1291, 1259, 122, 121, 228, 1287, 1364, 872, 347, 861,
/* 380 */ 1342, 1213, 320, 11, 1170, 1044, 317, 983, 984, 986, /* 380 */ 1301, 30, 28, 348, 972, 1348, 1044, 389, 349, 235,
/* 390 */ 987, 62, 1238, 1239, 1242, 1285, 1237, 398, 7, 228, /* 390 */ 885, 863, 1217, 118, 363, 331, 877, 880, 868, 249,
/* 400 */ 1281, 1358, 339, 906, 1, 908, 909, 910, 911, 912, /* 400 */ 1043, 1042, 62, 1244, 1245, 1248, 1291, 861, 1041, 7,
/* 410 */ 1303, 880, 1299, 326, 322, 342, 1253, 30, 28, 348, /* 410 */ 228, 1287, 1364, 964, 245, 1129, 92, 886, 30, 28,
/* 420 */ 1068, 59, 428, 347, 1172, 235, 1213, 861, 428, 1043, /* 420 */ 337, 1309, 104, 398, 30, 28, 235, 1217, 863, 59,
/* 430 */ 1295, 93, 1189, 349, 860, 1193, 960, 1213, 1117, 120, /* 430 */ 1131, 1243, 235, 428, 863, 1040, 1176, 7, 1037, 93,
/* 440 */ 860, 363, 335, 859, 1304, 956, 184, 202, 1238, 1239, /* 440 */ 248, 1217, 1217, 90, 861, 862, 1121, 1197, 104, 1217,
/* 450 */ 1242, 1014, 1015, 862, 865, 201, 248, 907, 389, 862, /* 450 */ 861, 1259, 333, 113, 1298, 1299, 1131, 1303, 347, 1036,
/* 460 */ 865, 201, 1125, 907, 104, 259, 1112, 1346, 879, 292, /* 460 */ 1035, 428, 884, 1193, 864, 867, 868, 201, 349, 911,
/* 470 */ 1213, 287, 1127, 7, 291, 252, 118, 290, 264, 288, /* 470 */ 120, 1034, 1217, 862, 7, 887, 1217, 335, 1176, 1217,
/* 480 */ 117, 1035, 289, 982, 1344, 340, 1237, 265, 31, 29, /* 480 */ 1, 1033, 202, 1244, 1245, 1248, 284, 118, 297, 1175,
/* 490 */ 27, 26, 25, 30, 28, 41, 1299, 428, 6, 363, /* 490 */ 283, 1116, 864, 867, 868, 201, 43, 911, 428, 1112,
/* 500 */ 343, 235, 137, 861, 249, 135, 1253, 30, 28, 860, /* 500 */ 1217, 1217, 1352, 305, 428, 1032, 1243, 1106, 1031, 1030,
/* 510 */ 122, 121, 1061, 347, 1294, 235, 1237, 861, 139, 859, /* 510 */ 862, 285, 1217, 1125, 1029, 117, 862, 145, 888, 1350,
/* 520 */ 1125, 138, 884, 349, 27, 26, 25, 1213, 862, 865, /* 520 */ 300, 1305, 1217, 9, 8, 294, 1259, 52, 144, 864,
/* 530 */ 201, 1108, 907, 859, 293, 337, 1253, 63, 1238, 1239, /* 530 */ 867, 868, 201, 347, 911, 864, 867, 868, 201, 1300,
/* 540 */ 1242, 1285, 1056, 347, 388, 1284, 1281, 1042, 1093, 7, /* 540 */ 911, 989, 1243, 349, 1122, 104, 1217, 1217, 6, 1217,
/* 550 */ 1054, 318, 167, 349, 1172, 263, 1041, 1213, 258, 257, /* 550 */ 1217, 40, 342, 1132, 39, 1217, 963, 63, 1244, 1245,
/* 560 */ 256, 255, 254, 1, 295, 1171, 431, 63, 1238, 1239, /* 560 */ 1248, 1291, 1259, 331, 395, 1290, 1287, 304, 394, 347,
/* 570 */ 1242, 1285, 298, 428, 1237, 345, 1281, 868, 141, 959, /* 570 */ 863, 388, 317, 987, 988, 990, 991, 165, 1243, 349,
/* 580 */ 187, 140, 1040, 88, 160, 860, 277, 428, 1213, 420, /* 580 */ 302, 871, 137, 1217, 92, 135, 861, 194, 139, 396,
/* 590 */ 1039, 186, 331, 1166, 1253, 156, 1038, 1213, 1037, 860, /* 590 */ 1039, 138, 196, 63, 1244, 1245, 1248, 1291, 1259, 318,
/* 600 */ 956, 347, 1100, 304, 862, 865, 201, 154, 907, 9, /* 600 */ 711, 345, 1287, 335, 195, 347, 309, 1243, 393, 392,
/* 610 */ 8, 349, 1315, 92, 60, 1213, 302, 182, 862, 865, /* 610 */ 391, 90, 390, 1058, 123, 349, 278, 346, 98, 1217,
/* 620 */ 201, 332, 907, 1213, 151, 63, 1238, 1239, 1242, 1285, /* 620 */ 151, 163, 1298, 330, 1104, 329, 1243, 1259, 1352, 63,
/* 630 */ 143, 1213, 335, 142, 1282, 1237, 1036, 1213, 1254, 1213, /* 630 */ 1244, 1245, 1248, 1291, 347, 298, 141, 343, 1288, 140,
/* 640 */ 90, 1017, 1018, 871, 1237, 169, 58, 867, 359, 1033, /* 640 */ 428, 117, 986, 156, 349, 1350, 1259, 874, 1217, 1243,
/* 650 */ 163, 1292, 330, 1032, 329, 1253, 54, 1346, 1031, 395, /* 650 */ 960, 234, 862, 347, 41, 154, 1021, 1022, 206, 1244,
/* 660 */ 1030, 879, 347, 394, 1253, 312, 931, 1029, 147, 2, /* 660 */ 1245, 1248, 143, 349, 58, 142, 1097, 1217, 1243, 1259,
/* 670 */ 117, 347, 349, 1237, 1344, 1028, 1213, 1213, 32, 234, /* 670 */ 314, 864, 867, 868, 54, 64, 347, 206, 1244, 1245,
/* 680 */ 1020, 349, 1237, 119, 396, 1213, 206, 1238, 1239, 1242, /* 680 */ 1248, 395, 870, 1170, 935, 394, 349, 895, 1259, 167,
/* 690 */ 1213, 1237, 1191, 1253, 1213, 204, 1238, 1239, 1242, 1213, /* 690 */ 1217, 160, 277, 1321, 920, 347, 32, 883, 1237, 32,
/* 700 */ 347, 1213, 1253, 393, 392, 391, 253, 390, 1213, 347, /* 700 */ 205, 1244, 1245, 1248, 252, 349, 396, 264, 1243, 1217,
/* 710 */ 349, 1253, 1027, 870, 1213, 261, 1213, 314, 347, 349, /* 710 */ 1235, 856, 175, 1243, 332, 118, 265, 169, 355, 107,
/* 720 */ 887, 1237, 260, 1213, 206, 1238, 1239, 1242, 349, 250, /* 720 */ 1244, 1245, 1248, 32, 173, 393, 392, 391, 1259, 390,
/* 730 */ 262, 124, 1213, 205, 1238, 1239, 1242, 242, 241, 1237, /* 730 */ 95, 1260, 327, 1259, 2, 347, 883, 1195, 119, 253,
/* 740 */ 266, 1253, 107, 1238, 1239, 1242, 1026, 873, 347, 267, /* 740 */ 347, 181, 261, 260, 266, 349, 891, 262, 873, 1217,
/* 750 */ 886, 268, 194, 1213, 1346, 127, 331, 196, 349, 1253, /* 750 */ 349, 777, 232, 96, 1217, 1072, 268, 236, 1366, 206,
/* 760 */ 42, 1025, 1213, 866, 269, 327, 347, 117, 1237, 195, /* 760 */ 1244, 1245, 1248, 98, 206, 1244, 1245, 1248, 1026, 267,
/* 770 */ 891, 1344, 207, 1238, 1239, 1242, 349, 92, 130, 123, /* 770 */ 124, 77, 890, 772, 76, 75, 74, 73, 72, 71,
/* 780 */ 1213, 1360, 32, 232, 272, 885, 20, 1213, 1253, 854, /* 780 */ 70, 69, 68, 127, 263, 41, 42, 258, 257, 256,
/* 790 */ 206, 1238, 1239, 1242, 279, 347, 31, 29, 27, 26, /* 790 */ 255, 254, 86, 85, 84, 83, 82, 81, 80, 79,
/* 800 */ 25, 32, 1213, 68, 90, 349, 1022, 281, 1115, 1213, /* 800 */ 78, 431, 1243, 272, 292, 269, 287, 1243, 130, 291,
/* 810 */ 134, 1231, 236, 333, 113, 1292, 1293, 364, 1297, 206, /* 810 */ 889, 805, 290, 279, 288, 187, 281, 289, 88, 87,
/* 820 */ 1238, 1239, 1242, 1229, 1237, 1111, 136, 100, 101, 869, /* 820 */ 809, 308, 1259, 368, 420, 224, 186, 1259, 292, 347,
/* 830 */ 87, 86, 85, 84, 83, 82, 81, 80, 79, 861, /* 830 */ 287, 310, 96, 291, 347, 815, 290, 1243, 288, 349,
/* 840 */ 64, 175, 355, 1113, 1253, 181, 1237, 132, 874, 865, /* 840 */ 1119, 289, 134, 1217, 349, 1243, 1115, 97, 1217, 60,
/* 850 */ 111, 347, 1237, 173, 95, 859, 276, 96, 131, 775, /* 850 */ 814, 136, 182, 204, 1244, 1245, 1248, 1259, 207, 1244,
/* 860 */ 1109, 349, 102, 103, 224, 1213, 1253, 308, 146, 311, /* 860 */ 1245, 1248, 98, 99, 347, 1259, 31, 29, 27, 26,
/* 870 */ 770, 98, 1253, 347, 1237, 199, 1238, 1239, 1242, 347, /* 870 */ 25, 100, 347, 101, 349, 96, 1117, 146, 1217, 1113,
/* 880 */ 118, 44, 41, 349, 129, 310, 331, 1213, 149, 349, /* 880 */ 102, 1243, 349, 359, 103, 149, 1217, 311, 199, 1244,
/* 890 */ 884, 1316, 319, 1213, 1253, 1326, 152, 208, 1238, 1239, /* 890 */ 1245, 1248, 888, 1322, 319, 1332, 208, 1244, 1245, 1248,
/* 900 */ 1242, 347, 1237, 200, 1238, 1239, 1242, 92, 803, 428, /* 900 */ 312, 1259, 353, 147, 1243, 152, 316, 227, 347, 1243,
/* 910 */ 1237, 349, 807, 353, 316, 1213, 865, 1325, 5, 155, /* 910 */ 31, 29, 27, 26, 25, 1331, 868, 155, 349, 323,
/* 920 */ 368, 860, 1253, 227, 96, 209, 1238, 1239, 1242, 347, /* 920 */ 5, 328, 1217, 898, 1259, 315, 1312, 159, 4, 1259,
/* 930 */ 1253, 128, 323, 1306, 90, 125, 159, 347, 1237, 349, /* 930 */ 110, 347, 200, 1244, 1245, 1248, 347, 960, 91, 887,
/* 940 */ 862, 865, 315, 1213, 114, 1292, 1293, 349, 1297, 328, /* 940 */ 33, 349, 161, 1306, 1243, 1217, 349, 162, 344, 341,
/* 950 */ 4, 1213, 161, 1250, 1238, 1239, 1242, 1237, 1253, 22, /* 950 */ 1217, 17, 1243, 229, 1367, 209, 1244, 1245, 1248, 331,
/* 960 */ 110, 1249, 1238, 1239, 1242, 347, 1237, 956, 813, 31, /* 960 */ 1256, 1244, 1245, 1248, 1259, 1273, 356, 357, 179, 1349,
/* 970 */ 29, 27, 26, 25, 883, 349, 812, 1253, 1300, 1213, /* 970 */ 168, 347, 1259, 1204, 1243, 1203, 351, 177, 352, 347,
/* 980 */ 97, 91, 33, 162, 347, 1237, 1253, 229, 98, 1248, /* 980 */ 92, 349, 51, 237, 358, 1217, 188, 1130, 53, 349,
/* 990 */ 1238, 1239, 1242, 347, 349, 1361, 344, 341, 1213, 1343, /* 990 */ 190, 366, 185, 1217, 1259, 1255, 1244, 1245, 1248, 427,
/* 1000 */ 168, 17, 1267, 349, 99, 1253, 356, 1213, 215, 1238, /* 1000 */ 197, 347, 1243, 1254, 1244, 1245, 1248, 90, 198, 193,
/* 1010 */ 1239, 1242, 347, 1237, 1200, 351, 96, 214, 1238, 1239, /* 1010 */ 1243, 349, 192, 1211, 839, 1217, 1188, 114, 1298, 1299,
/* 1020 */ 1242, 352, 349, 177, 1199, 237, 1213, 357, 331, 358, /* 1020 */ 94, 1303, 1259, 1187, 1186, 215, 1244, 1245, 1248, 347,
/* 1030 */ 179, 188, 51, 1253, 1126, 53, 216, 1238, 1239, 1242, /* 1030 */ 1259, 1185, 1243, 1184, 1183, 1182, 1181, 347, 126, 349,
/* 1040 */ 347, 1237, 366, 297, 190, 185, 427, 197, 198, 92, /* 1040 */ 1243, 841, 1180, 1217, 1179, 1178, 1177, 349, 1071, 1210,
/* 1050 */ 349, 193, 1207, 192, 1213, 837, 1184, 1183, 305, 94, /* 1050 */ 1201, 1217, 1259, 214, 1244, 1245, 1248, 1108, 724, 347,
/* 1060 */ 1182, 1253, 1181, 1180, 213, 1238, 1239, 1242, 347, 1179, /* 1060 */ 1259, 216, 1244, 1245, 1248, 1018, 1019, 347, 1070, 349,
/* 1070 */ 1178, 1177, 145, 1176, 1175, 300, 90, 839, 349, 1174, /* 1070 */ 1068, 132, 275, 1217, 111, 219, 1057, 349, 331, 273,
/* 1080 */ 294, 1173, 1213, 144, 1067, 1206, 115, 1292, 1293, 1197, /* 1080 */ 276, 1217, 131, 213, 1244, 1245, 1248, 274, 1056, 1053,
/* 1090 */ 1297, 126, 203, 1238, 1239, 1242, 1104, 722, 1066, 1064, /* 1090 */ 1110, 203, 1244, 1245, 1248, 67, 133, 284, 822, 92,
/* 1100 */ 292, 275, 287, 273, 274, 291, 40, 1053, 290, 39, /* 1100 */ 821, 283, 820, 1109, 752, 44, 1066, 751, 129, 750,
/* 1110 */ 288, 1052, 1049, 289, 1106, 31, 29, 27, 26, 25, /* 1110 */ 749, 220, 748, 218, 217, 747, 282, 20, 221, 1061,
/* 1120 */ 67, 133, 818, 1105, 820, 819, 750, 1062, 749, 748, /* 1120 */ 222, 296, 285, 1059, 223, 299, 90, 31, 29, 27,
/* 1130 */ 747, 746, 745, 1057, 296, 221, 1055, 222, 223, 299, /* 1130 */ 26, 25, 22, 1052, 301, 1051, 115, 1298, 1299, 303,
/* 1140 */ 1048, 301, 1047, 303, 65, 1205, 1204, 36, 1196, 148, /* 1140 */ 1303, 65, 31, 29, 27, 26, 25, 910, 1209, 912,
/* 1150 */ 45, 150, 14, 3, 15, 34, 32, 37, 158, 19, /* 1150 */ 913, 914, 915, 916, 1208, 128, 1200, 148, 14, 125,
/* 1160 */ 1229, 48, 10, 164, 8, 917, 153, 1003, 1002, 230, /* 1160 */ 45, 36, 3, 153, 150, 32, 37, 158, 985, 108,
/* 1170 */ 1007, 981, 894, 108, 354, 1006, 157, 231, 975, 974, /* 1170 */ 34, 1235, 157, 164, 979, 46, 19, 978, 47, 48,
/* 1180 */ 1195, 180, 875, 1021, 116, 46, 47, 1021, 1021, 953, /* 1180 */ 15, 35, 957, 1007, 1006, 956, 8, 1012, 230, 116,
/* 1190 */ 1021, 952, 1021, 1021, 178, 1008, 1063, 1051, 1050, 367, /* 1190 */ 1011, 1010, 16, 10, 896, 231, 13, 921, 172, 18,
/* 1200 */ 1021, 244, 1021, 371, 892, 781, 35, 172, 1021, 16, /* 1200 */ 171, 983, 174, 354, 176, 49, 1199, 178, 50, 878,
/* 1210 */ 979, 13, 18, 374, 171, 174, 377, 176, 49, 380, /* 1210 */ 38, 367, 244, 806, 180, 369, 54, 371, 803, 1234,
/* 1220 */ 50, 425, 1021, 1021, 38, 815, 809, 426, 804, 742, /* 1220 */ 800, 183, 365, 372, 374, 783, 375, 377, 794, 378,
/* 1230 */ 811, 54, 369, 810, 1228, 183, 801, 365, 372, 1021, /* 1230 */ 380, 792, 817, 381, 813, 812, 811, 55, 722, 56,
/* 1240 */ 798, 375, 734, 792, 378, 422, 790, 381, 741, 740, /* 1240 */ 57, 744, 397, 743, 736, 742, 741, 740, 739, 738,
/* 1250 */ 720, 739, 397, 55, 738, 737, 736, 735, 56, 733, /* 1250 */ 387, 737, 1067, 735, 798, 734, 733, 797, 732, 731,
/* 1260 */ 796, 418, 795, 794, 387, 732, 793, 731, 57, 730, /* 1260 */ 796, 795, 730, 729, 728, 727, 417, 418, 1055, 1054,
/* 1270 */ 729, 728, 727, 726, 725, 417, 1046, 421, 863, 191, /* 1270 */ 421, 422, 419, 1050, 816, 425, 426, 1025, 865, 191,
/* 1280 */ 429, 419, 430, 1021, 1021, 1021, 1021, 1021, 1021, 1021, /* 1280 */ 429, 430,
/* 1290 */ 814,
}; };
static const YYCODETYPE yy_lookahead[] = { static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 216, 183, 181, 175, 196, 212, 222, 223, 215, 196, /* 0 */ 216, 183, 181, 175, 196, 212, 222, 223, 215, 196,
/* 10 */ 192, 218, 12, 13, 14, 15, 16, 195, 200, 231, /* 10 */ 192, 218, 12, 13, 14, 15, 16, 195, 200, 231,
/* 20 */ 232, 246, 199, 195, 202, 12, 13, 14, 15, 16, /* 20 */ 232, 246, 199, 195, 202, 12, 13, 14, 15, 16,
/* 30 */ 202, 181, 181, 0, 259, 20, 186, 186, 263, 216, /* 30 */ 202, 181, 181, 181, 259, 20, 186, 186, 263, 216,
/* 40 */ 212, 175, 221, 193, 216, 222, 223, 47, 0, 221, /* 40 */ 212, 175, 221, 193, 216, 222, 223, 47, 0, 221,
/* 50 */ 228, 20, 202, 202, 226, 227, 228, 229, 230, 20, /* 50 */ 228, 20, 202, 202, 226, 227, 228, 229, 230, 207,
/* 60 */ 47, 195, 234, 235, 204, 181, 46, 246, 202, 69, /* 60 */ 47, 195, 234, 235, 204, 181, 0, 246, 202, 69,
/* 70 */ 186, 211, 212, 187, 246, 184, 185, 77, 212, 46, /* 70 */ 186, 211, 212, 187, 246, 184, 185, 77, 212, 212,
/* 80 */ 259, 195, 216, 68, 263, 188, 202, 259, 191, 203, /* 80 */ 259, 195, 216, 68, 263, 218, 202, 259, 22, 203,
/* 90 */ 77, 263, 226, 227, 228, 229, 0, 49, 50, 51, /* 90 */ 77, 263, 226, 227, 228, 229, 0, 49, 50, 51,
/* 100 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, /* 100 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
/* 110 */ 62, 63, 64, 65, 66, 183, 116, 21, 116, 47, /* 110 */ 62, 63, 64, 65, 66, 188, 116, 21, 191, 175,
/* 120 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 116, /* 120 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 116,
/* 130 */ 264, 265, 200, 133, 134, 133, 136, 137, 138, 139, /* 130 */ 264, 265, 178, 179, 134, 135, 136, 137, 138, 139,
/* 140 */ 140, 141, 142, 143, 20, 143, 133, 134, 0, 136, /* 140 */ 140, 141, 142, 143, 14, 15, 16, 134, 135, 136,
/* 150 */ 137, 138, 139, 140, 141, 142, 143, 1, 2, 175, /* 150 */ 137, 138, 139, 140, 141, 142, 143, 1, 2, 175,
/* 160 */ 20, 83, 84, 85, 86, 87, 88, 89, 90, 91, /* 160 */ 216, 83, 84, 85, 86, 87, 88, 89, 90, 91,
/* 170 */ 92, 93, 69, 95, 96, 97, 98, 99, 100, 195, /* 170 */ 92, 93, 20, 95, 96, 97, 98, 99, 100, 195,
/* 180 */ 12, 13, 181, 195, 81, 146, 202, 186, 20, 201, /* 180 */ 12, 13, 174, 195, 176, 199, 202, 175, 20, 201,
/* 190 */ 22, 12, 13, 14, 206, 174, 212, 176, 57, 20, /* 190 */ 22, 12, 13, 14, 206, 46, 212, 20, 195, 20,
/* 200 */ 216, 22, 61, 202, 175, 57, 38, 135, 68, 61, /* 200 */ 216, 22, 216, 175, 20, 202, 38, 0, 222, 223,
/* 210 */ 226, 227, 228, 229, 230, 47, 181, 38, 234, 235, /* 210 */ 226, 227, 228, 229, 230, 47, 181, 38, 234, 235,
/* 220 */ 236, 195, 181, 82, 195, 69, 47, 186, 202, 175, /* 220 */ 236, 186, 20, 195, 22, 69, 47, 81, 216, 0,
/* 230 */ 82, 202, 248, 20, 193, 180, 68, 194, 254, 255, /* 230 */ 202, 228, 248, 12, 13, 172, 68, 202, 254, 255,
/* 240 */ 35, 212, 207, 202, 199, 216, 122, 68, 205, 101, /* 240 */ 212, 20, 40, 22, 216, 68, 120, 68, 12, 13,
/* 250 */ 102, 103, 197, 105, 228, 226, 227, 228, 229, 230, /* 250 */ 14, 15, 16, 46, 226, 227, 228, 229, 230, 38,
/* 260 */ 92, 216, 57, 234, 235, 236, 61, 222, 223, 195, /* 260 */ 92, 3, 234, 235, 236, 144, 145, 175, 47, 181,
/* 270 */ 216, 92, 104, 20, 175, 201, 71, 195, 73, 74, /* 270 */ 116, 92, 104, 245, 186, 46, 195, 151, 152, 175,
/* 280 */ 206, 76, 146, 104, 255, 203, 146, 82, 20, 224, /* 280 */ 175, 193, 201, 104, 221, 12, 13, 206, 134, 68,
/* 290 */ 22, 123, 124, 125, 195, 127, 12, 13, 14, 15, /* 290 */ 202, 123, 124, 125, 126, 22, 128, 143, 146, 195,
/* 300 */ 16, 202, 123, 124, 125, 20, 127, 242, 40, 0, /* 300 */ 20, 194, 123, 124, 125, 126, 202, 128, 216, 246,
/* 310 */ 175, 212, 175, 21, 146, 216, 24, 25, 26, 27, /* 310 */ 164, 38, 205, 92, 146, 175, 212, 175, 195, 175,
/* 320 */ 28, 29, 30, 31, 32, 226, 227, 228, 229, 230, /* 320 */ 216, 216, 259, 146, 201, 104, 263, 63, 0, 206,
/* 330 */ 195, 178, 179, 234, 235, 236, 181, 202, 187, 212, /* 330 */ 226, 227, 228, 229, 230, 195, 181, 224, 234, 235,
/* 340 */ 175, 186, 12, 13, 245, 218, 195, 212, 12, 13, /* 340 */ 236, 186, 202, 181, 123, 124, 125, 126, 186, 128,
/* 350 */ 20, 216, 22, 216, 203, 46, 20, 202, 22, 22, /* 350 */ 22, 175, 212, 12, 13, 242, 216, 202, 216, 255,
/* 360 */ 195, 226, 227, 228, 229, 230, 135, 202, 38, 234, /* 360 */ 216, 20, 224, 22, 202, 92, 226, 227, 228, 229,
/* 370 */ 235, 236, 14, 195, 38, 38, 3, 212, 20, 201, /* 370 */ 230, 195, 108, 109, 234, 235, 236, 104, 202, 38,
/* 380 */ 245, 216, 120, 47, 206, 175, 155, 156, 157, 158, /* 380 */ 242, 12, 13, 14, 14, 245, 175, 79, 212, 20,
/* 390 */ 159, 226, 227, 228, 229, 230, 175, 46, 68, 234, /* 390 */ 20, 22, 216, 146, 181, 181, 123, 124, 125, 186,
/* 400 */ 235, 236, 81, 126, 68, 128, 129, 130, 131, 132, /* 400 */ 175, 175, 226, 227, 228, 229, 230, 38, 175, 68,
/* 410 */ 245, 20, 224, 151, 152, 81, 195, 12, 13, 14, /* 410 */ 234, 235, 236, 4, 187, 202, 202, 20, 12, 13,
/* 420 */ 0, 180, 92, 202, 195, 20, 216, 22, 92, 175, /* 420 */ 162, 245, 195, 46, 12, 13, 20, 216, 22, 180,
/* 430 */ 242, 190, 202, 212, 104, 206, 4, 216, 197, 209, /* 430 */ 203, 175, 20, 92, 22, 175, 195, 68, 175, 190,
/* 440 */ 104, 181, 221, 38, 144, 145, 186, 226, 227, 228, /* 440 */ 187, 216, 216, 229, 38, 104, 197, 206, 195, 216,
/* 450 */ 229, 167, 168, 123, 124, 125, 187, 127, 79, 123, /* 450 */ 38, 195, 238, 239, 240, 241, 203, 243, 202, 175,
/* 460 */ 124, 125, 202, 127, 195, 63, 196, 246, 20, 49, /* 460 */ 175, 92, 20, 202, 123, 124, 125, 126, 212, 128,
/* 470 */ 216, 51, 203, 68, 54, 27, 146, 57, 30, 59, /* 470 */ 209, 175, 216, 104, 68, 20, 216, 221, 195, 216,
/* 480 */ 259, 176, 62, 69, 263, 164, 175, 39, 12, 13, /* 480 */ 68, 175, 226, 227, 228, 229, 57, 146, 4, 206,
/* 490 */ 14, 15, 16, 12, 13, 81, 224, 92, 43, 181, /* 490 */ 61, 196, 123, 124, 125, 126, 183, 128, 92, 196,
/* 500 */ 166, 20, 72, 22, 186, 75, 195, 12, 13, 104, /* 500 */ 216, 216, 246, 19, 92, 175, 175, 0, 175, 175,
/* 510 */ 108, 109, 0, 202, 242, 20, 175, 22, 72, 38, /* 510 */ 104, 82, 216, 200, 175, 259, 104, 33, 20, 263,
/* 520 */ 202, 75, 20, 212, 14, 15, 16, 216, 123, 124, /* 520 */ 36, 224, 216, 1, 2, 41, 195, 180, 44, 123,
/* 530 */ 125, 196, 127, 38, 22, 162, 195, 226, 227, 228, /* 530 */ 124, 125, 126, 202, 128, 123, 124, 125, 126, 242,
/* 540 */ 229, 230, 0, 202, 196, 234, 235, 175, 185, 68, /* 540 */ 128, 124, 175, 212, 197, 195, 216, 216, 43, 216,
/* 550 */ 0, 257, 266, 212, 195, 107, 175, 216, 110, 111, /* 550 */ 216, 67, 81, 203, 70, 216, 147, 226, 227, 228,
/* 560 */ 112, 113, 114, 68, 22, 206, 19, 226, 227, 228, /* 560 */ 229, 230, 195, 181, 57, 234, 235, 21, 61, 202,
/* 570 */ 229, 230, 22, 92, 175, 234, 235, 38, 72, 147, /* 570 */ 22, 196, 155, 156, 157, 158, 159, 122, 175, 212,
/* 580 */ 33, 75, 175, 36, 251, 104, 178, 92, 216, 42, /* 580 */ 34, 38, 72, 216, 202, 75, 38, 18, 72, 82,
/* 590 */ 175, 44, 181, 205, 195, 69, 175, 216, 175, 104, /* 590 */ 176, 75, 23, 226, 227, 228, 229, 230, 195, 257,
/* 600 */ 145, 202, 0, 21, 123, 124, 125, 81, 127, 1, /* 600 */ 22, 234, 235, 221, 35, 202, 69, 175, 101, 102,
/* 610 */ 2, 212, 225, 202, 67, 216, 34, 70, 123, 124, /* 610 */ 103, 229, 105, 0, 45, 212, 38, 47, 81, 216,
/* 620 */ 125, 244, 127, 216, 122, 226, 227, 228, 229, 230, /* 620 */ 122, 239, 240, 241, 0, 243, 175, 195, 246, 226,
/* 630 */ 72, 216, 221, 75, 235, 175, 175, 216, 195, 216, /* 630 */ 227, 228, 229, 230, 202, 22, 72, 166, 235, 75,
/* 640 */ 229, 170, 171, 104, 175, 260, 68, 38, 101, 175, /* 640 */ 92, 259, 69, 69, 212, 263, 195, 104, 216, 175,
/* 650 */ 239, 240, 241, 175, 243, 195, 78, 246, 175, 57, /* 650 */ 145, 219, 104, 202, 81, 81, 170, 171, 226, 227,
/* 660 */ 175, 20, 202, 61, 195, 118, 69, 175, 121, 247, /* 660 */ 228, 229, 72, 212, 68, 75, 185, 216, 175, 195,
/* 670 */ 259, 202, 212, 175, 263, 175, 216, 216, 81, 219, /* 670 */ 219, 123, 124, 125, 78, 106, 202, 226, 227, 228,
/* 680 */ 172, 212, 175, 115, 82, 216, 226, 227, 228, 229, /* 680 */ 229, 57, 38, 205, 69, 61, 212, 69, 195, 266,
/* 690 */ 216, 175, 181, 195, 216, 226, 227, 228, 229, 216, /* 690 */ 216, 251, 178, 225, 124, 202, 81, 20, 68, 81,
/* 700 */ 202, 216, 195, 101, 102, 103, 210, 105, 216, 202, /* 700 */ 226, 227, 228, 229, 27, 212, 82, 30, 175, 216,
/* 710 */ 212, 195, 175, 104, 216, 116, 216, 219, 202, 212, /* 710 */ 80, 69, 69, 175, 244, 146, 39, 260, 69, 226,
/* 720 */ 20, 175, 208, 216, 226, 227, 228, 229, 212, 221, /* 720 */ 227, 228, 229, 81, 81, 101, 102, 103, 195, 105,
/* 730 */ 208, 183, 216, 226, 227, 228, 229, 12, 13, 175, /* 730 */ 81, 195, 258, 195, 247, 202, 20, 181, 115, 210,
/* 740 */ 181, 195, 226, 227, 228, 229, 175, 22, 202, 220, /* 740 */ 202, 69, 116, 208, 181, 212, 20, 208, 104, 216,
/* 750 */ 20, 202, 18, 216, 246, 183, 181, 23, 212, 195, /* 750 */ 212, 69, 219, 81, 216, 0, 202, 219, 265, 226,
/* 760 */ 183, 175, 216, 38, 213, 258, 202, 259, 175, 35, /* 760 */ 227, 228, 229, 81, 226, 227, 228, 229, 0, 220,
/* 770 */ 69, 263, 226, 227, 228, 229, 212, 202, 183, 45, /* 770 */ 183, 21, 20, 69, 24, 25, 26, 27, 28, 29,
/* 780 */ 216, 265, 81, 219, 181, 20, 2, 216, 195, 69, /* 780 */ 30, 31, 32, 183, 107, 81, 183, 110, 111, 112,
/* 790 */ 226, 227, 228, 229, 177, 202, 12, 13, 14, 15, /* 790 */ 113, 114, 24, 25, 26, 27, 28, 29, 30, 31,
/* 800 */ 16, 81, 216, 181, 229, 212, 0, 195, 195, 216, /* 800 */ 32, 19, 175, 181, 49, 213, 51, 175, 183, 54,
/* 810 */ 195, 68, 219, 238, 239, 240, 241, 92, 243, 226, /* 810 */ 20, 69, 57, 177, 59, 33, 195, 62, 36, 181,
/* 820 */ 227, 228, 229, 80, 175, 195, 195, 195, 195, 104, /* 820 */ 69, 220, 195, 81, 42, 177, 44, 195, 49, 202,
/* 830 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 22, /* 830 */ 51, 202, 81, 54, 202, 69, 57, 175, 59, 212,
/* 840 */ 106, 69, 69, 195, 195, 69, 175, 33, 123, 124, /* 840 */ 195, 62, 195, 216, 212, 175, 195, 81, 216, 67,
/* 850 */ 36, 202, 175, 81, 81, 38, 42, 81, 44, 69, /* 850 */ 69, 195, 70, 226, 227, 228, 229, 195, 226, 227,
/* 860 */ 195, 212, 195, 195, 177, 216, 195, 220, 180, 213, /* 860 */ 228, 229, 81, 69, 202, 195, 12, 13, 14, 15,
/* 870 */ 69, 81, 195, 202, 175, 226, 227, 228, 229, 202, /* 870 */ 16, 195, 202, 195, 212, 81, 195, 180, 216, 195,
/* 880 */ 146, 67, 81, 212, 70, 202, 181, 216, 180, 212, /* 880 */ 195, 175, 212, 101, 195, 180, 216, 213, 226, 227,
/* 890 */ 20, 225, 154, 216, 195, 256, 217, 226, 227, 228, /* 890 */ 228, 229, 20, 225, 154, 256, 226, 227, 228, 229,
/* 900 */ 229, 202, 175, 226, 227, 228, 229, 202, 69, 92, /* 900 */ 118, 195, 153, 121, 175, 217, 216, 216, 202, 175,
/* 910 */ 175, 212, 69, 153, 216, 216, 124, 256, 161, 217, /* 910 */ 12, 13, 14, 15, 16, 256, 125, 217, 212, 216,
/* 920 */ 81, 104, 195, 216, 81, 226, 227, 228, 229, 202, /* 920 */ 161, 160, 216, 69, 195, 149, 253, 252, 148, 195,
/* 930 */ 195, 117, 216, 253, 229, 121, 252, 202, 175, 212, /* 930 */ 250, 202, 226, 227, 228, 229, 202, 145, 202, 20,
/* 940 */ 123, 124, 149, 216, 239, 240, 241, 212, 243, 160, /* 940 */ 115, 212, 249, 224, 175, 216, 212, 237, 165, 163,
/* 950 */ 148, 216, 249, 226, 227, 228, 229, 175, 195, 2, /* 950 */ 216, 68, 175, 169, 267, 226, 227, 228, 229, 181,
/* 960 */ 250, 226, 227, 228, 229, 202, 175, 145, 69, 12, /* 960 */ 226, 227, 228, 229, 195, 233, 119, 214, 180, 262,
/* 970 */ 13, 14, 15, 16, 20, 212, 69, 195, 224, 216, /* 970 */ 261, 202, 195, 217, 175, 217, 216, 202, 216, 202,
/* 980 */ 81, 202, 115, 237, 202, 175, 195, 169, 81, 226, /* 980 */ 202, 212, 180, 216, 213, 216, 191, 202, 68, 212,
/* 990 */ 227, 228, 229, 202, 212, 267, 165, 163, 216, 262, /* 990 */ 181, 198, 180, 216, 195, 226, 227, 228, 229, 177,
/* 1000 */ 261, 68, 233, 212, 69, 195, 119, 216, 226, 227, /* 1000 */ 189, 202, 175, 226, 227, 228, 229, 229, 189, 173,
/* 1010 */ 228, 229, 202, 175, 217, 216, 81, 226, 227, 228, /* 1010 */ 175, 212, 182, 0, 80, 216, 0, 239, 240, 241,
/* 1020 */ 229, 216, 212, 202, 217, 216, 216, 214, 181, 213, /* 1020 */ 115, 243, 195, 0, 0, 226, 227, 228, 229, 202,
/* 1030 */ 180, 191, 180, 195, 202, 68, 226, 227, 228, 229, /* 1030 */ 195, 0, 175, 0, 0, 0, 0, 202, 43, 212,
/* 1040 */ 202, 175, 198, 4, 181, 180, 177, 189, 189, 202, /* 1040 */ 175, 22, 0, 216, 0, 0, 0, 212, 0, 0,
/* 1050 */ 212, 173, 0, 182, 216, 80, 0, 0, 19, 115, /* 1050 */ 0, 216, 195, 226, 227, 228, 229, 0, 48, 202,
/* 1060 */ 0, 195, 0, 0, 226, 227, 228, 229, 202, 0, /* 1060 */ 195, 226, 227, 228, 229, 167, 168, 202, 0, 212,
/* 1070 */ 0, 0, 33, 0, 0, 36, 229, 22, 212, 0, /* 1070 */ 0, 33, 43, 216, 36, 35, 0, 212, 181, 38,
/* 1080 */ 41, 0, 216, 44, 0, 0, 239, 240, 241, 0, /* 1080 */ 42, 216, 44, 226, 227, 228, 229, 36, 0, 0,
/* 1090 */ 243, 43, 226, 227, 228, 229, 0, 48, 0, 0, /* 1090 */ 0, 226, 227, 228, 229, 77, 75, 57, 38, 202,
/* 1100 */ 49, 43, 51, 38, 36, 54, 67, 0, 57, 70, /* 1100 */ 38, 61, 22, 0, 38, 67, 0, 38, 70, 38,
/* 1110 */ 59, 0, 0, 62, 0, 12, 13, 14, 15, 16, /* 1110 */ 38, 71, 38, 73, 74, 38, 76, 2, 22, 0,
/* 1120 */ 77, 75, 22, 0, 38, 38, 38, 0, 38, 38, /* 1120 */ 22, 39, 82, 0, 22, 38, 229, 12, 13, 14,
/* 1130 */ 38, 38, 38, 0, 39, 22, 0, 22, 22, 38, /* 1130 */ 15, 16, 2, 0, 22, 0, 239, 240, 241, 22,
/* 1140 */ 0, 22, 0, 22, 20, 0, 0, 122, 0, 43, /* 1140 */ 243, 20, 12, 13, 14, 15, 16, 127, 0, 129,
/* 1150 */ 68, 117, 150, 81, 150, 144, 81, 81, 81, 81, /* 1150 */ 130, 131, 132, 133, 0, 117, 0, 43, 150, 121,
/* 1160 */ 80, 4, 150, 80, 2, 135, 69, 38, 38, 38, /* 1160 */ 68, 122, 81, 69, 117, 81, 81, 81, 69, 68,
/* 1170 */ 38, 69, 69, 68, 120, 38, 68, 38, 69, 69, /* 1170 */ 144, 80, 68, 80, 69, 68, 81, 69, 68, 4,
/* 1180 */ 0, 117, 22, 268, 80, 68, 68, 268, 268, 69, /* 1180 */ 150, 81, 69, 38, 38, 69, 2, 69, 38, 80,
/* 1190 */ 268, 69, 268, 268, 43, 69, 0, 0, 0, 38, /* 1190 */ 38, 38, 81, 150, 69, 38, 68, 124, 69, 68,
/* 1200 */ 268, 38, 268, 38, 69, 22, 81, 69, 268, 81, /* 1200 */ 80, 69, 68, 120, 68, 68, 0, 43, 68, 22,
/* 1210 */ 69, 68, 68, 38, 80, 68, 38, 68, 68, 38, /* 1210 */ 68, 38, 38, 69, 117, 68, 78, 38, 69, 80,
/* 1220 */ 68, 22, 268, 268, 68, 38, 22, 21, 69, 22, /* 1220 */ 69, 80, 79, 68, 38, 22, 68, 38, 69, 68,
/* 1230 */ 38, 78, 68, 38, 80, 80, 69, 79, 68, 268, /* 1230 */ 38, 69, 38, 68, 38, 38, 22, 68, 48, 68,
/* 1240 */ 69, 68, 22, 69, 68, 37, 69, 68, 38, 38, /* 1240 */ 68, 22, 47, 38, 22, 38, 38, 38, 38, 38,
/* 1250 */ 48, 38, 47, 68, 38, 38, 38, 38, 68, 38, /* 1250 */ 82, 38, 0, 38, 94, 38, 38, 94, 38, 38,
/* 1260 */ 94, 36, 94, 94, 82, 38, 94, 38, 68, 38, /* 1260 */ 94, 94, 38, 38, 38, 38, 38, 36, 0, 0,
/* 1270 */ 38, 38, 38, 38, 38, 38, 0, 38, 22, 22, /* 1270 */ 38, 37, 43, 0, 104, 22, 21, 268, 22, 22,
/* 1280 */ 21, 43, 20, 268, 268, 268, 268, 268, 268, 268, /* 1280 */ 21, 20, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1290 */ 104, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1290 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1300 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1300 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1310 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1310 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1320 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1320 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
...@@ -488,128 +487,127 @@ static const YYCODETYPE yy_lookahead[] = { ...@@ -488,128 +487,127 @@ static const YYCODETYPE yy_lookahead[] = {
/* 1420 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1420 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1430 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1430 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1440 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1440 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268,
/* 1450 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, /* 1450 */ 268, 268, 268, 268,
/* 1460 */ 268, 268, 268,
}; };
#define YY_SHIFT_COUNT (431) #define YY_SHIFT_COUNT (431)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (1276) #define YY_SHIFT_MAX (1273)
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 734, 168, 179, 336, 336, 336, 336, 330, 336, 336, /* 0 */ 569, 168, 179, 221, 221, 221, 221, 341, 221, 221,
/* 10 */ 481, 495, 140, 405, 481, 481, 481, 481, 481, 481, /* 10 */ 406, 412, 177, 369, 406, 406, 406, 406, 406, 406,
/* 20 */ 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, /* 20 */ 406, 406, 406, 406, 406, 406, 406, 406, 406, 406,
/* 30 */ 481, 481, 481, 15, 15, 15, 39, 725, 725, 31, /* 30 */ 406, 406, 406, 15, 15, 15, 152, 273, 273, 31,
/* 40 */ 31, 725, 31, 31, 20, 213, 253, 253, 136, 285, /* 40 */ 31, 273, 31, 31, 149, 184, 280, 280, 247, 397,
/* 50 */ 213, 31, 31, 213, 31, 213, 285, 213, 213, 31, /* 50 */ 184, 31, 31, 184, 31, 184, 397, 184, 184, 31,
/* 60 */ 351, 0, 13, 13, 448, 292, 205, 817, 1051, 817, /* 60 */ 377, 0, 13, 13, 677, 750, 1040, 548, 548, 548,
/* 70 */ 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, /* 70 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 80 */ 817, 817, 817, 817, 817, 817, 817, 817, 268, 33, /* 80 */ 548, 548, 548, 548, 548, 548, 548, 779, 202, 207,
/* 90 */ 124, 124, 124, 309, 391, 285, 213, 213, 213, 379, /* 90 */ 455, 455, 455, 229, 442, 397, 184, 184, 184, 308,
/* 100 */ 78, 78, 78, 78, 78, 96, 420, 284, 231, 141, /* 100 */ 78, 78, 78, 78, 78, 96, 755, 898, 417, 429,
/* 110 */ 262, 337, 502, 300, 455, 300, 358, 373, 432, 641, /* 110 */ 126, 578, 498, 121, 505, 121, 370, 258, 409, 716,
/* 120 */ 568, 599, 599, 641, 700, 20, 391, 730, 20, 20, /* 120 */ 623, 626, 626, 716, 726, 149, 442, 752, 149, 149,
/* 130 */ 641, 20, 765, 213, 213, 213, 213, 213, 213, 213, /* 130 */ 716, 149, 790, 184, 184, 184, 184, 184, 184, 184,
/* 140 */ 213, 213, 213, 213, 641, 765, 700, 351, 391, 730, /* 140 */ 184, 184, 184, 184, 716, 790, 726, 377, 442, 752,
/* 150 */ 351, 870, 738, 760, 792, 738, 760, 792, 792, 757, /* 150 */ 377, 872, 740, 749, 791, 740, 749, 791, 791, 759,
/* 160 */ 789, 793, 802, 822, 391, 954, 867, 818, 831, 834, /* 160 */ 761, 776, 780, 792, 442, 919, 825, 784, 783, 786,
/* 170 */ 933, 213, 760, 792, 792, 760, 792, 887, 391, 730, /* 170 */ 883, 184, 749, 791, 791, 749, 791, 847, 442, 752,
/* 180 */ 351, 379, 351, 391, 967, 641, 351, 765, 1291, 1291, /* 180 */ 377, 308, 377, 442, 920, 716, 377, 790, 1282, 1282,
/* 190 */ 1291, 1291, 48, 806, 547, 814, 1039, 148, 602, 784, /* 190 */ 1282, 1282, 48, 768, 782, 1038, 484, 507, 624, 1115,
/* 200 */ 957, 277, 1103, 476, 476, 476, 476, 476, 476, 476, /* 200 */ 1130, 1020, 854, 236, 236, 236, 236, 236, 236, 236,
/* 210 */ 402, 156, 2, 510, 510, 510, 510, 430, 446, 506, /* 210 */ 264, 156, 154, 130, 130, 130, 130, 510, 516, 564,
/* 220 */ 558, 512, 542, 550, 582, 103, 414, 526, 608, 471, /* 220 */ 590, 66, 328, 613, 546, 537, 573, 574, 522, 486,
/* 230 */ 321, 334, 597, 72, 701, 743, 720, 772, 773, 776, /* 230 */ 146, 471, 615, 570, 618, 630, 642, 643, 649, 672,
/* 240 */ 790, 539, 609, 801, 839, 843, 899, 907, 935, 578, /* 240 */ 682, 543, 644, 704, 742, 751, 766, 781, 794, 596,
/* 250 */ 1052, 975, 1056, 1057, 944, 1060, 1062, 1063, 1069, 1070, /* 250 */ 1013, 934, 1016, 1023, 905, 1024, 1031, 1033, 1034, 1035,
/* 260 */ 1071, 1055, 1073, 1074, 1079, 1081, 1084, 1085, 1089, 1048, /* 260 */ 1036, 1019, 1042, 1044, 1045, 1046, 1048, 1049, 1050, 995,
/* 270 */ 1096, 1049, 1098, 1099, 1065, 1068, 1058, 1107, 1111, 1112, /* 270 */ 1057, 1010, 1068, 1070, 1041, 1051, 1029, 1076, 1088, 1089,
/* 280 */ 1114, 1043, 1046, 1086, 1087, 1100, 1123, 1088, 1090, 1091, /* 280 */ 1090, 1018, 1021, 1060, 1062, 1080, 1103, 1066, 1069, 1071,
/* 290 */ 1092, 1093, 1094, 1127, 1113, 1133, 1115, 1095, 1136, 1116, /* 290 */ 1072, 1074, 1077, 1106, 1096, 1119, 1098, 1082, 1123, 1102,
/* 300 */ 1101, 1140, 1119, 1142, 1121, 1124, 1145, 1146, 1025, 1148, /* 300 */ 1087, 1133, 1112, 1135, 1117, 1121, 1148, 1154, 1039, 1156,
/* 310 */ 1082, 1106, 1034, 1072, 1075, 1002, 1097, 1076, 1102, 1105, /* 310 */ 1092, 1114, 1047, 1081, 1084, 1008, 1094, 1085, 1099, 1101,
/* 320 */ 1108, 1109, 1117, 1110, 1077, 1080, 1118, 1078, 1004, 1120, /* 320 */ 1104, 1105, 1107, 1108, 1086, 1091, 1110, 1095, 1030, 1113,
/* 330 */ 1122, 1083, 1011, 1125, 1104, 1126, 1128, 1012, 1157, 1129, /* 330 */ 1116, 1093, 1026, 1100, 1109, 1118, 1111, 1043, 1175, 1145,
/* 340 */ 1130, 1131, 1132, 1137, 1139, 1162, 1030, 1134, 1135, 1143, /* 340 */ 1146, 1150, 1152, 1153, 1157, 1184, 1073, 1120, 1125, 1128,
/* 350 */ 1144, 1138, 1141, 1147, 1149, 1054, 1150, 1180, 1151, 1064, /* 350 */ 1131, 1129, 1132, 1134, 1136, 1083, 1137, 1206, 1164, 1097,
/* 360 */ 1152, 1153, 1154, 1155, 1160, 1156, 1158, 1159, 1161, 1163, /* 360 */ 1140, 1138, 1139, 1141, 1187, 1142, 1143, 1144, 1173, 1174,
/* 370 */ 1164, 1167, 1165, 1170, 1171, 1175, 1173, 1174, 1178, 1176, /* 370 */ 1147, 1149, 1179, 1155, 1151, 1186, 1158, 1159, 1189, 1161,
/* 380 */ 1177, 1181, 1179, 1166, 1168, 1169, 1172, 1183, 1182, 1185, /* 380 */ 1162, 1192, 1165, 1160, 1163, 1166, 1167, 1203, 1168, 1169,
/* 390 */ 1187, 1186, 1190, 1200, 1192, 1195, 1204, 1202, 1205, 1207, /* 390 */ 1194, 1170, 1171, 1172, 1196, 1197, 1214, 1190, 1195, 1219,
/* 400 */ 1210, 1211, 1213, 1216, 1217, 1218, 1219, 1220, 1221, 1227, /* 400 */ 1205, 1207, 1208, 1209, 1210, 1211, 1213, 1222, 1215, 1217,
/* 410 */ 1229, 1231, 1232, 1233, 1234, 1235, 1236, 1196, 1237, 1225, /* 410 */ 1218, 1220, 1221, 1224, 1225, 1226, 1227, 1252, 1228, 1231,
/* 420 */ 1238, 1197, 1239, 1208, 1198, 1276, 1199, 1206, 1256, 1257, /* 420 */ 1229, 1268, 1232, 1234, 1269, 1273, 1253, 1255, 1256, 1257,
/* 430 */ 1259, 1262, /* 430 */ 1259, 1261,
}; };
#define YY_REDUCE_COUNT (191) #define YY_REDUCE_COUNT (191)
#define YY_REDUCE_MIN (-225) #define YY_REDUCE_MIN (-225)
#define YY_REDUCE_MAX (878) #define YY_REDUCE_MAX (897)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
/* 0 */ 508, -172, -16, 29, 99, 135, 165, 221, 311, 341, /* 0 */ 63, -172, -16, 104, 28, 140, 176, 256, 331, 367,
/* 10 */ -134, 399, 411, 460, 498, 507, 516, 564, 593, 469, /* 10 */ -134, 403, 382, 432, 451, 474, 493, 533, 538, 627,
/* 20 */ 546, 649, 671, 677, 699, 727, 735, 763, 782, 791, /* 20 */ 632, 662, 670, 706, 729, 734, 769, 777, 799, 827,
/* 30 */ 810, 838, 866, 575, 705, 847, -179, -177, 45, -150, /* 30 */ 835, 857, 865, 214, 778, 897, -179, -177, -14, -150,
/* 40 */ 41, -216, -149, -116, -182, -12, -178, 26, -225, -207, /* 40 */ 88, -216, -149, -116, -182, -12, -178, 3, -225, -207,
/* 50 */ -114, 1, 155, 74, 260, 151, -140, 178, 269, 318, /* 50 */ -114, 35, 155, 81, 162, 227, -140, 123, 253, 213,
/* 60 */ 241, -212, -212, -212, 35, 21, 43, 54, -109, 137, /* 60 */ 249, -212, -212, -212, -148, 8, 107, -56, 12, 92,
/* 70 */ 210, 254, 372, 381, 407, 415, 421, 423, 461, 474, /* 70 */ 105, 142, 144, 211, 225, 226, 233, 260, 263, 284,
/* 80 */ 478, 483, 485, 492, 500, 537, 571, 586, 153, -68, /* 80 */ 285, 296, 306, 330, 333, 334, 339, -109, -46, 313,
/* 90 */ 65, 188, 272, 55, 230, 127, 82, 229, 359, -103, /* 90 */ 113, 138, 297, 347, 261, -133, 350, 241, 283, -73,
/* 100 */ -192, -187, 270, 335, 348, 305, 363, 286, 294, 388, /* 100 */ -192, -187, 295, 303, 375, 414, 481, 423, 342, 478,
/* 110 */ 333, 408, 387, 377, 377, 377, 443, 385, 422, 511, /* 110 */ 440, 514, 468, 470, 470, 470, 536, 457, 487, 556,
/* 120 */ 496, 514, 522, 559, 529, 548, 549, 551, 572, 577, /* 120 */ 529, 535, 539, 563, 549, 587, 554, 592, 600, 603,
/* 130 */ 603, 595, 617, 612, 613, 615, 630, 631, 632, 633, /* 130 */ 622, 625, 636, 621, 645, 647, 651, 656, 676, 678,
/* 140 */ 648, 665, 667, 668, 622, 687, 647, 688, 683, 656, /* 140 */ 681, 684, 685, 689, 638, 648, 601, 697, 629, 674,
/* 150 */ 708, 666, 639, 679, 698, 661, 702, 707, 716, 680, /* 150 */ 705, 668, 639, 688, 690, 659, 700, 691, 703, 673,
/* 160 */ 684, 710, 703, 377, 779, 754, 746, 728, 737, 739, /* 160 */ 675, 680, 693, 470, 736, 719, 710, 687, 707, 709,
/* 170 */ 769, 443, 797, 799, 805, 807, 809, 813, 821, 816, /* 170 */ 732, 536, 756, 760, 762, 758, 767, 753, 775, 771,
/* 180 */ 850, 840, 852, 832, 844, 863, 865, 869, 858, 859, /* 180 */ 788, 795, 802, 785, 793, 809, 812, 822, 811, 819,
/* 190 */ 871, 878, /* 190 */ 830, 836,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 0 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 10 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 10 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 20 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 20 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 30 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 30 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 40 */ 1019, 1019, 1019, 1019, 1072, 1019, 1019, 1019, 1019, 1019, /* 40 */ 1023, 1023, 1023, 1023, 1076, 1023, 1023, 1023, 1023, 1023,
/* 50 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 50 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 60 */ 1070, 1019, 1287, 1019, 1185, 1019, 1019, 1019, 1019, 1019, /* 60 */ 1074, 1023, 1293, 1023, 1189, 1023, 1023, 1023, 1023, 1023,
/* 70 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 70 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 80 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1072, /* 80 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1076,
/* 90 */ 1298, 1298, 1298, 1070, 1019, 1019, 1019, 1019, 1019, 1154, /* 90 */ 1304, 1304, 1304, 1074, 1023, 1023, 1023, 1023, 1023, 1158,
/* 100 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1362, 1019, 1107, /* 100 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1368, 1023, 1111,
/* 110 */ 1322, 1019, 1314, 1290, 1304, 1291, 1019, 1347, 1307, 1019, /* 110 */ 1328, 1023, 1320, 1296, 1310, 1297, 1023, 1353, 1313, 1023,
/* 120 */ 1190, 1187, 1187, 1019, 1019, 1072, 1019, 1019, 1072, 1072, /* 120 */ 1194, 1191, 1191, 1023, 1023, 1076, 1023, 1023, 1076, 1076,
/* 130 */ 1019, 1072, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 130 */ 1023, 1076, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 140 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1070, 1019, 1019, /* 140 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1074, 1023, 1023,
/* 150 */ 1070, 1019, 1329, 1327, 1019, 1329, 1327, 1019, 1019, 1341, /* 150 */ 1074, 1023, 1335, 1333, 1023, 1335, 1333, 1023, 1023, 1347,
/* 160 */ 1337, 1320, 1318, 1304, 1019, 1019, 1019, 1365, 1353, 1349, /* 160 */ 1343, 1326, 1324, 1310, 1023, 1023, 1023, 1371, 1359, 1355,
/* 170 */ 1019, 1019, 1327, 1019, 1019, 1327, 1019, 1198, 1019, 1019, /* 170 */ 1023, 1023, 1333, 1023, 1023, 1333, 1023, 1202, 1023, 1023,
/* 180 */ 1070, 1019, 1070, 1019, 1123, 1019, 1070, 1019, 1157, 1157, /* 180 */ 1074, 1023, 1074, 1023, 1127, 1023, 1074, 1023, 1161, 1161,
/* 190 */ 1073, 1024, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 190 */ 1077, 1028, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 200 */ 1019, 1019, 1019, 1252, 1340, 1339, 1251, 1264, 1263, 1262, /* 200 */ 1023, 1023, 1023, 1258, 1346, 1345, 1257, 1270, 1269, 1268,
/* 210 */ 1019, 1019, 1019, 1246, 1247, 1245, 1244, 1019, 1019, 1019, /* 210 */ 1023, 1023, 1023, 1252, 1253, 1251, 1250, 1023, 1023, 1023,
/* 220 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1288, 1019, /* 220 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1294, 1023,
/* 230 */ 1350, 1354, 1019, 1019, 1019, 1230, 1019, 1019, 1019, 1019, /* 230 */ 1356, 1360, 1023, 1023, 1023, 1236, 1023, 1023, 1023, 1023,
/* 240 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 240 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 250 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 250 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 260 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 260 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 270 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 270 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 280 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 280 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 290 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 290 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 300 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 300 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 310 */ 1019, 1019, 1019, 1311, 1321, 1019, 1019, 1019, 1019, 1019, /* 310 */ 1023, 1023, 1023, 1317, 1327, 1023, 1023, 1023, 1023, 1023,
/* 320 */ 1019, 1019, 1019, 1019, 1019, 1230, 1019, 1338, 1019, 1297, /* 320 */ 1023, 1023, 1023, 1023, 1023, 1236, 1023, 1344, 1023, 1303,
/* 330 */ 1293, 1019, 1019, 1289, 1019, 1019, 1348, 1019, 1019, 1019, /* 330 */ 1299, 1023, 1023, 1295, 1023, 1023, 1354, 1023, 1023, 1023,
/* 340 */ 1019, 1019, 1019, 1019, 1019, 1283, 1019, 1019, 1019, 1019, /* 340 */ 1023, 1023, 1023, 1023, 1023, 1289, 1023, 1023, 1023, 1023,
/* 350 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 350 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 360 */ 1019, 1019, 1229, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 360 */ 1023, 1023, 1235, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 370 */ 1151, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 370 */ 1155, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 380 */ 1019, 1019, 1019, 1136, 1134, 1133, 1132, 1019, 1129, 1019, /* 380 */ 1023, 1023, 1023, 1140, 1138, 1137, 1136, 1023, 1133, 1023,
/* 390 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 390 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 400 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 400 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 410 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 410 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 420 */ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, /* 420 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
/* 430 */ 1019, 1019, /* 430 */ 1023, 1023,
}; };
/********** End of lemon-generated parsing tables *****************************/ /********** End of lemon-generated parsing tables *****************************/
...@@ -840,18 +838,18 @@ static const char *const yyTokenName[] = { ...@@ -840,18 +838,18 @@ static const char *const yyTokenName[] = {
/* 121 */ "TOPIC", /* 121 */ "TOPIC",
/* 122 */ "AS", /* 122 */ "AS",
/* 123 */ "NK_BOOL", /* 123 */ "NK_BOOL",
/* 124 */ "NK_VARIABLE", /* 124 */ "NULL",
/* 125 */ "NK_UNDERLINE", /* 125 */ "NK_VARIABLE",
/* 126 */ "ROWTS", /* 126 */ "NK_UNDERLINE",
/* 127 */ "TBNAME", /* 127 */ "ROWTS",
/* 128 */ "QSTARTTS", /* 128 */ "TBNAME",
/* 129 */ "QENDTS", /* 129 */ "QSTARTTS",
/* 130 */ "WSTARTTS", /* 130 */ "QENDTS",
/* 131 */ "WENDTS", /* 131 */ "WSTARTTS",
/* 132 */ "WDURATION", /* 132 */ "WENDTS",
/* 133 */ "BETWEEN", /* 133 */ "WDURATION",
/* 134 */ "IS", /* 134 */ "BETWEEN",
/* 135 */ "NULL", /* 135 */ "IS",
/* 136 */ "NK_LT", /* 136 */ "NK_LT",
/* 137 */ "NK_GT", /* 137 */ "NK_GT",
/* 138 */ "NK_LE", /* 138 */ "NK_LE",
...@@ -1183,160 +1181,162 @@ static const char *const yyRuleName[] = { ...@@ -1183,160 +1181,162 @@ static const char *const yyRuleName[] = {
/* 189 */ "literal ::= NK_BOOL", /* 189 */ "literal ::= NK_BOOL",
/* 190 */ "literal ::= TIMESTAMP NK_STRING", /* 190 */ "literal ::= TIMESTAMP NK_STRING",
/* 191 */ "literal ::= duration_literal", /* 191 */ "literal ::= duration_literal",
/* 192 */ "duration_literal ::= NK_VARIABLE", /* 192 */ "literal ::= NULL",
/* 193 */ "signed ::= NK_INTEGER", /* 193 */ "duration_literal ::= NK_VARIABLE",
/* 194 */ "signed ::= NK_PLUS NK_INTEGER", /* 194 */ "signed ::= NK_INTEGER",
/* 195 */ "signed ::= NK_MINUS NK_INTEGER", /* 195 */ "signed ::= NK_PLUS NK_INTEGER",
/* 196 */ "signed ::= NK_FLOAT", /* 196 */ "signed ::= NK_MINUS NK_INTEGER",
/* 197 */ "signed ::= NK_PLUS NK_FLOAT", /* 197 */ "signed ::= NK_FLOAT",
/* 198 */ "signed ::= NK_MINUS NK_FLOAT", /* 198 */ "signed ::= NK_PLUS NK_FLOAT",
/* 199 */ "signed_literal ::= signed", /* 199 */ "signed ::= NK_MINUS NK_FLOAT",
/* 200 */ "signed_literal ::= NK_STRING", /* 200 */ "signed_literal ::= signed",
/* 201 */ "signed_literal ::= NK_BOOL", /* 201 */ "signed_literal ::= NK_STRING",
/* 202 */ "signed_literal ::= TIMESTAMP NK_STRING", /* 202 */ "signed_literal ::= NK_BOOL",
/* 203 */ "signed_literal ::= duration_literal", /* 203 */ "signed_literal ::= TIMESTAMP NK_STRING",
/* 204 */ "literal_list ::= signed_literal", /* 204 */ "signed_literal ::= duration_literal",
/* 205 */ "literal_list ::= literal_list NK_COMMA signed_literal", /* 205 */ "signed_literal ::= NULL",
/* 206 */ "db_name ::= NK_ID", /* 206 */ "literal_list ::= signed_literal",
/* 207 */ "table_name ::= NK_ID", /* 207 */ "literal_list ::= literal_list NK_COMMA signed_literal",
/* 208 */ "column_name ::= NK_ID", /* 208 */ "db_name ::= NK_ID",
/* 209 */ "function_name ::= NK_ID", /* 209 */ "table_name ::= NK_ID",
/* 210 */ "table_alias ::= NK_ID", /* 210 */ "column_name ::= NK_ID",
/* 211 */ "column_alias ::= NK_ID", /* 211 */ "function_name ::= NK_ID",
/* 212 */ "user_name ::= NK_ID", /* 212 */ "table_alias ::= NK_ID",
/* 213 */ "index_name ::= NK_ID", /* 213 */ "column_alias ::= NK_ID",
/* 214 */ "topic_name ::= NK_ID", /* 214 */ "user_name ::= NK_ID",
/* 215 */ "expression ::= literal", /* 215 */ "index_name ::= NK_ID",
/* 216 */ "expression ::= pseudo_column", /* 216 */ "topic_name ::= NK_ID",
/* 217 */ "expression ::= column_reference", /* 217 */ "expression ::= literal",
/* 218 */ "expression ::= function_name NK_LP expression_list NK_RP", /* 218 */ "expression ::= pseudo_column",
/* 219 */ "expression ::= function_name NK_LP NK_STAR NK_RP", /* 219 */ "expression ::= column_reference",
/* 220 */ "expression ::= subquery", /* 220 */ "expression ::= function_name NK_LP expression_list NK_RP",
/* 221 */ "expression ::= NK_LP expression NK_RP", /* 221 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
/* 222 */ "expression ::= NK_PLUS expression", /* 222 */ "expression ::= subquery",
/* 223 */ "expression ::= NK_MINUS expression", /* 223 */ "expression ::= NK_LP expression NK_RP",
/* 224 */ "expression ::= expression NK_PLUS expression", /* 224 */ "expression ::= NK_PLUS expression",
/* 225 */ "expression ::= expression NK_MINUS expression", /* 225 */ "expression ::= NK_MINUS expression",
/* 226 */ "expression ::= expression NK_STAR expression", /* 226 */ "expression ::= expression NK_PLUS expression",
/* 227 */ "expression ::= expression NK_SLASH expression", /* 227 */ "expression ::= expression NK_MINUS expression",
/* 228 */ "expression ::= expression NK_REM expression", /* 228 */ "expression ::= expression NK_STAR expression",
/* 229 */ "expression_list ::= expression", /* 229 */ "expression ::= expression NK_SLASH expression",
/* 230 */ "expression_list ::= expression_list NK_COMMA expression", /* 230 */ "expression ::= expression NK_REM expression",
/* 231 */ "column_reference ::= column_name", /* 231 */ "expression_list ::= expression",
/* 232 */ "column_reference ::= table_name NK_DOT column_name", /* 232 */ "expression_list ::= expression_list NK_COMMA expression",
/* 233 */ "pseudo_column ::= NK_UNDERLINE ROWTS", /* 233 */ "column_reference ::= column_name",
/* 234 */ "pseudo_column ::= TBNAME", /* 234 */ "column_reference ::= table_name NK_DOT column_name",
/* 235 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", /* 235 */ "pseudo_column ::= NK_UNDERLINE ROWTS",
/* 236 */ "pseudo_column ::= NK_UNDERLINE QENDTS", /* 236 */ "pseudo_column ::= TBNAME",
/* 237 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", /* 237 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS",
/* 238 */ "pseudo_column ::= NK_UNDERLINE WENDTS", /* 238 */ "pseudo_column ::= NK_UNDERLINE QENDTS",
/* 239 */ "pseudo_column ::= NK_UNDERLINE WDURATION", /* 239 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS",
/* 240 */ "predicate ::= expression compare_op expression", /* 240 */ "pseudo_column ::= NK_UNDERLINE WENDTS",
/* 241 */ "predicate ::= expression BETWEEN expression AND expression", /* 241 */ "pseudo_column ::= NK_UNDERLINE WDURATION",
/* 242 */ "predicate ::= expression NOT BETWEEN expression AND expression", /* 242 */ "predicate ::= expression compare_op expression",
/* 243 */ "predicate ::= expression IS NULL", /* 243 */ "predicate ::= expression BETWEEN expression AND expression",
/* 244 */ "predicate ::= expression IS NOT NULL", /* 244 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 245 */ "predicate ::= expression in_op in_predicate_value", /* 245 */ "predicate ::= expression IS NULL",
/* 246 */ "compare_op ::= NK_LT", /* 246 */ "predicate ::= expression IS NOT NULL",
/* 247 */ "compare_op ::= NK_GT", /* 247 */ "predicate ::= expression in_op in_predicate_value",
/* 248 */ "compare_op ::= NK_LE", /* 248 */ "compare_op ::= NK_LT",
/* 249 */ "compare_op ::= NK_GE", /* 249 */ "compare_op ::= NK_GT",
/* 250 */ "compare_op ::= NK_NE", /* 250 */ "compare_op ::= NK_LE",
/* 251 */ "compare_op ::= NK_EQ", /* 251 */ "compare_op ::= NK_GE",
/* 252 */ "compare_op ::= LIKE", /* 252 */ "compare_op ::= NK_NE",
/* 253 */ "compare_op ::= NOT LIKE", /* 253 */ "compare_op ::= NK_EQ",
/* 254 */ "compare_op ::= MATCH", /* 254 */ "compare_op ::= LIKE",
/* 255 */ "compare_op ::= NMATCH", /* 255 */ "compare_op ::= NOT LIKE",
/* 256 */ "in_op ::= IN", /* 256 */ "compare_op ::= MATCH",
/* 257 */ "in_op ::= NOT IN", /* 257 */ "compare_op ::= NMATCH",
/* 258 */ "in_predicate_value ::= NK_LP expression_list NK_RP", /* 258 */ "in_op ::= IN",
/* 259 */ "boolean_value_expression ::= boolean_primary", /* 259 */ "in_op ::= NOT IN",
/* 260 */ "boolean_value_expression ::= NOT boolean_primary", /* 260 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 261 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", /* 261 */ "boolean_value_expression ::= boolean_primary",
/* 262 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", /* 262 */ "boolean_value_expression ::= NOT boolean_primary",
/* 263 */ "boolean_primary ::= predicate", /* 263 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 264 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", /* 264 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 265 */ "common_expression ::= expression", /* 265 */ "boolean_primary ::= predicate",
/* 266 */ "common_expression ::= boolean_value_expression", /* 266 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 267 */ "from_clause ::= FROM table_reference_list", /* 267 */ "common_expression ::= expression",
/* 268 */ "table_reference_list ::= table_reference", /* 268 */ "common_expression ::= boolean_value_expression",
/* 269 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", /* 269 */ "from_clause ::= FROM table_reference_list",
/* 270 */ "table_reference ::= table_primary", /* 270 */ "table_reference_list ::= table_reference",
/* 271 */ "table_reference ::= joined_table", /* 271 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 272 */ "table_primary ::= table_name alias_opt", /* 272 */ "table_reference ::= table_primary",
/* 273 */ "table_primary ::= db_name NK_DOT table_name alias_opt", /* 273 */ "table_reference ::= joined_table",
/* 274 */ "table_primary ::= subquery alias_opt", /* 274 */ "table_primary ::= table_name alias_opt",
/* 275 */ "table_primary ::= parenthesized_joined_table", /* 275 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 276 */ "alias_opt ::=", /* 276 */ "table_primary ::= subquery alias_opt",
/* 277 */ "alias_opt ::= table_alias", /* 277 */ "table_primary ::= parenthesized_joined_table",
/* 278 */ "alias_opt ::= AS table_alias", /* 278 */ "alias_opt ::=",
/* 279 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", /* 279 */ "alias_opt ::= table_alias",
/* 280 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", /* 280 */ "alias_opt ::= AS table_alias",
/* 281 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", /* 281 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 282 */ "join_type ::=", /* 282 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 283 */ "join_type ::= INNER", /* 283 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 284 */ "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", /* 284 */ "join_type ::=",
/* 285 */ "set_quantifier_opt ::=", /* 285 */ "join_type ::= INNER",
/* 286 */ "set_quantifier_opt ::= DISTINCT", /* 286 */ "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",
/* 287 */ "set_quantifier_opt ::= ALL", /* 287 */ "set_quantifier_opt ::=",
/* 288 */ "select_list ::= NK_STAR", /* 288 */ "set_quantifier_opt ::= DISTINCT",
/* 289 */ "select_list ::= select_sublist", /* 289 */ "set_quantifier_opt ::= ALL",
/* 290 */ "select_sublist ::= select_item", /* 290 */ "select_list ::= NK_STAR",
/* 291 */ "select_sublist ::= select_sublist NK_COMMA select_item", /* 291 */ "select_list ::= select_sublist",
/* 292 */ "select_item ::= common_expression", /* 292 */ "select_sublist ::= select_item",
/* 293 */ "select_item ::= common_expression column_alias", /* 293 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 294 */ "select_item ::= common_expression AS column_alias", /* 294 */ "select_item ::= common_expression",
/* 295 */ "select_item ::= table_name NK_DOT NK_STAR", /* 295 */ "select_item ::= common_expression column_alias",
/* 296 */ "where_clause_opt ::=", /* 296 */ "select_item ::= common_expression AS column_alias",
/* 297 */ "where_clause_opt ::= WHERE search_condition", /* 297 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 298 */ "partition_by_clause_opt ::=", /* 298 */ "where_clause_opt ::=",
/* 299 */ "partition_by_clause_opt ::= PARTITION BY expression_list", /* 299 */ "where_clause_opt ::= WHERE search_condition",
/* 300 */ "twindow_clause_opt ::=", /* 300 */ "partition_by_clause_opt ::=",
/* 301 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", /* 301 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 302 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", /* 302 */ "twindow_clause_opt ::=",
/* 303 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", /* 303 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
/* 304 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", /* 304 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
/* 305 */ "sliding_opt ::=", /* 305 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 306 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", /* 306 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 307 */ "fill_opt ::=", /* 307 */ "sliding_opt ::=",
/* 308 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", /* 308 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 309 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", /* 309 */ "fill_opt ::=",
/* 310 */ "fill_mode ::= NONE", /* 310 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 311 */ "fill_mode ::= PREV", /* 311 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 312 */ "fill_mode ::= NULL", /* 312 */ "fill_mode ::= NONE",
/* 313 */ "fill_mode ::= LINEAR", /* 313 */ "fill_mode ::= PREV",
/* 314 */ "fill_mode ::= NEXT", /* 314 */ "fill_mode ::= NULL",
/* 315 */ "group_by_clause_opt ::=", /* 315 */ "fill_mode ::= LINEAR",
/* 316 */ "group_by_clause_opt ::= GROUP BY group_by_list", /* 316 */ "fill_mode ::= NEXT",
/* 317 */ "group_by_list ::= expression", /* 317 */ "group_by_clause_opt ::=",
/* 318 */ "group_by_list ::= group_by_list NK_COMMA expression", /* 318 */ "group_by_clause_opt ::= GROUP BY group_by_list",
/* 319 */ "having_clause_opt ::=", /* 319 */ "group_by_list ::= expression",
/* 320 */ "having_clause_opt ::= HAVING search_condition", /* 320 */ "group_by_list ::= group_by_list NK_COMMA expression",
/* 321 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", /* 321 */ "having_clause_opt ::=",
/* 322 */ "query_expression_body ::= query_primary", /* 322 */ "having_clause_opt ::= HAVING search_condition",
/* 323 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", /* 323 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 324 */ "query_primary ::= query_specification", /* 324 */ "query_expression_body ::= query_primary",
/* 325 */ "order_by_clause_opt ::=", /* 325 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 326 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", /* 326 */ "query_primary ::= query_specification",
/* 327 */ "slimit_clause_opt ::=", /* 327 */ "order_by_clause_opt ::=",
/* 328 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", /* 328 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 329 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", /* 329 */ "slimit_clause_opt ::=",
/* 330 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", /* 330 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 331 */ "limit_clause_opt ::=", /* 331 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 332 */ "limit_clause_opt ::= LIMIT NK_INTEGER", /* 332 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 333 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", /* 333 */ "limit_clause_opt ::=",
/* 334 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", /* 334 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 335 */ "subquery ::= NK_LP query_expression NK_RP", /* 335 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 336 */ "search_condition ::= common_expression", /* 336 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 337 */ "sort_specification_list ::= sort_specification", /* 337 */ "subquery ::= NK_LP query_expression NK_RP",
/* 338 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", /* 338 */ "search_condition ::= common_expression",
/* 339 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", /* 339 */ "sort_specification_list ::= sort_specification",
/* 340 */ "ordering_specification_opt ::=", /* 340 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 341 */ "ordering_specification_opt ::= ASC", /* 341 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 342 */ "ordering_specification_opt ::= DESC", /* 342 */ "ordering_specification_opt ::=",
/* 343 */ "null_ordering_opt ::=", /* 343 */ "ordering_specification_opt ::= ASC",
/* 344 */ "null_ordering_opt ::= NULLS FIRST", /* 344 */ "ordering_specification_opt ::= DESC",
/* 345 */ "null_ordering_opt ::= NULLS LAST", /* 345 */ "null_ordering_opt ::=",
/* 346 */ "null_ordering_opt ::= NULLS FIRST",
/* 347 */ "null_ordering_opt ::= NULLS LAST",
}; };
#endif /* NDEBUG */ #endif /* NDEBUG */
...@@ -2093,160 +2093,162 @@ static const struct { ...@@ -2093,160 +2093,162 @@ static const struct {
{ 175, -1 }, /* (189) literal ::= NK_BOOL */ { 175, -1 }, /* (189) literal ::= NK_BOOL */
{ 175, -2 }, /* (190) literal ::= TIMESTAMP NK_STRING */ { 175, -2 }, /* (190) literal ::= TIMESTAMP NK_STRING */
{ 175, -1 }, /* (191) literal ::= duration_literal */ { 175, -1 }, /* (191) literal ::= duration_literal */
{ 216, -1 }, /* (192) duration_literal ::= NK_VARIABLE */ { 175, -1 }, /* (192) literal ::= NULL */
{ 222, -1 }, /* (193) signed ::= NK_INTEGER */ { 216, -1 }, /* (193) duration_literal ::= NK_VARIABLE */
{ 222, -2 }, /* (194) signed ::= NK_PLUS NK_INTEGER */ { 222, -1 }, /* (194) signed ::= NK_INTEGER */
{ 222, -2 }, /* (195) signed ::= NK_MINUS NK_INTEGER */ { 222, -2 }, /* (195) signed ::= NK_PLUS NK_INTEGER */
{ 222, -1 }, /* (196) signed ::= NK_FLOAT */ { 222, -2 }, /* (196) signed ::= NK_MINUS NK_INTEGER */
{ 222, -2 }, /* (197) signed ::= NK_PLUS NK_FLOAT */ { 222, -1 }, /* (197) signed ::= NK_FLOAT */
{ 222, -2 }, /* (198) signed ::= NK_MINUS NK_FLOAT */ { 222, -2 }, /* (198) signed ::= NK_PLUS NK_FLOAT */
{ 223, -1 }, /* (199) signed_literal ::= signed */ { 222, -2 }, /* (199) signed ::= NK_MINUS NK_FLOAT */
{ 223, -1 }, /* (200) signed_literal ::= NK_STRING */ { 223, -1 }, /* (200) signed_literal ::= signed */
{ 223, -1 }, /* (201) signed_literal ::= NK_BOOL */ { 223, -1 }, /* (201) signed_literal ::= NK_STRING */
{ 223, -2 }, /* (202) signed_literal ::= TIMESTAMP NK_STRING */ { 223, -1 }, /* (202) signed_literal ::= NK_BOOL */
{ 223, -1 }, /* (203) signed_literal ::= duration_literal */ { 223, -2 }, /* (203) signed_literal ::= TIMESTAMP NK_STRING */
{ 199, -1 }, /* (204) literal_list ::= signed_literal */ { 223, -1 }, /* (204) signed_literal ::= duration_literal */
{ 199, -3 }, /* (205) literal_list ::= literal_list NK_COMMA signed_literal */ { 223, -1 }, /* (205) signed_literal ::= NULL */
{ 181, -1 }, /* (206) db_name ::= NK_ID */ { 199, -1 }, /* (206) literal_list ::= signed_literal */
{ 202, -1 }, /* (207) table_name ::= NK_ID */ { 199, -3 }, /* (207) literal_list ::= literal_list NK_COMMA signed_literal */
{ 195, -1 }, /* (208) column_name ::= NK_ID */ { 181, -1 }, /* (208) db_name ::= NK_ID */
{ 212, -1 }, /* (209) function_name ::= NK_ID */ { 202, -1 }, /* (209) table_name ::= NK_ID */
{ 224, -1 }, /* (210) table_alias ::= NK_ID */ { 195, -1 }, /* (210) column_name ::= NK_ID */
{ 225, -1 }, /* (211) column_alias ::= NK_ID */ { 212, -1 }, /* (211) function_name ::= NK_ID */
{ 177, -1 }, /* (212) user_name ::= NK_ID */ { 224, -1 }, /* (212) table_alias ::= NK_ID */
{ 213, -1 }, /* (213) index_name ::= NK_ID */ { 225, -1 }, /* (213) column_alias ::= NK_ID */
{ 220, -1 }, /* (214) topic_name ::= NK_ID */ { 177, -1 }, /* (214) user_name ::= NK_ID */
{ 226, -1 }, /* (215) expression ::= literal */ { 213, -1 }, /* (215) index_name ::= NK_ID */
{ 226, -1 }, /* (216) expression ::= pseudo_column */ { 220, -1 }, /* (216) topic_name ::= NK_ID */
{ 226, -1 }, /* (217) expression ::= column_reference */ { 226, -1 }, /* (217) expression ::= literal */
{ 226, -4 }, /* (218) expression ::= function_name NK_LP expression_list NK_RP */ { 226, -1 }, /* (218) expression ::= pseudo_column */
{ 226, -4 }, /* (219) expression ::= function_name NK_LP NK_STAR NK_RP */ { 226, -1 }, /* (219) expression ::= column_reference */
{ 226, -1 }, /* (220) expression ::= subquery */ { 226, -4 }, /* (220) expression ::= function_name NK_LP expression_list NK_RP */
{ 226, -3 }, /* (221) expression ::= NK_LP expression NK_RP */ { 226, -4 }, /* (221) expression ::= function_name NK_LP NK_STAR NK_RP */
{ 226, -2 }, /* (222) expression ::= NK_PLUS expression */ { 226, -1 }, /* (222) expression ::= subquery */
{ 226, -2 }, /* (223) expression ::= NK_MINUS expression */ { 226, -3 }, /* (223) expression ::= NK_LP expression NK_RP */
{ 226, -3 }, /* (224) expression ::= expression NK_PLUS expression */ { 226, -2 }, /* (224) expression ::= NK_PLUS expression */
{ 226, -3 }, /* (225) expression ::= expression NK_MINUS expression */ { 226, -2 }, /* (225) expression ::= NK_MINUS expression */
{ 226, -3 }, /* (226) expression ::= expression NK_STAR expression */ { 226, -3 }, /* (226) expression ::= expression NK_PLUS expression */
{ 226, -3 }, /* (227) expression ::= expression NK_SLASH expression */ { 226, -3 }, /* (227) expression ::= expression NK_MINUS expression */
{ 226, -3 }, /* (228) expression ::= expression NK_REM expression */ { 226, -3 }, /* (228) expression ::= expression NK_STAR expression */
{ 219, -1 }, /* (229) expression_list ::= expression */ { 226, -3 }, /* (229) expression ::= expression NK_SLASH expression */
{ 219, -3 }, /* (230) expression_list ::= expression_list NK_COMMA expression */ { 226, -3 }, /* (230) expression ::= expression NK_REM expression */
{ 228, -1 }, /* (231) column_reference ::= column_name */ { 219, -1 }, /* (231) expression_list ::= expression */
{ 228, -3 }, /* (232) column_reference ::= table_name NK_DOT column_name */ { 219, -3 }, /* (232) expression_list ::= expression_list NK_COMMA expression */
{ 227, -2 }, /* (233) pseudo_column ::= NK_UNDERLINE ROWTS */ { 228, -1 }, /* (233) column_reference ::= column_name */
{ 227, -1 }, /* (234) pseudo_column ::= TBNAME */ { 228, -3 }, /* (234) column_reference ::= table_name NK_DOT column_name */
{ 227, -2 }, /* (235) pseudo_column ::= NK_UNDERLINE QSTARTTS */ { 227, -2 }, /* (235) pseudo_column ::= NK_UNDERLINE ROWTS */
{ 227, -2 }, /* (236) pseudo_column ::= NK_UNDERLINE QENDTS */ { 227, -1 }, /* (236) pseudo_column ::= TBNAME */
{ 227, -2 }, /* (237) pseudo_column ::= NK_UNDERLINE WSTARTTS */ { 227, -2 }, /* (237) pseudo_column ::= NK_UNDERLINE QSTARTTS */
{ 227, -2 }, /* (238) pseudo_column ::= NK_UNDERLINE WENDTS */ { 227, -2 }, /* (238) pseudo_column ::= NK_UNDERLINE QENDTS */
{ 227, -2 }, /* (239) pseudo_column ::= NK_UNDERLINE WDURATION */ { 227, -2 }, /* (239) pseudo_column ::= NK_UNDERLINE WSTARTTS */
{ 230, -3 }, /* (240) predicate ::= expression compare_op expression */ { 227, -2 }, /* (240) pseudo_column ::= NK_UNDERLINE WENDTS */
{ 230, -5 }, /* (241) predicate ::= expression BETWEEN expression AND expression */ { 227, -2 }, /* (241) pseudo_column ::= NK_UNDERLINE WDURATION */
{ 230, -6 }, /* (242) predicate ::= expression NOT BETWEEN expression AND expression */ { 230, -3 }, /* (242) predicate ::= expression compare_op expression */
{ 230, -3 }, /* (243) predicate ::= expression IS NULL */ { 230, -5 }, /* (243) predicate ::= expression BETWEEN expression AND expression */
{ 230, -4 }, /* (244) predicate ::= expression IS NOT NULL */ { 230, -6 }, /* (244) predicate ::= expression NOT BETWEEN expression AND expression */
{ 230, -3 }, /* (245) predicate ::= expression in_op in_predicate_value */ { 230, -3 }, /* (245) predicate ::= expression IS NULL */
{ 231, -1 }, /* (246) compare_op ::= NK_LT */ { 230, -4 }, /* (246) predicate ::= expression IS NOT NULL */
{ 231, -1 }, /* (247) compare_op ::= NK_GT */ { 230, -3 }, /* (247) predicate ::= expression in_op in_predicate_value */
{ 231, -1 }, /* (248) compare_op ::= NK_LE */ { 231, -1 }, /* (248) compare_op ::= NK_LT */
{ 231, -1 }, /* (249) compare_op ::= NK_GE */ { 231, -1 }, /* (249) compare_op ::= NK_GT */
{ 231, -1 }, /* (250) compare_op ::= NK_NE */ { 231, -1 }, /* (250) compare_op ::= NK_LE */
{ 231, -1 }, /* (251) compare_op ::= NK_EQ */ { 231, -1 }, /* (251) compare_op ::= NK_GE */
{ 231, -1 }, /* (252) compare_op ::= LIKE */ { 231, -1 }, /* (252) compare_op ::= NK_NE */
{ 231, -2 }, /* (253) compare_op ::= NOT LIKE */ { 231, -1 }, /* (253) compare_op ::= NK_EQ */
{ 231, -1 }, /* (254) compare_op ::= MATCH */ { 231, -1 }, /* (254) compare_op ::= LIKE */
{ 231, -1 }, /* (255) compare_op ::= NMATCH */ { 231, -2 }, /* (255) compare_op ::= NOT LIKE */
{ 232, -1 }, /* (256) in_op ::= IN */ { 231, -1 }, /* (256) compare_op ::= MATCH */
{ 232, -2 }, /* (257) in_op ::= NOT IN */ { 231, -1 }, /* (257) compare_op ::= NMATCH */
{ 233, -3 }, /* (258) in_predicate_value ::= NK_LP expression_list NK_RP */ { 232, -1 }, /* (258) in_op ::= IN */
{ 234, -1 }, /* (259) boolean_value_expression ::= boolean_primary */ { 232, -2 }, /* (259) in_op ::= NOT IN */
{ 234, -2 }, /* (260) boolean_value_expression ::= NOT boolean_primary */ { 233, -3 }, /* (260) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 234, -3 }, /* (261) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { 234, -1 }, /* (261) boolean_value_expression ::= boolean_primary */
{ 234, -3 }, /* (262) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { 234, -2 }, /* (262) boolean_value_expression ::= NOT boolean_primary */
{ 235, -1 }, /* (263) boolean_primary ::= predicate */ { 234, -3 }, /* (263) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 235, -3 }, /* (264) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ { 234, -3 }, /* (264) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 236, -1 }, /* (265) common_expression ::= expression */ { 235, -1 }, /* (265) boolean_primary ::= predicate */
{ 236, -1 }, /* (266) common_expression ::= boolean_value_expression */ { 235, -3 }, /* (266) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 237, -2 }, /* (267) from_clause ::= FROM table_reference_list */ { 236, -1 }, /* (267) common_expression ::= expression */
{ 238, -1 }, /* (268) table_reference_list ::= table_reference */ { 236, -1 }, /* (268) common_expression ::= boolean_value_expression */
{ 238, -3 }, /* (269) table_reference_list ::= table_reference_list NK_COMMA table_reference */ { 237, -2 }, /* (269) from_clause ::= FROM table_reference_list */
{ 239, -1 }, /* (270) table_reference ::= table_primary */ { 238, -1 }, /* (270) table_reference_list ::= table_reference */
{ 239, -1 }, /* (271) table_reference ::= joined_table */ { 238, -3 }, /* (271) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 240, -2 }, /* (272) table_primary ::= table_name alias_opt */ { 239, -1 }, /* (272) table_reference ::= table_primary */
{ 240, -4 }, /* (273) table_primary ::= db_name NK_DOT table_name alias_opt */ { 239, -1 }, /* (273) table_reference ::= joined_table */
{ 240, -2 }, /* (274) table_primary ::= subquery alias_opt */ { 240, -2 }, /* (274) table_primary ::= table_name alias_opt */
{ 240, -1 }, /* (275) table_primary ::= parenthesized_joined_table */ { 240, -4 }, /* (275) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 242, 0 }, /* (276) alias_opt ::= */ { 240, -2 }, /* (276) table_primary ::= subquery alias_opt */
{ 242, -1 }, /* (277) alias_opt ::= table_alias */ { 240, -1 }, /* (277) table_primary ::= parenthesized_joined_table */
{ 242, -2 }, /* (278) alias_opt ::= AS table_alias */ { 242, 0 }, /* (278) alias_opt ::= */
{ 243, -3 }, /* (279) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ { 242, -1 }, /* (279) alias_opt ::= table_alias */
{ 243, -3 }, /* (280) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ { 242, -2 }, /* (280) alias_opt ::= AS table_alias */
{ 241, -6 }, /* (281) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { 243, -3 }, /* (281) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 244, 0 }, /* (282) join_type ::= */ { 243, -3 }, /* (282) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 244, -1 }, /* (283) join_type ::= INNER */ { 241, -6 }, /* (283) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 246, -9 }, /* (284) 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 */ { 244, 0 }, /* (284) join_type ::= */
{ 247, 0 }, /* (285) set_quantifier_opt ::= */ { 244, -1 }, /* (285) join_type ::= INNER */
{ 247, -1 }, /* (286) set_quantifier_opt ::= DISTINCT */ { 246, -9 }, /* (286) 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 */
{ 247, -1 }, /* (287) set_quantifier_opt ::= ALL */ { 247, 0 }, /* (287) set_quantifier_opt ::= */
{ 248, -1 }, /* (288) select_list ::= NK_STAR */ { 247, -1 }, /* (288) set_quantifier_opt ::= DISTINCT */
{ 248, -1 }, /* (289) select_list ::= select_sublist */ { 247, -1 }, /* (289) set_quantifier_opt ::= ALL */
{ 254, -1 }, /* (290) select_sublist ::= select_item */ { 248, -1 }, /* (290) select_list ::= NK_STAR */
{ 254, -3 }, /* (291) select_sublist ::= select_sublist NK_COMMA select_item */ { 248, -1 }, /* (291) select_list ::= select_sublist */
{ 255, -1 }, /* (292) select_item ::= common_expression */ { 254, -1 }, /* (292) select_sublist ::= select_item */
{ 255, -2 }, /* (293) select_item ::= common_expression column_alias */ { 254, -3 }, /* (293) select_sublist ::= select_sublist NK_COMMA select_item */
{ 255, -3 }, /* (294) select_item ::= common_expression AS column_alias */ { 255, -1 }, /* (294) select_item ::= common_expression */
{ 255, -3 }, /* (295) select_item ::= table_name NK_DOT NK_STAR */ { 255, -2 }, /* (295) select_item ::= common_expression column_alias */
{ 249, 0 }, /* (296) where_clause_opt ::= */ { 255, -3 }, /* (296) select_item ::= common_expression AS column_alias */
{ 249, -2 }, /* (297) where_clause_opt ::= WHERE search_condition */ { 255, -3 }, /* (297) select_item ::= table_name NK_DOT NK_STAR */
{ 250, 0 }, /* (298) partition_by_clause_opt ::= */ { 249, 0 }, /* (298) where_clause_opt ::= */
{ 250, -3 }, /* (299) partition_by_clause_opt ::= PARTITION BY expression_list */ { 249, -2 }, /* (299) where_clause_opt ::= WHERE search_condition */
{ 251, 0 }, /* (300) twindow_clause_opt ::= */ { 250, 0 }, /* (300) partition_by_clause_opt ::= */
{ 251, -6 }, /* (301) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { 250, -3 }, /* (301) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 251, -4 }, /* (302) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ { 251, 0 }, /* (302) twindow_clause_opt ::= */
{ 251, -6 }, /* (303) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { 251, -6 }, /* (303) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
{ 251, -8 }, /* (304) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { 251, -4 }, /* (304) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ 217, 0 }, /* (305) sliding_opt ::= */ { 251, -6 }, /* (305) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 217, -4 }, /* (306) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { 251, -8 }, /* (306) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 256, 0 }, /* (307) fill_opt ::= */ { 217, 0 }, /* (307) sliding_opt ::= */
{ 256, -4 }, /* (308) fill_opt ::= FILL NK_LP fill_mode NK_RP */ { 217, -4 }, /* (308) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 256, -6 }, /* (309) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { 256, 0 }, /* (309) fill_opt ::= */
{ 257, -1 }, /* (310) fill_mode ::= NONE */ { 256, -4 }, /* (310) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 257, -1 }, /* (311) fill_mode ::= PREV */ { 256, -6 }, /* (311) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 257, -1 }, /* (312) fill_mode ::= NULL */ { 257, -1 }, /* (312) fill_mode ::= NONE */
{ 257, -1 }, /* (313) fill_mode ::= LINEAR */ { 257, -1 }, /* (313) fill_mode ::= PREV */
{ 257, -1 }, /* (314) fill_mode ::= NEXT */ { 257, -1 }, /* (314) fill_mode ::= NULL */
{ 252, 0 }, /* (315) group_by_clause_opt ::= */ { 257, -1 }, /* (315) fill_mode ::= LINEAR */
{ 252, -3 }, /* (316) group_by_clause_opt ::= GROUP BY group_by_list */ { 257, -1 }, /* (316) fill_mode ::= NEXT */
{ 258, -1 }, /* (317) group_by_list ::= expression */ { 252, 0 }, /* (317) group_by_clause_opt ::= */
{ 258, -3 }, /* (318) group_by_list ::= group_by_list NK_COMMA expression */ { 252, -3 }, /* (318) group_by_clause_opt ::= GROUP BY group_by_list */
{ 253, 0 }, /* (319) having_clause_opt ::= */ { 258, -1 }, /* (319) group_by_list ::= expression */
{ 253, -2 }, /* (320) having_clause_opt ::= HAVING search_condition */ { 258, -3 }, /* (320) group_by_list ::= group_by_list NK_COMMA expression */
{ 221, -4 }, /* (321) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { 253, 0 }, /* (321) having_clause_opt ::= */
{ 259, -1 }, /* (322) query_expression_body ::= query_primary */ { 253, -2 }, /* (322) having_clause_opt ::= HAVING search_condition */
{ 259, -4 }, /* (323) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { 221, -4 }, /* (323) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 263, -1 }, /* (324) query_primary ::= query_specification */ { 259, -1 }, /* (324) query_expression_body ::= query_primary */
{ 260, 0 }, /* (325) order_by_clause_opt ::= */ { 259, -4 }, /* (325) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 260, -3 }, /* (326) order_by_clause_opt ::= ORDER BY sort_specification_list */ { 263, -1 }, /* (326) query_primary ::= query_specification */
{ 261, 0 }, /* (327) slimit_clause_opt ::= */ { 260, 0 }, /* (327) order_by_clause_opt ::= */
{ 261, -2 }, /* (328) slimit_clause_opt ::= SLIMIT NK_INTEGER */ { 260, -3 }, /* (328) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 261, -4 }, /* (329) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ { 261, 0 }, /* (329) slimit_clause_opt ::= */
{ 261, -4 }, /* (330) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ { 261, -2 }, /* (330) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 262, 0 }, /* (331) limit_clause_opt ::= */ { 261, -4 }, /* (331) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 262, -2 }, /* (332) limit_clause_opt ::= LIMIT NK_INTEGER */ { 261, -4 }, /* (332) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 262, -4 }, /* (333) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ { 262, 0 }, /* (333) limit_clause_opt ::= */
{ 262, -4 }, /* (334) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ { 262, -2 }, /* (334) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 229, -3 }, /* (335) subquery ::= NK_LP query_expression NK_RP */ { 262, -4 }, /* (335) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 245, -1 }, /* (336) search_condition ::= common_expression */ { 262, -4 }, /* (336) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 264, -1 }, /* (337) sort_specification_list ::= sort_specification */ { 229, -3 }, /* (337) subquery ::= NK_LP query_expression NK_RP */
{ 264, -3 }, /* (338) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ { 245, -1 }, /* (338) search_condition ::= common_expression */
{ 265, -3 }, /* (339) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { 264, -1 }, /* (339) sort_specification_list ::= sort_specification */
{ 266, 0 }, /* (340) ordering_specification_opt ::= */ { 264, -3 }, /* (340) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 266, -1 }, /* (341) ordering_specification_opt ::= ASC */ { 265, -3 }, /* (341) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 266, -1 }, /* (342) ordering_specification_opt ::= DESC */ { 266, 0 }, /* (342) ordering_specification_opt ::= */
{ 267, 0 }, /* (343) null_ordering_opt ::= */ { 266, -1 }, /* (343) ordering_specification_opt ::= ASC */
{ 267, -2 }, /* (344) null_ordering_opt ::= NULLS FIRST */ { 266, -1 }, /* (344) ordering_specification_opt ::= DESC */
{ 267, -2 }, /* (345) null_ordering_opt ::= NULLS LAST */ { 267, 0 }, /* (345) null_ordering_opt ::= */
{ 267, -2 }, /* (346) null_ordering_opt ::= NULLS FIRST */
{ 267, -2 }, /* (347) null_ordering_opt ::= NULLS LAST */
}; };
static void yy_accept(yyParser*); /* Forward Declaration */ static void yy_accept(yyParser*); /* Forward Declaration */
...@@ -2421,15 +2423,15 @@ static YYACTIONTYPE yy_reduce( ...@@ -2421,15 +2423,15 @@ static YYACTIONTYPE yy_reduce(
case 36: /* dnode_endpoint ::= NK_STRING */ case 36: /* dnode_endpoint ::= NK_STRING */
case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37);
case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38);
case 206: /* db_name ::= NK_ID */ yytestcase(yyruleno==206); case 208: /* db_name ::= NK_ID */ yytestcase(yyruleno==208);
case 207: /* table_name ::= NK_ID */ yytestcase(yyruleno==207); case 209: /* table_name ::= NK_ID */ yytestcase(yyruleno==209);
case 208: /* column_name ::= NK_ID */ yytestcase(yyruleno==208); case 210: /* column_name ::= NK_ID */ yytestcase(yyruleno==210);
case 209: /* function_name ::= NK_ID */ yytestcase(yyruleno==209); case 211: /* function_name ::= NK_ID */ yytestcase(yyruleno==211);
case 210: /* table_alias ::= NK_ID */ yytestcase(yyruleno==210); case 212: /* table_alias ::= NK_ID */ yytestcase(yyruleno==212);
case 211: /* column_alias ::= NK_ID */ yytestcase(yyruleno==211); case 213: /* column_alias ::= NK_ID */ yytestcase(yyruleno==213);
case 212: /* user_name ::= NK_ID */ yytestcase(yyruleno==212); case 214: /* user_name ::= NK_ID */ yytestcase(yyruleno==214);
case 213: /* index_name ::= NK_ID */ yytestcase(yyruleno==213); case 215: /* index_name ::= NK_ID */ yytestcase(yyruleno==215);
case 214: /* topic_name ::= NK_ID */ yytestcase(yyruleno==214); case 216: /* topic_name ::= NK_ID */ yytestcase(yyruleno==216);
{ yylhsminor.yy225 = yymsp[0].minor.yy0; } { yylhsminor.yy225 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy225 = yylhsminor.yy225; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
...@@ -2462,7 +2464,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -2462,7 +2464,7 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 48: /* not_exists_opt ::= */ case 48: /* not_exists_opt ::= */
case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); case 50: /* exists_opt ::= */ yytestcase(yyruleno==50);
case 285: /* set_quantifier_opt ::= */ yytestcase(yyruleno==285); case 287: /* set_quantifier_opt ::= */ yytestcase(yyruleno==287);
{ yymsp[1].minor.yy505 = false; } { yymsp[1].minor.yy505 = false; }
break; break;
case 49: /* exists_opt ::= IF EXISTS */ case 49: /* exists_opt ::= IF EXISTS */
...@@ -2633,9 +2635,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -2633,9 +2635,9 @@ static YYACTIONTYPE yy_reduce(
case 148: /* col_name_list ::= col_name */ yytestcase(yyruleno==148); case 148: /* col_name_list ::= col_name */ yytestcase(yyruleno==148);
case 170: /* func_name_list ::= func_name */ yytestcase(yyruleno==170); case 170: /* func_name_list ::= func_name */ yytestcase(yyruleno==170);
case 179: /* func_list ::= func */ yytestcase(yyruleno==179); case 179: /* func_list ::= func */ yytestcase(yyruleno==179);
case 204: /* literal_list ::= signed_literal */ yytestcase(yyruleno==204); case 206: /* literal_list ::= signed_literal */ yytestcase(yyruleno==206);
case 290: /* select_sublist ::= select_item */ yytestcase(yyruleno==290); case 292: /* select_sublist ::= select_item */ yytestcase(yyruleno==292);
case 337: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==337); case 339: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==339);
{ yylhsminor.yy512 = createNodeList(pCxt, yymsp[0].minor.yy176); } { yylhsminor.yy512 = createNodeList(pCxt, yymsp[0].minor.yy176); }
yymsp[0].minor.yy512 = yylhsminor.yy512; yymsp[0].minor.yy512 = yylhsminor.yy512;
break; break;
...@@ -2654,9 +2656,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -2654,9 +2656,9 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 101: /* specific_tags_opt ::= */ case 101: /* specific_tags_opt ::= */
case 132: /* tags_def_opt ::= */ yytestcase(yyruleno==132); case 132: /* tags_def_opt ::= */ yytestcase(yyruleno==132);
case 298: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==298); case 300: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==300);
case 315: /* group_by_clause_opt ::= */ yytestcase(yyruleno==315); case 317: /* group_by_clause_opt ::= */ yytestcase(yyruleno==317);
case 325: /* order_by_clause_opt ::= */ yytestcase(yyruleno==325); case 327: /* order_by_clause_opt ::= */ yytestcase(yyruleno==327);
{ yymsp[1].minor.yy512 = NULL; } { yymsp[1].minor.yy512 = NULL; }
break; break;
case 102: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ case 102: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */
...@@ -2674,9 +2676,9 @@ static YYACTIONTYPE yy_reduce( ...@@ -2674,9 +2676,9 @@ static YYACTIONTYPE yy_reduce(
case 149: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==149); case 149: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==149);
case 171: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==171); case 171: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==171);
case 180: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==180); case 180: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==180);
case 205: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==205); case 207: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==207);
case 291: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==291); case 293: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==293);
case 338: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==338); case 340: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==340);
{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, yymsp[0].minor.yy176); } { yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, yymsp[0].minor.yy176); }
yymsp[-2].minor.yy512 = yylhsminor.yy512; yymsp[-2].minor.yy512 = yylhsminor.yy512;
break; break;
...@@ -2756,7 +2758,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -2756,7 +2758,7 @@ static YYACTIONTYPE yy_reduce(
{ yymsp[-5].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } { yymsp[-5].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break; break;
case 133: /* tags_def_opt ::= tags_def */ case 133: /* tags_def_opt ::= tags_def */
case 289: /* select_list ::= select_sublist */ yytestcase(yyruleno==289); case 291: /* select_list ::= select_sublist */ yytestcase(yyruleno==291);
{ yylhsminor.yy512 = yymsp[0].minor.yy512; } { yylhsminor.yy512 = yymsp[0].minor.yy512; }
yymsp[0].minor.yy512 = yylhsminor.yy512; yymsp[0].minor.yy512 = yylhsminor.yy512;
break; break;
...@@ -2861,13 +2863,13 @@ static YYACTIONTYPE yy_reduce( ...@@ -2861,13 +2863,13 @@ static YYACTIONTYPE yy_reduce(
break; break;
case 165: /* like_pattern_opt ::= */ case 165: /* like_pattern_opt ::= */
case 176: /* index_options ::= */ yytestcase(yyruleno==176); case 176: /* index_options ::= */ yytestcase(yyruleno==176);
case 296: /* where_clause_opt ::= */ yytestcase(yyruleno==296); case 298: /* where_clause_opt ::= */ yytestcase(yyruleno==298);
case 300: /* twindow_clause_opt ::= */ yytestcase(yyruleno==300); case 302: /* twindow_clause_opt ::= */ yytestcase(yyruleno==302);
case 305: /* sliding_opt ::= */ yytestcase(yyruleno==305); case 307: /* sliding_opt ::= */ yytestcase(yyruleno==307);
case 307: /* fill_opt ::= */ yytestcase(yyruleno==307); case 309: /* fill_opt ::= */ yytestcase(yyruleno==309);
case 319: /* having_clause_opt ::= */ yytestcase(yyruleno==319); case 321: /* having_clause_opt ::= */ yytestcase(yyruleno==321);
case 327: /* slimit_clause_opt ::= */ yytestcase(yyruleno==327); case 329: /* slimit_clause_opt ::= */ yytestcase(yyruleno==329);
case 331: /* limit_clause_opt ::= */ yytestcase(yyruleno==331); case 333: /* limit_clause_opt ::= */ yytestcase(yyruleno==333);
{ yymsp[1].minor.yy176 = NULL; } { yymsp[1].minor.yy176 = NULL; }
break; break;
case 166: /* like_pattern_opt ::= LIKE NK_STRING */ case 166: /* like_pattern_opt ::= LIKE NK_STRING */
...@@ -2933,36 +2935,40 @@ static YYACTIONTYPE yy_reduce( ...@@ -2933,36 +2935,40 @@ static YYACTIONTYPE yy_reduce(
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 191: /* literal ::= duration_literal */ case 191: /* literal ::= duration_literal */
case 199: /* signed_literal ::= signed */ yytestcase(yyruleno==199); case 200: /* signed_literal ::= signed */ yytestcase(yyruleno==200);
case 215: /* expression ::= literal */ yytestcase(yyruleno==215); case 217: /* expression ::= literal */ yytestcase(yyruleno==217);
case 216: /* expression ::= pseudo_column */ yytestcase(yyruleno==216); case 218: /* expression ::= pseudo_column */ yytestcase(yyruleno==218);
case 217: /* expression ::= column_reference */ yytestcase(yyruleno==217); case 219: /* expression ::= column_reference */ yytestcase(yyruleno==219);
case 220: /* expression ::= subquery */ yytestcase(yyruleno==220); case 222: /* expression ::= subquery */ yytestcase(yyruleno==222);
case 259: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==259); case 261: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==261);
case 263: /* boolean_primary ::= predicate */ yytestcase(yyruleno==263); case 265: /* boolean_primary ::= predicate */ yytestcase(yyruleno==265);
case 265: /* common_expression ::= expression */ yytestcase(yyruleno==265); case 267: /* common_expression ::= expression */ yytestcase(yyruleno==267);
case 266: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==266); case 268: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==268);
case 268: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==268); case 270: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==270);
case 270: /* table_reference ::= table_primary */ yytestcase(yyruleno==270); case 272: /* table_reference ::= table_primary */ yytestcase(yyruleno==272);
case 271: /* table_reference ::= joined_table */ yytestcase(yyruleno==271); case 273: /* table_reference ::= joined_table */ yytestcase(yyruleno==273);
case 275: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==275); case 277: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==277);
case 322: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==322); case 324: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==324);
case 324: /* query_primary ::= query_specification */ yytestcase(yyruleno==324); case 326: /* query_primary ::= query_specification */ yytestcase(yyruleno==326);
{ yylhsminor.yy176 = yymsp[0].minor.yy176; } { yylhsminor.yy176 = yymsp[0].minor.yy176; }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 192: /* duration_literal ::= NK_VARIABLE */ case 192: /* literal ::= NULL */
{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); }
yymsp[0].minor.yy176 = yylhsminor.yy176;
break;
case 193: /* duration_literal ::= NK_VARIABLE */
{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } { yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 193: /* signed ::= NK_INTEGER */ case 194: /* signed ::= NK_INTEGER */
{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } { yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 194: /* signed ::= NK_PLUS NK_INTEGER */ case 195: /* signed ::= NK_PLUS NK_INTEGER */
{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } { yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
break; break;
case 195: /* signed ::= NK_MINUS NK_INTEGER */ case 196: /* signed ::= NK_MINUS NK_INTEGER */
{ {
SToken t = yymsp[-1].minor.yy0; SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
...@@ -2970,14 +2976,14 @@ static YYACTIONTYPE yy_reduce( ...@@ -2970,14 +2976,14 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 196: /* signed ::= NK_FLOAT */ case 197: /* signed ::= NK_FLOAT */
{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } { yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 197: /* signed ::= NK_PLUS NK_FLOAT */ case 198: /* signed ::= NK_PLUS NK_FLOAT */
{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } { yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break; break;
case 198: /* signed ::= NK_MINUS NK_FLOAT */ case 199: /* signed ::= NK_MINUS NK_FLOAT */
{ {
SToken t = yymsp[-1].minor.yy0; SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
...@@ -2985,50 +2991,53 @@ static YYACTIONTYPE yy_reduce( ...@@ -2985,50 +2991,53 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 200: /* signed_literal ::= NK_STRING */ case 201: /* signed_literal ::= NK_STRING */
{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } { yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 201: /* signed_literal ::= NK_BOOL */ case 202: /* signed_literal ::= NK_BOOL */
{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } { yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 202: /* signed_literal ::= TIMESTAMP NK_STRING */ case 203: /* signed_literal ::= TIMESTAMP NK_STRING */
{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } { yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break; break;
case 203: /* signed_literal ::= duration_literal */ case 204: /* signed_literal ::= duration_literal */
case 336: /* search_condition ::= common_expression */ yytestcase(yyruleno==336); case 338: /* search_condition ::= common_expression */ yytestcase(yyruleno==338);
{ yylhsminor.yy176 = releaseRawExprNode(pCxt, yymsp[0].minor.yy176); } { yylhsminor.yy176 = releaseRawExprNode(pCxt, yymsp[0].minor.yy176); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 218: /* expression ::= function_name NK_LP expression_list NK_RP */ case 205: /* signed_literal ::= NULL */
{ yymsp[0].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); }
break;
case 220: /* expression ::= function_name NK_LP expression_list NK_RP */
{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy512)); } { yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy512)); }
yymsp[-3].minor.yy176 = yylhsminor.yy176; yymsp[-3].minor.yy176 = yylhsminor.yy176;
break; break;
case 219: /* expression ::= function_name NK_LP NK_STAR NK_RP */ case 221: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } { yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
yymsp[-3].minor.yy176 = yylhsminor.yy176; yymsp[-3].minor.yy176 = yylhsminor.yy176;
break; break;
case 221: /* expression ::= NK_LP expression NK_RP */ case 223: /* expression ::= NK_LP expression NK_RP */
case 264: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==264); case 266: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==266);
{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); } { yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 222: /* expression ::= NK_PLUS expression */ case 224: /* expression ::= NK_PLUS expression */
{ {
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy176));
} }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 223: /* expression ::= NK_MINUS expression */ case 225: /* expression ::= NK_MINUS expression */
{ {
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), NULL)); yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), NULL));
} }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 224: /* expression ::= expression NK_PLUS expression */ case 226: /* expression ::= expression NK_PLUS expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3036,7 +3045,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3036,7 +3045,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 225: /* expression ::= expression NK_MINUS expression */ case 227: /* expression ::= expression NK_MINUS expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3044,7 +3053,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3044,7 +3053,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 226: /* expression ::= expression NK_STAR expression */ case 228: /* expression ::= expression NK_STAR expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3052,7 +3061,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3052,7 +3061,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 227: /* expression ::= expression NK_SLASH expression */ case 229: /* expression ::= expression NK_SLASH expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3060,7 +3069,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3060,7 +3069,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 228: /* expression ::= expression NK_REM expression */ case 230: /* expression ::= expression NK_REM expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3068,28 +3077,28 @@ static YYACTIONTYPE yy_reduce( ...@@ -3068,28 +3077,28 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 229: /* expression_list ::= expression */ case 231: /* expression_list ::= expression */
{ yylhsminor.yy512 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); } { yylhsminor.yy512 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); }
yymsp[0].minor.yy512 = yylhsminor.yy512; yymsp[0].minor.yy512 = yylhsminor.yy512;
break; break;
case 230: /* expression_list ::= expression_list NK_COMMA expression */ case 232: /* expression_list ::= expression_list NK_COMMA expression */
{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); } { yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); }
yymsp[-2].minor.yy512 = yylhsminor.yy512; yymsp[-2].minor.yy512 = yylhsminor.yy512;
break; break;
case 231: /* column_reference ::= column_name */ case 233: /* column_reference ::= column_name */
{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy225, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225)); } { yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy225, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225)); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 232: /* column_reference ::= table_name NK_DOT column_name */ case 234: /* column_reference ::= table_name NK_DOT column_name */
{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225)); } { yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225)); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 233: /* pseudo_column ::= NK_UNDERLINE ROWTS */ case 235: /* pseudo_column ::= NK_UNDERLINE ROWTS */
case 235: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==235); case 237: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==237);
case 236: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==236); case 238: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==238);
case 237: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==237); case 239: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==239);
case 238: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==238); case 240: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==240);
case 239: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==239); case 241: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==241);
{ {
SToken t = yymsp[-1].minor.yy0; SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
...@@ -3097,12 +3106,12 @@ static YYACTIONTYPE yy_reduce( ...@@ -3097,12 +3106,12 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 234: /* pseudo_column ::= TBNAME */ case 236: /* pseudo_column ::= TBNAME */
{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } { yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 240: /* predicate ::= expression compare_op expression */ case 242: /* predicate ::= expression compare_op expression */
case 245: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==245); case 247: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==247);
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3110,7 +3119,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3110,7 +3119,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 241: /* predicate ::= expression BETWEEN expression AND expression */ case 243: /* predicate ::= expression BETWEEN expression AND expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3118,7 +3127,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3118,7 +3127,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-4].minor.yy176 = yylhsminor.yy176; yymsp[-4].minor.yy176 = yylhsminor.yy176;
break; break;
case 242: /* predicate ::= expression NOT BETWEEN expression AND expression */ case 244: /* predicate ::= expression NOT BETWEEN expression AND expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3126,68 +3135,68 @@ static YYACTIONTYPE yy_reduce( ...@@ -3126,68 +3135,68 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-5].minor.yy176 = yylhsminor.yy176; yymsp[-5].minor.yy176 = yylhsminor.yy176;
break; break;
case 243: /* predicate ::= expression IS NULL */ case 245: /* predicate ::= expression IS NULL */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), NULL)); yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), NULL));
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 244: /* predicate ::= expression IS NOT NULL */ case 246: /* predicate ::= expression IS NOT NULL */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy176);
yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), NULL)); yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), NULL));
} }
yymsp[-3].minor.yy176 = yylhsminor.yy176; yymsp[-3].minor.yy176 = yylhsminor.yy176;
break; break;
case 246: /* compare_op ::= NK_LT */ case 248: /* compare_op ::= NK_LT */
{ yymsp[0].minor.yy404 = OP_TYPE_LOWER_THAN; } { yymsp[0].minor.yy404 = OP_TYPE_LOWER_THAN; }
break; break;
case 247: /* compare_op ::= NK_GT */ case 249: /* compare_op ::= NK_GT */
{ yymsp[0].minor.yy404 = OP_TYPE_GREATER_THAN; } { yymsp[0].minor.yy404 = OP_TYPE_GREATER_THAN; }
break; break;
case 248: /* compare_op ::= NK_LE */ case 250: /* compare_op ::= NK_LE */
{ yymsp[0].minor.yy404 = OP_TYPE_LOWER_EQUAL; } { yymsp[0].minor.yy404 = OP_TYPE_LOWER_EQUAL; }
break; break;
case 249: /* compare_op ::= NK_GE */ case 251: /* compare_op ::= NK_GE */
{ yymsp[0].minor.yy404 = OP_TYPE_GREATER_EQUAL; } { yymsp[0].minor.yy404 = OP_TYPE_GREATER_EQUAL; }
break; break;
case 250: /* compare_op ::= NK_NE */ case 252: /* compare_op ::= NK_NE */
{ yymsp[0].minor.yy404 = OP_TYPE_NOT_EQUAL; } { yymsp[0].minor.yy404 = OP_TYPE_NOT_EQUAL; }
break; break;
case 251: /* compare_op ::= NK_EQ */ case 253: /* compare_op ::= NK_EQ */
{ yymsp[0].minor.yy404 = OP_TYPE_EQUAL; } { yymsp[0].minor.yy404 = OP_TYPE_EQUAL; }
break; break;
case 252: /* compare_op ::= LIKE */ case 254: /* compare_op ::= LIKE */
{ yymsp[0].minor.yy404 = OP_TYPE_LIKE; } { yymsp[0].minor.yy404 = OP_TYPE_LIKE; }
break; break;
case 253: /* compare_op ::= NOT LIKE */ case 255: /* compare_op ::= NOT LIKE */
{ yymsp[-1].minor.yy404 = OP_TYPE_NOT_LIKE; } { yymsp[-1].minor.yy404 = OP_TYPE_NOT_LIKE; }
break; break;
case 254: /* compare_op ::= MATCH */ case 256: /* compare_op ::= MATCH */
{ yymsp[0].minor.yy404 = OP_TYPE_MATCH; } { yymsp[0].minor.yy404 = OP_TYPE_MATCH; }
break; break;
case 255: /* compare_op ::= NMATCH */ case 257: /* compare_op ::= NMATCH */
{ yymsp[0].minor.yy404 = OP_TYPE_NMATCH; } { yymsp[0].minor.yy404 = OP_TYPE_NMATCH; }
break; break;
case 256: /* in_op ::= IN */ case 258: /* in_op ::= IN */
{ yymsp[0].minor.yy404 = OP_TYPE_IN; } { yymsp[0].minor.yy404 = OP_TYPE_IN; }
break; break;
case 257: /* in_op ::= NOT IN */ case 259: /* in_op ::= NOT IN */
{ yymsp[-1].minor.yy404 = OP_TYPE_NOT_IN; } { yymsp[-1].minor.yy404 = OP_TYPE_NOT_IN; }
break; break;
case 258: /* in_predicate_value ::= NK_LP expression_list NK_RP */ case 260: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy512)); } { yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy512)); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 260: /* boolean_value_expression ::= NOT boolean_primary */ case 262: /* boolean_value_expression ::= NOT boolean_primary */
{ {
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), NULL)); yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), NULL));
} }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 261: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ case 263: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3195,7 +3204,7 @@ static YYACTIONTYPE yy_reduce( ...@@ -3195,7 +3204,7 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 262: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ case 264: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ {
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
...@@ -3203,52 +3212,52 @@ static YYACTIONTYPE yy_reduce( ...@@ -3203,52 +3212,52 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 267: /* from_clause ::= FROM table_reference_list */ case 269: /* from_clause ::= FROM table_reference_list */
case 297: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==297); case 299: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==299);
case 320: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==320); case 322: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==322);
{ yymsp[-1].minor.yy176 = yymsp[0].minor.yy176; } { yymsp[-1].minor.yy176 = yymsp[0].minor.yy176; }
break; break;
case 269: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ case 271: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ yylhsminor.yy176 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy176, yymsp[0].minor.yy176, NULL); } { yylhsminor.yy176 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy176, yymsp[0].minor.yy176, NULL); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 272: /* table_primary ::= table_name alias_opt */ case 274: /* table_primary ::= table_name alias_opt */
{ yylhsminor.yy176 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } { yylhsminor.yy176 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 273: /* table_primary ::= db_name NK_DOT table_name alias_opt */ case 275: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ yylhsminor.yy176 = createRealTableNode(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } { yylhsminor.yy176 = createRealTableNode(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); }
yymsp[-3].minor.yy176 = yylhsminor.yy176; yymsp[-3].minor.yy176 = yylhsminor.yy176;
break; break;
case 274: /* table_primary ::= subquery alias_opt */ case 276: /* table_primary ::= subquery alias_opt */
{ yylhsminor.yy176 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176), &yymsp[0].minor.yy225); } { yylhsminor.yy176 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176), &yymsp[0].minor.yy225); }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 276: /* alias_opt ::= */ case 278: /* alias_opt ::= */
{ yymsp[1].minor.yy225 = nil_token; } { yymsp[1].minor.yy225 = nil_token; }
break; break;
case 277: /* alias_opt ::= table_alias */ case 279: /* alias_opt ::= table_alias */
{ yylhsminor.yy225 = yymsp[0].minor.yy225; } { yylhsminor.yy225 = yymsp[0].minor.yy225; }
yymsp[0].minor.yy225 = yylhsminor.yy225; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 278: /* alias_opt ::= AS table_alias */ case 280: /* alias_opt ::= AS table_alias */
{ yymsp[-1].minor.yy225 = yymsp[0].minor.yy225; } { yymsp[-1].minor.yy225 = yymsp[0].minor.yy225; }
break; break;
case 279: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 281: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case 280: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==280); case 282: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==282);
{ yymsp[-2].minor.yy176 = yymsp[-1].minor.yy176; } { yymsp[-2].minor.yy176 = yymsp[-1].minor.yy176; }
break; break;
case 281: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ case 283: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ yylhsminor.yy176 = createJoinTableNode(pCxt, yymsp[-4].minor.yy236, yymsp[-5].minor.yy176, yymsp[-2].minor.yy176, yymsp[0].minor.yy176); } { yylhsminor.yy176 = createJoinTableNode(pCxt, yymsp[-4].minor.yy236, yymsp[-5].minor.yy176, yymsp[-2].minor.yy176, yymsp[0].minor.yy176); }
yymsp[-5].minor.yy176 = yylhsminor.yy176; yymsp[-5].minor.yy176 = yylhsminor.yy176;
break; break;
case 282: /* join_type ::= */ case 284: /* join_type ::= */
{ yymsp[1].minor.yy236 = JOIN_TYPE_INNER; } { yymsp[1].minor.yy236 = JOIN_TYPE_INNER; }
break; break;
case 283: /* join_type ::= INNER */ case 285: /* join_type ::= INNER */
{ yymsp[0].minor.yy236 = JOIN_TYPE_INNER; } { yymsp[0].minor.yy236 = JOIN_TYPE_INNER; }
break; break;
case 284: /* 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 286: /* 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.yy176 = createSelectStmt(pCxt, yymsp[-7].minor.yy505, yymsp[-6].minor.yy512, yymsp[-5].minor.yy176); yymsp[-8].minor.yy176 = createSelectStmt(pCxt, yymsp[-7].minor.yy505, yymsp[-6].minor.yy512, yymsp[-5].minor.yy176);
yymsp[-8].minor.yy176 = addWhereClause(pCxt, yymsp[-8].minor.yy176, yymsp[-4].minor.yy176); yymsp[-8].minor.yy176 = addWhereClause(pCxt, yymsp[-8].minor.yy176, yymsp[-4].minor.yy176);
...@@ -3258,84 +3267,84 @@ static YYACTIONTYPE yy_reduce( ...@@ -3258,84 +3267,84 @@ static YYACTIONTYPE yy_reduce(
yymsp[-8].minor.yy176 = addHavingClause(pCxt, yymsp[-8].minor.yy176, yymsp[0].minor.yy176); yymsp[-8].minor.yy176 = addHavingClause(pCxt, yymsp[-8].minor.yy176, yymsp[0].minor.yy176);
} }
break; break;
case 286: /* set_quantifier_opt ::= DISTINCT */ case 288: /* set_quantifier_opt ::= DISTINCT */
{ yymsp[0].minor.yy505 = true; } { yymsp[0].minor.yy505 = true; }
break; break;
case 287: /* set_quantifier_opt ::= ALL */ case 289: /* set_quantifier_opt ::= ALL */
{ yymsp[0].minor.yy505 = false; } { yymsp[0].minor.yy505 = false; }
break; break;
case 288: /* select_list ::= NK_STAR */ case 290: /* select_list ::= NK_STAR */
{ yymsp[0].minor.yy512 = NULL; } { yymsp[0].minor.yy512 = NULL; }
break; break;
case 292: /* select_item ::= common_expression */ case 294: /* select_item ::= common_expression */
{ {
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176);
yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), &t); yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), &t);
} }
yymsp[0].minor.yy176 = yylhsminor.yy176; yymsp[0].minor.yy176 = yylhsminor.yy176;
break; break;
case 293: /* select_item ::= common_expression column_alias */ case 295: /* select_item ::= common_expression column_alias */
{ yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176), &yymsp[0].minor.yy225); } { yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176), &yymsp[0].minor.yy225); }
yymsp[-1].minor.yy176 = yylhsminor.yy176; yymsp[-1].minor.yy176 = yylhsminor.yy176;
break; break;
case 294: /* select_item ::= common_expression AS column_alias */ case 296: /* select_item ::= common_expression AS column_alias */
{ yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), &yymsp[0].minor.yy225); } { yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), &yymsp[0].minor.yy225); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 295: /* select_item ::= table_name NK_DOT NK_STAR */ case 297: /* select_item ::= table_name NK_DOT NK_STAR */
{ yylhsminor.yy176 = createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } { yylhsminor.yy176 = createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 299: /* partition_by_clause_opt ::= PARTITION BY expression_list */ case 301: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 316: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==316); case 318: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==318);
case 326: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==326); case 328: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==328);
{ yymsp[-2].minor.yy512 = yymsp[0].minor.yy512; } { yymsp[-2].minor.yy512 = yymsp[0].minor.yy512; }
break; break;
case 301: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ case 303: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
{ yymsp[-5].minor.yy176 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); } { yymsp[-5].minor.yy176 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); }
break; break;
case 302: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ case 304: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ yymsp[-3].minor.yy176 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); } { yymsp[-3].minor.yy176 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); }
break; break;
case 303: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ case 305: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ yymsp[-5].minor.yy176 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), NULL, yymsp[-1].minor.yy176, yymsp[0].minor.yy176); } { yymsp[-5].minor.yy176 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), NULL, yymsp[-1].minor.yy176, yymsp[0].minor.yy176); }
break; break;
case 304: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ case 306: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ yymsp[-7].minor.yy176 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy176), releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), yymsp[-1].minor.yy176, yymsp[0].minor.yy176); } { yymsp[-7].minor.yy176 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy176), releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), yymsp[-1].minor.yy176, yymsp[0].minor.yy176); }
break; break;
case 306: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ case 308: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ yymsp[-3].minor.yy176 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy176); } { yymsp[-3].minor.yy176 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy176); }
break; break;
case 308: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ case 310: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ yymsp[-3].minor.yy176 = createFillNode(pCxt, yymsp[-1].minor.yy142, NULL); } { yymsp[-3].minor.yy176 = createFillNode(pCxt, yymsp[-1].minor.yy142, NULL); }
break; break;
case 309: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ case 311: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ yymsp[-5].minor.yy176 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy512)); } { yymsp[-5].minor.yy176 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy512)); }
break; break;
case 310: /* fill_mode ::= NONE */ case 312: /* fill_mode ::= NONE */
{ yymsp[0].minor.yy142 = FILL_MODE_NONE; } { yymsp[0].minor.yy142 = FILL_MODE_NONE; }
break; break;
case 311: /* fill_mode ::= PREV */ case 313: /* fill_mode ::= PREV */
{ yymsp[0].minor.yy142 = FILL_MODE_PREV; } { yymsp[0].minor.yy142 = FILL_MODE_PREV; }
break; break;
case 312: /* fill_mode ::= NULL */ case 314: /* fill_mode ::= NULL */
{ yymsp[0].minor.yy142 = FILL_MODE_NULL; } { yymsp[0].minor.yy142 = FILL_MODE_NULL; }
break; break;
case 313: /* fill_mode ::= LINEAR */ case 315: /* fill_mode ::= LINEAR */
{ yymsp[0].minor.yy142 = FILL_MODE_LINEAR; } { yymsp[0].minor.yy142 = FILL_MODE_LINEAR; }
break; break;
case 314: /* fill_mode ::= NEXT */ case 316: /* fill_mode ::= NEXT */
{ yymsp[0].minor.yy142 = FILL_MODE_NEXT; } { yymsp[0].minor.yy142 = FILL_MODE_NEXT; }
break; break;
case 317: /* group_by_list ::= expression */ case 319: /* group_by_list ::= expression */
{ yylhsminor.yy512 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); } { yylhsminor.yy512 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); }
yymsp[0].minor.yy512 = yylhsminor.yy512; yymsp[0].minor.yy512 = yylhsminor.yy512;
break; break;
case 318: /* group_by_list ::= group_by_list NK_COMMA expression */ case 320: /* group_by_list ::= group_by_list NK_COMMA expression */
{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); } { yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); }
yymsp[-2].minor.yy512 = yylhsminor.yy512; yymsp[-2].minor.yy512 = yylhsminor.yy512;
break; break;
case 321: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ case 323: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ {
yylhsminor.yy176 = addOrderByClause(pCxt, yymsp[-3].minor.yy176, yymsp[-2].minor.yy512); yylhsminor.yy176 = addOrderByClause(pCxt, yymsp[-3].minor.yy176, yymsp[-2].minor.yy512);
yylhsminor.yy176 = addSlimitClause(pCxt, yylhsminor.yy176, yymsp[-1].minor.yy176); yylhsminor.yy176 = addSlimitClause(pCxt, yylhsminor.yy176, yymsp[-1].minor.yy176);
...@@ -3343,46 +3352,46 @@ static YYACTIONTYPE yy_reduce( ...@@ -3343,46 +3352,46 @@ static YYACTIONTYPE yy_reduce(
} }
yymsp[-3].minor.yy176 = yylhsminor.yy176; yymsp[-3].minor.yy176 = yylhsminor.yy176;
break; break;
case 323: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ case 325: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ yylhsminor.yy176 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy176, yymsp[0].minor.yy176); } { yylhsminor.yy176 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy176, yymsp[0].minor.yy176); }
yymsp[-3].minor.yy176 = yylhsminor.yy176; yymsp[-3].minor.yy176 = yylhsminor.yy176;
break; break;
case 328: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ case 330: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 332: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==332); case 334: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==334);
{ yymsp[-1].minor.yy176 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } { yymsp[-1].minor.yy176 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break; break;
case 329: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 331: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 333: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==333); case 335: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==335);
{ yymsp[-3].minor.yy176 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } { yymsp[-3].minor.yy176 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break; break;
case 330: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 332: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case 334: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==334); case 336: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==336);
{ yymsp[-3].minor.yy176 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } { yymsp[-3].minor.yy176 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break; break;
case 335: /* subquery ::= NK_LP query_expression NK_RP */ case 337: /* subquery ::= NK_LP query_expression NK_RP */
{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy176); } { yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy176); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 339: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ case 341: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ yylhsminor.yy176 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), yymsp[-1].minor.yy106, yymsp[0].minor.yy465); } { yylhsminor.yy176 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), yymsp[-1].minor.yy106, yymsp[0].minor.yy465); }
yymsp[-2].minor.yy176 = yylhsminor.yy176; yymsp[-2].minor.yy176 = yylhsminor.yy176;
break; break;
case 340: /* ordering_specification_opt ::= */ case 342: /* ordering_specification_opt ::= */
{ yymsp[1].minor.yy106 = ORDER_ASC; } { yymsp[1].minor.yy106 = ORDER_ASC; }
break; break;
case 341: /* ordering_specification_opt ::= ASC */ case 343: /* ordering_specification_opt ::= ASC */
{ yymsp[0].minor.yy106 = ORDER_ASC; } { yymsp[0].minor.yy106 = ORDER_ASC; }
break; break;
case 342: /* ordering_specification_opt ::= DESC */ case 344: /* ordering_specification_opt ::= DESC */
{ yymsp[0].minor.yy106 = ORDER_DESC; } { yymsp[0].minor.yy106 = ORDER_DESC; }
break; break;
case 343: /* null_ordering_opt ::= */ case 345: /* null_ordering_opt ::= */
{ yymsp[1].minor.yy465 = NULL_ORDER_DEFAULT; } { yymsp[1].minor.yy465 = NULL_ORDER_DEFAULT; }
break; break;
case 344: /* null_ordering_opt ::= NULLS FIRST */ case 346: /* null_ordering_opt ::= NULLS FIRST */
{ yymsp[-1].minor.yy465 = NULL_ORDER_FIRST; } { yymsp[-1].minor.yy465 = NULL_ORDER_FIRST; }
break; break;
case 345: /* null_ordering_opt ::= NULLS LAST */ case 347: /* null_ordering_opt ::= NULLS LAST */
{ yymsp[-1].minor.yy465 = NULL_ORDER_LAST; } { yymsp[-1].minor.yy465 = NULL_ORDER_LAST; }
break; break;
default: default:
......
...@@ -487,7 +487,10 @@ TEST_F(ParserTest, createTable) { ...@@ -487,7 +487,10 @@ TEST_F(ParserTest, createTable) {
bind("create table " bind("create table "
"if not exists test.t1 using test.st1 (tag1, tag2) tags(1, 'abc') " "if not exists test.t1 using test.st1 (tag1, tag2) tags(1, 'abc') "
"if not exists test.t2 using test.st1 (tag1, tag2) tags(2, 'abc') " "if not exists test.t2 using test.st1 (tag1, tag2) tags(2, 'abc') "
"if not exists test.t3 using test.st1 (tag1, tag2) tags(3, 'abc')" "if not exists test.t3 using test.st1 (tag1, tag2) tags(3, 'abc') "
"if not exists test.t4 using test.st1 (tag1, tag2) tags(3, null) "
"if not exists test.t5 using test.st1 (tag1, tag2) tags(null, 'abc') "
"if not exists test.t6 using test.st1 (tag1, tag2) tags(null, null)"
); );
ASSERT_TRUE(run()); ASSERT_TRUE(run());
......
...@@ -142,6 +142,46 @@ static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanCols, STab ...@@ -142,6 +142,46 @@ static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanCols, STab
return SCAN_TYPE_TAG; return SCAN_TYPE_TAG;
} }
static SNodeptr createPrimaryKeyCol(uint64_t tableId) {
SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) {
return NULL;
}
pCol->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP;
pCol->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes;
pCol->tableId = tableId;
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
pCol->colType = COLUMN_TYPE_COLUMN;
strcpy(pCol->colName, "#primarykey");
return pCol;
}
static int32_t addPrimaryKeyCol(uint64_t tableId, SNodeList** pCols) {
if (NULL == *pCols) {
*pCols = nodesMakeList();
if (NULL == *pCols) {
return TSDB_CODE_OUT_OF_MEMORY;
}
}
bool found = false;
SNode* pCol = NULL;
FOREACH(pCol, *pCols) {
if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pCol)->colId) {
found = true;
break;
}
}
if (!found) {
if (TSDB_CODE_SUCCESS != nodesListStrictAppend(*pCols, createPrimaryKeyCol(tableId))) {
nodesDestroyList(*pCols);
return TSDB_CODE_OUT_OF_MEMORY;
}
}
return TSDB_CODE_SUCCESS;
}
static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SRealTableNode* pRealTable, SLogicNode** pLogicNode) { static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SRealTableNode* pRealTable, SLogicNode** pLogicNode) {
SScanLogicNode* pScan = (SScanLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SCAN); SScanLogicNode* pScan = (SScanLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SCAN);
if (NULL == pScan) { if (NULL == pScan) {
...@@ -161,7 +201,11 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect ...@@ -161,7 +201,11 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
// set columns to scan // set columns to scan
SNodeList* pCols = NULL; SNodeList* pCols = NULL;
int32_t code = nodesCollectColumns(pSelect, SQL_CLAUSE_FROM, pRealTable->table.tableAlias, &pCols); int32_t code = nodesCollectColumns(pSelect, SQL_CLAUSE_FROM, pRealTable->table.tableAlias, &pCols);
if (TSDB_CODE_SUCCESS == code && NULL != pCols) { if (TSDB_CODE_SUCCESS == code) {
code = addPrimaryKeyCol(pScan->pMeta->uid, &pCols);
}
if (TSDB_CODE_SUCCESS == code) {
pScan->pScanCols = nodesCloneList(pCols); pScan->pScanCols = nodesCloneList(pCols);
if (NULL == pScan) { if (NULL == pScan) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
...@@ -171,13 +215,15 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect ...@@ -171,13 +215,15 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pScan->scanType = getScanType(pCxt, pCols, pScan->pMeta); pScan->scanType = getScanType(pCxt, pCols, pScan->pMeta);
// set output // set output
if (TSDB_CODE_SUCCESS == code && NULL != pCols) { if (TSDB_CODE_SUCCESS == code) {
pScan->node.pTargets = nodesCloneList(pCols); pScan->node.pTargets = nodesCloneList(pCols);
if (NULL == pScan) { if (NULL == pScan) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
} }
} }
nodesClearList(pCols);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
*pLogicNode = (SLogicNode*)pScan; *pLogicNode = (SLogicNode*)pScan;
} else { } else {
...@@ -548,6 +594,22 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel ...@@ -548,6 +594,22 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
if (NULL != pSelect->pLimit) {
pProject->limit = ((SLimitNode*)pSelect->pLimit)->limit;
pProject->offset = ((SLimitNode*)pSelect->pLimit)->offset;
} else {
pProject->limit = -1;
pProject->offset = -1;
}
if (NULL != pSelect->pSlimit) {
pProject->slimit = ((SLimitNode*)pSelect->pSlimit)->limit;
pProject->soffset = ((SLimitNode*)pSelect->pSlimit)->offset;
} else {
pProject->slimit = -1;
pProject->soffset = -1;
}
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
pProject->pProjections = nodesCloneList(pSelect->pProjectionList); pProject->pProjections = nodesCloneList(pSelect->pProjectionList);
...@@ -569,15 +631,42 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel ...@@ -569,15 +631,42 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel
return code; return code;
} }
static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
if (NULL == pSelect->pPartitionByList) {
return TSDB_CODE_SUCCESS;
}
SPartitionLogicNode* pPartition = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_PARTITION);
if (NULL == pPartition) {
return TSDB_CODE_OUT_OF_MEMORY;
}
return TSDB_CODE_SUCCESS;
}
static int32_t createDistinctLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
if (!pSelect->isDistinct) {
return TSDB_CODE_SUCCESS;
}
return TSDB_CODE_SUCCESS;
}
static int32_t createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { static int32_t createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
SLogicNode* pRoot = NULL; SLogicNode* pRoot = NULL;
int32_t code = createLogicNodeByTable(pCxt, pSelect, pSelect->pFromTable, &pRoot); int32_t code = createLogicNodeByTable(pCxt, pSelect, pSelect->pFromTable, &pRoot);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createChildLogicNode(pCxt, pSelect, createWindowLogicNode, &pRoot); code = createChildLogicNode(pCxt, pSelect, createWindowLogicNode, &pRoot);
} }
if (TSDB_CODE_SUCCESS == code) {
code = createChildLogicNode(pCxt, pSelect, createPartitionLogicNode, &pRoot);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createChildLogicNode(pCxt, pSelect, createAggLogicNode, &pRoot); code = createChildLogicNode(pCxt, pSelect, createAggLogicNode, &pRoot);
} }
if (TSDB_CODE_SUCCESS == code) {
code = createChildLogicNode(pCxt, pSelect, createDistinctLogicNode, &pRoot);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createChildLogicNode(pCxt, pSelect, createSortLogicNode, &pRoot); code = createChildLogicNode(pCxt, pSelect, createSortLogicNode, &pRoot);
} }
......
...@@ -131,7 +131,8 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD ...@@ -131,7 +131,8 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD
code = putSlotToHash(pDataBlockDesc->dataBlockId, slotId, pNode, pHash); code = putSlotToHash(pDataBlockDesc->dataBlockId, slotId, pNode, pHash);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pDataBlockDesc->resultRowSize += ((SExprNode*)pNode)->resType.bytes; pDataBlockDesc->totalRowSize += ((SExprNode*)pNode)->resType.bytes;
pDataBlockDesc->outputRowSize += ((SExprNode*)pNode)->resType.bytes;
++slotId; ++slotId;
} else { } else {
break; break;
...@@ -189,7 +190,10 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList, ...@@ -189,7 +190,10 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList,
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = putSlotToHashImpl(pDataBlockDesc->dataBlockId, nextSlotId, name, len, pHash); code = putSlotToHashImpl(pDataBlockDesc->dataBlockId, nextSlotId, name, len, pHash);
} }
pDataBlockDesc->resultRowSize += ((SExprNode*)pExpr)->resType.bytes; pDataBlockDesc->totalRowSize += ((SExprNode*)pExpr)->resType.bytes;
if (output) {
pDataBlockDesc->outputRowSize += ((SExprNode*)pExpr)->resType.bytes;
}
slotId = nextSlotId; slotId = nextSlotId;
++nextSlotId; ++nextSlotId;
} else { } else {
...@@ -311,20 +315,6 @@ static int32_t setConditionsSlotId(SPhysiPlanContext* pCxt, const SLogicNode* pL ...@@ -311,20 +315,6 @@ static int32_t setConditionsSlotId(SPhysiPlanContext* pCxt, const SLogicNode* pL
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static SNodeptr createPrimaryKeyCol(SPhysiPlanContext* pCxt, uint64_t tableId) {
SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) {
return NULL;
}
pCol->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP;
pCol->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes;
pCol->tableId = tableId;
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
pCol->colType = COLUMN_TYPE_COLUMN;
strcpy(pCol->colName, "#primarykey");
return pCol;
}
static int32_t colIdCompare(const void* pLeft, const void* pRight) { static int32_t colIdCompare(const void* pLeft, const void* pRight) {
SColumnNode* pLeftCol = *(SColumnNode**)pLeft; SColumnNode* pLeftCol = *(SColumnNode**)pLeft;
SColumnNode* pRightCol = *(SColumnNode**)pRight; SColumnNode* pRightCol = *(SColumnNode**)pRight;
...@@ -353,35 +343,10 @@ static int32_t sortScanCols(SNodeList* pScanCols) { ...@@ -353,35 +343,10 @@ static int32_t sortScanCols(SNodeList* pScanCols) {
} }
static int32_t createScanCols(SPhysiPlanContext* pCxt, SScanPhysiNode* pScanPhysiNode, SNodeList* pScanCols) { static int32_t createScanCols(SPhysiPlanContext* pCxt, SScanPhysiNode* pScanPhysiNode, SNodeList* pScanCols) {
if (QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == nodeType(pScanPhysiNode) pScanPhysiNode->pScanCols = nodesCloneList(pScanCols);
|| QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN == nodeType(pScanPhysiNode)) { if (NULL == pScanPhysiNode->pScanCols) {
pScanPhysiNode->pScanCols = nodesMakeList(); return TSDB_CODE_OUT_OF_MEMORY;
if (NULL == pScanPhysiNode->pScanCols) {
return TSDB_CODE_OUT_OF_MEMORY;
}
if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pScanPhysiNode->pScanCols, createPrimaryKeyCol(pCxt, pScanPhysiNode->uid))) {
return TSDB_CODE_OUT_OF_MEMORY;
}
SNode* pNode;
FOREACH(pNode, pScanCols) {
if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pNode)->colId) {
SColumnNode* pCol = nodesListGetNode(pScanPhysiNode->pScanCols, 0);
strcpy(pCol->tableAlias, ((SColumnNode*)pNode)->tableAlias);
strcpy(pCol->colName, ((SColumnNode*)pNode)->colName);
continue;
}
if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pScanPhysiNode->pScanCols, nodesCloneNode(pNode))) {
return TSDB_CODE_OUT_OF_MEMORY;
}
}
} else {
pScanPhysiNode->pScanCols = nodesCloneList(pScanCols);
if (NULL == pScanPhysiNode->pScanCols) {
return TSDB_CODE_OUT_OF_MEMORY;
}
} }
return sortScanCols(pScanPhysiNode->pScanCols); return sortScanCols(pScanPhysiNode->pScanCols);
} }
...@@ -708,6 +673,11 @@ static int32_t createProjectPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChild ...@@ -708,6 +673,11 @@ static int32_t createProjectPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChild
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
pProject->limit = pProjectLogicNode->limit;
pProject->offset = pProjectLogicNode->offset;
pProject->slimit = pProjectLogicNode->slimit;
pProject->soffset = pProjectLogicNode->soffset;
int32_t code = setListSlotId(pCxt, ((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc->dataBlockId, -1, pProjectLogicNode->pProjections, &pProject->pProjections); int32_t code = setListSlotId(pCxt, ((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc->dataBlockId, -1, pProjectLogicNode->pProjections, &pProject->pProjections);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = addDataBlockSlotsForProject(pCxt, pProjectLogicNode->stmtName, pProject->pProjections, pProject->node.pOutputDataBlockDesc); code = addDataBlockSlotsForProject(pCxt, pProjectLogicNode->stmtName, pProject->pProjections, pProject->node.pOutputDataBlockDesc);
......
...@@ -207,7 +207,7 @@ TEST_F(PlannerTest, sessionWindow) { ...@@ -207,7 +207,7 @@ TEST_F(PlannerTest, sessionWindow) {
TEST_F(PlannerTest, orderBy) { TEST_F(PlannerTest, orderBy) {
setDatabase("root", "test"); setDatabase("root", "test");
bind("SELECT * FROM t1 order by c1"); bind("SELECT c1 FROM t1 order by c1");
ASSERT_TRUE(run()); ASSERT_TRUE(run());
bind("SELECT c1 FROM t1 order by c2"); bind("SELECT c1 FROM t1 order by c2");
...@@ -217,6 +217,32 @@ TEST_F(PlannerTest, orderBy) { ...@@ -217,6 +217,32 @@ TEST_F(PlannerTest, orderBy) {
ASSERT_TRUE(run()); ASSERT_TRUE(run());
} }
TEST_F(PlannerTest, limit) {
setDatabase("root", "test");
bind("SELECT * FROM t1 limit 2");
ASSERT_TRUE(run());
bind("SELECT * FROM t1 limit 5 offset 2");
ASSERT_TRUE(run());
bind("SELECT * FROM t1 limit 2, 5");
ASSERT_TRUE(run());
}
TEST_F(PlannerTest, slimit) {
setDatabase("root", "test");
bind("SELECT * FROM t1 partition by c1 slimit 2");
ASSERT_TRUE(run());
bind("SELECT * FROM t1 partition by c1 slimit 5 soffset 2");
ASSERT_TRUE(run());
bind("SELECT * FROM t1 partition by c1 slimit 2, 5");
ASSERT_TRUE(run());
}
TEST_F(PlannerTest, showTables) { TEST_F(PlannerTest, showTables) {
setDatabase("root", "test"); setDatabase("root", "test");
......
...@@ -30,21 +30,20 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg); ...@@ -30,21 +30,20 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg);
int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg);
int32_t qwProcessHb(SQWorkerMgmt *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req); int32_t qwProcessHb(SQWorkerMgmt *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req);
int32_t qwBuildAndSendDropRsp(SQWConnInfo *pConn, int32_t code); int32_t qwBuildAndSendDropRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code);
int32_t qwBuildAndSendCancelRsp(SQWConnInfo *pConn, int32_t code); int32_t qwBuildAndSendCancelRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code);
int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int32_t dataLength, int32_t code); int32_t qwBuildAndSendFetchRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int32_t dataLength,
void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete); int32_t code);
void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete);
int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SQWConnInfo *pConn); int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SQWConnInfo *pConn);
int32_t qwBuildAndSendReadyRsp(SQWConnInfo *pConn, int32_t code); int32_t qwBuildAndSendReadyRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code);
int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code); int32_t qwBuildAndSendQueryRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code);
void qwFreeFetchRsp(void *msg); void qwFreeFetchRsp(void *msg);
int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp); int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp);
int32_t qwGetSchTasksStatus(SQWorkerMgmt *mgmt, uint64_t sId, SSchedulerStatusRsp **rsp); int32_t qwGetSchTasksStatus(SQWorkerMgmt *mgmt, uint64_t sId, SSchedulerStatusRsp **rsp);
int32_t qwBuildAndSendHbRsp(SQWConnInfo *pConn, SSchedulerHbRsp *rsp, int32_t code); int32_t qwBuildAndSendHbRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, SSchedulerHbRsp *rsp, int32_t code);
int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn); int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -763,8 +763,8 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu ...@@ -763,8 +763,8 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
dropConnection = &ctx->connInfo; dropConnection = &ctx->connInfo;
QW_ERR_JRET(qwDropTask(QW_FPARAMS())); QW_ERR_JRET(qwDropTask(QW_FPARAMS()));
dropConnection = NULL; dropConnection = NULL;
qwBuildAndSendDropRsp(&ctx->connInfo, code); qwBuildAndSendDropRsp(&mgmt->msgCb, &ctx->connInfo, code);
QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", ctx->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", ctx->connInfo.handle, code, tstrerror(code));
QW_ERR_JRET(TSDB_CODE_QRY_TASK_DROPPED); QW_ERR_JRET(TSDB_CODE_QRY_TASK_DROPPED);
...@@ -802,9 +802,9 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu ...@@ -802,9 +802,9 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
QW_ERR_JRET(qwDropTask(QW_FPARAMS())); QW_ERR_JRET(qwDropTask(QW_FPARAMS()));
dropConnection = NULL; dropConnection = NULL;
qwBuildAndSendDropRsp(&ctx->connInfo, code); qwBuildAndSendDropRsp(&mgmt->msgCb, &ctx->connInfo, code);
QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", ctx->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", ctx->connInfo.handle, code, tstrerror(code));
QW_ERR_JRET(TSDB_CODE_QRY_TASK_DROPPED); QW_ERR_JRET(TSDB_CODE_QRY_TASK_DROPPED);
} }
...@@ -830,12 +830,12 @@ _return: ...@@ -830,12 +830,12 @@ _return:
} }
if (dropConnection) { if (dropConnection) {
qwBuildAndSendDropRsp(dropConnection, code); qwBuildAndSendDropRsp(&mgmt->msgCb, dropConnection, code);
QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", dropConnection->handle, code, tstrerror(code)); QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", dropConnection->handle, code, tstrerror(code));
} }
if (cancelConnection) { if (cancelConnection) {
qwBuildAndSendCancelRsp(cancelConnection, code); qwBuildAndSendCancelRsp(&mgmt->msgCb, cancelConnection, code);
QW_TASK_DLOG("cancel rsp send, handle:%p, code:%x - %s", cancelConnection->handle, code, tstrerror(code)); QW_TASK_DLOG("cancel rsp send, handle:%p, code:%x - %s", cancelConnection->handle, code, tstrerror(code));
} }
...@@ -886,9 +886,9 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp ...@@ -886,9 +886,9 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp
QW_ERR_JRET(TSDB_CODE_QRY_APP_ERROR); QW_ERR_JRET(TSDB_CODE_QRY_APP_ERROR);
} }
qwBuildAndSendDropRsp(&ctx->connInfo, code); qwBuildAndSendDropRsp(&mgmt->msgCb, &ctx->connInfo, code);
QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", ctx->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", ctx->connInfo.handle, code, tstrerror(code));
QW_ERR_JRET(qwDropTask(QW_FPARAMS())); QW_ERR_JRET(qwDropTask(QW_FPARAMS()));
QW_ERR_JRET(TSDB_CODE_QRY_TASK_DROPPED); QW_ERR_JRET(TSDB_CODE_QRY_TASK_DROPPED);
} }
...@@ -918,7 +918,7 @@ _return: ...@@ -918,7 +918,7 @@ _return:
} }
if (readyConnection) { if (readyConnection) {
qwBuildAndSendReadyRsp(readyConnection, code); qwBuildAndSendReadyRsp(&mgmt->msgCb, readyConnection, code);
QW_TASK_DLOG("ready msg rsped, handle:%p, code:%x - %s", readyConnection->handle, code, tstrerror(code)); QW_TASK_DLOG("ready msg rsped, handle:%p, code:%x - %s", readyConnection->handle, code, tstrerror(code));
} }
...@@ -970,7 +970,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType) { ...@@ -970,7 +970,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType) {
QW_ERR_JRET(TSDB_CODE_QRY_APP_ERROR); QW_ERR_JRET(TSDB_CODE_QRY_APP_ERROR);
} }
QW_ERR_JRET(qwBuildAndSendQueryRsp(&qwMsg->connInfo, code)); QW_ERR_JRET(qwBuildAndSendQueryRsp(&mgmt->msgCb, &qwMsg->connInfo, code));
QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
queryRsped = true; queryRsped = true;
...@@ -986,9 +986,9 @@ _return: ...@@ -986,9 +986,9 @@ _return:
input.code = code; input.code = code;
code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL); code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL);
if (!queryRsped) { if (!queryRsped) {
qwBuildAndSendQueryRsp(&qwMsg->connInfo, code); qwBuildAndSendQueryRsp(&mgmt->msgCb, &qwMsg->connInfo, code);
QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
} }
...@@ -1051,7 +1051,7 @@ _return: ...@@ -1051,7 +1051,7 @@ _return:
} }
if (needRsp) { if (needRsp) {
qwBuildAndSendReadyRsp(&qwMsg->connInfo, code); qwBuildAndSendReadyRsp(&mgmt->msgCb, &qwMsg->connInfo, code);
QW_TASK_DLOG("ready msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("ready msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
} }
...@@ -1095,7 +1095,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { ...@@ -1095,7 +1095,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
qwMsg->connInfo = ctx->connInfo; qwMsg->connInfo = ctx->connInfo;
QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_FETCH); QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_FETCH);
qwBuildAndSendFetchRsp(&qwMsg->connInfo, rsp, dataLen, code); qwBuildAndSendFetchRsp(&mgmt->msgCb, &qwMsg->connInfo, rsp, dataLen, code);
QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), dataLen); QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), dataLen);
} else { } else {
atomic_store_8((int8_t*)&ctx->queryContinue, 1); atomic_store_8((int8_t*)&ctx->queryContinue, 1);
...@@ -1114,7 +1114,7 @@ _return: ...@@ -1114,7 +1114,7 @@ _return:
rsp = NULL; rsp = NULL;
qwMsg->connInfo = ctx->connInfo; qwMsg->connInfo = ctx->connInfo;
qwBuildAndSendFetchRsp(&qwMsg->connInfo, rsp, 0, code); qwBuildAndSendFetchRsp(&mgmt->msgCb, &qwMsg->connInfo, rsp, 0, code);
QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), 0); QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), 0);
} }
...@@ -1195,7 +1195,7 @@ _return: ...@@ -1195,7 +1195,7 @@ _return:
} }
if (code || rsp) { if (code || rsp) {
qwBuildAndSendFetchRsp(&qwMsg->connInfo, rsp, dataLen, code); qwBuildAndSendFetchRsp(&mgmt->msgCb, &qwMsg->connInfo, rsp, dataLen, code);
QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), dataLen); QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), dataLen);
} }
...@@ -1226,9 +1226,9 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) { ...@@ -1226,9 +1226,9 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
QW_ERR_JRET(qwKillTaskHandle(QW_FPARAMS(), ctx)); QW_ERR_JRET(qwKillTaskHandle(QW_FPARAMS(), ctx));
qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_DROPPING); qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_DROPPING);
} else if (ctx->phase > 0) { } else if (ctx->phase > 0) {
qwBuildAndSendDropRsp(&qwMsg->connInfo, code); qwBuildAndSendDropRsp(&mgmt->msgCb, &qwMsg->connInfo, code);
QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
QW_ERR_JRET(qwDropTask(QW_FPARAMS())); QW_ERR_JRET(qwDropTask(QW_FPARAMS()));
rsped = true; rsped = true;
} else { } else {
...@@ -1241,7 +1241,7 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) { ...@@ -1241,7 +1241,7 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP); QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP);
} }
_return: _return:
if (code) { if (code) {
...@@ -1261,7 +1261,7 @@ _return: ...@@ -1261,7 +1261,7 @@ _return:
} }
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
qwBuildAndSendDropRsp(&qwMsg->connInfo, code); qwBuildAndSendDropRsp(&mgmt->msgCb, &qwMsg->connInfo, code);
QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code)); QW_TASK_DLOG("drop rsp send, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
} }
...@@ -1297,7 +1297,7 @@ int32_t qwProcessHb(SQWorkerMgmt *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { ...@@ -1297,7 +1297,7 @@ int32_t qwProcessHb(SQWorkerMgmt *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) {
_return: _return:
qwBuildAndSendHbRsp(&qwMsg->connInfo, &rsp, code); qwBuildAndSendHbRsp(&mgmt->msgCb, &qwMsg->connInfo, &rsp, code);
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);
...@@ -1351,8 +1351,9 @@ _return: ...@@ -1351,8 +1351,9 @@ _return:
QW_UNLOCK(QW_READ, &mgmt->schLock); QW_UNLOCK(QW_READ, &mgmt->schLock);
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(&mgmt->msgCb, &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), (rspList[j].rsp.taskStatus ? (int32_t)taosArrayGetSize(rspList[j].rsp.taskStatus) : 0)); 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));
tFreeSSchedulerHbRsp(&rspList[j].rsp); tFreeSSchedulerHbRsp(&rspList[j].rsp);
} }
......
...@@ -46,7 +46,7 @@ void qwFreeFetchRsp(void *msg) { ...@@ -46,7 +46,7 @@ void qwFreeFetchRsp(void *msg) {
} }
} }
int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code) { int32_t qwBuildAndSendQueryRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code) {
SQueryTableRsp rsp = {.code = code}; SQueryTableRsp rsp = {.code = code};
int32_t contLen = tSerializeSQueryTableRsp(NULL, 0, &rsp); int32_t contLen = tSerializeSQueryTableRsp(NULL, 0, &rsp);
...@@ -62,12 +62,12 @@ int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code) { ...@@ -62,12 +62,12 @@ int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code) {
.code = code, .code = code,
}; };
rpcSendResponse(&rpcRsp); tmsgSendRsp(pMsgCb, &rpcRsp);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendReadyRsp(SQWConnInfo *pConn, int32_t code) { int32_t qwBuildAndSendReadyRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code) {
SResReadyRsp *pRsp = (SResReadyRsp *)rpcMallocCont(sizeof(SResReadyRsp)); SResReadyRsp *pRsp = (SResReadyRsp *)rpcMallocCont(sizeof(SResReadyRsp));
pRsp->code = code; pRsp->code = code;
...@@ -80,12 +80,12 @@ int32_t qwBuildAndSendReadyRsp(SQWConnInfo *pConn, int32_t code) { ...@@ -80,12 +80,12 @@ int32_t qwBuildAndSendReadyRsp(SQWConnInfo *pConn, int32_t code) {
.code = code, .code = code,
}; };
rpcSendResponse(&rpcRsp); tmsgSendRsp(pMsgCb, &rpcRsp);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendHbRsp(SQWConnInfo *pConn, SSchedulerHbRsp *pStatus, int32_t code) { int32_t qwBuildAndSendHbRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, SSchedulerHbRsp *pStatus, int32_t code) {
int32_t contLen = tSerializeSSchedulerHbRsp(NULL, 0, pStatus); int32_t contLen = tSerializeSSchedulerHbRsp(NULL, 0, pStatus);
void *pRsp = rpcMallocCont(contLen); void *pRsp = rpcMallocCont(contLen);
tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus); tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus);
...@@ -99,12 +99,12 @@ int32_t qwBuildAndSendHbRsp(SQWConnInfo *pConn, SSchedulerHbRsp *pStatus, int32_ ...@@ -99,12 +99,12 @@ int32_t qwBuildAndSendHbRsp(SQWConnInfo *pConn, SSchedulerHbRsp *pStatus, int32_
.code = code, .code = code,
}; };
rpcSendResponse(&rpcRsp); tmsgSendRsp(pMsgCb, &rpcRsp);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int32_t dataLength, int32_t code) { int32_t qwBuildAndSendFetchRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int32_t dataLength, int32_t code) {
if (NULL == pRsp) { if (NULL == pRsp) {
pRsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp)); pRsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp));
memset(pRsp, 0, sizeof(SRetrieveTableRsp)); memset(pRsp, 0, sizeof(SRetrieveTableRsp));
...@@ -120,12 +120,12 @@ int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int3 ...@@ -120,12 +120,12 @@ int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int3
.code = code, .code = code,
}; };
rpcSendResponse(&rpcRsp); tmsgSendRsp(pMsgCb, &rpcRsp);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendCancelRsp(SQWConnInfo *pConn, int32_t code) { int32_t qwBuildAndSendCancelRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code) {
STaskCancelRsp *pRsp = (STaskCancelRsp *)rpcMallocCont(sizeof(STaskCancelRsp)); STaskCancelRsp *pRsp = (STaskCancelRsp *)rpcMallocCont(sizeof(STaskCancelRsp));
pRsp->code = code; pRsp->code = code;
...@@ -138,11 +138,11 @@ int32_t qwBuildAndSendCancelRsp(SQWConnInfo *pConn, int32_t code) { ...@@ -138,11 +138,11 @@ int32_t qwBuildAndSendCancelRsp(SQWConnInfo *pConn, int32_t code) {
.code = code, .code = code,
}; };
rpcSendResponse(&rpcRsp); tmsgSendRsp(pMsgCb, &rpcRsp);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendDropRsp(SQWConnInfo *pConn, int32_t code) { int32_t qwBuildAndSendDropRsp(const SMsgCb *pMsgCb, SQWConnInfo *pConn, int32_t code) {
STaskDropRsp *pRsp = (STaskDropRsp *)rpcMallocCont(sizeof(STaskDropRsp)); STaskDropRsp *pRsp = (STaskDropRsp *)rpcMallocCont(sizeof(STaskDropRsp));
pRsp->code = code; pRsp->code = code;
...@@ -155,11 +155,11 @@ int32_t qwBuildAndSendDropRsp(SQWConnInfo *pConn, int32_t code) { ...@@ -155,11 +155,11 @@ int32_t qwBuildAndSendDropRsp(SQWConnInfo *pConn, int32_t code) {
.code = code, .code = code,
}; };
rpcSendResponse(&rpcRsp); tmsgSendRsp(pMsgCb, &rpcRsp);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendShowRsp(SRpcMsg *pMsg, int32_t code) { int32_t qwBuildAndSendShowRsp(const SMsgCb *pMsgCb, SRpcMsg *pMsg, int32_t code) {
int32_t numOfCols = 6; int32_t numOfCols = 6;
SVShowTablesRsp showRsp = {0}; SVShowTablesRsp showRsp = {0};
...@@ -210,11 +210,11 @@ int32_t qwBuildAndSendShowRsp(SRpcMsg *pMsg, int32_t code) { ...@@ -210,11 +210,11 @@ int32_t qwBuildAndSendShowRsp(SRpcMsg *pMsg, int32_t code) {
.code = code, .code = code,
}; };
rpcSendResponse(&rpcMsg); tmsgSendRsp(pMsgCb, &rpcMsg);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchReq) { int32_t qwBuildAndSendShowFetchRsp(const SMsgCb *pMsgCb, SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchReq) {
SVShowTablesFetchRsp *pRsp = (SVShowTablesFetchRsp *)rpcMallocCont(sizeof(SVShowTablesFetchRsp)); SVShowTablesFetchRsp *pRsp = (SVShowTablesFetchRsp *)rpcMallocCont(sizeof(SVShowTablesFetchRsp));
int32_t handle = htonl(pFetchReq->id); int32_t handle = htonl(pFetchReq->id);
...@@ -227,7 +227,7 @@ int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchRe ...@@ -227,7 +227,7 @@ int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchRe
.code = 0, .code = 0,
}; };
rpcSendResponse(&rpcMsg); tmsgSendRsp(pMsgCb, &rpcMsg);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -287,7 +287,7 @@ int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) { ...@@ -287,7 +287,7 @@ int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
.code = TSDB_CODE_RPC_NETWORK_UNAVAIL, .code = TSDB_CODE_RPC_NETWORK_UNAVAIL,
}; };
rpcRegisterBrokenLinkArg(&pMsg); tmsgRegisterBrokenLinkArg(&mgmt->msgCb, &pMsg);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -498,7 +498,7 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) { ...@@ -498,7 +498,7 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
_return: _return:
QW_ERR_RET(qwBuildAndSendCancelRsp(&qwMsg.connInfo, code)); QW_ERR_RET(qwBuildAndSendCancelRsp(&mgmt->msgCb, &qwMsg.connInfo, code));
QW_SCH_TASK_DLOG("cancel rsp send, handle:%p, code:%x - %s", qwMsg.connInfo.handle, code, tstrerror(code)); QW_SCH_TASK_DLOG("cancel rsp send, handle:%p, code:%x - %s", qwMsg.connInfo.handle, code, tstrerror(code));
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -579,15 +579,16 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) { ...@@ -579,15 +579,16 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t qWorkerProcessShowMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) { int32_t qWorkerProcessShowMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) { if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) {
return TSDB_CODE_QRY_INVALID_INPUT; return TSDB_CODE_QRY_INVALID_INPUT;
} }
SQWorkerMgmt *pMgmt = qWorkerMgmt;
int32_t code = 0; int32_t code = 0;
SVShowTablesReq *pReq = pMsg->pCont; SVShowTablesReq *pReq = pMsg->pCont;
QW_RET(qwBuildAndSendShowRsp(pMsg, code)); QW_RET(qwBuildAndSendShowRsp(&pMgmt->msgCb, pMsg, code));
} }
int32_t qWorkerProcessShowFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) { int32_t qWorkerProcessShowFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
...@@ -595,8 +596,8 @@ int32_t qWorkerProcessShowFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) ...@@ -595,8 +596,8 @@ int32_t qWorkerProcessShowFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg)
return TSDB_CODE_QRY_INVALID_INPUT; return TSDB_CODE_QRY_INVALID_INPUT;
} }
SQWorkerMgmt *pMgmt = qWorkerMgmt;
SVShowTablesFetchReq *pFetchReq = pMsg->pCont; SVShowTablesFetchReq *pFetchReq = pMsg->pCont;
QW_RET(qwBuildAndSendShowFetchRsp(pMsg, pFetchReq)); QW_RET(qwBuildAndSendShowFetchRsp(&pMgmt->msgCb, pMsg, pFetchReq));
} }
...@@ -74,7 +74,7 @@ static int32_t streamBuildDispatchMsg(SStreamTask* pTask, SArray* data, SRpcMsg* ...@@ -74,7 +74,7 @@ static int32_t streamBuildDispatchMsg(SStreamTask* pTask, SArray* data, SRpcMsg*
pMsg->contLen = tlen; pMsg->contLen = tlen;
pMsg->code = 0; pMsg->code = 0;
pMsg->msgType = pTask->dispatchMsgType; pMsg->msgType = pTask->dispatchMsgType;
/*pMsg->noResp = 1;*/ pMsg->noResp = 1;
return 0; return 0;
} }
...@@ -124,22 +124,23 @@ int32_t streamExecTask(SStreamTask* pTask, SMsgCb* pMsgCb, const void* input, in ...@@ -124,22 +124,23 @@ int32_t streamExecTask(SStreamTask* pTask, SMsgCb* pMsgCb, const void* input, in
} }
} else if (inputType == STREAM_DATA_TYPE_SSDATA_BLOCK) { } else if (inputType == STREAM_DATA_TYPE_SSDATA_BLOCK) {
const SArray* blocks = (const SArray*)input; const SArray* blocks = (const SArray*)input;
int32_t sz = taosArrayGetSize(blocks); /*int32_t sz = taosArrayGetSize(blocks);*/
for (int32_t i = 0; i < sz; i++) { /*for (int32_t i = 0; i < sz; i++) {*/
SSDataBlock* pBlock = taosArrayGet(blocks, i); /*SSDataBlock* pBlock = taosArrayGet(blocks, i);*/
qSetStreamInput(exec, pBlock, inputType); /*qSetStreamInput(exec, pBlock, inputType);*/
while (1) { qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_DATA_TYPE_SSDATA_BLOCK);
SSDataBlock* output; while (1) {
uint64_t ts; SSDataBlock* output;
if (qExecTask(exec, &output, &ts) < 0) { uint64_t ts;
ASSERT(false); if (qExecTask(exec, &output, &ts) < 0) {
} ASSERT(false);
if (output == NULL) {
break;
}
taosArrayPush(pRes, output);
} }
if (output == NULL) {
break;
}
taosArrayPush(pRes, output);
} }
/*}*/
} else { } else {
ASSERT(0); ASSERT(0);
} }
......
...@@ -214,9 +214,11 @@ static void uvHandleReq(SSrvConn* pConn) { ...@@ -214,9 +214,11 @@ static void uvHandleReq(SSrvConn* pConn) {
// no ref here // no ref here
} }
if (pHead->noResp == 0) { // if pHead->noResp = 1,
transMsg.handle = pConn; // 1. server application should not send resp on handle
} // 2. once send out data, cli conn released to conn pool immediately
// 3. not mixed with persist
transMsg.handle = pConn;
STrans* pTransInst = pConn->pTransInst; STrans* pTransInst = pConn->pTransInst;
(*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL); (*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <sys/wait.h> #include <sys/wait.h>
#define SHM_DEFAULT_SIZE (20 * 1024 * 1024) #define SHM_DEFAULT_SIZE (20 * 1024 * 1024)
#define CEIL8(n) (ceil((float)(n) / 8) * 8)
typedef void *(*ProcThreadFp)(void *param); typedef void *(*ProcThreadFp)(void *param);
typedef struct SProcQueue { typedef struct SProcQueue {
...@@ -58,6 +57,11 @@ typedef struct SProcObj { ...@@ -58,6 +57,11 @@ typedef struct SProcObj {
bool stopFlag; bool stopFlag;
} SProcObj; } SProcObj;
static inline int32_t CEIL8(int32_t v) {
const int32_t c = ceil((float)(v) / 8) * 8;
return c < 8 ? 8 : c;
}
static int32_t taosProcInitMutex(TdThreadMutex **ppMutex, int32_t *pShmid) { static int32_t taosProcInitMutex(TdThreadMutex **ppMutex, int32_t *pShmid) {
TdThreadMutex *pMutex = NULL; TdThreadMutex *pMutex = NULL;
TdThreadMutexAttr mattr = {0}; TdThreadMutexAttr mattr = {0};
...@@ -203,7 +207,8 @@ static void taosProcCleanupQueue(SProcQueue *pQueue) { ...@@ -203,7 +207,8 @@ static void taosProcCleanupQueue(SProcQueue *pQueue) {
} }
} }
static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHeadLen, char *pBody, int32_t rawBodyLen) { static int32_t taosProcQueuePush(SProcQueue *pQueue, const char *pHead, int16_t rawHeadLen, const char *pBody,
int32_t rawBodyLen, ProcFuncType funcType) {
const int32_t headLen = CEIL8(rawHeadLen); const int32_t headLen = CEIL8(rawHeadLen);
const int32_t bodyLen = CEIL8(rawBodyLen); const int32_t bodyLen = CEIL8(rawBodyLen);
const int32_t fullLen = headLen + bodyLen + 8; const int32_t fullLen = headLen + bodyLen + 8;
...@@ -221,10 +226,12 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHea ...@@ -221,10 +226,12 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHea
} }
if (pQueue->tail < pQueue->total) { if (pQueue->tail < pQueue->total) {
*(int32_t *)(pQueue->pBuffer + pQueue->head) = headLen; *(int16_t *)(pQueue->pBuffer + pQueue->head) = headLen;
*(int8_t *)(pQueue->pBuffer + pQueue->head + 2) = (int8_t)funcType;
*(int32_t *)(pQueue->pBuffer + pQueue->head + 4) = bodyLen; *(int32_t *)(pQueue->pBuffer + pQueue->head + 4) = bodyLen;
} else { } else {
*(int32_t *)(pQueue->pBuffer) = headLen; *(int16_t *)(pQueue->pBuffer) = headLen;
*(int8_t *)(pQueue->pBuffer + pQueue->head + 2) = (int8_t)funcType;
*(int32_t *)(pQueue->pBuffer + 4) = bodyLen; *(int32_t *)(pQueue->pBuffer + 4) = bodyLen;
} }
...@@ -264,13 +271,13 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHea ...@@ -264,13 +271,13 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHea
taosThreadMutexUnlock(pQueue->mutex); taosThreadMutexUnlock(pQueue->mutex);
tsem_post(&pQueue->sem); tsem_post(&pQueue->sem);
uTrace("proc:%s, push msg to queue:%p remains:%d, head:%d:%p body:%d:%p", pQueue->name, pQueue, pQueue->items, uTrace("proc:%s, push msg to queue:%p remains:%d, head:%d:%p body:%d:%p ftype:%d", pQueue->name, pQueue, pQueue->items,
headLen, pHead, bodyLen, pBody); headLen, pHead, bodyLen, pBody, funcType);
return 0; return 0;
} }
static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHeadLen, void **ppBody, static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int16_t *pHeadLen, void **ppBody,
int32_t *pBodyLen) { int32_t *pBodyLen, ProcFuncType *pFuncType) {
tsem_wait(&pQueue->sem); tsem_wait(&pQueue->sem);
taosThreadMutexLock(pQueue->mutex); taosThreadMutexLock(pQueue->mutex);
...@@ -281,13 +288,16 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHea ...@@ -281,13 +288,16 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHea
return 0; return 0;
} }
int32_t headLen = 0; int16_t headLen = 0;
int8_t ftype = 0;
int32_t bodyLen = 0; int32_t bodyLen = 0;
if (pQueue->head < pQueue->total) { if (pQueue->head < pQueue->total) {
headLen = *(int32_t *)(pQueue->pBuffer + pQueue->head); headLen = *(int16_t *)(pQueue->pBuffer + pQueue->head);
ftype = *(int8_t *)(pQueue->pBuffer + pQueue->head + 2);
bodyLen = *(int32_t *)(pQueue->pBuffer + pQueue->head + 4); bodyLen = *(int32_t *)(pQueue->pBuffer + pQueue->head + 4);
} else { } else {
headLen = *(int32_t *)(pQueue->pBuffer); headLen = *(int16_t *)(pQueue->pBuffer);
ftype = *(int8_t *)(pQueue->pBuffer + 2);
bodyLen = *(int32_t *)(pQueue->pBuffer + 4); bodyLen = *(int32_t *)(pQueue->pBuffer + 4);
} }
...@@ -341,9 +351,10 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHea ...@@ -341,9 +351,10 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHea
*ppBody = pBody; *ppBody = pBody;
*pHeadLen = headLen; *pHeadLen = headLen;
*pBodyLen = bodyLen; *pBodyLen = bodyLen;
*pFuncType = (ProcFuncType)ftype;
uTrace("proc:%s, pop msg from queue:%p remains:%d, head:%d:%p body:%d:%p", pQueue->name, pQueue, pQueue->items, uTrace("proc:%s, pop msg from queue:%p remains:%d, head:%d:%p body:%d:%p ftype:%d", pQueue->name, pQueue, pQueue->items,
headLen, pHead, bodyLen, pBody); headLen, pHead, bodyLen, pBody, ftype);
return 1; return 1;
} }
...@@ -396,12 +407,14 @@ static void taosProcThreadLoop(SProcQueue *pQueue) { ...@@ -396,12 +407,14 @@ static void taosProcThreadLoop(SProcQueue *pQueue) {
ProcConsumeFp consumeFp = pQueue->consumeFp; ProcConsumeFp consumeFp = pQueue->consumeFp;
void *pParent = pQueue->pParent; void *pParent = pQueue->pParent;
void *pHead, *pBody; void *pHead, *pBody;
int32_t headLen, bodyLen; int16_t headLen;
ProcFuncType ftype;
int32_t bodyLen;
uDebug("proc:%s, start to get msg from queue:%p", pQueue->name, pQueue); uDebug("proc:%s, start to get msg from queue:%p", pQueue->name, pQueue);
while (1) { while (1) {
int32_t numOfMsgs = taosProcQueuePop(pQueue, &pHead, &headLen, &pBody, &bodyLen); int32_t numOfMsgs = taosProcQueuePop(pQueue, &pHead, &headLen, &pBody, &bodyLen, &ftype);
if (numOfMsgs == 0) { if (numOfMsgs == 0) {
uDebug("proc:%s, get no msg from queue:%p and exit the proc thread", pQueue->name, pQueue); uDebug("proc:%s, get no msg from queue:%p and exit the proc thread", pQueue->name, pQueue);
break; break;
...@@ -410,7 +423,7 @@ static void taosProcThreadLoop(SProcQueue *pQueue) { ...@@ -410,7 +423,7 @@ static void taosProcThreadLoop(SProcQueue *pQueue) {
taosMsleep(1); taosMsleep(1);
continue; continue;
} else { } else {
(*consumeFp)(pParent, pHead, headLen, pBody, bodyLen); (*consumeFp)(pParent, pHead, headLen, pBody, bodyLen, ftype);
} }
} }
} }
...@@ -458,10 +471,12 @@ void taosProcCleanup(SProcObj *pProc) { ...@@ -458,10 +471,12 @@ void taosProcCleanup(SProcObj *pProc) {
} }
} }
int32_t taosProcPutToChildQueue(SProcObj *pProc, void *pHead, int32_t headLen, void *pBody, int32_t bodyLen) { int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen,
return taosProcQueuePush(pProc->pChildQueue, pHead, headLen, pBody, bodyLen); ProcFuncType funcType) {
return taosProcQueuePush(pProc->pChildQueue, pHead, headLen, pBody, bodyLen, funcType);
} }
int32_t taosProcPutToParentQueue(SProcObj *pProc, void *pHead, int32_t headLen, void *pBody, int32_t bodyLen) { int32_t taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen,
return taosProcQueuePush(pProc->pParentQueue, pHead, headLen, pBody, bodyLen); ProcFuncType funcType) {
return taosProcQueuePush(pProc->pParentQueue, pHead, headLen, pBody, bodyLen, funcType);
} }
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
./test.sh -f tsim/insert/backquote.sim ./test.sh -f tsim/insert/backquote.sim
./test.sh -f tsim/insert/null.sim ./test.sh -f tsim/insert/null.sim
# ---- parser
#./test.sh -f tsim/parser/groupby-basic.sim
#./test.sh -f tsim/parser/fourArithmetic-basic.sim
# ---- query # ---- query
./test.sh -f tsim/query/interval.sim ./test.sh -f tsim/query/interval.sim
./test.sh -f tsim/query/interval-offset.sim ./test.sh -f tsim/query/interval-offset.sim
...@@ -33,5 +37,6 @@ ...@@ -33,5 +37,6 @@
# ---- tmq # ---- tmq
./test.sh -f tsim/tmq/basic.sim ./test.sh -f tsim/tmq/basic.sim
./test.sh -f tsim/tmq/basic1.sim
#======================b1-end=============== #======================b1-end===============
...@@ -41,7 +41,7 @@ print =============== insert data, mode1: one row one table in sql ...@@ -41,7 +41,7 @@ print =============== insert data, mode1: one row one table in sql
print =============== insert data, mode1: mulit rows one table in sql print =============== insert data, mode1: mulit rows one table in sql
print =============== insert data, mode1: one rows mulit table in sql print =============== insert data, mode1: one rows mulit table in sql
print =============== insert data, mode1: mulit rows mulit table in sql print =============== insert data, mode1: mulit rows mulit table in sql
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
print =============== query data print =============== query data
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
check_dnode_ready:
$loop_cnt = $loop_cnt + 1
sleep 200
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready
endi
sql connect
$dbNamme = d0
print =============== create database
sql create database $dbNamme vgroups 1
sql show databases
print $data00 $data01 $data02
if $rows != 2 then
return -1
endi
sql use $dbNamme
print =============== create super table
sql create table if not exists stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double) tags (t1 int)
sql show stables
if $rows != 1 then
return -1
endi
print =============== create child table
sql create table ct0 using stb tags(1000)
#sql create table ct1 using stb tags(2000)
#sql create table ct3 using stb tags(3000)
sql show tables
if $rows != 1 then
return -1
endi
print =============== insert data
$tbPrefix = ct
$tbNum = 1
$rowNum = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
$x = 0
while $x < $rowNum
$c2 = $x + 10
$c3 = $x * 10
$c4 = $x - 10
sql insert into $tb values ($tstart , $x , $c2 , $c3 , $c4 )
$tstart = $tstart + 1
$x = $x + 1
endw
$i = $i + 1
$tstart = 1640966400000
endw
sql select ts, c2-c1, c3/c1, c4+c1, c1*9, c1%3 from ct0
print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25
print ===> $data30 $data31 $data32 $data33 $data34 $data35
if $rows != 10 then
return -1
endi
if $data01 != 10.000000000 then
return -1
endi
if $data02 != -nan then
return -1
endi
if $data03 != -10.000000000 then
return -1
endi
if $data91 != 10.000000000 then
return -1
endi
if $data92 != 10.000000000 then
return -1
endi
if $data93 != 8.000000000 then
return -1
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablespervnode -v 4
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
check_dnode_ready:
$loop_cnt = $loop_cnt + 1
sleep 200
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready
endi
sql connect
$dbPrefix = group_db
$tbPrefix = group_tb
$mtPrefix = group_mt
$tbNum = 8
$rowNum = 100
$totalNum = $tbNum * $rowNum
print =============== groupby.sim
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
print ==== create db, stable, ctables, insert data
sql drop database if exists $db -x step1
step1:
sql create database if not exists $db keep 3650
sql use $db
sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12))
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
$tg2 = ' . abc
$tg2 = $tg2 . '
sql create table $tb using $mt tags( $i , $tg2 )
$x = 0
while $x < $rowNum
$c = $x / 10
$c = $c * 10
$c = $x - $c
$binary = ' . binary
$binary = $binary . $c
$binary = $binary . '
$nchar = ' . nchar
$nchar = $nchar . $c
$nchar = $nchar . '
sql insert into $tb values ($tstart , $c , $c , $x , $x , $c , $c , $c , $binary , $nchar )
#print ==== insert into $tb values ($tstart , $c , $c , $x , $x , $c , $c , $c , $binary , $nchar )
$tstart = $tstart + 1
$x = $x + 1
endw
$i = $i + 1
$tstart = 1640966400000
endw
sleep 100
$i1 = 1
$i2 = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$dbPrefix = group_db
$tbPrefix = group_tb
$mtPrefix = group_mt
$tb1 = $tbPrefix . $i1
$tb2 = $tbPrefix . $i2
$ts1 = $tb1 . .ts
$ts2 = $tb2 . .ts
print ===============================groupby_operation
print
print ==== select count(*), c1 from group_tb0 group by c1
sql select count(*), c1 from group_tb0 group by c1
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
print $data20 $data21 $data22 $data23
print $data80 $data81 $data82 $data83
print $data90 $data91 $data92 $data93
if $rows != 10 then
return -1
endi
#if $data00 != 10 then
# return -1
#endi
if $data01 != 0 then
return -1
endi
#if $data10 != 10 then
# return -1
#endi
if $data11 != 1 then
return -1
endi
#if $data90 != 10 then
# return -1
#endi
if $data91 != 9 then
return -1
endi
sql select first(ts),c1 from group_tb0 group by c1;
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
print $data20 $data21 $data22 $data23
print $data80 $data81 $data82 $data83
print $data90 $data91 $data92 $data93
if $row != 10 then
return -1
endi
if $data00 != @2022-01-01 00:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data90 != @2022-01-01 00:00:00.009@ then
return -1
endi
if $data91 != 9 then
return -1
endi
sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1;
if $row != 20 then
return -1
endi
if $data00 != 0 then
return -1
endi
if $data01 != 0 then
return -1
endi
print $data02
if $data02 != 0.000000000 then
return -1
endi
if $data03 != 0 then
return -1
endi
print $data04
if $data04 != 0.00000 then
return -1
endi
if $data10 != 100 then
return -1
endi
if $data11 != 1 then
return -1
endi
print $data12
if $data12 != 1.000000000 then
return -1
endi
if $data13 != 1 then
return -1
endi
if $data14 != 1.00000 then
print expect 1.00000, actual:$data14
return -1
endi
sql_error select sum(c1), ts, c1 from group_tb0 where c1<20 group by c1;
sql_error select first(ts), ts, c2 from group_tb0 where c1 < 20 group by c1;
sql_error select sum(c3), ts, c2 from group_tb0 where c1 < 20 group by c1;
sql_error select sum(c3), first(ts), c2 from group_tb0 where c1 < 20 group by c1;
sql_error select first(c3), ts, c1, c2 from group_tb0 where c1 < 20 group by c1;
sql_error select first(c3), last(c3), ts, c1 from group_tb0 where c1 < 20 group by c1;
sql_error select ts from group_tb0 group by c1;
#===========================interval=====not support======================
sql_error select count(*), c1 from group_tb0 where c1<20 interval(1y) group by c1;
#=====tbname must be the first in the group by clause=====================
sql_error select count(*) from group_tb0 where c1 < 20 group by c1, tbname;
#super table group by normal columns
sql select count(*), c1 from group_mt0 where c1< 20 group by c1;
if $row != 20 then
return -1
endi
if $data00 != 800 then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data10 != 800 then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data90 != 800 then
return -1
endi
if $data91 != 9 then
return -1
endi
sql select first(c1), c1, ts from group_mt0 where c1<20 group by c1;
if $row != 20 then
return -1
endi
if $data00 != $data01 then
return -1
endi
if $data02 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data10 != $data11 then
return -1
endi
if $data12 != @70-01-01 08:01:40.001@ then
return -1
endi
if $data20 != $data21 then
return -1
endi
if $data22 != @70-01-01 08:01:40.002@ then
return -1
endi
if $data90 != $data91 then
return -1
endi
if $data92 != @70-01-01 08:01:40.009@ then
return -1
endi
sql select first(c1), last(ts), first(ts), last(c1),c1,sum(c1),avg(c1),count(*) from group_mt0 where c1<20 group by c1;
if $row != 20 then
return -1
endi
if $data00 != $data03 then
return -1
endi
if $data01 != @70-01-01 08:01:49.900@ then
return -1
endi
if $data02 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data07 != 800 then
return -1
endi
if $data10 != $data13 then
return -1
endi
if $data11 != @70-01-01 08:01:49.901@ then
return -1
endi
if $data12 != @70-01-01 08:01:40.001@ then
return -1
endi
if $data17 != 800 then
return -1
endi
if $data90 != $data93 then
return -1
endi
if $data91 != @70-01-01 08:01:49.909@ then
return -1
endi
if $data92 != @70-01-01 08:01:40.009@ then
return -1
endi
if $data97 != 800 then
return -1
endi
if $data95 != 7200 then
return -1
endi
if $data94 != 9 then
return -1
endi
sql select c1,sum(c1),avg(c1),count(*) from group_mt0 where c1<5 group by c1;
if $row != 5 then
return -1
endi
if $data00 != 0 then
return -1
endi
if $data11 != 800 then
return -1
endi
sql select first(c1), last(ts), first(ts), last(c1),sum(c1),avg(c1),count(*) from group_mt0 where c1<20 group by tbname,c1;
if $row != 160 then
return -1
endi
print $data00
if $data00 != 0 then
return -1
endi
if $data01 != @70-01-01 08:01:49.900@ then
return -1
endi
print $data01
if $data02 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data03 != 0 then
return -1
endi
if $data04 != 0 then
return -1
endi
if $data06 != 100 then
return -1
endi
if $data07 != @group_tb0@ then
return -1
endi
if $data90 != 9 then
return -1
endi
if $data91 != @70-01-01 08:01:49.909@ then
return -1
endi
if $data92 != @70-01-01 08:01:40.009@ then
return -1
endi
if $data93 != 9 then
return -1
endi
if $data94 != 900 then
return -1
endi
if $data96 != 100 then
return -1
endi
if $data97 != @group_tb0@ then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4;
if $rows != 10000 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data02 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data03 != 0 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4 limit 1;
if $rows != 1 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4 limit 20 offset 9990;
if $rows != 10 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3),max(c3),sum(c3),avg(c3),sum(c4)/count(c4) from group_tb1 group by c4;
if $rows != 10000 then
return -1
endi
print ---------------------------------> group by binary|nchar data add cases
sql select count(*) from group_tb1 group by c8;
if $rows != 100 then
return -1
endi
sql select count(*),sum(c4), count(c4), sum(c4)/count(c4) from group_tb1 group by c8
if $rows != 100 then
return -1
endi
if $data00 != 100 then
return -1
endi
if $data01 != 495000 then
return -1
endi
if $data02 != 100 then
return -1
endi
if $data03 != 4950.000000000 then
print expect 4950.000000000 , acutal $data03
return -1
endi
if $data10 != 100 then
return -1
endi
if $data11 != 495100 then
return -1
endi
if $data13 != 4951.000000000 then
return -1
endi
print ====================> group by normal column + slimit + soffset
sql select count(*), c8 from group_mt0 group by c8 limit 1 offset 0;
if $rows != 100 then
return -1
endi
sql select sum(c2),c8,avg(c2), sum(c2)/count(*) from group_mt0 group by c8 slimit 2 soffset 99
if $rows != 1 then
return -1
endi
if $data00 != 79200.000000000 then
return -1
endi
if $data01 != @binary99@ then
return -1
endi
if $data02 != 99.000000000 then
return -1
endi
if $data03 != 99.000000000 then
return -1
endi
print ============>td-1765
sql select percentile(c4, 49),min(c4),max(c4),avg(c4),stddev(c4) from group_tb0 group by c8;
if $rows != 100 then
return -1
endi
if $data00 != 4851.000000000 then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data02 != 9900 then
return -1
endi
if $data03 != 4950.000000000 then
return -1
endi
if $data04 != 2886.607004772 then
return -1
endi
if $data10 != 4852.000000000 then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data12 != 9901 then
return -1
endi
if $data13 != 4951.000000000 then
return -1
endi
if $data14 != 2886.607004772 then
return -1
endi
print ================>td-2090
sql select leastsquares(c2, 1, 1) from group_tb1 group by c8;
if $rows != 100 then
return -1
endi
if $data00 != @{slop:0.000000, intercept:0.000000}@ then
return -1
endi
if $data10 != @{slop:0.000000, intercept:1.000000}@ then
return -1
endi
if $data90 != @{slop:0.000000, intercept:9.000000}@ then
return -1
endi
#=========================== group by multi tags ======================
sql create table st (ts timestamp, c int) tags (t1 int, t2 int, t3 int, t4 int);
sql create table t1 using st tags(1, 1, 1, 1);
sql create table t2 using st tags(1, 2, 2, 2);
sql insert into t1 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ;
sql insert into t1 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ;
sql insert into t2 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ;
sql insert into t2 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ;
print =================>TD-2665
sql_error create table txx as select avg(c) as t from st;
sql_error create table txx1 as select avg(c) as t from t1;
sql select stddev(c),stddev(c) from st group by c;
if $rows != 4 then
return -1
endi
print =================>TD-2236
sql select first(ts),last(ts) from t1 group by c;
if $rows != 4 then
return -1
endi
if $data00 != @20-03-27 04:11:16.000@ then
return -1
endi
if $data01 != @20-03-27 04:21:16.000@ then
return -1
endi
if $data10 != @20-03-27 04:11:17.000@ then
return -1
endi
if $data11 != @20-03-27 04:31:17.000@ then
return -1
endi
if $data20 != @20-03-27 04:11:18.000@ then
return -1
endi
if $data21 != @20-03-27 04:51:18.000@ then
return -1
endi
if $data30 != @20-03-27 04:11:19.000@ then
return -1
endi
if $data31 != @20-03-27 05:10:19.000@ then
return -1
endi
print ===============>
sql select stddev(c),c from st where t2=1 or t2=2 group by c;
if $rows != 4 then
return -1
endi
if $data00 != 0.000000000 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 0.000000000 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 0.000000000 then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data30 != 0.000000000 then
return -1
endi
if $data31 != 4 then
return -1
endi
sql_error select irate(c) from st where t1="1" and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' interval(1m) sliding(15s) group by tbname,c;
sql select irate(c) from st where t1="1" and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' interval(1m) sliding(15s) group by tbname,t1,t2;
if $rows != 40 then
return -1
endi
if $data01 != 1.000000000 then
return -1
endi
if $data02 != t1 then
return -1
endi
if $data03 != 1 then
return -1
endi
if $data04 != 1 then
return -1
endi
if $data11 != 1.000000000 then
return -1
endi
if $data12 != t1 then
return -1
endi
if $data13 != 1 then
return -1
endi
if $data14 != 1 then
return -1
endi
sql select irate(c) from st where t1="1" and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' interval(1m) sliding(15s) group by tbname,t1,t2 limit 1;
if $rows != 2 then
return -1
endi
if $data11 != 1.000000000 then
return -1
endi
if $data12 != t2 then
return -1
endi
if $data13 != 1 then
return -1
endi
if $data14 != 2 then
return -1
endi
sql create table m1 (ts timestamp, k int, f1 int) tags(a int);
sql create table tm0 using m1 tags(0);
sql create table tm1 using m1 tags(1);
sql insert into tm0 values('2020-1-1 1:1:1', 1, 10);
sql insert into tm0 values('2020-1-1 1:1:2', 1, 20);
sql insert into tm1 values('2020-2-1 1:1:1', 2, 10);
sql insert into tm1 values('2020-2-1 1:1:2', 2, 20);
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 100
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect
sleep 100
sql use group_db0;
print =========================>TD-4894
sql select count(*),k from m1 group by k;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data11 != 2 then
return -1
endi
sql_error select count(*) from m1 group by tbname,k,f1;
sql_error select count(*) from m1 group by tbname,k,a;
sql_error select count(*) from m1 group by k, tbname;
sql_error select count(*) from m1 group by k,f1;
sql_error select count(*) from tm0 group by tbname;
sql_error select count(*) from tm0 group by a;
sql_error select count(*) from tm0 group by k,f1;
sql_error select count(*),f1 from m1 group by tbname,k;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -41,6 +41,38 @@ sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6 ) ...@@ -41,6 +41,38 @@ sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6 )
sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7 ) sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7 )
sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8 ) sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8 )
print =============== insert data into child table ct2 (d)
sql insert into ct2 values ( '2022-01-01 01:00:01.000', 1 )
sql insert into ct2 values ( '2022-01-01 10:00:01.000', 2 )
sql insert into ct2 values ( '2022-01-01 20:00:01.000', 3 )
sql insert into ct2 values ( '2022-01-02 10:00:01.000', 4 )
sql insert into ct2 values ( '2022-01-02 20:00:01.000', 5 )
sql insert into ct2 values ( '2022-01-03 10:00:01.000', 6 )
sql insert into ct2 values ( '2022-01-03 20:00:01.000', 7 )
print =============== insert data into child table ct3 (n)
sql insert into ct3 values ( '2021-12-21 01:01:01.000', NULL )
sql insert into ct3 values ( '2021-12-31 01:01:01.000', 1 )
sql insert into ct3 values ( '2022-01-01 01:01:06.000', 2 )
sql insert into ct3 values ( '2022-01-07 01:01:10.000', 3 )
sql insert into ct3 values ( '2022-01-31 01:01:16.000', 4 )
sql insert into ct3 values ( '2022-02-01 01:01:20.000', 5 )
sql insert into ct3 values ( '2022-02-28 01:01:26.000', 6 )
sql insert into ct3 values ( '2022-03-01 01:01:30.000', 7 )
sql insert into ct3 values ( '2022-03-08 01:01:36.000', 8 )
print =============== insert data into child table ct4 (y)
sql insert into ct4 values ( '2020-10-21 01:01:01.000', 1 )
sql insert into ct4 values ( '2020-12-31 01:01:01.000', 2 )
sql insert into ct4 values ( '2021-01-01 01:01:06.000', 3 )
sql insert into ct4 values ( '2021-05-07 01:01:10.000', 4 )
sql insert into ct4 values ( '2021-09-30 01:01:16.000', 5 )
sql insert into ct4 values ( '2022-02-01 01:01:20.000', 6 )
sql insert into ct4 values ( '2022-10-28 01:01:26.000', 7 )
sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8 )
sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9 )
print ================ start query ======================
sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s)
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s)
print ===> rows: $rows print ===> rows: $rows
...@@ -102,15 +134,6 @@ if $data80 != 1 then ...@@ -102,15 +134,6 @@ if $data80 != 1 then
return -1 return -1
endi endi
print =============== insert data into child table ct2 (d)
sql insert into ct2 values ( '2022-01-01 01:00:01.000', 1 )
sql insert into ct2 values ( '2022-01-01 10:00:01.000', 2 )
sql insert into ct2 values ( '2022-01-01 20:00:01.000', 3 )
sql insert into ct2 values ( '2022-01-02 10:00:01.000', 4 )
sql insert into ct2 values ( '2022-01-02 20:00:01.000', 5 )
sql insert into ct2 values ( '2022-01-03 10:00:01.000', 6 )
sql insert into ct2 values ( '2022-01-03 20:00:01.000', 7 )
sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h)
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h)
print ===> rows: $rows print ===> rows: $rows
...@@ -140,45 +163,19 @@ print ===> rows4: $data40 $data41 $data42 $data43 $data44 $data45 ...@@ -140,45 +163,19 @@ print ===> rows4: $data40 $data41 $data42 $data43 $data44 $data45
print ===> rows5: $data50 $data51 $data52 $data53 $data54 $data55 print ===> rows5: $data50 $data51 $data52 $data53 $data54 $data55
print ===> rows6: $data60 $data61 $data62 $data63 $data64 $data65 print ===> rows6: $data60 $data61 $data62 $data63 $data64 $data65
print ===> rows7: $data70 $data71 $data72 $data73 $data74 $data75 print ===> rows7: $data70 $data71 $data72 $data73 $data74 $data75
#if $rows != 8 then if $rows != 8 then
# return -1 return -1
#endi endi
#if $data00 != 1 then if $data00 != 1 then
# return -1 return -1
#endi endi
#if $data10 != 2 then if $data10 != 2 then
# return -1 return -1
#endi endi
#if $data20 != 2 then if $data70 != 1 then
# return -1 return -1
#endi endi
#if $data30 != 2 then
# return -1
#endi
#if $data40 != 2 then
# return -1
#endi
#if $data50 != 2 then
# return -1
#endi
#if $data60 != 2 then
# return -1
#endi
#if $data70 != 1 then
# return -1
#endi
print =============== insert data into child table ct3 (n)
sql insert into ct3 values ( '2021-12-21 01:01:01.000', NULL );
sql insert into ct3 values ( '2021-12-31 01:01:01.000', 1 );
sql insert into ct3 values ( '2022-01-01 01:01:06.000', 2 );
sql insert into ct3 values ( '2022-01-07 01:01:10.000', 3 );
sql insert into ct3 values ( '2022-01-31 01:01:16.000', 4 );
sql insert into ct3 values ( '2022-02-01 01:01:20.000', 5 );
sql insert into ct3 values ( '2022-02-28 01:01:26.000', 6 );
sql insert into ct3 values ( '2022-03-01 01:01:30.000', 7 );
sql insert into ct3 values ( '2022-03-08 01:01:36.000', 8 );
sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w)
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w)
print ===> rows: $rows print ===> rows: $rows
...@@ -236,18 +233,6 @@ print ===> rows7: $data70 $data71 $data72 $data73 $data74 ...@@ -236,18 +233,6 @@ print ===> rows7: $data70 $data71 $data72 $data73 $data74
# return -1 # return -1
#endi #endi
print =============== insert data into child table ct4 (y)
sql insert into ct4 values ( '2020-10-21 01:01:01.000', 1 )
sql insert into ct4 values ( '2020-12-31 01:01:01.000', 2 )
sql insert into ct4 values ( '2021-01-01 01:01:06.000', 3 )
sql insert into ct4 values ( '2021-05-07 01:01:10.000', 4 )
sql insert into ct4 values ( '2021-09-30 01:01:16.000', 5 )
sql insert into ct4 values ( '2022-02-01 01:01:20.000', 6 )
sql insert into ct4 values ( '2022-10-28 01:01:26.000', 7 )
sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8 )
sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9 )
sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n)
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n)
print ===> rows: $rows print ===> rows: $rows
...@@ -305,6 +290,27 @@ print ===> rows7: $data70 $data71 $data72 $data73 $data74 ...@@ -305,6 +290,27 @@ print ===> rows7: $data70 $data71 $data72 $data73 $data74
# return -1 # return -1
#endi #endi
#=================================================
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
check_dnode_ready:
$loop_cnt = $loop_cnt + 1
sleep 200
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready
endi
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
run tsim/user/basic1.sim run tsim/user/basic1.sim
run tsim/db/basic1.sim run tsim/db/basic1.sim
run tsim/db/basic2.sim
run tsim/db/basic3.sim
run tsim/db/basic6.sim run tsim/db/basic6.sim
run tsim/db/basic7.sim run tsim/db/basic7.sim
run tsim/db/error1.sim run tsim/db/error1.sim
...@@ -13,12 +15,15 @@ run tsim/insert/basic1.sim ...@@ -13,12 +15,15 @@ run tsim/insert/basic1.sim
run tsim/insert/backquote.sim run tsim/insert/backquote.sim
run tsim/insert/null.sim run tsim/insert/null.sim
#run tsim/parser/groupby-basic.sim
#run tsim/parser/fourArithmetic-basic.sim
run tsim/query/interval.sim run tsim/query/interval.sim
#run tsim/query/interval-offset.sim # TD-14266 run tsim/query/interval-offset.sim
run tsim/show/basic.sim run tsim/show/basic.sim
run tsim/table/basic1.sim run tsim/table/basic1.sim
run tsim/tmq/basic.sim run tsim/tmq/basic.sim
run tsim/tmq/basic1.sim
#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406
# vgroups=1, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb
# vgroups=1, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb
# vgroups=4, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb
# vgroups=4, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb
# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN
# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5;
#
# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval).
#
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
check_dnode_ready:
$loop_cnt = $loop_cnt + 1
sleep 200
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready
endi
sql connect
$dbNamme = d0
print =============== create database , vgroup 1
sql create database $dbNamme vgroups 1
sql show databases
print $data00 $data01 $data02
if $rows != 2 then
return -1
endi
sql use $dbNamme
print =============== create super table
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int)
sql show stables
if $rows != 1 then
return -1
endi
print =============== create child table
sql create table ct0 using stb tags(1000)
sql create table ct1 using stb tags(2000)
#sql create table ct3 using stb tags(3000)
print =============== create normal table
sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10))
print =============== create multi topics. notes: now only support:
print =============== 1. columns from stb; 2. * from ctb; 3. columns from ctb
print =============== will support: * from stb; function from stb/ctb
sql create topic topic_stb_column as select ts, c1, c3 from stb
#sql create topic topic_stb_all as select * from stb
#sql create topic topic_stb_function as select ts, abs(c1), sina(c2) from stb
sql create topic topic_ctb_column as select ts, c1, c3 from ct0
sql create topic topic_ctb_all as select * from ct0
#sql create topic topic_ctb_function as select ts, abs(c1), sina(c2) from ct0
sql create topic topic_ntb_column as select ts, c1, c3 from ntb
sql create topic topic_ntb_all as select * from ntb
#sql create topic topic_ntb_function as select ts, abs(c1), sina(c2) from ntb
sql show tables
if $rows != 3 then
return -1
endi
print =============== insert data
$tbPrefix = ct
$tbNum = 2
$rowNum = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
$x = 0
while $x < $rowNum
$c = $x / 10
$c = $c * 10
$c = $x - $c
$binary = ' . binary
$binary = $binary . $c
$binary = $binary . '
sql insert into $tb values ($tstart , $c , $x , $binary )
sql insert into ntb values ($tstart , $c , $x , $binary )
$tstart = $tstart + 1
$x = $x + 1
endw
$i = $i + 1
$tstart = 1640966400000
endw
#root@trd02 /home $ tmq_sim --help
# -c Configuration directory, default is
# -d The name of the database for cosumer, no default
# -t The topic string for cosumer, no default
# -k The key-value string for cosumer, no default
# -g showMsgFlag, default is 0
#
$totalMsgCnt = $rowNum * $tbNum
print inserted totalMsgCnt: $totalMsgCnt
# supported key:
# group.id:<xxx>
# enable.auto.commit:<true | false>
# auto.offset.reset:<earliest | latest | none>
# td.connect.ip:<fqdn | ipaddress>
# td.connect.user:root
# td.connect.pass:taosdata
# td.connect.port:6030
# td.connect.db:db
print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2"
system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2"
print cmd result----> $system_content
if $system_content != @{consume success: 20, 0}@ then
return -1
endi
#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2"
#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2"
#print cmd result----> $system_content
#if $system_content != @{consume success: 20, 0}@ then
# return -1
#endi
print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2"
system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2"
print cmd result----> $system_content
if $system_content != @{consume success: 10, 0}@ then
return -1
endi
print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2"
system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2"
print cmd result----> $system_content
if $system_content != @{consume success: 10, 0}@ then
return -1
endi
print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2"
system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2"
print cmd result----> $system_content
if $system_content != @{consume success: 20, 0}@ then
return -1
endi
print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2"
system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2"
print cmd result----> $system_content
if $system_content != @{consume success: 20, 0}@ then
return -1
endi
print =============== create database , vgroup 4
$dbNamme = d1
sql create database $dbNamme vgroups 4
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -67,7 +67,7 @@ static SConfInfo g_stConfInfo = { ...@@ -67,7 +67,7 @@ static SConfInfo g_stConfInfo = {
"tmqdb", "tmqdb",
"stb", "stb",
"./tmqResult.txt", // output_file "./tmqResult.txt", // output_file
"/data2/dnode/data/vnode/vnode2/wal", "", // /data2/dnode/data/vnode/vnode2/wal",
1, // threads 1, // threads
1, // tables 1, // tables
1, // vgroups 1, // vgroups
...@@ -662,7 +662,7 @@ int main(int32_t argc, char *argv[]) { ...@@ -662,7 +662,7 @@ int main(int32_t argc, char *argv[]) {
float msgsSpeed = totalMsgs / seconds; float msgsSpeed = totalMsgs / seconds;
if (0 == g_stConfInfo.simCase) { if ((0 == g_stConfInfo.simCase) && (strlen(g_stConfInfo.vnodeWalPath))) {
walLogSize = getDirectorySize(g_stConfInfo.vnodeWalPath); walLogSize = getDirectorySize(g_stConfInfo.vnodeWalPath);
if (walLogSize <= 0) { if (walLogSize <= 0) {
printf("%s size incorrect!", g_stConfInfo.vnodeWalPath); printf("%s size incorrect!", g_stConfInfo.vnodeWalPath);
......
...@@ -98,7 +98,7 @@ void parseArgument(int32_t argc, char *argv[]) { ...@@ -98,7 +98,7 @@ void parseArgument(int32_t argc, char *argv[]) {
} }
} }
#if 1 #if 0
pPrint("%s configDir:%s %s", GREEN, configDir, NC); pPrint("%s configDir:%s %s", GREEN, configDir, NC);
pPrint("%s dbName:%s %s", GREEN, g_stConfInfo.dbName, NC); pPrint("%s dbName:%s %s", GREEN, g_stConfInfo.dbName, NC);
pPrint("%s topicString:%s %s", GREEN, g_stConfInfo.topicString, NC); pPrint("%s topicString:%s %s", GREEN, g_stConfInfo.topicString, NC);
...@@ -151,8 +151,6 @@ void parseInputString() { ...@@ -151,8 +151,6 @@ void parseInputString() {
token = strtok(NULL, delim); token = strtok(NULL, delim);
} }
printf("\n\n");
token = strtok(g_stConfInfo.keyString, delim); token = strtok(g_stConfInfo.keyString, delim);
while(token != NULL) { while(token != NULL) {
//printf("%s\n", token ); //printf("%s\n", token );
...@@ -198,6 +196,8 @@ tmq_t* build_consumer() { ...@@ -198,6 +196,8 @@ tmq_t* build_consumer() {
TAOS_RES* pRes = taos_query(pConn, sqlStr); TAOS_RES* pRes = taos_query(pConn, sqlStr);
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
printf("error in use db, reason:%s\n", taos_errstr(pRes)); printf("error in use db, reason:%s\n", taos_errstr(pRes));
taos_free_result(pRes);
exit(-1);
} }
taos_free_result(pRes); taos_free_result(pRes);
...@@ -219,61 +219,33 @@ tmq_list_t* build_topic_list() { ...@@ -219,61 +219,33 @@ tmq_list_t* build_topic_list() {
return topic_list; return topic_list;
} }
void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) { void loop_consume(tmq_t* tmq) {
static const int MIN_COMMIT_COUNT = 1000;
int msg_count = 0;
tmq_resp_err_t err;
if ((err = tmq_subscribe(tmq, topics))) {
fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(err));
return;
}
while (running) {
tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 1);
if (tmqmessage) {
msg_process(tmqmessage);
tmq_message_destroy(tmqmessage);
if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0);
}
}
err = tmq_consumer_close(tmq);
if (err)
fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(err));
else
fprintf(stderr, "%% Consumer closed\n");
}
void perf_loop(tmq_t* tmq, tmq_list_t* topics) {
tmq_resp_err_t err; tmq_resp_err_t err;
if ((err = tmq_subscribe(tmq, topics))) {
printf("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err));
return;
}
int32_t totalMsgs = 0; int32_t totalMsgs = 0;
int32_t totalRows = 0;
int32_t skipLogNum = 0; int32_t skipLogNum = 0;
//int64_t startTime = taosGetTimestampUs();
while (running) { while (running) {
tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 1); tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 1);
if (tmqmessage) { if (tmqMsg) {
totalMsgs++; totalMsgs++;
skipLogNum += tmqGetSkipLogNum(tmqmessage);
#if 0
TAOS_ROW row;
while (NULL != (row = tmq_get_row(tmqMsg))) {
totalRows++;
}
#endif
skipLogNum += tmqGetSkipLogNum(tmqMsg);
if (0 != g_stConfInfo.showMsgFlag) { if (0 != g_stConfInfo.showMsgFlag) {
msg_process(tmqmessage); msg_process(tmqMsg);
} }
tmq_message_destroy(tmqmessage); tmq_message_destroy(tmqMsg);
} else { } else {
break; break;
} }
} }
//int64_t endTime = taosGetTimestampUs();
//double consumeTime = (double)(endTime - startTime) / 1000000;
err = tmq_consumer_close(tmq); err = tmq_consumer_close(tmq);
if (err) { if (err) {
...@@ -281,7 +253,7 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics) { ...@@ -281,7 +253,7 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics) {
exit(-1); exit(-1);
} }
printf("{consume success: %d}", totalMsgs); printf("{consume success: %d, %d}", totalMsgs, totalRows);
} }
int main(int32_t argc, char *argv[]) { int main(int32_t argc, char *argv[]) {
...@@ -294,7 +266,21 @@ int main(int32_t argc, char *argv[]) { ...@@ -294,7 +266,21 @@ int main(int32_t argc, char *argv[]) {
return -1; return -1;
} }
perf_loop(tmq, topic_list); tmq_resp_err_t err = tmq_subscribe(tmq, topic_list);
if (err) {
printf("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err));
exit(-1);
}
loop_consume(tmq);
#if 0
err = tmq_unsubscribe(tmq);
if (err) {
printf("tmq_unsubscribe() fail, reason: %s\n", tmq_err2str(err));
exit(-1);
}
#endif
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册