未验证 提交 3119efc7 编写于 作者: X xiao-yu-wang 提交者: GitHub

Merge pull request #10533 from taosdata/feature/3.0_query_integrate_wxy

TD-13706 client modify vnode process integration
...@@ -51,6 +51,7 @@ typedef void **TAOS_ROW; ...@@ -51,6 +51,7 @@ typedef void **TAOS_ROW;
#define TSDB_DATA_TYPE_JSON 17 // json #define TSDB_DATA_TYPE_JSON 17 // json
#define TSDB_DATA_TYPE_DECIMAL 18 // decimal #define TSDB_DATA_TYPE_DECIMAL 18 // decimal
#define TSDB_DATA_TYPE_BLOB 19 // binary #define TSDB_DATA_TYPE_BLOB 19 // binary
#define TSDB_DATA_TYPE_MEDIUMBLOB 20
typedef enum { typedef enum {
TSDB_OPTION_LOCALE, TSDB_OPTION_LOCALE,
......
...@@ -57,63 +57,85 @@ ...@@ -57,63 +57,85 @@
#define TK_VGROUPS 39 #define TK_VGROUPS 39
#define TK_SINGLESTABLE 40 #define TK_SINGLESTABLE 40
#define TK_STREAMMODE 41 #define TK_STREAMMODE 41
#define TK_NK_FLOAT 42 #define TK_USE 42
#define TK_NK_BOOL 43 #define TK_TABLE 43
#define TK_TIMESTAMP 44 #define TK_NK_LP 44
#define TK_NK_VARIABLE 45 #define TK_NK_RP 45
#define TK_NK_COMMA 46 #define TK_NK_ID 46
#define TK_NK_ID 47 #define TK_NK_DOT 47
#define TK_NK_LP 48 #define TK_NK_COMMA 48
#define TK_NK_RP 49 #define TK_COMMENT 49
#define TK_NK_DOT 50 #define TK_BOOL 50
#define TK_BETWEEN 51 #define TK_TINYINT 51
#define TK_IS 52 #define TK_SMALLINT 52
#define TK_NULL 53 #define TK_INT 53
#define TK_NK_LT 54 #define TK_INTEGER 54
#define TK_NK_GT 55 #define TK_BIGINT 55
#define TK_NK_LE 56 #define TK_FLOAT 56
#define TK_NK_GE 57 #define TK_DOUBLE 57
#define TK_NK_NE 58 #define TK_BINARY 58
#define TK_NK_EQ 59 #define TK_TIMESTAMP 59
#define TK_LIKE 60 #define TK_NCHAR 60
#define TK_MATCH 61 #define TK_UNSIGNED 61
#define TK_NMATCH 62 #define TK_JSON 62
#define TK_IN 63 #define TK_VARCHAR 63
#define TK_FROM 64 #define TK_MEDIUMBLOB 64
#define TK_AS 65 #define TK_BLOB 65
#define TK_JOIN 66 #define TK_VARBINARY 66
#define TK_ON 67 #define TK_DECIMAL 67
#define TK_INNER 68 #define TK_SHOW 68
#define TK_SELECT 69 #define TK_DATABASES 69
#define TK_DISTINCT 70 #define TK_NK_FLOAT 70
#define TK_WHERE 71 #define TK_NK_BOOL 71
#define TK_PARTITION 72 #define TK_NK_VARIABLE 72
#define TK_BY 73 #define TK_BETWEEN 73
#define TK_SESSION 74 #define TK_IS 74
#define TK_STATE_WINDOW 75 #define TK_NULL 75
#define TK_INTERVAL 76 #define TK_NK_LT 76
#define TK_SLIDING 77 #define TK_NK_GT 77
#define TK_FILL 78 #define TK_NK_LE 78
#define TK_VALUE 79 #define TK_NK_GE 79
#define TK_NONE 80 #define TK_NK_NE 80
#define TK_PREV 81 #define TK_NK_EQ 81
#define TK_LINEAR 82 #define TK_LIKE 82
#define TK_NEXT 83 #define TK_MATCH 83
#define TK_GROUP 84 #define TK_NMATCH 84
#define TK_HAVING 85 #define TK_IN 85
#define TK_ORDER 86 #define TK_FROM 86
#define TK_SLIMIT 87 #define TK_AS 87
#define TK_SOFFSET 88 #define TK_JOIN 88
#define TK_LIMIT 89 #define TK_ON 89
#define TK_OFFSET 90 #define TK_INNER 90
#define TK_ASC 91 #define TK_SELECT 91
#define TK_DESC 92 #define TK_DISTINCT 92
#define TK_NULLS 93 #define TK_WHERE 93
#define TK_FIRST 94 #define TK_PARTITION 94
#define TK_LAST 95 #define TK_BY 95
#define TK_SESSION 96
#define TK_STATE_WINDOW 97
#define TK_INTERVAL 98
#define TK_SLIDING 99
#define TK_FILL 100
#define TK_VALUE 101
#define TK_NONE 102
#define TK_PREV 103
#define TK_LINEAR 104
#define TK_NEXT 105
#define TK_GROUP 106
#define TK_HAVING 107
#define TK_ORDER 108
#define TK_SLIMIT 109
#define TK_SOFFSET 110
#define TK_LIMIT 111
#define TK_OFFSET 112
#define TK_ASC 113
#define TK_DESC 114
#define TK_NULLS 115
#define TK_FIRST 116
#define TK_LAST 117
#define TK_SPACE 300 #define TK_SPACE 300
#define TK_COMMENT 301 #define TK_NK_COMMENT 301
#define TK_ILLEGAL 302 #define TK_ILLEGAL 302
#define TK_HEX 303 // hex number 0x123 #define TK_HEX 303 // hex number 0x123
#define TK_OCT 304 // oct number #define TK_OCT 304 // oct number
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_PLANN_NODES_H_ #ifndef _TD_CMD_NODES_H_
#define _TD_PLANN_NODES_H_ #define _TD_CMD_NODES_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -49,6 +49,11 @@ typedef struct SCreateDatabaseStmt { ...@@ -49,6 +49,11 @@ typedef struct SCreateDatabaseStmt {
SDatabaseOptions options; SDatabaseOptions options;
} SCreateDatabaseStmt; } SCreateDatabaseStmt;
typedef struct SUseDatabaseStmt {
ENodeType type;
char dbName[TSDB_DB_NAME_LEN];
} SUseDatabaseStmt;
typedef struct STableOptions { typedef struct STableOptions {
int32_t keep; int32_t keep;
int32_t ttl; int32_t ttl;
...@@ -77,4 +82,4 @@ typedef struct SCreateTableStmt { ...@@ -77,4 +82,4 @@ typedef struct SCreateTableStmt {
} }
#endif #endif
#endif /*_TD_PLANN_NODES_H_*/ #endif /*_TD_CMD_NODES_H_*/
...@@ -70,16 +70,18 @@ typedef enum ENodeType { ...@@ -70,16 +70,18 @@ typedef enum ENodeType {
// Statement nodes are used in parser and planner module. // Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR, QUERY_NODE_SET_OPERATOR,
QUERY_NODE_SELECT_STMT, QUERY_NODE_SELECT_STMT,
QUERY_NODE_SHOW_STMT,
QUERY_NODE_VNODE_MODIF_STMT, QUERY_NODE_VNODE_MODIF_STMT,
QUERY_NODE_CREATE_DATABASE_STMT, QUERY_NODE_CREATE_DATABASE_STMT,
QUERY_NODE_CREATE_TABLE_STMT, QUERY_NODE_CREATE_TABLE_STMT,
QUERY_NODE_USE_DATABASE_STMT,
QUERY_NODE_SHOW_DATABASE_STMT, // temp
// logic plan node // logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN, QUERY_NODE_LOGIC_PLAN_SCAN,
QUERY_NODE_LOGIC_PLAN_JOIN, QUERY_NODE_LOGIC_PLAN_JOIN,
QUERY_NODE_LOGIC_PLAN_AGG, QUERY_NODE_LOGIC_PLAN_AGG,
QUERY_NODE_LOGIC_PLAN_PROJECT, QUERY_NODE_LOGIC_PLAN_PROJECT,
QUERY_NODE_LOGIC_PLAN_VNODE_MODIF,
QUERY_NODE_LOGIC_SUBPLAN, QUERY_NODE_LOGIC_SUBPLAN,
QUERY_NODE_LOGIC_PLAN, QUERY_NODE_LOGIC_PLAN,
...@@ -94,6 +96,7 @@ typedef enum ENodeType { ...@@ -94,6 +96,7 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, QUERY_NODE_PHYSICAL_PLAN_EXCHANGE,
QUERY_NODE_PHYSICAL_PLAN_SORT, QUERY_NODE_PHYSICAL_PLAN_SORT,
QUERY_NODE_PHYSICAL_PLAN_DISPATCH, QUERY_NODE_PHYSICAL_PLAN_DISPATCH,
QUERY_NODE_PHYSICAL_PLAN_INSERT,
QUERY_NODE_PHYSICAL_SUBPLAN, QUERY_NODE_PHYSICAL_SUBPLAN,
QUERY_NODE_PHYSICAL_PLAN QUERY_NODE_PHYSICAL_PLAN
} ENodeType; } ENodeType;
...@@ -153,6 +156,7 @@ bool nodesEqualNode(const SNodeptr a, const SNodeptr b); ...@@ -153,6 +156,7 @@ bool nodesEqualNode(const SNodeptr a, const SNodeptr b);
SNodeptr nodesCloneNode(const SNodeptr pNode); SNodeptr nodesCloneNode(const SNodeptr pNode);
SNodeList* nodesCloneList(const SNodeList* pList); SNodeList* nodesCloneList(const SNodeList* pList);
const char* nodesNodeName(ENodeType type);
int32_t nodesNodeToString(const SNodeptr pNode, bool format, char** pStr, int32_t* pLen); int32_t nodesNodeToString(const SNodeptr pNode, bool format, char** pStr, int32_t* pLen);
int32_t nodesStringToNode(const char* pStr, SNode** pNode); int32_t nodesStringToNode(const char* pStr, SNode** pNode);
......
...@@ -65,11 +65,28 @@ typedef struct SProjectLogicNode { ...@@ -65,11 +65,28 @@ typedef struct SProjectLogicNode {
SNodeList* pProjections; SNodeList* pProjections;
} SProjectLogicNode; } SProjectLogicNode;
typedef struct SVnodeModifLogicNode {
ENodeType type;;
int32_t msgType;
SArray* pDataBlocks;
SVgDataBlocks* pVgDataBlocks;
} SVnodeModifLogicNode;
typedef enum ESubplanType {
SUBPLAN_TYPE_MERGE = 1,
SUBPLAN_TYPE_PARTIAL,
SUBPLAN_TYPE_SCAN,
SUBPLAN_TYPE_MODIFY
} ESubplanType;
typedef struct SSubLogicPlan { typedef struct SSubLogicPlan {
ENodeType type; ENodeType type;
SNodeList* pChildren; SNodeList* pChildren;
SNodeList* pParents; SNodeList* pParents;
SLogicNode* pNode; SLogicNode* pNode;
SQueryNodeAddr execNode;
ESubplanType subplanType;
int32_t level;
} SSubLogicPlan; } SSubLogicPlan;
typedef struct SQueryLogicPlan { typedef struct SQueryLogicPlan {
...@@ -178,13 +195,6 @@ typedef struct SSubplanId { ...@@ -178,13 +195,6 @@ typedef struct SSubplanId {
int32_t subplanId; int32_t subplanId;
} SSubplanId; } SSubplanId;
typedef enum ESubplanType {
SUBPLAN_TYPE_MERGE = 1,
SUBPLAN_TYPE_PARTIAL,
SUBPLAN_TYPE_SCAN,
SUBPLAN_TYPE_MODIFY
} ESubplanType;
typedef struct SSubplan { typedef struct SSubplan {
ENodeType type; ENodeType type;
SSubplanId id; // unique id of the subplan SSubplanId id; // unique id of the subplan
......
...@@ -264,6 +264,7 @@ typedef struct SVgDataBlocks { ...@@ -264,6 +264,7 @@ typedef struct SVgDataBlocks {
typedef struct SVnodeModifOpStmt { typedef struct SVnodeModifOpStmt {
ENodeType nodeType; ENodeType nodeType;
ENodeType sqlNodeType;
SArray* pDataBlocks; // data block for each vgroup, SArray<SVgDataBlocks*>. SArray* pDataBlocks; // data block for each vgroup, SArray<SVgDataBlocks*>.
int8_t schemaAttache; // denote if submit block is built with table schema or not int8_t schemaAttache; // denote if submit block is built with table schema or not
uint8_t payloadType; // EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert uint8_t payloadType; // EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
......
...@@ -43,7 +43,9 @@ typedef struct SCmdMsgInfo { ...@@ -43,7 +43,9 @@ typedef struct SCmdMsgInfo {
} SCmdMsgInfo; } SCmdMsgInfo;
typedef struct SQuery { typedef struct SQuery {
bool isCmd; bool directRpc;
bool haveResultSet;
ENodeType sqlNodeType;
SNode* pRoot; SNode* pRoot;
int32_t numOfResCols; int32_t numOfResCols;
SSchema* pResSchema; SSchema* pResSchema;
......
...@@ -161,7 +161,7 @@ int32_t parseSql(SRequestObj* pRequest, SQuery** pQuery) { ...@@ -161,7 +161,7 @@ int32_t parseSql(SRequestObj* pRequest, SQuery** pQuery) {
} }
code = qParseQuerySql(&cxt, pQuery); code = qParseQuerySql(&cxt, pQuery);
if (TSDB_CODE_SUCCESS == code && !((*pQuery)->isCmd)) { if (TSDB_CODE_SUCCESS == code && ((*pQuery)->haveResultSet)) {
setResSchemaInfo(&pRequest->body.resInfo, (*pQuery)->pResSchema, (*pQuery)->numOfResCols); setResSchemaInfo(&pRequest->body.resInfo, (*pQuery)->pResSchema, (*pQuery)->numOfResCols);
} }
...@@ -184,19 +184,12 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { ...@@ -184,19 +184,12 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
} }
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pDag, SArray* pNodeList) { int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pDag, SArray* pNodeList) {
// pRequest->type = pQuery->type; pRequest->type = pQuery->sqlNodeType;
SPlanContext cxt = { .queryId = pRequest->requestId, .pAstRoot = pQuery->pRoot }; SPlanContext cxt = { .queryId = pRequest->requestId, .pAstRoot = pQuery->pRoot };
int32_t code = qCreateQueryPlan(&cxt, pDag); int32_t code = qCreateQueryPlan(&cxt, pDag);
if (code != 0) { if (code != 0) {
return code; return code;
} }
// if (pQuery->type == TSDB_SQL_SELECT) {
// setResSchemaInfo(&pRequest->body.resInfo, pSchema, numOfCols);
// pRequest->type = TDMT_VND_QUERY;
// }
return code; return code;
} }
...@@ -254,7 +247,7 @@ TAOS_RES* taos_query_l(TAOS* taos, const char* sql, int sqlLen) { ...@@ -254,7 +247,7 @@ TAOS_RES* taos_query_l(TAOS* taos, const char* sql, int sqlLen) {
CHECK_CODE_GOTO(buildRequest(pTscObj, sql, sqlLen, &pRequest), _return); CHECK_CODE_GOTO(buildRequest(pTscObj, sql, sqlLen, &pRequest), _return);
CHECK_CODE_GOTO(parseSql(pRequest, &pQuery), _return); CHECK_CODE_GOTO(parseSql(pRequest, &pQuery), _return);
if (pQuery->isCmd) { if (pQuery->directRpc) {
CHECK_CODE_GOTO(execDdlQuery(pRequest, pQuery), _return); CHECK_CODE_GOTO(execDdlQuery(pRequest, pQuery), _return);
} else { } else {
CHECK_CODE_GOTO(getPlan(pRequest, pQuery, &pRequest->body.pDag, pNodeList), _return); CHECK_CODE_GOTO(getPlan(pRequest, pQuery, &pRequest->body.pDag, pNodeList), _return);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "plannodes.h"
#include "querynodes.h" #include "querynodes.h"
#include "taos.h" #include "taos.h"
#include "taoserror.h" #include "taoserror.h"
...@@ -157,6 +158,13 @@ static SNode* groupingSetNodeCopy(const SGroupingSetNode* pSrc, SGroupingSetNode ...@@ -157,6 +158,13 @@ static SNode* groupingSetNodeCopy(const SGroupingSetNode* pSrc, SGroupingSetNode
return (SNode*)pDst; return (SNode*)pDst;
} }
static SNode* logicSubplanCopy(const SSubLogicPlan* pSrc, SSubLogicPlan* pDst) {
COPY_NODE_FIELD(pNode);
COPY_SCALAR_FIELD(execNode);
COPY_SCALAR_FIELD(subplanType);
return (SNode*)pDst;
}
SNodeptr nodesCloneNode(const SNodeptr pNode) { SNodeptr nodesCloneNode(const SNodeptr pNode) {
if (NULL == pNode) { if (NULL == pNode) {
return NULL; return NULL;
...@@ -187,9 +195,13 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) { ...@@ -187,9 +195,13 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) {
return groupingSetNodeCopy((const SGroupingSetNode*)pNode, (SGroupingSetNode*)pDst); return groupingSetNodeCopy((const SGroupingSetNode*)pNode, (SGroupingSetNode*)pDst);
case QUERY_NODE_ORDER_BY_EXPR: case QUERY_NODE_ORDER_BY_EXPR:
case QUERY_NODE_LIMIT: case QUERY_NODE_LIMIT:
break;
case QUERY_NODE_LOGIC_SUBPLAN:
return logicSubplanCopy((const SSubLogicPlan*)pNode, (SSubLogicPlan*)pDst);
default: default:
break; break;
} }
printf("nodesCloneNode unknown node = %s\n", nodesNodeName(nodeType(pNode)));
return pDst; return pDst;
} }
......
...@@ -24,7 +24,7 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj); ...@@ -24,7 +24,7 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj);
static int32_t jsonToNodeObject(const SJson* pJson, const char* pName, SNode** pNode); static int32_t jsonToNodeObject(const SJson* pJson, const char* pName, SNode** pNode);
static int32_t makeNodeByJson(const SJson* pJson, SNode** pNode); static int32_t makeNodeByJson(const SJson* pJson, SNode** pNode);
static char* nodeName(ENodeType type) { const char* nodesNodeName(ENodeType type) {
switch (type) { switch (type) {
case QUERY_NODE_COLUMN: case QUERY_NODE_COLUMN:
return "Column"; return "Column";
...@@ -58,20 +58,30 @@ static char* nodeName(ENodeType type) { ...@@ -58,20 +58,30 @@ static char* nodeName(ENodeType type) {
return "NodeList"; return "NodeList";
case QUERY_NODE_FILL: case QUERY_NODE_FILL:
return "Fill"; return "Fill";
case QUERY_NODE_TARGET:
return "Target";
case QUERY_NODE_RAW_EXPR: case QUERY_NODE_RAW_EXPR:
return "RawExpr"; return "RawExpr";
case QUERY_NODE_TARGET:
return "Target";
case QUERY_NODE_DATABLOCK_DESC: case QUERY_NODE_DATABLOCK_DESC:
return "TupleDesc"; return "TupleDesc";
case QUERY_NODE_SLOT_DESC: case QUERY_NODE_SLOT_DESC:
return "SlotDesc"; return "SlotDesc";
case QUERY_NODE_COLUMN_DEF:
return "ColumnDef";
case QUERY_NODE_SET_OPERATOR: case QUERY_NODE_SET_OPERATOR:
return "SetOperator"; return "SetOperator";
case QUERY_NODE_SELECT_STMT: case QUERY_NODE_SELECT_STMT:
return "SelectStmt"; return "SelectStmt";
case QUERY_NODE_SHOW_STMT: case QUERY_NODE_VNODE_MODIF_STMT:
return "ShowStmt"; return "VnodeModifStmt";
case QUERY_NODE_CREATE_DATABASE_STMT:
return "CreateDatabaseStmt";
case QUERY_NODE_CREATE_TABLE_STMT:
return "CreateTableStmt";
case QUERY_NODE_USE_DATABASE_STMT:
return "UseDatabaseStmt";
case QUERY_NODE_SHOW_DATABASE_STMT:
return "ShowDatabaseStmt";
case QUERY_NODE_LOGIC_PLAN_SCAN: case QUERY_NODE_LOGIC_PLAN_SCAN:
return "LogicScan"; return "LogicScan";
case QUERY_NODE_LOGIC_PLAN_JOIN: case QUERY_NODE_LOGIC_PLAN_JOIN:
...@@ -80,16 +90,34 @@ static char* nodeName(ENodeType type) { ...@@ -80,16 +90,34 @@ static char* nodeName(ENodeType type) {
return "LogicAgg"; return "LogicAgg";
case QUERY_NODE_LOGIC_PLAN_PROJECT: case QUERY_NODE_LOGIC_PLAN_PROJECT:
return "LogicProject"; return "LogicProject";
case QUERY_NODE_LOGIC_PLAN_VNODE_MODIF:
return "LogicVnodeModif";
case QUERY_NODE_LOGIC_SUBPLAN:
return "LogicSubplan";
case QUERY_NODE_LOGIC_PLAN:
return "LogicPlan";
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
return "PhysiTagScan"; return "PhysiTagScan";
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
return "PhysiTableScan"; return "PhysiTableScan";
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN:
return "PhysiTableSeqScan";
case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN:
return "PhysiSreamScan";
case QUERY_NODE_PHYSICAL_PLAN_PROJECT: case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
return "PhysiProject"; return "PhysiProject";
case QUERY_NODE_PHYSICAL_PLAN_JOIN: case QUERY_NODE_PHYSICAL_PLAN_JOIN:
return "PhysiJoin"; return "PhysiJoin";
case QUERY_NODE_PHYSICAL_PLAN_AGG: case QUERY_NODE_PHYSICAL_PLAN_AGG:
return "PhysiAgg"; return "PhysiAgg";
case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:
return "PhysiExchange";
case QUERY_NODE_PHYSICAL_PLAN_SORT:
return "PhysiSort";
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
return "PhysiDispatch";
case QUERY_NODE_PHYSICAL_PLAN_INSERT:
return "PhysiInsert";
case QUERY_NODE_PHYSICAL_SUBPLAN: case QUERY_NODE_PHYSICAL_SUBPLAN:
return "PhysiSubplan"; return "PhysiSubplan";
case QUERY_NODE_PHYSICAL_PLAN: case QUERY_NODE_PHYSICAL_PLAN:
...@@ -1249,23 +1277,28 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { ...@@ -1249,23 +1277,28 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case QUERY_NODE_STATE_WINDOW: case QUERY_NODE_STATE_WINDOW:
case QUERY_NODE_SESSION_WINDOW: case QUERY_NODE_SESSION_WINDOW:
case QUERY_NODE_INTERVAL_WINDOW: case QUERY_NODE_INTERVAL_WINDOW:
break;
case QUERY_NODE_NODE_LIST: case QUERY_NODE_NODE_LIST:
return nodeListNodeToJson(pObj, pJson); return nodeListNodeToJson(pObj, pJson);
case QUERY_NODE_FILL: case QUERY_NODE_FILL:
case QUERY_NODE_RAW_EXPR:
break; break;
case QUERY_NODE_TARGET: case QUERY_NODE_TARGET:
return targetNodeToJson(pObj, pJson); return targetNodeToJson(pObj, pJson);
case QUERY_NODE_RAW_EXPR:
break;
case QUERY_NODE_DATABLOCK_DESC: case QUERY_NODE_DATABLOCK_DESC:
return dataBlockDescNodeToJson(pObj, pJson); return dataBlockDescNodeToJson(pObj, pJson);
case QUERY_NODE_SLOT_DESC: case QUERY_NODE_SLOT_DESC:
return slotDescNodeToJson(pObj, pJson); return slotDescNodeToJson(pObj, pJson);
case QUERY_NODE_COLUMN_DEF:
case QUERY_NODE_SET_OPERATOR: case QUERY_NODE_SET_OPERATOR:
break; break;
case QUERY_NODE_SELECT_STMT: case QUERY_NODE_SELECT_STMT:
return selectStmtTojson(pObj, pJson); return selectStmtTojson(pObj, pJson);
case QUERY_NODE_SHOW_STMT: case QUERY_NODE_VNODE_MODIF_STMT:
case QUERY_NODE_CREATE_DATABASE_STMT:
case QUERY_NODE_CREATE_TABLE_STMT:
case QUERY_NODE_USE_DATABASE_STMT:
case QUERY_NODE_SHOW_DATABASE_STMT:
break; break;
case QUERY_NODE_LOGIC_PLAN_SCAN: case QUERY_NODE_LOGIC_PLAN_SCAN:
return logicScanNodeToJson(pObj, pJson); return logicScanNodeToJson(pObj, pJson);
...@@ -1275,16 +1308,28 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { ...@@ -1275,16 +1308,28 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return logicAggNodeToJson(pObj, pJson); return logicAggNodeToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_PROJECT: case QUERY_NODE_LOGIC_PLAN_PROJECT:
return logicProjectNodeToJson(pObj, pJson); return logicProjectNodeToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_VNODE_MODIF:
case QUERY_NODE_LOGIC_SUBPLAN:
case QUERY_NODE_LOGIC_PLAN:
break;
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
return physiTagScanNodeToJson(pObj, pJson); return physiTagScanNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
return physiTableScanNodeToJson(pObj, pJson); return physiTableScanNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN:
case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN:
break;
case QUERY_NODE_PHYSICAL_PLAN_PROJECT: case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
return physiProjectNodeToJson(pObj, pJson); return physiProjectNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_JOIN: case QUERY_NODE_PHYSICAL_PLAN_JOIN:
return physiJoinNodeToJson(pObj, pJson); return physiJoinNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_AGG: case QUERY_NODE_PHYSICAL_PLAN_AGG:
return physiAggNodeToJson(pObj, pJson); return physiAggNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:
case QUERY_NODE_PHYSICAL_PLAN_SORT:
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
case QUERY_NODE_PHYSICAL_PLAN_INSERT:
break;
case QUERY_NODE_PHYSICAL_SUBPLAN: case QUERY_NODE_PHYSICAL_SUBPLAN:
return subplanToJson(pObj, pJson); return subplanToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN: case QUERY_NODE_PHYSICAL_PLAN:
...@@ -1292,7 +1337,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { ...@@ -1292,7 +1337,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
default: default:
break; break;
} }
printf("================================ specificNodeToJson unknown node = %s\n", nodeName(nodeType(pObj))); printf("================================ specificNodeToJson unknown node = %s\n", nodesNodeName(nodeType(pObj)));
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1334,8 +1379,6 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { ...@@ -1334,8 +1379,6 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
// break; // break;
// case QUERY_NODE_SELECT_STMT: // case QUERY_NODE_SELECT_STMT:
// return jsonToSelectStmt(pJson, pObj); // return jsonToSelectStmt(pJson, pObj);
// case QUERY_NODE_SHOW_STMT:
// break;
// case QUERY_NODE_LOGIC_PLAN_SCAN: // case QUERY_NODE_LOGIC_PLAN_SCAN:
// return jsonToLogicScanNode(pJson, pObj); // return jsonToLogicScanNode(pJson, pObj);
// case QUERY_NODE_LOGIC_PLAN_JOIN: // case QUERY_NODE_LOGIC_PLAN_JOIN:
...@@ -1372,10 +1415,10 @@ static int32_t nodeToJson(const void* pObj, SJson* pJson) { ...@@ -1372,10 +1415,10 @@ static int32_t nodeToJson(const void* pObj, SJson* pJson) {
int32_t code = tjsonAddIntegerToObject(pJson, jkNodeType, pNode->type); int32_t code = tjsonAddIntegerToObject(pJson, jkNodeType, pNode->type);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddStringToObject(pJson, jkNodeName, nodeName(pNode->type)); code = tjsonAddStringToObject(pJson, jkNodeName, nodesNodeName(pNode->type));
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, nodeName(pNode->type), specificNodeToJson, pNode); code = tjsonAddObject(pJson, nodesNodeName(pNode->type), specificNodeToJson, pNode);
} }
return code; return code;
...@@ -1388,7 +1431,7 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj) { ...@@ -1388,7 +1431,7 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj) {
int32_t code = tjsonGetIntValue(pJson, jkNodeType, &val); int32_t code = tjsonGetIntValue(pJson, jkNodeType, &val);
pNode->type = val; pNode->type = val;
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonToObject(pJson, nodeName(pNode->type), jsonToSpecificNode, pNode); code = tjsonToObject(pJson, nodesNodeName(pNode->type), jsonToSpecificNode, pNode);
} }
return code; return code;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "cmdnodes.h"
#include "querynodes.h" #include "querynodes.h"
#include "plannodes.h" #include "plannodes.h"
#include "taos.h" #include "taos.h"
...@@ -65,12 +66,28 @@ SNodeptr nodesMakeNode(ENodeType type) { ...@@ -65,12 +66,28 @@ SNodeptr nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SFillNode)); return makeNode(type, sizeof(SFillNode));
case QUERY_NODE_RAW_EXPR: case QUERY_NODE_RAW_EXPR:
return makeNode(type, sizeof(SRawExprNode)); return makeNode(type, sizeof(SRawExprNode));
case QUERY_NODE_TARGET:
return makeNode(type, sizeof(STargetNode));
case QUERY_NODE_DATABLOCK_DESC:
return makeNode(type, sizeof(SDataBlockDescNode));
case QUERY_NODE_SLOT_DESC:
return makeNode(type, sizeof(SSlotDescNode));
case QUERY_NODE_COLUMN_DEF:
return makeNode(type, sizeof(SColumnDefNode));
case QUERY_NODE_SET_OPERATOR: case QUERY_NODE_SET_OPERATOR:
return makeNode(type, sizeof(SSetOperator)); return makeNode(type, sizeof(SSetOperator));
case QUERY_NODE_SELECT_STMT: case QUERY_NODE_SELECT_STMT:
return makeNode(type, sizeof(SSelectStmt)); return makeNode(type, sizeof(SSelectStmt));
// case QUERY_NODE_SHOW_STMT: case QUERY_NODE_VNODE_MODIF_STMT:
// return makeNode(type, sizeof(SShowStmt)); return makeNode(type, sizeof(SVnodeModifOpStmt));
case QUERY_NODE_CREATE_DATABASE_STMT:
return makeNode(type, sizeof(SCreateDatabaseStmt));
case QUERY_NODE_CREATE_TABLE_STMT:
return makeNode(type, sizeof(SCreateTableStmt));
case QUERY_NODE_USE_DATABASE_STMT:
return makeNode(type, sizeof(SUseDatabaseStmt));
case QUERY_NODE_SHOW_DATABASE_STMT:
return makeNode(type, sizeof(SNode));;
case QUERY_NODE_LOGIC_PLAN_SCAN: case QUERY_NODE_LOGIC_PLAN_SCAN:
return makeNode(type, sizeof(SScanLogicNode)); return makeNode(type, sizeof(SScanLogicNode));
case QUERY_NODE_LOGIC_PLAN_JOIN: case QUERY_NODE_LOGIC_PLAN_JOIN:
...@@ -79,26 +96,34 @@ SNodeptr nodesMakeNode(ENodeType type) { ...@@ -79,26 +96,34 @@ SNodeptr nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SAggLogicNode)); return makeNode(type, sizeof(SAggLogicNode));
case QUERY_NODE_LOGIC_PLAN_PROJECT: case QUERY_NODE_LOGIC_PLAN_PROJECT:
return makeNode(type, sizeof(SProjectLogicNode)); return makeNode(type, sizeof(SProjectLogicNode));
case QUERY_NODE_LOGIC_PLAN_VNODE_MODIF:
return makeNode(type, sizeof(SVnodeModifLogicNode));
case QUERY_NODE_LOGIC_SUBPLAN: case QUERY_NODE_LOGIC_SUBPLAN:
return makeNode(type, sizeof(SSubLogicPlan)); return makeNode(type, sizeof(SSubLogicPlan));
case QUERY_NODE_LOGIC_PLAN: case QUERY_NODE_LOGIC_PLAN:
return makeNode(type, sizeof(SQueryLogicPlan)); return makeNode(type, sizeof(SQueryLogicPlan));
case QUERY_NODE_TARGET:
return makeNode(type, sizeof(STargetNode));
case QUERY_NODE_DATABLOCK_DESC:
return makeNode(type, sizeof(SDataBlockDescNode));
case QUERY_NODE_SLOT_DESC:
return makeNode(type, sizeof(SSlotDescNode));
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
return makeNode(type, sizeof(STagScanPhysiNode)); return makeNode(type, sizeof(STagScanPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
return makeNode(type, sizeof(STableScanPhysiNode)); return makeNode(type, sizeof(STableScanPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN:
return makeNode(type, sizeof(STableSeqScanPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN:
return makeNode(type, sizeof(SNode));
case QUERY_NODE_PHYSICAL_PLAN_PROJECT: case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
return makeNode(type, sizeof(SProjectPhysiNode)); return makeNode(type, sizeof(SProjectPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_JOIN: case QUERY_NODE_PHYSICAL_PLAN_JOIN:
return makeNode(type, sizeof(SJoinPhysiNode)); return makeNode(type, sizeof(SJoinPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_AGG: case QUERY_NODE_PHYSICAL_PLAN_AGG:
return makeNode(type, sizeof(SAggPhysiNode)); return makeNode(type, sizeof(SAggPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:
return makeNode(type, sizeof(SExchangePhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_SORT:
return makeNode(type, sizeof(SNode));
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
return makeNode(type, sizeof(SDataDispatcherNode));
case QUERY_NODE_PHYSICAL_PLAN_INSERT:
return makeNode(type, sizeof(SDataInserterNode));
case QUERY_NODE_PHYSICAL_SUBPLAN: case QUERY_NODE_PHYSICAL_SUBPLAN:
return makeNode(type, sizeof(SSubplan)); return makeNode(type, sizeof(SSubplan));
case QUERY_NODE_PHYSICAL_PLAN: case QUERY_NODE_PHYSICAL_PLAN:
......
...@@ -116,8 +116,14 @@ typedef enum ETableOptionType { ...@@ -116,8 +116,14 @@ typedef enum ETableOptionType {
STableOptions* createDefaultTableOptions(SAstCreateContext* pCxt); STableOptions* createDefaultTableOptions(SAstCreateContext* pCxt);
STableOptions* setTableOption(SAstCreateContext* pCxt, STableOptions* pOptions, ETableOptionType type, const SToken* pVal); STableOptions* setTableOption(SAstCreateContext* pCxt, STableOptions* pOptions, ETableOptionType type, const SToken* pVal);
SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment); SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment);
SDataType createDataType(uint8_t type);
SDataType createVarLenDataType(uint8_t type, const SToken* pLen);
SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, const STokenPair* pFullTableName, SNodeList* pCols, STableOptions* pOptions); SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, const STokenPair* pFullTableName, SNodeList* pCols, STableOptions* pOptions);
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName);
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -92,22 +92,25 @@ db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). ...@@ -92,22 +92,25 @@ db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(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) 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); } db_options(A) ::= db_options(B) STREAMMODE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STREAMMODE, &C); }
/************************************************ create database *****************************************************/
cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A);}
/************************************************ create table *******************************************************/ /************************************************ create table *******************************************************/
cmd ::= CREATE TABLE exists_opt(A) full_table_name(B) cmd ::= CREATE TABLE exists_opt(A) full_table_name(B)
NK_LP column_def_list(C) NK_RP table_options(D). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D);} NK_LP column_def_list(C) NK_RP table_options(D). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D);}
%type full_table_name { STokenPair } %type full_table_name { STokenPair }
%destructor full_table_name { } %destructor full_table_name { }
full_table_name(A) ::= NK_ID(B). { A = { .first = B, .second = nil_token}; } full_table_name(A) ::= NK_ID(B). { STokenPair t = { .first = B, .second = nil_token}; A = t; }
full_table_name(A) ::= NK_ID(B) NK_DOT NK_ID(C). { A = { .first = B, .second = C}; } full_table_name(A) ::= NK_ID(B) NK_DOT NK_ID(C). { STokenPair t = { .first = B, .second = C}; A = t; }
%type column_def_list { SNodeList* } %type column_def_list { SNodeList* }
%destructor column_def_list { nodesDestroyList($$); } %destructor column_def_list { nodesDestroyList($$); }
column_def_list(A) ::= column_def(B). { A = createNodeList(pCxt, B); } column_def_list(A) ::= column_def(B). { A = createNodeList(pCxt, B); }
column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); } column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); }
column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, B, C, NULL); } column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); }
column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, B, C, &D); } column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); }
%type type_name { SDataType } %type type_name { SDataType }
%destructor type_name { } %destructor type_name { }
...@@ -115,6 +118,7 @@ type_name(A) ::= BOOL. ...@@ -115,6 +118,7 @@ type_name(A) ::= BOOL.
type_name(A) ::= TINYINT. { A = createDataType(TSDB_DATA_TYPE_TINYINT); } type_name(A) ::= TINYINT. { A = createDataType(TSDB_DATA_TYPE_TINYINT); }
type_name(A) ::= SMALLINT. { A = createDataType(TSDB_DATA_TYPE_SMALLINT); } type_name(A) ::= SMALLINT. { A = createDataType(TSDB_DATA_TYPE_SMALLINT); }
type_name(A) ::= INT. { A = createDataType(TSDB_DATA_TYPE_INT); } type_name(A) ::= INT. { A = createDataType(TSDB_DATA_TYPE_INT); }
type_name(A) ::= INTEGER. { A = createDataType(TSDB_DATA_TYPE_INT); }
type_name(A) ::= BIGINT. { A = createDataType(TSDB_DATA_TYPE_BIGINT); } type_name(A) ::= BIGINT. { A = createDataType(TSDB_DATA_TYPE_BIGINT); }
type_name(A) ::= FLOAT. { A = createDataType(TSDB_DATA_TYPE_FLOAT); } type_name(A) ::= FLOAT. { A = createDataType(TSDB_DATA_TYPE_FLOAT); }
type_name(A) ::= DOUBLE. { A = createDataType(TSDB_DATA_TYPE_DOUBLE); } type_name(A) ::= DOUBLE. { A = createDataType(TSDB_DATA_TYPE_DOUBLE); }
...@@ -134,14 +138,15 @@ type_name(A) ::= DECIMAL. ...@@ -134,14 +138,15 @@ type_name(A) ::= DECIMAL.
type_name(A) ::= DECIMAL NK_LP NK_INTEGER NK_RP. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); } type_name(A) ::= DECIMAL NK_LP NK_INTEGER NK_RP. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); }
type_name(A) ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); } type_name(A) ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); }
%type table_options { SDatabaseOptions* } %type table_options { STableOptions* }
%destructor table_options { tfree($$); } %destructor table_options { tfree($$); }
table_options(A) ::= . { A = createDefaultTableOptions(pCxt);} table_options(A) ::= . { A = createDefaultTableOptions(pCxt);}
table_options(A) ::= table_options(B) COMMENT NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); } table_options(A) ::= table_options(B) COMMENT NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
table_options(A) ::= table_options(B) KEEP NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_KEEP, &C); } table_options(A) ::= table_options(B) KEEP NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_KEEP, &C); }
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); } table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
//cmd ::= SHOW DATABASES. { PARSER_TRACE; createShowStmt(pCxt, SHOW_TYPE_DATABASE); } /************************************************ show ***************************************************************/
cmd ::= SHOW DATABASES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASE_STMT); }
/************************************************ select *************************************************************/ /************************************************ select *************************************************************/
cmd ::= query_expression(A). { PARSER_TRACE; pCxt->pRootNode = A; } cmd ::= query_expression(A). { PARSER_TRACE; pCxt->pRootNode = A; }
......
...@@ -719,6 +719,16 @@ SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDat ...@@ -719,6 +719,16 @@ SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDat
return (SNode*)pCol; return (SNode*)pCol;
} }
SDataType createDataType(uint8_t type) {
SDataType dt = { .type = type, .precision = 0, .scale = 0, .bytes = 0 };
return dt;
}
SDataType createVarLenDataType(uint8_t type, const SToken* pLen) {
SDataType dt = { .type = type, .precision = 0, .scale = 0, .bytes = 0 };
return dt;
}
SNode* createCreateTableStmt(SAstCreateContext* pCxt, SNode* createCreateTableStmt(SAstCreateContext* pCxt,
bool ignoreExists, const STokenPair* pFullTableName, SNodeList* pCols, STableOptions* pOptions) { bool ignoreExists, const STokenPair* pFullTableName, SNodeList* pCols, STableOptions* pOptions) {
SCreateTableStmt* pStmt = (SCreateTableStmt*)nodesMakeNode(QUERY_NODE_CREATE_TABLE_STMT); SCreateTableStmt* pStmt = (SCreateTableStmt*)nodesMakeNode(QUERY_NODE_CREATE_TABLE_STMT);
...@@ -732,3 +742,16 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt, ...@@ -732,3 +742,16 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt,
pStmt->options = *pOptions; pStmt->options = *pOptions;
return (SNode*)pStmt; return (SNode*)pStmt;
} }
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName) {
SUseDatabaseStmt* pStmt = (SUseDatabaseStmt*)nodesMakeNode(QUERY_NODE_USE_DATABASE_STMT);
CHECK_OUT_OF_MEM(pStmt);
strncpy(pStmt->dbName, pDbName->z, pDbName->n);
return (SNode*)pStmt;
}
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) {
SNode* pStmt = nodesMakeNode(QUERY_NODE_SHOW_DATABASE_STMT);;
CHECK_OUT_OF_MEM(pStmt);
return pStmt;
}
...@@ -26,18 +26,19 @@ extern void NewParse(void*, int, SToken, void*); ...@@ -26,18 +26,19 @@ extern void NewParse(void*, int, SToken, void*);
extern void NewParseFree(void*, FFree); extern void NewParseFree(void*, FFree);
extern void NewParseTrace(FILE*, char*); extern void NewParseTrace(FILE*, char*);
static bool isCmd(const SNode* pRootNode) { static void setQuery(SAstCreateContext* pCxt, SQuery* pQuery) {
if (NULL == pRootNode) { pQuery->pRoot = pCxt->pRootNode;
return true; ENodeType type = nodeType(pCxt->pRootNode);
if (QUERY_NODE_SELECT_STMT == type) {
pQuery->haveResultSet = true;
pQuery->directRpc = false;
} else if (QUERY_NODE_CREATE_TABLE_STMT == type) {
pQuery->haveResultSet = false;
pQuery->directRpc = false;
} else {
pQuery->haveResultSet = false;
pQuery->directRpc = true;
} }
switch (nodeType(pRootNode)) {
case QUERY_NODE_SELECT_STMT:
case QUERY_NODE_CREATE_TABLE_STMT:
return false;
default:
break;
}
return true;
} }
int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
...@@ -60,6 +61,10 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { ...@@ -60,6 +61,10 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
case TK_COMMENT: { case TK_COMMENT: {
break; break;
} }
case TK_SEMI: {
NewParse(pParser, 0, t0, &cxt);
goto abort_parse;
}
case TK_QUESTION: case TK_QUESTION:
case TK_ILLEGAL: { case TK_ILLEGAL: {
snprintf(cxt.pQueryCxt->pMsg, cxt.pQueryCxt->msgLen, "unrecognized token: \"%s\"", t0.z); snprintf(cxt.pQueryCxt->pMsg, cxt.pQueryCxt->msgLen, "unrecognized token: \"%s\"", t0.z);
...@@ -89,8 +94,7 @@ abort_parse: ...@@ -89,8 +94,7 @@ abort_parse:
if (NULL == *pQuery) { if (NULL == *pQuery) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
(*pQuery)->isCmd = isCmd(cxt.pRootNode); setQuery(&cxt, *pQuery);
(*pQuery)->pRoot = cxt.pRootNode;
} }
return cxt.valid ? TSDB_CODE_SUCCESS : TSDB_CODE_FAILED; return cxt.valid ? TSDB_CODE_SUCCESS : TSDB_CODE_FAILED;
} }
...@@ -829,10 +829,52 @@ static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseS ...@@ -829,10 +829,52 @@ static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseS
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* pStmt) {
SName name = {0};
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
SUseDbReq usedbReq = {0};
tNameExtractFullName(&name, usedbReq.db);
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_USE_DB;
pCxt->pCmdMsg->msgLen = tSerializeSUseDbReq(NULL, 0, &usedbReq);
pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen);
if (NULL== pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSUseDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &usedbReq);
return TSDB_CODE_SUCCESS;
}
static int32_t translateCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { static int32_t translateCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t translateShow(STranslateContext* pCxt) {
SShowReq showReq = { .type = TSDB_MGMT_TABLE_DB };
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_SHOW;
pCxt->pCmdMsg->msgLen = tSerializeSShowReq(NULL, 0, &showReq);
pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen);
if (NULL== pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSShowReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &showReq);
return TSDB_CODE_SUCCESS;
}
static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pNode)) { switch (nodeType(pNode)) {
...@@ -842,6 +884,11 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { ...@@ -842,6 +884,11 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case QUERY_NODE_CREATE_DATABASE_STMT: case QUERY_NODE_CREATE_DATABASE_STMT:
code = translateCreateDatabase(pCxt, (SCreateDatabaseStmt*)pNode); code = translateCreateDatabase(pCxt, (SCreateDatabaseStmt*)pNode);
break; break;
case QUERY_NODE_USE_DATABASE_STMT:
code = translateUseDatabase(pCxt, (SUseDatabaseStmt*)pNode);
break;
case QUERY_NODE_SHOW_DATABASE_STMT:
code = translateShow(pCxt);
case QUERY_NODE_CREATE_TABLE_STMT: case QUERY_NODE_CREATE_TABLE_STMT:
code = translateCreateTable(pCxt, (SCreateTableStmt*)pNode); code = translateCreateTable(pCxt, (SCreateTableStmt*)pNode);
break; break;
...@@ -862,7 +909,7 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) { ...@@ -862,7 +909,7 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) {
return code; return code;
} }
int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) { static int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) {
if (QUERY_NODE_SELECT_STMT == nodeType(pQuery->pRoot)) { if (QUERY_NODE_SELECT_STMT == nodeType(pQuery->pRoot)) {
SSelectStmt* pSelect = (SSelectStmt*)pQuery->pRoot; SSelectStmt* pSelect = (SSelectStmt*)pQuery->pRoot;
pQuery->numOfResCols = LIST_LENGTH(pSelect->pProjectionList); pQuery->numOfResCols = LIST_LENGTH(pSelect->pProjectionList);
...@@ -882,7 +929,7 @@ int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) { ...@@ -882,7 +929,7 @@ int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void destroyTranslateContext(STranslateContext* pCxt) { static void destroyTranslateContext(STranslateContext* pCxt) {
taosArrayDestroy(pCxt->pNsLevel); taosArrayDestroy(pCxt->pNsLevel);
if (NULL != pCxt->pCmdMsg) { if (NULL != pCxt->pCmdMsg) {
tfree(pCxt->pCmdMsg->pMsg); tfree(pCxt->pCmdMsg->pMsg);
...@@ -890,6 +937,116 @@ void destroyTranslateContext(STranslateContext* pCxt) { ...@@ -890,6 +937,116 @@ void destroyTranslateContext(STranslateContext* pCxt) {
} }
} }
typedef struct SVgroupTablesBatch {
SVCreateTbBatchReq req;
SVgroupInfo info;
} SVgroupTablesBatch;
static void toSchema(const SColumnNode* pCol, SSchema* pSchema) {
pSchema->type = pCol->node.resType.type;
pSchema->bytes = pCol->node.resType.bytes;
strcpy(pSchema->name, pCol->colName);
}
static int32_t doBuildSingleTableBatchReq(SName* pTableName, SNodeList* pColumns, SVgroupInfo* pVgroupInfo, SVgroupTablesBatch* pBatch) {
SVCreateTbReq req = {0};
req.type = TD_NORMAL_TABLE;
req.name = strdup(tNameGetTableName(pTableName));
req.ntbCfg.nCols = LIST_LENGTH(pColumns);
int32_t num = req.ntbCfg.nCols;
req.ntbCfg.pSchema = calloc(num, sizeof(SSchema));
SNode* pCol;
int32_t index = 0;
FOREACH(pCol, pColumns) {
toSchema((SColumnNode*)pCol, req.ntbCfg.pSchema + index++);
}
pBatch->info = *pVgroupInfo;
pBatch->req.pArray = taosArrayInit(1, sizeof(struct SVCreateTbReq));
if (pBatch->req.pArray == NULL) {
return TSDB_CODE_QRY_OUT_OF_MEMORY;
}
taosArrayPush(pBatch->req.pArray, &req);
return TSDB_CODE_SUCCESS;
}
static int32_t serializeVgroupTablesBatchImpl(SVgroupTablesBatch* pTbBatch, SArray* pBufArray) {
int tlen = sizeof(SMsgHead) + tSerializeSVCreateTbBatchReq(NULL, &(pTbBatch->req));
void* buf = malloc(tlen);
if (buf == NULL) {
// TODO: handle error
}
((SMsgHead*)buf)->vgId = htonl(pTbBatch->info.vgId);
((SMsgHead*)buf)->contLen = htonl(tlen);
void* pBuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
tSerializeSVCreateTbBatchReq(&pBuf, &(pTbBatch->req));
SVgDataBlocks* pVgData = calloc(1, sizeof(SVgDataBlocks));
pVgData->vg = pTbBatch->info;
pVgData->pData = buf;
pVgData->size = tlen;
pVgData->numOfTables = (int32_t) taosArrayGetSize(pTbBatch->req.pArray);
taosArrayPush(pBufArray, &pVgData);
}
static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
size_t size = taosArrayGetSize(pTbBatch->req.pArray);
for(int32_t i = 0; i < size; ++i) {
SVCreateTbReq* pTableReq = taosArrayGet(pTbBatch->req.pArray, i);
tfree(pTableReq->name);
if (pTableReq->type == TSDB_NORMAL_TABLE) {
tfree(pTableReq->ntbCfg.pSchema);
} else if (pTableReq->type == TSDB_CHILD_TABLE) {
tfree(pTableReq->ctbCfg.pTag);
} else {
assert(0);
}
}
taosArrayDestroy(pTbBatch->req.pArray);
}
static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
if (QUERY_NODE_CREATE_TABLE_STMT == nodeType(pQuery->pRoot)) {
SCreateTableStmt* pStmt = (SCreateTableStmt*)pQuery->pRoot;
SName tableName = { .type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId };
strcpy(tableName.dbname, pStmt->dbName);
strcpy(tableName.tname, pStmt->tableName);
SVgroupInfo info = {0};
catalogGetTableHashVgroup(pCxt->pParseCxt->pCatalog, pCxt->pParseCxt->pTransporter, &pCxt->pParseCxt->mgmtEpSet, &tableName, &info);
SVgroupTablesBatch tbatch = {0};
int32_t code = doBuildSingleTableBatchReq(&tableName, pStmt->pCols, &info, &tbatch);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
SArray* pBufArray = taosArrayInit(1, POINTER_BYTES);
if (pBufArray == NULL) {
return TSDB_CODE_QRY_OUT_OF_MEMORY;
}
serializeVgroupTablesBatchImpl(&tbatch, pBufArray);
destroyCreateTbReqBatch(&tbatch);
SVnodeModifOpStmt* pNewStmt = nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT);
pNewStmt->sqlNodeType = nodeType(pQuery->pRoot);
pNewStmt->pDataBlocks = pBufArray;
pQuery->sqlNodeType = nodeType(pQuery->pRoot);
nodesDestroyNode(pQuery->pRoot);
pQuery->pRoot = (SNode*)pNewStmt;
}
return TSDB_CODE_SUCCESS;
}
int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) { int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) {
STranslateContext cxt = { STranslateContext cxt = {
.pParseCxt = pParseCxt, .pParseCxt = pParseCxt,
...@@ -900,14 +1057,18 @@ int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) { ...@@ -900,14 +1057,18 @@ int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) {
.currClause = 0 .currClause = 0
}; };
int32_t code = fmFuncMgtInit(); int32_t code = fmFuncMgtInit();
if (TSDB_CODE_SUCCESS == code) {
code = rewriteQuery(&cxt, pQuery);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = translateQuery(&cxt, pQuery->pRoot); code = translateQuery(&cxt, pQuery->pRoot);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
if (pQuery->isCmd) { if (pQuery->directRpc) {
pQuery->pCmdMsg = cxt.pCmdMsg; pQuery->pCmdMsg = cxt.pCmdMsg;
cxt.pCmdMsg = NULL; cxt.pCmdMsg = NULL;
} else { }
if (pQuery->haveResultSet) {
code = setReslutSchema(&cxt, pQuery); code = setReslutSchema(&cxt, pQuery);
} }
} }
......
...@@ -109,22 +109,25 @@ ...@@ -109,22 +109,25 @@
#endif #endif
/************* Begin control #defines *****************************************/ /************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned char #define YYCODETYPE unsigned char
#define YYNOCODE 152 #define YYNOCODE 179
#define YYACTIONTYPE unsigned short int #define YYACTIONTYPE unsigned short int
#define NewParseTOKENTYPE SToken #define NewParseTOKENTYPE SToken
typedef union { typedef union {
int yyinit; int yyinit;
NewParseTOKENTYPE yy0; NewParseTOKENTYPE yy0;
SNodeList* yy8; EOrder yy14;
EOrder yy50; ENullOrder yy17;
EOperatorType yy60; SDatabaseOptions* yy27;
SDatabaseOptions* yy87; STableOptions* yy40;
SNode* yy104; SNodeList* yy60;
SToken yy129; SToken yy105;
bool yy185; STokenPair yy111;
ENullOrder yy186; SNode* yy172;
EJoinType yy228; EFillMode yy202;
EFillMode yy246; EOperatorType yy214;
SDataType yy248;
bool yy259;
EJoinType yy278;
} YYMINORTYPE; } YYMINORTYPE;
#ifndef YYSTACKDEPTH #ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100 #define YYSTACKDEPTH 100
...@@ -139,17 +142,17 @@ typedef union { ...@@ -139,17 +142,17 @@ typedef union {
#define NewParseCTX_PARAM #define NewParseCTX_PARAM
#define NewParseCTX_FETCH #define NewParseCTX_FETCH
#define NewParseCTX_STORE #define NewParseCTX_STORE
#define YYNSTATE 170 #define YYNSTATE 211
#define YYNRULE 160 #define YYNRULE 196
#define YYNTOKEN 96 #define YYNTOKEN 118
#define YY_MAX_SHIFT 169 #define YY_MAX_SHIFT 210
#define YY_MIN_SHIFTREDUCE 286 #define YY_MIN_SHIFTREDUCE 352
#define YY_MAX_SHIFTREDUCE 445 #define YY_MAX_SHIFTREDUCE 547
#define YY_ERROR_ACTION 446 #define YY_ERROR_ACTION 548
#define YY_ACCEPT_ACTION 447 #define YY_ACCEPT_ACTION 549
#define YY_NO_ACTION 448 #define YY_NO_ACTION 550
#define YY_MIN_REDUCE 449 #define YY_MIN_REDUCE 551
#define YY_MAX_REDUCE 608 #define YY_MAX_REDUCE 746
/************* End control #defines *******************************************/ /************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
...@@ -216,216 +219,256 @@ typedef union { ...@@ -216,216 +219,256 @@ typedef union {
** yy_default[] Default action for each state. ** yy_default[] Default action for each state.
** **
*********** Begin parsing tables **********************************************/ *********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (757) #define YY_ACTTAB_COUNT (890)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 486, 476, 73, 146, 501, 147, 587, 114, 89, 487, /* 0 */ 616, 614, 105, 187, 116, 725, 576, 48, 23, 75,
/* 10 */ 105, 490, 30, 28, 26, 25, 24, 478, 476, 97, /* 10 */ 76, 639, 30, 28, 26, 25, 24, 157, 125, 724,
/* 20 */ 586, 92, 23, 72, 585, 30, 28, 26, 25, 24, /* 20 */ 678, 100, 128, 723, 678, 30, 28, 26, 25, 24,
/* 30 */ 479, 476, 146, 501, 92, 65, 486, 476, 117, 146, /* 30 */ 551, 617, 614, 639, 100, 68, 624, 614, 675, 157,
/* 40 */ 501, 147, 9, 8, 41, 487, 556, 490, 526, 328, /* 40 */ 158, 694, 674, 42, 625, 430, 628, 664, 26, 25,
/* 50 */ 129, 22, 101, 523, 346, 347, 348, 349, 350, 351, /* 50 */ 24, 663, 660, 210, 678, 209, 208, 207, 206, 205,
/* 60 */ 352, 354, 355, 356, 22, 101, 449, 346, 347, 348, /* 60 */ 204, 203, 202, 201, 150, 200, 199, 198, 197, 196,
/* 70 */ 349, 350, 351, 352, 354, 355, 356, 486, 476, 169, /* 70 */ 195, 194, 673, 22, 109, 151, 448, 449, 450, 451,
/* 80 */ 146, 501, 147, 412, 395, 89, 487, 108, 490, 168, /* 80 */ 452, 453, 454, 456, 457, 458, 22, 109, 140, 448,
/* 90 */ 364, 167, 166, 165, 164, 163, 162, 161, 160, 159, /* 90 */ 449, 450, 451, 452, 453, 454, 456, 457, 458, 30,
/* 100 */ 140, 158, 157, 156, 155, 154, 153, 152, 387, 113, /* 100 */ 28, 26, 25, 24, 381, 185, 184, 183, 385, 182,
/* 110 */ 410, 411, 413, 414, 136, 486, 476, 319, 146, 501, /* 110 */ 387, 388, 181, 390, 178, 117, 396, 175, 398, 399,
/* 120 */ 147, 131, 10, 39, 487, 122, 490, 526, 131, 10, /* 120 */ 172, 169, 639, 573, 147, 624, 614, 133, 157, 158,
/* 130 */ 55, 91, 522, 123, 118, 116, 486, 476, 321, 132, /* 130 */ 577, 48, 40, 625, 84, 628, 664, 152, 423, 80,
/* 140 */ 501, 147, 141, 587, 40, 487, 20, 490, 526, 55, /* 140 */ 99, 660, 10, 639, 142, 497, 624, 614, 421, 143,
/* 150 */ 55, 540, 99, 522, 49, 353, 70, 54, 357, 486, /* 150 */ 158, 424, 725, 41, 625, 189, 628, 664, 82, 20,
/* 160 */ 476, 585, 132, 501, 147, 139, 71, 40, 487, 537, /* 160 */ 188, 107, 660, 52, 58, 162, 57, 639, 455, 149,
/* 170 */ 490, 526, 107, 553, 386, 99, 522, 49, 486, 476, /* 170 */ 723, 459, 190, 157, 10, 74, 142, 421, 132, 73,
/* 180 */ 143, 146, 501, 147, 6, 383, 85, 487, 134, 490, /* 180 */ 489, 118, 691, 639, 6, 485, 624, 614, 58, 143,
/* 190 */ 26, 25, 24, 502, 486, 476, 554, 146, 501, 147, /* 190 */ 158, 640, 59, 41, 625, 78, 628, 664, 139, 9,
/* 200 */ 75, 42, 40, 487, 409, 490, 526, 146, 501, 2, /* 200 */ 8, 107, 660, 52, 683, 639, 485, 2, 624, 614,
/* 210 */ 99, 522, 599, 121, 545, 322, 383, 540, 540, 124, /* 210 */ 46, 157, 158, 424, 126, 41, 625, 44, 628, 664,
/* 220 */ 343, 560, 486, 476, 144, 146, 501, 147, 447, 115, /* 220 */ 695, 58, 692, 107, 660, 737, 141, 53, 671, 672,
/* 230 */ 40, 487, 149, 490, 526, 536, 535, 557, 99, 522, /* 230 */ 511, 676, 639, 43, 698, 624, 614, 705, 157, 158,
/* 240 */ 599, 567, 486, 476, 322, 146, 501, 147, 138, 583, /* 240 */ 9, 8, 41, 625, 145, 628, 664, 134, 129, 127,
/* 250 */ 40, 487, 112, 490, 526, 29, 27, 57, 99, 522, /* 250 */ 107, 660, 737, 639, 154, 549, 624, 614, 123, 157,
/* 260 */ 599, 587, 56, 59, 11, 31, 62, 308, 358, 544, /* 260 */ 158, 721, 60, 41, 625, 160, 628, 664, 488, 29,
/* 270 */ 128, 29, 27, 388, 314, 54, 45, 310, 566, 585, /* 270 */ 27, 107, 660, 737, 29, 27, 490, 410, 11, 546,
/* 280 */ 11, 9, 8, 308, 43, 309, 311, 148, 314, 110, /* 280 */ 547, 410, 682, 11, 466, 65, 410, 412, 62, 460,
/* 290 */ 106, 1, 111, 310, 51, 533, 534, 61, 538, 29, /* 290 */ 416, 412, 31, 725, 427, 121, 412, 31, 445, 621,
/* 300 */ 27, 309, 311, 148, 314, 98, 106, 1, 11, 444, /* 300 */ 122, 1, 619, 114, 106, 704, 1, 57, 114, 64,
/* 310 */ 445, 308, 55, 136, 486, 476, 5, 146, 501, 147, /* 310 */ 402, 723, 159, 167, 85, 5, 159, 47, 155, 685,
/* 320 */ 547, 310, 83, 487, 31, 490, 125, 325, 64, 309, /* 320 */ 136, 159, 67, 411, 413, 416, 120, 411, 413, 416,
/* 330 */ 311, 148, 314, 109, 106, 1, 29, 27, 48, 483, /* 330 */ 4, 51, 411, 413, 416, 485, 639, 69, 147, 624,
/* 340 */ 4, 481, 587, 66, 308, 383, 318, 321, 308, 30, /* 340 */ 614, 420, 157, 158, 45, 139, 90, 625, 58, 628,
/* 350 */ 28, 26, 25, 24, 310, 44, 54, 541, 310, 32, /* 350 */ 423, 29, 27, 147, 679, 29, 27, 46, 19, 32,
/* 360 */ 585, 67, 309, 311, 148, 314, 309, 311, 148, 314, /* 360 */ 11, 16, 70, 410, 44, 646, 725, 410, 30, 28,
/* 370 */ 16, 106, 7, 486, 476, 102, 146, 501, 147, 508, /* 370 */ 26, 25, 24, 412, 71, 671, 138, 412, 137, 740,
/* 380 */ 584, 41, 487, 602, 490, 526, 145, 319, 142, 525, /* 380 */ 57, 725, 110, 1, 723, 114, 156, 7, 153, 114,
/* 390 */ 522, 74, 317, 55, 79, 486, 476, 151, 146, 501, /* 390 */ 639, 419, 722, 624, 614, 57, 157, 158, 159, 723,
/* 400 */ 147, 77, 80, 41, 487, 3, 490, 526, 31, 14, /* 400 */ 92, 625, 159, 628, 163, 77, 165, 191, 193, 411,
/* 410 */ 58, 133, 522, 128, 406, 136, 60, 35, 408, 45, /* 410 */ 413, 416, 81, 411, 413, 416, 86, 83, 639, 3,
/* 420 */ 29, 27, 135, 47, 63, 119, 36, 43, 441, 442, /* 420 */ 31, 624, 614, 98, 157, 158, 87, 14, 42, 625,
/* 430 */ 402, 401, 308, 120, 481, 29, 27, 68, 533, 127, /* 430 */ 61, 628, 664, 135, 58, 508, 144, 660, 29, 27,
/* 440 */ 37, 126, 310, 18, 587, 15, 33, 308, 380, 379, /* 440 */ 146, 29, 27, 63, 29, 27, 35, 510, 639, 50,
/* 450 */ 309, 311, 148, 314, 69, 106, 7, 310, 54, 34, /* 450 */ 410, 624, 614, 410, 157, 158, 410, 66, 42, 625,
/* 460 */ 29, 27, 585, 8, 480, 309, 311, 148, 314, 53, /* 460 */ 412, 628, 664, 412, 504, 36, 412, 661, 503, 21,
/* 470 */ 106, 1, 308, 344, 326, 486, 476, 17, 146, 501, /* 470 */ 7, 130, 114, 1, 619, 114, 7, 37, 114, 30,
/* 480 */ 147, 435, 310, 46, 487, 12, 490, 38, 430, 429, /* 480 */ 28, 26, 25, 24, 131, 159, 18, 15, 159, 482,
/* 490 */ 309, 311, 148, 314, 103, 106, 7, 486, 476, 19, /* 490 */ 72, 159, 33, 481, 34, 8, 411, 413, 416, 411,
/* 500 */ 146, 501, 147, 76, 21, 89, 487, 100, 490, 30, /* 500 */ 413, 416, 411, 413, 416, 639, 618, 56, 624, 614,
/* 510 */ 28, 26, 25, 24, 30, 28, 26, 25, 24, 434, /* 510 */ 446, 157, 158, 428, 537, 49, 625, 12, 628, 38,
/* 520 */ 433, 13, 137, 600, 30, 28, 26, 25, 24, 486, /* 520 */ 17, 532, 639, 531, 111, 624, 614, 536, 157, 158,
/* 530 */ 476, 104, 146, 501, 147, 312, 470, 46, 487, 287, /* 530 */ 535, 112, 96, 625, 113, 628, 639, 79, 13, 624,
/* 540 */ 490, 486, 476, 150, 146, 501, 147, 299, 306, 84, /* 540 */ 614, 608, 157, 158, 607, 414, 96, 625, 119, 628,
/* 550 */ 487, 305, 490, 486, 476, 304, 146, 501, 147, 78, /* 550 */ 161, 572, 164, 403, 148, 738, 639, 166, 376, 624,
/* 560 */ 448, 86, 487, 303, 490, 302, 301, 486, 476, 300, /* 560 */ 614, 115, 157, 158, 168, 171, 96, 625, 108, 628,
/* 570 */ 146, 501, 147, 298, 297, 81, 487, 601, 490, 296, /* 570 */ 400, 639, 170, 397, 624, 614, 173, 157, 158, 174,
/* 580 */ 486, 476, 295, 146, 501, 147, 294, 293, 87, 487, /* 580 */ 176, 49, 625, 639, 628, 179, 624, 614, 391, 157,
/* 590 */ 292, 490, 486, 476, 291, 146, 501, 147, 290, 448, /* 590 */ 158, 177, 395, 91, 625, 389, 628, 639, 180, 394,
/* 600 */ 82, 487, 448, 490, 486, 476, 448, 146, 501, 147, /* 600 */ 624, 614, 380, 157, 158, 407, 393, 93, 625, 186,
/* 610 */ 448, 448, 88, 487, 448, 490, 448, 30, 28, 26, /* 610 */ 628, 406, 639, 405, 392, 624, 614, 39, 157, 158,
/* 620 */ 25, 24, 448, 448, 486, 476, 448, 146, 501, 147, /* 620 */ 353, 739, 88, 625, 639, 628, 372, 624, 614, 192,
/* 630 */ 448, 448, 498, 487, 448, 490, 486, 476, 448, 146, /* 630 */ 157, 158, 550, 371, 94, 625, 639, 628, 370, 624,
/* 640 */ 501, 147, 448, 448, 497, 487, 448, 490, 486, 476, /* 640 */ 614, 365, 157, 158, 369, 368, 89, 625, 367, 628,
/* 650 */ 448, 146, 501, 147, 328, 448, 496, 487, 448, 490, /* 650 */ 366, 364, 639, 550, 363, 624, 614, 550, 157, 158,
/* 660 */ 486, 476, 448, 146, 501, 147, 448, 448, 95, 487, /* 660 */ 362, 361, 95, 625, 360, 628, 639, 359, 358, 624,
/* 670 */ 448, 490, 486, 476, 448, 146, 501, 147, 448, 448, /* 670 */ 614, 357, 157, 158, 356, 550, 636, 625, 550, 628,
/* 680 */ 94, 487, 448, 490, 448, 486, 476, 448, 146, 501, /* 680 */ 550, 639, 550, 550, 624, 614, 550, 157, 158, 550,
/* 690 */ 147, 448, 448, 96, 487, 448, 490, 486, 476, 448, /* 690 */ 550, 635, 625, 639, 628, 550, 624, 614, 550, 157,
/* 700 */ 146, 501, 147, 448, 448, 93, 487, 448, 490, 486, /* 700 */ 158, 550, 550, 634, 625, 639, 628, 550, 624, 614,
/* 710 */ 476, 448, 146, 501, 147, 448, 448, 90, 487, 448, /* 710 */ 550, 157, 158, 550, 550, 103, 625, 639, 628, 550,
/* 720 */ 490, 448, 448, 128, 448, 448, 448, 448, 128, 45, /* 720 */ 624, 614, 550, 157, 158, 550, 550, 102, 625, 550,
/* 730 */ 448, 448, 448, 448, 45, 448, 448, 43, 448, 448, /* 730 */ 628, 639, 550, 550, 624, 614, 550, 157, 158, 550,
/* 740 */ 448, 448, 43, 448, 448, 448, 130, 50, 533, 534, /* 740 */ 550, 104, 625, 639, 628, 139, 624, 614, 550, 157,
/* 750 */ 448, 538, 52, 533, 534, 448, 538, /* 750 */ 158, 139, 550, 101, 625, 639, 628, 46, 624, 614,
/* 760 */ 550, 157, 158, 46, 44, 97, 625, 514, 628, 550,
/* 770 */ 44, 550, 550, 550, 54, 671, 672, 550, 676, 550,
/* 780 */ 55, 671, 672, 550, 676, 550, 550, 30, 28, 26,
/* 790 */ 25, 24, 550, 124, 512, 513, 515, 516, 550, 550,
/* 800 */ 30, 28, 26, 25, 24, 550, 550, 550, 550, 550,
/* 810 */ 550, 550, 550, 550, 550, 550, 550, 550, 550, 550,
/* 820 */ 550, 550, 550, 550, 550, 550, 550, 550, 550, 550,
/* 830 */ 550, 550, 550, 430, 550, 550, 550, 550, 550, 550,
/* 840 */ 550, 550, 550, 550, 550, 550, 550, 550, 550, 550,
/* 850 */ 550, 550, 550, 550, 550, 550, 550, 550, 550, 550,
/* 860 */ 550, 550, 550, 550, 550, 550, 550, 550, 550, 550,
/* 870 */ 550, 550, 550, 550, 550, 550, 550, 550, 550, 550,
/* 880 */ 550, 550, 550, 550, 550, 550, 550, 550, 543, 544,
}; };
static const YYCODETYPE yy_lookahead[] = { static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 101, 102, 150, 104, 105, 106, 129, 141, 109, 110, /* 0 */ 129, 130, 131, 127, 123, 156, 125, 126, 141, 142,
/* 10 */ 111, 112, 12, 13, 14, 15, 16, 101, 102, 103, /* 10 */ 177, 126, 12, 13, 14, 15, 16, 132, 168, 170,
/* 20 */ 143, 21, 114, 115, 147, 12, 13, 14, 15, 16, /* 20 */ 134, 21, 137, 174, 134, 12, 13, 14, 15, 16,
/* 30 */ 101, 102, 104, 105, 21, 134, 101, 102, 110, 104, /* 30 */ 0, 129, 130, 126, 21, 161, 129, 130, 152, 132,
/* 40 */ 105, 106, 1, 2, 109, 110, 108, 112, 113, 49, /* 40 */ 133, 135, 152, 136, 137, 45, 139, 140, 14, 15,
/* 50 */ 127, 51, 52, 118, 54, 55, 56, 57, 58, 59, /* 50 */ 16, 144, 145, 23, 134, 25, 26, 27, 28, 29,
/* 60 */ 60, 61, 62, 63, 51, 52, 0, 54, 55, 56, /* 60 */ 30, 31, 32, 33, 3, 35, 36, 37, 38, 39,
/* 70 */ 57, 58, 59, 60, 61, 62, 63, 101, 102, 18, /* 70 */ 40, 41, 152, 73, 74, 48, 76, 77, 78, 79,
/* 80 */ 104, 105, 106, 53, 14, 109, 110, 111, 112, 23, /* 80 */ 80, 81, 82, 83, 84, 85, 73, 74, 154, 76,
/* 90 */ 49, 25, 26, 27, 28, 29, 30, 31, 32, 33, /* 90 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 12,
/* 100 */ 46, 35, 36, 37, 38, 39, 40, 41, 4, 79, /* 100 */ 13, 14, 15, 16, 50, 51, 52, 53, 54, 55,
/* 110 */ 80, 81, 82, 83, 100, 101, 102, 47, 104, 105, /* 110 */ 56, 57, 58, 59, 60, 18, 62, 63, 64, 65,
/* 120 */ 106, 47, 48, 109, 110, 47, 112, 113, 47, 48, /* 120 */ 66, 67, 126, 0, 128, 129, 130, 46, 132, 133,
/* 130 */ 69, 117, 118, 74, 75, 76, 101, 102, 47, 104, /* 130 */ 125, 126, 136, 137, 19, 139, 140, 110, 46, 42,
/* 140 */ 105, 106, 88, 129, 109, 110, 51, 112, 113, 69, /* 140 */ 144, 145, 44, 126, 46, 14, 129, 130, 46, 132,
/* 150 */ 69, 107, 117, 118, 119, 60, 65, 143, 63, 101, /* 150 */ 133, 46, 156, 136, 137, 32, 139, 140, 43, 73,
/* 160 */ 102, 147, 104, 105, 106, 3, 131, 109, 110, 125, /* 160 */ 37, 144, 145, 146, 91, 68, 170, 126, 82, 108,
/* 170 */ 112, 113, 137, 138, 70, 117, 118, 119, 101, 102, /* 170 */ 174, 85, 49, 132, 44, 158, 46, 46, 137, 87,
/* 180 */ 46, 104, 105, 106, 67, 68, 109, 110, 21, 112, /* 180 */ 4, 164, 165, 126, 89, 90, 129, 130, 91, 132,
/* 190 */ 14, 15, 16, 105, 101, 102, 138, 104, 105, 106, /* 190 */ 133, 126, 87, 136, 137, 171, 139, 140, 120, 1,
/* 200 */ 144, 46, 109, 110, 49, 112, 113, 104, 105, 130, /* 200 */ 2, 144, 145, 146, 88, 126, 90, 157, 129, 130,
/* 210 */ 117, 118, 119, 110, 66, 47, 68, 107, 107, 142, /* 210 */ 132, 132, 133, 46, 100, 136, 137, 139, 139, 140,
/* 220 */ 53, 128, 101, 102, 90, 104, 105, 106, 96, 78, /* 220 */ 135, 91, 165, 144, 145, 146, 148, 149, 150, 151,
/* 230 */ 109, 110, 100, 112, 113, 125, 125, 108, 117, 118, /* 230 */ 45, 153, 126, 48, 155, 129, 130, 167, 132, 133,
/* 240 */ 119, 140, 101, 102, 47, 104, 105, 106, 86, 128, /* 240 */ 1, 2, 136, 137, 21, 139, 140, 96, 97, 98,
/* 250 */ 109, 110, 77, 112, 113, 12, 13, 139, 117, 118, /* 250 */ 144, 145, 146, 126, 48, 118, 129, 130, 99, 132,
/* 260 */ 119, 129, 65, 46, 21, 46, 49, 24, 49, 128, /* 260 */ 133, 155, 166, 136, 137, 128, 139, 140, 92, 12,
/* 270 */ 98, 12, 13, 14, 45, 143, 104, 34, 140, 147, /* 270 */ 13, 144, 145, 146, 12, 13, 14, 24, 21, 116,
/* 280 */ 21, 1, 2, 24, 112, 42, 43, 44, 45, 102, /* 280 */ 117, 24, 155, 21, 45, 45, 24, 34, 48, 45,
/* 290 */ 47, 48, 102, 34, 122, 123, 124, 139, 126, 12, /* 290 */ 72, 34, 48, 156, 45, 130, 34, 48, 75, 44,
/* 300 */ 13, 42, 43, 44, 45, 102, 47, 48, 21, 94, /* 300 */ 130, 44, 47, 46, 130, 167, 44, 170, 46, 166,
/* 310 */ 95, 24, 69, 100, 101, 102, 85, 104, 105, 106, /* 310 */ 45, 174, 59, 48, 45, 107, 59, 48, 112, 163,
/* 320 */ 136, 34, 109, 110, 46, 112, 84, 49, 135, 42, /* 320 */ 106, 59, 162, 70, 71, 72, 94, 70, 71, 72,
/* 330 */ 43, 44, 45, 72, 47, 48, 12, 13, 133, 48, /* 330 */ 93, 160, 70, 71, 72, 90, 126, 159, 128, 129,
/* 340 */ 71, 50, 129, 132, 24, 68, 47, 47, 24, 12, /* 340 */ 130, 46, 132, 133, 132, 120, 136, 137, 91, 139,
/* 350 */ 13, 14, 15, 16, 34, 104, 143, 107, 34, 64, /* 350 */ 46, 12, 13, 128, 134, 12, 13, 132, 2, 86,
/* 360 */ 147, 120, 42, 43, 44, 45, 42, 43, 44, 45, /* 360 */ 21, 44, 147, 24, 139, 143, 156, 24, 12, 13,
/* 370 */ 48, 47, 48, 101, 102, 93, 104, 105, 106, 116, /* 370 */ 14, 15, 16, 34, 149, 150, 151, 34, 153, 178,
/* 380 */ 146, 109, 110, 151, 112, 113, 89, 47, 87, 117, /* 380 */ 170, 156, 115, 44, 174, 46, 111, 44, 109, 46,
/* 390 */ 118, 145, 47, 69, 98, 101, 102, 20, 104, 105, /* 390 */ 126, 46, 173, 129, 130, 170, 132, 133, 59, 174,
/* 400 */ 106, 97, 99, 109, 110, 46, 112, 113, 46, 73, /* 400 */ 136, 137, 59, 139, 120, 172, 46, 122, 20, 70,
/* 410 */ 49, 117, 118, 98, 49, 100, 48, 46, 49, 104, /* 410 */ 71, 72, 119, 70, 71, 72, 120, 119, 126, 48,
/* 420 */ 12, 13, 14, 48, 48, 24, 48, 112, 91, 92, /* 420 */ 48, 129, 130, 124, 132, 133, 121, 95, 136, 137,
/* 430 */ 49, 49, 24, 46, 50, 12, 13, 122, 123, 124, /* 430 */ 45, 139, 140, 169, 91, 45, 144, 145, 12, 13,
/* 440 */ 48, 126, 34, 46, 129, 73, 66, 24, 49, 49, /* 440 */ 14, 12, 13, 44, 12, 13, 48, 45, 126, 44,
/* 450 */ 42, 43, 44, 45, 50, 47, 48, 34, 143, 46, /* 450 */ 24, 129, 130, 24, 132, 133, 24, 44, 136, 137,
/* 460 */ 12, 13, 147, 2, 50, 42, 43, 44, 45, 50, /* 460 */ 34, 139, 140, 34, 45, 44, 34, 145, 45, 2,
/* 470 */ 47, 48, 24, 53, 49, 101, 102, 46, 104, 105, /* 470 */ 44, 24, 46, 44, 47, 46, 44, 44, 46, 12,
/* 480 */ 106, 49, 34, 109, 110, 73, 112, 4, 24, 24, /* 480 */ 13, 14, 15, 16, 48, 59, 48, 95, 59, 45,
/* 490 */ 42, 43, 44, 45, 24, 47, 48, 101, 102, 2, /* 490 */ 47, 59, 88, 45, 48, 2, 70, 71, 72, 70,
/* 500 */ 104, 105, 106, 50, 2, 109, 110, 111, 112, 12, /* 500 */ 71, 72, 70, 71, 72, 126, 47, 47, 129, 130,
/* 510 */ 13, 14, 15, 16, 12, 13, 14, 15, 16, 24, /* 510 */ 75, 132, 133, 45, 45, 136, 137, 95, 139, 4,
/* 520 */ 24, 48, 148, 149, 12, 13, 14, 15, 16, 101, /* 520 */ 48, 24, 126, 24, 24, 129, 130, 24, 132, 133,
/* 530 */ 102, 24, 104, 105, 106, 34, 0, 109, 110, 22, /* 530 */ 24, 24, 136, 137, 138, 139, 126, 47, 44, 129,
/* 540 */ 112, 101, 102, 21, 104, 105, 106, 34, 24, 109, /* 540 */ 130, 0, 132, 133, 0, 34, 136, 137, 138, 139,
/* 550 */ 110, 24, 112, 101, 102, 24, 104, 105, 106, 19, /* 550 */ 69, 0, 47, 45, 175, 176, 126, 24, 46, 129,
/* 560 */ 152, 109, 110, 24, 112, 24, 24, 101, 102, 24, /* 560 */ 130, 24, 132, 133, 44, 44, 136, 137, 138, 139,
/* 570 */ 104, 105, 106, 24, 24, 109, 110, 149, 112, 24, /* 570 */ 45, 126, 24, 45, 129, 130, 24, 132, 133, 44,
/* 580 */ 101, 102, 24, 104, 105, 106, 24, 24, 109, 110, /* 580 */ 24, 136, 137, 126, 139, 24, 129, 130, 45, 132,
/* 590 */ 24, 112, 101, 102, 24, 104, 105, 106, 24, 152, /* 590 */ 133, 44, 61, 136, 137, 45, 139, 126, 44, 61,
/* 600 */ 109, 110, 152, 112, 101, 102, 152, 104, 105, 106, /* 600 */ 129, 130, 34, 132, 133, 24, 61, 136, 137, 49,
/* 610 */ 152, 152, 109, 110, 152, 112, 152, 12, 13, 14, /* 610 */ 139, 24, 126, 24, 61, 129, 130, 44, 132, 133,
/* 620 */ 15, 16, 152, 152, 101, 102, 152, 104, 105, 106, /* 620 */ 22, 176, 136, 137, 126, 139, 24, 129, 130, 21,
/* 630 */ 152, 152, 109, 110, 152, 112, 101, 102, 152, 104, /* 630 */ 132, 133, 179, 24, 136, 137, 126, 139, 24, 129,
/* 640 */ 105, 106, 152, 152, 109, 110, 152, 112, 101, 102, /* 640 */ 130, 34, 132, 133, 24, 24, 136, 137, 24, 139,
/* 650 */ 152, 104, 105, 106, 49, 152, 109, 110, 152, 112, /* 650 */ 24, 24, 126, 179, 24, 129, 130, 179, 132, 133,
/* 660 */ 101, 102, 152, 104, 105, 106, 152, 152, 109, 110, /* 660 */ 24, 24, 136, 137, 24, 139, 126, 24, 24, 129,
/* 670 */ 152, 112, 101, 102, 152, 104, 105, 106, 152, 152, /* 670 */ 130, 24, 132, 133, 24, 179, 136, 137, 179, 139,
/* 680 */ 109, 110, 152, 112, 152, 101, 102, 152, 104, 105, /* 680 */ 179, 126, 179, 179, 129, 130, 179, 132, 133, 179,
/* 690 */ 106, 152, 152, 109, 110, 152, 112, 101, 102, 152, /* 690 */ 179, 136, 137, 126, 139, 179, 129, 130, 179, 132,
/* 700 */ 104, 105, 106, 152, 152, 109, 110, 152, 112, 101, /* 700 */ 133, 179, 179, 136, 137, 126, 139, 179, 129, 130,
/* 710 */ 102, 152, 104, 105, 106, 152, 152, 109, 110, 152, /* 710 */ 179, 132, 133, 179, 179, 136, 137, 126, 139, 179,
/* 720 */ 112, 152, 152, 98, 152, 152, 152, 152, 98, 104, /* 720 */ 129, 130, 179, 132, 133, 179, 179, 136, 137, 179,
/* 730 */ 152, 152, 152, 152, 104, 152, 152, 112, 152, 152, /* 730 */ 139, 126, 179, 179, 129, 130, 179, 132, 133, 179,
/* 740 */ 152, 152, 112, 152, 152, 152, 121, 122, 123, 124, /* 740 */ 179, 136, 137, 126, 139, 120, 129, 130, 179, 132,
/* 750 */ 152, 126, 122, 123, 124, 152, 126, /* 750 */ 133, 120, 179, 136, 137, 126, 139, 132, 129, 130,
/* 760 */ 179, 132, 133, 132, 139, 136, 137, 75, 139, 179,
/* 770 */ 139, 179, 179, 179, 149, 150, 151, 179, 153, 179,
/* 780 */ 149, 150, 151, 179, 153, 179, 179, 12, 13, 14,
/* 790 */ 15, 16, 179, 101, 102, 103, 104, 105, 179, 179,
/* 800 */ 12, 13, 14, 15, 16, 179, 179, 179, 179, 179,
/* 810 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 820 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 830 */ 179, 179, 179, 45, 179, 179, 179, 179, 179, 179,
/* 840 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 850 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 860 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 870 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 880 */ 179, 179, 179, 179, 179, 179, 179, 179, 113, 114,
/* 890 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 900 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
/* 910 */ 179, 179, 179, 179, 179, 179, 179, 179, 179,
}; };
#define YY_SHIFT_COUNT (169) #define YY_SHIFT_COUNT (210)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (605) #define YY_SHIFT_MAX (788)
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 61, 243, 259, 287, 287, 287, 287, 324, 287, 287, /* 0 */ 97, 257, 262, 339, 339, 339, 339, 343, 339, 339,
/* 10 */ 81, 423, 448, 408, 448, 448, 448, 448, 448, 448, /* 10 */ 130, 429, 432, 426, 432, 432, 432, 432, 432, 432,
/* 20 */ 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, /* 20 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
/* 30 */ 448, 448, 74, 74, 74, 320, 78, 78, 80, 0, /* 30 */ 432, 432, 98, 98, 98, 253, 81, 81, 73, 102,
/* 40 */ 13, 13, 320, 91, 91, 91, 337, 30, 59, 197, /* 40 */ 0, 13, 13, 253, 92, 92, 92, 102, 54, 775,
/* 50 */ 148, 117, 148, 70, 162, 104, 168, 151, 175, 229, /* 50 */ 692, 151, 105, 116, 95, 116, 131, 61, 176, 167,
/* 60 */ 229, 151, 175, 229, 231, 242, 261, 269, 277, 299, /* 60 */ 114, 159, 218, 218, 114, 159, 218, 208, 214, 232,
/* 70 */ 300, 295, 322, 282, 297, 301, 340, 345, 377, 757, /* 70 */ 237, 245, 295, 304, 273, 317, 267, 275, 279, 102,
/* 80 */ 66, 497, 502, 605, 512, 512, 512, 512, 512, 512, /* 80 */ 345, 360, 388, 345, 388, 890, 890, 30, 356, 467,
/* 90 */ 512, 41, 95, 176, 176, 176, 176, 155, 217, 280, /* 90 */ 788, 87, 87, 87, 87, 87, 87, 87, 123, 239,
/* 100 */ 219, 167, 215, 54, 134, 278, 291, 359, 362, 336, /* 100 */ 86, 34, 34, 34, 34, 185, 240, 198, 244, 223,
/* 110 */ 361, 365, 368, 371, 369, 375, 376, 381, 378, 382, /* 110 */ 163, 27, 206, 249, 255, 265, 269, 115, 371, 372,
/* 120 */ 401, 387, 384, 392, 397, 372, 399, 400, 404, 380, /* 120 */ 332, 385, 390, 399, 398, 402, 405, 413, 419, 421,
/* 130 */ 413, 414, 419, 461, 420, 425, 432, 431, 412, 483, /* 130 */ 423, 447, 436, 427, 433, 438, 392, 444, 448, 443,
/* 140 */ 464, 465, 470, 495, 496, 507, 453, 473, 501, 536, /* 140 */ 404, 446, 459, 460, 493, 435, 468, 469, 472, 422,
/* 150 */ 517, 522, 524, 527, 531, 539, 541, 542, 545, 513, /* 150 */ 515, 497, 499, 500, 503, 506, 507, 490, 494, 511,
/* 160 */ 549, 550, 555, 558, 562, 563, 566, 570, 574, 540, /* 160 */ 541, 544, 481, 551, 512, 505, 508, 533, 537, 520,
/* 170 */ 525, 548, 521, 528, 552, 535, 543, 556, 547, 550,
/* 180 */ 561, 554, 531, 538, 545, 553, 568, 560, 581, 587,
/* 190 */ 589, 573, 598, 608, 602, 609, 614, 620, 621, 624,
/* 200 */ 626, 607, 627, 630, 636, 637, 640, 643, 644, 647,
/* 210 */ 650,
}; };
#define YY_REDUCE_COUNT (79) #define YY_REDUCE_COUNT (86)
#define YY_REDUCE_MIN (-148) #define YY_REDUCE_MIN (-167)
#define YY_REDUCE_MAX (630) #define YY_REDUCE_MAX (631)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
/* 0 */ 132, 14, 35, 58, 93, 121, 141, 213, 272, 294, /* 0 */ 137, -4, 17, 57, 79, 106, 127, 210, -93, 292,
/* 10 */ 315, -65, 374, -101, -24, 77, 396, 428, 440, 452, /* 10 */ 225, 322, 379, 396, 410, 264, 430, 445, 457, 471,
/* 20 */ 466, 479, 491, 503, 523, 535, 547, 559, 571, 584, /* 20 */ 486, 498, 510, 526, 540, 555, 567, 579, 591, 605,
/* 30 */ 596, 608, 625, 172, 630, -84, -72, 103, -123, -92, /* 30 */ 617, 629, 78, 625, 631, -129, -115, 41, -151, -119,
/* 40 */ -92, -92, -71, 44, 110, 111, -148, -134, -99, -62, /* 40 */ -133, -133, -133, -98, -114, -110, -80, 5, -124, -167,
/* 50 */ -77, -77, -77, 88, 56, 79, 129, 101, 118, 187, /* 50 */ -150, -126, -94, -66, -66, -66, 65, 24, 50, 85,
/* 60 */ 190, 138, 158, 203, 184, 193, 205, 211, -77, 251, /* 60 */ 70, 96, 165, 170, 138, 143, 174, 156, 160, 171,
/* 70 */ 250, 241, 263, 232, 234, 246, 88, 296, 304, 303, /* 70 */ 178, -66, 212, 220, 215, 222, 201, 219, 233, 65,
/* 80 */ 284, 285, 293, 296, 298, 299, 305,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 0 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 10 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 10 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 20 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 20 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 30 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 30 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 40 */ 528, 446, 446, 539, 539, 539, 603, 446, 563, 555, /* 40 */ 548, 666, 548, 548, 677, 677, 677, 548, 548, 741,
/* 50 */ 531, 545, 532, 446, 588, 548, 446, 570, 568, 446, /* 50 */ 548, 701, 693, 669, 683, 670, 548, 726, 686, 548,
/* 60 */ 446, 570, 568, 446, 582, 578, 561, 559, 545, 446, /* 60 */ 708, 706, 548, 548, 708, 706, 548, 720, 716, 699,
/* 70 */ 446, 446, 446, 606, 594, 590, 446, 446, 451, 452, /* 70 */ 697, 683, 548, 548, 548, 548, 744, 732, 728, 548,
/* 80 */ 446, 446, 446, 446, 581, 580, 505, 504, 503, 499, /* 80 */ 548, 548, 553, 548, 553, 603, 554, 548, 548, 548,
/* 90 */ 500, 446, 446, 494, 495, 493, 492, 446, 446, 529, /* 90 */ 548, 719, 718, 643, 642, 641, 637, 638, 548, 548,
/* 100 */ 446, 446, 446, 591, 595, 446, 482, 552, 562, 446, /* 100 */ 548, 632, 633, 631, 630, 548, 548, 667, 548, 548,
/* 110 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 110 */ 548, 729, 733, 548, 620, 548, 548, 548, 690, 700,
/* 120 */ 446, 446, 482, 446, 579, 446, 538, 534, 446, 446, /* 120 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 130 */ 530, 481, 446, 524, 446, 446, 446, 589, 446, 446, /* 130 */ 548, 548, 548, 620, 548, 717, 548, 676, 672, 548,
/* 140 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 140 */ 548, 668, 619, 548, 662, 548, 548, 548, 727, 548,
/* 150 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 150 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 160 */ 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, /* 160 */ 548, 548, 548, 548, 548, 574, 548, 548, 548, 600,
/* 170 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 180 */ 548, 548, 585, 583, 582, 581, 548, 578, 548, 548,
/* 190 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 200 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
/* 210 */ 548,
}; };
/********** End of lemon-generated parsing tables *****************************/ /********** End of lemon-generated parsing tables *****************************/
...@@ -574,116 +617,143 @@ static const char *const yyTokenName[] = { ...@@ -574,116 +617,143 @@ static const char *const yyTokenName[] = {
/* 39 */ "VGROUPS", /* 39 */ "VGROUPS",
/* 40 */ "SINGLESTABLE", /* 40 */ "SINGLESTABLE",
/* 41 */ "STREAMMODE", /* 41 */ "STREAMMODE",
/* 42 */ "NK_FLOAT", /* 42 */ "USE",
/* 43 */ "NK_BOOL", /* 43 */ "TABLE",
/* 44 */ "TIMESTAMP", /* 44 */ "NK_LP",
/* 45 */ "NK_VARIABLE", /* 45 */ "NK_RP",
/* 46 */ "NK_COMMA", /* 46 */ "NK_ID",
/* 47 */ "NK_ID", /* 47 */ "NK_DOT",
/* 48 */ "NK_LP", /* 48 */ "NK_COMMA",
/* 49 */ "NK_RP", /* 49 */ "COMMENT",
/* 50 */ "NK_DOT", /* 50 */ "BOOL",
/* 51 */ "BETWEEN", /* 51 */ "TINYINT",
/* 52 */ "IS", /* 52 */ "SMALLINT",
/* 53 */ "NULL", /* 53 */ "INT",
/* 54 */ "NK_LT", /* 54 */ "INTEGER",
/* 55 */ "NK_GT", /* 55 */ "BIGINT",
/* 56 */ "NK_LE", /* 56 */ "FLOAT",
/* 57 */ "NK_GE", /* 57 */ "DOUBLE",
/* 58 */ "NK_NE", /* 58 */ "BINARY",
/* 59 */ "NK_EQ", /* 59 */ "TIMESTAMP",
/* 60 */ "LIKE", /* 60 */ "NCHAR",
/* 61 */ "MATCH", /* 61 */ "UNSIGNED",
/* 62 */ "NMATCH", /* 62 */ "JSON",
/* 63 */ "IN", /* 63 */ "VARCHAR",
/* 64 */ "FROM", /* 64 */ "MEDIUMBLOB",
/* 65 */ "AS", /* 65 */ "BLOB",
/* 66 */ "JOIN", /* 66 */ "VARBINARY",
/* 67 */ "ON", /* 67 */ "DECIMAL",
/* 68 */ "INNER", /* 68 */ "SHOW",
/* 69 */ "SELECT", /* 69 */ "DATABASES",
/* 70 */ "DISTINCT", /* 70 */ "NK_FLOAT",
/* 71 */ "WHERE", /* 71 */ "NK_BOOL",
/* 72 */ "PARTITION", /* 72 */ "NK_VARIABLE",
/* 73 */ "BY", /* 73 */ "BETWEEN",
/* 74 */ "SESSION", /* 74 */ "IS",
/* 75 */ "STATE_WINDOW", /* 75 */ "NULL",
/* 76 */ "INTERVAL", /* 76 */ "NK_LT",
/* 77 */ "SLIDING", /* 77 */ "NK_GT",
/* 78 */ "FILL", /* 78 */ "NK_LE",
/* 79 */ "VALUE", /* 79 */ "NK_GE",
/* 80 */ "NONE", /* 80 */ "NK_NE",
/* 81 */ "PREV", /* 81 */ "NK_EQ",
/* 82 */ "LINEAR", /* 82 */ "LIKE",
/* 83 */ "NEXT", /* 83 */ "MATCH",
/* 84 */ "GROUP", /* 84 */ "NMATCH",
/* 85 */ "HAVING", /* 85 */ "IN",
/* 86 */ "ORDER", /* 86 */ "FROM",
/* 87 */ "SLIMIT", /* 87 */ "AS",
/* 88 */ "SOFFSET", /* 88 */ "JOIN",
/* 89 */ "LIMIT", /* 89 */ "ON",
/* 90 */ "OFFSET", /* 90 */ "INNER",
/* 91 */ "ASC", /* 91 */ "SELECT",
/* 92 */ "DESC", /* 92 */ "DISTINCT",
/* 93 */ "NULLS", /* 93 */ "WHERE",
/* 94 */ "FIRST", /* 94 */ "PARTITION",
/* 95 */ "LAST", /* 95 */ "BY",
/* 96 */ "cmd", /* 96 */ "SESSION",
/* 97 */ "exists_opt", /* 97 */ "STATE_WINDOW",
/* 98 */ "db_name", /* 98 */ "INTERVAL",
/* 99 */ "db_options", /* 99 */ "SLIDING",
/* 100 */ "query_expression", /* 100 */ "FILL",
/* 101 */ "literal", /* 101 */ "VALUE",
/* 102 */ "duration_literal", /* 102 */ "NONE",
/* 103 */ "literal_list", /* 103 */ "PREV",
/* 104 */ "table_name", /* 104 */ "LINEAR",
/* 105 */ "column_name", /* 105 */ "NEXT",
/* 106 */ "function_name", /* 106 */ "GROUP",
/* 107 */ "table_alias", /* 107 */ "HAVING",
/* 108 */ "column_alias", /* 108 */ "ORDER",
/* 109 */ "expression", /* 109 */ "SLIMIT",
/* 110 */ "column_reference", /* 110 */ "SOFFSET",
/* 111 */ "expression_list", /* 111 */ "LIMIT",
/* 112 */ "subquery", /* 112 */ "OFFSET",
/* 113 */ "predicate", /* 113 */ "ASC",
/* 114 */ "compare_op", /* 114 */ "DESC",
/* 115 */ "in_op", /* 115 */ "NULLS",
/* 116 */ "in_predicate_value", /* 116 */ "FIRST",
/* 117 */ "boolean_value_expression", /* 117 */ "LAST",
/* 118 */ "boolean_primary", /* 118 */ "cmd",
/* 119 */ "common_expression", /* 119 */ "exists_opt",
/* 120 */ "from_clause", /* 120 */ "db_name",
/* 121 */ "table_reference_list", /* 121 */ "db_options",
/* 122 */ "table_reference", /* 122 */ "full_table_name",
/* 123 */ "table_primary", /* 123 */ "column_def_list",
/* 124 */ "joined_table", /* 124 */ "table_options",
/* 125 */ "alias_opt", /* 125 */ "column_def",
/* 126 */ "parenthesized_joined_table", /* 126 */ "column_name",
/* 127 */ "join_type", /* 127 */ "type_name",
/* 128 */ "search_condition", /* 128 */ "query_expression",
/* 129 */ "query_specification", /* 129 */ "literal",
/* 130 */ "set_quantifier_opt", /* 130 */ "duration_literal",
/* 131 */ "select_list", /* 131 */ "literal_list",
/* 132 */ "where_clause_opt", /* 132 */ "table_name",
/* 133 */ "partition_by_clause_opt", /* 133 */ "function_name",
/* 134 */ "twindow_clause_opt", /* 134 */ "table_alias",
/* 135 */ "group_by_clause_opt", /* 135 */ "column_alias",
/* 136 */ "having_clause_opt", /* 136 */ "expression",
/* 137 */ "select_sublist", /* 137 */ "column_reference",
/* 138 */ "select_item", /* 138 */ "expression_list",
/* 139 */ "sliding_opt", /* 139 */ "subquery",
/* 140 */ "fill_opt", /* 140 */ "predicate",
/* 141 */ "fill_mode", /* 141 */ "compare_op",
/* 142 */ "group_by_list", /* 142 */ "in_op",
/* 143 */ "query_expression_body", /* 143 */ "in_predicate_value",
/* 144 */ "order_by_clause_opt", /* 144 */ "boolean_value_expression",
/* 145 */ "slimit_clause_opt", /* 145 */ "boolean_primary",
/* 146 */ "limit_clause_opt", /* 146 */ "common_expression",
/* 147 */ "query_primary", /* 147 */ "from_clause",
/* 148 */ "sort_specification_list", /* 148 */ "table_reference_list",
/* 149 */ "sort_specification", /* 149 */ "table_reference",
/* 150 */ "ordering_specification_opt", /* 150 */ "table_primary",
/* 151 */ "null_ordering_opt", /* 151 */ "joined_table",
/* 152 */ "alias_opt",
/* 153 */ "parenthesized_joined_table",
/* 154 */ "join_type",
/* 155 */ "search_condition",
/* 156 */ "query_specification",
/* 157 */ "set_quantifier_opt",
/* 158 */ "select_list",
/* 159 */ "where_clause_opt",
/* 160 */ "partition_by_clause_opt",
/* 161 */ "twindow_clause_opt",
/* 162 */ "group_by_clause_opt",
/* 163 */ "having_clause_opt",
/* 164 */ "select_sublist",
/* 165 */ "select_item",
/* 166 */ "sliding_opt",
/* 167 */ "fill_opt",
/* 168 */ "fill_mode",
/* 169 */ "group_by_list",
/* 170 */ "query_expression_body",
/* 171 */ "order_by_clause_opt",
/* 172 */ "slimit_clause_opt",
/* 173 */ "limit_clause_opt",
/* 174 */ "query_primary",
/* 175 */ "sort_specification_list",
/* 176 */ "sort_specification",
/* 177 */ "ordering_specification_opt",
/* 178 */ "null_ordering_opt",
}; };
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
...@@ -712,145 +782,181 @@ static const char *const yyRuleName[] = { ...@@ -712,145 +782,181 @@ static const char *const yyRuleName[] = {
/* 18 */ "db_options ::= db_options VGROUPS NK_INTEGER", /* 18 */ "db_options ::= db_options VGROUPS NK_INTEGER",
/* 19 */ "db_options ::= db_options SINGLESTABLE NK_INTEGER", /* 19 */ "db_options ::= db_options SINGLESTABLE NK_INTEGER",
/* 20 */ "db_options ::= db_options STREAMMODE NK_INTEGER", /* 20 */ "db_options ::= db_options STREAMMODE NK_INTEGER",
/* 21 */ "cmd ::= query_expression", /* 21 */ "cmd ::= USE db_name",
/* 22 */ "literal ::= NK_INTEGER", /* 22 */ "cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options",
/* 23 */ "literal ::= NK_FLOAT", /* 23 */ "full_table_name ::= NK_ID",
/* 24 */ "literal ::= NK_STRING", /* 24 */ "full_table_name ::= NK_ID NK_DOT NK_ID",
/* 25 */ "literal ::= NK_BOOL", /* 25 */ "column_def_list ::= column_def",
/* 26 */ "literal ::= TIMESTAMP NK_STRING", /* 26 */ "column_def_list ::= column_def_list NK_COMMA column_def",
/* 27 */ "literal ::= duration_literal", /* 27 */ "column_def ::= column_name type_name",
/* 28 */ "duration_literal ::= NK_VARIABLE", /* 28 */ "column_def ::= column_name type_name COMMENT NK_STRING",
/* 29 */ "literal_list ::= literal", /* 29 */ "type_name ::= BOOL",
/* 30 */ "literal_list ::= literal_list NK_COMMA literal", /* 30 */ "type_name ::= TINYINT",
/* 31 */ "db_name ::= NK_ID", /* 31 */ "type_name ::= SMALLINT",
/* 32 */ "table_name ::= NK_ID", /* 32 */ "type_name ::= INT",
/* 33 */ "column_name ::= NK_ID", /* 33 */ "type_name ::= INTEGER",
/* 34 */ "function_name ::= NK_ID", /* 34 */ "type_name ::= BIGINT",
/* 35 */ "table_alias ::= NK_ID", /* 35 */ "type_name ::= FLOAT",
/* 36 */ "column_alias ::= NK_ID", /* 36 */ "type_name ::= DOUBLE",
/* 37 */ "expression ::= literal", /* 37 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
/* 38 */ "expression ::= column_reference", /* 38 */ "type_name ::= TIMESTAMP",
/* 39 */ "expression ::= function_name NK_LP expression_list NK_RP", /* 39 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
/* 40 */ "expression ::= function_name NK_LP NK_STAR NK_RP", /* 40 */ "type_name ::= TINYINT UNSIGNED",
/* 41 */ "expression ::= subquery", /* 41 */ "type_name ::= SMALLINT UNSIGNED",
/* 42 */ "expression ::= NK_LP expression NK_RP", /* 42 */ "type_name ::= INT UNSIGNED",
/* 43 */ "expression ::= NK_PLUS expression", /* 43 */ "type_name ::= BIGINT UNSIGNED",
/* 44 */ "expression ::= NK_MINUS expression", /* 44 */ "type_name ::= JSON",
/* 45 */ "expression ::= expression NK_PLUS expression", /* 45 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
/* 46 */ "expression ::= expression NK_MINUS expression", /* 46 */ "type_name ::= MEDIUMBLOB",
/* 47 */ "expression ::= expression NK_STAR expression", /* 47 */ "type_name ::= BLOB",
/* 48 */ "expression ::= expression NK_SLASH expression", /* 48 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
/* 49 */ "expression ::= expression NK_REM expression", /* 49 */ "type_name ::= DECIMAL",
/* 50 */ "expression_list ::= expression", /* 50 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
/* 51 */ "expression_list ::= expression_list NK_COMMA expression", /* 51 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
/* 52 */ "column_reference ::= column_name", /* 52 */ "table_options ::=",
/* 53 */ "column_reference ::= table_name NK_DOT column_name", /* 53 */ "table_options ::= table_options COMMENT NK_INTEGER",
/* 54 */ "predicate ::= expression compare_op expression", /* 54 */ "table_options ::= table_options KEEP NK_INTEGER",
/* 55 */ "predicate ::= expression BETWEEN expression AND expression", /* 55 */ "table_options ::= table_options TTL NK_INTEGER",
/* 56 */ "predicate ::= expression NOT BETWEEN expression AND expression", /* 56 */ "cmd ::= SHOW DATABASES",
/* 57 */ "predicate ::= expression IS NULL", /* 57 */ "cmd ::= query_expression",
/* 58 */ "predicate ::= expression IS NOT NULL", /* 58 */ "literal ::= NK_INTEGER",
/* 59 */ "predicate ::= expression in_op in_predicate_value", /* 59 */ "literal ::= NK_FLOAT",
/* 60 */ "compare_op ::= NK_LT", /* 60 */ "literal ::= NK_STRING",
/* 61 */ "compare_op ::= NK_GT", /* 61 */ "literal ::= NK_BOOL",
/* 62 */ "compare_op ::= NK_LE", /* 62 */ "literal ::= TIMESTAMP NK_STRING",
/* 63 */ "compare_op ::= NK_GE", /* 63 */ "literal ::= duration_literal",
/* 64 */ "compare_op ::= NK_NE", /* 64 */ "duration_literal ::= NK_VARIABLE",
/* 65 */ "compare_op ::= NK_EQ", /* 65 */ "literal_list ::= literal",
/* 66 */ "compare_op ::= LIKE", /* 66 */ "literal_list ::= literal_list NK_COMMA literal",
/* 67 */ "compare_op ::= NOT LIKE", /* 67 */ "db_name ::= NK_ID",
/* 68 */ "compare_op ::= MATCH", /* 68 */ "table_name ::= NK_ID",
/* 69 */ "compare_op ::= NMATCH", /* 69 */ "column_name ::= NK_ID",
/* 70 */ "in_op ::= IN", /* 70 */ "function_name ::= NK_ID",
/* 71 */ "in_op ::= NOT IN", /* 71 */ "table_alias ::= NK_ID",
/* 72 */ "in_predicate_value ::= NK_LP expression_list NK_RP", /* 72 */ "column_alias ::= NK_ID",
/* 73 */ "boolean_value_expression ::= boolean_primary", /* 73 */ "expression ::= literal",
/* 74 */ "boolean_value_expression ::= NOT boolean_primary", /* 74 */ "expression ::= column_reference",
/* 75 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", /* 75 */ "expression ::= function_name NK_LP expression_list NK_RP",
/* 76 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", /* 76 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
/* 77 */ "boolean_primary ::= predicate", /* 77 */ "expression ::= subquery",
/* 78 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", /* 78 */ "expression ::= NK_LP expression NK_RP",
/* 79 */ "common_expression ::= expression", /* 79 */ "expression ::= NK_PLUS expression",
/* 80 */ "common_expression ::= boolean_value_expression", /* 80 */ "expression ::= NK_MINUS expression",
/* 81 */ "from_clause ::= FROM table_reference_list", /* 81 */ "expression ::= expression NK_PLUS expression",
/* 82 */ "table_reference_list ::= table_reference", /* 82 */ "expression ::= expression NK_MINUS expression",
/* 83 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", /* 83 */ "expression ::= expression NK_STAR expression",
/* 84 */ "table_reference ::= table_primary", /* 84 */ "expression ::= expression NK_SLASH expression",
/* 85 */ "table_reference ::= joined_table", /* 85 */ "expression ::= expression NK_REM expression",
/* 86 */ "table_primary ::= table_name alias_opt", /* 86 */ "expression_list ::= expression",
/* 87 */ "table_primary ::= db_name NK_DOT table_name alias_opt", /* 87 */ "expression_list ::= expression_list NK_COMMA expression",
/* 88 */ "table_primary ::= subquery alias_opt", /* 88 */ "column_reference ::= column_name",
/* 89 */ "table_primary ::= parenthesized_joined_table", /* 89 */ "column_reference ::= table_name NK_DOT column_name",
/* 90 */ "alias_opt ::=", /* 90 */ "predicate ::= expression compare_op expression",
/* 91 */ "alias_opt ::= table_alias", /* 91 */ "predicate ::= expression BETWEEN expression AND expression",
/* 92 */ "alias_opt ::= AS table_alias", /* 92 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 93 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", /* 93 */ "predicate ::= expression IS NULL",
/* 94 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", /* 94 */ "predicate ::= expression IS NOT NULL",
/* 95 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", /* 95 */ "predicate ::= expression in_op in_predicate_value",
/* 96 */ "join_type ::=", /* 96 */ "compare_op ::= NK_LT",
/* 97 */ "join_type ::= INNER", /* 97 */ "compare_op ::= NK_GT",
/* 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", /* 98 */ "compare_op ::= NK_LE",
/* 99 */ "set_quantifier_opt ::=", /* 99 */ "compare_op ::= NK_GE",
/* 100 */ "set_quantifier_opt ::= DISTINCT", /* 100 */ "compare_op ::= NK_NE",
/* 101 */ "set_quantifier_opt ::= ALL", /* 101 */ "compare_op ::= NK_EQ",
/* 102 */ "select_list ::= NK_STAR", /* 102 */ "compare_op ::= LIKE",
/* 103 */ "select_list ::= select_sublist", /* 103 */ "compare_op ::= NOT LIKE",
/* 104 */ "select_sublist ::= select_item", /* 104 */ "compare_op ::= MATCH",
/* 105 */ "select_sublist ::= select_sublist NK_COMMA select_item", /* 105 */ "compare_op ::= NMATCH",
/* 106 */ "select_item ::= common_expression", /* 106 */ "in_op ::= IN",
/* 107 */ "select_item ::= common_expression column_alias", /* 107 */ "in_op ::= NOT IN",
/* 108 */ "select_item ::= common_expression AS column_alias", /* 108 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 109 */ "select_item ::= table_name NK_DOT NK_STAR", /* 109 */ "boolean_value_expression ::= boolean_primary",
/* 110 */ "where_clause_opt ::=", /* 110 */ "boolean_value_expression ::= NOT boolean_primary",
/* 111 */ "where_clause_opt ::= WHERE search_condition", /* 111 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 112 */ "partition_by_clause_opt ::=", /* 112 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 113 */ "partition_by_clause_opt ::= PARTITION BY expression_list", /* 113 */ "boolean_primary ::= predicate",
/* 114 */ "twindow_clause_opt ::=", /* 114 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 115 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP", /* 115 */ "common_expression ::= expression",
/* 116 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", /* 116 */ "common_expression ::= boolean_value_expression",
/* 117 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", /* 117 */ "from_clause ::= FROM table_reference_list",
/* 118 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", /* 118 */ "table_reference_list ::= table_reference",
/* 119 */ "sliding_opt ::=", /* 119 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 120 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", /* 120 */ "table_reference ::= table_primary",
/* 121 */ "fill_opt ::=", /* 121 */ "table_reference ::= joined_table",
/* 122 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", /* 122 */ "table_primary ::= table_name alias_opt",
/* 123 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", /* 123 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 124 */ "fill_mode ::= NONE", /* 124 */ "table_primary ::= subquery alias_opt",
/* 125 */ "fill_mode ::= PREV", /* 125 */ "table_primary ::= parenthesized_joined_table",
/* 126 */ "fill_mode ::= NULL", /* 126 */ "alias_opt ::=",
/* 127 */ "fill_mode ::= LINEAR", /* 127 */ "alias_opt ::= table_alias",
/* 128 */ "fill_mode ::= NEXT", /* 128 */ "alias_opt ::= AS table_alias",
/* 129 */ "group_by_clause_opt ::=", /* 129 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 130 */ "group_by_clause_opt ::= GROUP BY group_by_list", /* 130 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 131 */ "group_by_list ::= expression", /* 131 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 132 */ "group_by_list ::= group_by_list NK_COMMA expression", /* 132 */ "join_type ::=",
/* 133 */ "having_clause_opt ::=", /* 133 */ "join_type ::= INNER",
/* 134 */ "having_clause_opt ::= HAVING search_condition", /* 134 */ "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",
/* 135 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", /* 135 */ "set_quantifier_opt ::=",
/* 136 */ "query_expression_body ::= query_primary", /* 136 */ "set_quantifier_opt ::= DISTINCT",
/* 137 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", /* 137 */ "set_quantifier_opt ::= ALL",
/* 138 */ "query_primary ::= query_specification", /* 138 */ "select_list ::= NK_STAR",
/* 139 */ "order_by_clause_opt ::=", /* 139 */ "select_list ::= select_sublist",
/* 140 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", /* 140 */ "select_sublist ::= select_item",
/* 141 */ "slimit_clause_opt ::=", /* 141 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 142 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", /* 142 */ "select_item ::= common_expression",
/* 143 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", /* 143 */ "select_item ::= common_expression column_alias",
/* 144 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", /* 144 */ "select_item ::= common_expression AS column_alias",
/* 145 */ "limit_clause_opt ::=", /* 145 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 146 */ "limit_clause_opt ::= LIMIT NK_INTEGER", /* 146 */ "where_clause_opt ::=",
/* 147 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", /* 147 */ "where_clause_opt ::= WHERE search_condition",
/* 148 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", /* 148 */ "partition_by_clause_opt ::=",
/* 149 */ "subquery ::= NK_LP query_expression NK_RP", /* 149 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 150 */ "search_condition ::= common_expression", /* 150 */ "twindow_clause_opt ::=",
/* 151 */ "sort_specification_list ::= sort_specification", /* 151 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
/* 152 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", /* 152 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
/* 153 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", /* 153 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 154 */ "ordering_specification_opt ::=", /* 154 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 155 */ "ordering_specification_opt ::= ASC", /* 155 */ "sliding_opt ::=",
/* 156 */ "ordering_specification_opt ::= DESC", /* 156 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 157 */ "null_ordering_opt ::=", /* 157 */ "fill_opt ::=",
/* 158 */ "null_ordering_opt ::= NULLS FIRST", /* 158 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 159 */ "null_ordering_opt ::= NULLS LAST", /* 159 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 160 */ "fill_mode ::= NONE",
/* 161 */ "fill_mode ::= PREV",
/* 162 */ "fill_mode ::= NULL",
/* 163 */ "fill_mode ::= LINEAR",
/* 164 */ "fill_mode ::= NEXT",
/* 165 */ "group_by_clause_opt ::=",
/* 166 */ "group_by_clause_opt ::= GROUP BY group_by_list",
/* 167 */ "group_by_list ::= expression",
/* 168 */ "group_by_list ::= group_by_list NK_COMMA expression",
/* 169 */ "having_clause_opt ::=",
/* 170 */ "having_clause_opt ::= HAVING search_condition",
/* 171 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 172 */ "query_expression_body ::= query_primary",
/* 173 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 174 */ "query_primary ::= query_specification",
/* 175 */ "order_by_clause_opt ::=",
/* 176 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 177 */ "slimit_clause_opt ::=",
/* 178 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 179 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 180 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 181 */ "limit_clause_opt ::=",
/* 182 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 183 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 184 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 185 */ "subquery ::= NK_LP query_expression NK_RP",
/* 186 */ "search_condition ::= common_expression",
/* 187 */ "sort_specification_list ::= sort_specification",
/* 188 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 189 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 190 */ "ordering_specification_opt ::=",
/* 191 */ "ordering_specification_opt ::= ASC",
/* 192 */ "ordering_specification_opt ::= DESC",
/* 193 */ "null_ordering_opt ::=",
/* 194 */ "null_ordering_opt ::= NULLS FIRST",
/* 195 */ "null_ordering_opt ::= NULLS LAST",
}; };
#endif /* NDEBUG */ #endif /* NDEBUG */
...@@ -977,98 +1083,119 @@ static void yy_destructor( ...@@ -977,98 +1083,119 @@ static void yy_destructor(
*/ */
/********* Begin destructor definitions ***************************************/ /********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */ /* Default NON-TERMINAL Destructor */
case 96: /* cmd */ case 118: /* cmd */
case 97: /* exists_opt */ case 119: /* exists_opt */
case 100: /* query_expression */ case 125: /* column_def */
case 101: /* literal */ case 128: /* query_expression */
case 102: /* duration_literal */ case 129: /* literal */
case 109: /* expression */ case 130: /* duration_literal */
case 110: /* column_reference */ case 136: /* expression */
case 112: /* subquery */ case 137: /* column_reference */
case 113: /* predicate */ case 139: /* subquery */
case 116: /* in_predicate_value */ case 140: /* predicate */
case 117: /* boolean_value_expression */ case 143: /* in_predicate_value */
case 118: /* boolean_primary */ case 144: /* boolean_value_expression */
case 119: /* common_expression */ case 145: /* boolean_primary */
case 120: /* from_clause */ case 146: /* common_expression */
case 121: /* table_reference_list */ case 147: /* from_clause */
case 122: /* table_reference */ case 148: /* table_reference_list */
case 123: /* table_primary */ case 149: /* table_reference */
case 124: /* joined_table */ case 150: /* table_primary */
case 126: /* parenthesized_joined_table */ case 151: /* joined_table */
case 128: /* search_condition */ case 153: /* parenthesized_joined_table */
case 129: /* query_specification */ case 155: /* search_condition */
case 132: /* where_clause_opt */ case 156: /* query_specification */
case 134: /* twindow_clause_opt */ case 159: /* where_clause_opt */
case 136: /* having_clause_opt */ case 161: /* twindow_clause_opt */
case 138: /* select_item */ case 163: /* having_clause_opt */
case 139: /* sliding_opt */ case 165: /* select_item */
case 140: /* fill_opt */ case 166: /* sliding_opt */
case 143: /* query_expression_body */ case 167: /* fill_opt */
case 145: /* slimit_clause_opt */ case 170: /* query_expression_body */
case 146: /* limit_clause_opt */ case 172: /* slimit_clause_opt */
case 147: /* query_primary */ case 173: /* limit_clause_opt */
case 149: /* sort_specification */ case 174: /* query_primary */
case 176: /* sort_specification */
{ {
PARSER_DESTRUCTOR_TRACE; nodesDestroyNode((yypminor->yy104)); PARSER_DESTRUCTOR_TRACE; nodesDestroyNode((yypminor->yy172));
} }
break; break;
case 98: /* db_name */ case 120: /* db_name */
case 104: /* table_name */ case 126: /* column_name */
case 105: /* column_name */ case 132: /* table_name */
case 106: /* function_name */ case 133: /* function_name */
case 107: /* table_alias */ case 134: /* table_alias */
case 108: /* column_alias */ case 135: /* column_alias */
case 125: /* alias_opt */ case 152: /* alias_opt */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
break; break;
case 99: /* db_options */ case 121: /* db_options */
{ {
tfree((yypminor->yy87)); tfree((yypminor->yy27));
} }
break; break;
case 103: /* literal_list */ case 122: /* full_table_name */
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 123: /* column_def_list */
{
nodesDestroyList((yypminor->yy60));
} }
break; break;
case 114: /* compare_op */ case 124: /* table_options */
case 115: /* in_op */ {
tfree((yypminor->yy40));
}
break;
case 127: /* type_name */
{
}
break;
case 131: /* literal_list */
case 138: /* expression_list */
case 158: /* select_list */
case 160: /* partition_by_clause_opt */
case 162: /* group_by_clause_opt */
case 164: /* select_sublist */
case 169: /* group_by_list */
case 171: /* order_by_clause_opt */
case 175: /* sort_specification_list */
{
PARSER_DESTRUCTOR_TRACE; nodesDestroyList((yypminor->yy60));
}
break;
case 141: /* compare_op */
case 142: /* in_op */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
break; break;
case 127: /* join_type */ case 154: /* join_type */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
break; break;
case 130: /* set_quantifier_opt */ case 157: /* set_quantifier_opt */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
break; break;
case 141: /* fill_mode */ case 168: /* fill_mode */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
break; break;
case 150: /* ordering_specification_opt */ case 177: /* ordering_specification_opt */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
break; break;
case 151: /* null_ordering_opt */ case 178: /* null_ordering_opt */
{ {
PARSER_DESTRUCTOR_TRACE; PARSER_DESTRUCTOR_TRACE;
} }
...@@ -1367,166 +1494,202 @@ static const struct { ...@@ -1367,166 +1494,202 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = { } yyRuleInfo[] = {
{ 96, -5 }, /* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */ { 118, -5 }, /* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */
{ 97, -3 }, /* (1) exists_opt ::= IF NOT EXISTS */ { 119, -3 }, /* (1) exists_opt ::= IF NOT EXISTS */
{ 97, 0 }, /* (2) exists_opt ::= */ { 119, 0 }, /* (2) exists_opt ::= */
{ 99, 0 }, /* (3) db_options ::= */ { 121, 0 }, /* (3) db_options ::= */
{ 99, -3 }, /* (4) db_options ::= db_options BLOCKS NK_INTEGER */ { 121, -3 }, /* (4) db_options ::= db_options BLOCKS NK_INTEGER */
{ 99, -3 }, /* (5) db_options ::= db_options CACHE NK_INTEGER */ { 121, -3 }, /* (5) db_options ::= db_options CACHE NK_INTEGER */
{ 99, -3 }, /* (6) db_options ::= db_options CACHELAST NK_INTEGER */ { 121, -3 }, /* (6) db_options ::= db_options CACHELAST NK_INTEGER */
{ 99, -3 }, /* (7) db_options ::= db_options COMP NK_INTEGER */ { 121, -3 }, /* (7) db_options ::= db_options COMP NK_INTEGER */
{ 99, -3 }, /* (8) db_options ::= db_options DAYS NK_INTEGER */ { 121, -3 }, /* (8) db_options ::= db_options DAYS NK_INTEGER */
{ 99, -3 }, /* (9) db_options ::= db_options FSYNC NK_INTEGER */ { 121, -3 }, /* (9) db_options ::= db_options FSYNC NK_INTEGER */
{ 99, -3 }, /* (10) db_options ::= db_options MAXROWS NK_INTEGER */ { 121, -3 }, /* (10) db_options ::= db_options MAXROWS NK_INTEGER */
{ 99, -3 }, /* (11) db_options ::= db_options MINROWS NK_INTEGER */ { 121, -3 }, /* (11) db_options ::= db_options MINROWS NK_INTEGER */
{ 99, -3 }, /* (12) db_options ::= db_options KEEP NK_INTEGER */ { 121, -3 }, /* (12) db_options ::= db_options KEEP NK_INTEGER */
{ 99, -3 }, /* (13) db_options ::= db_options PRECISION NK_STRING */ { 121, -3 }, /* (13) db_options ::= db_options PRECISION NK_STRING */
{ 99, -3 }, /* (14) db_options ::= db_options QUORUM NK_INTEGER */ { 121, -3 }, /* (14) db_options ::= db_options QUORUM NK_INTEGER */
{ 99, -3 }, /* (15) db_options ::= db_options REPLICA NK_INTEGER */ { 121, -3 }, /* (15) db_options ::= db_options REPLICA NK_INTEGER */
{ 99, -3 }, /* (16) db_options ::= db_options TTL NK_INTEGER */ { 121, -3 }, /* (16) db_options ::= db_options TTL NK_INTEGER */
{ 99, -3 }, /* (17) db_options ::= db_options WAL NK_INTEGER */ { 121, -3 }, /* (17) db_options ::= db_options WAL NK_INTEGER */
{ 99, -3 }, /* (18) db_options ::= db_options VGROUPS NK_INTEGER */ { 121, -3 }, /* (18) db_options ::= db_options VGROUPS NK_INTEGER */
{ 99, -3 }, /* (19) db_options ::= db_options SINGLESTABLE NK_INTEGER */ { 121, -3 }, /* (19) db_options ::= db_options SINGLESTABLE NK_INTEGER */
{ 99, -3 }, /* (20) db_options ::= db_options STREAMMODE NK_INTEGER */ { 121, -3 }, /* (20) db_options ::= db_options STREAMMODE NK_INTEGER */
{ 96, -1 }, /* (21) cmd ::= query_expression */ { 118, -2 }, /* (21) cmd ::= USE db_name */
{ 101, -1 }, /* (22) literal ::= NK_INTEGER */ { 118, -8 }, /* (22) cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options */
{ 101, -1 }, /* (23) literal ::= NK_FLOAT */ { 122, -1 }, /* (23) full_table_name ::= NK_ID */
{ 101, -1 }, /* (24) literal ::= NK_STRING */ { 122, -3 }, /* (24) full_table_name ::= NK_ID NK_DOT NK_ID */
{ 101, -1 }, /* (25) literal ::= NK_BOOL */ { 123, -1 }, /* (25) column_def_list ::= column_def */
{ 101, -2 }, /* (26) literal ::= TIMESTAMP NK_STRING */ { 123, -3 }, /* (26) column_def_list ::= column_def_list NK_COMMA column_def */
{ 101, -1 }, /* (27) literal ::= duration_literal */ { 125, -2 }, /* (27) column_def ::= column_name type_name */
{ 102, -1 }, /* (28) duration_literal ::= NK_VARIABLE */ { 125, -4 }, /* (28) column_def ::= column_name type_name COMMENT NK_STRING */
{ 103, -1 }, /* (29) literal_list ::= literal */ { 127, -1 }, /* (29) type_name ::= BOOL */
{ 103, -3 }, /* (30) literal_list ::= literal_list NK_COMMA literal */ { 127, -1 }, /* (30) type_name ::= TINYINT */
{ 98, -1 }, /* (31) db_name ::= NK_ID */ { 127, -1 }, /* (31) type_name ::= SMALLINT */
{ 104, -1 }, /* (32) table_name ::= NK_ID */ { 127, -1 }, /* (32) type_name ::= INT */
{ 105, -1 }, /* (33) column_name ::= NK_ID */ { 127, -1 }, /* (33) type_name ::= INTEGER */
{ 106, -1 }, /* (34) function_name ::= NK_ID */ { 127, -1 }, /* (34) type_name ::= BIGINT */
{ 107, -1 }, /* (35) table_alias ::= NK_ID */ { 127, -1 }, /* (35) type_name ::= FLOAT */
{ 108, -1 }, /* (36) column_alias ::= NK_ID */ { 127, -1 }, /* (36) type_name ::= DOUBLE */
{ 109, -1 }, /* (37) expression ::= literal */ { 127, -4 }, /* (37) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
{ 109, -1 }, /* (38) expression ::= column_reference */ { 127, -1 }, /* (38) type_name ::= TIMESTAMP */
{ 109, -4 }, /* (39) expression ::= function_name NK_LP expression_list NK_RP */ { 127, -4 }, /* (39) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
{ 109, -4 }, /* (40) expression ::= function_name NK_LP NK_STAR NK_RP */ { 127, -2 }, /* (40) type_name ::= TINYINT UNSIGNED */
{ 109, -1 }, /* (41) expression ::= subquery */ { 127, -2 }, /* (41) type_name ::= SMALLINT UNSIGNED */
{ 109, -3 }, /* (42) expression ::= NK_LP expression NK_RP */ { 127, -2 }, /* (42) type_name ::= INT UNSIGNED */
{ 109, -2 }, /* (43) expression ::= NK_PLUS expression */ { 127, -2 }, /* (43) type_name ::= BIGINT UNSIGNED */
{ 109, -2 }, /* (44) expression ::= NK_MINUS expression */ { 127, -1 }, /* (44) type_name ::= JSON */
{ 109, -3 }, /* (45) expression ::= expression NK_PLUS expression */ { 127, -4 }, /* (45) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
{ 109, -3 }, /* (46) expression ::= expression NK_MINUS expression */ { 127, -1 }, /* (46) type_name ::= MEDIUMBLOB */
{ 109, -3 }, /* (47) expression ::= expression NK_STAR expression */ { 127, -1 }, /* (47) type_name ::= BLOB */
{ 109, -3 }, /* (48) expression ::= expression NK_SLASH expression */ { 127, -4 }, /* (48) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
{ 109, -3 }, /* (49) expression ::= expression NK_REM expression */ { 127, -1 }, /* (49) type_name ::= DECIMAL */
{ 111, -1 }, /* (50) expression_list ::= expression */ { 127, -4 }, /* (50) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
{ 111, -3 }, /* (51) expression_list ::= expression_list NK_COMMA expression */ { 127, -6 }, /* (51) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
{ 110, -1 }, /* (52) column_reference ::= column_name */ { 124, 0 }, /* (52) table_options ::= */
{ 110, -3 }, /* (53) column_reference ::= table_name NK_DOT column_name */ { 124, -3 }, /* (53) table_options ::= table_options COMMENT NK_INTEGER */
{ 113, -3 }, /* (54) predicate ::= expression compare_op expression */ { 124, -3 }, /* (54) table_options ::= table_options KEEP NK_INTEGER */
{ 113, -5 }, /* (55) predicate ::= expression BETWEEN expression AND expression */ { 124, -3 }, /* (55) table_options ::= table_options TTL NK_INTEGER */
{ 113, -6 }, /* (56) predicate ::= expression NOT BETWEEN expression AND expression */ { 118, -2 }, /* (56) cmd ::= SHOW DATABASES */
{ 113, -3 }, /* (57) predicate ::= expression IS NULL */ { 118, -1 }, /* (57) cmd ::= query_expression */
{ 113, -4 }, /* (58) predicate ::= expression IS NOT NULL */ { 129, -1 }, /* (58) literal ::= NK_INTEGER */
{ 113, -3 }, /* (59) predicate ::= expression in_op in_predicate_value */ { 129, -1 }, /* (59) literal ::= NK_FLOAT */
{ 114, -1 }, /* (60) compare_op ::= NK_LT */ { 129, -1 }, /* (60) literal ::= NK_STRING */
{ 114, -1 }, /* (61) compare_op ::= NK_GT */ { 129, -1 }, /* (61) literal ::= NK_BOOL */
{ 114, -1 }, /* (62) compare_op ::= NK_LE */ { 129, -2 }, /* (62) literal ::= TIMESTAMP NK_STRING */
{ 114, -1 }, /* (63) compare_op ::= NK_GE */ { 129, -1 }, /* (63) literal ::= duration_literal */
{ 114, -1 }, /* (64) compare_op ::= NK_NE */ { 130, -1 }, /* (64) duration_literal ::= NK_VARIABLE */
{ 114, -1 }, /* (65) compare_op ::= NK_EQ */ { 131, -1 }, /* (65) literal_list ::= literal */
{ 114, -1 }, /* (66) compare_op ::= LIKE */ { 131, -3 }, /* (66) literal_list ::= literal_list NK_COMMA literal */
{ 114, -2 }, /* (67) compare_op ::= NOT LIKE */ { 120, -1 }, /* (67) db_name ::= NK_ID */
{ 114, -1 }, /* (68) compare_op ::= MATCH */ { 132, -1 }, /* (68) table_name ::= NK_ID */
{ 114, -1 }, /* (69) compare_op ::= NMATCH */ { 126, -1 }, /* (69) column_name ::= NK_ID */
{ 115, -1 }, /* (70) in_op ::= IN */ { 133, -1 }, /* (70) function_name ::= NK_ID */
{ 115, -2 }, /* (71) in_op ::= NOT IN */ { 134, -1 }, /* (71) table_alias ::= NK_ID */
{ 116, -3 }, /* (72) in_predicate_value ::= NK_LP expression_list NK_RP */ { 135, -1 }, /* (72) column_alias ::= NK_ID */
{ 117, -1 }, /* (73) boolean_value_expression ::= boolean_primary */ { 136, -1 }, /* (73) expression ::= literal */
{ 117, -2 }, /* (74) boolean_value_expression ::= NOT boolean_primary */ { 136, -1 }, /* (74) expression ::= column_reference */
{ 117, -3 }, /* (75) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { 136, -4 }, /* (75) expression ::= function_name NK_LP expression_list NK_RP */
{ 117, -3 }, /* (76) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { 136, -4 }, /* (76) expression ::= function_name NK_LP NK_STAR NK_RP */
{ 118, -1 }, /* (77) boolean_primary ::= predicate */ { 136, -1 }, /* (77) expression ::= subquery */
{ 118, -3 }, /* (78) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ { 136, -3 }, /* (78) expression ::= NK_LP expression NK_RP */
{ 119, -1 }, /* (79) common_expression ::= expression */ { 136, -2 }, /* (79) expression ::= NK_PLUS expression */
{ 119, -1 }, /* (80) common_expression ::= boolean_value_expression */ { 136, -2 }, /* (80) expression ::= NK_MINUS expression */
{ 120, -2 }, /* (81) from_clause ::= FROM table_reference_list */ { 136, -3 }, /* (81) expression ::= expression NK_PLUS expression */
{ 121, -1 }, /* (82) table_reference_list ::= table_reference */ { 136, -3 }, /* (82) expression ::= expression NK_MINUS expression */
{ 121, -3 }, /* (83) table_reference_list ::= table_reference_list NK_COMMA table_reference */ { 136, -3 }, /* (83) expression ::= expression NK_STAR expression */
{ 122, -1 }, /* (84) table_reference ::= table_primary */ { 136, -3 }, /* (84) expression ::= expression NK_SLASH expression */
{ 122, -1 }, /* (85) table_reference ::= joined_table */ { 136, -3 }, /* (85) expression ::= expression NK_REM expression */
{ 123, -2 }, /* (86) table_primary ::= table_name alias_opt */ { 138, -1 }, /* (86) expression_list ::= expression */
{ 123, -4 }, /* (87) table_primary ::= db_name NK_DOT table_name alias_opt */ { 138, -3 }, /* (87) expression_list ::= expression_list NK_COMMA expression */
{ 123, -2 }, /* (88) table_primary ::= subquery alias_opt */ { 137, -1 }, /* (88) column_reference ::= column_name */
{ 123, -1 }, /* (89) table_primary ::= parenthesized_joined_table */ { 137, -3 }, /* (89) column_reference ::= table_name NK_DOT column_name */
{ 125, 0 }, /* (90) alias_opt ::= */ { 140, -3 }, /* (90) predicate ::= expression compare_op expression */
{ 125, -1 }, /* (91) alias_opt ::= table_alias */ { 140, -5 }, /* (91) predicate ::= expression BETWEEN expression AND expression */
{ 125, -2 }, /* (92) alias_opt ::= AS table_alias */ { 140, -6 }, /* (92) predicate ::= expression NOT BETWEEN expression AND expression */
{ 126, -3 }, /* (93) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ { 140, -3 }, /* (93) predicate ::= expression IS NULL */
{ 126, -3 }, /* (94) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ { 140, -4 }, /* (94) predicate ::= expression IS NOT NULL */
{ 124, -6 }, /* (95) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { 140, -3 }, /* (95) predicate ::= expression in_op in_predicate_value */
{ 127, 0 }, /* (96) join_type ::= */ { 141, -1 }, /* (96) compare_op ::= NK_LT */
{ 127, -1 }, /* (97) join_type ::= INNER */ { 141, -1 }, /* (97) compare_op ::= NK_GT */
{ 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 */ { 141, -1 }, /* (98) compare_op ::= NK_LE */
{ 130, 0 }, /* (99) set_quantifier_opt ::= */ { 141, -1 }, /* (99) compare_op ::= NK_GE */
{ 130, -1 }, /* (100) set_quantifier_opt ::= DISTINCT */ { 141, -1 }, /* (100) compare_op ::= NK_NE */
{ 130, -1 }, /* (101) set_quantifier_opt ::= ALL */ { 141, -1 }, /* (101) compare_op ::= NK_EQ */
{ 131, -1 }, /* (102) select_list ::= NK_STAR */ { 141, -1 }, /* (102) compare_op ::= LIKE */
{ 131, -1 }, /* (103) select_list ::= select_sublist */ { 141, -2 }, /* (103) compare_op ::= NOT LIKE */
{ 137, -1 }, /* (104) select_sublist ::= select_item */ { 141, -1 }, /* (104) compare_op ::= MATCH */
{ 137, -3 }, /* (105) select_sublist ::= select_sublist NK_COMMA select_item */ { 141, -1 }, /* (105) compare_op ::= NMATCH */
{ 138, -1 }, /* (106) select_item ::= common_expression */ { 142, -1 }, /* (106) in_op ::= IN */
{ 138, -2 }, /* (107) select_item ::= common_expression column_alias */ { 142, -2 }, /* (107) in_op ::= NOT IN */
{ 138, -3 }, /* (108) select_item ::= common_expression AS column_alias */ { 143, -3 }, /* (108) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 138, -3 }, /* (109) select_item ::= table_name NK_DOT NK_STAR */ { 144, -1 }, /* (109) boolean_value_expression ::= boolean_primary */
{ 132, 0 }, /* (110) where_clause_opt ::= */ { 144, -2 }, /* (110) boolean_value_expression ::= NOT boolean_primary */
{ 132, -2 }, /* (111) where_clause_opt ::= WHERE search_condition */ { 144, -3 }, /* (111) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 133, 0 }, /* (112) partition_by_clause_opt ::= */ { 144, -3 }, /* (112) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 133, -3 }, /* (113) partition_by_clause_opt ::= PARTITION BY expression_list */ { 145, -1 }, /* (113) boolean_primary ::= predicate */
{ 134, 0 }, /* (114) twindow_clause_opt ::= */ { 145, -3 }, /* (114) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 134, -6 }, /* (115) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */ { 146, -1 }, /* (115) common_expression ::= expression */
{ 134, -4 }, /* (116) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ { 146, -1 }, /* (116) common_expression ::= boolean_value_expression */
{ 134, -6 }, /* (117) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { 147, -2 }, /* (117) from_clause ::= FROM table_reference_list */
{ 134, -8 }, /* (118) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { 148, -1 }, /* (118) table_reference_list ::= table_reference */
{ 139, 0 }, /* (119) sliding_opt ::= */ { 148, -3 }, /* (119) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 139, -4 }, /* (120) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { 149, -1 }, /* (120) table_reference ::= table_primary */
{ 140, 0 }, /* (121) fill_opt ::= */ { 149, -1 }, /* (121) table_reference ::= joined_table */
{ 140, -4 }, /* (122) fill_opt ::= FILL NK_LP fill_mode NK_RP */ { 150, -2 }, /* (122) table_primary ::= table_name alias_opt */
{ 140, -6 }, /* (123) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { 150, -4 }, /* (123) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 141, -1 }, /* (124) fill_mode ::= NONE */ { 150, -2 }, /* (124) table_primary ::= subquery alias_opt */
{ 141, -1 }, /* (125) fill_mode ::= PREV */ { 150, -1 }, /* (125) table_primary ::= parenthesized_joined_table */
{ 141, -1 }, /* (126) fill_mode ::= NULL */ { 152, 0 }, /* (126) alias_opt ::= */
{ 141, -1 }, /* (127) fill_mode ::= LINEAR */ { 152, -1 }, /* (127) alias_opt ::= table_alias */
{ 141, -1 }, /* (128) fill_mode ::= NEXT */ { 152, -2 }, /* (128) alias_opt ::= AS table_alias */
{ 135, 0 }, /* (129) group_by_clause_opt ::= */ { 153, -3 }, /* (129) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 135, -3 }, /* (130) group_by_clause_opt ::= GROUP BY group_by_list */ { 153, -3 }, /* (130) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 142, -1 }, /* (131) group_by_list ::= expression */ { 151, -6 }, /* (131) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 142, -3 }, /* (132) group_by_list ::= group_by_list NK_COMMA expression */ { 154, 0 }, /* (132) join_type ::= */
{ 136, 0 }, /* (133) having_clause_opt ::= */ { 154, -1 }, /* (133) join_type ::= INNER */
{ 136, -2 }, /* (134) having_clause_opt ::= HAVING search_condition */ { 156, -9 }, /* (134) 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 */
{ 100, -4 }, /* (135) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { 157, 0 }, /* (135) set_quantifier_opt ::= */
{ 143, -1 }, /* (136) query_expression_body ::= query_primary */ { 157, -1 }, /* (136) set_quantifier_opt ::= DISTINCT */
{ 143, -4 }, /* (137) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { 157, -1 }, /* (137) set_quantifier_opt ::= ALL */
{ 147, -1 }, /* (138) query_primary ::= query_specification */ { 158, -1 }, /* (138) select_list ::= NK_STAR */
{ 144, 0 }, /* (139) order_by_clause_opt ::= */ { 158, -1 }, /* (139) select_list ::= select_sublist */
{ 144, -3 }, /* (140) order_by_clause_opt ::= ORDER BY sort_specification_list */ { 164, -1 }, /* (140) select_sublist ::= select_item */
{ 145, 0 }, /* (141) slimit_clause_opt ::= */ { 164, -3 }, /* (141) select_sublist ::= select_sublist NK_COMMA select_item */
{ 145, -2 }, /* (142) slimit_clause_opt ::= SLIMIT NK_INTEGER */ { 165, -1 }, /* (142) select_item ::= common_expression */
{ 145, -4 }, /* (143) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ { 165, -2 }, /* (143) select_item ::= common_expression column_alias */
{ 145, -4 }, /* (144) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ { 165, -3 }, /* (144) select_item ::= common_expression AS column_alias */
{ 146, 0 }, /* (145) limit_clause_opt ::= */ { 165, -3 }, /* (145) select_item ::= table_name NK_DOT NK_STAR */
{ 146, -2 }, /* (146) limit_clause_opt ::= LIMIT NK_INTEGER */ { 159, 0 }, /* (146) where_clause_opt ::= */
{ 146, -4 }, /* (147) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ { 159, -2 }, /* (147) where_clause_opt ::= WHERE search_condition */
{ 146, -4 }, /* (148) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ { 160, 0 }, /* (148) partition_by_clause_opt ::= */
{ 112, -3 }, /* (149) subquery ::= NK_LP query_expression NK_RP */ { 160, -3 }, /* (149) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 128, -1 }, /* (150) search_condition ::= common_expression */ { 161, 0 }, /* (150) twindow_clause_opt ::= */
{ 148, -1 }, /* (151) sort_specification_list ::= sort_specification */ { 161, -6 }, /* (151) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ 148, -3 }, /* (152) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ { 161, -4 }, /* (152) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ 149, -3 }, /* (153) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { 161, -6 }, /* (153) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 150, 0 }, /* (154) ordering_specification_opt ::= */ { 161, -8 }, /* (154) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 150, -1 }, /* (155) ordering_specification_opt ::= ASC */ { 166, 0 }, /* (155) sliding_opt ::= */
{ 150, -1 }, /* (156) ordering_specification_opt ::= DESC */ { 166, -4 }, /* (156) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 151, 0 }, /* (157) null_ordering_opt ::= */ { 167, 0 }, /* (157) fill_opt ::= */
{ 151, -2 }, /* (158) null_ordering_opt ::= NULLS FIRST */ { 167, -4 }, /* (158) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 151, -2 }, /* (159) null_ordering_opt ::= NULLS LAST */ { 167, -6 }, /* (159) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 168, -1 }, /* (160) fill_mode ::= NONE */
{ 168, -1 }, /* (161) fill_mode ::= PREV */
{ 168, -1 }, /* (162) fill_mode ::= NULL */
{ 168, -1 }, /* (163) fill_mode ::= LINEAR */
{ 168, -1 }, /* (164) fill_mode ::= NEXT */
{ 162, 0 }, /* (165) group_by_clause_opt ::= */
{ 162, -3 }, /* (166) group_by_clause_opt ::= GROUP BY group_by_list */
{ 169, -1 }, /* (167) group_by_list ::= expression */
{ 169, -3 }, /* (168) group_by_list ::= group_by_list NK_COMMA expression */
{ 163, 0 }, /* (169) having_clause_opt ::= */
{ 163, -2 }, /* (170) having_clause_opt ::= HAVING search_condition */
{ 128, -4 }, /* (171) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 170, -1 }, /* (172) query_expression_body ::= query_primary */
{ 170, -4 }, /* (173) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 174, -1 }, /* (174) query_primary ::= query_specification */
{ 171, 0 }, /* (175) order_by_clause_opt ::= */
{ 171, -3 }, /* (176) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 172, 0 }, /* (177) slimit_clause_opt ::= */
{ 172, -2 }, /* (178) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 172, -4 }, /* (179) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 172, -4 }, /* (180) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 173, 0 }, /* (181) limit_clause_opt ::= */
{ 173, -2 }, /* (182) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 173, -4 }, /* (183) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 173, -4 }, /* (184) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 139, -3 }, /* (185) subquery ::= NK_LP query_expression NK_RP */
{ 155, -1 }, /* (186) search_condition ::= common_expression */
{ 175, -1 }, /* (187) sort_specification_list ::= sort_specification */
{ 175, -3 }, /* (188) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 176, -3 }, /* (189) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 177, 0 }, /* (190) ordering_specification_opt ::= */
{ 177, -1 }, /* (191) ordering_specification_opt ::= ASC */
{ 177, -1 }, /* (192) ordering_specification_opt ::= DESC */
{ 178, 0 }, /* (193) null_ordering_opt ::= */
{ 178, -2 }, /* (194) null_ordering_opt ::= NULLS FIRST */
{ 178, -2 }, /* (195) null_ordering_opt ::= NULLS LAST */
}; };
static void yy_accept(yyParser*); /* Forward Declaration */ static void yy_accept(yyParser*); /* Forward Declaration */
...@@ -1614,562 +1777,677 @@ static YYACTIONTYPE yy_reduce( ...@@ -1614,562 +1777,677 @@ static YYACTIONTYPE yy_reduce(
/********** Begin reduce actions **********************************************/ /********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor; YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE DATABASE exists_opt db_name db_options */ 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);} { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy105, yymsp[0].minor.yy27);}
break; break;
case 1: /* exists_opt ::= IF NOT EXISTS */ case 1: /* exists_opt ::= IF NOT EXISTS */
{ yymsp[-2].minor.yy185 = true; } { yymsp[-2].minor.yy259 = true; }
break; break;
case 2: /* exists_opt ::= */ case 2: /* exists_opt ::= */
{ yymsp[1].minor.yy185 = false; } { yymsp[1].minor.yy259 = false; }
break; break;
case 3: /* db_options ::= */ case 3: /* db_options ::= */
{ yymsp[1].minor.yy87 = createDefaultDatabaseOptions(pCxt);} { yymsp[1].minor.yy27 = createDefaultDatabaseOptions(pCxt); }
break; break;
case 4: /* db_options ::= db_options BLOCKS NK_INTEGER */ case 4: /* db_options ::= db_options BLOCKS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 5: /* db_options ::= db_options CACHE NK_INTEGER */ case 5: /* db_options ::= db_options CACHE NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_CACHE, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 6: /* db_options ::= db_options CACHELAST NK_INTEGER */ case 6: /* db_options ::= db_options CACHELAST NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 7: /* db_options ::= db_options COMP NK_INTEGER */ case 7: /* db_options ::= db_options COMP NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_COMP, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 8: /* db_options ::= db_options DAYS NK_INTEGER */ case 8: /* db_options ::= db_options DAYS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 9: /* db_options ::= db_options FSYNC NK_INTEGER */ case 9: /* db_options ::= db_options FSYNC NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 10: /* db_options ::= db_options MAXROWS NK_INTEGER */ case 10: /* db_options ::= db_options MAXROWS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 11: /* db_options ::= db_options MINROWS NK_INTEGER */ case 11: /* db_options ::= db_options MINROWS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 12: /* db_options ::= db_options KEEP NK_INTEGER */ case 12: /* db_options ::= db_options KEEP NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_KEEP, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 13: /* db_options ::= db_options PRECISION NK_STRING */ case 13: /* db_options ::= db_options PRECISION NK_STRING */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 14: /* db_options ::= db_options QUORUM NK_INTEGER */ case 14: /* db_options ::= db_options QUORUM NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 15: /* db_options ::= db_options REPLICA NK_INTEGER */ case 15: /* db_options ::= db_options REPLICA NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 16: /* db_options ::= db_options TTL NK_INTEGER */ case 16: /* db_options ::= db_options TTL NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_TTL, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_TTL, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 17: /* db_options ::= db_options WAL NK_INTEGER */ case 17: /* db_options ::= db_options WAL NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_WAL, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 18: /* db_options ::= db_options VGROUPS NK_INTEGER */ case 18: /* db_options ::= db_options VGROUPS NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 19: /* db_options ::= db_options SINGLESTABLE NK_INTEGER */ case 19: /* db_options ::= db_options SINGLESTABLE NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_SINGLESTABLE, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_SINGLESTABLE, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 20: /* db_options ::= db_options STREAMMODE NK_INTEGER */ case 20: /* db_options ::= db_options STREAMMODE NK_INTEGER */
{ yylhsminor.yy87 = setDatabaseOption(pCxt, yymsp[-2].minor.yy87, DB_OPTION_STREAMMODE, &yymsp[0].minor.yy0); } { yylhsminor.yy27 = setDatabaseOption(pCxt, yymsp[-2].minor.yy27, DB_OPTION_STREAMMODE, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy87 = yylhsminor.yy87; yymsp[-2].minor.yy27 = yylhsminor.yy27;
break; break;
case 21: /* cmd ::= query_expression */ case 21: /* cmd ::= USE db_name */
{ PARSER_TRACE; pCxt->pRootNode = yymsp[0].minor.yy104; } { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy105);}
break; break;
case 22: /* literal ::= NK_INTEGER */ case 22: /* cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-5].minor.yy259, &yymsp[-4].minor.yy111, yymsp[-2].minor.yy60, yymsp[0].minor.yy40);}
yymsp[0].minor.yy104 = yylhsminor.yy104; break;
break; case 23: /* full_table_name ::= NK_ID */
case 23: /* literal ::= NK_FLOAT */ { STokenPair t = { .first = yymsp[0].minor.yy0, .second = nil_token}; yylhsminor.yy111 = t; }
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy111 = yylhsminor.yy111;
yymsp[0].minor.yy104 = yylhsminor.yy104; break;
break; case 24: /* full_table_name ::= NK_ID NK_DOT NK_ID */
case 24: /* literal ::= NK_STRING */ { STokenPair t = { .first = yymsp[-2].minor.yy0, .second = yymsp[0].minor.yy0}; yylhsminor.yy111 = t; }
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy111 = yylhsminor.yy111;
yymsp[0].minor.yy104 = yylhsminor.yy104; break;
break; case 25: /* column_def_list ::= column_def */
case 25: /* literal ::= NK_BOOL */ { yylhsminor.yy60 = createNodeList(pCxt, yymsp[0].minor.yy172); }
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy60 = yylhsminor.yy60;
yymsp[0].minor.yy104 = yylhsminor.yy104; break;
break; case 26: /* column_def_list ::= column_def_list NK_COMMA column_def */
case 26: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, yymsp[0].minor.yy172); }
{ 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[-2].minor.yy60 = yylhsminor.yy60;
yymsp[-1].minor.yy104 = yylhsminor.yy104; break;
break; case 27: /* column_def ::= column_name type_name */
case 27: /* literal ::= duration_literal */ { yylhsminor.yy172 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy105, yymsp[0].minor.yy248, NULL); }
case 37: /* expression ::= literal */ yytestcase(yyruleno==37); yymsp[-1].minor.yy172 = yylhsminor.yy172;
case 38: /* expression ::= column_reference */ yytestcase(yyruleno==38); break;
case 41: /* expression ::= subquery */ yytestcase(yyruleno==41); case 28: /* column_def ::= column_name type_name COMMENT NK_STRING */
case 73: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==73); { yylhsminor.yy172 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy105, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); }
case 77: /* boolean_primary ::= predicate */ yytestcase(yyruleno==77); yymsp[-3].minor.yy172 = yylhsminor.yy172;
case 82: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==82); break;
case 84: /* table_reference ::= table_primary */ yytestcase(yyruleno==84); case 29: /* type_name ::= BOOL */
case 85: /* table_reference ::= joined_table */ yytestcase(yyruleno==85); { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_BOOL); }
case 89: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==89); break;
case 136: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==136); case 30: /* type_name ::= TINYINT */
case 138: /* query_primary ::= query_specification */ yytestcase(yyruleno==138); { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_TINYINT); }
{ PARSER_TRACE; yylhsminor.yy104 = yymsp[0].minor.yy104; } break;
yymsp[0].minor.yy104 = yylhsminor.yy104; case 31: /* type_name ::= SMALLINT */
break; { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
case 28: /* duration_literal ::= NK_VARIABLE */ break;
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } case 32: /* type_name ::= INT */
yymsp[0].minor.yy104 = yylhsminor.yy104; case 33: /* type_name ::= INTEGER */ yytestcase(yyruleno==33);
break; { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_INT); }
case 29: /* literal_list ::= literal */ break;
case 50: /* expression_list ::= expression */ yytestcase(yyruleno==50); case 34: /* type_name ::= BIGINT */
{ PARSER_TRACE; yylhsminor.yy8 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_BIGINT); }
yymsp[0].minor.yy8 = yylhsminor.yy8; break;
break; case 35: /* type_name ::= FLOAT */
case 30: /* literal_list ::= literal_list NK_COMMA literal */ { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_FLOAT); }
case 51: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==51); break;
{ PARSER_TRACE; yylhsminor.yy8 = addNodeToList(pCxt, yymsp[-2].minor.yy8, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } case 36: /* type_name ::= DOUBLE */
yymsp[-2].minor.yy8 = yylhsminor.yy8; { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break; break;
case 31: /* db_name ::= NK_ID */ case 37: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
case 32: /* table_name ::= NK_ID */ yytestcase(yyruleno==32); { yymsp[-3].minor.yy248 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
case 33: /* column_name ::= NK_ID */ yytestcase(yyruleno==33); break;
case 34: /* function_name ::= NK_ID */ yytestcase(yyruleno==34); case 38: /* type_name ::= TIMESTAMP */
case 35: /* table_alias ::= NK_ID */ yytestcase(yyruleno==35); { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
case 36: /* column_alias ::= NK_ID */ yytestcase(yyruleno==36); break;
{ PARSER_TRACE; yylhsminor.yy129 = yymsp[0].minor.yy0; } case 39: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
yymsp[0].minor.yy129 = yylhsminor.yy129; { yymsp[-3].minor.yy248 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break; break;
case 39: /* expression ::= function_name NK_LP expression_list NK_RP */ case 40: /* type_name ::= TINYINT UNSIGNED */
{ 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[-1].minor.yy248 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
yymsp[-3].minor.yy104 = yylhsminor.yy104; break;
break; case 41: /* type_name ::= SMALLINT UNSIGNED */
case 40: /* expression ::= function_name NK_LP NK_STAR NK_RP */ { yymsp[-1].minor.yy248 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
{ 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)))); } break;
yymsp[-3].minor.yy104 = yylhsminor.yy104; case 42: /* type_name ::= INT UNSIGNED */
break; { yymsp[-1].minor.yy248 = createDataType(TSDB_DATA_TYPE_UINT); }
case 42: /* expression ::= NK_LP expression NK_RP */ break;
case 78: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==78); case 43: /* type_name ::= BIGINT UNSIGNED */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } { yymsp[-1].minor.yy248 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; break;
break; case 44: /* type_name ::= JSON */
case 43: /* expression ::= NK_PLUS expression */ { yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 45: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy248 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 46: /* type_name ::= MEDIUMBLOB */
{ yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 47: /* type_name ::= BLOB */
{ yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 48: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy248 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 49: /* type_name ::= DECIMAL */
{ yymsp[0].minor.yy248 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 50: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
{ yymsp[-3].minor.yy248 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 51: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
{ yymsp[-5].minor.yy248 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 52: /* table_options ::= */
{ yymsp[1].minor.yy40 = createDefaultTableOptions(pCxt);}
break;
case 53: /* table_options ::= table_options COMMENT NK_INTEGER */
{ yylhsminor.yy40 = setTableOption(pCxt, yymsp[-2].minor.yy40, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy40 = yylhsminor.yy40;
break;
case 54: /* table_options ::= table_options KEEP NK_INTEGER */
{ yylhsminor.yy40 = setTableOption(pCxt, yymsp[-2].minor.yy40, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy40 = yylhsminor.yy40;
break;
case 55: /* table_options ::= table_options TTL NK_INTEGER */
{ yylhsminor.yy40 = setTableOption(pCxt, yymsp[-2].minor.yy40, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy40 = yylhsminor.yy40;
break;
case 56: /* cmd ::= SHOW DATABASES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASE_STMT); }
break;
case 57: /* cmd ::= query_expression */
{ PARSER_TRACE; pCxt->pRootNode = yymsp[0].minor.yy172; }
break;
case 58: /* literal ::= NK_INTEGER */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 59: /* literal ::= NK_FLOAT */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 60: /* literal ::= NK_STRING */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 61: /* literal ::= NK_BOOL */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 62: /* literal ::= TIMESTAMP NK_STRING */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
yymsp[-1].minor.yy172 = yylhsminor.yy172;
break;
case 63: /* literal ::= duration_literal */
case 73: /* expression ::= literal */ yytestcase(yyruleno==73);
case 74: /* expression ::= column_reference */ yytestcase(yyruleno==74);
case 77: /* expression ::= subquery */ yytestcase(yyruleno==77);
case 109: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==109);
case 113: /* boolean_primary ::= predicate */ yytestcase(yyruleno==113);
case 118: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==118);
case 120: /* table_reference ::= table_primary */ yytestcase(yyruleno==120);
case 121: /* table_reference ::= joined_table */ yytestcase(yyruleno==121);
case 125: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==125);
case 172: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==172);
case 174: /* query_primary ::= query_specification */ yytestcase(yyruleno==174);
{ PARSER_TRACE; yylhsminor.yy172 = yymsp[0].minor.yy172; }
yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 64: /* duration_literal ::= NK_VARIABLE */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 65: /* literal_list ::= literal */
case 86: /* expression_list ::= expression */ yytestcase(yyruleno==86);
{ PARSER_TRACE; yylhsminor.yy60 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172)); }
yymsp[0].minor.yy60 = yylhsminor.yy60;
break;
case 66: /* literal_list ::= literal_list NK_COMMA literal */
case 87: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==87);
{ PARSER_TRACE; yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, releaseRawExprNode(pCxt, yymsp[0].minor.yy172)); }
yymsp[-2].minor.yy60 = yylhsminor.yy60;
break;
case 67: /* db_name ::= NK_ID */
case 68: /* table_name ::= NK_ID */ yytestcase(yyruleno==68);
case 69: /* column_name ::= NK_ID */ yytestcase(yyruleno==69);
case 70: /* function_name ::= NK_ID */ yytestcase(yyruleno==70);
case 71: /* table_alias ::= NK_ID */ yytestcase(yyruleno==71);
case 72: /* column_alias ::= NK_ID */ yytestcase(yyruleno==72);
{ PARSER_TRACE; yylhsminor.yy105 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy105 = yylhsminor.yy105;
break;
case 75: /* expression ::= function_name NK_LP expression_list NK_RP */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy105, yymsp[-1].minor.yy60)); }
yymsp[-3].minor.yy172 = yylhsminor.yy172;
break;
case 76: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy105, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy105, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
yymsp[-3].minor.yy172 = yylhsminor.yy172;
break;
case 78: /* expression ::= NK_LP expression NK_RP */
case 114: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==114);
{ PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); }
yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
case 79: /* expression ::= NK_PLUS expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy172));
} }
yymsp[-1].minor.yy104 = yylhsminor.yy104; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 44: /* expression ::= NK_MINUS expression */ case 80: /* expression ::= NK_MINUS expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy172), NULL));
} }
yymsp[-1].minor.yy104 = yylhsminor.yy104; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 45: /* expression ::= expression NK_PLUS expression */ case 81: /* expression ::= expression NK_PLUS expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 46: /* expression ::= expression NK_MINUS expression */ case 82: /* expression ::= expression NK_MINUS expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 47: /* expression ::= expression NK_STAR expression */ case 83: /* expression ::= expression NK_STAR expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 48: /* expression ::= expression NK_SLASH expression */ case 84: /* expression ::= expression NK_SLASH expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 49: /* expression ::= expression NK_REM expression */ case 85: /* expression ::= expression NK_REM expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 52: /* column_reference ::= column_name */ case 88: /* column_reference ::= column_name */
{ PARSER_TRACE; yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); } { PARSER_TRACE; yylhsminor.yy172 = createRawExprNode(pCxt, &yymsp[0].minor.yy105, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy105)); }
yymsp[0].minor.yy104 = yylhsminor.yy104; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
case 53: /* column_reference ::= table_name NK_DOT column_name */ case 89: /* 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)); } { PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy105, createColumnNode(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy105)); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 54: /* predicate ::= expression compare_op expression */ case 90: /* predicate ::= expression compare_op expression */
case 59: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==59); case 95: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==95);
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy60, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy214, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 55: /* predicate ::= expression BETWEEN expression AND expression */ case 91: /* predicate ::= expression BETWEEN expression AND expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
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))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy172), releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-4].minor.yy104 = yylhsminor.yy104; yymsp[-4].minor.yy172 = yylhsminor.yy172;
break; break;
case 56: /* predicate ::= expression NOT BETWEEN expression AND expression */ case 92: /* predicate ::= expression NOT BETWEEN expression AND expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
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))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[-5].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-5].minor.yy104 = yylhsminor.yy104; yymsp[-5].minor.yy172 = yylhsminor.yy172;
break; break;
case 57: /* predicate ::= expression IS NULL */ case 93: /* predicate ::= expression IS NULL */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), NULL));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 58: /* predicate ::= expression IS NOT NULL */ case 94: /* predicate ::= expression IS NOT NULL */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), NULL));
} }
yymsp[-3].minor.yy104 = yylhsminor.yy104; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 60: /* compare_op ::= NK_LT */ case 96: /* compare_op ::= NK_LT */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_LOWER_THAN; }
break; break;
case 61: /* compare_op ::= NK_GT */ case 97: /* compare_op ::= NK_GT */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_GREATER_THAN; }
break; break;
case 62: /* compare_op ::= NK_LE */ case 98: /* compare_op ::= NK_LE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_LOWER_EQUAL; }
break; break;
case 63: /* compare_op ::= NK_GE */ case 99: /* compare_op ::= NK_GE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_GREATER_EQUAL; }
break; break;
case 64: /* compare_op ::= NK_NE */ case 100: /* compare_op ::= NK_NE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_NOT_EQUAL; }
break; break;
case 65: /* compare_op ::= NK_EQ */ case 101: /* compare_op ::= NK_EQ */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_EQUAL; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_EQUAL; }
break; break;
case 66: /* compare_op ::= LIKE */ case 102: /* compare_op ::= LIKE */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_LIKE; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_LIKE; }
break; break;
case 67: /* compare_op ::= NOT LIKE */ case 103: /* compare_op ::= NOT LIKE */
{ PARSER_TRACE; yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; } { PARSER_TRACE; yymsp[-1].minor.yy214 = OP_TYPE_NOT_LIKE; }
break; break;
case 68: /* compare_op ::= MATCH */ case 104: /* compare_op ::= MATCH */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_MATCH; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_MATCH; }
break; break;
case 69: /* compare_op ::= NMATCH */ case 105: /* compare_op ::= NMATCH */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_NMATCH; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_NMATCH; }
break; break;
case 70: /* in_op ::= IN */ case 106: /* in_op ::= IN */
{ PARSER_TRACE; yymsp[0].minor.yy60 = OP_TYPE_IN; } { PARSER_TRACE; yymsp[0].minor.yy214 = OP_TYPE_IN; }
break; break;
case 71: /* in_op ::= NOT IN */ case 107: /* in_op ::= NOT IN */
{ PARSER_TRACE; yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; } { PARSER_TRACE; yymsp[-1].minor.yy214 = OP_TYPE_NOT_IN; }
break; break;
case 72: /* in_predicate_value ::= NK_LP expression_list NK_RP */ case 108: /* 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)); } { PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy60)); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 74: /* boolean_value_expression ::= NOT boolean_primary */ case 110: /* boolean_value_expression ::= NOT boolean_primary */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy172), NULL));
} }
yymsp[-1].minor.yy104 = yylhsminor.yy104; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 75: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ case 111: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 76: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ case 112: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy172);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); yylhsminor.yy172 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), releaseRawExprNode(pCxt, yymsp[0].minor.yy172)));
} }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 79: /* common_expression ::= expression */ case 115: /* common_expression ::= expression */
case 80: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==80); case 116: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==116);
{ yylhsminor.yy104 = yymsp[0].minor.yy104; } { yylhsminor.yy172 = yymsp[0].minor.yy172; }
yymsp[0].minor.yy104 = yylhsminor.yy104; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
case 81: /* from_clause ::= FROM table_reference_list */ case 117: /* from_clause ::= FROM table_reference_list */
case 111: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==111); case 147: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==147);
case 134: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==134); case 170: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==170);
{ PARSER_TRACE; yymsp[-1].minor.yy104 = yymsp[0].minor.yy104; } { PARSER_TRACE; yymsp[-1].minor.yy172 = yymsp[0].minor.yy172; }
break; break;
case 83: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ case 119: /* 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); } { PARSER_TRACE; yylhsminor.yy172 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy172, yymsp[0].minor.yy172, NULL); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 86: /* table_primary ::= table_name alias_opt */ case 122: /* table_primary ::= table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } { PARSER_TRACE; yylhsminor.yy172 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); }
yymsp[-1].minor.yy104 = yylhsminor.yy104; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 87: /* table_primary ::= db_name NK_DOT table_name alias_opt */ case 123: /* 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); } { PARSER_TRACE; yylhsminor.yy172 = createRealTableNode(pCxt, &yymsp[-3].minor.yy105, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); }
yymsp[-3].minor.yy104 = yylhsminor.yy104; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 88: /* table_primary ::= subquery alias_opt */ case 124: /* table_primary ::= subquery alias_opt */
{ PARSER_TRACE; yylhsminor.yy104 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } { PARSER_TRACE; yylhsminor.yy172 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172), &yymsp[0].minor.yy105); }
yymsp[-1].minor.yy104 = yylhsminor.yy104; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 90: /* alias_opt ::= */ case 126: /* alias_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy129 = nil_token; } { PARSER_TRACE; yymsp[1].minor.yy105 = nil_token; }
break; break;
case 91: /* alias_opt ::= table_alias */ case 127: /* alias_opt ::= table_alias */
{ PARSER_TRACE; yylhsminor.yy129 = yymsp[0].minor.yy129; } { PARSER_TRACE; yylhsminor.yy105 = yymsp[0].minor.yy105; }
yymsp[0].minor.yy129 = yylhsminor.yy129; yymsp[0].minor.yy105 = yylhsminor.yy105;
break; break;
case 92: /* alias_opt ::= AS table_alias */ case 128: /* alias_opt ::= AS table_alias */
{ PARSER_TRACE; yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; } { PARSER_TRACE; yymsp[-1].minor.yy105 = yymsp[0].minor.yy105; }
break; break;
case 93: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 129: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case 94: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==94); case 130: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==130);
{ PARSER_TRACE; yymsp[-2].minor.yy104 = yymsp[-1].minor.yy104; } { PARSER_TRACE; yymsp[-2].minor.yy172 = yymsp[-1].minor.yy172; }
break; break;
case 95: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ case 131: /* 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); } { PARSER_TRACE; yylhsminor.yy172 = createJoinTableNode(pCxt, yymsp[-4].minor.yy278, yymsp[-5].minor.yy172, yymsp[-2].minor.yy172, yymsp[0].minor.yy172); }
yymsp[-5].minor.yy104 = yylhsminor.yy104; yymsp[-5].minor.yy172 = yylhsminor.yy172;
break; break;
case 96: /* join_type ::= */ case 132: /* join_type ::= */
{ PARSER_TRACE; yymsp[1].minor.yy228 = JOIN_TYPE_INNER; } { PARSER_TRACE; yymsp[1].minor.yy278 = JOIN_TYPE_INNER; }
break; break;
case 97: /* join_type ::= INNER */ case 133: /* join_type ::= INNER */
{ PARSER_TRACE; yymsp[0].minor.yy228 = JOIN_TYPE_INNER; } { PARSER_TRACE; yymsp[0].minor.yy278 = JOIN_TYPE_INNER; }
break; break;
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 */ case 134: /* 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; PARSER_TRACE;
yymsp[-8].minor.yy104 = createSelectStmt(pCxt, yymsp[-7].minor.yy185, yymsp[-6].minor.yy8, yymsp[-5].minor.yy104); yymsp[-8].minor.yy172 = createSelectStmt(pCxt, yymsp[-7].minor.yy259, yymsp[-6].minor.yy60, yymsp[-5].minor.yy172);
yymsp[-8].minor.yy104 = addWhereClause(pCxt, yymsp[-8].minor.yy104, yymsp[-4].minor.yy104); yymsp[-8].minor.yy172 = addWhereClause(pCxt, yymsp[-8].minor.yy172, yymsp[-4].minor.yy172);
yymsp[-8].minor.yy104 = addPartitionByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-3].minor.yy8); yymsp[-8].minor.yy172 = addPartitionByClause(pCxt, yymsp[-8].minor.yy172, yymsp[-3].minor.yy60);
yymsp[-8].minor.yy104 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy104, yymsp[-2].minor.yy104); yymsp[-8].minor.yy172 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy172, yymsp[-2].minor.yy172);
yymsp[-8].minor.yy104 = addGroupByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-1].minor.yy8); yymsp[-8].minor.yy172 = addGroupByClause(pCxt, yymsp[-8].minor.yy172, yymsp[-1].minor.yy60);
yymsp[-8].minor.yy104 = addHavingClause(pCxt, yymsp[-8].minor.yy104, yymsp[0].minor.yy104); yymsp[-8].minor.yy172 = addHavingClause(pCxt, yymsp[-8].minor.yy172, yymsp[0].minor.yy172);
} }
break; break;
case 99: /* set_quantifier_opt ::= */ case 135: /* set_quantifier_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy185 = false; } { PARSER_TRACE; yymsp[1].minor.yy259 = false; }
break; break;
case 100: /* set_quantifier_opt ::= DISTINCT */ case 136: /* set_quantifier_opt ::= DISTINCT */
{ PARSER_TRACE; yymsp[0].minor.yy185 = true; } { PARSER_TRACE; yymsp[0].minor.yy259 = true; }
break; break;
case 101: /* set_quantifier_opt ::= ALL */ case 137: /* set_quantifier_opt ::= ALL */
{ PARSER_TRACE; yymsp[0].minor.yy185 = false; } { PARSER_TRACE; yymsp[0].minor.yy259 = false; }
break; break;
case 102: /* select_list ::= NK_STAR */ case 138: /* select_list ::= NK_STAR */
{ PARSER_TRACE; yymsp[0].minor.yy8 = NULL; } { PARSER_TRACE; yymsp[0].minor.yy60 = NULL; }
break; break;
case 103: /* select_list ::= select_sublist */ case 139: /* select_list ::= select_sublist */
{ PARSER_TRACE; yylhsminor.yy8 = yymsp[0].minor.yy8; } { PARSER_TRACE; yylhsminor.yy60 = yymsp[0].minor.yy60; }
yymsp[0].minor.yy8 = yylhsminor.yy8; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
case 104: /* select_sublist ::= select_item */ case 140: /* select_sublist ::= select_item */
case 151: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==151); case 187: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==187);
{ PARSER_TRACE; yylhsminor.yy8 = createNodeList(pCxt, yymsp[0].minor.yy104); } { PARSER_TRACE; yylhsminor.yy60 = createNodeList(pCxt, yymsp[0].minor.yy172); }
yymsp[0].minor.yy8 = yylhsminor.yy8; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
case 105: /* select_sublist ::= select_sublist NK_COMMA select_item */ case 141: /* select_sublist ::= select_sublist NK_COMMA select_item */
case 152: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==152); case 188: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==188);
{ PARSER_TRACE; yylhsminor.yy8 = addNodeToList(pCxt, yymsp[-2].minor.yy8, yymsp[0].minor.yy104); } { PARSER_TRACE; yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, yymsp[0].minor.yy172); }
yymsp[-2].minor.yy8 = yylhsminor.yy8; yymsp[-2].minor.yy60 = yylhsminor.yy60;
break; break;
case 106: /* select_item ::= common_expression */ case 142: /* select_item ::= common_expression */
{ {
PARSER_TRACE; PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy172);
yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), &t); yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172), &t);
} }
yymsp[0].minor.yy104 = yylhsminor.yy104; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
case 107: /* select_item ::= common_expression column_alias */ case 143: /* select_item ::= common_expression column_alias */
{ PARSER_TRACE; yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } { PARSER_TRACE; yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172), &yymsp[0].minor.yy105); }
yymsp[-1].minor.yy104 = yylhsminor.yy104; yymsp[-1].minor.yy172 = yylhsminor.yy172;
break; break;
case 108: /* select_item ::= common_expression AS column_alias */ case 144: /* select_item ::= common_expression AS column_alias */
{ PARSER_TRACE; yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), &yymsp[0].minor.yy129); } { PARSER_TRACE; yylhsminor.yy172 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), &yymsp[0].minor.yy105); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 109: /* select_item ::= table_name NK_DOT NK_STAR */ case 145: /* select_item ::= table_name NK_DOT NK_STAR */
{ PARSER_TRACE; yylhsminor.yy104 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } { PARSER_TRACE; yylhsminor.yy172 = createColumnNode(pCxt, &yymsp[-2].minor.yy105, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 110: /* where_clause_opt ::= */ case 146: /* where_clause_opt ::= */
case 114: /* twindow_clause_opt ::= */ yytestcase(yyruleno==114); case 150: /* twindow_clause_opt ::= */ yytestcase(yyruleno==150);
case 119: /* sliding_opt ::= */ yytestcase(yyruleno==119); case 155: /* sliding_opt ::= */ yytestcase(yyruleno==155);
case 121: /* fill_opt ::= */ yytestcase(yyruleno==121); case 157: /* fill_opt ::= */ yytestcase(yyruleno==157);
case 133: /* having_clause_opt ::= */ yytestcase(yyruleno==133); case 169: /* having_clause_opt ::= */ yytestcase(yyruleno==169);
case 141: /* slimit_clause_opt ::= */ yytestcase(yyruleno==141); case 177: /* slimit_clause_opt ::= */ yytestcase(yyruleno==177);
case 145: /* limit_clause_opt ::= */ yytestcase(yyruleno==145); case 181: /* limit_clause_opt ::= */ yytestcase(yyruleno==181);
{ PARSER_TRACE; yymsp[1].minor.yy104 = NULL; } { PARSER_TRACE; yymsp[1].minor.yy172 = NULL; }
break; break;
case 112: /* partition_by_clause_opt ::= */ case 148: /* partition_by_clause_opt ::= */
case 129: /* group_by_clause_opt ::= */ yytestcase(yyruleno==129); case 165: /* group_by_clause_opt ::= */ yytestcase(yyruleno==165);
case 139: /* order_by_clause_opt ::= */ yytestcase(yyruleno==139); case 175: /* order_by_clause_opt ::= */ yytestcase(yyruleno==175);
{ PARSER_TRACE; yymsp[1].minor.yy8 = NULL; } { PARSER_TRACE; yymsp[1].minor.yy60 = NULL; }
break; break;
case 113: /* partition_by_clause_opt ::= PARTITION BY expression_list */ case 149: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 130: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==130); case 166: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==166);
case 140: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==140); case 176: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==176);
{ PARSER_TRACE; yymsp[-2].minor.yy8 = yymsp[0].minor.yy8; } { PARSER_TRACE; yymsp[-2].minor.yy60 = yymsp[0].minor.yy60; }
break; break;
case 115: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */ case 151: /* 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); } { PARSER_TRACE; yymsp[-5].minor.yy172 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy172), &yymsp[-1].minor.yy0); }
break; break;
case 116: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ case 152: /* 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)); } { PARSER_TRACE; yymsp[-3].minor.yy172 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy172)); }
break; break;
case 117: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ case 153: /* 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); } { PARSER_TRACE; yymsp[-5].minor.yy172 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy172, NULL, yymsp[-1].minor.yy172, yymsp[0].minor.yy172); }
break; break;
case 118: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ case 154: /* 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); } { PARSER_TRACE; yymsp[-7].minor.yy172 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy172, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy172); }
break; break;
case 120: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ case 156: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy104 = yymsp[-1].minor.yy104; } { PARSER_TRACE; yymsp[-3].minor.yy172 = yymsp[-1].minor.yy172; }
break; break;
case 122: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ case 158: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createFillNode(pCxt, yymsp[-1].minor.yy246, NULL); } { PARSER_TRACE; yymsp[-3].minor.yy172 = createFillNode(pCxt, yymsp[-1].minor.yy202, NULL); }
break; break;
case 123: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ case 159: /* 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)); } { PARSER_TRACE; yymsp[-5].minor.yy172 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy60)); }
break; break;
case 124: /* fill_mode ::= NONE */ case 160: /* fill_mode ::= NONE */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_NONE; } { PARSER_TRACE; yymsp[0].minor.yy202 = FILL_MODE_NONE; }
break; break;
case 125: /* fill_mode ::= PREV */ case 161: /* fill_mode ::= PREV */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_PREV; } { PARSER_TRACE; yymsp[0].minor.yy202 = FILL_MODE_PREV; }
break; break;
case 126: /* fill_mode ::= NULL */ case 162: /* fill_mode ::= NULL */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_NULL; } { PARSER_TRACE; yymsp[0].minor.yy202 = FILL_MODE_NULL; }
break; break;
case 127: /* fill_mode ::= LINEAR */ case 163: /* fill_mode ::= LINEAR */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_LINEAR; } { PARSER_TRACE; yymsp[0].minor.yy202 = FILL_MODE_LINEAR; }
break; break;
case 128: /* fill_mode ::= NEXT */ case 164: /* fill_mode ::= NEXT */
{ PARSER_TRACE; yymsp[0].minor.yy246 = FILL_MODE_NEXT; } { PARSER_TRACE; yymsp[0].minor.yy202 = FILL_MODE_NEXT; }
break; break;
case 131: /* group_by_list ::= expression */ case 167: /* group_by_list ::= expression */
{ PARSER_TRACE; yylhsminor.yy8 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } { PARSER_TRACE; yylhsminor.yy60 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172))); }
yymsp[0].minor.yy8 = yylhsminor.yy8; yymsp[0].minor.yy60 = yylhsminor.yy60;
break; break;
case 132: /* group_by_list ::= group_by_list NK_COMMA expression */ case 168: /* 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))); } { PARSER_TRACE; yylhsminor.yy60 = addNodeToList(pCxt, yymsp[-2].minor.yy60, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy172))); }
yymsp[-2].minor.yy8 = yylhsminor.yy8; yymsp[-2].minor.yy60 = yylhsminor.yy60;
break; break;
case 135: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ case 171: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ {
PARSER_TRACE; PARSER_TRACE;
yylhsminor.yy104 = addOrderByClause(pCxt, yymsp[-3].minor.yy104, yymsp[-2].minor.yy8); yylhsminor.yy172 = addOrderByClause(pCxt, yymsp[-3].minor.yy172, yymsp[-2].minor.yy60);
yylhsminor.yy104 = addSlimitClause(pCxt, yylhsminor.yy104, yymsp[-1].minor.yy104); yylhsminor.yy172 = addSlimitClause(pCxt, yylhsminor.yy172, yymsp[-1].minor.yy172);
yylhsminor.yy104 = addLimitClause(pCxt, yylhsminor.yy104, yymsp[0].minor.yy104); yylhsminor.yy172 = addLimitClause(pCxt, yylhsminor.yy172, yymsp[0].minor.yy172);
} }
yymsp[-3].minor.yy104 = yylhsminor.yy104; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 137: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ case 173: /* 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); } { PARSER_TRACE; yylhsminor.yy172 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy172, yymsp[0].minor.yy172); }
yymsp[-3].minor.yy104 = yylhsminor.yy104; yymsp[-3].minor.yy172 = yylhsminor.yy172;
break; break;
case 142: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ case 178: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 146: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==146); case 182: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==182);
{ PARSER_TRACE; yymsp[-1].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } { PARSER_TRACE; yymsp[-1].minor.yy172 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break; break;
case 143: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 179: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 147: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==147); case 183: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==183);
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } { PARSER_TRACE; yymsp[-3].minor.yy172 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break; break;
case 144: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 180: /* 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); case 184: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==184);
{ PARSER_TRACE; yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } { PARSER_TRACE; yymsp[-3].minor.yy172 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break; break;
case 149: /* subquery ::= NK_LP query_expression NK_RP */ case 185: /* 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); } { PARSER_TRACE; yylhsminor.yy172 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy172); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 150: /* search_condition ::= common_expression */ case 186: /* search_condition ::= common_expression */
{ PARSER_TRACE; yylhsminor.yy104 = releaseRawExprNode(pCxt, yymsp[0].minor.yy104); } { PARSER_TRACE; yylhsminor.yy172 = releaseRawExprNode(pCxt, yymsp[0].minor.yy172); }
yymsp[0].minor.yy104 = yylhsminor.yy104; yymsp[0].minor.yy172 = yylhsminor.yy172;
break; break;
case 153: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ case 189: /* 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); } { PARSER_TRACE; yylhsminor.yy172 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy172), yymsp[-1].minor.yy14, yymsp[0].minor.yy17); }
yymsp[-2].minor.yy104 = yylhsminor.yy104; yymsp[-2].minor.yy172 = yylhsminor.yy172;
break; break;
case 154: /* ordering_specification_opt ::= */ case 190: /* ordering_specification_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy50 = ORDER_ASC; } { PARSER_TRACE; yymsp[1].minor.yy14 = ORDER_ASC; }
break; break;
case 155: /* ordering_specification_opt ::= ASC */ case 191: /* ordering_specification_opt ::= ASC */
{ PARSER_TRACE; yymsp[0].minor.yy50 = ORDER_ASC; } { PARSER_TRACE; yymsp[0].minor.yy14 = ORDER_ASC; }
break; break;
case 156: /* ordering_specification_opt ::= DESC */ case 192: /* ordering_specification_opt ::= DESC */
{ PARSER_TRACE; yymsp[0].minor.yy50 = ORDER_DESC; } { PARSER_TRACE; yymsp[0].minor.yy14 = ORDER_DESC; }
break; break;
case 157: /* null_ordering_opt ::= */ case 193: /* null_ordering_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy186 = NULL_ORDER_DEFAULT; } { PARSER_TRACE; yymsp[1].minor.yy17 = NULL_ORDER_DEFAULT; }
break; break;
case 158: /* null_ordering_opt ::= NULLS FIRST */ case 194: /* null_ordering_opt ::= NULLS FIRST */
{ PARSER_TRACE; yymsp[-1].minor.yy186 = NULL_ORDER_FIRST; } { PARSER_TRACE; yymsp[-1].minor.yy17 = NULL_ORDER_FIRST; }
break; break;
case 159: /* null_ordering_opt ::= NULLS LAST */ case 195: /* null_ordering_opt ::= NULLS LAST */
{ PARSER_TRACE; yymsp[-1].minor.yy186 = NULL_ORDER_LAST; } { PARSER_TRACE; yymsp[-1].minor.yy17 = NULL_ORDER_LAST; }
break; break;
default: default:
break; break;
......
...@@ -30,18 +30,18 @@ typedef struct SKeyword { ...@@ -30,18 +30,18 @@ typedef struct SKeyword {
// keywords in sql string // keywords in sql string
static SKeyword keywordTable[] = { static SKeyword keywordTable[] = {
// {"ID", TK_ID}, // {"ID", TK_ID},
// {"BOOL", TK_BOOL}, {"BOOL", TK_BOOL},
// {"TINYINT", TK_TINYINT}, {"TINYINT", TK_TINYINT},
// {"SMALLINT", TK_SMALLINT}, {"SMALLINT", TK_SMALLINT},
// {"INTEGER", TK_INTEGER}, {"INTEGER", TK_INTEGER},
// {"INT", TK_INTEGER}, {"INT", TK_INTEGER},
// {"BIGINT", TK_BIGINT}, {"BIGINT", TK_BIGINT},
// {"FLOAT", TK_FLOAT}, {"FLOAT", TK_FLOAT},
// {"DOUBLE", TK_DOUBLE}, {"DOUBLE", TK_DOUBLE},
// {"STRING", TK_STRING}, // {"STRING", TK_STRING},
{"TIMESTAMP", TK_TIMESTAMP}, {"TIMESTAMP", TK_TIMESTAMP},
// {"BINARY", TK_BINARY}, {"BINARY", TK_BINARY},
// {"NCHAR", TK_NCHAR}, {"NCHAR", TK_NCHAR},
{"OR", TK_OR}, {"OR", TK_OR},
{"AND", TK_AND}, {"AND", TK_AND},
{"NOT", TK_NOT}, {"NOT", TK_NOT},
...@@ -74,8 +74,8 @@ static SKeyword keywordTable[] = { ...@@ -74,8 +74,8 @@ static SKeyword keywordTable[] = {
// {"UMINUS", TK_UMINUS}, // {"UMINUS", TK_UMINUS},
// {"UPLUS", TK_UPLUS}, // {"UPLUS", TK_UPLUS},
// {"BITNOT", TK_BITNOT}, // {"BITNOT", TK_BITNOT},
// {"SHOW", TK_SHOW}, {"SHOW", TK_SHOW},
// {"DATABASES", TK_DATABASES}, {"DATABASES", TK_DATABASES},
// {"MNODES", TK_MNODES}, // {"MNODES", TK_MNODES},
// {"DNODES", TK_DNODES}, // {"DNODES", TK_DNODES},
// {"ACCOUNTS", TK_ACCOUNTS}, // {"ACCOUNTS", TK_ACCOUNTS},
...@@ -92,12 +92,12 @@ static SKeyword keywordTable[] = { ...@@ -92,12 +92,12 @@ static SKeyword keywordTable[] = {
// {"STABLES", TK_STABLES}, // {"STABLES", TK_STABLES},
{"VGROUPS", TK_VGROUPS}, {"VGROUPS", TK_VGROUPS},
// {"DROP", TK_DROP}, // {"DROP", TK_DROP},
// {"TABLE", TK_TABLE}, {"TABLE", TK_TABLE},
{"DATABASE", TK_DATABASE}, {"DATABASE", TK_DATABASE},
// {"DNODE", TK_DNODE}, // {"DNODE", TK_DNODE},
// {"USER", TK_USER}, // {"USER", TK_USER},
// {"ACCOUNT", TK_ACCOUNT}, // {"ACCOUNT", TK_ACCOUNT},
// {"USE", TK_USE}, {"USE", TK_USE},
// {"DESCRIBE", TK_DESCRIBE}, // {"DESCRIBE", TK_DESCRIBE},
// {"SYNCDB", TK_SYNCDB}, // {"SYNCDB", TK_SYNCDB},
// {"ALTER", TK_ALTER}, // {"ALTER", TK_ALTER},
...@@ -309,7 +309,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { ...@@ -309,7 +309,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
if (z[1] == '-') { if (z[1] == '-') {
for (i = 2; z[i] && z[i] != '\n'; i++) { for (i = 2; z[i] && z[i] != '\n'; i++) {
} }
*tokenId = TK_COMMENT; *tokenId = TK_NK_COMMENT;
return i; return i;
} }
*tokenId = TK_MINUS; *tokenId = TK_MINUS;
...@@ -343,7 +343,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { ...@@ -343,7 +343,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
for (i = 3; z[i] && (z[i] != '/' || z[i - 1] != '*'); i++) { for (i = 3; z[i] && (z[i] != '/' || z[i - 1] != '*'); i++) {
} }
if (z[i]) i++; if (z[i]) i++;
*tokenId = TK_COMMENT; *tokenId = TK_NK_COMMENT;
return i; return i;
} }
case '%': { case '%': {
......
...@@ -696,3 +696,23 @@ TEST_F(ParserTest, selectSemanticError) { ...@@ -696,3 +696,23 @@ TEST_F(ParserTest, selectSemanticError) {
bind("SELECT DISTINCT c2 FROM t1 WHERE c1 > 0 ORDER BY count(c2)"); bind("SELECT DISTINCT c2 FROM t1 WHERE c1 > 0 ORDER BY count(c2)");
ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION)); ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION));
} }
TEST_F(ParserTest, createDatabase) {
bind("create database wxy_db");
ASSERT_TRUE(run());
}
TEST_F(ParserTest, showDatabase) {
bind("show databases");
ASSERT_TRUE(run());
}
TEST_F(ParserTest, useDatabase) {
bind("use wxy_db");
ASSERT_TRUE(run());
}
TEST_F(ParserTest, createTable) {
bind("create table t1(ts timestamp, c1 int)");
ASSERT_TRUE(run());
}
...@@ -39,6 +39,15 @@ extern "C" { ...@@ -39,6 +39,15 @@ extern "C" {
} \ } \
} while (0) } while (0)
#define CHECK_CODE_EXT(exec) \
do { \
int32_t code = (exec); \
if (TSDB_CODE_SUCCESS != code) { \
pCxt->errCode = code; \
return code; \
} \
} while (0)
int32_t createLogicPlan(SPlanContext* pCxt, SLogicNode** pLogicNode); int32_t createLogicPlan(SPlanContext* pCxt, SLogicNode** pLogicNode);
int32_t optimize(SPlanContext* pCxt, SLogicNode* pLogicNode); int32_t optimize(SPlanContext* pCxt, SLogicNode* pLogicNode);
int32_t createPhysiPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SQueryPlan** pPlan); int32_t createPhysiPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SQueryPlan** pPlan);
......
...@@ -348,10 +348,20 @@ static SLogicNode* createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p ...@@ -348,10 +348,20 @@ static SLogicNode* createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
return pRoot; return pRoot;
} }
static SLogicNode* createVnodeModifLogicNode(SLogicPlanContext* pCxt, SVnodeModifOpStmt* pStmt) {
SVnodeModifLogicNode* pModif = (SVnodeModifLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_VNODE_MODIF);
CHECK_ALLOC(pModif, NULL);
pModif->pDataBlocks = pStmt->pDataBlocks;
pModif->msgType = (QUERY_NODE_CREATE_TABLE_STMT == pStmt->sqlNodeType ? TDMT_VND_CREATE_TABLE : TDMT_VND_SUBMIT);
return (SLogicNode*)pModif;
}
static SLogicNode* createQueryLogicNode(SLogicPlanContext* pCxt, SNode* pStmt) { static SLogicNode* createQueryLogicNode(SLogicPlanContext* pCxt, SNode* pStmt) {
switch (nodeType(pStmt)) { switch (nodeType(pStmt)) {
case QUERY_NODE_SELECT_STMT: case QUERY_NODE_SELECT_STMT:
return createSelectLogicNode(pCxt, (SSelectStmt*)pStmt); return createSelectLogicNode(pCxt, (SSelectStmt*)pStmt);
case QUERY_NODE_VNODE_MODIF_STMT:
return createVnodeModifLogicNode(pCxt, (SVnodeModifOpStmt*)pStmt);
default: default:
break; break;
} }
......
...@@ -466,10 +466,26 @@ static SPhysiNode* createPhysiNode(SPhysiPlanContext* pCxt, SLogicNode* pLogicPl ...@@ -466,10 +466,26 @@ static SPhysiNode* createPhysiNode(SPhysiPlanContext* pCxt, SLogicNode* pLogicPl
return pPhyNode; return pPhyNode;
} }
static SDataSinkNode* createDataInserter(SPhysiPlanContext* pCxt, SVgDataBlocks* pBlocks) {
SDataInserterNode* pInserter = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_INSERT);
pInserter->numOfTables = pBlocks->numOfTables;
pInserter->size = pBlocks->size;
TSWAP(pInserter->pData, pBlocks->pData, char*);
return (SDataSinkNode*)pInserter;
}
static SSubplan* createPhysiSubplan(SPhysiPlanContext* pCxt, SSubLogicPlan* pLogicSubplan) { static SSubplan* createPhysiSubplan(SPhysiPlanContext* pCxt, SSubLogicPlan* pLogicSubplan) {
SSubplan* pSubplan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN); SSubplan* pSubplan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
CHECK_ALLOC(pSubplan, NULL); CHECK_ALLOC(pSubplan, NULL);
if (SUBPLAN_TYPE_MODIFY == pLogicSubplan->subplanType) {
SVnodeModifLogicNode* pModif = (SVnodeModifLogicNode*)pLogicSubplan->pNode;
pSubplan->pDataSink = createDataInserter(pCxt, pModif->pVgDataBlocks);
pSubplan->msgType = pModif->msgType;
} else {
pSubplan->pNode = createPhysiNode(pCxt, pLogicSubplan->pNode); pSubplan->pNode = createPhysiNode(pCxt, pLogicSubplan->pNode);
// pSubplan->pDataSink = createDataDispatcher(pCxt, pSubplan->pNode);
}
pSubplan->subplanType = pLogicSubplan->subplanType;
return pSubplan; return pSubplan;
} }
...@@ -484,57 +500,130 @@ static int32_t strictListAppend(SNodeList* pList, SNodeptr pNode) { ...@@ -484,57 +500,130 @@ static int32_t strictListAppend(SNodeList* pList, SNodeptr pNode) {
return code; return code;
} }
static SQueryLogicPlan* createRawQueryLogicPlan(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode) { static int32_t splitLogicPlan(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode, SSubLogicPlan** pSubLogicPlan) {
*pSubLogicPlan = (SSubLogicPlan*)nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN);
CHECK_ALLOC(*pSubLogicPlan, TSDB_CODE_OUT_OF_MEMORY);
// todo pSubplan->pNode = nodesCloneNode(pLogicNode);
(*pSubLogicPlan)->pNode = pLogicNode;
if (QUERY_NODE_LOGIC_PLAN_VNODE_MODIF == nodeType(pLogicNode)) {
(*pSubLogicPlan)->subplanType = SUBPLAN_TYPE_MODIFY;
}
// todo split
return TSDB_CODE_SUCCESS;
}
static int32_t pushSubplan(SPhysiPlanContext* pCxt, SNodeptr pSubplan, int32_t level, SNodeList* pSubplans) {
SNodeListNode* pGroup;
if (level >= LIST_LENGTH(pSubplans)) {
pGroup = nodesMakeNode(QUERY_NODE_NODE_LIST);
CHECK_ALLOC(pGroup, TSDB_CODE_OUT_OF_MEMORY);
CHECK_CODE(strictListAppend(pSubplans, pGroup), TSDB_CODE_OUT_OF_MEMORY);
} else {
pGroup = nodesListGetNode(pSubplans, level);
}
if (NULL == pGroup->pNodeList) {
pGroup->pNodeList = nodesMakeList();
CHECK_ALLOC(pGroup->pNodeList, TSDB_CODE_OUT_OF_MEMORY);
}
CHECK_CODE(strictListAppend(pGroup->pNodeList, pSubplan), TSDB_CODE_OUT_OF_MEMORY);
}
SSubLogicPlan* singleCloneSubLogicPlan(SPhysiPlanContext* pCxt, SSubLogicPlan* pSrc, int32_t level) {
SSubLogicPlan* pDst = nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN);
CHECK_ALLOC(pDst, NULL);
// todo pDst->pNode = nodesCloneNode(pSrc->pNode);
pDst->pNode = pSrc->pNode;
if (NULL == pDst->pNode) {
nodesDestroyNode(pDst);
return NULL;
}
pDst->subplanType = pSrc->subplanType;
pDst->level = level;
return pDst;
}
static int32_t doScaleOut(SPhysiPlanContext* pCxt, SSubLogicPlan* pSubplan, int32_t level, SQueryLogicPlan* pLogicPlan) {
if (SUBPLAN_TYPE_MODIFY == pSubplan->subplanType) {
SVnodeModifLogicNode* pNode = (SVnodeModifLogicNode*)pSubplan->pNode;
size_t numOfVgroups = taosArrayGetSize(pNode->pDataBlocks);
for (int32_t i = 0; i < numOfVgroups; ++i) {
SSubLogicPlan* pNewSubplan = singleCloneSubLogicPlan(pCxt, pSubplan, level);
CHECK_ALLOC(pNewSubplan, TSDB_CODE_OUT_OF_MEMORY);
SVgDataBlocks* blocks = (SVgDataBlocks*)taosArrayGetP(pNode->pDataBlocks, i);
pNewSubplan->execNode.epset = blocks->vg.epset;
((SVnodeModifLogicNode*)pNewSubplan->pNode)->pVgDataBlocks = blocks;
CHECK_CODE_EXT(pushSubplan(pCxt, pNewSubplan, level, pLogicPlan->pSubplans));
}
} else {
SSubLogicPlan* pNewSubplan = singleCloneSubLogicPlan(pCxt, pSubplan, level);
CHECK_ALLOC(pNewSubplan, TSDB_CODE_OUT_OF_MEMORY);
CHECK_CODE_EXT(pushSubplan(pCxt, pNewSubplan, level, pLogicPlan->pSubplans));
}
SNode* pChild;
FOREACH(pChild, pSubplan->pChildren) {
CHECK_CODE_EXT(doScaleOut(pCxt, (SSubLogicPlan*)pChild, level + 1, pLogicPlan));
}
return TSDB_CODE_SUCCESS;
}
static SQueryLogicPlan* makeQueryLogicPlan(SPhysiPlanContext* pCxt) {
SQueryLogicPlan* pLogicPlan = (SQueryLogicPlan*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN); SQueryLogicPlan* pLogicPlan = (SQueryLogicPlan*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN);
CHECK_ALLOC(pLogicPlan, NULL); CHECK_ALLOC(pLogicPlan, NULL);
pLogicPlan->pSubplans = nodesMakeList(); pLogicPlan->pSubplans = nodesMakeList();
CHECK_ALLOC(pLogicPlan->pSubplans, pLogicPlan); if (NULL == pLogicPlan->pSubplans) {
SNodeListNode* pTopSubplans = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST); nodesDestroyNode(pLogicPlan);
CHECK_ALLOC(pTopSubplans, pLogicPlan); return NULL;
CHECK_CODE(strictListAppend(pLogicPlan->pSubplans, pTopSubplans), pLogicPlan); }
pTopSubplans->pNodeList = nodesMakeList();
CHECK_ALLOC(pTopSubplans->pNodeList, pLogicPlan);
SSubLogicPlan* pSubplan = (SSubLogicPlan*)nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN);
CHECK_ALLOC(pSubplan, pLogicPlan);
CHECK_CODE(strictListAppend(pTopSubplans->pNodeList, pSubplan), pLogicPlan);
pSubplan->pNode = pLogicNode;
CHECK_ALLOC(pSubplan->pNode, pLogicPlan);
return pLogicPlan; return pLogicPlan;
} }
static int32_t splitLogicPlan(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode, SQueryLogicPlan** pLogicPlan) { static int32_t scaleOutLogicPlan(SPhysiPlanContext* pCxt, SSubLogicPlan* pRootSubLogicPlan, SQueryLogicPlan** pLogicPlan) {
SQueryLogicPlan* pPlan = createRawQueryLogicPlan(pCxt, pLogicNode); *pLogicPlan = makeQueryLogicPlan(pCxt);
if (TSDB_CODE_SUCCESS != pCxt->errCode) { CHECK_ALLOC(*pLogicPlan, TSDB_CODE_OUT_OF_MEMORY);
nodesDestroyNode((SNode*)pPlan); return doScaleOut(pCxt, pRootSubLogicPlan, 0, *pLogicPlan);
return pCxt->errCode;
}
// todo split
*pLogicPlan = pPlan;
return TSDB_CODE_SUCCESS;
} }
static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryPlan** pPlan) { typedef struct SBuildPhysiSubplanCxt {
SQueryPlan* pQueryPlan = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN); int32_t errCode;
CHECK_ALLOC(pQueryPlan, TSDB_CODE_OUT_OF_MEMORY); SQueryPlan* pQueryPlan;
*pPlan = pQueryPlan; SPhysiPlanContext* pPhyCxt;
pQueryPlan->queryId = pCxt->pPlanCxt->queryId; } SBuildPhysiSubplanCxt;
static EDealRes doBuildPhysiSubplan(SNode* pNode, void* pContext) {
SBuildPhysiSubplanCxt* pCxt = (SBuildPhysiSubplanCxt*)pContext;
if (QUERY_NODE_LOGIC_SUBPLAN == nodeType(pNode)) {
SSubplan* pSubplan = createPhysiSubplan(pCxt->pPhyCxt, (SSubLogicPlan*)pNode);
CHECK_ALLOC(pSubplan, DEAL_RES_ERROR);
CHECK_CODE(pushSubplan(pCxt->pPhyCxt, pSubplan, ((SSubLogicPlan*)pNode)->level, pCxt->pQueryPlan->pSubplans), DEAL_RES_ERROR);
++(pCxt->pQueryPlan->numOfSubplans);
return DEAL_RES_IGNORE_CHILD;
}
return DEAL_RES_CONTINUE;
}
pQueryPlan->pSubplans = nodesMakeList(); static SQueryPlan* makeQueryPhysiPlan(SPhysiPlanContext* pCxt) {
CHECK_ALLOC(pQueryPlan->pSubplans, TSDB_CODE_OUT_OF_MEMORY); SQueryPlan* pPlan = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN);
SNode* pNode; CHECK_ALLOC(pPlan, NULL);
FOREACH(pNode, pLogicPlan->pSubplans) { pPlan->pSubplans = nodesMakeList();
SNodeListNode* pLevelSubplans = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST); if (NULL == pPlan->pSubplans) {
CHECK_ALLOC(pLevelSubplans, TSDB_CODE_OUT_OF_MEMORY); nodesDestroyNode(pPlan);
CHECK_CODE(strictListAppend(pQueryPlan->pSubplans, pLevelSubplans), TSDB_CODE_OUT_OF_MEMORY); return NULL;
pLevelSubplans->pNodeList = nodesMakeList();
CHECK_ALLOC(pLevelSubplans->pNodeList, TSDB_CODE_OUT_OF_MEMORY);
SNode* pLogicSubplan;
FOREACH(pLogicSubplan, ((SNodeListNode*)pNode)->pNodeList) {
CHECK_CODE(strictListAppend(pLevelSubplans->pNodeList,
createPhysiSubplan(pCxt, (SSubLogicPlan*)pLogicSubplan)), TSDB_CODE_OUT_OF_MEMORY);
++(pQueryPlan->numOfSubplans);
} }
pPlan->queryId = pCxt->pPlanCxt->queryId;
return pPlan;
}
static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryPlan** pPlan) {
SBuildPhysiSubplanCxt cxt = { .errCode = TSDB_CODE_SUCCESS, .pQueryPlan = makeQueryPhysiPlan(pCxt), .pPhyCxt = pCxt };
CHECK_ALLOC(cxt.pQueryPlan, TSDB_CODE_OUT_OF_MEMORY);
nodesWalkList(pLogicPlan->pSubplans, doBuildPhysiSubplan, &cxt);
if (TSDB_CODE_SUCCESS != cxt.errCode) {
nodesDestroyNode(cxt.pQueryPlan);
return cxt.errCode;
} }
*pPlan = cxt.pQueryPlan;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -549,8 +638,11 @@ int32_t createPhysiPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SQueryPlan** ...@@ -549,8 +638,11 @@ int32_t createPhysiPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SQueryPlan**
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
SQueryLogicPlan* pLogicPlan; SQueryLogicPlan* pLogicPlan;
int32_t code = splitLogicPlan(&cxt, pLogicNode, &pLogicPlan); SSubLogicPlan* pSubLogicPlan;
// todo scale out int32_t code = splitLogicPlan(&cxt, pLogicNode, &pSubLogicPlan);
if (TSDB_CODE_SUCCESS == code) {
code = scaleOutLogicPlan(&cxt, pSubLogicPlan, &pLogicPlan);
}
// todo maping // todo maping
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = buildPhysiPlan(&cxt, pLogicPlan, pPlan); code = buildPhysiPlan(&cxt, pLogicPlan, pPlan);
......
...@@ -38,6 +38,13 @@ void qSetSubplanExecutionNode(SSubplan* subplan, uint64_t templateId, SDownstrea ...@@ -38,6 +38,13 @@ void qSetSubplanExecutionNode(SSubplan* subplan, uint64_t templateId, SDownstrea
} }
int32_t qSubPlanToString(const SSubplan* subplan, char** str, int32_t* len) { int32_t qSubPlanToString(const SSubplan* subplan, char** str, int32_t* len) {
if (SUBPLAN_TYPE_MODIFY == subplan->subplanType) {
SDataInserterNode* insert = (SDataInserterNode*)subplan->pDataSink;
*len = insert->size;
*str = insert->pData;
insert->pData = NULL;
return TSDB_CODE_SUCCESS;
}
return nodesNodeToString((const SNode*)subplan, false, str, len); return nodesNodeToString((const SNode*)subplan, false, str, len);
} }
......
...@@ -151,3 +151,8 @@ TEST_F(PlannerTest, subquery) { ...@@ -151,3 +151,8 @@ TEST_F(PlannerTest, subquery) {
bind("SELECT count(*) FROM (SELECT c1 + c3 a, c1 + count(*) b FROM t1 where c2 = 'abc' GROUP BY c1, c3) where a > 100 group by b"); bind("SELECT count(*) FROM (SELECT c1 + c3 a, c1 + count(*) b FROM t1 where c2 = 'abc' GROUP BY c1, c3) where a > 100 group by b");
ASSERT_TRUE(run()); ASSERT_TRUE(run());
} }
TEST_F(PlannerTest, createTable) {
bind("create table t1(ts timestamp, c1 int)");
ASSERT_TRUE(run());
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册