提交 195ff4f5 编写于 作者: X Xiaoyu Wang

TD-13705 parser integrate and CREATE DATABASE implement

上级 649905f4
......@@ -16,269 +16,101 @@
#ifndef TDENGINE_TTOKENDEF_H
#define TDENGINE_TTOKENDEF_H
#define TK_ID 1
#define TK_BOOL 2
#define TK_INTEGER 3
#define TK_FLOAT 4
#define TK_STRING 5
#define TK_TIMESTAMP 6
#define TK_OR 7
#define TK_AND 8
#define TK_NOT 9
#define TK_EQ 10
#define TK_NE 11
#define TK_ISNULL 12
#define TK_NOTNULL 13
#define TK_IS 14
#define TK_LIKE 15
#define TK_MATCH 16
#define TK_NMATCH 17
#define TK_GLOB 18
#define TK_BETWEEN 19
#define TK_IN 20
#define TK_GT 21
#define TK_GE 22
#define TK_LT 23
#define TK_LE 24
#define TK_BITAND 25
#define TK_BITOR 26
#define TK_LSHIFT 27
#define TK_RSHIFT 28
#define TK_PLUS 29
#define TK_MINUS 30
#define TK_DIVIDE 31
#define TK_TIMES 32
#define TK_STAR 33
#define TK_SLASH 34
#define TK_REM 35
#define TK_CONCAT 36
#define TK_UMINUS 37
#define TK_UPLUS 38
#define TK_BITNOT 39
#define TK_SHOW 40
#define TK_DATABASES 41
#define TK_TOPICS 42
#define TK_FUNCTIONS 43
#define TK_MNODES 44
#define TK_DNODES 45
#define TK_ACCOUNTS 46
#define TK_USERS 47
#define TK_MODULES 48
#define TK_QUERIES 49
#define TK_CONNECTIONS 50
#define TK_STREAMS 51
#define TK_VARIABLES 52
#define TK_SCORES 53
#define TK_GRANTS 54
#define TK_VNODES 55
#define TK_DOT 56
#define TK_CREATE 57
#define TK_TABLE 58
#define TK_STABLE 59
#define TK_DATABASE 60
#define TK_TABLES 61
#define TK_STABLES 62
#define TK_VGROUPS 63
#define TK_DROP 64
#define TK_TOPIC 65
#define TK_FUNCTION 66
#define TK_DNODE 67
#define TK_USER 68
#define TK_ACCOUNT 69
#define TK_USE 70
#define TK_DESCRIBE 71
#define TK_DESC 72
#define TK_ALTER 73
#define TK_PASS 74
#define TK_PRIVILEGE 75
#define TK_LOCAL 76
#define TK_COMPACT 77
#define TK_LP 78
#define TK_RP 79
#define TK_IF 80
#define TK_EXISTS 81
#define TK_PORT 82
#define TK_IPTOKEN 83
#define TK_AS 84
#define TK_OUTPUTTYPE 85
#define TK_AGGREGATE 86
#define TK_BUFSIZE 87
#define TK_PPS 88
#define TK_TSERIES 89
#define TK_DBS 90
#define TK_STORAGE 91
#define TK_QTIME 92
#define TK_CONNS 93
#define TK_STATE 94
#define TK_COMMA 95
#define TK_KEEP 96
#define TK_CACHE 97
#define TK_REPLICA 98
#define TK_QUORUM 99
#define TK_DAYS 100
#define TK_MINROWS 101
#define TK_MAXROWS 102
#define TK_BLOCKS 103
#define TK_CTIME 104
#define TK_WAL 105
#define TK_FSYNC 106
#define TK_COMP 107
#define TK_PRECISION 108
#define TK_UPDATE 109
#define TK_CACHELAST 110
#define TK_STREAM 111
#define TK_MODE 112
#define TK_UNSIGNED 113
#define TK_TAGS 114
#define TK_USING 115
#define TK_NULL 116
#define TK_NOW 117
#define TK_SELECT 118
#define TK_UNION 119
#define TK_ALL 120
#define TK_DISTINCT 121
#define TK_FROM 122
#define TK_VARIABLE 123
#define TK_INTERVAL 124
#define TK_EVERY 125
#define TK_SESSION 126
#define TK_STATE_WINDOW 127
#define TK_FILL 128
#define TK_SLIDING 129
#define TK_ORDER 130
#define TK_BY 131
#define TK_ASC 132
#define TK_GROUP 133
#define TK_HAVING 134
#define TK_LIMIT 135
#define TK_OFFSET 136
#define TK_SLIMIT 137
#define TK_SOFFSET 138
#define TK_WHERE 139
#define TK_RESET 140
#define TK_QUERY 141
#define TK_SYNCDB 142
#define TK_ADD 143
#define TK_COLUMN 144
#define TK_MODIFY 145
#define TK_TAG 146
#define TK_CHANGE 147
#define TK_SET 148
#define TK_KILL 149
#define TK_CONNECTION 150
#define TK_COLON 151
#define TK_ABORT 152
#define TK_AFTER 153
#define TK_ATTACH 154
#define TK_BEFORE 155
#define TK_BEGIN 156
#define TK_CASCADE 157
#define TK_CLUSTER 158
#define TK_CONFLICT 159
#define TK_COPY 160
#define TK_DEFERRED 161
#define TK_DELIMITERS 162
#define TK_DETACH 163
#define TK_EACH 164
#define TK_END 165
#define TK_EXPLAIN 166
#define TK_FAIL 167
#define TK_FOR 168
#define TK_IGNORE 169
#define TK_IMMEDIATE 170
#define TK_INITIALLY 171
#define TK_INSTEAD 172
#define TK_KEY 173
#define TK_OF 174
#define TK_RAISE 175
#define TK_REPLACE 176
#define TK_RESTRICT 177
#define TK_ROW 178
#define TK_STATEMENT 179
#define TK_TRIGGER 180
#define TK_VIEW 181
#define TK_SEMI 182
#define TK_NONE 183
#define TK_PREV 184
#define TK_LINEAR 185
#define TK_IMPORT 186
#define TK_TBNAME 187
#define TK_JOIN 188
#define TK_INSERT 189
#define TK_INTO 190
#define TK_VALUES 191
#define NEW_TK_OR 1
#define NEW_TK_AND 2
#define NEW_TK_UNION 3
#define NEW_TK_ALL 4
#define NEW_TK_MINUS 5
#define NEW_TK_EXCEPT 6
#define NEW_TK_INTERSECT 7
#define NEW_TK_NK_PLUS 8
#define NEW_TK_NK_MINUS 9
#define NEW_TK_NK_STAR 10
#define NEW_TK_NK_SLASH 11
#define NEW_TK_NK_REM 12
#define NEW_TK_SHOW 13
#define NEW_TK_DATABASES 14
#define NEW_TK_NK_INTEGER 15
#define NEW_TK_NK_FLOAT 16
#define NEW_TK_NK_STRING 17
#define NEW_TK_NK_BOOL 18
#define NEW_TK_TIMESTAMP 19
#define NEW_TK_NK_VARIABLE 20
#define NEW_TK_NK_COMMA 21
#define NEW_TK_NK_ID 22
#define NEW_TK_NK_LP 23
#define NEW_TK_NK_RP 24
#define NEW_TK_NK_DOT 25
#define NEW_TK_BETWEEN 26
#define NEW_TK_NOT 27
#define NEW_TK_IS 28
#define NEW_TK_NULL 29
#define NEW_TK_NK_LT 30
#define NEW_TK_NK_GT 31
#define NEW_TK_NK_LE 32
#define NEW_TK_NK_GE 33
#define NEW_TK_NK_NE 34
#define NEW_TK_NK_EQ 35
#define NEW_TK_LIKE 36
#define NEW_TK_MATCH 37
#define NEW_TK_NMATCH 38
#define NEW_TK_IN 39
#define NEW_TK_FROM 40
#define NEW_TK_AS 41
#define NEW_TK_JOIN 42
#define NEW_TK_ON 43
#define NEW_TK_INNER 44
#define NEW_TK_SELECT 45
#define NEW_TK_DISTINCT 46
#define NEW_TK_WHERE 47
#define NEW_TK_PARTITION 48
#define NEW_TK_BY 49
#define NEW_TK_SESSION 50
#define NEW_TK_STATE_WINDOW 51
#define NEW_TK_INTERVAL 52
#define NEW_TK_SLIDING 53
#define NEW_TK_FILL 54
#define NEW_TK_VALUE 55
#define NEW_TK_NONE 56
#define NEW_TK_PREV 57
#define NEW_TK_LINEAR 58
#define NEW_TK_NEXT 59
#define NEW_TK_GROUP 60
#define NEW_TK_HAVING 61
#define NEW_TK_ORDER 62
#define NEW_TK_SLIMIT 63
#define NEW_TK_SOFFSET 64
#define NEW_TK_LIMIT 65
#define NEW_TK_OFFSET 66
#define NEW_TK_ASC 67
#define NEW_TK_DESC 68
#define NEW_TK_NULLS 69
#define NEW_TK_FIRST 70
#define NEW_TK_LAST 71
#define TK_OR 1
#define TK_AND 2
#define TK_UNION 3
#define TK_ALL 4
#define TK_MINUS 5
#define TK_EXCEPT 6
#define TK_INTERSECT 7
#define TK_NK_BITAND 8
#define TK_NK_BITOR 9
#define TK_NK_LSHIFT 10
#define TK_NK_RSHIFT 11
#define TK_NK_PLUS 12
#define TK_NK_MINUS 13
#define TK_NK_STAR 14
#define TK_NK_SLASH 15
#define TK_NK_REM 16
#define TK_NK_CONCAT 17
#define TK_CREATE 18
#define TK_DATABASE 19
#define TK_IF 20
#define TK_NOT 21
#define TK_EXISTS 22
#define TK_BLOCKS 23
#define TK_NK_INTEGER 24
#define TK_CACHE 25
#define TK_CACHELAST 26
#define TK_COMP 27
#define TK_DAYS 28
#define TK_FSYNC 29
#define TK_MAXROWS 30
#define TK_MINROWS 31
#define TK_KEEP 32
#define TK_PRECISION 33
#define TK_NK_STRING 34
#define TK_QUORUM 35
#define TK_REPLICA 36
#define TK_TTL 37
#define TK_WAL 38
#define TK_VGROUPS 39
#define TK_SINGLESTABLE 40
#define TK_STREAMMODE 41
#define TK_NK_FLOAT 42
#define TK_NK_BOOL 43
#define TK_TIMESTAMP 44
#define TK_NK_VARIABLE 45
#define TK_NK_COMMA 46
#define TK_NK_ID 47
#define TK_NK_LP 48
#define TK_NK_RP 49
#define TK_NK_DOT 50
#define TK_BETWEEN 51
#define TK_IS 52
#define TK_NULL 53
#define TK_NK_LT 54
#define TK_NK_GT 55
#define TK_NK_LE 56
#define TK_NK_GE 57
#define TK_NK_NE 58
#define TK_NK_EQ 59
#define TK_LIKE 60
#define TK_MATCH 61
#define TK_NMATCH 62
#define TK_IN 63
#define TK_FROM 64
#define TK_AS 65
#define TK_JOIN 66
#define TK_ON 67
#define TK_INNER 68
#define TK_SELECT 69
#define TK_DISTINCT 70
#define TK_WHERE 71
#define TK_PARTITION 72
#define TK_BY 73
#define TK_SESSION 74
#define TK_STATE_WINDOW 75
#define TK_INTERVAL 76
#define TK_SLIDING 77
#define TK_FILL 78
#define TK_VALUE 79
#define TK_NONE 80
#define TK_PREV 81
#define TK_LINEAR 82
#define TK_NEXT 83
#define TK_GROUP 84
#define TK_HAVING 85
#define TK_ORDER 86
#define TK_SLIMIT 87
#define TK_SOFFSET 88
#define TK_LIMIT 89
#define TK_OFFSET 90
#define TK_ASC 91
#define TK_DESC 92
#define TK_NULLS 93
#define TK_FIRST 94
#define TK_LAST 95
#define TK_SPACE 300
#define TK_COMMENT 301
......@@ -289,6 +121,18 @@
#define TK_FILE 306
#define TK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query
#define TK_NK_COLON 500
#define TK_NK_BITNOT 501
#define TK_INSERT 502
#define TK_INTO 503
#define TK_NOW 504
#define TK_TAGS 505
#define TK_USING 506
#define TK_VALUES 507
#define TK_IMPORT 507
#define TK_SEMI 508
#define TK_IPTOKEN 509
#define TK_NIL 65535
#endif
......
......@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_NODES_SHOW_STMTS_H_
#define _TD_NODES_SHOW_STMTS_H_
#ifndef _TD_PLANN_NODES_H_
#define _TD_PLANN_NODES_H_
#ifdef __cplusplus
extern "C" {
......@@ -22,17 +22,35 @@ extern "C" {
#include "nodes.h"
typedef enum EShowStmtType {
SHOW_TYPE_DATABASE = 1
} EShowStmtType;
typedef struct SDatabaseOptions {
int32_t numOfBlocks;
int32_t cacheBlockSize;
int8_t cachelast;
int32_t compressionLevel;
int32_t daysPerFile;
int32_t fsyncPeriod;
int32_t maxRowsPerBlock;
int32_t minRowsPerBlock;
int32_t keep;
int32_t precision;
int32_t quorum;
int32_t replica;
int32_t ttl;
int32_t walLevel;
int32_t numOfVgroups;
int8_t singleStable;
int8_t streamMode;
} SDatabaseOptions;
typedef struct SShowStmt {
ENodeType type; // QUERY_NODE_SHOW_STMT
EShowStmtType showType;
} SShowStmt;
typedef struct SCreateDatabaseStmt {
ENodeType type;
char dbName[TSDB_DB_NAME_LEN];
bool ignoreExists;
SDatabaseOptions options;
} SCreateDatabaseStmt;
#ifdef __cplusplus
}
#endif
#endif /*_TD_NODES_SHOW_STMTS_H_*/
#endif /*_TD_PLANN_NODES_H_*/
......@@ -71,6 +71,7 @@ typedef enum ENodeType {
QUERY_NODE_SELECT_STMT,
QUERY_NODE_SHOW_STMT,
QUERY_NODE_VNODE_MODIF_STMT,
QUERY_NODE_CREATE_DATABASE_STMT,
// logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN,
......
......@@ -35,11 +35,19 @@ typedef struct SParseContext {
struct SCatalog *pCatalog;
} SParseContext;
typedef struct SCmdMsgInfo {
int16_t msgType;
SEpSet epSet;
char* pMsg;
int32_t msgLen;
} SCmdMsgInfo;
typedef struct SQuery {
bool isCmd;
SNode* pRoot;
int32_t numOfResCols;
SSchema* pResSchema;
SCmdMsgInfo* pCmdMsg;
} SQuery;
int32_t qParseQuerySql(SParseContext* pCxt, SQuery** pQuery);
......
......@@ -338,6 +338,17 @@ typedef enum ELogicConditionType {
#define TSDB_MAX_DB_CACHE_LAST_ROW 3
#define TSDB_DEFAULT_CACHE_LAST_ROW 0
#define TSDB_MIN_DB_TTL_OPTION 1
#define TSDB_DEFAULT_DB_TTL_OPTION 0
#define TSDB_MIN_DB_SINGLE_STABLE_OPTION 0
#define TSDB_MAX_DB_SINGLE_STABLE_OPTION 1
#define TSDB_DEFAULT_DB_SINGLE_STABLE_OPTION 0
#define TSDB_MIN_DB_STREAM_MODE_OPTION 0
#define TSDB_MAX_DB_STREAM_MODE_OPTION 1
#define TSDB_DEFAULT_DB_STREAM_MODE_OPTION 0
#define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_UNION_CLAUSE 5
......
......@@ -161,7 +161,7 @@ int32_t parseSql(SRequestObj* pRequest, SQuery** pQuery) {
}
code = qParseQuerySql(&cxt, pQuery);
if (TSDB_CODE_SUCCESS == code) {
if (TSDB_CODE_SUCCESS == code && !((*pQuery)->isCmd)) {
setResSchemaInfo(&pRequest->body.resInfo, (*pQuery)->pResSchema, (*pQuery)->numOfResCols);
}
......@@ -170,28 +170,16 @@ int32_t parseSql(SRequestObj* pRequest, SQuery** pQuery) {
}
int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
// SDclStmtInfo* pDcl = (SDclStmtInfo*)pQuery;
// pRequest->type = pDcl->msgType;
// pRequest->body.requestMsg = (SDataBuf){.pData = pDcl->pMsg, .len = pDcl->msgLen, .handle = NULL};
// STscObj* pTscObj = pRequest->pTscObj;
// SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
// int64_t transporterId = 0;
// if (pDcl->msgType == TDMT_VND_CREATE_TABLE || pDcl->msgType == TDMT_VND_SHOW_TABLES) {
// if (pDcl->msgType == TDMT_VND_SHOW_TABLES) {
// SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo;
// if (pShowReqInfo->pArray == NULL) {
// pShowReqInfo->currentIndex = 0; // set the first vnode/ then iterate the next vnode
// pShowReqInfo->pArray = pDcl->pExtension;
// }
// }
// asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pDcl->epSet, &transporterId, pSendMsg);
// } else {
// asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pDcl->epSet, &transporterId, pSendMsg);
// }
SCmdMsgInfo* pMsgInfo = pQuery->pCmdMsg;
pRequest->type = pMsgInfo->msgType;
pRequest->body.requestMsg = (SDataBuf){.pData = pMsgInfo->pMsg, .len = pMsgInfo->msgLen, .handle = NULL};
STscObj* pTscObj = pRequest->pTscObj;
SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
int64_t transporterId = 0;
asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, &transporterId, pSendMsg);
// tsem_wait(&pRequest->body.rspSem);
tsem_wait(&pRequest->body.rspSem);
return TSDB_CODE_SUCCESS;
}
......
......@@ -200,6 +200,9 @@ SNode* nodesListGetNode(SNodeList* pList, int32_t index) {
}
void nodesDestroyList(SNodeList* pList) {
if (NULL == pList) {
return;
}
SListCell* pNext = pList->pHead;
while (NULL != pNext) {
pNext = nodesListErase(pList, pNext);
......
......@@ -20,7 +20,7 @@
extern "C" {
#endif
#include "nodesShowStmts.h"
#include "cmdnodes.h"
#include "parser.h"
#include "querynodes.h"
#include "ttoken.h"
......@@ -34,6 +34,8 @@ typedef struct SAstCreateContext {
extern SToken nil_token;
void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt);
SNode* createRawExprNode(SAstCreateContext* pCxt, const SToken* pToken, SNode* pNode);
SNode* createRawExprNodeExt(SAstCreateContext* pCxt, const SToken* pStart, const SToken* pEnd, SNode* pNode);
SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode);
......@@ -74,7 +76,33 @@ SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit);
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable);
SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight);
SNode* createShowStmt(SAstCreateContext* pCxt, EShowStmtType type);
SDatabaseOptions* createDefaultDatabaseOptions(SAstCreateContext* pCxt);
typedef enum EDatabaseOptionType {
DB_OPTION_BLOCKS = 0,
DB_OPTION_CACHE,
DB_OPTION_CACHELAST,
DB_OPTION_COMP,
DB_OPTION_DAYS,
DB_OPTION_FSYNC,
DB_OPTION_MAXROWS,
DB_OPTION_MINROWS,
DB_OPTION_KEEP,
DB_OPTION_PRECISION,
DB_OPTION_QUORUM,
DB_OPTION_REPLICA,
DB_OPTION_TTL,
DB_OPTION_WAL,
DB_OPTION_VGROUPS,
DB_OPTION_SINGLESTABLE,
DB_OPTION_STREAMMODE,
DB_OPTION_MAX
} EDatabaseOptionType;
SDatabaseOptions* setDatabaseOption(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, EDatabaseOptionType type, const SToken* pVal);
SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pDbName, SDatabaseOptions* pOptions);
#ifdef __cplusplus
......
......@@ -3,7 +3,7 @@
%name NewParse
%token_prefix NEW_TK_
%token_prefix TK_
%token_type { SToken }
%default_type { SNode* }
%default_destructor { PARSER_DESTRUCTOR_TRACE; nodesDestroyNode($$); }
......@@ -57,14 +57,44 @@
%left AND.
//%right NOT.
%left UNION ALL MINUS EXCEPT INTERSECT.
//%left BITAND BITOR LSHIFT RSHIFT.
%left NK_BITAND NK_BITOR NK_LSHIFT NK_RSHIFT.
%left NK_PLUS NK_MINUS.
//%left DIVIDE TIMES.
%left NK_STAR NK_SLASH NK_REM.
//%left CONCAT.
//%right UMINUS UPLUS BITNOT.
cmd ::= SHOW DATABASES. { PARSER_TRACE; createShowStmt(pCxt, SHOW_TYPE_DATABASE); }
%left NK_CONCAT.
//%right NK_BITNOT.
/************************************************ create database *****************************************************/
cmd ::= CREATE DATABASE exists_opt(A) db_name(B) db_options(C). { PARSER_TRACE; pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C);}
%type exists_opt { bool }
exists_opt(A) ::= IF NOT EXISTS. { A = true; }
exists_opt(A) ::= . { A = false; }
%type db_options { SDatabaseOptions* }
%destructor db_options { tfree($$); }
db_options(A) ::= . { A = createDefaultDatabaseOptions(pCxt);}
db_options(A) ::= db_options(B) BLOCKS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_BLOCKS, &C); }
db_options(A) ::= db_options(B) CACHE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHE, &C); }
db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(X)(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHELAST, &C); }
db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); }
db_options(A) ::= db_options(B) DAYS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); }
db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); }
db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); }
db_options(A) ::= db_options(B) KEEP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, &C); }
db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); }
db_options(A) ::= db_options(B) QUORUM NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_QUORUM, &C); }
db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); }
db_options(A) ::= db_options(B) TTL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TTL, &C); }
db_options(A) ::= db_options(B) WAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL, &C); }
db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_VGROUPS, &C); }
db_options(A) ::= db_options(B) SINGLESTABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLESTABLE, &C); }
db_options(A) ::= db_options(B) STREAMMODE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STREAMMODE, &C); }
//cmd ::= SHOW DATABASES. { PARSER_TRACE; createShowStmt(pCxt, SHOW_TYPE_DATABASE); }
/************************************************ select *************************************************************/
cmd ::= query_expression(A). { PARSER_TRACE; pCxt->pRootNode = A; }
/************************************************ literal *************************************************************/
......
......@@ -36,7 +36,7 @@ typedef struct SToken {
* @return
*/
#define isNumber(tk) \
((tk)->type == TK_INTEGER || (tk)->type == TK_FLOAT || (tk)->type == TK_HEX || (tk)->type == TK_BIN)
((tk)->type == TK_NK_INTEGER || (tk)->type == TK_NK_FLOAT || (tk)->type == TK_HEX || (tk)->type == TK_BIN)
/**
* tokenizer for sql string
......@@ -102,7 +102,7 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
}
}
type = TK_FLOAT;
type = TK_NK_FLOAT;
goto _end;
}
......@@ -131,7 +131,7 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
case '7':
case '8':
case '9': {
type = TK_INTEGER;
type = TK_NK_INTEGER;
for (; isdigit(z[i]); i++) {
}
......@@ -144,7 +144,7 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
}
seg++;
type = TK_FLOAT;
type = TK_NK_FLOAT;
}
if (seg > 1) {
......@@ -158,7 +158,7 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
i++;
}
type = TK_FLOAT;
type = TK_NK_FLOAT;
}
goto _end;
......
......@@ -34,6 +34,243 @@
SToken nil_token = { .type = TK_NIL, .n = 0, .z = NULL };
typedef SDatabaseOptions* (*FSetDatabaseOption)(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal);
static FSetDatabaseOption setDbOptionFuncs[DB_OPTION_MAX];
static SDatabaseOptions* setDbBlocks(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_TOTAL_BLOCKS || val > TSDB_MAX_TOTAL_BLOCKS) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option totalBlocks: %d valid range: [%d, %d]", val, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS);
pCxt->valid = false;
return pOptions;
}
pOptions->numOfBlocks = val;
return pOptions;
}
static SDatabaseOptions* setDbCache(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_CACHE_BLOCK_SIZE || val > TSDB_MAX_CACHE_BLOCK_SIZE) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option cacheBlockSize: %d valid range: [%d, %d]", val, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE);
pCxt->valid = false;
return pOptions;
}
pOptions->cacheBlockSize = val;
return pOptions;
}
static SDatabaseOptions* setDbCacheLast(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DB_CACHE_LAST_ROW || val > TSDB_MAX_DB_CACHE_LAST_ROW) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option cacheLast: %d valid range: [%d, %d]", val, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW);
pCxt->valid = false;
return pOptions;
}
pOptions->cachelast = val;
return pOptions;
}
static SDatabaseOptions* setDbComp(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_COMP_LEVEL || val > TSDB_MAX_COMP_LEVEL) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option compression: %d valid range: [%d, %d]", val, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL);
pCxt->valid = false;
return pOptions;
}
pOptions->compressionLevel = val;
return pOptions;
}
static SDatabaseOptions* setDbDays(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DAYS_PER_FILE || val > TSDB_MAX_DAYS_PER_FILE) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option daysPerFile: %d valid range: [%d, %d]", val, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE);
pCxt->valid = false;
return pOptions;
}
pOptions->daysPerFile = val;
return pOptions;
}
static SDatabaseOptions* setDbFsync(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_FSYNC_PERIOD || val > TSDB_MAX_FSYNC_PERIOD) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option fsyncPeriod: %d valid range: [%d, %d]", val, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD);
pCxt->valid = false;
return pOptions;
}
pOptions->fsyncPeriod = val;
return pOptions;
}
static SDatabaseOptions* setDbMaxRows(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_MAX_ROW_FBLOCK || val > TSDB_MAX_MAX_ROW_FBLOCK) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option maxRowsPerBlock: %d valid range: [%d, %d]", val, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK);
pCxt->valid = false;
return pOptions;
}
pOptions->maxRowsPerBlock = val;
return pOptions;
}
static SDatabaseOptions* setDbMinRows(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_MIN_ROW_FBLOCK || val > TSDB_MAX_MIN_ROW_FBLOCK) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option minRowsPerBlock: %d valid range: [%d, %d]", val, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK);
pCxt->valid = false;
return pOptions;
}
pOptions->minRowsPerBlock = val;
return pOptions;
}
static SDatabaseOptions* setDbKeep(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_KEEP || val > TSDB_MAX_KEEP) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option keep: %d valid range: [%d, %d]", val, TSDB_MIN_KEEP, TSDB_MAX_KEEP);
pCxt->valid = false;
return pOptions;
}
pOptions->keep = val;
return pOptions;
}
static SDatabaseOptions* setDbPrecision(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
if (0 == strncmp(pVal->z, TSDB_TIME_PRECISION_MILLI_STR, pVal->n) && strlen(TSDB_TIME_PRECISION_MILLI_STR) == pVal->n) {
pOptions->precision = TSDB_TIME_PRECISION_MILLI;
} else if (0 == strncmp(pVal->z, TSDB_TIME_PRECISION_MICRO_STR, pVal->n) && strlen(TSDB_TIME_PRECISION_MICRO_STR) == pVal->n) {
pOptions->precision = TSDB_TIME_PRECISION_MICRO;
} else if (0 == strncmp(pVal->z, TSDB_TIME_PRECISION_NANO_STR, pVal->n) && strlen(TSDB_TIME_PRECISION_NANO_STR) == pVal->n) {
pOptions->precision = TSDB_TIME_PRECISION_NANO;
} else {
char tmp[10];
strncpy(tmp, pVal->z, pVal->n);
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option precision: %s", tmp);
pCxt->valid = false;
}
return pOptions;
}
static SDatabaseOptions* setDbQuorum(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DB_QUORUM_OPTION || val > TSDB_MAX_DB_QUORUM_OPTION) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option quorum: %d valid range: [%d, %d]", val, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION);
pCxt->valid = false;
return pOptions;
}
pOptions->quorum = val;
return pOptions;
}
static SDatabaseOptions* setDbReplica(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DB_REPLICA_OPTION || val > TSDB_MAX_DB_REPLICA_OPTION) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option replications: %d valid range: [%d, %d]", val, TSDB_MIN_DB_REPLICA_OPTION, TSDB_MAX_DB_REPLICA_OPTION);
pCxt->valid = false;
return pOptions;
}
pOptions->replica = val;
return pOptions;
}
static SDatabaseOptions* setDbTtl(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DB_TTL_OPTION) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option ttl: %d, should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION);
pCxt->valid = false;
return pOptions;
}
pOptions->ttl = val;
return pOptions;
}
static SDatabaseOptions* setDbWal(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_WAL_LEVEL || val > TSDB_MAX_WAL_LEVEL) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option walLevel: %d, only 1-2 allowed", val);
pCxt->valid = false;
return pOptions;
}
pOptions->walLevel = val;
return pOptions;
}
static SDatabaseOptions* setDbVgroups(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_VNODES_PER_DB || val > TSDB_MAX_VNODES_PER_DB) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen,
"invalid db option vgroups: %d valid range: [%d, %d]", val, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB);
pCxt->valid = false;
return pOptions;
}
pOptions->numOfVgroups = val;
return pOptions;
}
static SDatabaseOptions* setDbSingleStable(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DB_SINGLE_STABLE_OPTION || val > TSDB_MAX_DB_SINGLE_STABLE_OPTION) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option singleStable: %d, only 0-1 allowed", val);
pCxt->valid = false;
return pOptions;
}
pOptions->singleStable = val;
return pOptions;
}
static SDatabaseOptions* setDbStreamMode(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) {
int64_t val = strtol(pVal->z, NULL, 10);
if (val < TSDB_MIN_DB_STREAM_MODE_OPTION || val > TSDB_MAX_DB_STREAM_MODE_OPTION) {
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option streamMode: %d, only 0-1 allowed", val);
pCxt->valid = false;
return pOptions;
}
pOptions->streamMode = val;
return pOptions;
}
static void initSetDatabaseOptionFp() {
setDbOptionFuncs[DB_OPTION_BLOCKS] = setDbBlocks;
setDbOptionFuncs[DB_OPTION_CACHE] = setDbCache;
setDbOptionFuncs[DB_OPTION_CACHELAST] = setDbCacheLast;
setDbOptionFuncs[DB_OPTION_COMP] = setDbComp;
setDbOptionFuncs[DB_OPTION_DAYS] = setDbDays;
setDbOptionFuncs[DB_OPTION_FSYNC] = setDbFsync;
setDbOptionFuncs[DB_OPTION_MAXROWS] = setDbMaxRows;
setDbOptionFuncs[DB_OPTION_MINROWS] = setDbMinRows;
setDbOptionFuncs[DB_OPTION_KEEP] = setDbKeep;
setDbOptionFuncs[DB_OPTION_PRECISION] = setDbPrecision;
setDbOptionFuncs[DB_OPTION_QUORUM] = setDbQuorum;
setDbOptionFuncs[DB_OPTION_REPLICA] = setDbReplica;
setDbOptionFuncs[DB_OPTION_TTL] = setDbTtl;
setDbOptionFuncs[DB_OPTION_WAL] = setDbWal;
setDbOptionFuncs[DB_OPTION_VGROUPS] = setDbVgroups;
setDbOptionFuncs[DB_OPTION_SINGLESTABLE] = setDbSingleStable;
setDbOptionFuncs[DB_OPTION_STREAMMODE] = setDbStreamMode;
}
void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt) {
pCxt->pQueryCxt = pParseCxt;
pCxt->notSupport = false;
pCxt->valid = true;
pCxt->pRootNode = NULL;
initSetDatabaseOptionFp();
}
static bool checkDbName(SAstCreateContext* pCxt, const SToken* pDbName) {
if (NULL == pDbName) {
return true;
......@@ -376,9 +613,41 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode*
return (SNode*)setOp;
}
SNode* createShowStmt(SAstCreateContext* pCxt, EShowStmtType type) {
SShowStmt* show = (SShowStmt*)nodesMakeNode(QUERY_NODE_SHOW_STMT);
CHECK_OUT_OF_MEM(show);
show->showType = type;
return (SNode*)show;
SDatabaseOptions* createDefaultDatabaseOptions(SAstCreateContext* pCxt) {
SDatabaseOptions* pOptions = calloc(1, sizeof(SDatabaseOptions));
CHECK_OUT_OF_MEM(pOptions);
pOptions->numOfBlocks = TSDB_DEFAULT_TOTAL_BLOCKS;
pOptions->cacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE;
pOptions->cachelast = TSDB_DEFAULT_CACHE_LAST_ROW;
pOptions->compressionLevel = TSDB_DEFAULT_COMP_LEVEL;
pOptions->daysPerFile = TSDB_DEFAULT_DAYS_PER_FILE;
pOptions->fsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD;
pOptions->maxRowsPerBlock = TSDB_DEFAULT_MAX_ROW_FBLOCK;
pOptions->minRowsPerBlock = TSDB_DEFAULT_MIN_ROW_FBLOCK;
pOptions->keep = TSDB_DEFAULT_KEEP;
pOptions->precision = TSDB_TIME_PRECISION_MILLI;
pOptions->quorum = TSDB_DEFAULT_DB_QUORUM_OPTION;
pOptions->replica = TSDB_DEFAULT_DB_REPLICA_OPTION;
pOptions->ttl = TSDB_DEFAULT_DB_TTL_OPTION;
pOptions->walLevel = TSDB_DEFAULT_WAL_LEVEL;
pOptions->numOfVgroups = TSDB_DEFAULT_VN_PER_DB;
pOptions->singleStable = TSDB_DEFAULT_DB_SINGLE_STABLE_OPTION;
pOptions->streamMode = TSDB_DEFAULT_DB_STREAM_MODE_OPTION;
return pOptions;
}
SDatabaseOptions* setDatabaseOption(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, EDatabaseOptionType type, const SToken* pVal) {
return setDbOptionFuncs[type](pCxt, pOptions, pVal);
}
SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pDbName, SDatabaseOptions* pOptions) {
if (!checkDbName(pCxt, pDbName)) {
return NULL;
}
SCreateDatabaseStmt* pStmt = (SCreateDatabaseStmt*)nodesMakeNode(QUERY_NODE_CREATE_DATABASE_STMT);
CHECK_OUT_OF_MEM(pStmt);
strncpy(pStmt->dbName, pDbName->z, pDbName->n);
pStmt->ignoreExists = ignoreExists;
pStmt->options = *pOptions;
return (SNode*)pStmt;
}
......@@ -26,150 +26,6 @@ extern void NewParse(void*, int, SToken, void*);
extern void NewParseFree(void*, FFree);
extern void NewParseTrace(FILE*, char*);
static uint32_t toNewTokenId(uint32_t tokenId) {
switch (tokenId) {
case TK_OR:
return NEW_TK_OR;
case TK_AND:
return NEW_TK_AND;
case TK_UNION:
return NEW_TK_UNION;
case TK_ALL:
return NEW_TK_ALL;
case TK_MINUS:
return NEW_TK_NK_MINUS;
case TK_PLUS:
return NEW_TK_NK_PLUS;
case TK_STAR:
return NEW_TK_NK_STAR;
case TK_SLASH:
return NEW_TK_NK_SLASH;
case TK_REM:
return NEW_TK_NK_REM;
case TK_SHOW:
return NEW_TK_SHOW;
case TK_DATABASES:
return NEW_TK_DATABASES;
case TK_INTEGER:
return NEW_TK_NK_INTEGER;
case TK_FLOAT:
return NEW_TK_NK_FLOAT;
case TK_STRING:
return NEW_TK_NK_STRING;
case TK_BOOL:
return NEW_TK_NK_BOOL;
case TK_TIMESTAMP:
return NEW_TK_TIMESTAMP;
case TK_VARIABLE:
return NEW_TK_NK_VARIABLE;
case TK_COMMA:
return NEW_TK_NK_COMMA;
case TK_ID:
return NEW_TK_NK_ID;
case TK_LP:
return NEW_TK_NK_LP;
case TK_RP:
return NEW_TK_NK_RP;
case TK_DOT:
return NEW_TK_NK_DOT;
case TK_BETWEEN:
return NEW_TK_BETWEEN;
case TK_NOT:
return NEW_TK_NOT;
case TK_IS:
return NEW_TK_IS;
case TK_NULL:
return NEW_TK_NULL;
case TK_LT:
return NEW_TK_NK_LT;
case TK_GT:
return NEW_TK_NK_GT;
case TK_LE:
return NEW_TK_NK_LE;
case TK_GE:
return NEW_TK_NK_GE;
case TK_NE:
return NEW_TK_NK_NE;
case TK_EQ:
return NEW_TK_NK_EQ;
case TK_LIKE:
return NEW_TK_LIKE;
case TK_MATCH:
return NEW_TK_MATCH;
case TK_NMATCH:
return NEW_TK_NMATCH;
case TK_IN:
return NEW_TK_IN;
case TK_SELECT:
return NEW_TK_SELECT;
case TK_DISTINCT:
return NEW_TK_DISTINCT;
case TK_WHERE:
return NEW_TK_WHERE;
case TK_AS:
return NEW_TK_AS;
case TK_FROM:
return NEW_TK_FROM;
case TK_JOIN:
return NEW_TK_JOIN;
// case TK_PARTITION:
// return NEW_TK_PARTITION;
case TK_SESSION:
return NEW_TK_SESSION;
case TK_STATE_WINDOW:
return NEW_TK_STATE_WINDOW;
case TK_INTERVAL:
return NEW_TK_INTERVAL;
case TK_SLIDING:
return NEW_TK_SLIDING;
case TK_FILL:
return NEW_TK_FILL;
// case TK_VALUE:
// return NEW_TK_VALUE;
case TK_NONE:
return NEW_TK_NONE;
case TK_PREV:
return NEW_TK_PREV;
case TK_LINEAR:
return NEW_TK_LINEAR;
// case TK_NEXT:
// return NEW_TK_NEXT;
case TK_GROUP:
return NEW_TK_GROUP;
case TK_HAVING:
return NEW_TK_HAVING;
case TK_ORDER:
return NEW_TK_ORDER;
case TK_BY:
return NEW_TK_BY;
case TK_ASC:
return NEW_TK_ASC;
case TK_DESC:
return NEW_TK_DESC;
case TK_SLIMIT:
return NEW_TK_SLIMIT;
case TK_SOFFSET:
return NEW_TK_SOFFSET;
case TK_LIMIT:
return NEW_TK_LIMIT;
case TK_OFFSET:
return NEW_TK_OFFSET;
case TK_SPACE:
case NEW_TK_ON:
case NEW_TK_INNER:
break;
default:
printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!tokenId = %d\n", tokenId);
}
return tokenId;
}
static uint32_t getToken(const char* z, uint32_t* tokenId) {
uint32_t n = tGetToken(z, tokenId);
*tokenId = toNewTokenId(*tokenId);
return n;
}
static bool isCmd(const SNode* pRootNode) {
if (NULL == pRootNode) {
return true;
......@@ -184,7 +40,8 @@ static bool isCmd(const SNode* pRootNode) {
}
int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
SAstCreateContext cxt = { .pQueryCxt = pParseCxt, .notSupport = false, .valid = true, .pRootNode = NULL};
SAstCreateContext cxt;
initAstCreateContext(pParseCxt, &cxt);
void *pParser = NewParseAlloc(malloc);
int32_t i = 0;
while (1) {
......@@ -193,7 +50,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
NewParse(pParser, 0, t0, &cxt);
goto abort_parse;
}
t0.n = getToken((char *)&cxt.pQueryCxt->pSql[i], &t0.type);
t0.n = tGetToken((char *)&cxt.pQueryCxt->pSql[i], &t0.type);
t0.z = (char *)(cxt.pQueryCxt->pSql + i);
i += t0.n;
......@@ -202,10 +59,6 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
case TK_COMMENT: {
break;
}
case TK_SEMI: {
NewParse(pParser, 0, t0, &cxt);
goto abort_parse;
}
case TK_QUESTION:
case TK_ILLEGAL: {
snprintf(cxt.pQueryCxt->pMsg, cxt.pQueryCxt->msgLen, "unrecognized token: \"%s\"", t0.z);
......@@ -221,7 +74,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
}
default:
NewParse(pParser, t0.type, t0, &cxt);
// NewParseTrace(stdout, "");
NewParseTrace(stdout, "");
if (!cxt.valid) {
goto abort_parse;
}
......@@ -232,6 +85,9 @@ abort_parse:
NewParseFree(pParser, free);
if (cxt.valid) {
*pQuery = calloc(1, sizeof(SQuery));
if (NULL == *pQuery) {
return TSDB_CODE_OUT_OF_MEMORY;
}
(*pQuery)->isCmd = isCmd(cxt.pRootNode);
(*pQuery)->pRoot = cxt.pRootNode;
}
......
......@@ -16,6 +16,7 @@
#include "parserInt.h"
#include "catalog.h"
#include "cmdnodes.h"
#include "functionMgt.h"
#include "parserUtil.h"
#include "ttime.h"
......@@ -36,6 +37,7 @@ typedef struct STranslateContext {
int32_t currLevel;
ESqlClause currClause;
SSelectStmt* pCurrStmt;
SCmdMsgInfo* pCmdMsg;
} STranslateContext;
static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode);
......@@ -278,9 +280,12 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
return found ? DEAL_RES_CONTINUE : translateColumnWithoutPrefix(pCxt, pCol);
}
static int32_t trimStringCopy(const char* src, int32_t len, char* dst) {
varDataSetLen(dst, len);
char* dstVal = varDataVal(dst);
static int32_t trimStringCopy(const char* src, int32_t len, bool format, char* dst) {
char* dstVal = dst;
if (format) {
varDataSetLen(dst, len);
dstVal = varDataVal(dst);
}
// delete escape character: \\, \', \"
char delim = src[0];
int32_t cnt = 0;
......@@ -346,7 +351,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
return DEAL_RES_ERROR;
}
trimStringCopy(pVal->literal, n, pVal->datum.p);
trimStringCopy(pVal->literal, n, true, pVal->datum.p);
break;
}
case TSDB_DATA_TYPE_TIMESTAMP: {
......@@ -356,7 +361,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
return DEAL_RES_ERROR;
}
int32_t len = trimStringCopy(pVal->literal, n, tmp);
int32_t len = trimStringCopy(pVal->literal, n, false, tmp);
if (taosParseTime(tmp, &pVal->datum.i, len, pVal->node.resType.precision, tsDaylight) != TSDB_CODE_SUCCESS) {
tfree(tmp);
generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
......@@ -777,12 +782,62 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
return code;
}
static void buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt, SCreateDbReq* pReq) {
SName name = {0};
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
tNameGetFullDbName(&name, pReq->db);
pReq->numOfVgroups = pStmt->options.numOfVgroups;
pReq->cacheBlockSize = pStmt->options.cacheBlockSize;
pReq->totalBlocks = pStmt->options.numOfBlocks;
pReq->daysPerFile = pStmt->options.daysPerFile;
pReq->daysToKeep0 = pStmt->options.keep;
pReq->daysToKeep1 = -1;
pReq->daysToKeep2 = -1;
pReq->minRows = pStmt->options.minRowsPerBlock;
pReq->maxRows = pStmt->options.maxRowsPerBlock;
pReq->commitTime = -1;
pReq->fsyncPeriod = pStmt->options.fsyncPeriod;
pReq->walLevel = pStmt->options.walLevel;
pReq->precision = pStmt->options.precision;
pReq->compression = pStmt->options.compressionLevel;
pReq->replications = pStmt->options.replica;
pReq->quorum = pStmt->options.quorum;
pReq->update = -1;
pReq->cacheLastRow = pStmt->options.cachelast;
pReq->ignoreExist = pStmt->ignoreExists;
pReq->streamMode = pStmt->options.streamMode;
return;
}
static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) {
SCreateDbReq createReq = {0};
buildCreateDbReq(pCxt, pStmt, &createReq);
pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo));
if (NULL== pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_DB;
pCxt->pCmdMsg->msgLen = tSerializeSCreateDbReq(NULL, 0, &createReq);
pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen);
if (NULL== pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSCreateDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
return TSDB_CODE_SUCCESS;
}
static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pNode)) {
case QUERY_NODE_SELECT_STMT:
code = translateSelect(pCxt, (SSelectStmt*)pNode);
break;
case QUERY_NODE_CREATE_DATABASE_STMT:
code = translateCreateDatabase(pCxt, (SCreateDatabaseStmt*)pNode);
break;
default:
break;
}
......@@ -820,6 +875,14 @@ int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) {
return TSDB_CODE_SUCCESS;
}
void destroyTranslateContext(STranslateContext* pCxt) {
taosArrayDestroy(pCxt->pNsLevel);
if (NULL != pCxt->pCmdMsg) {
tfree(pCxt->pCmdMsg->pMsg);
tfree(pCxt->pCmdMsg);
}
}
int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) {
STranslateContext cxt = {
.pParseCxt = pParseCxt,
......@@ -833,8 +896,14 @@ int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) {
if (TSDB_CODE_SUCCESS == code) {
code = translateQuery(&cxt, pQuery->pRoot);
}
if (TSDB_CODE_SUCCESS == code && !pQuery->isCmd) {
code = setReslutSchema(&cxt, pQuery);
if (TSDB_CODE_SUCCESS == code) {
if (pQuery->isCmd) {
pQuery->pCmdMsg = cxt.pCmdMsg;
cxt.pCmdMsg = NULL;
} else {
code = setReslutSchema(&cxt, pQuery);
}
}
destroyTranslateContext(&cxt);
return code;
}
......@@ -263,7 +263,7 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
if (pToken->type == TK_NOW) {
ts = taosGetTimestamp(timePrec);
} else if (pToken->type == TK_INTEGER) {
} else if (pToken->type == TK_NK_INTEGER) {
bool isSigned = false;
toInteger(pToken->z, pToken->n, 10, &ts, &isSigned);
} else { // parse the RFC-3339/ISO-8601 timestamp format string
......@@ -294,7 +294,7 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
sToken = tStrGetToken(pTokenEnd, &index, false);
pTokenEnd += index;
if (sToken.type == TK_MINUS || sToken.type == TK_PLUS) {
if (sToken.type == TK_MINUS || sToken.type == TK_NK_PLUS) {
index = 0;
valueToken = tStrGetToken(pTokenEnd, &index, false);
pTokenEnd += index;
......@@ -308,7 +308,7 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
return TSDB_CODE_TSC_INVALID_OPERATION;
}
if (sToken.type == TK_PLUS) {
if (sToken.type == TK_NK_PLUS) {
ts += interval;
} else {
ts = ts - interval;
......@@ -322,9 +322,9 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
}
static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, uint32_t type, char* tmpTokenBuf, SMsgBuf* pMsgBuf) {
if ((pToken->type != TK_NOW && pToken->type != TK_INTEGER && pToken->type != TK_STRING && pToken->type != TK_FLOAT && pToken->type != TK_BOOL &&
if ((pToken->type != TK_NOW && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL &&
pToken->type != TK_NULL && pToken->type != TK_HEX && pToken->type != TK_OCT && pToken->type != TK_BIN) ||
(pToken->n == 0) || (pToken->type == TK_RP)) {
(pToken->n == 0) || (pToken->type == TK_NK_RP)) {
return buildSyntaxErrMsg(pMsgBuf, "invalid data or symbol", pToken->z);
}
......@@ -363,7 +363,7 @@ static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, uint32_t type, cha
}
static bool isNullStr(SToken *pToken) {
return (pToken->type == TK_NULL) || ((pToken->type == TK_STRING) && (pToken->n != 0) &&
return (pToken->type == TK_NULL) || ((pToken->type == TK_NK_STRING) && (pToken->n != 0) &&
(strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0));
}
......@@ -400,7 +400,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
switch (pSchema->type) {
case TSDB_DATA_TYPE_BOOL: {
if ((pToken->type == TK_BOOL || pToken->type == TK_STRING) && (pToken->n != 0)) {
if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) {
if (strncmp(pToken->z, "true", pToken->n) == 0) {
return func(&TRUE_VALUE, pSchema->bytes, param);
} else if (strncmp(pToken->z, "false", pToken->n) == 0) {
......@@ -408,9 +408,9 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
} else {
return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z);
}
} else if (pToken->type == TK_INTEGER) {
} else if (pToken->type == TK_NK_INTEGER) {
return func(((strtoll(pToken->z, NULL, 10) == 0) ? &FALSE_VALUE : &TRUE_VALUE), pSchema->bytes, param);
} else if (pToken->type == TK_FLOAT) {
} else if (pToken->type == TK_NK_FLOAT) {
return func(((strtod(pToken->z, NULL) == 0) ? &FALSE_VALUE : &TRUE_VALUE), pSchema->bytes, param);
} else {
return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z);
......@@ -592,7 +592,7 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo*
while (1) {
NEXT_TOKEN(pCxt->pSql, sToken);
if (TK_RP == sToken.type) {
if (TK_NK_RP == sToken.type) {
break;
}
......@@ -692,7 +692,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken)
// pSql -> [(tag1_name, ...)] TAGS (tag1_value, ...)
NEXT_TOKEN(pCxt->pSql, sToken);
if (TK_LP == sToken.type) {
if (TK_NK_LP == sToken.type) {
CHECK_CODE(parseBoundColumns(pCxt, &pCxt->tags, pTagsSchema));
NEXT_TOKEN(pCxt->pSql, sToken);
}
......@@ -702,7 +702,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken)
}
// pSql -> (tag1_value, ...)
NEXT_TOKEN(pCxt->pSql, sToken);
if (TK_LP != sToken.type) {
if (TK_NK_LP != sToken.type) {
return buildSyntaxErrMsg(&pCxt->msg, "( is expected", sToken.z);
}
CHECK_CODE(parseTagsClause(pCxt, pTagsSchema, getTableInfo(pCxt->pTableMeta).precision));
......@@ -766,7 +766,7 @@ static int32_t parseValues(SInsertParseContext* pCxt, STableDataBlocks* pDataBlo
while (1) {
int32_t index = 0;
NEXT_TOKEN_KEEP_SQL(pCxt->pSql, sToken, index);
if (TK_LP != sToken.type) {
if (TK_NK_LP != sToken.type) {
break;
}
pCxt->pSql += index;
......@@ -783,7 +783,7 @@ static int32_t parseValues(SInsertParseContext* pCxt, STableDataBlocks* pDataBlo
pDataBlock->size += extendedRowSize; //len;
NEXT_TOKEN(pCxt->pSql, sToken);
if (TK_RP != sToken.type) {
if (TK_NK_RP != sToken.type) {
return buildSyntaxErrMsg(&pCxt->msg, ") expected", sToken.z);
}
......@@ -882,7 +882,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, pCxt->pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE,
sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL));
if (TK_LP == sToken.type) {
if (TK_NK_LP == sToken.type) {
// pSql -> field1_name, ...)
CHECK_CODE(parseBoundColumns(pCxt, &dataBuf->boundColumnInfo, getTableColumnSchema(pCxt->pTableMeta)));
NEXT_TOKEN(pCxt->pSql, sToken);
......@@ -899,7 +899,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
if (TK_FILE == sToken.type) {
// pSql -> csv_file_path
NEXT_TOKEN(pCxt->pSql, sToken);
if (0 == sToken.n || (TK_STRING != sToken.type && TK_ID != sToken.type)) {
if (0 == sToken.n || (TK_NK_STRING != sToken.type && TK_NK_ID != sToken.type)) {
return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", sToken.z);
}
// todo
......
......@@ -109,21 +109,22 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned char
#define YYNOCODE 126
#define YYNOCODE 152
#define YYACTIONTYPE unsigned short int
#define NewParseTOKENTYPE SToken
typedef union {
int yyinit;
NewParseTOKENTYPE yy0;
EFillMode yy18;
SToken yy29;
EJoinType yy36;
SNode* yy56;
ENullOrder yy109;
EOperatorType yy128;
bool yy173;
SNodeList* yy208;
EOrder yy218;
SNodeList* yy8;
EOrder yy50;
EOperatorType yy60;
SDatabaseOptions* yy87;
SNode* yy104;
SToken yy129;
bool yy185;
ENullOrder yy186;
EJoinType yy228;
EFillMode yy246;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
......@@ -138,17 +139,17 @@ typedef union {
#define NewParseCTX_PARAM
#define NewParseCTX_FETCH
#define NewParseCTX_STORE
#define YYNSTATE 148
#define YYNRULE 140
#define YYNTOKEN 72
#define YY_MAX_SHIFT 147
#define YY_MIN_SHIFTREDUCE 245
#define YY_MAX_SHIFTREDUCE 384
#define YY_ERROR_ACTION 385
#define YY_ACCEPT_ACTION 386
#define YY_NO_ACTION 387
#define YY_MIN_REDUCE 388
#define YY_MAX_REDUCE 527
#define YYNSTATE 170
#define YYNRULE 160
#define YYNTOKEN 96
#define YY_MAX_SHIFT 169
#define YY_MIN_SHIFTREDUCE 286
#define YY_MAX_SHIFTREDUCE 445
#define YY_ERROR_ACTION 446
#define YY_ACCEPT_ACTION 447
#define YY_NO_ACTION 448
#define YY_MIN_REDUCE 449
#define YY_MAX_REDUCE 608
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
......@@ -215,215 +216,216 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (750)
#define YY_ACTTAB_COUNT (757)
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 397, 395, 93, 23, 72, 398, 395, 73, 30, 28,
/* 10 */ 26, 25, 24, 405, 395, 142, 420, 142, 420, 143,
/* 20 */ 110, 113, 80, 406, 267, 409, 22, 88, 97, 147,
/* 30 */ 285, 286, 287, 288, 289, 290, 291, 293, 294, 295,
/* 40 */ 30, 28, 26, 25, 24, 405, 395, 142, 420, 142,
/* 50 */ 420, 143, 118, 117, 46, 406, 260, 409, 22, 88,
/* 60 */ 97, 55, 285, 286, 287, 288, 289, 290, 291, 293,
/* 70 */ 294, 295, 132, 405, 395, 70, 65, 142, 420, 143,
/* 80 */ 127, 10, 39, 406, 55, 409, 445, 119, 114, 112,
/* 90 */ 87, 441, 334, 133, 519, 247, 248, 249, 250, 144,
/* 100 */ 253, 459, 506, 55, 258, 405, 395, 475, 261, 128,
/* 110 */ 420, 143, 127, 10, 40, 406, 54, 409, 445, 456,
/* 120 */ 504, 459, 95, 441, 49, 405, 395, 56, 135, 142,
/* 130 */ 420, 143, 383, 384, 81, 406, 71, 409, 20, 455,
/* 140 */ 405, 395, 103, 472, 128, 420, 143, 125, 292, 40,
/* 150 */ 406, 296, 409, 445, 29, 27, 421, 95, 441, 49,
/* 160 */ 75, 247, 248, 249, 250, 144, 253, 120, 102, 1,
/* 170 */ 459, 9, 8, 11, 26, 25, 24, 464, 473, 322,
/* 180 */ 405, 395, 386, 145, 142, 420, 143, 134, 454, 40,
/* 190 */ 406, 55, 409, 445, 303, 29, 27, 95, 441, 518,
/* 200 */ 2, 326, 247, 248, 249, 250, 144, 253, 479, 102,
/* 210 */ 1, 405, 395, 506, 11, 142, 420, 143, 6, 322,
/* 220 */ 40, 406, 261, 409, 445, 9, 8, 54, 95, 441,
/* 230 */ 518, 504, 405, 395, 506, 139, 142, 420, 143, 502,
/* 240 */ 111, 40, 406, 325, 409, 445, 486, 136, 505, 95,
/* 250 */ 441, 518, 504, 476, 29, 27, 327, 108, 124, 45,
/* 260 */ 463, 247, 248, 249, 250, 144, 253, 43, 102, 1,
/* 270 */ 57, 42, 351, 11, 348, 253, 126, 50, 452, 453,
/* 280 */ 140, 457, 132, 405, 395, 106, 107, 142, 420, 143,
/* 290 */ 137, 59, 79, 406, 62, 409, 29, 27, 109, 349,
/* 300 */ 350, 352, 353, 247, 248, 249, 250, 144, 253, 485,
/* 310 */ 102, 7, 506, 30, 28, 26, 25, 24, 31, 405,
/* 320 */ 395, 297, 94, 142, 420, 143, 54, 5, 41, 406,
/* 330 */ 504, 409, 445, 55, 61, 466, 444, 441, 405, 395,
/* 340 */ 121, 64, 142, 420, 143, 48, 105, 41, 406, 4,
/* 350 */ 409, 445, 130, 322, 282, 129, 441, 132, 66, 257,
/* 360 */ 31, 124, 45, 264, 29, 27, 131, 402, 44, 400,
/* 370 */ 43, 247, 248, 249, 250, 144, 253, 260, 102, 7,
/* 380 */ 68, 452, 123, 32, 122, 29, 27, 506, 460, 67,
/* 390 */ 16, 427, 247, 248, 249, 250, 144, 253, 521, 102,
/* 400 */ 1, 54, 98, 405, 395, 504, 141, 142, 420, 143,
/* 410 */ 138, 503, 41, 406, 258, 409, 445, 29, 27, 74,
/* 420 */ 3, 442, 14, 31, 247, 248, 249, 250, 144, 253,
/* 430 */ 58, 102, 7, 115, 345, 60, 405, 395, 35, 347,
/* 440 */ 142, 420, 143, 47, 63, 85, 406, 101, 409, 405,
/* 450 */ 395, 116, 341, 142, 420, 143, 36, 400, 85, 406,
/* 460 */ 104, 409, 405, 395, 340, 18, 142, 420, 143, 37,
/* 470 */ 69, 85, 406, 96, 409, 405, 395, 319, 15, 142,
/* 480 */ 420, 143, 318, 33, 46, 406, 34, 409, 405, 395,
/* 490 */ 8, 399, 142, 420, 143, 53, 283, 82, 406, 265,
/* 500 */ 409, 405, 395, 374, 17, 142, 420, 143, 12, 38,
/* 510 */ 77, 406, 369, 409, 368, 99, 405, 395, 373, 372,
/* 520 */ 142, 420, 143, 100, 520, 83, 406, 76, 409, 405,
/* 530 */ 395, 251, 13, 142, 420, 143, 389, 388, 78, 406,
/* 540 */ 146, 409, 405, 395, 387, 387, 142, 420, 143, 387,
/* 550 */ 387, 84, 406, 387, 409, 405, 395, 387, 387, 142,
/* 560 */ 420, 143, 387, 387, 417, 406, 387, 409, 405, 395,
/* 570 */ 387, 387, 142, 420, 143, 387, 387, 416, 406, 387,
/* 580 */ 409, 405, 395, 387, 387, 142, 420, 143, 387, 387,
/* 590 */ 415, 406, 387, 409, 387, 405, 395, 387, 387, 142,
/* 600 */ 420, 143, 387, 387, 91, 406, 387, 409, 405, 395,
/* 610 */ 387, 387, 142, 420, 143, 387, 387, 90, 406, 387,
/* 620 */ 409, 405, 395, 387, 387, 142, 420, 143, 387, 387,
/* 630 */ 92, 406, 387, 409, 405, 395, 387, 387, 142, 420,
/* 640 */ 143, 387, 387, 89, 406, 387, 409, 405, 395, 387,
/* 650 */ 387, 142, 420, 143, 387, 387, 86, 406, 387, 409,
/* 660 */ 124, 45, 387, 387, 387, 124, 45, 387, 387, 43,
/* 670 */ 387, 387, 387, 387, 43, 387, 387, 387, 387, 51,
/* 680 */ 452, 453, 387, 457, 52, 452, 453, 387, 457, 30,
/* 690 */ 28, 26, 25, 24, 19, 387, 387, 387, 387, 387,
/* 700 */ 30, 28, 26, 25, 24, 21, 387, 387, 387, 387,
/* 710 */ 387, 30, 28, 26, 25, 24, 387, 387, 387, 387,
/* 720 */ 30, 28, 26, 25, 24, 387, 387, 387, 387, 387,
/* 730 */ 387, 387, 387, 387, 387, 387, 267, 387, 387, 387,
/* 740 */ 387, 387, 387, 387, 387, 387, 387, 387, 380, 381,
/* 0 */ 486, 476, 73, 146, 501, 147, 587, 114, 89, 487,
/* 10 */ 105, 490, 30, 28, 26, 25, 24, 478, 476, 97,
/* 20 */ 586, 92, 23, 72, 585, 30, 28, 26, 25, 24,
/* 30 */ 479, 476, 146, 501, 92, 65, 486, 476, 117, 146,
/* 40 */ 501, 147, 9, 8, 41, 487, 556, 490, 526, 328,
/* 50 */ 129, 22, 101, 523, 346, 347, 348, 349, 350, 351,
/* 60 */ 352, 354, 355, 356, 22, 101, 449, 346, 347, 348,
/* 70 */ 349, 350, 351, 352, 354, 355, 356, 486, 476, 169,
/* 80 */ 146, 501, 147, 412, 395, 89, 487, 108, 490, 168,
/* 90 */ 364, 167, 166, 165, 164, 163, 162, 161, 160, 159,
/* 100 */ 140, 158, 157, 156, 155, 154, 153, 152, 387, 113,
/* 110 */ 410, 411, 413, 414, 136, 486, 476, 319, 146, 501,
/* 120 */ 147, 131, 10, 39, 487, 122, 490, 526, 131, 10,
/* 130 */ 55, 91, 522, 123, 118, 116, 486, 476, 321, 132,
/* 140 */ 501, 147, 141, 587, 40, 487, 20, 490, 526, 55,
/* 150 */ 55, 540, 99, 522, 49, 353, 70, 54, 357, 486,
/* 160 */ 476, 585, 132, 501, 147, 139, 71, 40, 487, 537,
/* 170 */ 490, 526, 107, 553, 386, 99, 522, 49, 486, 476,
/* 180 */ 143, 146, 501, 147, 6, 383, 85, 487, 134, 490,
/* 190 */ 26, 25, 24, 502, 486, 476, 554, 146, 501, 147,
/* 200 */ 75, 42, 40, 487, 409, 490, 526, 146, 501, 2,
/* 210 */ 99, 522, 599, 121, 545, 322, 383, 540, 540, 124,
/* 220 */ 343, 560, 486, 476, 144, 146, 501, 147, 447, 115,
/* 230 */ 40, 487, 149, 490, 526, 536, 535, 557, 99, 522,
/* 240 */ 599, 567, 486, 476, 322, 146, 501, 147, 138, 583,
/* 250 */ 40, 487, 112, 490, 526, 29, 27, 57, 99, 522,
/* 260 */ 599, 587, 56, 59, 11, 31, 62, 308, 358, 544,
/* 270 */ 128, 29, 27, 388, 314, 54, 45, 310, 566, 585,
/* 280 */ 11, 9, 8, 308, 43, 309, 311, 148, 314, 110,
/* 290 */ 106, 1, 111, 310, 51, 533, 534, 61, 538, 29,
/* 300 */ 27, 309, 311, 148, 314, 98, 106, 1, 11, 444,
/* 310 */ 445, 308, 55, 136, 486, 476, 5, 146, 501, 147,
/* 320 */ 547, 310, 83, 487, 31, 490, 125, 325, 64, 309,
/* 330 */ 311, 148, 314, 109, 106, 1, 29, 27, 48, 483,
/* 340 */ 4, 481, 587, 66, 308, 383, 318, 321, 308, 30,
/* 350 */ 28, 26, 25, 24, 310, 44, 54, 541, 310, 32,
/* 360 */ 585, 67, 309, 311, 148, 314, 309, 311, 148, 314,
/* 370 */ 16, 106, 7, 486, 476, 102, 146, 501, 147, 508,
/* 380 */ 584, 41, 487, 602, 490, 526, 145, 319, 142, 525,
/* 390 */ 522, 74, 317, 55, 79, 486, 476, 151, 146, 501,
/* 400 */ 147, 77, 80, 41, 487, 3, 490, 526, 31, 14,
/* 410 */ 58, 133, 522, 128, 406, 136, 60, 35, 408, 45,
/* 420 */ 29, 27, 135, 47, 63, 119, 36, 43, 441, 442,
/* 430 */ 402, 401, 308, 120, 481, 29, 27, 68, 533, 127,
/* 440 */ 37, 126, 310, 18, 587, 15, 33, 308, 380, 379,
/* 450 */ 309, 311, 148, 314, 69, 106, 7, 310, 54, 34,
/* 460 */ 29, 27, 585, 8, 480, 309, 311, 148, 314, 53,
/* 470 */ 106, 1, 308, 344, 326, 486, 476, 17, 146, 501,
/* 480 */ 147, 435, 310, 46, 487, 12, 490, 38, 430, 429,
/* 490 */ 309, 311, 148, 314, 103, 106, 7, 486, 476, 19,
/* 500 */ 146, 501, 147, 76, 21, 89, 487, 100, 490, 30,
/* 510 */ 28, 26, 25, 24, 30, 28, 26, 25, 24, 434,
/* 520 */ 433, 13, 137, 600, 30, 28, 26, 25, 24, 486,
/* 530 */ 476, 104, 146, 501, 147, 312, 470, 46, 487, 287,
/* 540 */ 490, 486, 476, 150, 146, 501, 147, 299, 306, 84,
/* 550 */ 487, 305, 490, 486, 476, 304, 146, 501, 147, 78,
/* 560 */ 448, 86, 487, 303, 490, 302, 301, 486, 476, 300,
/* 570 */ 146, 501, 147, 298, 297, 81, 487, 601, 490, 296,
/* 580 */ 486, 476, 295, 146, 501, 147, 294, 293, 87, 487,
/* 590 */ 292, 490, 486, 476, 291, 146, 501, 147, 290, 448,
/* 600 */ 82, 487, 448, 490, 486, 476, 448, 146, 501, 147,
/* 610 */ 448, 448, 88, 487, 448, 490, 448, 30, 28, 26,
/* 620 */ 25, 24, 448, 448, 486, 476, 448, 146, 501, 147,
/* 630 */ 448, 448, 498, 487, 448, 490, 486, 476, 448, 146,
/* 640 */ 501, 147, 448, 448, 497, 487, 448, 490, 486, 476,
/* 650 */ 448, 146, 501, 147, 328, 448, 496, 487, 448, 490,
/* 660 */ 486, 476, 448, 146, 501, 147, 448, 448, 95, 487,
/* 670 */ 448, 490, 486, 476, 448, 146, 501, 147, 448, 448,
/* 680 */ 94, 487, 448, 490, 448, 486, 476, 448, 146, 501,
/* 690 */ 147, 448, 448, 96, 487, 448, 490, 486, 476, 448,
/* 700 */ 146, 501, 147, 448, 448, 93, 487, 448, 490, 486,
/* 710 */ 476, 448, 146, 501, 147, 448, 448, 90, 487, 448,
/* 720 */ 490, 448, 448, 128, 448, 448, 448, 448, 128, 45,
/* 730 */ 448, 448, 448, 448, 45, 448, 448, 43, 448, 448,
/* 740 */ 448, 448, 43, 448, 448, 448, 130, 50, 533, 534,
/* 750 */ 448, 538, 52, 533, 534, 448, 538,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 74, 75, 76, 88, 89, 74, 75, 124, 8, 9,
/* 10 */ 10, 11, 12, 74, 75, 78, 79, 78, 79, 80,
/* 20 */ 115, 84, 83, 84, 24, 86, 26, 27, 28, 13,
/* 30 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
/* 40 */ 8, 9, 10, 11, 12, 74, 75, 78, 79, 78,
/* 50 */ 79, 80, 22, 84, 83, 84, 22, 86, 26, 27,
/* 60 */ 28, 45, 30, 31, 32, 33, 34, 35, 36, 37,
/* 70 */ 38, 39, 73, 74, 75, 41, 108, 78, 79, 80,
/* 80 */ 22, 23, 83, 84, 45, 86, 87, 50, 51, 52,
/* 90 */ 91, 92, 10, 122, 123, 15, 16, 17, 18, 19,
/* 100 */ 20, 81, 103, 45, 22, 74, 75, 82, 22, 78,
/* 110 */ 79, 80, 22, 23, 83, 84, 117, 86, 87, 99,
/* 120 */ 121, 81, 91, 92, 93, 74, 75, 41, 3, 78,
/* 130 */ 79, 80, 70, 71, 83, 84, 105, 86, 26, 99,
/* 140 */ 74, 75, 111, 112, 78, 79, 80, 101, 36, 83,
/* 150 */ 84, 39, 86, 87, 8, 9, 79, 91, 92, 93,
/* 160 */ 118, 15, 16, 17, 18, 19, 20, 116, 22, 23,
/* 170 */ 81, 1, 2, 27, 10, 11, 12, 42, 112, 44,
/* 180 */ 74, 75, 72, 73, 78, 79, 80, 62, 99, 83,
/* 190 */ 84, 45, 86, 87, 24, 8, 9, 91, 92, 93,
/* 200 */ 104, 4, 15, 16, 17, 18, 19, 20, 102, 22,
/* 210 */ 23, 74, 75, 103, 27, 78, 79, 80, 43, 44,
/* 220 */ 83, 84, 22, 86, 87, 1, 2, 117, 91, 92,
/* 230 */ 93, 121, 74, 75, 103, 21, 78, 79, 80, 102,
/* 240 */ 54, 83, 84, 46, 86, 87, 114, 21, 117, 91,
/* 250 */ 92, 93, 121, 82, 8, 9, 10, 53, 77, 78,
/* 260 */ 102, 15, 16, 17, 18, 19, 20, 86, 22, 23,
/* 270 */ 113, 21, 29, 27, 24, 20, 95, 96, 97, 98,
/* 280 */ 66, 100, 73, 74, 75, 75, 75, 78, 79, 80,
/* 290 */ 64, 21, 83, 84, 24, 86, 8, 9, 55, 56,
/* 300 */ 57, 58, 59, 15, 16, 17, 18, 19, 20, 114,
/* 310 */ 22, 23, 103, 8, 9, 10, 11, 12, 21, 74,
/* 320 */ 75, 24, 75, 78, 79, 80, 117, 61, 83, 84,
/* 330 */ 121, 86, 87, 45, 113, 110, 91, 92, 74, 75,
/* 340 */ 60, 109, 78, 79, 80, 107, 48, 83, 84, 47,
/* 350 */ 86, 87, 27, 44, 29, 91, 92, 73, 106, 22,
/* 360 */ 21, 77, 78, 24, 8, 9, 10, 23, 78, 25,
/* 370 */ 86, 15, 16, 17, 18, 19, 20, 22, 22, 23,
/* 380 */ 96, 97, 98, 40, 100, 8, 9, 103, 81, 94,
/* 390 */ 23, 90, 15, 16, 17, 18, 19, 20, 125, 22,
/* 400 */ 23, 117, 69, 74, 75, 121, 65, 78, 79, 80,
/* 410 */ 63, 120, 83, 84, 22, 86, 87, 8, 9, 119,
/* 420 */ 21, 92, 49, 21, 15, 16, 17, 18, 19, 20,
/* 430 */ 24, 22, 23, 15, 24, 23, 74, 75, 21, 24,
/* 440 */ 78, 79, 80, 23, 23, 83, 84, 85, 86, 74,
/* 450 */ 75, 21, 24, 78, 79, 80, 23, 25, 83, 84,
/* 460 */ 85, 86, 74, 75, 24, 21, 78, 79, 80, 23,
/* 470 */ 25, 83, 84, 85, 86, 74, 75, 24, 49, 78,
/* 480 */ 79, 80, 24, 42, 83, 84, 21, 86, 74, 75,
/* 490 */ 2, 25, 78, 79, 80, 25, 29, 83, 84, 24,
/* 500 */ 86, 74, 75, 24, 21, 78, 79, 80, 49, 4,
/* 510 */ 83, 84, 15, 86, 15, 15, 74, 75, 15, 15,
/* 520 */ 78, 79, 80, 15, 123, 83, 84, 25, 86, 74,
/* 530 */ 75, 17, 23, 78, 79, 80, 0, 0, 83, 84,
/* 540 */ 14, 86, 74, 75, 126, 126, 78, 79, 80, 126,
/* 550 */ 126, 83, 84, 126, 86, 74, 75, 126, 126, 78,
/* 560 */ 79, 80, 126, 126, 83, 84, 126, 86, 74, 75,
/* 570 */ 126, 126, 78, 79, 80, 126, 126, 83, 84, 126,
/* 580 */ 86, 74, 75, 126, 126, 78, 79, 80, 126, 126,
/* 590 */ 83, 84, 126, 86, 126, 74, 75, 126, 126, 78,
/* 600 */ 79, 80, 126, 126, 83, 84, 126, 86, 74, 75,
/* 610 */ 126, 126, 78, 79, 80, 126, 126, 83, 84, 126,
/* 620 */ 86, 74, 75, 126, 126, 78, 79, 80, 126, 126,
/* 630 */ 83, 84, 126, 86, 74, 75, 126, 126, 78, 79,
/* 640 */ 80, 126, 126, 83, 84, 126, 86, 74, 75, 126,
/* 650 */ 126, 78, 79, 80, 126, 126, 83, 84, 126, 86,
/* 660 */ 77, 78, 126, 126, 126, 77, 78, 126, 126, 86,
/* 670 */ 126, 126, 126, 126, 86, 126, 126, 126, 126, 96,
/* 680 */ 97, 98, 126, 100, 96, 97, 98, 126, 100, 8,
/* 690 */ 9, 10, 11, 12, 2, 126, 126, 126, 126, 126,
/* 700 */ 8, 9, 10, 11, 12, 2, 126, 126, 126, 126,
/* 710 */ 126, 8, 9, 10, 11, 12, 126, 126, 126, 126,
/* 720 */ 8, 9, 10, 11, 12, 126, 126, 126, 126, 126,
/* 730 */ 126, 126, 126, 126, 126, 126, 24, 126, 126, 126,
/* 740 */ 126, 126, 126, 126, 126, 126, 126, 126, 67, 68,
/* 750 */ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
/* 760 */ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
/* 770 */ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
/* 780 */ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
/* 790 */ 126, 126, 126,
/* 0 */ 101, 102, 150, 104, 105, 106, 129, 141, 109, 110,
/* 10 */ 111, 112, 12, 13, 14, 15, 16, 101, 102, 103,
/* 20 */ 143, 21, 114, 115, 147, 12, 13, 14, 15, 16,
/* 30 */ 101, 102, 104, 105, 21, 134, 101, 102, 110, 104,
/* 40 */ 105, 106, 1, 2, 109, 110, 108, 112, 113, 49,
/* 50 */ 127, 51, 52, 118, 54, 55, 56, 57, 58, 59,
/* 60 */ 60, 61, 62, 63, 51, 52, 0, 54, 55, 56,
/* 70 */ 57, 58, 59, 60, 61, 62, 63, 101, 102, 18,
/* 80 */ 104, 105, 106, 53, 14, 109, 110, 111, 112, 23,
/* 90 */ 49, 25, 26, 27, 28, 29, 30, 31, 32, 33,
/* 100 */ 46, 35, 36, 37, 38, 39, 40, 41, 4, 79,
/* 110 */ 80, 81, 82, 83, 100, 101, 102, 47, 104, 105,
/* 120 */ 106, 47, 48, 109, 110, 47, 112, 113, 47, 48,
/* 130 */ 69, 117, 118, 74, 75, 76, 101, 102, 47, 104,
/* 140 */ 105, 106, 88, 129, 109, 110, 51, 112, 113, 69,
/* 150 */ 69, 107, 117, 118, 119, 60, 65, 143, 63, 101,
/* 160 */ 102, 147, 104, 105, 106, 3, 131, 109, 110, 125,
/* 170 */ 112, 113, 137, 138, 70, 117, 118, 119, 101, 102,
/* 180 */ 46, 104, 105, 106, 67, 68, 109, 110, 21, 112,
/* 190 */ 14, 15, 16, 105, 101, 102, 138, 104, 105, 106,
/* 200 */ 144, 46, 109, 110, 49, 112, 113, 104, 105, 130,
/* 210 */ 117, 118, 119, 110, 66, 47, 68, 107, 107, 142,
/* 220 */ 53, 128, 101, 102, 90, 104, 105, 106, 96, 78,
/* 230 */ 109, 110, 100, 112, 113, 125, 125, 108, 117, 118,
/* 240 */ 119, 140, 101, 102, 47, 104, 105, 106, 86, 128,
/* 250 */ 109, 110, 77, 112, 113, 12, 13, 139, 117, 118,
/* 260 */ 119, 129, 65, 46, 21, 46, 49, 24, 49, 128,
/* 270 */ 98, 12, 13, 14, 45, 143, 104, 34, 140, 147,
/* 280 */ 21, 1, 2, 24, 112, 42, 43, 44, 45, 102,
/* 290 */ 47, 48, 102, 34, 122, 123, 124, 139, 126, 12,
/* 300 */ 13, 42, 43, 44, 45, 102, 47, 48, 21, 94,
/* 310 */ 95, 24, 69, 100, 101, 102, 85, 104, 105, 106,
/* 320 */ 136, 34, 109, 110, 46, 112, 84, 49, 135, 42,
/* 330 */ 43, 44, 45, 72, 47, 48, 12, 13, 133, 48,
/* 340 */ 71, 50, 129, 132, 24, 68, 47, 47, 24, 12,
/* 350 */ 13, 14, 15, 16, 34, 104, 143, 107, 34, 64,
/* 360 */ 147, 120, 42, 43, 44, 45, 42, 43, 44, 45,
/* 370 */ 48, 47, 48, 101, 102, 93, 104, 105, 106, 116,
/* 380 */ 146, 109, 110, 151, 112, 113, 89, 47, 87, 117,
/* 390 */ 118, 145, 47, 69, 98, 101, 102, 20, 104, 105,
/* 400 */ 106, 97, 99, 109, 110, 46, 112, 113, 46, 73,
/* 410 */ 49, 117, 118, 98, 49, 100, 48, 46, 49, 104,
/* 420 */ 12, 13, 14, 48, 48, 24, 48, 112, 91, 92,
/* 430 */ 49, 49, 24, 46, 50, 12, 13, 122, 123, 124,
/* 440 */ 48, 126, 34, 46, 129, 73, 66, 24, 49, 49,
/* 450 */ 42, 43, 44, 45, 50, 47, 48, 34, 143, 46,
/* 460 */ 12, 13, 147, 2, 50, 42, 43, 44, 45, 50,
/* 470 */ 47, 48, 24, 53, 49, 101, 102, 46, 104, 105,
/* 480 */ 106, 49, 34, 109, 110, 73, 112, 4, 24, 24,
/* 490 */ 42, 43, 44, 45, 24, 47, 48, 101, 102, 2,
/* 500 */ 104, 105, 106, 50, 2, 109, 110, 111, 112, 12,
/* 510 */ 13, 14, 15, 16, 12, 13, 14, 15, 16, 24,
/* 520 */ 24, 48, 148, 149, 12, 13, 14, 15, 16, 101,
/* 530 */ 102, 24, 104, 105, 106, 34, 0, 109, 110, 22,
/* 540 */ 112, 101, 102, 21, 104, 105, 106, 34, 24, 109,
/* 550 */ 110, 24, 112, 101, 102, 24, 104, 105, 106, 19,
/* 560 */ 152, 109, 110, 24, 112, 24, 24, 101, 102, 24,
/* 570 */ 104, 105, 106, 24, 24, 109, 110, 149, 112, 24,
/* 580 */ 101, 102, 24, 104, 105, 106, 24, 24, 109, 110,
/* 590 */ 24, 112, 101, 102, 24, 104, 105, 106, 24, 152,
/* 600 */ 109, 110, 152, 112, 101, 102, 152, 104, 105, 106,
/* 610 */ 152, 152, 109, 110, 152, 112, 152, 12, 13, 14,
/* 620 */ 15, 16, 152, 152, 101, 102, 152, 104, 105, 106,
/* 630 */ 152, 152, 109, 110, 152, 112, 101, 102, 152, 104,
/* 640 */ 105, 106, 152, 152, 109, 110, 152, 112, 101, 102,
/* 650 */ 152, 104, 105, 106, 49, 152, 109, 110, 152, 112,
/* 660 */ 101, 102, 152, 104, 105, 106, 152, 152, 109, 110,
/* 670 */ 152, 112, 101, 102, 152, 104, 105, 106, 152, 152,
/* 680 */ 109, 110, 152, 112, 152, 101, 102, 152, 104, 105,
/* 690 */ 106, 152, 152, 109, 110, 152, 112, 101, 102, 152,
/* 700 */ 104, 105, 106, 152, 152, 109, 110, 152, 112, 101,
/* 710 */ 102, 152, 104, 105, 106, 152, 152, 109, 110, 152,
/* 720 */ 112, 152, 152, 98, 152, 152, 152, 152, 98, 104,
/* 730 */ 152, 152, 152, 152, 104, 152, 152, 112, 152, 152,
/* 740 */ 152, 152, 112, 152, 152, 152, 121, 122, 123, 124,
/* 750 */ 152, 126, 122, 123, 124, 152, 126,
};
#define YY_SHIFT_COUNT (147)
#define YY_SHIFT_COUNT (169)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (712)
#define YY_SHIFT_MAX (605)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 16, 146, 246, 187, 187, 187, 187, 288, 187, 187,
/* 10 */ 58, 377, 409, 356, 409, 409, 409, 409, 409, 409,
/* 20 */ 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
/* 30 */ 409, 409, 90, 90, 90, 80, 30, 30, 39, 0,
/* 40 */ 32, 32, 80, 34, 34, 34, 681, 243, 37, 86,
/* 50 */ 135, 175, 135, 82, 125, 197, 200, 186, 204, 255,
/* 60 */ 255, 186, 204, 255, 266, 280, 298, 302, 309, 337,
/* 70 */ 355, 343, 367, 333, 341, 347, 392, 692, 703, 712,
/* 80 */ 305, 305, 305, 305, 305, 305, 305, 170, 112, 164,
/* 90 */ 164, 164, 164, 250, 270, 224, 297, 325, 62, 226,
/* 100 */ 214, 339, 344, 399, 402, 373, 406, 410, 412, 417,
/* 110 */ 415, 420, 421, 428, 433, 440, 418, 430, 432, 446,
/* 120 */ 444, 429, 453, 458, 445, 441, 465, 466, 470, 488,
/* 130 */ 467, 475, 479, 483, 459, 505, 497, 499, 500, 503,
/* 140 */ 504, 508, 502, 509, 514, 536, 537, 526,
/* 0 */ 61, 243, 259, 287, 287, 287, 287, 324, 287, 287,
/* 10 */ 81, 423, 448, 408, 448, 448, 448, 448, 448, 448,
/* 20 */ 448, 448, 448, 448, 448, 448, 448, 448, 448, 448,
/* 30 */ 448, 448, 74, 74, 74, 320, 78, 78, 80, 0,
/* 40 */ 13, 13, 320, 91, 91, 91, 337, 30, 59, 197,
/* 50 */ 148, 117, 148, 70, 162, 104, 168, 151, 175, 229,
/* 60 */ 229, 151, 175, 229, 231, 242, 261, 269, 277, 299,
/* 70 */ 300, 295, 322, 282, 297, 301, 340, 345, 377, 757,
/* 80 */ 66, 497, 502, 605, 512, 512, 512, 512, 512, 512,
/* 90 */ 512, 41, 95, 176, 176, 176, 176, 155, 217, 280,
/* 100 */ 219, 167, 215, 54, 134, 278, 291, 359, 362, 336,
/* 110 */ 361, 365, 368, 371, 369, 375, 376, 381, 378, 382,
/* 120 */ 401, 387, 384, 392, 397, 372, 399, 400, 404, 380,
/* 130 */ 413, 414, 419, 461, 420, 425, 432, 431, 412, 483,
/* 140 */ 464, 465, 470, 495, 496, 507, 453, 473, 501, 536,
/* 150 */ 517, 522, 524, 527, 531, 539, 541, 542, 545, 513,
/* 160 */ 549, 550, 555, 558, 562, 563, 566, 570, 574, 540,
};
#define YY_REDUCE_COUNT (76)
#define YY_REDUCE_MIN (-117)
#define YY_REDUCE_MAX (588)
#define YY_REDUCE_COUNT (79)
#define YY_REDUCE_MIN (-148)
#define YY_REDUCE_MAX (630)
static const short yy_reduce_ofst[] = {
/* 0 */ 110, -1, 31, 66, 106, 137, 158, 209, 245, 264,
/* 10 */ 284, 329, -29, 362, 375, 51, 388, 401, -61, 414,
/* 20 */ 427, 442, 455, 468, 481, 494, 507, 521, 534, 547,
/* 30 */ 560, 573, 181, 583, 588, -74, -63, -31, 131, -85,
/* 40 */ -85, -85, -69, 20, 40, 89, -117, -95, -32, 25,
/* 50 */ 46, 46, 46, 77, 42, 96, 171, 132, 157, 210,
/* 60 */ 211, 195, 221, 247, 225, 232, 238, 252, 46, 290,
/* 70 */ 307, 295, 301, 273, 291, 300, 77,
/* 0 */ 132, 14, 35, 58, 93, 121, 141, 213, 272, 294,
/* 10 */ 315, -65, 374, -101, -24, 77, 396, 428, 440, 452,
/* 20 */ 466, 479, 491, 503, 523, 535, 547, 559, 571, 584,
/* 30 */ 596, 608, 625, 172, 630, -84, -72, 103, -123, -92,
/* 40 */ -92, -92, -71, 44, 110, 111, -148, -134, -99, -62,
/* 50 */ -77, -77, -77, 88, 56, 79, 129, 101, 118, 187,
/* 60 */ 190, 138, 158, 203, 184, 193, 205, 211, -77, 251,
/* 70 */ 250, 241, 263, 232, 234, 246, 88, 296, 304, 303,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
/* 10 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
/* 20 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
/* 30 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
/* 40 */ 447, 385, 385, 458, 458, 458, 522, 385, 482, 474,
/* 50 */ 450, 464, 451, 385, 507, 467, 385, 489, 487, 385,
/* 60 */ 385, 489, 487, 385, 501, 497, 480, 478, 464, 385,
/* 70 */ 385, 385, 385, 525, 513, 509, 385, 385, 385, 385,
/* 80 */ 500, 499, 424, 423, 422, 418, 419, 385, 385, 413,
/* 90 */ 414, 412, 411, 385, 385, 448, 385, 385, 385, 510,
/* 100 */ 514, 385, 401, 471, 481, 385, 385, 385, 385, 385,
/* 110 */ 385, 385, 385, 385, 385, 385, 385, 385, 401, 385,
/* 120 */ 498, 385, 457, 453, 385, 385, 449, 400, 385, 443,
/* 130 */ 385, 385, 385, 508, 385, 385, 385, 385, 385, 385,
/* 140 */ 385, 385, 385, 385, 385, 385, 385, 385,
/* 0 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 10 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 20 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 30 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 40 */ 528, 446, 446, 539, 539, 539, 603, 446, 563, 555,
/* 50 */ 531, 545, 532, 446, 588, 548, 446, 570, 568, 446,
/* 60 */ 446, 570, 568, 446, 582, 578, 561, 559, 545, 446,
/* 70 */ 446, 446, 446, 606, 594, 590, 446, 446, 451, 452,
/* 80 */ 446, 446, 446, 446, 581, 580, 505, 504, 503, 499,
/* 90 */ 500, 446, 446, 494, 495, 493, 492, 446, 446, 529,
/* 100 */ 446, 446, 446, 591, 595, 446, 482, 552, 562, 446,
/* 110 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 120 */ 446, 446, 482, 446, 579, 446, 538, 534, 446, 446,
/* 130 */ 530, 481, 446, 524, 446, 446, 446, 589, 446, 446,
/* 140 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 150 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
/* 160 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
};
/********** End of lemon-generated parsing tables *****************************/
......@@ -538,124 +540,150 @@ static const char *const yyTokenName[] = {
/* 5 */ "MINUS",
/* 6 */ "EXCEPT",
/* 7 */ "INTERSECT",
/* 8 */ "NK_PLUS",
/* 9 */ "NK_MINUS",
/* 10 */ "NK_STAR",
/* 11 */ "NK_SLASH",
/* 12 */ "NK_REM",
/* 13 */ "SHOW",
/* 14 */ "DATABASES",
/* 15 */ "NK_INTEGER",
/* 16 */ "NK_FLOAT",
/* 17 */ "NK_STRING",
/* 18 */ "NK_BOOL",
/* 19 */ "TIMESTAMP",
/* 20 */ "NK_VARIABLE",
/* 21 */ "NK_COMMA",
/* 22 */ "NK_ID",
/* 23 */ "NK_LP",
/* 24 */ "NK_RP",
/* 25 */ "NK_DOT",
/* 26 */ "BETWEEN",
/* 27 */ "NOT",
/* 28 */ "IS",
/* 29 */ "NULL",
/* 30 */ "NK_LT",
/* 31 */ "NK_GT",
/* 32 */ "NK_LE",
/* 33 */ "NK_GE",
/* 34 */ "NK_NE",
/* 35 */ "NK_EQ",
/* 36 */ "LIKE",
/* 37 */ "MATCH",
/* 38 */ "NMATCH",
/* 39 */ "IN",
/* 40 */ "FROM",
/* 41 */ "AS",
/* 42 */ "JOIN",
/* 43 */ "ON",
/* 44 */ "INNER",
/* 45 */ "SELECT",
/* 46 */ "DISTINCT",
/* 47 */ "WHERE",
/* 48 */ "PARTITION",
/* 49 */ "BY",
/* 50 */ "SESSION",
/* 51 */ "STATE_WINDOW",
/* 52 */ "INTERVAL",
/* 53 */ "SLIDING",
/* 54 */ "FILL",
/* 55 */ "VALUE",
/* 56 */ "NONE",
/* 57 */ "PREV",
/* 58 */ "LINEAR",
/* 59 */ "NEXT",
/* 60 */ "GROUP",
/* 61 */ "HAVING",
/* 62 */ "ORDER",
/* 63 */ "SLIMIT",
/* 64 */ "SOFFSET",
/* 65 */ "LIMIT",
/* 66 */ "OFFSET",
/* 67 */ "ASC",
/* 68 */ "DESC",
/* 69 */ "NULLS",
/* 70 */ "FIRST",
/* 71 */ "LAST",
/* 72 */ "cmd",
/* 73 */ "query_expression",
/* 74 */ "literal",
/* 75 */ "duration_literal",
/* 76 */ "literal_list",
/* 77 */ "db_name",
/* 78 */ "table_name",
/* 79 */ "column_name",
/* 80 */ "function_name",
/* 81 */ "table_alias",
/* 82 */ "column_alias",
/* 83 */ "expression",
/* 84 */ "column_reference",
/* 85 */ "expression_list",
/* 86 */ "subquery",
/* 87 */ "predicate",
/* 88 */ "compare_op",
/* 89 */ "in_op",
/* 90 */ "in_predicate_value",
/* 91 */ "boolean_value_expression",
/* 92 */ "boolean_primary",
/* 93 */ "common_expression",
/* 94 */ "from_clause",
/* 95 */ "table_reference_list",
/* 96 */ "table_reference",
/* 97 */ "table_primary",
/* 98 */ "joined_table",
/* 99 */ "alias_opt",
/* 100 */ "parenthesized_joined_table",
/* 101 */ "join_type",
/* 102 */ "search_condition",
/* 103 */ "query_specification",
/* 104 */ "set_quantifier_opt",
/* 105 */ "select_list",
/* 106 */ "where_clause_opt",
/* 107 */ "partition_by_clause_opt",
/* 108 */ "twindow_clause_opt",
/* 109 */ "group_by_clause_opt",
/* 110 */ "having_clause_opt",
/* 111 */ "select_sublist",
/* 112 */ "select_item",
/* 113 */ "sliding_opt",
/* 114 */ "fill_opt",
/* 115 */ "fill_mode",
/* 116 */ "group_by_list",
/* 117 */ "query_expression_body",
/* 118 */ "order_by_clause_opt",
/* 119 */ "slimit_clause_opt",
/* 120 */ "limit_clause_opt",
/* 121 */ "query_primary",
/* 122 */ "sort_specification_list",
/* 123 */ "sort_specification",
/* 124 */ "ordering_specification_opt",
/* 125 */ "null_ordering_opt",
/* 8 */ "NK_BITAND",
/* 9 */ "NK_BITOR",
/* 10 */ "NK_LSHIFT",
/* 11 */ "NK_RSHIFT",
/* 12 */ "NK_PLUS",
/* 13 */ "NK_MINUS",
/* 14 */ "NK_STAR",
/* 15 */ "NK_SLASH",
/* 16 */ "NK_REM",
/* 17 */ "NK_CONCAT",
/* 18 */ "CREATE",
/* 19 */ "DATABASE",
/* 20 */ "IF",
/* 21 */ "NOT",
/* 22 */ "EXISTS",
/* 23 */ "BLOCKS",
/* 24 */ "NK_INTEGER",
/* 25 */ "CACHE",
/* 26 */ "CACHELAST",
/* 27 */ "COMP",
/* 28 */ "DAYS",
/* 29 */ "FSYNC",
/* 30 */ "MAXROWS",
/* 31 */ "MINROWS",
/* 32 */ "KEEP",
/* 33 */ "PRECISION",
/* 34 */ "NK_STRING",
/* 35 */ "QUORUM",
/* 36 */ "REPLICA",
/* 37 */ "TTL",
/* 38 */ "WAL",
/* 39 */ "VGROUPS",
/* 40 */ "SINGLESTABLE",
/* 41 */ "STREAMMODE",
/* 42 */ "NK_FLOAT",
/* 43 */ "NK_BOOL",
/* 44 */ "TIMESTAMP",
/* 45 */ "NK_VARIABLE",
/* 46 */ "NK_COMMA",
/* 47 */ "NK_ID",
/* 48 */ "NK_LP",
/* 49 */ "NK_RP",
/* 50 */ "NK_DOT",
/* 51 */ "BETWEEN",
/* 52 */ "IS",
/* 53 */ "NULL",
/* 54 */ "NK_LT",
/* 55 */ "NK_GT",
/* 56 */ "NK_LE",
/* 57 */ "NK_GE",
/* 58 */ "NK_NE",
/* 59 */ "NK_EQ",
/* 60 */ "LIKE",
/* 61 */ "MATCH",
/* 62 */ "NMATCH",
/* 63 */ "IN",
/* 64 */ "FROM",
/* 65 */ "AS",
/* 66 */ "JOIN",
/* 67 */ "ON",
/* 68 */ "INNER",
/* 69 */ "SELECT",
/* 70 */ "DISTINCT",
/* 71 */ "WHERE",
/* 72 */ "PARTITION",
/* 73 */ "BY",
/* 74 */ "SESSION",
/* 75 */ "STATE_WINDOW",
/* 76 */ "INTERVAL",
/* 77 */ "SLIDING",
/* 78 */ "FILL",
/* 79 */ "VALUE",
/* 80 */ "NONE",
/* 81 */ "PREV",
/* 82 */ "LINEAR",
/* 83 */ "NEXT",
/* 84 */ "GROUP",
/* 85 */ "HAVING",
/* 86 */ "ORDER",
/* 87 */ "SLIMIT",
/* 88 */ "SOFFSET",
/* 89 */ "LIMIT",
/* 90 */ "OFFSET",
/* 91 */ "ASC",
/* 92 */ "DESC",
/* 93 */ "NULLS",
/* 94 */ "FIRST",
/* 95 */ "LAST",
/* 96 */ "cmd",
/* 97 */ "exists_opt",
/* 98 */ "db_name",
/* 99 */ "db_options",
/* 100 */ "query_expression",
/* 101 */ "literal",
/* 102 */ "duration_literal",
/* 103 */ "literal_list",
/* 104 */ "table_name",
/* 105 */ "column_name",
/* 106 */ "function_name",
/* 107 */ "table_alias",
/* 108 */ "column_alias",
/* 109 */ "expression",
/* 110 */ "column_reference",
/* 111 */ "expression_list",
/* 112 */ "subquery",
/* 113 */ "predicate",
/* 114 */ "compare_op",
/* 115 */ "in_op",
/* 116 */ "in_predicate_value",
/* 117 */ "boolean_value_expression",
/* 118 */ "boolean_primary",
/* 119 */ "common_expression",
/* 120 */ "from_clause",
/* 121 */ "table_reference_list",
/* 122 */ "table_reference",
/* 123 */ "table_primary",
/* 124 */ "joined_table",
/* 125 */ "alias_opt",
/* 126 */ "parenthesized_joined_table",
/* 127 */ "join_type",
/* 128 */ "search_condition",
/* 129 */ "query_specification",
/* 130 */ "set_quantifier_opt",
/* 131 */ "select_list",
/* 132 */ "where_clause_opt",
/* 133 */ "partition_by_clause_opt",
/* 134 */ "twindow_clause_opt",
/* 135 */ "group_by_clause_opt",
/* 136 */ "having_clause_opt",
/* 137 */ "select_sublist",
/* 138 */ "select_item",
/* 139 */ "sliding_opt",
/* 140 */ "fill_opt",
/* 141 */ "fill_mode",
/* 142 */ "group_by_list",
/* 143 */ "query_expression_body",
/* 144 */ "order_by_clause_opt",
/* 145 */ "slimit_clause_opt",
/* 146 */ "limit_clause_opt",
/* 147 */ "query_primary",
/* 148 */ "sort_specification_list",
/* 149 */ "sort_specification",
/* 150 */ "ordering_specification_opt",
/* 151 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
......@@ -663,146 +691,166 @@ static const char *const yyTokenName[] = {
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
/* 0 */ "cmd ::= SHOW DATABASES",
/* 1 */ "cmd ::= query_expression",
/* 2 */ "literal ::= NK_INTEGER",
/* 3 */ "literal ::= NK_FLOAT",
/* 4 */ "literal ::= NK_STRING",
/* 5 */ "literal ::= NK_BOOL",
/* 6 */ "literal ::= TIMESTAMP NK_STRING",
/* 7 */ "literal ::= duration_literal",
/* 8 */ "duration_literal ::= NK_VARIABLE",
/* 9 */ "literal_list ::= literal",
/* 10 */ "literal_list ::= literal_list NK_COMMA literal",
/* 11 */ "db_name ::= NK_ID",
/* 12 */ "table_name ::= NK_ID",
/* 13 */ "column_name ::= NK_ID",
/* 14 */ "function_name ::= NK_ID",
/* 15 */ "table_alias ::= NK_ID",
/* 16 */ "column_alias ::= NK_ID",
/* 17 */ "expression ::= literal",
/* 18 */ "expression ::= column_reference",
/* 19 */ "expression ::= function_name NK_LP expression_list NK_RP",
/* 20 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
/* 21 */ "expression ::= subquery",
/* 22 */ "expression ::= NK_LP expression NK_RP",
/* 23 */ "expression ::= NK_PLUS expression",
/* 24 */ "expression ::= NK_MINUS expression",
/* 25 */ "expression ::= expression NK_PLUS expression",
/* 26 */ "expression ::= expression NK_MINUS expression",
/* 27 */ "expression ::= expression NK_STAR expression",
/* 28 */ "expression ::= expression NK_SLASH expression",
/* 29 */ "expression ::= expression NK_REM expression",
/* 30 */ "expression_list ::= expression",
/* 31 */ "expression_list ::= expression_list NK_COMMA expression",
/* 32 */ "column_reference ::= column_name",
/* 33 */ "column_reference ::= table_name NK_DOT column_name",
/* 34 */ "predicate ::= expression compare_op expression",
/* 35 */ "predicate ::= expression BETWEEN expression AND expression",
/* 36 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 37 */ "predicate ::= expression IS NULL",
/* 38 */ "predicate ::= expression IS NOT NULL",
/* 39 */ "predicate ::= expression in_op in_predicate_value",
/* 40 */ "compare_op ::= NK_LT",
/* 41 */ "compare_op ::= NK_GT",
/* 42 */ "compare_op ::= NK_LE",
/* 43 */ "compare_op ::= NK_GE",
/* 44 */ "compare_op ::= NK_NE",
/* 45 */ "compare_op ::= NK_EQ",
/* 46 */ "compare_op ::= LIKE",
/* 47 */ "compare_op ::= NOT LIKE",
/* 48 */ "compare_op ::= MATCH",
/* 49 */ "compare_op ::= NMATCH",
/* 50 */ "in_op ::= IN",
/* 51 */ "in_op ::= NOT IN",
/* 52 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 53 */ "boolean_value_expression ::= boolean_primary",
/* 54 */ "boolean_value_expression ::= NOT boolean_primary",
/* 55 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 56 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 57 */ "boolean_primary ::= predicate",
/* 58 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 59 */ "common_expression ::= expression",
/* 60 */ "common_expression ::= boolean_value_expression",
/* 61 */ "from_clause ::= FROM table_reference_list",
/* 62 */ "table_reference_list ::= table_reference",
/* 63 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 64 */ "table_reference ::= table_primary",
/* 65 */ "table_reference ::= joined_table",
/* 66 */ "table_primary ::= table_name alias_opt",
/* 67 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 68 */ "table_primary ::= subquery alias_opt",
/* 69 */ "table_primary ::= parenthesized_joined_table",
/* 70 */ "alias_opt ::=",
/* 71 */ "alias_opt ::= table_alias",
/* 72 */ "alias_opt ::= AS table_alias",
/* 73 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 74 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 75 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 76 */ "join_type ::=",
/* 77 */ "join_type ::= INNER",
/* 78 */ "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",
/* 79 */ "set_quantifier_opt ::=",
/* 80 */ "set_quantifier_opt ::= DISTINCT",
/* 81 */ "set_quantifier_opt ::= ALL",
/* 82 */ "select_list ::= NK_STAR",
/* 83 */ "select_list ::= select_sublist",
/* 84 */ "select_sublist ::= select_item",
/* 85 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 86 */ "select_item ::= common_expression",
/* 87 */ "select_item ::= common_expression column_alias",
/* 88 */ "select_item ::= common_expression AS column_alias",
/* 89 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 90 */ "where_clause_opt ::=",
/* 91 */ "where_clause_opt ::= WHERE search_condition",
/* 92 */ "partition_by_clause_opt ::=",
/* 93 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 94 */ "twindow_clause_opt ::=",
/* 95 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
/* 96 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
/* 97 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 98 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 99 */ "sliding_opt ::=",
/* 100 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 101 */ "fill_opt ::=",
/* 102 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 103 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 104 */ "fill_mode ::= NONE",
/* 105 */ "fill_mode ::= PREV",
/* 106 */ "fill_mode ::= NULL",
/* 107 */ "fill_mode ::= LINEAR",
/* 108 */ "fill_mode ::= NEXT",
/* 109 */ "group_by_clause_opt ::=",
/* 110 */ "group_by_clause_opt ::= GROUP BY group_by_list",
/* 111 */ "group_by_list ::= expression",
/* 112 */ "group_by_list ::= group_by_list NK_COMMA expression",
/* 113 */ "having_clause_opt ::=",
/* 114 */ "having_clause_opt ::= HAVING search_condition",
/* 115 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 116 */ "query_expression_body ::= query_primary",
/* 117 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 118 */ "query_primary ::= query_specification",
/* 119 */ "order_by_clause_opt ::=",
/* 120 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 121 */ "slimit_clause_opt ::=",
/* 122 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 123 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 124 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 125 */ "limit_clause_opt ::=",
/* 126 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 127 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 128 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 129 */ "subquery ::= NK_LP query_expression NK_RP",
/* 130 */ "search_condition ::= common_expression",
/* 131 */ "sort_specification_list ::= sort_specification",
/* 132 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 133 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 134 */ "ordering_specification_opt ::=",
/* 135 */ "ordering_specification_opt ::= ASC",
/* 136 */ "ordering_specification_opt ::= DESC",
/* 137 */ "null_ordering_opt ::=",
/* 138 */ "null_ordering_opt ::= NULLS FIRST",
/* 139 */ "null_ordering_opt ::= NULLS LAST",
/* 0 */ "cmd ::= CREATE DATABASE exists_opt db_name db_options",
/* 1 */ "exists_opt ::= IF NOT EXISTS",
/* 2 */ "exists_opt ::=",
/* 3 */ "db_options ::=",
/* 4 */ "db_options ::= db_options BLOCKS NK_INTEGER",
/* 5 */ "db_options ::= db_options CACHE NK_INTEGER",
/* 6 */ "db_options ::= db_options CACHELAST NK_INTEGER",
/* 7 */ "db_options ::= db_options COMP NK_INTEGER",
/* 8 */ "db_options ::= db_options DAYS NK_INTEGER",
/* 9 */ "db_options ::= db_options FSYNC NK_INTEGER",
/* 10 */ "db_options ::= db_options MAXROWS NK_INTEGER",
/* 11 */ "db_options ::= db_options MINROWS NK_INTEGER",
/* 12 */ "db_options ::= db_options KEEP NK_INTEGER",
/* 13 */ "db_options ::= db_options PRECISION NK_STRING",
/* 14 */ "db_options ::= db_options QUORUM NK_INTEGER",
/* 15 */ "db_options ::= db_options REPLICA NK_INTEGER",
/* 16 */ "db_options ::= db_options TTL NK_INTEGER",
/* 17 */ "db_options ::= db_options WAL NK_INTEGER",
/* 18 */ "db_options ::= db_options VGROUPS NK_INTEGER",
/* 19 */ "db_options ::= db_options SINGLESTABLE NK_INTEGER",
/* 20 */ "db_options ::= db_options STREAMMODE NK_INTEGER",
/* 21 */ "cmd ::= query_expression",
/* 22 */ "literal ::= NK_INTEGER",
/* 23 */ "literal ::= NK_FLOAT",
/* 24 */ "literal ::= NK_STRING",
/* 25 */ "literal ::= NK_BOOL",
/* 26 */ "literal ::= TIMESTAMP NK_STRING",
/* 27 */ "literal ::= duration_literal",
/* 28 */ "duration_literal ::= NK_VARIABLE",
/* 29 */ "literal_list ::= literal",
/* 30 */ "literal_list ::= literal_list NK_COMMA literal",
/* 31 */ "db_name ::= NK_ID",
/* 32 */ "table_name ::= NK_ID",
/* 33 */ "column_name ::= NK_ID",
/* 34 */ "function_name ::= NK_ID",
/* 35 */ "table_alias ::= NK_ID",
/* 36 */ "column_alias ::= NK_ID",
/* 37 */ "expression ::= literal",
/* 38 */ "expression ::= column_reference",
/* 39 */ "expression ::= function_name NK_LP expression_list NK_RP",
/* 40 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
/* 41 */ "expression ::= subquery",
/* 42 */ "expression ::= NK_LP expression NK_RP",
/* 43 */ "expression ::= NK_PLUS expression",
/* 44 */ "expression ::= NK_MINUS expression",
/* 45 */ "expression ::= expression NK_PLUS expression",
/* 46 */ "expression ::= expression NK_MINUS expression",
/* 47 */ "expression ::= expression NK_STAR expression",
/* 48 */ "expression ::= expression NK_SLASH expression",
/* 49 */ "expression ::= expression NK_REM expression",
/* 50 */ "expression_list ::= expression",
/* 51 */ "expression_list ::= expression_list NK_COMMA expression",
/* 52 */ "column_reference ::= column_name",
/* 53 */ "column_reference ::= table_name NK_DOT column_name",
/* 54 */ "predicate ::= expression compare_op expression",
/* 55 */ "predicate ::= expression BETWEEN expression AND expression",
/* 56 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 57 */ "predicate ::= expression IS NULL",
/* 58 */ "predicate ::= expression IS NOT NULL",
/* 59 */ "predicate ::= expression in_op in_predicate_value",
/* 60 */ "compare_op ::= NK_LT",
/* 61 */ "compare_op ::= NK_GT",
/* 62 */ "compare_op ::= NK_LE",
/* 63 */ "compare_op ::= NK_GE",
/* 64 */ "compare_op ::= NK_NE",
/* 65 */ "compare_op ::= NK_EQ",
/* 66 */ "compare_op ::= LIKE",
/* 67 */ "compare_op ::= NOT LIKE",
/* 68 */ "compare_op ::= MATCH",
/* 69 */ "compare_op ::= NMATCH",
/* 70 */ "in_op ::= IN",
/* 71 */ "in_op ::= NOT IN",
/* 72 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 73 */ "boolean_value_expression ::= boolean_primary",
/* 74 */ "boolean_value_expression ::= NOT boolean_primary",
/* 75 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 76 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 77 */ "boolean_primary ::= predicate",
/* 78 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 79 */ "common_expression ::= expression",
/* 80 */ "common_expression ::= boolean_value_expression",
/* 81 */ "from_clause ::= FROM table_reference_list",
/* 82 */ "table_reference_list ::= table_reference",
/* 83 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 84 */ "table_reference ::= table_primary",
/* 85 */ "table_reference ::= joined_table",
/* 86 */ "table_primary ::= table_name alias_opt",
/* 87 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 88 */ "table_primary ::= subquery alias_opt",
/* 89 */ "table_primary ::= parenthesized_joined_table",
/* 90 */ "alias_opt ::=",
/* 91 */ "alias_opt ::= table_alias",
/* 92 */ "alias_opt ::= AS table_alias",
/* 93 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 94 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 95 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 96 */ "join_type ::=",
/* 97 */ "join_type ::= INNER",
/* 98 */ "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",
/* 99 */ "set_quantifier_opt ::=",
/* 100 */ "set_quantifier_opt ::= DISTINCT",
/* 101 */ "set_quantifier_opt ::= ALL",
/* 102 */ "select_list ::= NK_STAR",
/* 103 */ "select_list ::= select_sublist",
/* 104 */ "select_sublist ::= select_item",
/* 105 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 106 */ "select_item ::= common_expression",
/* 107 */ "select_item ::= common_expression column_alias",
/* 108 */ "select_item ::= common_expression AS column_alias",
/* 109 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 110 */ "where_clause_opt ::=",
/* 111 */ "where_clause_opt ::= WHERE search_condition",
/* 112 */ "partition_by_clause_opt ::=",
/* 113 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 114 */ "twindow_clause_opt ::=",
/* 115 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
/* 116 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
/* 117 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 118 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 119 */ "sliding_opt ::=",
/* 120 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 121 */ "fill_opt ::=",
/* 122 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 123 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 124 */ "fill_mode ::= NONE",
/* 125 */ "fill_mode ::= PREV",
/* 126 */ "fill_mode ::= NULL",
/* 127 */ "fill_mode ::= LINEAR",
/* 128 */ "fill_mode ::= NEXT",
/* 129 */ "group_by_clause_opt ::=",
/* 130 */ "group_by_clause_opt ::= GROUP BY group_by_list",
/* 131 */ "group_by_list ::= expression",
/* 132 */ "group_by_list ::= group_by_list NK_COMMA expression",
/* 133 */ "having_clause_opt ::=",
/* 134 */ "having_clause_opt ::= HAVING search_condition",
/* 135 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 136 */ "query_expression_body ::= query_primary",
/* 137 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 138 */ "query_primary ::= query_specification",
/* 139 */ "order_by_clause_opt ::=",
/* 140 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 141 */ "slimit_clause_opt ::=",
/* 142 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 143 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 144 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 145 */ "limit_clause_opt ::=",
/* 146 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 147 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 148 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 149 */ "subquery ::= NK_LP query_expression NK_RP",
/* 150 */ "search_condition ::= common_expression",
/* 151 */ "sort_specification_list ::= sort_specification",
/* 152 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 153 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 154 */ "ordering_specification_opt ::=",
/* 155 */ "ordering_specification_opt ::= ASC",
/* 156 */ "ordering_specification_opt ::= DESC",
/* 157 */ "null_ordering_opt ::=",
/* 158 */ "null_ordering_opt ::= NULLS FIRST",
/* 159 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
......@@ -929,92 +977,98 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
case 72: /* cmd */
case 73: /* query_expression */
case 74: /* literal */
case 75: /* duration_literal */
case 83: /* expression */
case 84: /* column_reference */
case 86: /* subquery */
case 87: /* predicate */
case 90: /* in_predicate_value */
case 91: /* boolean_value_expression */
case 92: /* boolean_primary */
case 93: /* common_expression */
case 94: /* from_clause */
case 95: /* table_reference_list */
case 96: /* table_reference */
case 97: /* table_primary */
case 98: /* joined_table */
case 100: /* parenthesized_joined_table */
case 102: /* search_condition */
case 103: /* query_specification */
case 106: /* where_clause_opt */
case 108: /* twindow_clause_opt */
case 110: /* having_clause_opt */
case 112: /* select_item */
case 113: /* sliding_opt */
case 114: /* fill_opt */
case 117: /* query_expression_body */
case 119: /* slimit_clause_opt */
case 120: /* limit_clause_opt */
case 121: /* query_primary */
case 123: /* sort_specification */
case 96: /* cmd */
case 97: /* exists_opt */
case 100: /* query_expression */
case 101: /* literal */
case 102: /* duration_literal */
case 109: /* expression */
case 110: /* column_reference */
case 112: /* subquery */
case 113: /* predicate */
case 116: /* in_predicate_value */
case 117: /* boolean_value_expression */
case 118: /* boolean_primary */
case 119: /* common_expression */
case 120: /* from_clause */
case 121: /* table_reference_list */
case 122: /* table_reference */
case 123: /* table_primary */
case 124: /* joined_table */
case 126: /* parenthesized_joined_table */
case 128: /* search_condition */
case 129: /* query_specification */
case 132: /* where_clause_opt */
case 134: /* twindow_clause_opt */
case 136: /* having_clause_opt */
case 138: /* select_item */
case 139: /* sliding_opt */
case 140: /* fill_opt */
case 143: /* query_expression_body */
case 145: /* slimit_clause_opt */
case 146: /* limit_clause_opt */
case 147: /* query_primary */
case 149: /* sort_specification */
{
PARSER_DESTRUCTOR_TRACE; nodesDestroyNode((yypminor->yy56));
PARSER_DESTRUCTOR_TRACE; nodesDestroyNode((yypminor->yy104));
}
break;
case 76: /* literal_list */
case 85: /* expression_list */
case 105: /* select_list */
case 107: /* partition_by_clause_opt */
case 109: /* group_by_clause_opt */
case 111: /* select_sublist */
case 116: /* group_by_list */
case 118: /* order_by_clause_opt */
case 122: /* sort_specification_list */
case 98: /* db_name */
case 104: /* table_name */
case 105: /* column_name */
case 106: /* function_name */
case 107: /* table_alias */
case 108: /* column_alias */
case 125: /* alias_opt */
{
PARSER_DESTRUCTOR_TRACE; nodesDestroyList((yypminor->yy208));
PARSER_DESTRUCTOR_TRACE;
}
break;
case 77: /* db_name */
case 78: /* table_name */
case 79: /* column_name */
case 80: /* function_name */
case 81: /* table_alias */
case 82: /* column_alias */
case 99: /* alias_opt */
case 99: /* db_options */
{
PARSER_DESTRUCTOR_TRACE;
tfree((yypminor->yy87));
}
break;
case 103: /* literal_list */
case 111: /* expression_list */
case 131: /* select_list */
case 133: /* partition_by_clause_opt */
case 135: /* group_by_clause_opt */
case 137: /* select_sublist */
case 142: /* group_by_list */
case 144: /* order_by_clause_opt */
case 148: /* sort_specification_list */
{
PARSER_DESTRUCTOR_TRACE; nodesDestroyList((yypminor->yy8));
}
break;
case 88: /* compare_op */
case 89: /* in_op */
case 114: /* compare_op */
case 115: /* in_op */
{
PARSER_DESTRUCTOR_TRACE;
}
break;
case 101: /* join_type */
case 127: /* join_type */
{
PARSER_DESTRUCTOR_TRACE;
}
break;
case 104: /* set_quantifier_opt */
case 130: /* set_quantifier_opt */
{
PARSER_DESTRUCTOR_TRACE;
}
break;
case 115: /* fill_mode */
case 141: /* fill_mode */
{
PARSER_DESTRUCTOR_TRACE;
}
break;
case 124: /* ordering_specification_opt */
case 150: /* ordering_specification_opt */
{
PARSER_DESTRUCTOR_TRACE;
}
break;
case 125: /* null_ordering_opt */
case 151: /* null_ordering_opt */
{
PARSER_DESTRUCTOR_TRACE;
}
......@@ -1313,146 +1367,166 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
{ 72, -2 }, /* (0) cmd ::= SHOW DATABASES */
{ 72, -1 }, /* (1) cmd ::= query_expression */
{ 74, -1 }, /* (2) literal ::= NK_INTEGER */
{ 74, -1 }, /* (3) literal ::= NK_FLOAT */
{ 74, -1 }, /* (4) literal ::= NK_STRING */
{ 74, -1 }, /* (5) literal ::= NK_BOOL */
{ 74, -2 }, /* (6) literal ::= TIMESTAMP NK_STRING */
{ 74, -1 }, /* (7) literal ::= duration_literal */
{ 75, -1 }, /* (8) duration_literal ::= NK_VARIABLE */
{ 76, -1 }, /* (9) literal_list ::= literal */
{ 76, -3 }, /* (10) literal_list ::= literal_list NK_COMMA literal */
{ 77, -1 }, /* (11) db_name ::= NK_ID */
{ 78, -1 }, /* (12) table_name ::= NK_ID */
{ 79, -1 }, /* (13) column_name ::= NK_ID */
{ 80, -1 }, /* (14) function_name ::= NK_ID */
{ 81, -1 }, /* (15) table_alias ::= NK_ID */
{ 82, -1 }, /* (16) column_alias ::= NK_ID */
{ 83, -1 }, /* (17) expression ::= literal */
{ 83, -1 }, /* (18) expression ::= column_reference */
{ 83, -4 }, /* (19) expression ::= function_name NK_LP expression_list NK_RP */
{ 83, -4 }, /* (20) expression ::= function_name NK_LP NK_STAR NK_RP */
{ 83, -1 }, /* (21) expression ::= subquery */
{ 83, -3 }, /* (22) expression ::= NK_LP expression NK_RP */
{ 83, -2 }, /* (23) expression ::= NK_PLUS expression */
{ 83, -2 }, /* (24) expression ::= NK_MINUS expression */
{ 83, -3 }, /* (25) expression ::= expression NK_PLUS expression */
{ 83, -3 }, /* (26) expression ::= expression NK_MINUS expression */
{ 83, -3 }, /* (27) expression ::= expression NK_STAR expression */
{ 83, -3 }, /* (28) expression ::= expression NK_SLASH expression */
{ 83, -3 }, /* (29) expression ::= expression NK_REM expression */
{ 85, -1 }, /* (30) expression_list ::= expression */
{ 85, -3 }, /* (31) expression_list ::= expression_list NK_COMMA expression */
{ 84, -1 }, /* (32) column_reference ::= column_name */
{ 84, -3 }, /* (33) column_reference ::= table_name NK_DOT column_name */
{ 87, -3 }, /* (34) predicate ::= expression compare_op expression */
{ 87, -5 }, /* (35) predicate ::= expression BETWEEN expression AND expression */
{ 87, -6 }, /* (36) predicate ::= expression NOT BETWEEN expression AND expression */
{ 87, -3 }, /* (37) predicate ::= expression IS NULL */
{ 87, -4 }, /* (38) predicate ::= expression IS NOT NULL */
{ 87, -3 }, /* (39) predicate ::= expression in_op in_predicate_value */
{ 88, -1 }, /* (40) compare_op ::= NK_LT */
{ 88, -1 }, /* (41) compare_op ::= NK_GT */
{ 88, -1 }, /* (42) compare_op ::= NK_LE */
{ 88, -1 }, /* (43) compare_op ::= NK_GE */
{ 88, -1 }, /* (44) compare_op ::= NK_NE */
{ 88, -1 }, /* (45) compare_op ::= NK_EQ */
{ 88, -1 }, /* (46) compare_op ::= LIKE */
{ 88, -2 }, /* (47) compare_op ::= NOT LIKE */
{ 88, -1 }, /* (48) compare_op ::= MATCH */
{ 88, -1 }, /* (49) compare_op ::= NMATCH */
{ 89, -1 }, /* (50) in_op ::= IN */
{ 89, -2 }, /* (51) in_op ::= NOT IN */
{ 90, -3 }, /* (52) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 91, -1 }, /* (53) boolean_value_expression ::= boolean_primary */
{ 91, -2 }, /* (54) boolean_value_expression ::= NOT boolean_primary */
{ 91, -3 }, /* (55) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 91, -3 }, /* (56) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 92, -1 }, /* (57) boolean_primary ::= predicate */
{ 92, -3 }, /* (58) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 93, -1 }, /* (59) common_expression ::= expression */
{ 93, -1 }, /* (60) common_expression ::= boolean_value_expression */
{ 94, -2 }, /* (61) from_clause ::= FROM table_reference_list */
{ 95, -1 }, /* (62) table_reference_list ::= table_reference */
{ 95, -3 }, /* (63) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 96, -1 }, /* (64) table_reference ::= table_primary */
{ 96, -1 }, /* (65) table_reference ::= joined_table */
{ 97, -2 }, /* (66) table_primary ::= table_name alias_opt */
{ 97, -4 }, /* (67) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 97, -2 }, /* (68) table_primary ::= subquery alias_opt */
{ 97, -1 }, /* (69) table_primary ::= parenthesized_joined_table */
{ 99, 0 }, /* (70) alias_opt ::= */
{ 99, -1 }, /* (71) alias_opt ::= table_alias */
{ 99, -2 }, /* (72) alias_opt ::= AS table_alias */
{ 100, -3 }, /* (73) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 100, -3 }, /* (74) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 98, -6 }, /* (75) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 101, 0 }, /* (76) join_type ::= */
{ 101, -1 }, /* (77) join_type ::= INNER */
{ 103, -9 }, /* (78) 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 */
{ 104, 0 }, /* (79) set_quantifier_opt ::= */
{ 104, -1 }, /* (80) set_quantifier_opt ::= DISTINCT */
{ 104, -1 }, /* (81) set_quantifier_opt ::= ALL */
{ 105, -1 }, /* (82) select_list ::= NK_STAR */
{ 105, -1 }, /* (83) select_list ::= select_sublist */
{ 111, -1 }, /* (84) select_sublist ::= select_item */
{ 111, -3 }, /* (85) select_sublist ::= select_sublist NK_COMMA select_item */
{ 112, -1 }, /* (86) select_item ::= common_expression */
{ 112, -2 }, /* (87) select_item ::= common_expression column_alias */
{ 112, -3 }, /* (88) select_item ::= common_expression AS column_alias */
{ 112, -3 }, /* (89) select_item ::= table_name NK_DOT NK_STAR */
{ 106, 0 }, /* (90) where_clause_opt ::= */
{ 106, -2 }, /* (91) where_clause_opt ::= WHERE search_condition */
{ 107, 0 }, /* (92) partition_by_clause_opt ::= */
{ 107, -3 }, /* (93) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 108, 0 }, /* (94) twindow_clause_opt ::= */
{ 108, -6 }, /* (95) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ 108, -4 }, /* (96) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ 108, -6 }, /* (97) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 108, -8 }, /* (98) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 113, 0 }, /* (99) sliding_opt ::= */
{ 113, -4 }, /* (100) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 114, 0 }, /* (101) fill_opt ::= */
{ 114, -4 }, /* (102) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 114, -6 }, /* (103) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 115, -1 }, /* (104) fill_mode ::= NONE */
{ 115, -1 }, /* (105) fill_mode ::= PREV */
{ 115, -1 }, /* (106) fill_mode ::= NULL */
{ 115, -1 }, /* (107) fill_mode ::= LINEAR */
{ 115, -1 }, /* (108) fill_mode ::= NEXT */
{ 109, 0 }, /* (109) group_by_clause_opt ::= */
{ 109, -3 }, /* (110) group_by_clause_opt ::= GROUP BY group_by_list */
{ 116, -1 }, /* (111) group_by_list ::= expression */
{ 116, -3 }, /* (112) group_by_list ::= group_by_list NK_COMMA expression */
{ 110, 0 }, /* (113) having_clause_opt ::= */
{ 110, -2 }, /* (114) having_clause_opt ::= HAVING search_condition */
{ 73, -4 }, /* (115) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 117, -1 }, /* (116) query_expression_body ::= query_primary */
{ 117, -4 }, /* (117) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 121, -1 }, /* (118) query_primary ::= query_specification */
{ 118, 0 }, /* (119) order_by_clause_opt ::= */
{ 118, -3 }, /* (120) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 119, 0 }, /* (121) slimit_clause_opt ::= */
{ 119, -2 }, /* (122) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 119, -4 }, /* (123) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 119, -4 }, /* (124) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 120, 0 }, /* (125) limit_clause_opt ::= */
{ 120, -2 }, /* (126) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 120, -4 }, /* (127) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 120, -4 }, /* (128) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 86, -3 }, /* (129) subquery ::= NK_LP query_expression NK_RP */
{ 102, -1 }, /* (130) search_condition ::= common_expression */
{ 122, -1 }, /* (131) sort_specification_list ::= sort_specification */
{ 122, -3 }, /* (132) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 123, -3 }, /* (133) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 124, 0 }, /* (134) ordering_specification_opt ::= */
{ 124, -1 }, /* (135) ordering_specification_opt ::= ASC */
{ 124, -1 }, /* (136) ordering_specification_opt ::= DESC */
{ 125, 0 }, /* (137) null_ordering_opt ::= */
{ 125, -2 }, /* (138) null_ordering_opt ::= NULLS FIRST */
{ 125, -2 }, /* (139) null_ordering_opt ::= NULLS LAST */
{ 96, -5 }, /* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */
{ 97, -3 }, /* (1) exists_opt ::= IF NOT EXISTS */
{ 97, 0 }, /* (2) exists_opt ::= */
{ 99, 0 }, /* (3) db_options ::= */
{ 99, -3 }, /* (4) db_options ::= db_options BLOCKS NK_INTEGER */
{ 99, -3 }, /* (5) db_options ::= db_options CACHE NK_INTEGER */
{ 99, -3 }, /* (6) db_options ::= db_options CACHELAST NK_INTEGER */
{ 99, -3 }, /* (7) db_options ::= db_options COMP NK_INTEGER */
{ 99, -3 }, /* (8) db_options ::= db_options DAYS NK_INTEGER */
{ 99, -3 }, /* (9) db_options ::= db_options FSYNC NK_INTEGER */
{ 99, -3 }, /* (10) db_options ::= db_options MAXROWS NK_INTEGER */
{ 99, -3 }, /* (11) db_options ::= db_options MINROWS NK_INTEGER */
{ 99, -3 }, /* (12) db_options ::= db_options KEEP NK_INTEGER */
{ 99, -3 }, /* (13) db_options ::= db_options PRECISION NK_STRING */
{ 99, -3 }, /* (14) db_options ::= db_options QUORUM NK_INTEGER */
{ 99, -3 }, /* (15) db_options ::= db_options REPLICA NK_INTEGER */
{ 99, -3 }, /* (16) db_options ::= db_options TTL NK_INTEGER */
{ 99, -3 }, /* (17) db_options ::= db_options WAL NK_INTEGER */
{ 99, -3 }, /* (18) db_options ::= db_options VGROUPS NK_INTEGER */
{ 99, -3 }, /* (19) db_options ::= db_options SINGLESTABLE NK_INTEGER */
{ 99, -3 }, /* (20) db_options ::= db_options STREAMMODE NK_INTEGER */
{ 96, -1 }, /* (21) cmd ::= query_expression */
{ 101, -1 }, /* (22) literal ::= NK_INTEGER */
{ 101, -1 }, /* (23) literal ::= NK_FLOAT */
{ 101, -1 }, /* (24) literal ::= NK_STRING */
{ 101, -1 }, /* (25) literal ::= NK_BOOL */
{ 101, -2 }, /* (26) literal ::= TIMESTAMP NK_STRING */
{ 101, -1 }, /* (27) literal ::= duration_literal */
{ 102, -1 }, /* (28) duration_literal ::= NK_VARIABLE */
{ 103, -1 }, /* (29) literal_list ::= literal */
{ 103, -3 }, /* (30) literal_list ::= literal_list NK_COMMA literal */
{ 98, -1 }, /* (31) db_name ::= NK_ID */
{ 104, -1 }, /* (32) table_name ::= NK_ID */
{ 105, -1 }, /* (33) column_name ::= NK_ID */
{ 106, -1 }, /* (34) function_name ::= NK_ID */
{ 107, -1 }, /* (35) table_alias ::= NK_ID */
{ 108, -1 }, /* (36) column_alias ::= NK_ID */
{ 109, -1 }, /* (37) expression ::= literal */
{ 109, -1 }, /* (38) expression ::= column_reference */
{ 109, -4 }, /* (39) expression ::= function_name NK_LP expression_list NK_RP */
{ 109, -4 }, /* (40) expression ::= function_name NK_LP NK_STAR NK_RP */
{ 109, -1 }, /* (41) expression ::= subquery */
{ 109, -3 }, /* (42) expression ::= NK_LP expression NK_RP */
{ 109, -2 }, /* (43) expression ::= NK_PLUS expression */
{ 109, -2 }, /* (44) expression ::= NK_MINUS expression */
{ 109, -3 }, /* (45) expression ::= expression NK_PLUS expression */
{ 109, -3 }, /* (46) expression ::= expression NK_MINUS expression */
{ 109, -3 }, /* (47) expression ::= expression NK_STAR expression */
{ 109, -3 }, /* (48) expression ::= expression NK_SLASH expression */
{ 109, -3 }, /* (49) expression ::= expression NK_REM expression */
{ 111, -1 }, /* (50) expression_list ::= expression */
{ 111, -3 }, /* (51) expression_list ::= expression_list NK_COMMA expression */
{ 110, -1 }, /* (52) column_reference ::= column_name */
{ 110, -3 }, /* (53) column_reference ::= table_name NK_DOT column_name */
{ 113, -3 }, /* (54) predicate ::= expression compare_op expression */
{ 113, -5 }, /* (55) predicate ::= expression BETWEEN expression AND expression */
{ 113, -6 }, /* (56) predicate ::= expression NOT BETWEEN expression AND expression */
{ 113, -3 }, /* (57) predicate ::= expression IS NULL */
{ 113, -4 }, /* (58) predicate ::= expression IS NOT NULL */
{ 113, -3 }, /* (59) predicate ::= expression in_op in_predicate_value */
{ 114, -1 }, /* (60) compare_op ::= NK_LT */
{ 114, -1 }, /* (61) compare_op ::= NK_GT */
{ 114, -1 }, /* (62) compare_op ::= NK_LE */
{ 114, -1 }, /* (63) compare_op ::= NK_GE */
{ 114, -1 }, /* (64) compare_op ::= NK_NE */
{ 114, -1 }, /* (65) compare_op ::= NK_EQ */
{ 114, -1 }, /* (66) compare_op ::= LIKE */
{ 114, -2 }, /* (67) compare_op ::= NOT LIKE */
{ 114, -1 }, /* (68) compare_op ::= MATCH */
{ 114, -1 }, /* (69) compare_op ::= NMATCH */
{ 115, -1 }, /* (70) in_op ::= IN */
{ 115, -2 }, /* (71) in_op ::= NOT IN */
{ 116, -3 }, /* (72) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 117, -1 }, /* (73) boolean_value_expression ::= boolean_primary */
{ 117, -2 }, /* (74) boolean_value_expression ::= NOT boolean_primary */
{ 117, -3 }, /* (75) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 117, -3 }, /* (76) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 118, -1 }, /* (77) boolean_primary ::= predicate */
{ 118, -3 }, /* (78) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 119, -1 }, /* (79) common_expression ::= expression */
{ 119, -1 }, /* (80) common_expression ::= boolean_value_expression */
{ 120, -2 }, /* (81) from_clause ::= FROM table_reference_list */
{ 121, -1 }, /* (82) table_reference_list ::= table_reference */
{ 121, -3 }, /* (83) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 122, -1 }, /* (84) table_reference ::= table_primary */
{ 122, -1 }, /* (85) table_reference ::= joined_table */
{ 123, -2 }, /* (86) table_primary ::= table_name alias_opt */
{ 123, -4 }, /* (87) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 123, -2 }, /* (88) table_primary ::= subquery alias_opt */
{ 123, -1 }, /* (89) table_primary ::= parenthesized_joined_table */
{ 125, 0 }, /* (90) alias_opt ::= */
{ 125, -1 }, /* (91) alias_opt ::= table_alias */
{ 125, -2 }, /* (92) alias_opt ::= AS table_alias */
{ 126, -3 }, /* (93) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 126, -3 }, /* (94) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 124, -6 }, /* (95) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 127, 0 }, /* (96) join_type ::= */
{ 127, -1 }, /* (97) join_type ::= INNER */
{ 129, -9 }, /* (98) 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 */
{ 130, 0 }, /* (99) set_quantifier_opt ::= */
{ 130, -1 }, /* (100) set_quantifier_opt ::= DISTINCT */
{ 130, -1 }, /* (101) set_quantifier_opt ::= ALL */
{ 131, -1 }, /* (102) select_list ::= NK_STAR */
{ 131, -1 }, /* (103) select_list ::= select_sublist */
{ 137, -1 }, /* (104) select_sublist ::= select_item */
{ 137, -3 }, /* (105) select_sublist ::= select_sublist NK_COMMA select_item */
{ 138, -1 }, /* (106) select_item ::= common_expression */
{ 138, -2 }, /* (107) select_item ::= common_expression column_alias */
{ 138, -3 }, /* (108) select_item ::= common_expression AS column_alias */
{ 138, -3 }, /* (109) select_item ::= table_name NK_DOT NK_STAR */
{ 132, 0 }, /* (110) where_clause_opt ::= */
{ 132, -2 }, /* (111) where_clause_opt ::= WHERE search_condition */
{ 133, 0 }, /* (112) partition_by_clause_opt ::= */
{ 133, -3 }, /* (113) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 134, 0 }, /* (114) twindow_clause_opt ::= */
{ 134, -6 }, /* (115) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ 134, -4 }, /* (116) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ 134, -6 }, /* (117) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 134, -8 }, /* (118) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 139, 0 }, /* (119) sliding_opt ::= */
{ 139, -4 }, /* (120) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 140, 0 }, /* (121) fill_opt ::= */
{ 140, -4 }, /* (122) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 140, -6 }, /* (123) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 141, -1 }, /* (124) fill_mode ::= NONE */
{ 141, -1 }, /* (125) fill_mode ::= PREV */
{ 141, -1 }, /* (126) fill_mode ::= NULL */
{ 141, -1 }, /* (127) fill_mode ::= LINEAR */
{ 141, -1 }, /* (128) fill_mode ::= NEXT */
{ 135, 0 }, /* (129) group_by_clause_opt ::= */
{ 135, -3 }, /* (130) group_by_clause_opt ::= GROUP BY group_by_list */
{ 142, -1 }, /* (131) group_by_list ::= expression */
{ 142, -3 }, /* (132) group_by_list ::= group_by_list NK_COMMA expression */
{ 136, 0 }, /* (133) having_clause_opt ::= */
{ 136, -2 }, /* (134) having_clause_opt ::= HAVING search_condition */
{ 100, -4 }, /* (135) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 143, -1 }, /* (136) query_expression_body ::= query_primary */
{ 143, -4 }, /* (137) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 147, -1 }, /* (138) query_primary ::= query_specification */
{ 144, 0 }, /* (139) order_by_clause_opt ::= */
{ 144, -3 }, /* (140) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 145, 0 }, /* (141) slimit_clause_opt ::= */
{ 145, -2 }, /* (142) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 145, -4 }, /* (143) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 145, -4 }, /* (144) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 146, 0 }, /* (145) limit_clause_opt ::= */
{ 146, -2 }, /* (146) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 146, -4 }, /* (147) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 146, -4 }, /* (148) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 112, -3 }, /* (149) subquery ::= NK_LP query_expression NK_RP */
{ 128, -1 }, /* (150) search_condition ::= common_expression */
{ 148, -1 }, /* (151) sort_specification_list ::= sort_specification */
{ 148, -3 }, /* (152) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 149, -3 }, /* (153) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 150, 0 }, /* (154) ordering_specification_opt ::= */
{ 150, -1 }, /* (155) ordering_specification_opt ::= ASC */
{ 150, -1 }, /* (156) ordering_specification_opt ::= DESC */
{ 151, 0 }, /* (157) null_ordering_opt ::= */
{ 151, -2 }, /* (158) null_ordering_opt ::= NULLS FIRST */
{ 151, -2 }, /* (159) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
......@@ -1539,486 +1613,563 @@ static YYACTIONTYPE yy_reduce(
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= SHOW DATABASES */
{ PARSER_TRACE; createShowStmt(pCxt, SHOW_TYPE_DATABASE); }
break;
case 1: /* cmd ::= query_expression */
{ PARSER_TRACE; pCxt->pRootNode = yymsp[0].minor.yy56; }
break;
case 2: /* literal ::= NK_INTEGER */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 3: /* literal ::= NK_FLOAT */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 4: /* literal ::= NK_STRING */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 5: /* literal ::= NK_BOOL */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 6: /* literal ::= TIMESTAMP NK_STRING */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
yymsp[-1].minor.yy56 = yylhsminor.yy56;
break;
case 7: /* literal ::= duration_literal */
case 17: /* expression ::= literal */ yytestcase(yyruleno==17);
case 18: /* expression ::= column_reference */ yytestcase(yyruleno==18);
case 21: /* expression ::= subquery */ yytestcase(yyruleno==21);
case 53: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==53);
case 57: /* boolean_primary ::= predicate */ yytestcase(yyruleno==57);
case 62: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==62);
case 64: /* table_reference ::= table_primary */ yytestcase(yyruleno==64);
case 65: /* table_reference ::= joined_table */ yytestcase(yyruleno==65);
case 69: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==69);
case 116: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==116);
case 118: /* query_primary ::= query_specification */ yytestcase(yyruleno==118);
{ PARSER_TRACE; yylhsminor.yy56 = yymsp[0].minor.yy56; }
yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 8: /* duration_literal ::= NK_VARIABLE */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 9: /* literal_list ::= literal */
case 30: /* expression_list ::= expression */ yytestcase(yyruleno==30);
{ PARSER_TRACE; yylhsminor.yy208 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy56)); }
yymsp[0].minor.yy208 = yylhsminor.yy208;
break;
case 10: /* literal_list ::= literal_list NK_COMMA literal */
case 31: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==31);
{ PARSER_TRACE; yylhsminor.yy208 = addNodeToList(pCxt, yymsp[-2].minor.yy208, releaseRawExprNode(pCxt, yymsp[0].minor.yy56)); }
yymsp[-2].minor.yy208 = yylhsminor.yy208;
break;
case 11: /* db_name ::= NK_ID */
case 12: /* table_name ::= NK_ID */ yytestcase(yyruleno==12);
case 13: /* column_name ::= NK_ID */ yytestcase(yyruleno==13);
case 14: /* function_name ::= NK_ID */ yytestcase(yyruleno==14);
case 15: /* table_alias ::= NK_ID */ yytestcase(yyruleno==15);
case 16: /* column_alias ::= NK_ID */ yytestcase(yyruleno==16);
{ PARSER_TRACE; yylhsminor.yy29 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy29 = yylhsminor.yy29;
break;
case 19: /* expression ::= function_name NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy208)); }
yymsp[-3].minor.yy56 = yylhsminor.yy56;
break;
case 20: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
yymsp[-3].minor.yy56 = yylhsminor.yy56;
break;
case 22: /* expression ::= NK_LP expression NK_RP */
case 58: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==58);
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy56)); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
break;
case 23: /* expression ::= NK_PLUS expression */
case 0: /* cmd ::= CREATE DATABASE exists_opt db_name db_options */
{ PARSER_TRACE; pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy129, yymsp[0].minor.yy87);}
break;
case 1: /* exists_opt ::= IF NOT EXISTS */
{ yymsp[-2].minor.yy185 = true; }
break;
case 2: /* exists_opt ::= */
{ yymsp[1].minor.yy185 = false; }
break;
case 3: /* db_options ::= */
{ yymsp[1].minor.yy87 = createDefaultDatabaseOptions(pCxt);}
break;
case 4: /* db_options ::= db_options BLOCKS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 5: /* db_options ::= db_options CACHE NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_CACHE, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 6: /* db_options ::= db_options CACHELAST NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 7: /* db_options ::= db_options COMP NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 8: /* db_options ::= db_options DAYS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 9: /* db_options ::= db_options FSYNC NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 10: /* db_options ::= db_options MAXROWS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 11: /* db_options ::= db_options MINROWS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 12: /* db_options ::= db_options KEEP NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_KEEP, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 13: /* db_options ::= db_options PRECISION NK_STRING */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 14: /* db_options ::= db_options QUORUM NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 15: /* db_options ::= db_options REPLICA NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 16: /* db_options ::= db_options TTL NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_TTL, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 17: /* db_options ::= db_options WAL NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 18: /* db_options ::= db_options VGROUPS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 19: /* db_options ::= db_options SINGLESTABLE NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_SINGLESTABLE, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 20: /* db_options ::= db_options STREAMMODE NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_STREAMMODE, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87;
break;
case 21: /* cmd ::= query_expression */
{ PARSER_TRACE; pCxt->pRootNode = yymsp[0].minor.yy104; }
break;
case 22: /* literal ::= NK_INTEGER */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 23: /* literal ::= NK_FLOAT */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 24: /* literal ::= NK_STRING */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 25: /* literal ::= NK_BOOL */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 26: /* literal ::= TIMESTAMP NK_STRING */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 27: /* literal ::= duration_literal */
case 37: /* expression ::= literal */ yytestcase(yyruleno==37);
case 38: /* expression ::= column_reference */ yytestcase(yyruleno==38);
case 41: /* expression ::= subquery */ yytestcase(yyruleno==41);
case 73: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==73);
case 77: /* boolean_primary ::= predicate */ yytestcase(yyruleno==77);
case 82: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==82);
case 84: /* table_reference ::= table_primary */ yytestcase(yyruleno==84);
case 85: /* table_reference ::= joined_table */ yytestcase(yyruleno==85);
case 89: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==89);
case 136: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==136);
case 138: /* query_primary ::= query_specification */ yytestcase(yyruleno==138);
{ PARSER_TRACE; yylhsminor.yy104 = yymsp[0].minor.yy104; }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 28: /* duration_literal ::= NK_VARIABLE */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 29: /* literal_list ::= literal */
case 50: /* expression_list ::= expression */ yytestcase(yyruleno==50);
{ PARSER_TRACE; yylhsminor.yy8 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); }
yymsp[0].minor.yy8 = yylhsminor.yy8;
break;
case 30: /* literal_list ::= literal_list NK_COMMA literal */
case 51: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==51);
{ PARSER_TRACE; yylhsminor.yy8 = addNodeToList(pCxt, yymsp[-2].minor.yy8, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); }
yymsp[-2].minor.yy8 = yylhsminor.yy8;
break;
case 31: /* db_name ::= NK_ID */
case 32: /* table_name ::= NK_ID */ yytestcase(yyruleno==32);
case 33: /* column_name ::= NK_ID */ yytestcase(yyruleno==33);
case 34: /* function_name ::= NK_ID */ yytestcase(yyruleno==34);
case 35: /* table_alias ::= NK_ID */ yytestcase(yyruleno==35);
case 36: /* column_alias ::= NK_ID */ yytestcase(yyruleno==36);
{ PARSER_TRACE; yylhsminor.yy129 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy129 = yylhsminor.yy129;
break;
case 39: /* expression ::= function_name NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy8)); }
yymsp[-3].minor.yy104 = yylhsminor.yy104;
break;
case 40: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
yymsp[-3].minor.yy104 = yylhsminor.yy104;
break;
case 42: /* expression ::= NK_LP expression NK_RP */
case 78: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==78);
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 43: /* expression ::= NK_PLUS expression */
{
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy56));
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy104));
}
yymsp[-1].minor.yy56 = yylhsminor.yy56;
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 24: /* expression ::= NK_MINUS expression */
case 44: /* expression ::= NK_MINUS expression */
{
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy56), NULL));
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL));
}
yymsp[-1].minor.yy56 = yylhsminor.yy56;
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 25: /* expression ::= expression NK_PLUS expression */
case 45: /* expression ::= expression NK_PLUS expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 26: /* expression ::= expression NK_MINUS expression */
case 46: /* expression ::= expression NK_MINUS expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 27: /* expression ::= expression NK_STAR expression */
case 47: /* expression ::= expression NK_STAR expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 28: /* expression ::= expression NK_SLASH expression */
case 48: /* expression ::= expression NK_SLASH expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 29: /* expression ::= expression NK_REM expression */
case 49: /* expression ::= expression NK_REM expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 32: /* column_reference ::= column_name */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNode(pCxt, &yymsp[0].minor.yy29, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29)); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
case 52: /* column_reference ::= column_name */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 33: /* column_reference ::= table_name NK_DOT column_name */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29)); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 53: /* column_reference ::= table_name NK_DOT column_name */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 34: /* predicate ::= expression compare_op expression */
case 39: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==39);
case 54: /* predicate ::= expression compare_op expression */
case 59: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==59);
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy128, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy60, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 35: /* predicate ::= expression BETWEEN expression AND expression */
case 55: /* predicate ::= expression BETWEEN expression AND expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy56), releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy104), releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-4].minor.yy56 = yylhsminor.yy56;
yymsp[-4].minor.yy104 = yylhsminor.yy104;
break;
case 36: /* predicate ::= expression NOT BETWEEN expression AND expression */
case 56: /* predicate ::= expression NOT BETWEEN expression AND expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[-5].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-5].minor.yy56 = yylhsminor.yy56;
yymsp[-5].minor.yy104 = yylhsminor.yy104;
break;
case 37: /* predicate ::= expression IS NULL */
case 57: /* predicate ::= expression IS NULL */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), NULL));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 38: /* predicate ::= expression IS NOT NULL */
case 58: /* predicate ::= expression IS NOT NULL */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy56), NULL));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL));
}
yymsp[-3].minor.yy56 = yylhsminor.yy56;
yymsp[-3].minor.yy104 = yylhsminor.yy104;
break;
case 40: /* compare_op ::= NK_LT */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_LOWER_THAN; }
case 60: /* compare_op ::= NK_LT */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; }
break;
case 41: /* compare_op ::= NK_GT */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_GREATER_THAN; }
case 61: /* compare_op ::= NK_GT */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; }
break;
case 42: /* compare_op ::= NK_LE */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_LOWER_EQUAL; }
case 62: /* compare_op ::= NK_LE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; }
break;
case 43: /* compare_op ::= NK_GE */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_GREATER_EQUAL; }
case 63: /* compare_op ::= NK_GE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; }
break;
case 44: /* compare_op ::= NK_NE */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_NOT_EQUAL; }
case 64: /* compare_op ::= NK_NE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; }
break;
case 45: /* compare_op ::= NK_EQ */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_EQUAL; }
case 65: /* compare_op ::= NK_EQ */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_EQUAL; }
break;
case 46: /* compare_op ::= LIKE */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_LIKE; }
case 66: /* compare_op ::= LIKE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_LIKE; }
break;
case 47: /* compare_op ::= NOT LIKE */
{ PARSER_TRACE; yymsp[-1].minor.yy128 = OP_TYPE_NOT_LIKE; }
case 67: /* compare_op ::= NOT LIKE */
{ PARSER_TRACE; yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; }
break;
case 48: /* compare_op ::= MATCH */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_MATCH; }
case 68: /* compare_op ::= MATCH */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_MATCH; }
break;
case 49: /* compare_op ::= NMATCH */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_NMATCH; }
case 69: /* compare_op ::= NMATCH */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_NMATCH; }
break;
case 50: /* in_op ::= IN */
{ PARSER_TRACE; yymsp[0].minor.yy128 = OP_TYPE_IN; }
case 70: /* in_op ::= IN */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_IN; }
break;
case 51: /* in_op ::= NOT IN */
{ PARSER_TRACE; yymsp[-1].minor.yy128 = OP_TYPE_NOT_IN; }
case 71: /* in_op ::= NOT IN */
{ PARSER_TRACE; yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; }
break;
case 52: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy208)); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 72: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy8)); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 54: /* boolean_value_expression ::= NOT boolean_primary */
case 74: /* boolean_value_expression ::= NOT boolean_primary */
{
PARSER_TRACE;
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy56), NULL));
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL));
}
yymsp[-1].minor.yy56 = yylhsminor.yy56;
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 55: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
case 75: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 56: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
case 76: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy56);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), releaseRawExprNode(pCxt, yymsp[0].minor.yy56)));
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104)));
}
yymsp[-2].minor.yy56 = yylhsminor.yy56;
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 59: /* common_expression ::= expression */
case 60: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==60);
{ yylhsminor.yy56 = yymsp[0].minor.yy56; }
yymsp[0].minor.yy56 = yylhsminor.yy56;
case 79: /* common_expression ::= expression */
case 80: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==80);
{ yylhsminor.yy104 = yymsp[0].minor.yy104; }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 61: /* from_clause ::= FROM table_reference_list */
case 91: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==91);
case 114: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==114);
{ PARSER_TRACE; yymsp[-1].minor.yy56 = yymsp[0].minor.yy56; }
case 81: /* from_clause ::= FROM table_reference_list */
case 111: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==111);
case 134: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==134);
{ PARSER_TRACE; yymsp[-1].minor.yy104 = yymsp[0].minor.yy104; }
break;
case 63: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ PARSER_TRACE; yylhsminor.yy56 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy56, yymsp[0].minor.yy56, NULL); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 83: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ PARSER_TRACE; yylhsminor.yy104 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy104, yymsp[0].minor.yy104, NULL); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 66: /* table_primary ::= table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy56 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
yymsp[-1].minor.yy56 = yylhsminor.yy56;
case 86: /* table_primary ::= table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 67: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy56 = createRealTableNode(pCxt, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
yymsp[-3].minor.yy56 = yylhsminor.yy56;
case 87: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
yymsp[-3].minor.yy104 = yylhsminor.yy104;
break;
case 68: /* table_primary ::= subquery alias_opt */
{ PARSER_TRACE; yylhsminor.yy56 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy56), &yymsp[0].minor.yy29); }
yymsp[-1].minor.yy56 = yylhsminor.yy56;
case 88: /* table_primary ::= subquery alias_opt */
{ PARSER_TRACE; yylhsminor.yy104 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); }
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 70: /* alias_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy29 = nil_token; }
case 90: /* alias_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy129 = nil_token; }
break;
case 71: /* alias_opt ::= table_alias */
{ PARSER_TRACE; yylhsminor.yy29 = yymsp[0].minor.yy29; }
yymsp[0].minor.yy29 = yylhsminor.yy29;
case 91: /* alias_opt ::= table_alias */
{ PARSER_TRACE; yylhsminor.yy129 = yymsp[0].minor.yy129; }
yymsp[0].minor.yy129 = yylhsminor.yy129;
break;
case 72: /* alias_opt ::= AS table_alias */
{ PARSER_TRACE; yymsp[-1].minor.yy29 = yymsp[0].minor.yy29; }
case 92: /* alias_opt ::= AS table_alias */
{ PARSER_TRACE; yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; }
break;
case 73: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case 74: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==74);
{ PARSER_TRACE; yymsp[-2].minor.yy56 = yymsp[-1].minor.yy56; }
case 93: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case 94: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==94);
{ PARSER_TRACE; yymsp[-2].minor.yy104 = yymsp[-1].minor.yy104; }
break;
case 75: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ PARSER_TRACE; yylhsminor.yy56 = createJoinTableNode(pCxt, yymsp[-4].minor.yy36, yymsp[-5].minor.yy56, yymsp[-2].minor.yy56, yymsp[0].minor.yy56); }
yymsp[-5].minor.yy56 = yylhsminor.yy56;
case 95: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ PARSER_TRACE; yylhsminor.yy104 = createJoinTableNode(pCxt, yymsp[-4].minor.yy228, yymsp[-5].minor.yy104, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); }
yymsp[-5].minor.yy104 = yylhsminor.yy104;
break;
case 76: /* join_type ::= */
{ PARSER_TRACE; yymsp[1].minor.yy36 = JOIN_TYPE_INNER; }
case 96: /* join_type ::= */
{ PARSER_TRACE; yymsp[1].minor.yy228 = JOIN_TYPE_INNER; }
break;
case 77: /* join_type ::= INNER */
{ PARSER_TRACE; yymsp[0].minor.yy36 = JOIN_TYPE_INNER; }
case 97: /* join_type ::= INNER */
{ PARSER_TRACE; yymsp[0].minor.yy228 = JOIN_TYPE_INNER; }
break;
case 78: /* 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 98: /* 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 */
{
PARSER_TRACE;
yymsp[-8].minor.yy56 = createSelectStmt(pCxt, yymsp[-7].minor.yy173, yymsp[-6].minor.yy208, yymsp[-5].minor.yy56);
yymsp[-8].minor.yy56 = addWhereClause(pCxt, yymsp[-8].minor.yy56, yymsp[-4].minor.yy56);
yymsp[-8].minor.yy56 = addPartitionByClause(pCxt, yymsp[-8].minor.yy56, yymsp[-3].minor.yy208);
yymsp[-8].minor.yy56 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy56, yymsp[-2].minor.yy56);
yymsp[-8].minor.yy56 = addGroupByClause(pCxt, yymsp[-8].minor.yy56, yymsp[-1].minor.yy208);
yymsp[-8].minor.yy56 = addHavingClause(pCxt, yymsp[-8].minor.yy56, yymsp[0].minor.yy56);
yymsp[-8].minor.yy104 = createSelectStmt(pCxt, yymsp[-7].minor.yy185, yymsp[-6].minor.yy8, yymsp[-5].minor.yy104);
yymsp[-8].minor.yy104 = addWhereClause(pCxt, yymsp[-8].minor.yy104, yymsp[-4].minor.yy104);
yymsp[-8].minor.yy104 = addPartitionByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-3].minor.yy8);
yymsp[-8].minor.yy104 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy104, yymsp[-2].minor.yy104);
yymsp[-8].minor.yy104 = addGroupByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-1].minor.yy8);
yymsp[-8].minor.yy104 = addHavingClause(pCxt, yymsp[-8].minor.yy104, yymsp[0].minor.yy104);
}
break;
case 79: /* set_quantifier_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy173 = false; }
case 99: /* set_quantifier_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy185 = false; }
break;
case 80: /* set_quantifier_opt ::= DISTINCT */
{ PARSER_TRACE; yymsp[0].minor.yy173 = true; }
case 100: /* set_quantifier_opt ::= DISTINCT */
{ PARSER_TRACE; yymsp[0].minor.yy185 = true; }
break;
case 81: /* set_quantifier_opt ::= ALL */
{ PARSER_TRACE; yymsp[0].minor.yy173 = false; }
case 101: /* set_quantifier_opt ::= ALL */
{ PARSER_TRACE; yymsp[0].minor.yy185 = false; }
break;
case 82: /* select_list ::= NK_STAR */
{ PARSER_TRACE; yymsp[0].minor.yy208 = NULL; }
case 102: /* select_list ::= NK_STAR */
{ PARSER_TRACE; yymsp[0].minor.yy8 = NULL; }
break;
case 83: /* select_list ::= select_sublist */
{ PARSER_TRACE; yylhsminor.yy208 = yymsp[0].minor.yy208; }
yymsp[0].minor.yy208 = yylhsminor.yy208;
case 103: /* select_list ::= select_sublist */
{ PARSER_TRACE; yylhsminor.yy8 = yymsp[0].minor.yy8; }
yymsp[0].minor.yy8 = yylhsminor.yy8;
break;
case 84: /* select_sublist ::= select_item */
case 131: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==131);
{ PARSER_TRACE; yylhsminor.yy208 = createNodeList(pCxt, yymsp[0].minor.yy56); }
yymsp[0].minor.yy208 = yylhsminor.yy208;
case 104: /* select_sublist ::= select_item */
case 151: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==151);
{ PARSER_TRACE; yylhsminor.yy8 = createNodeList(pCxt, yymsp[0].minor.yy104); }
yymsp[0].minor.yy8 = yylhsminor.yy8;
break;
case 85: /* select_sublist ::= select_sublist NK_COMMA select_item */
case 132: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==132);
{ PARSER_TRACE; yylhsminor.yy208 = addNodeToList(pCxt, yymsp[-2].minor.yy208, yymsp[0].minor.yy56); }
yymsp[-2].minor.yy208 = yylhsminor.yy208;
case 105: /* select_sublist ::= select_sublist NK_COMMA select_item */
case 152: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==152);
{ PARSER_TRACE; yylhsminor.yy8 = addNodeToList(pCxt, yymsp[-2].minor.yy8, yymsp[0].minor.yy104); }
yymsp[-2].minor.yy8 = yylhsminor.yy8;
break;
case 86: /* select_item ::= common_expression */
case 106: /* select_item ::= common_expression */
{
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy56);
yylhsminor.yy56 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy56), &t);
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104);
yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), &t);
}
yymsp[0].minor.yy56 = yylhsminor.yy56;
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 87: /* select_item ::= common_expression column_alias */
{ PARSER_TRACE; yylhsminor.yy56 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy56), &yymsp[0].minor.yy29); }
yymsp[-1].minor.yy56 = yylhsminor.yy56;
case 107: /* select_item ::= common_expression column_alias */
{ PARSER_TRACE; yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); }
yymsp[-1].minor.yy104 = yylhsminor.yy104;
break;
case 88: /* select_item ::= common_expression AS column_alias */
{ PARSER_TRACE; yylhsminor.yy56 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), &yymsp[0].minor.yy29); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 108: /* select_item ::= common_expression AS column_alias */
{ PARSER_TRACE; yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), &yymsp[0].minor.yy129); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 89: /* select_item ::= table_name NK_DOT NK_STAR */
{ PARSER_TRACE; yylhsminor.yy56 = createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 109: /* select_item ::= table_name NK_DOT NK_STAR */
{ PARSER_TRACE; yylhsminor.yy104 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 90: /* where_clause_opt ::= */
case 94: /* twindow_clause_opt ::= */ yytestcase(yyruleno==94);
case 99: /* sliding_opt ::= */ yytestcase(yyruleno==99);
case 101: /* fill_opt ::= */ yytestcase(yyruleno==101);
case 113: /* having_clause_opt ::= */ yytestcase(yyruleno==113);
case 121: /* slimit_clause_opt ::= */ yytestcase(yyruleno==121);
case 125: /* limit_clause_opt ::= */ yytestcase(yyruleno==125);
{ PARSER_TRACE; yymsp[1].minor.yy56 = NULL; }
case 110: /* where_clause_opt ::= */
case 114: /* twindow_clause_opt ::= */ yytestcase(yyruleno==114);
case 119: /* sliding_opt ::= */ yytestcase(yyruleno==119);
case 121: /* fill_opt ::= */ yytestcase(yyruleno==121);
case 133: /* having_clause_opt ::= */ yytestcase(yyruleno==133);
case 141: /* slimit_clause_opt ::= */ yytestcase(yyruleno==141);
case 145: /* limit_clause_opt ::= */ yytestcase(yyruleno==145);
{ PARSER_TRACE; yymsp[1].minor.yy104 = NULL; }
break;
case 92: /* partition_by_clause_opt ::= */
case 109: /* group_by_clause_opt ::= */ yytestcase(yyruleno==109);
case 119: /* order_by_clause_opt ::= */ yytestcase(yyruleno==119);
{ PARSER_TRACE; yymsp[1].minor.yy208 = NULL; }
case 112: /* partition_by_clause_opt ::= */
case 129: /* group_by_clause_opt ::= */ yytestcase(yyruleno==129);
case 139: /* order_by_clause_opt ::= */ yytestcase(yyruleno==139);
{ PARSER_TRACE; yymsp[1].minor.yy8 = NULL; }
break;
case 93: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 110: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==110);
case 120: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==120);
{ PARSER_TRACE; yymsp[-2].minor.yy208 = yymsp[0].minor.yy208; }
case 113: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 130: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==130);
case 140: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==140);
{ PARSER_TRACE; yymsp[-2].minor.yy8 = yymsp[0].minor.yy8; }
break;
case 95: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy56 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy56), &yymsp[-1].minor.yy0); }
case 115: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy104 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), &yymsp[-1].minor.yy0); }
break;
case 96: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy56 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy56)); }
case 116: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); }
break;
case 97: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-5].minor.yy56 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy56, NULL, yymsp[-1].minor.yy56, yymsp[0].minor.yy56); }
case 117: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-5].minor.yy104 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy104, NULL, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); }
break;
case 98: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-7].minor.yy56 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy56, yymsp[-3].minor.yy56, yymsp[-1].minor.yy56, yymsp[0].minor.yy56); }
case 118: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-7].minor.yy104 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy104, yymsp[-3].minor.yy104, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); }
break;
case 100: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy56 = yymsp[-1].minor.yy56; }
case 120: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy104 = yymsp[-1].minor.yy104; }
break;
case 102: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy56 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); }
case 122: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createFillNode(pCxt, yymsp[-1].minor.yy246, NULL); }
break;
case 103: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy56 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy208)); }
case 123: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy104 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy8)); }
break;
case 104: /* fill_mode ::= NONE */
{ PARSER_TRACE; yymsp[0].minor.yy18 = FILL_MODE_NONE; }
case 124: /* fill_mode ::= NONE */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_NONE; }
break;
case 105: /* fill_mode ::= PREV */
{ PARSER_TRACE; yymsp[0].minor.yy18 = FILL_MODE_PREV; }
case 125: /* fill_mode ::= PREV */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_PREV; }
break;
case 106: /* fill_mode ::= NULL */
{ PARSER_TRACE; yymsp[0].minor.yy18 = FILL_MODE_NULL; }
case 126: /* fill_mode ::= NULL */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_NULL; }
break;
case 107: /* fill_mode ::= LINEAR */
{ PARSER_TRACE; yymsp[0].minor.yy18 = FILL_MODE_LINEAR; }
case 127: /* fill_mode ::= LINEAR */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_LINEAR; }
break;
case 108: /* fill_mode ::= NEXT */
{ PARSER_TRACE; yymsp[0].minor.yy18 = FILL_MODE_NEXT; }
case 128: /* fill_mode ::= NEXT */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_NEXT; }
break;
case 111: /* group_by_list ::= expression */
{ PARSER_TRACE; yylhsminor.yy208 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy56))); }
yymsp[0].minor.yy208 = yylhsminor.yy208;
case 131: /* group_by_list ::= expression */
{ PARSER_TRACE; yylhsminor.yy8 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); }
yymsp[0].minor.yy8 = yylhsminor.yy8;
break;
case 112: /* group_by_list ::= group_by_list NK_COMMA expression */
{ PARSER_TRACE; yylhsminor.yy208 = addNodeToList(pCxt, yymsp[-2].minor.yy208, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy56))); }
yymsp[-2].minor.yy208 = yylhsminor.yy208;
case 132: /* group_by_list ::= group_by_list NK_COMMA expression */
{ PARSER_TRACE; yylhsminor.yy8 = addNodeToList(pCxt, yymsp[-2].minor.yy8, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); }
yymsp[-2].minor.yy8 = yylhsminor.yy8;
break;
case 115: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
case 135: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
PARSER_TRACE;
yylhsminor.yy56 = addOrderByClause(pCxt, yymsp[-3].minor.yy56, yymsp[-2].minor.yy208);
yylhsminor.yy56 = addSlimitClause(pCxt, yylhsminor.yy56, yymsp[-1].minor.yy56);
yylhsminor.yy56 = addLimitClause(pCxt, yylhsminor.yy56, yymsp[0].minor.yy56);
yylhsminor.yy104 = addOrderByClause(pCxt, yymsp[-3].minor.yy104, yymsp[-2].minor.yy8);
yylhsminor.yy104 = addSlimitClause(pCxt, yylhsminor.yy104, yymsp[-1].minor.yy104);
yylhsminor.yy104 = addLimitClause(pCxt, yylhsminor.yy104, yymsp[0].minor.yy104);
}
yymsp[-3].minor.yy56 = yylhsminor.yy56;
yymsp[-3].minor.yy104 = yylhsminor.yy104;
break;
case 117: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ PARSER_TRACE; yylhsminor.yy56 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy56, yymsp[0].minor.yy56); }
yymsp[-3].minor.yy56 = yylhsminor.yy56;
case 137: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ PARSER_TRACE; yylhsminor.yy104 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy104, yymsp[0].minor.yy104); }
yymsp[-3].minor.yy104 = yylhsminor.yy104;
break;
case 122: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 126: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==126);
{ PARSER_TRACE; yymsp[-1].minor.yy56 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
case 142: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 146: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==146);
{ PARSER_TRACE; yymsp[-1].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
case 123: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 127: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==127);
{ PARSER_TRACE; yymsp[-3].minor.yy56 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
case 143: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 147: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==147);
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 124: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case 128: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==128);
{ PARSER_TRACE; yymsp[-3].minor.yy56 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
case 144: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case 148: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==148);
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
case 129: /* subquery ::= NK_LP query_expression NK_RP */
{ PARSER_TRACE; yylhsminor.yy56 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy56); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 149: /* subquery ::= NK_LP query_expression NK_RP */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy104); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 130: /* search_condition ::= common_expression */
{ PARSER_TRACE; yylhsminor.yy56 = releaseRawExprNode(pCxt, yymsp[0].minor.yy56); }
yymsp[0].minor.yy56 = yylhsminor.yy56;
case 150: /* search_condition ::= common_expression */
{ PARSER_TRACE; yylhsminor.yy104 = releaseRawExprNode(pCxt, yymsp[0].minor.yy104); }
yymsp[0].minor.yy104 = yylhsminor.yy104;
break;
case 133: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ PARSER_TRACE; yylhsminor.yy56 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy56), yymsp[-1].minor.yy218, yymsp[0].minor.yy109); }
yymsp[-2].minor.yy56 = yylhsminor.yy56;
case 153: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ PARSER_TRACE; yylhsminor.yy104 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[-1].minor.yy50, yymsp[0].minor.yy186); }
yymsp[-2].minor.yy104 = yylhsminor.yy104;
break;
case 134: /* ordering_specification_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy218 = ORDER_ASC; }
case 154: /* ordering_specification_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy50 = ORDER_ASC; }
break;
case 135: /* ordering_specification_opt ::= ASC */
{ PARSER_TRACE; yymsp[0].minor.yy218 = ORDER_ASC; }
case 155: /* ordering_specification_opt ::= ASC */
{ PARSER_TRACE; yymsp[0].minor.yy50 = ORDER_ASC; }
break;
case 136: /* ordering_specification_opt ::= DESC */
{ PARSER_TRACE; yymsp[0].minor.yy218 = ORDER_DESC; }
case 156: /* ordering_specification_opt ::= DESC */
{ PARSER_TRACE; yymsp[0].minor.yy50 = ORDER_DESC; }
break;
case 137: /* null_ordering_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; }
case 157: /* null_ordering_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy186 = NULL_ORDER_DEFAULT; }
break;
case 138: /* null_ordering_opt ::= NULLS FIRST */
{ PARSER_TRACE; yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; }
case 158: /* null_ordering_opt ::= NULLS FIRST */
{ PARSER_TRACE; yymsp[-1].minor.yy186 = NULL_ORDER_FIRST; }
break;
case 139: /* null_ordering_opt ::= NULLS LAST */
{ PARSER_TRACE; yymsp[-1].minor.yy109 = NULL_ORDER_LAST; }
case 159: /* null_ordering_opt ::= NULLS LAST */
{ PARSER_TRACE; yymsp[-1].minor.yy186 = NULL_ORDER_LAST; }
break;
default:
break;
......
......@@ -13,257 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if 0
#include "astGenerator.h"
#include "parserInt.h"
#include "parserUtil.h"
#include "ttoken.h"
#include "function.h"
#include "insertParser.h"
bool isInsertSql(const char* pStr, size_t length) {
int32_t index = 0;
do {
SToken t0 = tStrGetToken((char*) pStr, &index, false);
if (t0.type != TK_LP) {
return t0.type == TK_INSERT || t0.type == TK_IMPORT;
}
} while (1);
}
bool qIsDdlQuery(const SQueryNode* pQueryNode) {
return TSDB_SQL_INSERT != pQueryNode->type && TSDB_SQL_SELECT != pQueryNode->type && TSDB_SQL_CREATE_TABLE != pQueryNode->type;
}
int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
int32_t code = TSDB_CODE_SUCCESS;
SSqlInfo info = doGenerateAST(pCxt->pSql);
if (!info.valid) {
strncpy(pCxt->pMsg, info.msg, pCxt->msgLen);
code = TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
goto _end;
}
if (!isDqlSqlStatement(&info)) {
if (info.type == TSDB_SQL_CREATE_TABLE) {
SVnodeModifOpStmtInfo * pModifStmtInfo = qParserValidateCreateTbSqlNode(&info, pCxt, pCxt->pMsg, pCxt->msgLen);
if (pModifStmtInfo == NULL) {
code = terrno;
goto _end;
}
*pQuery = (SQueryNode*)pModifStmtInfo;
} else {
SDclStmtInfo* pDcl = qParserValidateDclSqlNode(&info, pCxt, pCxt->pMsg, pCxt->msgLen);
if (pDcl == NULL) {
code = terrno;
goto _end;
}
*pQuery = (SQueryNode*)pDcl;
pDcl->nodeType = info.type;
}
} else {
SQueryStmtInfo* pQueryInfo = createQueryInfo();
if (pQueryInfo == NULL) {
code = TSDB_CODE_QRY_OUT_OF_MEMORY; // set correct error code.
goto _end;
}
code = qParserValidateSqlNode(pCxt, &info, pQueryInfo, pCxt->pMsg, pCxt->msgLen);
if (code == TSDB_CODE_SUCCESS) {
*pQuery = (SQueryNode*)pQueryInfo;
} else {
goto _end;
}
}
_end:
destroySqlInfo(&info);
terrno = code;
return code;
}
int32_t qParseQuerySql(SParseContext* pCxt, SQueryNode** pQueryNode) {
if (isInsertSql(pCxt->pSql, pCxt->sqlLen)) {
return parseInsertSql(pCxt, (SVnodeModifOpStmtInfo**)pQueryNode);
} else {
return parseQuerySql(pCxt, pQueryNode);
}
}
int32_t qParserConvertSql(const char* pStr, size_t length, char** pConvertSql) {
return 0;
}
static int32_t getTableNameFromSqlNode(SSqlNode* pSqlNode, SArray* tableNameList, SParseContext *pCtx, SMsgBuf* pMsgBuf);
static int32_t tnameComparFn(const void* p1, const void* p2) {
SName* pn1 = (SName*)p1;
SName* pn2 = (SName*)p2;
int32_t ret = pn1->acctId - pn2->acctId;
if (ret != 0) {
return ret > 0? 1:-1;
} else {
ret = strncmp(pn1->dbname, pn2->dbname, tListLen(pn1->dbname));
if (ret != 0) {
return ret > 0? 1:-1;
} else {
ret = strncmp(pn1->tname, pn2->tname, tListLen(pn1->tname));
if (ret != 0) {
return ret > 0? 1:-1;
} else {
return 0;
}
}
}
}
static int32_t getTableNameFromSubquery(SSqlNode* pSqlNode, SArray* tableNameList, SParseContext *pCtx, SMsgBuf* pMsgBuf) {
int32_t numOfSub = (int32_t)taosArrayGetSize(pSqlNode->from->list);
for (int32_t j = 0; j < numOfSub; ++j) {
SRelElement* sub = taosArrayGet(pSqlNode->from->list, j);
int32_t num = (int32_t)taosArrayGetSize(sub->pSubquery->node);
for (int32_t i = 0; i < num; ++i) {
SSqlNode* p = taosArrayGetP(sub->pSubquery->node, i);
if (p->from->type == SQL_FROM_NODE_TABLES) {
int32_t code = getTableNameFromSqlNode(p, tableNameList, pCtx, pMsgBuf);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
} else {
getTableNameFromSubquery(p, tableNameList, pCtx, pMsgBuf);
}
}
}
return TSDB_CODE_SUCCESS;
}
int32_t getTableNameFromSqlNode(SSqlNode* pSqlNode, SArray* tableNameList, SParseContext *pParseCtx, SMsgBuf* pMsgBuf) {
const char* msg1 = "invalid table name";
int32_t numOfTables = (int32_t) taosArrayGetSize(pSqlNode->from->list);
assert(pSqlNode->from->type == SQL_FROM_NODE_TABLES);
for(int32_t j = 0; j < numOfTables; ++j) {
SRelElement* item = taosArrayGet(pSqlNode->from->list, j);
SToken* t = &item->tableName;
if (t->type == TK_INTEGER || t->type == TK_FLOAT || t->type == TK_STRING) {
return buildInvalidOperationMsg(pMsgBuf, msg1);
}
if (parserValidateIdToken(t) != TSDB_CODE_SUCCESS) {
return buildInvalidOperationMsg(pMsgBuf, msg1);
}
SName name = {0};
int32_t code = createSName(&name, t, pParseCtx, pMsgBuf);
if (code != TSDB_CODE_SUCCESS) {
return buildInvalidOperationMsg(pMsgBuf, msg1);
}
taosArrayPush(tableNameList, &name);
}
return TSDB_CODE_SUCCESS;
}
static void freePtrElem(void* p) {
tfree(*(char**)p);
}
int32_t qParserExtractRequestedMetaInfo(const SSqlInfo* pSqlInfo, SCatalogReq* pMetaInfo, SParseContext *pCtx, char* msg, int32_t msgBufLen) {
int32_t code = TSDB_CODE_SUCCESS;
SMsgBuf msgBuf = {.buf = msg, .len = msgBufLen};
pMetaInfo->pTableName = taosArrayInit(4, sizeof(SName));
pMetaInfo->pUdf = taosArrayInit(4, POINTER_BYTES);
size_t size = taosArrayGetSize(pSqlInfo->sub.node);
for (int32_t i = 0; i < size; ++i) {
SSqlNode* pSqlNode = taosArrayGetP(pSqlInfo->sub.node, i);
if (pSqlNode->from == NULL) {
return buildInvalidOperationMsg(&msgBuf, "invalid from clause");
}
// load the table meta in the FROM clause
if (pSqlNode->from->type == SQL_FROM_NODE_TABLES) {
code = getTableNameFromSqlNode(pSqlNode, pMetaInfo->pTableName, pCtx, &msgBuf);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
} else {
code = getTableNameFromSubquery(pSqlNode, pMetaInfo->pTableName, pCtx, &msgBuf);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
}
}
taosArraySort(pMetaInfo->pTableName, tnameComparFn);
taosArrayRemoveDuplicate(pMetaInfo->pTableName, tnameComparFn, NULL);
size_t funcSize = 0;
if (pSqlInfo->funcs) {
funcSize = taosArrayGetSize(pSqlInfo->funcs);
}
if (funcSize > 0) {
for (size_t i = 0; i < funcSize; ++i) {
SToken* t = taosArrayGet(pSqlInfo->funcs, i);
assert(t != NULL);
if (t->n >= TSDB_FUNC_NAME_LEN) {
return buildSyntaxErrMsg(&msgBuf, "too long function name", t->z);
}
// Let's assume that it is an UDF/UDAF, if it is not a built-in function.
bool scalarFunc = false;
if (qIsBuiltinFunction(t->z, t->n, &scalarFunc) < 0) {
char* fname = strndup(t->z, t->n);
taosArrayPush(pMetaInfo->pUdf, &fname);
}
}
}
return code;
}
void qParserCleanupMetaRequestInfo(SCatalogReq* pMetaReq) {
if (pMetaReq == NULL) {
return;
}
taosArrayDestroy(pMetaReq->pTableName);
taosArrayDestroy(pMetaReq->pUdf);
}
void qDestroyQuery(SQueryNode* pQueryNode) {
if (NULL == pQueryNode) {
return;
}
int32_t type = queryNodeType(pQueryNode);
if (type == TSDB_SQL_INSERT || type == TSDB_SQL_CREATE_TABLE) {
SVnodeModifOpStmtInfo* pModifInfo = (SVnodeModifOpStmtInfo*)pQueryNode;
taosArrayDestroy(pModifInfo->pDataBlocks);
tfree(pQueryNode);
} else if (type == TSDB_SQL_SELECT) {
SQueryStmtInfo* pQueryStmtInfo = (SQueryStmtInfo*) pQueryNode;
destroyQueryInfo(pQueryStmtInfo);
}
}
#else
#include "parser.h"
#include "insertParser.h"
......@@ -275,7 +24,7 @@ static bool isInsertSql(const char* pStr, size_t length) {
do {
SToken t0 = tStrGetToken((char*) pStr, &index, false);
if (t0.type != TK_LP) {
if (t0.type != TK_NK_LP) {
return t0.type == TK_INSERT || t0.type == TK_IMPORT;
}
} while (1);
......@@ -300,5 +49,3 @@ int32_t qParseQuerySql(SParseContext* pCxt, SQuery** pQuery) {
void qDestroyQuery(SQuery* pQueryNode) {
// todo
}
#endif
......@@ -46,7 +46,7 @@ int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char*
}
int32_t parserValidateIdToken(SToken* pToken) {
if (pToken == NULL || pToken->z == NULL || pToken->type != TK_ID) {
if (pToken == NULL || pToken->z == NULL || pToken->type != TK_NK_ID) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
......@@ -75,7 +75,7 @@ int32_t parserValidateIdToken(SToken* pToken) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
if (pToken->type != TK_ID) {
if (pToken->type != TK_NK_ID) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
......@@ -84,7 +84,7 @@ int32_t parserValidateIdToken(SToken* pToken) {
pToken->z = sep + 1;
pToken->n = (uint32_t)(oldLen - (sep - pStr) - 1);
int32_t len = tGetToken(pToken->z, &pToken->type);
if (len != pToken->n || pToken->type != TK_ID) {
if (len != pToken->n || pToken->type != TK_NK_ID) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
......
......@@ -29,91 +29,91 @@ typedef struct SKeyword {
// keywords in sql string
static SKeyword keywordTable[] = {
{"ID", TK_ID},
{"BOOL", TK_BOOL},
// {"ID", TK_ID},
// {"BOOL", TK_BOOL},
// {"TINYINT", TK_TINYINT},
// {"SMALLINT", TK_SMALLINT},
{"INTEGER", TK_INTEGER},
{"INT", TK_INTEGER},
// {"INTEGER", TK_INTEGER},
// {"INT", TK_INTEGER},
// {"BIGINT", TK_BIGINT},
{"FLOAT", TK_FLOAT},
// {"FLOAT", TK_FLOAT},
// {"DOUBLE", TK_DOUBLE},
{"STRING", TK_STRING},
// {"STRING", TK_STRING},
{"TIMESTAMP", TK_TIMESTAMP},
// {"BINARY", TK_BINARY},
// {"NCHAR", TK_NCHAR},
{"OR", TK_OR},
{"AND", TK_AND},
{"NOT", TK_NOT},
{"EQ", TK_EQ},
{"NE", TK_NE},
{"ISNULL", TK_ISNULL},
{"NOTNULL", TK_NOTNULL},
// {"EQ", TK_EQ},
// {"NE", TK_NE},
// {"ISNULL", TK_ISNULL},
// {"NOTNULL", TK_NOTNULL},
{"IS", TK_IS},
{"LIKE", TK_LIKE},
{"MATCH", TK_MATCH},
{"GLOB", TK_GLOB},
// {"GLOB", TK_GLOB},
{"BETWEEN", TK_BETWEEN},
{"IN", TK_IN},
{"GT", TK_GT},
{"GE", TK_GE},
{"LT", TK_LT},
{"LE", TK_LE},
{"BITAND", TK_BITAND},
{"BITOR", TK_BITOR},
{"LSHIFT", TK_LSHIFT},
{"RSHIFT", TK_RSHIFT},
{"PLUS", TK_PLUS},
// {"GT", TK_GT},
// {"GE", TK_GE},
// {"LT", TK_LT},
// {"LE", TK_LE},
// {"BITAND", TK_BITAND},
// {"BITOR", TK_BITOR},
// {"LSHIFT", TK_LSHIFT},
// {"RSHIFT", TK_RSHIFT},
// {"PLUS", TK_PLUS},
{"MINUS", TK_MINUS},
{"DIVIDE", TK_DIVIDE},
{"TIMES", TK_TIMES},
{"STAR", TK_STAR},
{"SLASH", TK_SLASH},
{"REM ", TK_REM},
{"||", TK_CONCAT},
{"UMINUS", TK_UMINUS},
{"UPLUS", TK_UPLUS},
{"BITNOT", TK_BITNOT},
{"SHOW", TK_SHOW},
{"DATABASES", TK_DATABASES},
{"MNODES", TK_MNODES},
{"DNODES", TK_DNODES},
{"ACCOUNTS", TK_ACCOUNTS},
{"USERS", TK_USERS},
{"MODULES", TK_MODULES},
{"QUERIES", TK_QUERIES},
{"CONNECTIONS", TK_CONNECTIONS},
{"STREAMS", TK_STREAMS},
{"VARIABLES", TK_VARIABLES},
{"SCORES", TK_SCORES},
{"GRANTS", TK_GRANTS},
{"DOT", TK_DOT},
{"TABLES", TK_TABLES},
{"STABLES", TK_STABLES},
// {"DIVIDE", TK_DIVIDE},
// {"TIMES", TK_TIMES},
// {"STAR", TK_STAR},
// {"SLASH", TK_SLASH},
// {"REM ", TK_REM},
// {"||", TK_CONCAT},
// {"UMINUS", TK_UMINUS},
// {"UPLUS", TK_UPLUS},
// {"BITNOT", TK_BITNOT},
// {"SHOW", TK_SHOW},
// {"DATABASES", TK_DATABASES},
// {"MNODES", TK_MNODES},
// {"DNODES", TK_DNODES},
// {"ACCOUNTS", TK_ACCOUNTS},
// {"USERS", TK_USERS},
// {"MODULES", TK_MODULES},
// {"QUERIES", TK_QUERIES},
// {"CONNECTIONS", TK_CONNECTIONS},
// {"STREAMS", TK_STREAMS},
// {"VARIABLES", TK_VARIABLES},
// {"SCORES", TK_SCORES},
// {"GRANTS", TK_GRANTS},
// {"DOT", TK_DOT},
// {"TABLES", TK_TABLES},
// {"STABLES", TK_STABLES},
{"VGROUPS", TK_VGROUPS},
{"DROP", TK_DROP},
{"TABLE", TK_TABLE},
// {"DROP", TK_DROP},
// {"TABLE", TK_TABLE},
{"DATABASE", TK_DATABASE},
{"DNODE", TK_DNODE},
{"USER", TK_USER},
{"ACCOUNT", TK_ACCOUNT},
{"USE", TK_USE},
{"DESCRIBE", TK_DESCRIBE},
{"SYNCDB", TK_SYNCDB},
{"ALTER", TK_ALTER},
{"PASS", TK_PASS},
{"PRIVILEGE", TK_PRIVILEGE},
{"LOCAL", TK_LOCAL},
// {"DNODE", TK_DNODE},
// {"USER", TK_USER},
// {"ACCOUNT", TK_ACCOUNT},
// {"USE", TK_USE},
// {"DESCRIBE", TK_DESCRIBE},
// {"SYNCDB", TK_SYNCDB},
// {"ALTER", TK_ALTER},
// {"PASS", TK_PASS},
// {"PRIVILEGE", TK_PRIVILEGE},
// {"LOCAL", TK_LOCAL},
{"IF", TK_IF},
{"EXISTS", TK_EXISTS},
{"CREATE", TK_CREATE},
{"PPS", TK_PPS},
{"TSERIES", TK_TSERIES},
{"DBS", TK_DBS},
{"STORAGE", TK_STORAGE},
{"QTIME", TK_QTIME},
{"CONNS", TK_CONNS},
{"STATE", TK_STATE},
// {"PPS", TK_PPS},
// {"TSERIES", TK_TSERIES},
// {"DBS", TK_DBS},
// {"STORAGE", TK_STORAGE},
// {"QTIME", TK_QTIME},
// {"CONNS", TK_CONNS},
// {"STATE", TK_STATE},
{"KEEP", TK_KEEP},
{"REPLICA", TK_REPLICA},
{"QUORUM", TK_QUORUM},
......@@ -122,23 +122,23 @@ static SKeyword keywordTable[] = {
{"MAXROWS", TK_MAXROWS},
{"BLOCKS", TK_BLOCKS},
{"CACHE", TK_CACHE},
{"CTIME", TK_CTIME},
// {"CTIME", TK_CTIME},
{"WAL", TK_WAL},
{"FSYNC", TK_FSYNC},
{"COMP", TK_COMP},
{"PRECISION", TK_PRECISION},
{"LP", TK_LP},
{"RP", TK_RP},
{"UNSIGNED", TK_UNSIGNED},
// {"LP", TK_LP},
// {"RP", TK_RP},
// {"UNSIGNED", TK_UNSIGNED},
{"TAGS", TK_TAGS},
{"USING", TK_USING},
{"AS", TK_AS},
{"COMMA", TK_COMMA},
// {"COMMA", TK_COMMA},
{"NULL", TK_NULL},
{"SELECT", TK_SELECT},
{"EVERY", TK_EVERY},
// {"EVERY", TK_EVERY},
{"FROM", TK_FROM},
{"VARIABLE", TK_VARIABLE},
// {"VARIABLE", TK_VARIABLE},
{"INTERVAL", TK_INTERVAL},
{"SESSION", TK_SESSION},
{"STATE_WINDOW", TK_STATE_WINDOW},
......@@ -159,78 +159,78 @@ static SKeyword keywordTable[] = {
{"INSERT", TK_INSERT},
{"INTO", TK_INTO},
{"VALUES", TK_VALUES},
{"UPDATE", TK_UPDATE},
{"RESET", TK_RESET},
{"QUERY", TK_QUERY},
{"ADD", TK_ADD},
{"COLUMN", TK_COLUMN},
{"TAG", TK_TAG},
{"CHANGE", TK_CHANGE},
{"SET", TK_SET},
{"KILL", TK_KILL},
{"CONNECTION", TK_CONNECTION},
{"COLON", TK_COLON},
{"STREAM", TK_STREAM},
{"ABORT", TK_ABORT},
{"AFTER", TK_AFTER},
{"ATTACH", TK_ATTACH},
{"BEFORE", TK_BEFORE},
{"BEGIN", TK_BEGIN},
{"CASCADE", TK_CASCADE},
{"CLUSTER", TK_CLUSTER},
{"CONFLICT", TK_CONFLICT},
{"COPY", TK_COPY},
{"DEFERRED", TK_DEFERRED},
{"DELIMITERS", TK_DELIMITERS},
{"DETACH", TK_DETACH},
{"EACH", TK_EACH},
{"END", TK_END},
{"EXPLAIN", TK_EXPLAIN},
{"FAIL", TK_FAIL},
{"FOR", TK_FOR},
{"IGNORE", TK_IGNORE},
{"IMMEDIATE", TK_IMMEDIATE},
{"INITIALLY", TK_INITIALLY},
{"INSTEAD", TK_INSTEAD},
// {"UPDATE", TK_UPDATE},
// {"RESET", TK_RESET},
// {"QUERY", TK_QUERY},
// {"ADD", TK_ADD},
// {"COLUMN", TK_COLUMN},
// {"TAG", TK_TAG},
// {"CHANGE", TK_CHANGE},
// {"SET", TK_SET},
// {"KILL", TK_KILL},
// {"CONNECTION", TK_CONNECTION},
// {"COLON", TK_COLON},
// {"STREAM", TK_STREAM},
// {"ABORT", TK_ABORT},
// {"AFTER", TK_AFTER},
// {"ATTACH", TK_ATTACH},
// {"BEFORE", TK_BEFORE},
// {"BEGIN", TK_BEGIN},
// {"CASCADE", TK_CASCADE},
// {"CLUSTER", TK_CLUSTER},
// {"CONFLICT", TK_CONFLICT},
// {"COPY", TK_COPY},
// {"DEFERRED", TK_DEFERRED},
// {"DELIMITERS", TK_DELIMITERS},
// {"DETACH", TK_DETACH},
// {"EACH", TK_EACH},
// {"END", TK_END},
// {"EXPLAIN", TK_EXPLAIN},
// {"FAIL", TK_FAIL},
// {"FOR", TK_FOR},
// {"IGNORE", TK_IGNORE},
// {"IMMEDIATE", TK_IMMEDIATE},
// {"INITIALLY", TK_INITIALLY},
// {"INSTEAD", TK_INSTEAD},
{"MATCH", TK_MATCH},
{"NMATCH", TK_NMATCH},
{"KEY", TK_KEY},
{"OF", TK_OF},
{"RAISE", TK_RAISE},
{"REPLACE", TK_REPLACE},
{"RESTRICT", TK_RESTRICT},
{"ROW", TK_ROW},
{"STATEMENT", TK_STATEMENT},
{"TRIGGER", TK_TRIGGER},
{"VIEW", TK_VIEW},
// {"KEY", TK_KEY},
// {"OF", TK_OF},
// {"RAISE", TK_RAISE},
// {"REPLACE", TK_REPLACE},
// {"RESTRICT", TK_RESTRICT},
// {"ROW", TK_ROW},
// {"STATEMENT", TK_STATEMENT},
// {"TRIGGER", TK_TRIGGER},
// {"VIEW", TK_VIEW},
{"ALL", TK_ALL},
{"SEMI", TK_SEMI},
// {"SEMI", TK_SEMI},
{"NONE", TK_NONE},
{"PREV", TK_PREV},
{"LINEAR", TK_LINEAR},
{"IMPORT", TK_IMPORT},
{"TBNAME", TK_TBNAME},
// {"TBNAME", TK_TBNAME},
{"JOIN", TK_JOIN},
{"STABLE", TK_STABLE},
// {"STABLE", TK_STABLE},
{"FILE", TK_FILE},
{"VNODES", TK_VNODES},
// {"VNODES", TK_VNODES},
{"UNION", TK_UNION},
{"CACHELAST", TK_CACHELAST},
{"DISTINCT", TK_DISTINCT},
// {"PARTITIONS", TK_PARTITIONS},
{"TOPIC", TK_TOPIC},
{"TOPICS", TK_TOPICS},
{"COMPACT", TK_COMPACT},
{"MODIFY", TK_MODIFY},
{"FUNCTION", TK_FUNCTION},
{"FUNCTIONS", TK_FUNCTIONS},
{"OUTPUTTYPE", TK_OUTPUTTYPE},
{"AGGREGATE", TK_AGGREGATE},
{"BUFSIZE", TK_BUFSIZE},
{"PORT", TK_PORT},
{"INNER", NEW_TK_INNER},
{"ON", NEW_TK_ON},
{"MODE", TK_MODE},
// {"TOPIC", TK_TOPIC},
// {"TOPICS", TK_TOPICS},
// {"COMPACT", TK_COMPACT},
// {"MODIFY", TK_MODIFY},
// {"FUNCTION", TK_FUNCTION},
// {"FUNCTIONS", TK_FUNCTIONS},
// {"OUTPUTTYPE", TK_OUTPUTTYPE},
// {"AGGREGATE", TK_AGGREGATE},
// {"BUFSIZE", TK_BUFSIZE},
// {"PORT", TK_PORT},
{"INNER", TK_INNER},
{"ON", TK_ON},
// {"MODE", TK_MODE},
};
static const char isIdChar[] = {
......@@ -265,7 +265,7 @@ static int32_t tKeywordCode(const char* z, int n) {
char key[512] = {0};
if (n > tListLen(key)) { // too long token, can not be any other token type
return TK_ID;
return TK_NK_ID;
}
for (int32_t j = 0; j < n; ++j) {
......@@ -281,7 +281,7 @@ static int32_t tKeywordCode(const char* z, int n) {
}
SKeyword** pKey = (SKeyword**)taosHashGet(keywordHashTable, key, n);
return (pKey != NULL)? (*pKey)->type:TK_ID;
return (pKey != NULL)? (*pKey)->type:TK_NK_ID;
}
/*
......@@ -302,7 +302,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return i;
}
case ':': {
*tokenId = TK_COLON;
*tokenId = TK_NK_COLON;
return 1;
}
case '-': {
......@@ -316,11 +316,11 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return 1;
}
case '(': {
*tokenId = TK_LP;
*tokenId = TK_NK_LP;
return 1;
}
case ')': {
*tokenId = TK_RP;
*tokenId = TK_NK_RP;
return 1;
}
case ';': {
......@@ -328,16 +328,16 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return 1;
}
case '+': {
*tokenId = TK_PLUS;
*tokenId = TK_NK_PLUS;
return 1;
}
case '*': {
*tokenId = TK_STAR;
*tokenId = TK_NK_STAR;
return 1;
}
case '/': {
if (z[1] != '*' || z[2] == 0) {
*tokenId = TK_SLASH;
*tokenId = TK_NK_SLASH;
return 1;
}
for (i = 3; z[i] && (z[i] != '/' || z[i - 1] != '*'); i++) {
......@@ -347,37 +347,37 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return i;
}
case '%': {
*tokenId = TK_REM;
*tokenId = TK_NK_REM;
return 1;
}
case '=': {
*tokenId = TK_EQ;
*tokenId = TK_NK_EQ;
return 1 + (z[1] == '=');
}
case '<': {
if (z[1] == '=') {
*tokenId = TK_LE;
*tokenId = TK_NK_LE;
return 2;
} else if (z[1] == '>') {
*tokenId = TK_NE;
*tokenId = TK_NK_NE;
return 2;
} else if (z[1] == '<') {
*tokenId = TK_LSHIFT;
*tokenId = TK_NK_LSHIFT;
return 2;
} else {
*tokenId = TK_LT;
*tokenId = TK_NK_LT;
return 1;
}
}
case '>': {
if (z[1] == '=') {
*tokenId = TK_GE;
*tokenId = TK_NK_GE;
return 2;
} else if (z[1] == '>') {
*tokenId = TK_RSHIFT;
*tokenId = TK_NK_RSHIFT;
return 2;
} else {
*tokenId = TK_GT;
*tokenId = TK_NK_GT;
return 1;
}
}
......@@ -386,29 +386,29 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
*tokenId = TK_ILLEGAL;
return 2;
} else {
*tokenId = TK_NE;
*tokenId = TK_NK_NE;
return 2;
}
}
case '|': {
if (z[1] != '|') {
*tokenId = TK_BITOR;
*tokenId = TK_NK_BITOR;
return 1;
} else {
*tokenId = TK_CONCAT;
*tokenId = TK_NK_CONCAT;
return 2;
}
}
case ',': {
*tokenId = TK_COMMA;
*tokenId = TK_NK_COMMA;
return 1;
}
case '&': {
*tokenId = TK_BITAND;
*tokenId = TK_NK_BITAND;
return 1;
}
case '~': {
*tokenId = TK_BITNOT;
*tokenId = TK_NK_BITNOT;
return 1;
}
case '?': {
......@@ -439,7 +439,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
if (z[i]) i++;
if (strEnd) {
*tokenId = (delim == '`')? TK_ID:TK_STRING;
*tokenId = (delim == '`')? TK_NK_ID:TK_NK_STRING;
return i;
}
......@@ -463,10 +463,10 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
}
}
*tokenId = TK_FLOAT;
*tokenId = TK_NK_FLOAT;
return i;
} else {
*tokenId = TK_DOT;
*tokenId = TK_NK_DOT;
return 1;
}
}
......@@ -505,7 +505,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
case '7':
case '8':
case '9': {
*tokenId = TK_INTEGER;
*tokenId = TK_NK_INTEGER;
for (i = 1; isdigit(z[i]); i++) {
}
......@@ -515,7 +515,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
z[i] == 'B' || z[i] == 'U' || z[i] == 'A' || z[i] == 'S' || z[i] == 'M' || z[i] == 'H' || z[i] == 'D' || z[i] == 'N' ||
z[i] == 'Y' || z[i] == 'W') &&
(isIdChar[(uint8_t)z[i + 1]] == 0)) {
*tokenId = TK_VARIABLE;
*tokenId = TK_NK_VARIABLE;
i += 1;
return i;
}
......@@ -526,7 +526,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
while (isdigit(z[i])) {
i++;
}
*tokenId = TK_FLOAT;
*tokenId = TK_NK_FLOAT;
seg++;
}
......@@ -541,14 +541,14 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
while (isdigit(z[i])) {
i++;
}
*tokenId = TK_FLOAT;
*tokenId = TK_NK_FLOAT;
}
return i;
}
case '[': {
for (i = 1; z[i] && z[i - 1] != ']'; i++) {
}
*tokenId = TK_ID;
*tokenId = TK_NK_ID;
return i;
}
case 'T':
......@@ -559,7 +559,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
}
if ((i == 4 && strncasecmp(z, "true", 4) == 0) || (i == 5 && strncasecmp(z, "false", 5) == 0)) {
*tokenId = TK_BOOL;
*tokenId = TK_NK_BOOL;
return i;
}
}
......@@ -655,7 +655,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
len = tGetToken(&str[*i + t0.n + 1], &type);
// only id and string are valid
if ((TK_STRING != t0.type) && (TK_ID != t0.type)) {
if ((TK_NK_STRING != t0.type) && (TK_NK_ID != t0.type)) {
t0.type = TK_ILLEGAL;
t0.n = 0;
......@@ -666,9 +666,9 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
} else {
// support parse the -/+number format
if ((isPrevOptr) && (t0.type == TK_MINUS || t0.type == TK_PLUS)) {
if ((isPrevOptr) && (t0.type == TK_MINUS || t0.type == TK_NK_PLUS)) {
len = tGetToken(&str[*i + t0.n], &type);
if (type == TK_INTEGER || type == TK_FLOAT) {
if (type == TK_NK_INTEGER || type == TK_NK_FLOAT) {
t0.type = type;
t0.n += len;
}
......@@ -682,7 +682,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
}
bool taosIsKeyWordToken(const char* z, int32_t len) {
return (tKeywordCode((char*)z, len) != TK_ID);
return (tKeywordCode((char*)z, len) != TK_NK_ID);
}
void taosCleanupKeywordsTable() {
......
......@@ -612,10 +612,10 @@ TEST_F(ParserTest, selectSemanticError) {
setDatabase("root", "test");
// TSDB_CODE_PAR_INVALID_COLUMN
bind("SELECT c1, c3 FROM t1");
bind("SELECT c1, cc1 FROM t1");
ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_PAR_INVALID_COLUMN));
bind("SELECT t1.c1, t1.c3 FROM t1");
bind("SELECT t1.c1, t1.cc1 FROM t1");
ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_PAR_INVALID_COLUMN));
// TSDB_CODE_PAR_TABLE_NOT_EXIST
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册