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