Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
216c5317
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
216c5317
编写于
3月 07, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0_query_integrate' into feature/scheduler
上级
d781ea84
b05e83da
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
2586 addition
and
2443 deletion
+2586
-2443
include/common/ttokendef.h
include/common/ttokendef.h
+87
-85
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+17
-1
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+2
-0
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+1
-0
include/libs/parser/parser.h
include/libs/parser/parser.h
+0
-1
include/util/taoserror.h
include/util/taoserror.h
+2
-0
source/common/src/tvariant.c
source/common/src/tvariant.c
+3
-3
source/libs/nodes/inc/nodesint.h
source/libs/nodes/inc/nodesint.h
+34
-0
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+2
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+106
-78
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+7
-3
source/libs/parser/inc/astCreateFuncs.h
source/libs/parser/inc/astCreateFuncs.h
+6
-1
source/libs/parser/inc/new_sql.y
source/libs/parser/inc/new_sql.y
+191
-185
source/libs/parser/inc/parserUtil.h
source/libs/parser/inc/parserUtil.h
+2
-10
source/libs/parser/inc/ttoken.h
source/libs/parser/inc/ttoken.h
+9
-9
source/libs/parser/src/astCreateFuncs.c
source/libs/parser/src/astCreateFuncs.c
+50
-9
source/libs/parser/src/astParse.c
source/libs/parser/src/astParse.c
+8
-24
source/libs/parser/src/astTranslate.c
source/libs/parser/src/astTranslate.c
+368
-69
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+98
-5
source/libs/parser/src/new_sql.c
source/libs/parser/src/new_sql.c
+1381
-1343
source/libs/parser/src/parserUtil.c
source/libs/parser/src/parserUtil.c
+23
-87
source/libs/parser/src/ttokenizer.c
source/libs/parser/src/ttokenizer.c
+99
-93
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+8
-1
source/libs/parser/test/parserTest.cpp
source/libs/parser/test/parserTest.cpp
+77
-434
source/libs/planner/src/logicPlan.c
source/libs/planner/src/logicPlan.c
+5
-1
未找到文件。
include/common/ttokendef.h
浏览文件 @
216c5317
...
...
@@ -55,102 +55,104 @@
#define TK_TTL 37
#define TK_WAL 38
#define TK_VGROUPS 39
#define TK_SINGLE
STABLE
40
#define TK_STREAM
MODE
41
#define TK_SINGLE
_STABLE
40
#define TK_STREAM
_MODE
41
#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_TABLES 70
#define TK_NK_FLOAT 71
#define TK_NK_BOOL 72
#define TK_NK_VARIABLE 73
#define TK_BETWEEN 74
#define TK_IS 75
#define TK_NULL 76
#define TK_NK_LT 77
#define TK_NK_GT 78
#define TK_NK_LE 79
#define TK_NK_GE 80
#define TK_NK_NE 81
#define TK_NK_EQ 82
#define TK_LIKE 83
#define TK_MATCH 84
#define TK_NMATCH 85
#define TK_IN 86
#define TK_FROM 87
#define TK_AS 88
#define TK_JOIN 89
#define TK_ON 90
#define TK_INNER 91
#define TK_SELECT 92
#define TK_DISTINCT 93
#define TK_WHERE 94
#define TK_PARTITION 95
#define TK_BY 96
#define TK_SESSION 97
#define TK_STATE_WINDOW 98
#define TK_INTERVAL 99
#define TK_SLIDING 100
#define TK_FILL 101
#define TK_VALUE 102
#define TK_NONE 103
#define TK_PREV 104
#define TK_LINEAR 105
#define TK_NEXT 106
#define TK_GROUP 107
#define TK_HAVING 108
#define TK_ORDER 109
#define TK_SLIMIT 110
#define TK_SOFFSET 111
#define TK_LIMIT 112
#define TK_OFFSET 113
#define TK_ASC 114
#define TK_DESC 115
#define TK_NULLS 116
#define TK_FIRST 117
#define TK_LAST 118
#define TK_STABLE 46
#define TK_USING 47
#define TK_TAGS 48
#define TK_NK_ID 49
#define TK_NK_DOT 50
#define TK_NK_COMMA 51
#define TK_COMMENT 52
#define TK_BOOL 53
#define TK_TINYINT 54
#define TK_SMALLINT 55
#define TK_INT 56
#define TK_INTEGER 57
#define TK_BIGINT 58
#define TK_FLOAT 59
#define TK_DOUBLE 60
#define TK_BINARY 61
#define TK_TIMESTAMP 62
#define TK_NCHAR 63
#define TK_UNSIGNED 64
#define TK_JSON 65
#define TK_VARCHAR 66
#define TK_MEDIUMBLOB 67
#define TK_BLOB 68
#define TK_VARBINARY 69
#define TK_DECIMAL 70
#define TK_SMA 71
#define TK_SHOW 72
#define TK_DATABASES 73
#define TK_TABLES 74
#define TK_NK_FLOAT 75
#define TK_NK_BOOL 76
#define TK_NK_VARIABLE 77
#define TK_BETWEEN 78
#define TK_IS 79
#define TK_NULL 80
#define TK_NK_LT 81
#define TK_NK_GT 82
#define TK_NK_LE 83
#define TK_NK_GE 84
#define TK_NK_NE 85
#define TK_NK_EQ 86
#define TK_LIKE 87
#define TK_MATCH 88
#define TK_NMATCH 89
#define TK_IN 90
#define TK_FROM 91
#define TK_AS 92
#define TK_JOIN 93
#define TK_ON 94
#define TK_INNER 95
#define TK_SELECT 96
#define TK_DISTINCT 97
#define TK_WHERE 98
#define TK_PARTITION 99
#define TK_BY 100
#define TK_SESSION 101
#define TK_STATE_WINDOW 102
#define TK_INTERVAL 103
#define TK_SLIDING 104
#define TK_FILL 105
#define TK_VALUE 106
#define TK_NONE 107
#define TK_PREV 108
#define TK_LINEAR 109
#define TK_NEXT 110
#define TK_GROUP 111
#define TK_HAVING 112
#define TK_ORDER 113
#define TK_SLIMIT 114
#define TK_SOFFSET 115
#define TK_LIMIT 116
#define TK_OFFSET 117
#define TK_ASC 118
#define TK_DESC 119
#define TK_NULLS 120
#define TK_FIRST 121
#define TK_LAST 122
#define TK_
SPACE
300
#define TK_NK_COMMENT
301
#define TK_
ILLEGAL
302
#define TK_
HEX
303 // hex number 0x123
#define TK_
OCT
304 // oct number
#define TK_
BIN
305 // bin format data 0b111
#define TK_
FILE
306
#define TK_
QUESTION
307 // denoting the placeholder of "?",when invoking statement bind query
#define TK_
NK_SPACE
300
#define TK_NK_COMMENT 301
#define TK_
NK_ILLEGAL
302
#define TK_
NK_HEX
303 // hex number 0x123
#define TK_
NK_OCT
304 // oct number
#define TK_
NK_BIN
305 // bin format data 0b111
#define TK_
NK_FILE
306
#define TK_
NK_QUESTION
307 // denoting the placeholder of "?",when invoking statement bind query
#define TK_NK_COLON 500
#define TK_NK_BITNOT 501
#define TK_INSERT 502
#define TK_INTO 503
#define TK_NOW 504
#define TK_TAGS 505
#define TK_USING 506
#define TK_VALUES 507
#define TK_IMPORT 507
#define TK_SEMI 508
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
216c5317
...
...
@@ -58,6 +58,7 @@ typedef struct STableOptions {
int32_t
keep
;
int32_t
ttl
;
char
comments
[
TSDB_STB_COMMENT_LEN
];
SNodeList
*
pSma
;
}
STableOptions
;
typedef
struct
SColumnDefNode
{
...
...
@@ -73,10 +74,25 @@ typedef struct SCreateTableStmt {
char
tableName
[
TSDB_TABLE_NAME_LEN
];
bool
ignoreExists
;
SNodeList
*
pCols
;
SNodeList
*
pTags
;
STableOptions
options
;
}
SCreateTableStmt
;
// CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options]
typedef
struct
SCreateSubTableClause
{
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
char
useDbName
[
TSDB_DB_NAME_LEN
];
char
useTableName
[
TSDB_TABLE_NAME_LEN
];
bool
ignoreExists
;
SNodeList
*
pSpecificTags
;
SNodeList
*
pValsOfTags
;
}
SCreateSubTableClause
;
typedef
struct
SCreateMultiTableStmt
{
ENodeType
type
;
SNodeList
*
pSubTables
;
}
SCreateMultiTableStmt
;
#ifdef __cplusplus
}
...
...
include/libs/nodes/nodes.h
浏览文件 @
216c5317
...
...
@@ -73,6 +73,8 @@ typedef enum ENodeType {
QUERY_NODE_VNODE_MODIF_STMT
,
QUERY_NODE_CREATE_DATABASE_STMT
,
QUERY_NODE_CREATE_TABLE_STMT
,
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
,
QUERY_NODE_CREATE_MULTI_TABLE_STMT
,
QUERY_NODE_USE_DATABASE_STMT
,
QUERY_NODE_SHOW_DATABASES_STMT
,
// temp
QUERY_NODE_SHOW_TABLES_STMT
,
// temp
...
...
include/libs/nodes/querynodes.h
浏览文件 @
216c5317
...
...
@@ -74,6 +74,7 @@ typedef struct SValueNode {
SExprNode
node
;
// QUERY_NODE_VALUE
char
*
literal
;
bool
isDuration
;
bool
translate
;
union
{
bool
b
;
int64_t
i
;
...
...
include/libs/parser/parser.h
浏览文件 @
216c5317
...
...
@@ -46,7 +46,6 @@ typedef struct SCmdMsgInfo {
typedef
struct
SQuery
{
bool
directRpc
;
bool
haveResultSet
;
ENodeType
sqlNodeType
;
SNode
*
pRoot
;
int32_t
numOfResCols
;
SSchema
*
pResSchema
;
...
...
include/util/taoserror.h
浏览文件 @
216c5317
...
...
@@ -469,6 +469,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A)
#define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B)
#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C)
#define TSDB_CODE_PAR_TAGS_NOT_MATCHED TAOS_DEF_ERROR_CODE(0, 0x260D)
#define TSDB_CODE_PAR_INVALID_TAG_NAME TAOS_DEF_ERROR_CODE(0, 0x260E)
#ifdef __cplusplus
}
...
...
source/common/src/tvariant.c
浏览文件 @
216c5317
...
...
@@ -94,11 +94,11 @@ void taosVariantCreate(SVariant *pVar, const char *z, int32_t n, int32_t type) {
bool
sign
=
true
;
int32_t
base
=
10
;
if
(
type
==
TK_HEX
)
{
if
(
type
==
TK_
NK_
HEX
)
{
base
=
16
;
}
else
if
(
type
==
TK_OCT
)
{
}
else
if
(
type
==
TK_
NK_
OCT
)
{
base
=
8
;
}
else
if
(
type
==
TK_BIN
)
{
}
else
if
(
type
==
TK_
NK_
BIN
)
{
base
=
2
;
}
...
...
source/libs/nodes/inc/nodesint.h
0 → 100644
浏览文件 @
216c5317
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_NODES_INT_H_
#define _TD_NODES_INT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#define nodesFatal(param, ...) qFatal("NODES: " param, __VA_ARGS__)
#define nodesError(param, ...) qError("NODES: " param, __VA_ARGS__)
#define nodesWarn(param, ...) qWarn("NODES: " param, __VA_ARGS__)
#define nodesInfo(param, ...) qInfo("NODES: " param, __VA_ARGS__)
#define nodesDebug(param, ...) qDebug("NODES: " param, __VA_ARGS__)
#define nodesTrace(param, ...) qTrace("NODES: " param, __VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif
/*_TD_NODES_INT_H_*/
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
216c5317
...
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nodesint.h"
#include "plannodes.h"
#include "querynodes.h"
#include "taos.h"
...
...
@@ -221,7 +222,7 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) {
default:
break
;
}
printf
(
"nodesCloneNode unknown node = %s
\n
"
,
nodesNodeName
(
nodeType
(
pNode
)));
nodesWarn
(
"nodesCloneNode unknown node = %s
"
,
nodesNodeName
(
nodeType
(
pNode
)));
return
pDst
;
}
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
216c5317
...
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nodesint.h"
#include "plannodes.h"
#include "querynodes.h"
#include "query.h"
...
...
@@ -127,9 +128,8 @@ const char* nodesNodeName(ENodeType type) {
default:
break
;
}
static
char
tmp
[
20
];
snprintf
(
tmp
,
sizeof
(
tmp
),
"Unknown %d"
,
type
);
return
tmp
;
nodesWarn
(
"nodesNodeName unknown node = %d"
,
type
);
return
"UnknownNode"
;
}
static
int32_t
nodeListToJson
(
SJson
*
pJson
,
const
char
*
pName
,
const
SNodeList
*
pList
)
{
...
...
@@ -871,8 +871,53 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
static
const
char
*
jkValueLiteral
=
"Literal"
;
static
const
char
*
jkValueDuration
=
"Duration"
;
static
const
char
*
jkValueTranslate
=
"Translate"
;
static
const
char
*
jkValueDatum
=
"Datum"
;
static
int32_t
datumToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SValueNode
*
pNode
=
(
const
SValueNode
*
)
pObj
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
pNode
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
b
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
i
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
u
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
code
=
tjsonAddDoubleToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
d
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
code
=
tjsonAddStringToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
p
);
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
default:
break
;
}
return
code
;
}
static
int32_t
valueNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SValueNode
*
pNode
=
(
const
SValueNode
*
)
pObj
;
...
...
@@ -884,42 +929,54 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) {
code
=
tjsonAddBoolToObject
(
pJson
,
jkValueDuration
,
pNode
->
isDuration
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
switch
(
pNode
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
b
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
i
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
u
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
code
=
tjsonAddDoubleToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
d
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
code
=
tjsonAddStringToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
p
);
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
default:
break
;
}
code
=
tjsonAddBoolToObject
(
pJson
,
jkValueTranslate
,
pNode
->
translate
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
pNode
->
translate
)
{
code
=
datumToJson
(
pNode
,
pJson
);
}
return
code
;
}
static
int32_t
jsonToDatum
(
const
SJson
*
pJson
,
void
*
pObj
)
{
SValueNode
*
pNode
=
(
SValueNode
*
)
pObj
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
pNode
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
code
=
tjsonGetBoolValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
b
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
code
=
tjsonGetBigIntValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
i
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
code
=
tjsonGetUBigIntValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
u
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
code
=
tjsonGetDoubleValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
d
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
code
=
tjsonDupStringValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
p
);
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
default:
break
;
}
return
code
;
...
...
@@ -936,42 +993,10 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) {
code
=
tjsonGetBoolValue
(
pJson
,
jkValueDuration
,
&
pNode
->
isDuration
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
switch
(
pNode
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
code
=
tjsonGetBoolValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
b
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
code
=
tjsonGetBigIntValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
i
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
code
=
tjsonGetUBigIntValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
u
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
code
=
tjsonGetDoubleValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
d
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
code
=
tjsonDupStringValue
(
pJson
,
jkValueDatum
,
&
pNode
->
datum
.
p
);
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
default:
break
;
}
code
=
tjsonGetBoolValue
(
pJson
,
jkValueTranslate
,
&
pNode
->
translate
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
pNode
->
translate
)
{
code
=
jsonToDatum
(
pJson
,
pNode
);
}
return
code
;
...
...
@@ -1365,7 +1390,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
default:
break
;
}
printf
(
"================================ specificNodeToJson unknown node = %s
\n
"
,
nodesNodeName
(
nodeType
(
pObj
)));
nodesWarn
(
"specificNodeToJson unknown node = %s
"
,
nodesNodeName
(
nodeType
(
pObj
)));
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1434,7 +1459,7 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
default:
break
;
}
printf
(
"================================ jsonToSpecificNode unknown node = %s
\n
"
,
nodesNodeName
(
nodeType
(
pObj
)));
nodesWarn
(
"jsonToSpecificNode unknown node = %s
"
,
nodesNodeName
(
nodeType
(
pObj
)));
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1450,6 +1475,9 @@ static int32_t nodeToJson(const void* pObj, SJson* pJson) {
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
nodesNodeName
(
pNode
->
type
),
specificNodeToJson
,
pNode
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesError
(
"%s ToJson error"
,
nodesNodeName
(
pNode
->
type
));
}
}
return
code
;
...
...
@@ -1464,7 +1492,7 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonToObject
(
pJson
,
nodesNodeName
(
pNode
->
type
),
jsonToSpecificNode
,
pNode
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
printf
(
"%s toNode error
\n
"
,
nodesNodeName
(
pNode
->
type
));
nodesError
(
"%s toNode error
"
,
nodesNodeName
(
pNode
->
type
));
}
}
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
216c5317
...
...
@@ -14,11 +14,11 @@
*/
#include "cmdnodes.h"
#include "
querynodes
.h"
#include "
nodesint
.h"
#include "plannodes.h"
#include "querynodes.h"
#include "taos.h"
#include "taoserror.h"
#include "taos.h"
#include "thash.h"
static
SNode
*
makeNode
(
ENodeType
type
,
size_t
size
)
{
...
...
@@ -84,6 +84,10 @@ SNodeptr nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SCreateDatabaseStmt
));
case
QUERY_NODE_CREATE_TABLE_STMT
:
return
makeNode
(
type
,
sizeof
(
SCreateTableStmt
));
case
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
:
return
makeNode
(
type
,
sizeof
(
SCreateSubTableClause
));
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
return
makeNode
(
type
,
sizeof
(
SCreateMultiTableStmt
));
case
QUERY_NODE_USE_DATABASE_STMT
:
return
makeNode
(
type
,
sizeof
(
SUseDatabaseStmt
));
case
QUERY_NODE_SHOW_DATABASES_STMT
:
...
...
@@ -132,7 +136,7 @@ SNodeptr nodesMakeNode(ENodeType type) {
default:
break
;
}
printf
(
"================================ nodesMakeNode unknown node = %s
\n
"
,
nodesNodeName
(
type
));
nodesError
(
"nodesMakeNode unknown node = %s
"
,
nodesNodeName
(
type
));
return
NULL
;
}
...
...
source/libs/parser/inc/astCreateFuncs.h
浏览文件 @
216c5317
...
...
@@ -110,15 +110,20 @@ typedef enum ETableOptionType {
TABLE_OPTION_KEEP
=
0
,
TABLE_OPTION_TTL
,
TABLE_OPTION_COMMENT
,
TABLE_OPTION_SMA
,
TABLE_OPTION_MAX
}
ETableOptionType
;
STableOptions
*
createDefaultTableOptions
(
SAstCreateContext
*
pCxt
);
STableOptions
*
setTableOption
(
SAstCreateContext
*
pCxt
,
STableOptions
*
pOptions
,
ETableOptionType
type
,
const
SToken
*
pVal
);
STableOptions
*
setTableSmaOption
(
SAstCreateContext
*
pCxt
,
STableOptions
*
pOptions
,
SNodeList
*
pSma
);
SNode
*
createColumnDefNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pColName
,
SDataType
dataType
,
const
SToken
*
pComment
);
SDataType
createDataType
(
uint8_t
type
);
SDataType
createVarLenDataType
(
uint8_t
type
,
const
SToken
*
pLen
);
SNode
*
createCreateTableStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
STokenPair
*
pFullTableName
,
SNodeList
*
pCols
,
STableOptions
*
pOptions
);
SNode
*
createCreateTableStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
STokenPair
*
pFullTableName
,
SNodeList
*
pCols
,
SNodeList
*
pTags
,
STableOptions
*
pOptions
);
SNode
*
createCreateSubTableClause
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
STokenPair
*
pFullTableName
,
const
STokenPair
*
pUseFullTableName
,
SNodeList
*
pSpecificTags
,
SNodeList
*
pValsOfTags
);
SNode
*
createCreateMultiTableStmt
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pSubTables
);
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
);
...
...
source/libs/parser/inc/new_sql.y
浏览文件 @
216c5317
...
...
@@ -6,7 +6,7 @@
%token_prefix TK_
%token_type { SToken }
%default_type { SNode* }
%default_destructor {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyNode($$); }
%default_destructor { nodesDestroyNode($$); }
%extra_argument { SAstCreateContext* pCxt }
...
...
@@ -21,16 +21,6 @@
#include "ttoken.h"
#include "ttokendef.h"
#include "astCreateFuncs.h"
#if 0
#define PARSER_TRACE printf("lemon rule = %s\n", yyRuleName[yyruleno])
#define PARSER_DESTRUCTOR_TRACE printf("lemon destroy token = %s\n", yyTokenName[yymajor])
#define PARSER_COMPLETE printf("parsing complete!\n" )
#else
#define PARSER_TRACE
#define PARSER_DESTRUCTOR_TRACE
#define PARSER_COMPLETE
#endif
}
%syntax_error {
...
...
@@ -51,8 +41,6 @@
pCxt->valid = false;
}
%parse_accept { PARSER_COMPLETE; }
%left OR.
%left AND.
//%right NOT.
...
...
@@ -68,6 +56,7 @@
cmd ::= CREATE DATABASE exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C);}
%type exists_opt { bool }
%destructor exists_opt { }
exists_opt(A) ::= IF NOT EXISTS. { A = true; }
exists_opt(A) ::= . { A = false; }
...
...
@@ -76,7 +65,7 @@ exists_opt(A) ::= .
db_options(A) ::= . { A = createDefaultDatabaseOptions(pCxt); }
db_options(A) ::= db_options(B) BLOCKS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_BLOCKS, &C); }
db_options(A) ::= db_options(B) CACHE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHE, &C); }
db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(
X)(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_CACHELAST, &C); }
db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(
C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_CACHELAST, &C); }
db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); }
db_options(A) ::= db_options(B) DAYS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); }
...
...
@@ -89,15 +78,34 @@ db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C).
db_options(A) ::= db_options(B) TTL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TTL, &C); }
db_options(A) ::= db_options(B) WAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL, &C); }
db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_VGROUPS, &C); }
db_options(A) ::= db_options(B) SINGLE
STABLE NK_INTEGER(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLESTABLE, &C); }
db_options(A) ::= db_options(B) STREAM
MODE NK_INTEGER(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_STREAMMODE, &C); }
db_options(A) ::= db_options(B) SINGLE
_STABLE NK_INTEGER(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLESTABLE, &C); }
db_options(A) ::= db_options(B) STREAM
_MODE NK_INTEGER(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_STREAMMODE, &C); }
/************************************************ create database *****************************************************/
cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A);}
/************************************************ create table
******
*************************************************/
/************************************************ create table
/stable
*************************************************/
cmd ::= CREATE TABLE exists_opt(A) full_table_name(B)
NK_LP column_def_list(C) NK_RP table_options(D). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D);}
NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D, E);}
cmd ::= CREATE TABLE multi_create_clause(A). { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, A);}
cmd ::= CREATE STABLE exists_opt(A) full_table_name(B)
NK_LP column_def_list(C) NK_RP tags_def(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D, E);}
%type multi_create_clause { SNodeList* }
%destructor multi_create_clause { nodesDestroyList($$); }
multi_create_clause(A) ::= create_subtable_clause(B). { A = createNodeList(pCxt, B); }
multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C). { A = addNodeToList(pCxt, B, C); }
create_subtable_clause(A) ::=
exists_opt(B) full_table_name(C) USING full_table_name(D)
specific_tags_opt(E) TAGS NK_LP literal_list(F) NK_RP. { A = createCreateSubTableClause(pCxt, B, &C, &D, E, F); }
%type specific_tags_opt { SNodeList* }
%destructor specific_tags_opt { nodesDestroyList($$); }
specific_tags_opt(A) ::= . { A = NULL; }
specific_tags_opt(A) ::= NK_LP col_name_list(B) NK_RP. { A = B; }
%type full_table_name { STokenPair }
%destructor full_table_name { }
...
...
@@ -138,247 +146,247 @@ 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 tags_def_opt { SNodeList* }
%destructor tags_def_opt { nodesDestroyList($$); }
tags_def_opt(A) ::= . { A = NULL; }
tags_def_opt(A) ::= tags_def(B). { A = B; }
%type tags_def { SNodeList* }
%destructor tags_def { nodesDestroyList($$); }
tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP. { A = B; }
%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) COMMENT NK_
STRING(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); }
table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { A = setTableSmaOption(pCxt, B, C); }
%type col_name_list { SNodeList* }
%destructor col_name_list { nodesDestroyList($$); }
col_name_list(A) ::= col_name(B). { A = createNodeList(pCxt, B); }
col_name_list(A) ::= col_name_list(B) NK_COMMA col_name(C). { A = addNodeToList(pCxt, B, C); }
col_name(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); }
/************************************************ show ***************************************************************/
cmd ::= SHOW DATABASES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
cmd ::= SHOW TABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT); }
/************************************************ select *************************************************************/
cmd ::= query_expression(A). {
PARSER_TRACE;
pCxt->pRootNode = A; }
cmd ::= query_expression(A). { pCxt->pRootNode = A; }
/************************************************ literal *************************************************************/
literal(A) ::= NK_INTEGER(B). {
PARSER_TRACE;
A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); }
literal(A) ::= NK_FLOAT(B). {
PARSER_TRACE;
A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); }
literal(A) ::= NK_STRING(B). {
PARSER_TRACE;
A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)); }
literal(A) ::= NK_BOOL(B). {
PARSER_TRACE;
A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); }
literal(A) ::= TIMESTAMP(B) NK_STRING(C). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); }
literal(A) ::= duration_literal(B). {
PARSER_TRACE;
A = B; }
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); }
literal(A) ::= NK_FLOAT(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); }
literal(A) ::= NK_STRING(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)); }
literal(A) ::= NK_BOOL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); }
literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); }
literal(A) ::= duration_literal(B). { A = B; }
duration_literal(A) ::= NK_VARIABLE(B). {
PARSER_TRACE;
A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
%type literal_list { SNodeList* }
%destructor literal_list {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
literal_list(A) ::= literal(B). {
PARSER_TRACE;
A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
literal_list(A) ::= literal_list(B) NK_COMMA literal(C). {
PARSER_TRACE;
A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
%destructor literal_list { nodesDestroyList($$); }
literal_list(A) ::= literal(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
literal_list(A) ::= literal_list(B) NK_COMMA literal(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
/************************************************ names and identifiers ***********************************************/
%type db_name { SToken }
%destructor db_name {
PARSER_DESTRUCTOR_TRACE;
}
db_name(A) ::= NK_ID(B). {
PARSER_TRACE;
A = B; }
%destructor db_name { }
db_name(A) ::= NK_ID(B). { A = B; }
%type table_name { SToken }
%destructor table_name {
PARSER_DESTRUCTOR_TRACE;
}
table_name(A) ::= NK_ID(B). {
PARSER_TRACE;
A = B; }
%destructor table_name { }
table_name(A) ::= NK_ID(B). { A = B; }
%type column_name { SToken }
%destructor column_name {
PARSER_DESTRUCTOR_TRACE;
}
column_name(A) ::= NK_ID(B). {
PARSER_TRACE;
A = B; }
%destructor column_name { }
column_name(A) ::= NK_ID(B). { A = B; }
%type function_name { SToken }
%destructor function_name {
PARSER_DESTRUCTOR_TRACE;
}
function_name(A) ::= NK_ID(B). {
PARSER_TRACE;
A = B; }
%destructor function_name { }
function_name(A) ::= NK_ID(B). { A = B; }
%type table_alias { SToken }
%destructor table_alias {
PARSER_DESTRUCTOR_TRACE;
}
table_alias(A) ::= NK_ID(B). {
PARSER_TRACE;
A = B; }
%destructor table_alias { }
table_alias(A) ::= NK_ID(B). { A = B; }
%type column_alias { SToken }
%destructor column_alias {
PARSER_DESTRUCTOR_TRACE;
}
column_alias(A) ::= NK_ID(B). {
PARSER_TRACE;
A = B; }
%destructor column_alias { }
column_alias(A) ::= NK_ID(B). { A = B; }
/************************************************ expression **********************************************************/
expression(A) ::= literal(B). {
PARSER_TRACE;
A = B; }
//expression(A) ::= NK_QUESTION(B). {
PARSER_TRACE;
A = B; }
//expression(A) ::= pseudo_column(B). {
PARSER_TRACE;
A = B; }
expression(A) ::= column_reference(B). {
PARSER_TRACE;
A = B; }
expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
expression(A) ::= function_name(B) NK_LP NK_STAR(C) NK_RP(D). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, createNodeList(pCxt, createColumnNode(pCxt, NULL, &C)))); }
//expression(A) ::= cast_expression(B). {
PARSER_TRACE;
A = B; }
//expression(A) ::= case_expression(B). {
PARSER_TRACE;
A = B; }
expression(A) ::= subquery(B). {
PARSER_TRACE;
A = B; }
expression(A) ::= NK_LP(B) expression(C) NK_RP(D). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); }
expression(A) ::= literal(B). { A = B; }
//expression(A) ::= NK_QUESTION(B). { A = B; }
//expression(A) ::= pseudo_column(B). { A = B; }
expression(A) ::= column_reference(B). { A = B; }
expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
expression(A) ::= function_name(B) NK_LP NK_STAR(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, createNodeList(pCxt, createColumnNode(pCxt, NULL, &C)))); }
//expression(A) ::= cast_expression(B). { A = B; }
//expression(A) ::= case_expression(B). { A = B; }
expression(A) ::= subquery(B). { A = B; }
expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); }
expression(A) ::= NK_PLUS(B) expression(C). {
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &t, releaseRawExprNode(pCxt, C));
}
expression(A) ::= NK_MINUS(B) expression(C). {
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, C), NULL));
}
expression(A) ::= expression(B) NK_PLUS expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
expression(A) ::= expression(B) NK_MINUS expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
expression(A) ::= expression(B) NK_STAR expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
expression(A) ::= expression(B) NK_SLASH expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
expression(A) ::= expression(B) NK_REM expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
%type expression_list { SNodeList* }
%destructor expression_list {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
expression_list(A) ::= expression(B). {
PARSER_TRACE;
A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
expression_list(A) ::= expression_list(B) NK_COMMA expression(C). {
PARSER_TRACE;
A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
%destructor expression_list { nodesDestroyList($$); }
expression_list(A) ::= expression(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
expression_list(A) ::= expression_list(B) NK_COMMA expression(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
column_reference(A) ::= column_name(B). {
PARSER_TRACE;
A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); }
column_reference(A) ::= table_name(B) NK_DOT column_name(C). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); }
column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); }
column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); }
//pseudo_column(A) ::= NK_NOW. {
PARSER_TRACE;
A = createFunctionNode(pCxt, NULL, NULL); }
//pseudo_column(A) ::= NK_NOW. { A = createFunctionNode(pCxt, NULL, NULL); }
/************************************************ predicate ***********************************************************/
predicate(A) ::= expression(B) compare_op(C) expression(D). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
}
//predicate(A) ::= expression(B) compare_op sub_type expression(B).
predicate(A) ::= expression(B) BETWEEN expression(C) AND expression(D). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D)));
}
predicate(A) ::= expression(B) NOT BETWEEN expression(C) AND expression(D). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
}
predicate(A) ::= expression(B) IS NULL(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, B), NULL));
}
predicate(A) ::= expression(B) IS NOT NULL(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, B), NULL));
}
predicate(A) ::= expression(B) in_op(C) in_predicate_value(D). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
}
%type compare_op { EOperatorType }
%destructor compare_op {
PARSER_DESTRUCTOR_TRACE;
}
compare_op(A) ::= NK_LT. {
PARSER_TRACE;
A = OP_TYPE_LOWER_THAN; }
compare_op(A) ::= NK_GT. {
PARSER_TRACE;
A = OP_TYPE_GREATER_THAN; }
compare_op(A) ::= NK_LE. {
PARSER_TRACE;
A = OP_TYPE_LOWER_EQUAL; }
compare_op(A) ::= NK_GE. {
PARSER_TRACE;
A = OP_TYPE_GREATER_EQUAL; }
compare_op(A) ::= NK_NE. {
PARSER_TRACE;
A = OP_TYPE_NOT_EQUAL; }
compare_op(A) ::= NK_EQ. {
PARSER_TRACE;
A = OP_TYPE_EQUAL; }
compare_op(A) ::= LIKE. {
PARSER_TRACE;
A = OP_TYPE_LIKE; }
compare_op(A) ::= NOT LIKE. {
PARSER_TRACE;
A = OP_TYPE_NOT_LIKE; }
compare_op(A) ::= MATCH. {
PARSER_TRACE;
A = OP_TYPE_MATCH; }
compare_op(A) ::= NMATCH. {
PARSER_TRACE;
A = OP_TYPE_NMATCH; }
%destructor compare_op { }
compare_op(A) ::= NK_LT. { A = OP_TYPE_LOWER_THAN; }
compare_op(A) ::= NK_GT. { A = OP_TYPE_GREATER_THAN; }
compare_op(A) ::= NK_LE. { A = OP_TYPE_LOWER_EQUAL; }
compare_op(A) ::= NK_GE. { A = OP_TYPE_GREATER_EQUAL; }
compare_op(A) ::= NK_NE. { A = OP_TYPE_NOT_EQUAL; }
compare_op(A) ::= NK_EQ. { A = OP_TYPE_EQUAL; }
compare_op(A) ::= LIKE. { A = OP_TYPE_LIKE; }
compare_op(A) ::= NOT LIKE. { A = OP_TYPE_NOT_LIKE; }
compare_op(A) ::= MATCH. { A = OP_TYPE_MATCH; }
compare_op(A) ::= NMATCH. { A = OP_TYPE_NMATCH; }
%type in_op { EOperatorType }
%destructor in_op {
PARSER_DESTRUCTOR_TRACE;
}
in_op(A) ::= IN. {
PARSER_TRACE;
A = OP_TYPE_IN; }
in_op(A) ::= NOT IN. {
PARSER_TRACE;
A = OP_TYPE_NOT_IN; }
%destructor in_op { }
in_op(A) ::= IN. { A = OP_TYPE_IN; }
in_op(A) ::= NOT IN. { A = OP_TYPE_NOT_IN; }
in_predicate_value(A) ::= NK_LP(C) expression_list(B) NK_RP(D). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &C, &D, createNodeListNode(pCxt, B)); }
in_predicate_value(A) ::= NK_LP(C) expression_list(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, createNodeListNode(pCxt, B)); }
/************************************************ boolean_value_expression ********************************************/
boolean_value_expression(A) ::= boolean_primary(B). {
PARSER_TRACE;
A = B; }
boolean_value_expression(A) ::= boolean_primary(B). { A = B; }
boolean_value_expression(A) ::= NOT(C) boolean_primary(B). {
PARSER_TRACE;
SToken e = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &C, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, B), NULL));
}
boolean_value_expression(A) ::=
boolean_value_expression(B) OR boolean_value_expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
boolean_value_expression(A) ::=
boolean_value_expression(B) AND boolean_value_expression(C). {
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
boolean_primary(A) ::= predicate(B). {
PARSER_TRACE;
A = B; }
boolean_primary(A) ::= NK_LP(C) boolean_value_expression(B) NK_RP(D). {
PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &C, &D, releaseRawExprNode(pCxt, B)); }
boolean_primary(A) ::= predicate(B). { A = B; }
boolean_primary(A) ::= NK_LP(C) boolean_value_expression(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, releaseRawExprNode(pCxt, B)); }
/************************************************ common_expression ********************************************/
common_expression(A) ::= expression(B). { A = B; }
common_expression(A) ::= boolean_value_expression(B). { A = B; }
/************************************************ from_clause *********************************************************/
from_clause(A) ::= FROM table_reference_list(B). {
PARSER_TRACE;
A = B; }
from_clause(A) ::= FROM table_reference_list(B). { A = B; }
table_reference_list(A) ::= table_reference(B). {
PARSER_TRACE;
A = B; }
table_reference_list(A) ::= table_reference_list(B) NK_COMMA table_reference(C). {
PARSER_TRACE;
A = createJoinTableNode(pCxt, JOIN_TYPE_INNER, B, C, NULL); }
table_reference_list(A) ::= table_reference(B). { A = B; }
table_reference_list(A) ::= table_reference_list(B) NK_COMMA table_reference(C). { A = createJoinTableNode(pCxt, JOIN_TYPE_INNER, B, C, NULL); }
/************************************************ table_reference *****************************************************/
table_reference(A) ::= table_primary(B). {
PARSER_TRACE;
A = B; }
table_reference(A) ::= joined_table(B). {
PARSER_TRACE;
A = B; }
table_reference(A) ::= table_primary(B). { A = B; }
table_reference(A) ::= joined_table(B). { A = B; }
table_primary(A) ::= table_name(B) alias_opt(C). {
PARSER_TRACE;
A = createRealTableNode(pCxt, NULL, &B, &C); }
table_primary(A) ::= db_name(B) NK_DOT table_name(C) alias_opt(D). {
PARSER_TRACE;
A = createRealTableNode(pCxt, &B, &C, &D); }
table_primary(A) ::= subquery(B) alias_opt(C). {
PARSER_TRACE;
A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
table_primary(A) ::= parenthesized_joined_table(B). {
PARSER_TRACE;
A = B; }
table_primary(A) ::= table_name(B) alias_opt(C). { A = createRealTableNode(pCxt, NULL, &B, &C); }
table_primary(A) ::= db_name(B) NK_DOT table_name(C) alias_opt(D). { A = createRealTableNode(pCxt, &B, &C, &D); }
table_primary(A) ::= subquery(B) alias_opt(C). { A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
table_primary(A) ::= parenthesized_joined_table(B). { A = B; }
%type alias_opt { SToken }
%destructor alias_opt {
PARSER_DESTRUCTOR_TRACE;
}
alias_opt(A) ::= . {
PARSER_TRACE;
A = nil_token; }
alias_opt(A) ::= table_alias(B). {
PARSER_TRACE;
A = B; }
alias_opt(A) ::= AS table_alias(B). {
PARSER_TRACE;
A = B; }
%destructor alias_opt { }
alias_opt(A) ::= . { A = nil_token; }
alias_opt(A) ::= table_alias(B). { A = B; }
alias_opt(A) ::= AS table_alias(B). { A = B; }
parenthesized_joined_table(A) ::= NK_LP joined_table(B) NK_RP. {
PARSER_TRACE;
A = B; }
parenthesized_joined_table(A) ::= NK_LP parenthesized_joined_table(B) NK_RP. {
PARSER_TRACE;
A = B; }
parenthesized_joined_table(A) ::= NK_LP joined_table(B) NK_RP. { A = B; }
parenthesized_joined_table(A) ::= NK_LP parenthesized_joined_table(B) NK_RP. { A = B; }
/************************************************ joined_table ********************************************************/
joined_table(A) ::=
table_reference(B) join_type(C) JOIN table_reference(D) ON search_condition(E). {
PARSER_TRACE;
A = createJoinTableNode(pCxt, C, B, D, E); }
table_reference(B) join_type(C) JOIN table_reference(D) ON search_condition(E). { A = createJoinTableNode(pCxt, C, B, D, E); }
%type join_type { EJoinType }
%destructor join_type {
PARSER_DESTRUCTOR_TRACE;
}
join_type(A) ::= . {
PARSER_TRACE;
A = JOIN_TYPE_INNER; }
join_type(A) ::= INNER. {
PARSER_TRACE;
A = JOIN_TYPE_INNER; }
%destructor join_type { }
join_type(A) ::= . { A = JOIN_TYPE_INNER; }
join_type(A) ::= INNER. { A = JOIN_TYPE_INNER; }
/************************************************ query_specification *************************************************/
query_specification(A) ::=
SELECT set_quantifier_opt(B) select_list(C) from_clause(D) where_clause_opt(E)
partition_by_clause_opt(F) twindow_clause_opt(G)
group_by_clause_opt(H) having_clause_opt(I). {
PARSER_TRACE;
A = createSelectStmt(pCxt, B, C, D);
A = addWhereClause(pCxt, A, E);
A = addPartitionByClause(pCxt, A, F);
...
...
@@ -388,134 +396,132 @@ query_specification(A) ::=
}
%type set_quantifier_opt { bool }
%destructor set_quantifier_opt {
PARSER_DESTRUCTOR_TRACE;
}
set_quantifier_opt(A) ::= . {
PARSER_TRACE;
A = false; }
set_quantifier_opt(A) ::= DISTINCT. {
PARSER_TRACE;
A = true; }
set_quantifier_opt(A) ::= ALL. {
PARSER_TRACE;
A = false; }
%destructor set_quantifier_opt { }
set_quantifier_opt(A) ::= . { A = false; }
set_quantifier_opt(A) ::= DISTINCT. { A = true; }
set_quantifier_opt(A) ::= ALL. { A = false; }
%type select_list { SNodeList* }
%destructor select_list {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
select_list(A) ::= NK_STAR. {
PARSER_TRACE;
A = NULL; }
select_list(A) ::= select_sublist(B). {
PARSER_TRACE;
A = B; }
%destructor select_list { nodesDestroyList($$); }
select_list(A) ::= NK_STAR. { A = NULL; }
select_list(A) ::= select_sublist(B). { A = B; }
%type select_sublist { SNodeList* }
%destructor select_sublist {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
select_sublist(A) ::= select_item(B). {
PARSER_TRACE;
A = createNodeList(pCxt, B); }
select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). {
PARSER_TRACE;
A = addNodeToList(pCxt, B, C); }
%destructor select_sublist { nodesDestroyList($$); }
select_sublist(A) ::= select_item(B). { A = createNodeList(pCxt, B); }
select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); }
select_item(A) ::= common_expression(B). {
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, B);
A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &t);
}
select_item(A) ::= common_expression(B) column_alias(C). {
PARSER_TRACE;
A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= common_expression(B) AS column_alias(C). {
PARSER_TRACE;
A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= table_name(B) NK_DOT NK_STAR(C). {
PARSER_TRACE;
A = createColumnNode(pCxt, &B, &C); }
select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
where_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
where_clause_opt(A) ::= WHERE search_condition(B). {
PARSER_TRACE;
A = B; }
where_clause_opt(A) ::= . { A = NULL; }
where_clause_opt(A) ::= WHERE search_condition(B). { A = B; }
%type partition_by_clause_opt { SNodeList* }
%destructor partition_by_clause_opt {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
partition_by_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
partition_by_clause_opt(A) ::= PARTITION BY expression_list(B). {
PARSER_TRACE;
A = B; }
%destructor partition_by_clause_opt { nodesDestroyList($$); }
partition_by_clause_opt(A) ::= . { A = NULL; }
partition_by_clause_opt(A) ::= PARTITION BY expression_list(B). { A = B; }
twindow_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
twindow_clause_opt(A) ::= . { A = NULL; }
twindow_clause_opt(A) ::=
SESSION NK_LP column_reference(B) NK_COMMA NK_INTEGER(C) NK_RP. {
PARSER_TRACE;
A = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
twindow_clause_opt(A) ::= STATE_WINDOW NK_LP column_reference(B) NK_RP. {
PARSER_TRACE;
A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B)); }
SESSION NK_LP column_reference(B) NK_COMMA NK_INTEGER(C) NK_RP. { A = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
twindow_clause_opt(A) ::= STATE_WINDOW NK_LP column_reference(B) NK_RP. { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B)); }
twindow_clause_opt(A) ::=
INTERVAL NK_LP duration_literal(B) NK_RP sliding_opt(C) fill_opt(D). {
PARSER_TRACE;
A = createIntervalWindowNode(pCxt, B, NULL, C, D); }
INTERVAL NK_LP duration_literal(B) NK_RP sliding_opt(C) fill_opt(D). { A = createIntervalWindowNode(pCxt, B, NULL, C, D); }
twindow_clause_opt(A) ::=
INTERVAL NK_LP duration_literal(B) NK_COMMA duration_literal(C) NK_RP
sliding_opt(D) fill_opt(E). {
PARSER_TRACE;
A = createIntervalWindowNode(pCxt, B, C, D, E); }
sliding_opt(D) fill_opt(E). { A = createIntervalWindowNode(pCxt, B, C, D, E); }
sliding_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
sliding_opt(A) ::= SLIDING NK_LP duration_literal(B) NK_RP. {
PARSER_TRACE;
A = B; }
sliding_opt(A) ::= . { A = NULL; }
sliding_opt(A) ::= SLIDING NK_LP duration_literal(B) NK_RP. { A = B; }
fill_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. {
PARSER_TRACE;
A = createFillNode(pCxt, B, NULL); }
fill_opt(A) ::= FILL NK_LP VALUE NK_COMMA literal_list(B) NK_RP. {
PARSER_TRACE;
A = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, B)); }
fill_opt(A) ::= . { A = NULL; }
fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); }
fill_opt(A) ::= FILL NK_LP VALUE NK_COMMA literal_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, B)); }
%type fill_mode { EFillMode }
%destructor fill_mode {
PARSER_DESTRUCTOR_TRACE;
}
fill_mode(A) ::= NONE. {
PARSER_TRACE;
A = FILL_MODE_NONE; }
fill_mode(A) ::= PREV. {
PARSER_TRACE;
A = FILL_MODE_PREV; }
fill_mode(A) ::= NULL. {
PARSER_TRACE;
A = FILL_MODE_NULL; }
fill_mode(A) ::= LINEAR. {
PARSER_TRACE;
A = FILL_MODE_LINEAR; }
fill_mode(A) ::= NEXT. {
PARSER_TRACE;
A = FILL_MODE_NEXT; }
%destructor fill_mode { }
fill_mode(A) ::= NONE. { A = FILL_MODE_NONE; }
fill_mode(A) ::= PREV. { A = FILL_MODE_PREV; }
fill_mode(A) ::= NULL. { A = FILL_MODE_NULL; }
fill_mode(A) ::= LINEAR. { A = FILL_MODE_LINEAR; }
fill_mode(A) ::= NEXT. { A = FILL_MODE_NEXT; }
%type group_by_clause_opt { SNodeList* }
%destructor group_by_clause_opt {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
group_by_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
group_by_clause_opt(A) ::= GROUP BY group_by_list(B). {
PARSER_TRACE;
A = B; }
%destructor group_by_clause_opt { nodesDestroyList($$); }
group_by_clause_opt(A) ::= . { A = NULL; }
group_by_clause_opt(A) ::= GROUP BY group_by_list(B). { A = B; }
%type group_by_list { SNodeList* }
%destructor group_by_list {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
group_by_list(A) ::= expression(B). {
PARSER_TRACE;
A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); }
group_by_list(A) ::= group_by_list(B) NK_COMMA expression(C). {
PARSER_TRACE;
A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); }
%destructor group_by_list { nodesDestroyList($$); }
group_by_list(A) ::= expression(B). { A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); }
group_by_list(A) ::= group_by_list(B) NK_COMMA expression(C). { A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); }
having_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
having_clause_opt(A) ::= HAVING search_condition(B). {
PARSER_TRACE;
A = B; }
having_clause_opt(A) ::= . { A = NULL; }
having_clause_opt(A) ::= HAVING search_condition(B). { A = B; }
/************************************************ query_expression ****************************************************/
query_expression(A) ::=
query_expression_body(B)
order_by_clause_opt(C) slimit_clause_opt(D) limit_clause_opt(E). {
PARSER_TRACE;
A = addOrderByClause(pCxt, B, C);
A = addSlimitClause(pCxt, A, D);
A = addLimitClause(pCxt, A, E);
}
query_expression_body(A) ::= query_primary(B). {
PARSER_TRACE;
A = B; }
query_expression_body(A) ::= query_primary(B). { A = B; }
query_expression_body(A) ::=
query_expression_body(B) UNION ALL query_expression_body(D). {
PARSER_TRACE;
A = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, B, D); }
query_expression_body(B) UNION ALL query_expression_body(D). { A = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, B, D); }
query_primary(A) ::= query_specification(B). {
PARSER_TRACE;
A = B; }
query_primary(A) ::= query_specification(B). { A = B; }
//query_primary(A) ::=
// NK_LP query_expression_body(B)
// order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP. {
PARSER_TRACE;
A = B;}
// order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP. { A = B;}
%type order_by_clause_opt { SNodeList* }
%destructor order_by_clause_opt {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
order_by_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
order_by_clause_opt(A) ::= ORDER BY sort_specification_list(B). {
PARSER_TRACE;
A = B; }
%destructor order_by_clause_opt { nodesDestroyList($$); }
order_by_clause_opt(A) ::= . { A = NULL; }
order_by_clause_opt(A) ::= ORDER BY sort_specification_list(B). { A = B; }
slimit_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
slimit_clause_opt(A) ::= SLIMIT NK_INTEGER(B). {
PARSER_TRACE;
A = createLimitNode(pCxt, &B, NULL); }
slimit_clause_opt(A) ::= SLIMIT NK_INTEGER(B) SOFFSET NK_INTEGER(C). {
PARSER_TRACE;
A = createLimitNode(pCxt, &B, &C); }
slimit_clause_opt(A) ::= SLIMIT NK_INTEGER(C) NK_COMMA NK_INTEGER(B). {
PARSER_TRACE;
A = createLimitNode(pCxt, &B, &C); }
slimit_clause_opt(A) ::= . { A = NULL; }
slimit_clause_opt(A) ::= SLIMIT NK_INTEGER(B). { A = createLimitNode(pCxt, &B, NULL); }
slimit_clause_opt(A) ::= SLIMIT NK_INTEGER(B) SOFFSET NK_INTEGER(C). { A = createLimitNode(pCxt, &B, &C); }
slimit_clause_opt(A) ::= SLIMIT NK_INTEGER(C) NK_COMMA NK_INTEGER(B). { A = createLimitNode(pCxt, &B, &C); }
limit_clause_opt(A) ::= . {
PARSER_TRACE;
A = NULL; }
limit_clause_opt(A) ::= LIMIT NK_INTEGER(B). {
PARSER_TRACE;
A = createLimitNode(pCxt, &B, NULL); }
limit_clause_opt(A) ::= LIMIT NK_INTEGER(B) OFFSET NK_INTEGER(C). {
PARSER_TRACE;
A = createLimitNode(pCxt, &B, &C); }
limit_clause_opt(A) ::= LIMIT NK_INTEGER(C) NK_COMMA NK_INTEGER(B). {
PARSER_TRACE;
A = createLimitNode(pCxt, &B, &C); }
limit_clause_opt(A) ::= . { A = NULL; }
limit_clause_opt(A) ::= LIMIT NK_INTEGER(B). { A = createLimitNode(pCxt, &B, NULL); }
limit_clause_opt(A) ::= LIMIT NK_INTEGER(B) OFFSET NK_INTEGER(C). { A = createLimitNode(pCxt, &B, &C); }
limit_clause_opt(A) ::= LIMIT NK_INTEGER(C) NK_COMMA NK_INTEGER(B). { A = createLimitNode(pCxt, &B, &C); }
/************************************************ subquery ************************************************************/
subquery(A) ::= NK_LP(B) query_expression(C) NK_RP(D).
{ PARSER_TRACE;
A = createRawExprNodeExt(pCxt, &B, &D, C); }
subquery(A) ::= NK_LP(B) query_expression(C) NK_RP(D).
{
A = createRawExprNodeExt(pCxt, &B, &D, C); }
/************************************************ search_condition ****************************************************/
search_condition(A) ::= common_expression(B).
{ PARSER_TRACE;
A = releaseRawExprNode(pCxt, B); }
search_condition(A) ::= common_expression(B).
{
A = releaseRawExprNode(pCxt, B); }
/************************************************ sort_specification_list *********************************************/
%type sort_specification_list { SNodeList* }
%destructor sort_specification_list {
PARSER_DESTRUCTOR_TRACE;
nodesDestroyList($$); }
sort_specification_list(A) ::= sort_specification(B). {
PARSER_TRACE;
A = createNodeList(pCxt, B); }
%destructor sort_specification_list { nodesDestroyList($$); }
sort_specification_list(A) ::= sort_specification(B). { A = createNodeList(pCxt, B); }
sort_specification_list(A) ::=
sort_specification_list(B) NK_COMMA sort_specification(C). {
PARSER_TRACE;
A = addNodeToList(pCxt, B, C); }
sort_specification_list(B) NK_COMMA sort_specification(C). { A = addNodeToList(pCxt, B, C); }
sort_specification(A) ::=
expression(B) ordering_specification_opt(C) null_ordering_opt(D). {
PARSER_TRACE;
A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
expression(B) ordering_specification_opt(C) null_ordering_opt(D). { A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
%type ordering_specification_opt EOrder
%destructor ordering_specification_opt {
PARSER_DESTRUCTOR_TRACE;
}
ordering_specification_opt(A) ::= . {
PARSER_TRACE;
A = ORDER_ASC; }
ordering_specification_opt(A) ::= ASC. {
PARSER_TRACE;
A = ORDER_ASC; }
ordering_specification_opt(A) ::= DESC. {
PARSER_TRACE;
A = ORDER_DESC; }
%destructor ordering_specification_opt { }
ordering_specification_opt(A) ::= . { A = ORDER_ASC; }
ordering_specification_opt(A) ::= ASC. { A = ORDER_ASC; }
ordering_specification_opt(A) ::= DESC. { A = ORDER_DESC; }
%type null_ordering_opt ENullOrder
%destructor null_ordering_opt {
PARSER_DESTRUCTOR_TRACE;
}
null_ordering_opt(A) ::= . {
PARSER_TRACE;
A = NULL_ORDER_DEFAULT; }
null_ordering_opt(A) ::= NULLS FIRST. {
PARSER_TRACE;
A = NULL_ORDER_FIRST; }
null_ordering_opt(A) ::= NULLS LAST. {
PARSER_TRACE;
A = NULL_ORDER_LAST; }
%destructor null_ordering_opt { }
null_ordering_opt(A) ::= . { A = NULL_ORDER_DEFAULT; }
null_ordering_opt(A) ::= NULLS FIRST. { A = NULL_ORDER_FIRST; }
null_ordering_opt(A) ::= NULLS LAST. { A = NULL_ORDER_LAST; }
source/libs/parser/inc/parserUtil.h
浏览文件 @
216c5317
...
...
@@ -32,16 +32,6 @@ typedef struct SMsgBuf {
int32_t
buildInvalidOperationMsg
(
SMsgBuf
*
pMsgBuf
,
const
char
*
msg
);
int32_t
buildSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
const
char
*
additionalInfo
,
const
char
*
sourceStr
);
int32_t
parserValidateIdToken
(
SToken
*
pToken
);
typedef
struct
SKvParam
{
SKVRowBuilder
*
builder
;
SSchema
*
schema
;
char
buf
[
TSDB_MAX_TAGS_LEN
];
}
SKvParam
;
int32_t
KvRowAppend
(
const
void
*
value
,
int32_t
len
,
void
*
param
);
STableMeta
*
tableMetaDup
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getTableColumnSchema
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getTableTagSchema
(
const
STableMeta
*
pTableMeta
);
...
...
@@ -49,6 +39,8 @@ int32_t getNumOfColumns(const STableMeta* pTableMeta);
int32_t
getNumOfTags
(
const
STableMeta
*
pTableMeta
);
STableComInfo
getTableInfo
(
const
STableMeta
*
pTableMeta
);
int32_t
trimString
(
const
char
*
src
,
int32_t
len
,
char
*
dst
,
int32_t
dlen
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/parser/inc/ttoken.h
浏览文件 @
216c5317
...
...
@@ -36,7 +36,7 @@ typedef struct SToken {
* @return
*/
#define isNumber(tk) \
((tk)->type == TK_NK_INTEGER || (tk)->type == TK_NK_FLOAT || (tk)->type == TK_
HEX || (tk)->type == T
K_BIN)
((tk)->type == TK_NK_INTEGER || (tk)->type == TK_NK_FLOAT || (tk)->type == TK_
NK_HEX || (tk)->type == TK_N
K_BIN)
/**
* tokenizer for sql string
...
...
@@ -67,11 +67,11 @@ bool taosIsKeyWordToken(const char *z, int32_t len);
/**
* check if it is a token or not
* @param pToken
* @return token type, if it is not a number, TK_ILLEGAL will return
* @return token type, if it is not a number, TK_
NK_
ILLEGAL will return
*/
static
FORCE_INLINE
int32_t
tGetNumericStringType
(
const
SToken
*
pToken
)
{
const
char
*
z
=
pToken
->
z
;
int32_t
type
=
TK_ILLEGAL
;
int32_t
type
=
TK_
NK_
ILLEGAL
;
uint32_t
i
=
0
;
for
(;
i
<
pToken
->
n
;
++
i
)
{
...
...
@@ -88,7 +88,7 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
* .123e4
*/
if
(
!
isdigit
(
z
[
i
+
1
]))
{
return
TK_ILLEGAL
;
return
TK_
NK_
ILLEGAL
;
}
for
(
i
+=
2
;
isdigit
(
z
[
i
]);
i
++
)
{
...
...
@@ -109,13 +109,13 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
case
'0'
:
{
char
next
=
z
[
i
+
1
];
if
(
next
==
'b'
)
{
// bin number
type
=
TK_BIN
;
type
=
TK_
NK_
BIN
;
for
(
i
+=
2
;
(
z
[
i
]
==
'0'
||
z
[
i
]
==
'1'
);
++
i
)
{
}
goto
_end
;
}
else
if
(
next
==
'x'
)
{
//hex number
type
=
TK_HEX
;
type
=
TK_
NK_
HEX
;
for
(
i
+=
2
;
isdigit
(
z
[
i
])
||
(
z
[
i
]
>=
'a'
&&
z
[
i
]
<=
'f'
)
||
(
z
[
i
]
>=
'A'
&&
z
[
i
]
<=
'F'
);
++
i
)
{
}
...
...
@@ -148,7 +148,7 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
}
if
(
seg
>
1
)
{
return
TK_ILLEGAL
;
return
TK_
NK_
ILLEGAL
;
}
if
((
z
[
i
]
==
'e'
||
z
[
i
]
==
'E'
)
&&
...
...
@@ -164,12 +164,12 @@ static FORCE_INLINE int32_t tGetNumericStringType(const SToken* pToken) {
goto
_end
;
}
default:
return
TK_ILLEGAL
;
return
TK_
NK_
ILLEGAL
;
}
}
_end:
return
(
i
<
pToken
->
n
)
?
TK_ILLEGAL
:
type
;
return
(
i
<
pToken
->
n
)
?
TK_
NK_
ILLEGAL
:
type
;
}
void
taosCleanupKeywordsTable
();
...
...
source/libs/parser/src/astCreateFuncs.c
浏览文件 @
216c5317
...
...
@@ -15,6 +15,7 @@
*/
#include "astCreateFuncs.h"
#include "parserUtil.h"
#define CHECK_OUT_OF_MEM(p) \
do { \
...
...
@@ -149,16 +150,16 @@ static SDatabaseOptions* setDbKeep(SAstCreateContext* pCxt, SDatabaseOptions* pO
}
static
SDatabaseOptions
*
setDbPrecision
(
SAstCreateContext
*
pCxt
,
SDatabaseOptions
*
pOptions
,
const
SToken
*
pVal
)
{
if
(
0
==
strncmp
(
pVal
->
z
,
TSDB_TIME_PRECISION_MILLI_STR
,
pVal
->
n
)
&&
strlen
(
TSDB_TIME_PRECISION_MILLI_STR
)
==
pVal
->
n
)
{
char
val
[
10
]
=
{
0
};
trimString
(
pVal
->
z
,
pVal
->
n
,
val
,
sizeof
(
val
));
if
(
0
==
strcmp
(
val
,
TSDB_TIME_PRECISION_MILLI_STR
))
{
pOptions
->
precision
=
TSDB_TIME_PRECISION_MILLI
;
}
else
if
(
0
==
str
ncmp
(
pVal
->
z
,
TSDB_TIME_PRECISION_MICRO_STR
,
pVal
->
n
)
&&
strlen
(
TSDB_TIME_PRECISION_MICRO_STR
)
==
pVal
->
n
)
{
}
else
if
(
0
==
str
cmp
(
val
,
TSDB_TIME_PRECISION_MICRO_STR
)
)
{
pOptions
->
precision
=
TSDB_TIME_PRECISION_MICRO
;
}
else
if
(
0
==
str
ncmp
(
pVal
->
z
,
TSDB_TIME_PRECISION_NANO_STR
,
pVal
->
n
)
&&
strlen
(
TSDB_TIME_PRECISION_NANO_STR
)
==
pVal
->
n
)
{
}
else
if
(
0
==
str
cmp
(
val
,
TSDB_TIME_PRECISION_NANO_STR
)
)
{
pOptions
->
precision
=
TSDB_TIME_PRECISION_NANO
;
}
else
{
char
tmp
[
10
];
strncpy
(
tmp
,
pVal
->
z
,
pVal
->
n
);
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"invalid db option precision: %s"
,
tmp
);
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"invalid db option precision: %s"
,
val
);
pCxt
->
valid
=
false
;
}
return
pOptions
;
...
...
@@ -296,7 +297,7 @@ static STableOptions* setTableComment(SAstCreateContext* pCxt, STableOptions* pO
pCxt
->
valid
=
false
;
return
pOptions
;
}
strncpy
(
pOptions
->
comments
,
pVal
->
z
,
pVal
->
n
);
trimString
(
pVal
->
z
,
pVal
->
n
,
pOptions
->
comments
,
sizeof
(
pOptions
->
comments
)
);
return
pOptions
;
}
...
...
@@ -413,6 +414,8 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
dataType
)
{
val
->
node
.
resType
.
precision
=
TSDB_TIME_PRECISION_MILLI
;
}
val
->
isDuration
=
false
;
val
->
translate
=
false
;
return
(
SNode
*
)
val
;
}
...
...
@@ -422,6 +425,7 @@ SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral)
val
->
literal
=
strndup
(
pLiteral
->
z
,
pLiteral
->
n
);
CHECK_OUT_OF_MEM
(
val
->
literal
);
val
->
isDuration
=
true
;
val
->
translate
=
false
;
val
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BIGINT
;
val
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BIGINT
].
bytes
;
val
->
node
.
resType
.
precision
=
TSDB_TIME_PRECISION_MILLI
;
...
...
@@ -708,13 +712,18 @@ STableOptions* setTableOption(SAstCreateContext* pCxt, STableOptions* pOptions,
return
setTableOptionFuncs
[
type
](
pCxt
,
pOptions
,
pVal
);
}
STableOptions
*
setTableSmaOption
(
SAstCreateContext
*
pCxt
,
STableOptions
*
pOptions
,
SNodeList
*
pSma
)
{
pOptions
->
pSma
=
pSma
;
return
pOptions
;
}
SNode
*
createColumnDefNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pColName
,
SDataType
dataType
,
const
SToken
*
pComment
)
{
SColumnDefNode
*
pCol
=
(
SColumnDefNode
*
)
nodesMakeNode
(
QUERY_NODE_COLUMN_DEF
);
CHECK_OUT_OF_MEM
(
pCol
);
strncpy
(
pCol
->
colName
,
pColName
->
z
,
pColName
->
n
);
pCol
->
dataType
=
dataType
;
if
(
NULL
!=
pComment
)
{
strncpy
(
pCol
->
comments
,
pComment
->
z
,
pComment
->
n
);
trimString
(
pComment
->
z
,
pComment
->
n
,
pCol
->
comments
,
sizeof
(
pCol
->
comments
)
);
}
return
(
SNode
*
)
pCol
;
}
...
...
@@ -730,19 +739,51 @@ SDataType createVarLenDataType(uint8_t type, const SToken* pLen) {
}
SNode
*
createCreateTableStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
STokenPair
*
pFullTableName
,
SNodeList
*
pCols
,
STableOptions
*
pOptions
)
{
bool
ignoreExists
,
const
STokenPair
*
pFullTableName
,
SNodeList
*
pCols
,
S
NodeList
*
pTags
,
S
TableOptions
*
pOptions
)
{
SCreateTableStmt
*
pStmt
=
(
SCreateTableStmt
*
)
nodesMakeNode
(
QUERY_NODE_CREATE_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
if
(
TK_NIL
!=
pFullTableName
->
first
.
type
)
{
strncpy
(
pStmt
->
dbName
,
pFullTableName
->
first
.
z
,
pFullTableName
->
first
.
n
);
}
else
{
strcpy
(
pStmt
->
dbName
,
pCxt
->
pQueryCxt
->
db
);
}
strncpy
(
pStmt
->
tableName
,
pFullTableName
->
second
.
z
,
pFullTableName
->
second
.
n
);
pStmt
->
ignoreExists
=
ignoreExists
;
pStmt
->
pCols
=
pCols
;
pStmt
->
pTags
=
pTags
;
pStmt
->
options
=
*
pOptions
;
return
(
SNode
*
)
pStmt
;
}
SNode
*
createCreateSubTableClause
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
STokenPair
*
pFullTableName
,
const
STokenPair
*
pUseFullTableName
,
SNodeList
*
pSpecificTags
,
SNodeList
*
pValsOfTags
)
{
SCreateSubTableClause
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
);
CHECK_OUT_OF_MEM
(
pStmt
);
if
(
TK_NIL
!=
pFullTableName
->
first
.
type
)
{
strncpy
(
pStmt
->
dbName
,
pFullTableName
->
first
.
z
,
pFullTableName
->
first
.
n
);
}
else
{
strcpy
(
pStmt
->
dbName
,
pCxt
->
pQueryCxt
->
db
);
}
strncpy
(
pStmt
->
tableName
,
pFullTableName
->
second
.
z
,
pFullTableName
->
second
.
n
);
if
(
TK_NIL
!=
pUseFullTableName
->
first
.
type
)
{
strncpy
(
pStmt
->
useDbName
,
pUseFullTableName
->
first
.
z
,
pUseFullTableName
->
first
.
n
);
}
else
{
strcpy
(
pStmt
->
useDbName
,
pCxt
->
pQueryCxt
->
db
);
}
strncpy
(
pStmt
->
useTableName
,
pUseFullTableName
->
second
.
z
,
pUseFullTableName
->
second
.
n
);
pStmt
->
ignoreExists
=
ignoreExists
;
pStmt
->
pSpecificTags
=
pSpecificTags
;
pStmt
->
pValsOfTags
=
pValsOfTags
;
return
(
SNode
*
)
pStmt
;
}
SNode
*
createCreateMultiTableStmt
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pSubTables
)
{
SCreateMultiTableStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_CREATE_MULTI_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
pSubTables
=
pSubTables
;
return
(
SNode
*
)
pStmt
;
}
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
)
{
SUseDatabaseStmt
*
pStmt
=
(
SUseDatabaseStmt
*
)
nodesMakeNode
(
QUERY_NODE_USE_DATABASE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
...
...
source/libs/parser/src/astParse.c
浏览文件 @
216c5317
...
...
@@ -26,22 +26,6 @@ extern void NewParse(void*, int, SToken, void*);
extern
void
NewParseFree
(
void
*
,
FFree
);
extern
void
NewParseTrace
(
FILE
*
,
char
*
);
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
;
}
pQuery
->
msgType
=
(
QUERY_NODE_CREATE_TABLE_STMT
==
type
?
TDMT_VND_CREATE_TABLE
:
TDMT_VND_QUERY
);
}
int32_t
doParse
(
SParseContext
*
pParseCxt
,
SQuery
**
pQuery
)
{
SAstCreateContext
cxt
;
initAstCreateContext
(
pParseCxt
,
&
cxt
);
...
...
@@ -58,23 +42,23 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
i
+=
t0
.
n
;
switch
(
t0
.
type
)
{
case
TK_SPACE
:
case
TK_COMMENT
:
{
case
TK_
NK_
SPACE
:
case
TK_
NK_
COMMENT
:
{
break
;
}
case
TK_SEMI
:
{
NewParse
(
pParser
,
0
,
t0
,
&
cxt
);
goto
abort_parse
;
}
case
TK_QUESTION
:
case
TK_ILLEGAL
:
{
case
TK_
NK_
QUESTION
:
case
TK_
NK_
ILLEGAL
:
{
snprintf
(
cxt
.
pQueryCxt
->
pMsg
,
cxt
.
pQueryCxt
->
msgLen
,
"unrecognized token:
\"
%s
\"
"
,
t0
.
z
);
cxt
.
valid
=
false
;
goto
abort_parse
;
}
case
TK_HEX
:
case
TK_OCT
:
case
TK_BIN
:
{
case
TK_
NK_
HEX
:
case
TK_
NK_
OCT
:
case
TK_
NK_
BIN
:
{
snprintf
(
cxt
.
pQueryCxt
->
pMsg
,
cxt
.
pQueryCxt
->
msgLen
,
"unsupported token:
\"
%s
\"
"
,
t0
.
z
);
cxt
.
valid
=
false
;
goto
abort_parse
;
...
...
@@ -95,7 +79,7 @@ abort_parse:
if
(
NULL
==
*
pQuery
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
setQuery
(
&
cxt
,
*
pQuery
)
;
(
*
pQuery
)
->
pRoot
=
cxt
.
pRootNode
;
}
return
cxt
.
valid
?
TSDB_CODE_SUCCESS
:
TSDB_CODE_FAILED
;
}
source/libs/parser/src/astTranslate.c
浏览文件 @
216c5317
...
...
@@ -68,6 +68,10 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Not SELECTed expression"
;
case
TSDB_CODE_PAR_NOT_SINGLE_GROUP
:
return
"Not a single-group group function"
;
case
TSDB_CODE_PAR_TAGS_NOT_MATCHED
:
return
"tags number not matched"
;
case
TSDB_CODE_PAR_INVALID_TAG_NAME
:
return
"invalid tag name : %s"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
default:
...
...
@@ -280,29 +284,13 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
return
found
?
DEAL_RES_CONTINUE
:
translateColumnWithoutPrefix
(
pCxt
,
pCol
);
}
static
int32_t
trimString
Copy
(
const
char
*
src
,
int32_t
len
,
bool
format
,
char
*
dst
)
{
static
int32_t
trimString
WithVarFormat
(
const
char
*
src
,
int32_t
len
,
bool
format
,
char
*
dst
)
{
char
*
dstVal
=
dst
;
if
(
format
)
{
varDataSetLen
(
dst
,
len
);
dstVal
=
varDataVal
(
dst
);
}
// delete escape character: \\, \', \"
char
delim
=
src
[
0
];
int32_t
cnt
=
0
;
int32_t
j
=
0
;
for
(
uint32_t
k
=
1
;
k
<
len
-
1
;
++
k
)
{
if
(
src
[
k
]
==
'\\'
||
(
src
[
k
]
==
delim
&&
src
[
k
+
1
]
==
delim
))
{
dstVal
[
j
]
=
src
[
k
+
1
];
cnt
++
;
j
++
;
k
++
;
continue
;
}
dstVal
[
j
]
=
src
[
k
];
j
++
;
}
dstVal
[
j
]
=
'\0'
;
return
j
;
return
trimString
(
src
,
len
,
dstVal
,
len
);
}
static
EDealRes
translateValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
...
...
@@ -351,7 +339,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_OUT_OF_MEMORY
);
return
DEAL_RES_ERROR
;
}
trimString
Copy
(
pVal
->
literal
,
n
,
true
,
pVal
->
datum
.
p
);
trimString
WithVarFormat
(
pVal
->
literal
,
n
,
true
,
pVal
->
datum
.
p
);
break
;
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
...
...
@@ -361,7 +349,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_OUT_OF_MEMORY
);
return
DEAL_RES_ERROR
;
}
int32_t
len
=
trimString
Copy
(
pVal
->
literal
,
n
,
false
,
tmp
);
int32_t
len
=
trimString
WithVarFormat
(
pVal
->
literal
,
n
,
false
,
tmp
);
if
(
taosParseTime
(
tmp
,
&
pVal
->
datum
.
i
,
len
,
pVal
->
node
.
resType
.
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
tmp
);
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
...
...
@@ -378,6 +366,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
break
;
}
}
pVal
->
translate
=
true
;
return
DEAL_RES_CONTINUE
;
}
...
...
@@ -687,7 +676,7 @@ static int32_t translateOrderByPosition(STranslateContext* pCxt, SNodeList* pPro
SNode
*
pExpr
=
((
SOrderByExprNode
*
)
pNode
)
->
pExpr
;
if
(
QUERY_NODE_VALUE
==
nodeType
(
pExpr
))
{
SValueNode
*
pVal
=
(
SValueNode
*
)
pExpr
;
if
(
!
translateValue
(
pCxt
,
pVal
))
{
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
pVal
))
{
return
pCxt
->
errCode
;
}
int32_t
pos
=
getPositionValue
(
pVal
);
...
...
@@ -856,6 +845,47 @@ static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseS
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
columnNodeToField
(
SNodeList
*
pList
,
SArray
**
pArray
)
{
*
pArray
=
taosArrayInit
(
LIST_LENGTH
(
pList
),
sizeof
(
SField
));
SNode
*
pNode
;
FOREACH
(
pNode
,
pList
)
{
SColumnDefNode
*
pCol
=
(
SColumnDefNode
*
)
pNode
;
SField
field
=
{
.
type
=
pCol
->
dataType
.
type
,
.
bytes
=
pCol
->
dataType
.
bytes
};
strcpy
(
field
.
name
,
pCol
->
colName
);
taosArrayPush
(
*
pArray
,
&
field
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateCreateSuperTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
)
{
SMCreateStbReq
createReq
=
{
0
};
createReq
.
igExists
=
pStmt
->
ignoreExists
;
columnNodeToField
(
pStmt
->
pCols
,
&
createReq
.
pColumns
);
columnNodeToField
(
pStmt
->
pTags
,
&
createReq
.
pTags
);
createReq
.
numOfColumns
=
LIST_LENGTH
(
pStmt
->
pCols
);
createReq
.
numOfTags
=
LIST_LENGTH
(
pStmt
->
pTags
);
SName
tableName
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
strcpy
(
tableName
.
dbname
,
pStmt
->
dbName
);
strcpy
(
tableName
.
tname
,
pStmt
->
tableName
);
tNameExtractFullName
(
&
tableName
,
createReq
.
name
);
pCxt
->
pCmdMsg
=
malloc
(
sizeof
(
SCmdMsgInfo
));
if
(
NULL
==
pCxt
->
pCmdMsg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pCxt
->
pCmdMsg
->
epSet
=
pCxt
->
pParseCxt
->
mgmtEpSet
;
pCxt
->
pCmdMsg
->
msgType
=
TDMT_MND_CREATE_STB
;
pCxt
->
pCmdMsg
->
msgLen
=
tSerializeSMCreateStbReq
(
NULL
,
0
,
&
createReq
);
pCxt
->
pCmdMsg
->
pMsg
=
malloc
(
pCxt
->
pCmdMsg
->
msgLen
);
if
(
NULL
==
pCxt
->
pCmdMsg
->
pMsg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
tSerializeSMCreateStbReq
(
pCxt
->
pCmdMsg
->
pMsg
,
pCxt
->
pCmdMsg
->
msgLen
,
&
createReq
);
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
));
...
...
@@ -937,6 +967,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case
QUERY_NODE_CREATE_DATABASE_STMT
:
code
=
translateCreateDatabase
(
pCxt
,
(
SCreateDatabaseStmt
*
)
pNode
);
break
;
case
QUERY_NODE_CREATE_TABLE_STMT
:
code
=
translateCreateSuperTable
(
pCxt
,
(
SCreateTableStmt
*
)
pNode
);
break
;
case
QUERY_NODE_USE_DATABASE_STMT
:
code
=
translateUseDatabase
(
pCxt
,
(
SUseDatabaseStmt
*
)
pNode
);
break
;
...
...
@@ -1003,15 +1036,16 @@ static void toSchema(const SColumnDefNode* pCol, int32_t colId, SSchema* pSchema
strcpy
(
pSchema
->
name
,
pCol
->
colName
);
}
static
int32_t
doBuildSingleTableBatchReq
(
SName
*
pTableName
,
SNodeList
*
pColumns
,
SVgroupInfo
*
pVgroupInfo
,
SVgroupTablesBatch
*
pBatch
)
{
static
int32_t
buildNormalTableBatchReq
(
const
char
*
pTableName
,
const
SNodeList
*
pColumns
,
const
SVgroupInfo
*
pVgroupInfo
,
SVgroupTablesBatch
*
pBatch
)
{
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_NORMAL_TABLE
;
req
.
name
=
strdup
(
tNameGetTableName
(
pTableName
));
req
.
name
=
strdup
(
pTableName
);
req
.
ntbCfg
.
nCols
=
LIST_LENGTH
(
pColumns
);
int32_t
num
=
req
.
ntbCfg
.
nCols
;
req
.
ntbCfg
.
pSchema
=
calloc
(
num
,
sizeof
(
SSchema
));
req
.
ntbCfg
.
pSchema
=
calloc
(
req
.
ntbCfg
.
nCols
,
sizeof
(
SSchema
));
if
(
NULL
==
req
.
name
||
NULL
==
req
.
ntbCfg
.
pSchema
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SNode
*
pCol
;
int32_t
index
=
0
;
FOREACH
(
pCol
,
pColumns
)
{
...
...
@@ -1021,34 +1055,36 @@ static int32_t doBuildSingleTableBatchReq(SName* pTableName, SNodeList* pColumns
pBatch
->
info
=
*
pVgroupInfo
;
pBatch
->
req
.
pArray
=
taosArrayInit
(
1
,
sizeof
(
struct
SVCreateTbReq
));
if
(
pBatch
->
req
.
pArray
==
NULL
)
{
return
TSDB_CODE_
QRY_
OUT_OF_MEMORY
;
if
(
NULL
==
pBatch
->
req
.
pArray
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
taosArrayPush
(
pBatch
->
req
.
pArray
,
&
req
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
serializeVgroupTablesBatch
Impl
(
SVgroupTablesBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
static
int32_t
serializeVgroupTablesBatch
(
SVgroupTablesBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
int
tlen
=
sizeof
(
SMsgHead
)
+
tSerializeSVCreateTbBatchReq
(
NULL
,
&
(
pTbBatch
->
req
));
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
// TODO: handle error
if
(
NULL
==
buf
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
((
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
));
if
(
NULL
==
pVgData
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pVgData
->
vg
=
pTbBatch
->
info
;
pVgData
->
pData
=
buf
;
pVgData
->
size
=
tlen
;
pVgData
->
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pTbBatch
->
req
.
pArray
);
taosArrayPush
(
pBufArray
,
&
pVgData
);
return
TSDB_CODE_SUCCESS
;
}
static
void
destroyCreateTbReqBatch
(
SVgroupTablesBatch
*
pTbBatch
)
{
...
...
@@ -1069,42 +1105,311 @@ static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
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
;
static
int32_t
getTableHashVgroup
(
SParseContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SVgroupInfo
*
pInfo
)
{
SName
name
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
tname
,
pTableName
);
return
catalogGetTableHashVgroup
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
&
name
,
pInfo
);
}
SName
tableName
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
if
(
'\0'
==
pStmt
->
dbName
[
0
])
{
strcpy
(
tableName
.
dbname
,
pCxt
->
pParseCxt
->
db
);
}
else
{
strcpy
(
tableName
.
dbname
,
pStmt
->
dbName
);
static
int32_t
rewriteToVnodeModifOpStmt
(
SQuery
*
pQuery
,
SArray
*
pBufArray
)
{
SVnodeModifOpStmt
*
pNewStmt
=
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
if
(
pNewStmt
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pNewStmt
->
sqlNodeType
=
nodeType
(
pQuery
->
pRoot
);
pNewStmt
->
pDataBlocks
=
pBufArray
;
nodesDestroyNode
(
pQuery
->
pRoot
);
pQuery
->
pRoot
=
(
SNode
*
)
pNewStmt
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
buildCreateTableDataBlock
(
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pInfo
,
SArray
**
pBufArray
)
{
SVgroupTablesBatch
tbatch
=
{
0
};
int32_t
code
=
buildNormalTableBatchReq
(
pStmt
->
tableName
,
pStmt
->
pCols
,
pInfo
,
&
tbatch
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pBufArray
=
taosArrayInit
(
1
,
POINTER_BYTES
);
if
(
NULL
==
pBufArray
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
serializeVgroupTablesBatch
(
&
tbatch
,
*
pBufArray
);
}
destroyCreateTbReqBatch
(
&
tbatch
);
return
code
;
}
static
int32_t
rewriteCreateTable
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
SCreateTableStmt
*
pStmt
=
(
SCreateTableStmt
*
)
pQuery
->
pRoot
;
SVgroupInfo
info
=
{
0
};
int32_t
code
=
getTableHashVgroup
(
pCxt
->
pParseCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
info
);
SArray
*
pBufArray
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildCreateTableDataBlock
(
pStmt
,
&
info
,
&
pBufArray
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteToVnodeModifOpStmt
(
pQuery
,
pBufArray
);
}
return
code
;
}
static
void
addCreateTbReqIntoVgroup
(
SHashObj
*
pVgroupHashmap
,
const
char
*
pTableName
,
SKVRow
row
,
uint64_t
suid
,
SVgroupInfo
*
pVgInfo
)
{
struct
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_CHILD_TABLE
;
req
.
name
=
strdup
(
pTableName
);
req
.
ctbCfg
.
suid
=
suid
;
req
.
ctbCfg
.
pTag
=
row
;
SVgroupTablesBatch
*
pTableBatch
=
taosHashGet
(
pVgroupHashmap
,
&
pVgInfo
->
vgId
,
sizeof
(
pVgInfo
->
vgId
));
if
(
pTableBatch
==
NULL
)
{
SVgroupTablesBatch
tBatch
=
{
0
};
tBatch
.
info
=
*
pVgInfo
;
tBatch
.
req
.
pArray
=
taosArrayInit
(
4
,
sizeof
(
struct
SVCreateTbReq
));
taosArrayPush
(
tBatch
.
req
.
pArray
,
&
req
);
taosHashPut
(
pVgroupHashmap
,
&
pVgInfo
->
vgId
,
sizeof
(
pVgInfo
->
vgId
),
&
tBatch
,
sizeof
(
tBatch
));
}
else
{
// add to the correct vgroup
taosArrayPush
(
pTableBatch
->
req
.
pArray
,
&
req
);
}
}
static
void
valueNodeToVariant
(
const
SValueNode
*
pNode
,
SVariant
*
pVal
)
{
pVal
->
nType
=
pNode
->
node
.
resType
.
type
;
pVal
->
nLen
=
pNode
->
node
.
resType
.
bytes
;
switch
(
pNode
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
pVal
->
i
=
pNode
->
datum
.
b
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
pVal
->
i
=
pNode
->
datum
.
i
;
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
pVal
->
u
=
pNode
->
datum
.
u
;
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
pVal
->
d
=
pNode
->
datum
.
d
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
pVal
->
pz
=
pNode
->
datum
.
p
;
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
default:
break
;
}
}
static
int32_t
addValToKVRow
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
const
SSchema
*
pSchema
,
SKVRowBuilder
*
pBuilder
)
{
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
pVal
))
{
return
pCxt
->
errCode
;
}
SVariant
var
;
valueNodeToVariant
(
pVal
,
&
var
);
char
tagVal
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
int32_t
code
=
taosVariantDump
(
&
var
,
tagVal
,
pSchema
->
type
,
true
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tdAddColToKVRow
(
pBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
);
}
return
code
;
}
static
int32_t
buildKVRowForBindTags
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
STableMeta
*
pSuperTableMeta
,
SKVRowBuilder
*
pBuilder
)
{
int32_t
numOfTags
=
getNumOfTags
(
pSuperTableMeta
);
if
(
LIST_LENGTH
(
pStmt
->
pValsOfTags
)
!=
LIST_LENGTH
(
pStmt
->
pSpecificTags
)
||
numOfTags
<
LIST_LENGTH
(
pStmt
->
pValsOfTags
))
{
return
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_PAR_TAGS_NOT_MATCHED
);
}
SSchema
*
pTagSchema
=
getTableTagSchema
(
pSuperTableMeta
);
SNode
*
pTag
,
*
pVal
;
FORBOTH
(
pTag
,
pStmt
->
pSpecificTags
,
pVal
,
pStmt
->
pValsOfTags
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pTag
;
SSchema
*
pSchema
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
if
(
0
==
strcmp
(
pCol
->
colName
,
pTagSchema
[
i
].
name
))
{
pSchema
=
pTagSchema
+
i
;
break
;
}
}
if
(
NULL
==
pSchema
)
{
return
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_TAG_NAME
,
pCol
->
colName
);
}
int32_t
code
=
addValToKVRow
(
pCxt
,
(
SValueNode
*
)
pVal
,
pSchema
,
pBuilder
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
strcpy
(
tableName
.
tname
,
pStmt
->
tableName
);
SVgroupInfo
info
=
{
0
};
catalogGetTableHashVgroup
(
pCxt
->
pParseCxt
->
pCatalog
,
pCxt
->
pParseCxt
->
pTransporter
,
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
tableName
,
&
info
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
buildKVRowForAllTags
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
STableMeta
*
pSuperTableMeta
,
SKVRowBuilder
*
pBuilder
)
{
if
(
getNumOfTags
(
pSuperTableMeta
)
!=
LIST_LENGTH
(
pStmt
->
pValsOfTags
))
{
return
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_PAR_TAGS_NOT_MATCHED
);
}
SVgroupTablesBatch
tbatch
=
{
0
};
int32_t
code
=
doBuildSingleTableBatchReq
(
&
tableName
,
pStmt
->
pCols
,
&
info
,
&
tbatch
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
SSchema
*
pTagSchema
=
getTableTagSchema
(
pSuperTableMeta
);
SNode
*
pVal
;
int32_t
index
=
0
;
FOREACH
(
pVal
,
pStmt
->
pValsOfTags
)
{
int32_t
code
=
addValToKVRow
(
pCxt
,
(
SValueNode
*
)
pVal
,
pTagSchema
+
index
++
,
pBuilder
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
}
return
TSDB_CODE_SUCCESS
;
}
SArray
*
pBufArray
=
taosArrayInit
(
1
,
POINTER_BYTES
);
if
(
pBufArray
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
static
int32_t
rewriteCreateSubTable
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
SHashObj
*
pVgroupHashmap
)
{
SName
name
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pStmt
->
useDbName
);
strcpy
(
name
.
tname
,
pStmt
->
useTableName
);
STableMeta
*
pSuperTableMeta
=
NULL
;
int32_t
code
=
catalogGetTableMeta
(
pCxt
->
pParseCxt
->
pCatalog
,
pCxt
->
pParseCxt
->
pTransporter
,
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
name
,
&
pSuperTableMeta
);
SKVRowBuilder
kvRowBuilder
=
{
0
};
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tdInitKVRowBuilder
(
&
kvRowBuilder
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
NULL
!=
pStmt
->
pSpecificTags
)
{
code
=
buildKVRowForBindTags
(
pCxt
,
pStmt
,
pSuperTableMeta
,
&
kvRowBuilder
);
}
else
{
code
=
buildKVRowForAllTags
(
pCxt
,
pStmt
,
pSuperTableMeta
,
&
kvRowBuilder
);
}
}
serializeVgroupTablesBatchImpl
(
&
tbatch
,
pBufArray
);
destroyCreateTbReqBatch
(
&
tbatch
);
SKVRow
row
=
NULL
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
row
=
tdGetKVRowFromBuilder
(
&
kvRowBuilder
);
if
(
NULL
==
row
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
tdSortKVRowByColIdx
(
row
);
}
}
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
;
SVgroupInfo
info
=
{
0
};
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
getTableHashVgroup
(
pCxt
->
pParseCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
info
);
}
return
TSDB_CODE_SUCCESS
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
addCreateTbReqIntoVgroup
(
pVgroupHashmap
,
pStmt
->
tableName
,
row
,
pSuperTableMeta
->
uid
,
&
info
);
}
tfree
(
pSuperTableMeta
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
code
;
}
static
SArray
*
serializeVgroupsTablesBatch
(
SHashObj
*
pVgroupHashmap
)
{
SArray
*
pBufArray
=
taosArrayInit
(
taosHashGetSize
(
pVgroupHashmap
),
sizeof
(
void
*
));
if
(
NULL
==
pBufArray
)
{
return
NULL
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
SVgroupTablesBatch
*
pTbBatch
=
NULL
;
do
{
pTbBatch
=
taosHashIterate
(
pVgroupHashmap
,
pTbBatch
);
if
(
pTbBatch
==
NULL
)
{
break
;
}
serializeVgroupTablesBatch
(
pTbBatch
,
pBufArray
);
destroyCreateTbReqBatch
(
pTbBatch
);
}
while
(
true
);
return
pBufArray
;
}
static
int32_t
rewriteCreateMultiTable
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
SCreateMultiTableStmt
*
pStmt
=
(
SCreateMultiTableStmt
*
)
pQuery
->
pRoot
;
SHashObj
*
pVgroupHashmap
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
if
(
NULL
==
pVgroupHashmap
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pNode
;
FOREACH
(
pNode
,
pStmt
->
pSubTables
)
{
code
=
rewriteCreateSubTable
(
pCxt
,
(
SCreateSubTableClause
*
)
pNode
,
pVgroupHashmap
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
taosHashCleanup
(
pVgroupHashmap
);
return
code
;
}
}
SArray
*
pBufArray
=
serializeVgroupsTablesBatch
(
pVgroupHashmap
);
if
(
NULL
==
pBufArray
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
taosHashCleanup
(
pVgroupHashmap
);
return
rewriteToVnodeModifOpStmt
(
pQuery
,
pBufArray
);
}
static
int32_t
rewriteQuery
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
nodeType
(
pQuery
->
pRoot
))
{
case
QUERY_NODE_CREATE_TABLE_STMT
:
if
(
NULL
==
((
SCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pTags
)
{
code
=
rewriteCreateTable
(
pCxt
,
pQuery
);
}
break
;
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
code
=
rewriteCreateMultiTable
(
pCxt
,
pQuery
);
break
;
default:
break
;
}
return
code
;
}
static
int32_t
setQuery
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
nodeType
(
pQuery
->
pRoot
))
{
case
QUERY_NODE_SELECT_STMT
:
pQuery
->
haveResultSet
=
true
;
pQuery
->
directRpc
=
false
;
pQuery
->
msgType
=
TDMT_VND_QUERY
;
code
=
setReslutSchema
(
pCxt
,
pQuery
);
break
;
case
QUERY_NODE_VNODE_MODIF_STMT
:
pQuery
->
haveResultSet
=
false
;
pQuery
->
directRpc
=
false
;
pQuery
->
msgType
=
TDMT_VND_CREATE_TABLE
;
break
;
default:
pQuery
->
haveResultSet
=
false
;
pQuery
->
directRpc
=
true
;
pQuery
->
pCmdMsg
=
pCxt
->
pCmdMsg
;
pCxt
->
pCmdMsg
=
NULL
;
pQuery
->
msgType
=
pQuery
->
pCmdMsg
->
msgType
;
break
;
}
return
code
;
}
int32_t
doTranslate
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
...
...
@@ -1124,13 +1429,7 @@ int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) {
code
=
translateQuery
(
&
cxt
,
pQuery
->
pRoot
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
pQuery
->
directRpc
)
{
pQuery
->
pCmdMsg
=
cxt
.
pCmdMsg
;
cxt
.
pCmdMsg
=
NULL
;
}
if
(
pQuery
->
haveResultSet
)
{
code
=
setReslutSchema
(
&
cxt
,
pQuery
);
}
code
=
setQuery
(
&
cxt
,
pQuery
);
}
destroyTranslateContext
(
&
cxt
);
return
code
;
...
...
source/libs/parser/src/insertParser.c
浏览文件 @
216c5317
...
...
@@ -80,6 +80,68 @@ static int32_t skipInsertInto(SInsertParseContext* pCxt) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
parserValidateIdToken
(
SToken
*
pToken
)
{
if
(
pToken
==
NULL
||
pToken
->
z
==
NULL
||
pToken
->
type
!=
TK_NK_ID
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
// it is a token quoted with escape char '`'
if
(
pToken
->
z
[
0
]
==
TS_ESCAPE_CHAR
&&
pToken
->
z
[
pToken
->
n
-
1
]
==
TS_ESCAPE_CHAR
)
{
return
TSDB_CODE_SUCCESS
;
}
char
*
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
if
(
sep
==
NULL
)
{
// It is a single part token, not a complex type
if
(
isNumber
(
pToken
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
strntolower
(
pToken
->
z
,
pToken
->
z
,
pToken
->
n
);
}
else
{
// two part
int32_t
oldLen
=
pToken
->
n
;
char
*
pStr
=
pToken
->
z
;
if
(
pToken
->
type
==
TK_NK_SPACE
)
{
pToken
->
n
=
(
uint32_t
)
strtrim
(
pToken
->
z
);
}
pToken
->
n
=
tGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
pToken
->
z
[
pToken
->
n
]
!=
TS_PATH_DELIMITER
[
0
])
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
if
(
pToken
->
type
!=
TK_NK_ID
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
int32_t
firstPartLen
=
pToken
->
n
;
pToken
->
z
=
sep
+
1
;
pToken
->
n
=
(
uint32_t
)(
oldLen
-
(
sep
-
pStr
)
-
1
);
int32_t
len
=
tGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
len
!=
pToken
->
n
||
pToken
->
type
!=
TK_NK_ID
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
// re-build the whole name string
if
(
pStr
[
firstPartLen
]
==
TS_PATH_DELIMITER
[
0
])
{
// first part do not have quote do nothing
}
else
{
pStr
[
firstPartLen
]
=
TS_PATH_DELIMITER
[
0
];
memmove
(
&
pStr
[
firstPartLen
+
1
],
pToken
->
z
,
pToken
->
n
);
uint32_t
offset
=
(
uint32_t
)(
pToken
->
z
-
(
pStr
+
firstPartLen
+
1
));
memset
(
pToken
->
z
+
pToken
->
n
-
offset
,
' '
,
offset
);
}
pToken
->
n
+=
(
firstPartLen
+
sizeof
(
TS_PATH_DELIMITER
[
0
]));
pToken
->
z
=
pStr
;
strntolower
(
pToken
->
z
,
pToken
->
z
,
pToken
->
n
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
buildName
(
SInsertParseContext
*
pCxt
,
SToken
*
pStname
,
char
*
fullDbName
,
char
*
tableName
)
{
if
(
parserValidateIdToken
(
pStname
)
!=
TSDB_CODE_SUCCESS
)
{
return
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
"invalid table name"
,
pStname
->
z
);
...
...
@@ -320,7 +382,7 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
static
FORCE_INLINE
int32_t
checkAndTrimValue
(
SToken
*
pToken
,
uint32_t
type
,
char
*
tmpTokenBuf
,
SMsgBuf
*
pMsgBuf
)
{
if
((
pToken
->
type
!=
TK_NOW
&&
pToken
->
type
!=
TK_NK_INTEGER
&&
pToken
->
type
!=
TK_NK_STRING
&&
pToken
->
type
!=
TK_NK_FLOAT
&&
pToken
->
type
!=
TK_NK_BOOL
&&
pToken
->
type
!=
TK_NULL
&&
pToken
->
type
!=
TK_
HEX
&&
pToken
->
type
!=
TK_OCT
&&
pToken
->
type
!=
T
K_BIN
)
||
pToken
->
type
!=
TK_NULL
&&
pToken
->
type
!=
TK_
NK_HEX
&&
pToken
->
type
!=
TK_NK_OCT
&&
pToken
->
type
!=
TK_N
K_BIN
)
||
(
pToken
->
n
==
0
)
||
(
pToken
->
type
==
TK_NK_RP
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid data or symbol"
,
pToken
->
z
);
}
...
...
@@ -370,7 +432,7 @@ static FORCE_INLINE int32_t toDouble(SToken *pToken, double *value, char **endPt
// not a valid integer number, return error
if
((
*
endPtr
-
pToken
->
z
)
!=
pToken
->
n
)
{
return
TK_ILLEGAL
;
return
TK_
NK_
ILLEGAL
;
}
return
pToken
->
type
;
...
...
@@ -496,7 +558,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
case
TSDB_DATA_TYPE_FLOAT
:
{
double
dv
;
if
(
TK_ILLEGAL
==
toDouble
(
pToken
,
&
dv
,
&
endptr
))
{
if
(
TK_
NK_
ILLEGAL
==
toDouble
(
pToken
,
&
dv
,
&
endptr
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"illegal float data"
,
pToken
->
z
);
}
if
(((
dv
==
HUGE_VAL
||
dv
==
-
HUGE_VAL
)
&&
errno
==
ERANGE
)
||
dv
>
FLT_MAX
||
dv
<
-
FLT_MAX
||
isinf
(
dv
)
||
isnan
(
dv
))
{
...
...
@@ -508,7 +570,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
case
TSDB_DATA_TYPE_DOUBLE
:
{
double
dv
;
if
(
TK_ILLEGAL
==
toDouble
(
pToken
,
&
dv
,
&
endptr
))
{
if
(
TK_
NK_
ILLEGAL
==
toDouble
(
pToken
,
&
dv
,
&
endptr
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"illegal double data"
,
pToken
->
z
);
}
if
(((
dv
==
HUGE_VAL
||
dv
==
-
HUGE_VAL
)
&&
errno
==
ERANGE
)
||
isinf
(
dv
)
||
isnan
(
dv
))
{
...
...
@@ -646,6 +708,37 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo*
return
TSDB_CODE_SUCCESS
;
}
typedef
struct
SKvParam
{
SKVRowBuilder
*
builder
;
SSchema
*
schema
;
char
buf
[
TSDB_MAX_TAGS_LEN
];
}
SKvParam
;
static
int32_t
KvRowAppend
(
const
void
*
value
,
int32_t
len
,
void
*
param
)
{
SKvParam
*
pa
=
(
SKvParam
*
)
param
;
int32_t
type
=
pa
->
schema
->
type
;
int32_t
colId
=
pa
->
schema
->
colId
;
if
(
TSDB_DATA_TYPE_BINARY
==
type
)
{
STR_WITH_SIZE_TO_VARSTR
(
pa
->
buf
,
value
,
len
);
tdAddColToKVRow
(
pa
->
builder
,
colId
,
type
,
pa
->
buf
);
}
else
if
(
TSDB_DATA_TYPE_NCHAR
==
type
)
{
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
int32_t
output
=
0
;
if
(
!
taosMbsToUcs4
(
value
,
len
,
varDataVal
(
pa
->
buf
),
pa
->
schema
->
bytes
-
VARSTR_HEADER_SIZE
,
&
output
))
{
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
varDataSetLen
(
pa
->
buf
,
output
);
tdAddColToKVRow
(
pa
->
builder
,
colId
,
type
,
pa
->
buf
);
}
else
{
tdAddColToKVRow
(
pa
->
builder
,
colId
,
type
,
value
);
}
return
TSDB_CODE_SUCCESS
;
}
// pSql -> tag1_value, ...)
static
int32_t
parseTagsClause
(
SInsertParseContext
*
pCxt
,
SSchema
*
pTagsSchema
,
uint8_t
precision
)
{
if
(
tdInitKVRowBuilder
(
&
pCxt
->
tagsBuilder
)
<
0
)
{
...
...
@@ -893,7 +986,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
}
// FILE csv_file_path
if
(
TK_FILE
==
sToken
.
type
)
{
if
(
TK_
NK_
FILE
==
sToken
.
type
)
{
// pSql -> csv_file_path
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
if
(
0
==
sToken
.
n
||
(
TK_NK_STRING
!=
sToken
.
type
&&
TK_NK_ID
!=
sToken
.
type
))
{
...
...
source/libs/parser/src/new_sql.c
浏览文件 @
216c5317
...
...
@@ -36,16 +36,6 @@
#include "ttoken.h"
#include "ttokendef.h"
#include "astCreateFuncs.h"
#if 0
#define PARSER_TRACE printf("lemon rule = %s\n", yyRuleName[yyruleno])
#define PARSER_DESTRUCTOR_TRACE printf("lemon destroy token = %s\n", yyTokenName[yymajor])
#define PARSER_COMPLETE printf("parsing complete!\n" )
#else
#define PARSER_TRACE
#define PARSER_DESTRUCTOR_TRACE
#define PARSER_COMPLETE
#endif
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols
** in a format understandable to "makeheaders". This section is blank unless
...
...
@@ -109,25 +99,25 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned char
#define YYNOCODE 1
80
#define YYNOCODE 1
91
#define YYACTIONTYPE unsigned short int
#define NewParseTOKENTYPE SToken
typedef
union
{
int
yyinit
;
NewParseTOKENTYPE
yy0
;
E
OperatorType
yy20
;
STableOptions
*
yy46
;
EFillMode
yy54
;
STokenPair
yy57
;
SNodeList
*
yy64
;
bool
yy137
;
S
DatabaseOptions
*
yy199
;
SToken
yy209
;
ENullOrder
yy217
;
EOrder
yy218
;
EJoinType
yy252
;
SNode
*
yy272
;
S
DataType
yy304
;
E
JoinType
yy28
;
EOrder
yy29
;
SDataType
yy42
;
EFillMode
yy102
;
EOperatorType
yy140
;
SToken
yy175
;
S
NodeList
*
yy182
;
bool
yy187
;
SNode
*
yy210
;
SDatabaseOptions
*
yy211
;
STableOptions
*
yy286
;
ENullOrder
yy307
;
S
TokenPair
yy341
;
}
YYMINORTYPE
;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
...
...
@@ -142,17 +132,17 @@ typedef union {
#define NewParseCTX_PARAM
#define NewParseCTX_FETCH
#define NewParseCTX_STORE
#define YYNSTATE 2
12
#define YYNRULE
197
#define YYNTOKEN 1
19
#define YY_MAX_SHIFT 2
11
#define YY_MIN_SHIFTREDUCE 3
53
#define YY_MAX_SHIFTREDUCE
549
#define YY_ERROR_ACTION
550
#define YY_ACCEPT_ACTION
551
#define YY_NO_ACTION
552
#define YY_MIN_REDUCE
553
#define YY_MAX_REDUCE
749
#define YYNSTATE 2
39
#define YYNRULE
211
#define YYNTOKEN 1
23
#define YY_MAX_SHIFT 2
38
#define YY_MIN_SHIFTREDUCE 3
90
#define YY_MAX_SHIFTREDUCE
600
#define YY_ERROR_ACTION
601
#define YY_ACCEPT_ACTION
602
#define YY_NO_ACTION
603
#define YY_MIN_REDUCE
604
#define YY_MAX_REDUCE
814
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
...
...
@@ -219,255 +209,259 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (8
71
)
#define YY_ACTTAB_COUNT (8
24
)
static
const
YYACTIONTYPE
yy_action
[]
=
{
/* 0 */
619
,
617
,
105
,
188
,
117
,
728
,
578
,
48
,
23
,
75
,
/* 10 */
76
,
642
,
30
,
28
,
26
,
25
,
24
,
158
,
126
,
727
,
/* 20 */
681
,
100
,
129
,
726
,
681
,
30
,
28
,
26
,
25
,
24
,
/* 30 */
553
,
620
,
617
,
642
,
100
,
68
,
627
,
617
,
678
,
158
,
/* 40 */
159
,
499
,
677
,
42
,
628
,
432
,
631
,
667
,
26
,
25
,
/* 50 */
24
,
666
,
663
,
211
,
681
,
210
,
209
,
208
,
207
,
206
,
/* 60 */
205
,
204
,
203
,
202
,
697
,
201
,
200
,
199
,
198
,
197
,
/* 70 */
196
,
195
,
676
,
423
,
22
,
109
,
141
,
450
,
451
,
452
,
/* 80 */
453
,
454
,
455
,
456
,
458
,
459
,
460
,
22
,
109
,
134
,
/* 90 */
450
,
451
,
452
,
453
,
454
,
455
,
456
,
458
,
459
,
460
,
/* 100 */
10
,
10
,
143
,
143
,
382
,
186
,
185
,
184
,
386
,
183
,
/* 110 */
388
,
389
,
182
,
391
,
179
,
118
,
397
,
176
,
399
,
400
,
/* 120 */
173
,
170
,
642
,
575
,
148
,
627
,
617
,
84
,
158
,
159
,
/* 130 */
9
,
8
,
40
,
628
,
58
,
631
,
667
,
6
,
487
,
80
,
/* 140 */
99
,
663
,
423
,
642
,
579
,
48
,
627
,
617
,
58
,
144
,
/* 150 */
159
,
82
,
728
,
41
,
628
,
190
,
631
,
667
,
642
,
20
,
/* 160 */
189
,
107
,
663
,
52
,
158
,
115
,
57
,
643
,
457
,
133
,
/* 170 */
726
,
461
,
191
,
642
,
468
,
74
,
627
,
617
,
151
,
144
,
/* 180 */
159
,
119
,
694
,
41
,
628
,
491
,
631
,
667
,
426
,
58
,
/* 190 */
551
,
107
,
663
,
52
,
78
,
642
,
425
,
426
,
627
,
617
,
/* 200 */
161
,
158
,
159
,
155
,
513
,
41
,
628
,
43
,
631
,
667
,
/* 210 */
9
,
8
,
695
,
107
,
663
,
740
,
642
,
2
,
65
,
627
,
/* 220 */
617
,
62
,
158
,
159
,
701
,
152
,
41
,
628
,
728
,
631
,
/* 230 */
667
,
135
,
130
,
128
,
107
,
663
,
740
,
642
,
73
,
59
,
/* 240 */
627
,
617
,
57
,
158
,
159
,
724
,
726
,
41
,
628
,
698
,
/* 250 */
631
,
667
,
146
,
29
,
27
,
107
,
663
,
740
,
29
,
27
,
/* 260 */
492
,
686
,
11
,
487
,
127
,
412
,
685
,
11
,
156
,
462
,
/* 270 */
412
,
708
,
31
,
429
,
490
,
414
,
31
,
548
,
549
,
624
,
/* 280 */
414
,
60
,
622
,
403
,
150
,
1
,
168
,
114
,
153
,
124
,
/* 290 */
1
,
642
,
114
,
148
,
627
,
617
,
122
,
158
,
159
,
418
,
/* 300 */
160
,
90
,
628
,
85
,
631
,
160
,
47
,
447
,
29
,
27
,
/* 310 */
123
,
707
,
413
,
415
,
418
,
29
,
27
,
413
,
415
,
418
,
/* 320 */
412
,
728
,
163
,
162
,
11
,
64
,
106
,
412
,
5
,
137
,
/* 330 */
414
,
688
,
67
,
58
,
121
,
57
,
4
,
414
,
69
,
726
,
/* 340 */
7
,
51
,
114
,
422
,
45
,
487
,
425
,
1
,
682
,
114
,
/* 350 */
642
,
32
,
70
,
627
,
617
,
160
,
158
,
159
,
16
,
649
,
/* 360 */
49
,
628
,
160
,
631
,
110
,
743
,
725
,
413
,
415
,
418
,
/* 370 */
154
,
157
,
140
,
77
,
413
,
415
,
418
,
421
,
164
,
642
,
/* 380 */
148
,
166
,
627
,
617
,
46
,
158
,
159
,
194
,
58
,
42
,
/* 390 */
628
,
44
,
631
,
667
,
192
,
29
,
27
,
145
,
663
,
149
,
/* 400 */
741
,
71
,
674
,
139
,
81
,
138
,
86
,
412
,
728
,
83
,
/* 410 */
87
,
29
,
27
,
147
,
412
,
98
,
3
,
414
,
31
,
14
,
/* 420 */
61
,
510
,
57
,
412
,
414
,
63
,
726
,
1
,
642
,
114
,
/* 430 */
35
,
627
,
617
,
414
,
158
,
159
,
512
,
50
,
96
,
628
,
/* 440 */
113
,
631
,
160
,
7
,
66
,
114
,
506
,
505
,
36
,
160
,
/* 450 */
131
,
37
,
15
,
132
,
413
,
415
,
418
,
622
,
160
,
18
,
/* 460 */
484
,
413
,
415
,
418
,
483
,
34
,
33
,
72
,
29
,
27
,
/* 470 */
413
,
415
,
418
,
8
,
621
,
642
,
56
,
534
,
627
,
617
,
/* 480 */
412
,
158
,
159
,
430
,
448
,
42
,
628
,
539
,
631
,
667
,
/* 490 */
414
,
17
,
12
,
38
,
664
,
30
,
28
,
26
,
25
,
24
,
/* 500 */
7
,
533
,
114
,
111
,
538
,
537
,
112
,
642
,
79
,
13
,
/* 510 */
627
,
617
,
416
,
158
,
159
,
160
,
611
,
96
,
628
,
120
,
/* 520 */
631
,
610
,
609
,
574
,
167
,
396
,
116
,
413
,
415
,
418
,
/* 530 */
642
,
377
,
171
,
627
,
617
,
165
,
158
,
159
,
404
,
169
,
/* 540 */
92
,
628
,
401
,
631
,
398
,
642
,
381
,
172
,
627
,
617
,
/* 550 */
175
,
158
,
159
,
178
,
174
,
96
,
628
,
108
,
631
,
642
,
/* 560 */
177
,
180
,
627
,
617
,
392
,
158
,
159
,
408
,
181
,
49
,
/* 570 */
628
,
642
,
631
,
136
,
627
,
617
,
390
,
158
,
159
,
395
,
/* 580 */
407
,
91
,
628
,
187
,
631
,
406
,
642
,
394
,
393
,
627
,
/* 590 */
617
,
39
,
158
,
159
,
354
,
193
,
93
,
628
,
366
,
631
,
/* 600 */
642
,
373
,
372
,
627
,
617
,
371
,
158
,
159
,
370
,
742
,
/* 610 */
88
,
628
,
369
,
631
,
642
,
552
,
368
,
627
,
617
,
367
,
/* 620 */
158
,
159
,
365
,
364
,
94
,
628
,
363
,
631
,
642
,
552
,
/* 630 */
362
,
627
,
617
,
361
,
158
,
159
,
360
,
359
,
89
,
628
,
/* 640 */
552
,
631
,
642
,
552
,
358
,
627
,
617
,
357
,
158
,
159
,
/* 650 */
552
,
552
,
95
,
628
,
552
,
631
,
642
,
552
,
552
,
627
,
/* 660 */
617
,
552
,
158
,
159
,
552
,
552
,
639
,
628
,
642
,
631
,
/* 670 */
552
,
627
,
617
,
552
,
158
,
159
,
552
,
552
,
638
,
628
,
/* 680 */
642
,
631
,
552
,
627
,
617
,
552
,
158
,
159
,
552
,
552
,
/* 690 */
637
,
628
,
552
,
631
,
642
,
552
,
552
,
627
,
617
,
552
,
/* 700 */
158
,
159
,
552
,
552
,
103
,
628
,
642
,
631
,
552
,
627
,
/* 710 */
617
,
552
,
158
,
159
,
552
,
552
,
102
,
628
,
642
,
631
,
/* 720 */
552
,
627
,
617
,
552
,
158
,
159
,
552
,
552
,
104
,
628
,
/* 730 */
552
,
631
,
642
,
552
,
552
,
627
,
617
,
552
,
158
,
159
,
/* 740 */
552
,
552
,
101
,
628
,
552
,
631
,
642
,
552
,
516
,
627
,
/* 750 */
617
,
19
,
158
,
159
,
140
,
552
,
97
,
628
,
552
,
631
,
/* 760 */
140
,
30
,
28
,
26
,
25
,
24
,
46
,
30
,
28
,
26
,
/* 770 */
25
,
24
,
46
,
44
,
125
,
514
,
515
,
517
,
518
,
44
,
/* 780 */
552
,
552
,
142
,
53
,
674
,
675
,
552
,
679
,
140
,
54
,
/* 790 */
674
,
675
,
21
,
679
,
552
,
30
,
28
,
26
,
25
,
24
,
/* 800 */
46
,
552
,
30
,
28
,
26
,
25
,
24
,
44
,
552
,
552
,
/* 810 */
552
,
552
,
552
,
552
,
552
,
552
,
552
,
55
,
674
,
675
,
/* 820 */
552
,
679
,
552
,
552
,
552
,
552
,
552
,
552
,
432
,
552
,
/* 830 */
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
/* 840 */
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
/* 850 */
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
/* 860 */
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
552
,
545
,
/* 870 */
546
,
/* 0 */
122
,
214
,
135
,
23
,
84
,
793
,
746
,
684
,
682
,
684
,
/* 10 */
682
,
707
,
30
,
28
,
26
,
25
,
24
,
180
,
673
,
792
,
/* 20 */
672
,
116
,
151
,
791
,
743
,
30
,
28
,
26
,
25
,
24
,
/* 30 */
604
,
221
,
133
,
707
,
116
,
685
,
682
,
692
,
682
,
180
,
/* 40 */
181
,
636
,
57
,
48
,
693
,
483
,
696
,
732
,
689
,
9
,
/* 50 */
8
,
731
,
728
,
238
,
687
,
237
,
236
,
235
,
234
,
233
,
/* 60 */
232
,
231
,
230
,
229
,
156
,
228
,
227
,
226
,
225
,
224
,
/* 70 */
223
,
222
,
30
,
28
,
26
,
25
,
24
,
100
,
22
,
126
,
/* 80 */
664
,
501
,
502
,
503
,
504
,
505
,
506
,
507
,
509
,
510
,
/* 90 */
511
,
22
,
126
,
519
,
501
,
502
,
503
,
504
,
505
,
506
,
/* 100 */
507
,
509
,
510
,
511
,
157
,
152
,
150
,
426
,
212
,
211
,
/* 110 */
210
,
430
,
209
,
432
,
433
,
208
,
435
,
205
,
93
,
441
,
/* 120 */
202
,
443
,
444
,
199
,
196
,
707
,
474
,
630
,
170
,
692
,
/* 130 */
682
,
180
,
181
,
96
,
476
,
46
,
693
,
168
,
696
,
732
,
/* 140 */
53
,
20
,
629
,
115
,
728
,
30
,
28
,
26
,
25
,
24
,
/* 150 */
508
,
137
,
707
,
512
,
627
,
793
,
692
,
682
,
166
,
181
,
/* 160 */
636
,
57
,
47
,
693
,
121
,
696
,
732
,
477
,
98
,
66
,
/* 170 */
124
,
728
,
61
,
791
,
221
,
746
,
707
,
82
,
596
,
597
,
/* 180 */
692
,
682
,
180
,
181
,
83
,
746
,
58
,
693
,
89
,
696
,
/* 190 */
141
,
759
,
45
,
742
,
707
,
92
,
498
,
10
,
692
,
682
,
/* 200 */
166
,
181
,
165
,
741
,
47
,
693
,
10
,
696
,
732
,
707
,
/* 210 */
68
,
165
,
124
,
728
,
61
,
180
,
44
,
707
,
132
,
95
,
/* 220 */
155
,
692
,
682
,
180
,
181
,
171
,
806
,
47
,
693
,
215
,
/* 230 */
696
,
732
,
85
,
760
,
707
,
124
,
728
,
805
,
692
,
682
,
/* 240 */
180
,
181
,
67
,
173
,
47
,
693
,
766
,
696
,
732
,
67
,
/* 250 */
139
,
707
,
124
,
728
,
805
,
692
,
682
,
180
,
181
,
636
,
/* 260 */
57
,
47
,
693
,
789
,
696
,
732
,
29
,
27
,
148
,
124
,
/* 270 */
728
,
805
,
134
,
67
,
673
,
11
,
671
,
751
,
463
,
538
,
/* 280 */
750
,
564
,
29
,
27
,
543
,
542
,
463
,
49
,
465
,
628
,
/* 290 */
550
,
11
,
637
,
57
,
463
,
707
,
465
,
177
,
1
,
692
,
/* 300 */
682
,
180
,
181
,
131
,
465
,
111
,
693
,
130
,
696
,
30
,
/* 310 */
28
,
26
,
25
,
24
,
1
,
174
,
190
,
74
,
138
,
131
,
/* 320 */
673
,
218
,
671
,
71
,
190
,
474
,
217
,
9
,
8
,
464
,
/* 330 */
466
,
469
,
190
,
26
,
25
,
24
,
77
,
464
,
466
,
469
,
/* 340 */
762
,
219
,
483
,
6
,
538
,
464
,
466
,
469
,
162
,
163
,
/* 350 */
67
,
707
,
708
,
172
,
170
,
692
,
682
,
180
,
181
,
513
,
/* 360 */
216
,
105
,
693
,
178
,
696
,
31
,
2
,
52
,
29
,
27
,
/* 370 */
480
,
29
,
27
,
87
,
50
,
763
,
31
,
11
,
541
,
175
,
/* 380 */
463
,
793
,
477
,
463
,
63
,
739
,
740
,
149
,
744
,
773
,
/* 390 */
465
,
184
,
183
,
465
,
146
,
66
,
599
,
600
,
69
,
791
,
/* 400 */
1
,
469
,
144
,
7
,
145
,
131
,
707
,
73
,
131
,
90
,
/* 410 */
692
,
682
,
180
,
181
,
772
,
54
,
48
,
693
,
190
,
696
,
/* 420 */
732
,
190
,
419
,
417
,
167
,
728
,
123
,
19
,
55
,
49
,
/* 430 */
162
,
464
,
466
,
469
,
464
,
466
,
469
,
30
,
28
,
26
,
/* 440 */
25
,
24
,
447
,
5
,
753
,
159
,
170
,
707
,
194
,
52
,
/* 450 */
567
,
692
,
682
,
180
,
181
,
67
,
50
,
111
,
693
,
142
,
/* 460 */
696
,
76
,
29
,
27
,
169
,
143
,
80
,
739
,
161
,
451
,
/* 470 */
160
,
162
,
60
,
793
,
463
,
54
,
147
,
565
,
566
,
568
,
/* 480 */
569
,
29
,
27
,
456
,
465
,
4
,
56
,
66
,
78
,
55
,
/* 490 */
52
,
791
,
54
,
463
,
7
,
538
,
473
,
50
,
51
,
131
,
/* 500 */
476
,
747
,
79
,
465
,
32
,
16
,
164
,
62
,
739
,
740
,
/* 510 */
707
,
744
,
190
,
1
,
692
,
682
,
180
,
181
,
131
,
127
,
/* 520 */
48
,
693
,
714
,
696
,
732
,
464
,
466
,
469
,
21
,
729
,
/* 530 */
808
,
190
,
179
,
790
,
176
,
86
,
29
,
27
,
30
,
28
,
/* 540 */
26
,
25
,
24
,
472
,
464
,
466
,
469
,
185
,
463
,
707
,
/* 550 */
99
,
602
,
189
,
692
,
682
,
180
,
181
,
186
,
465
,
107
,
/* 560 */
693
,
91
,
696
,
187
,
41
,
192
,
94
,
140
,
7
,
182
,
/* 570 */
707
,
101
,
97
,
131
,
692
,
682
,
180
,
181
,
102
,
113
,
/* 580 */
111
,
693
,
125
,
696
,
114
,
3
,
190
,
31
,
70
,
14
,
/* 590 */
561
,
72
,
158
,
35
,
153
,
563
,
793
,
59
,
707
,
464
,
/* 600 */
466
,
469
,
692
,
682
,
180
,
181
,
626
,
75
,
58
,
693
,
/* 610 */
66
,
696
,
707
,
557
,
791
,
37
,
692
,
682
,
180
,
181
,
/* 620 */
154
,
556
,
106
,
693
,
687
,
696
,
707
,
38
,
18
,
15
,
/* 630 */
692
,
682
,
180
,
181
,
535
,
534
,
108
,
693
,
218
,
696
,
/* 640 */
8
,
81
,
686
,
217
,
33
,
34
,
65
,
499
,
807
,
707
,
/* 650 */
481
,
17
,
590
,
692
,
682
,
180
,
181
,
12
,
219
,
103
,
/* 660 */
693
,
585
,
696
,
707
,
39
,
584
,
128
,
692
,
682
,
180
,
/* 670 */
181
,
589
,
588
,
109
,
693
,
707
,
696
,
216
,
129
,
692
,
/* 680 */
682
,
180
,
181
,
88
,
13
,
104
,
693
,
707
,
696
,
676
,
/* 690 */
675
,
692
,
682
,
180
,
181
,
674
,
625
,
110
,
693
,
707
,
/* 700 */
696
,
421
,
40
,
692
,
682
,
180
,
181
,
467
,
448
,
704
,
/* 710 */
693
,
95
,
696
,
707
,
36
,
188
,
191
,
692
,
682
,
180
,
/* 720 */
181
,
193
,
136
,
703
,
693
,
707
,
696
,
195
,
197
,
692
,
/* 730 */
682
,
180
,
181
,
445
,
200
,
702
,
693
,
707
,
696
,
442
,
/* 740 */
203
,
692
,
682
,
180
,
181
,
198
,
201
,
119
,
693
,
204
,
/* 750 */
696
,
707
,
436
,
434
,
206
,
692
,
682
,
180
,
181
,
207
,
/* 760 */
425
,
118
,
693
,
440
,
696
,
707
,
213
,
439
,
42
,
692
,
/* 770 */
682
,
180
,
181
,
438
,
455
,
120
,
693
,
437
,
696
,
43
,
/* 780 */
454
,
453
,
162
,
391
,
220
,
403
,
410
,
707
,
409
,
408
,
/* 790 */
407
,
692
,
682
,
180
,
181
,
406
,
405
,
117
,
693
,
707
,
/* 800 */
696
,
52
,
404
,
692
,
682
,
180
,
181
,
402
,
50
,
112
,
/* 810 */
693
,
401
,
696
,
400
,
399
,
398
,
397
,
396
,
64
,
739
,
/* 820 */
740
,
395
,
744
,
394
,
};
static
const
YYCODETYPE
yy_lookahead
[]
=
{
/* 0 */
130
,
131
,
132
,
128
,
124
,
157
,
126
,
127
,
142
,
143
,
/* 10 */
178
,
127
,
12
,
13
,
14
,
15
,
16
,
133
,
169
,
171
,
/* 20 */
135
,
21
,
138
,
175
,
135
,
12
,
13
,
14
,
15
,
16
,
/* 30 */
0
,
130
,
131
,
127
,
21
,
162
,
130
,
131
,
153
,
133
,
/* 40 */
134
,
14
,
153
,
137
,
138
,
45
,
140
,
141
,
14
,
15
,
/* 50 */
16
,
145
,
146
,
23
,
135
,
25
,
26
,
27
,
28
,
29
,
/* 60 */
30
,
31
,
32
,
33
,
136
,
35
,
36
,
37
,
38
,
39
,
/* 70 */
40
,
41
,
153
,
46
,
74
,
75
,
155
,
77
,
78
,
79
,
/* 80 */
80
,
81
,
82
,
83
,
84
,
85
,
86
,
74
,
75
,
46
,
/* 90 */
77
,
78
,
79
,
80
,
81
,
82
,
83
,
84
,
85
,
86
,
/* 100 */
44
,
44
,
46
,
46
,
50
,
51
,
52
,
53
,
54
,
55
,
/* 110 */
56
,
57
,
58
,
59
,
60
,
18
,
62
,
63
,
64
,
65
,
/* 120 */
66
,
67
,
127
,
0
,
129
,
130
,
131
,
19
,
133
,
134
,
/* 130 */
1
,
2
,
137
,
138
,
92
,
140
,
141
,
90
,
91
,
42
,
/* 140 */
145
,
146
,
46
,
127
,
126
,
127
,
130
,
131
,
92
,
133
,
/* 150 */
134
,
43
,
157
,
137
,
138
,
32
,
140
,
141
,
127
,
74
,
/* 160 */
37
,
145
,
146
,
147
,
133
,
68
,
171
,
127
,
83
,
138
,
/* 170 */
175
,
86
,
49
,
127
,
45
,
159
,
130
,
131
,
3
,
133
,
/* 180 */
134
,
165
,
166
,
137
,
138
,
4
,
140
,
141
,
46
,
92
,
/* 190 */
119
,
145
,
146
,
147
,
172
,
127
,
46
,
46
,
130
,
131
,
/* 200 */
129
,
133
,
134
,
48
,
45
,
137
,
138
,
48
,
140
,
141
,
/* 210 */
1
,
2
,
166
,
145
,
146
,
147
,
127
,
158
,
45
,
130
,
/* 220 */
131
,
48
,
133
,
134
,
156
,
48
,
137
,
138
,
157
,
140
,
/* 230 */
141
,
97
,
98
,
99
,
145
,
146
,
147
,
127
,
88
,
88
,
/* 240 */
130
,
131
,
171
,
133
,
134
,
156
,
175
,
137
,
138
,
136
,
/* 250 */
140
,
141
,
21
,
12
,
13
,
145
,
146
,
147
,
12
,
13
,
/* 260 */
14
,
89
,
21
,
91
,
101
,
24
,
156
,
21
,
113
,
45
,
/* 270 */
24
,
168
,
48
,
45
,
93
,
34
,
48
,
117
,
118
,
44
,
/* 280 */
34
,
167
,
47
,
45
,
109
,
44
,
48
,
46
,
111
,
100
,
/* 290 */
44
,
127
,
46
,
129
,
130
,
131
,
131
,
133
,
134
,
73
,
/* 300 */
59
,
137
,
138
,
45
,
140
,
59
,
48
,
76
,
12
,
13
,
/* 310 */
131
,
168
,
71
,
72
,
73
,
12
,
13
,
71
,
72
,
73
,
/* 320 */
24
,
157
,
69
,
70
,
21
,
167
,
131
,
24
,
108
,
107
,
/* 330 */
34
,
164
,
163
,
92
,
95
,
171
,
94
,
34
,
160
,
175
,
/* 340 */
44
,
161
,
46
,
46
,
133
,
91
,
46
,
44
,
135
,
46
,
/* 350 */
127
,
87
,
148
,
130
,
131
,
59
,
133
,
134
,
44
,
144
,
/* 360 */
137
,
138
,
59
,
140
,
116
,
179
,
174
,
71
,
72
,
73
,
/* 370 */
110
,
112
,
121
,
173
,
71
,
72
,
73
,
46
,
121
,
127
,
/* 380 */
129
,
46
,
130
,
131
,
133
,
133
,
134
,
20
,
92
,
137
,
/* 390 */
138
,
140
,
140
,
141
,
123
,
12
,
13
,
145
,
146
,
176
,
/* 400 */
177
,
150
,
151
,
152
,
120
,
154
,
121
,
24
,
157
,
120
,
/* 410 */
122
,
12
,
13
,
14
,
24
,
125
,
48
,
34
,
48
,
96
,
/* 420 */
45
,
45
,
171
,
24
,
34
,
44
,
175
,
44
,
127
,
46
,
/* 430 */
48
,
130
,
131
,
34
,
133
,
134
,
45
,
44
,
137
,
138
,
/* 440 */
139
,
140
,
59
,
44
,
44
,
46
,
45
,
45
,
44
,
59
,
/* 450 */
24
,
44
,
96
,
48
,
71
,
72
,
73
,
47
,
59
,
48
,
/* 460 */
45
,
71
,
72
,
73
,
45
,
48
,
89
,
47
,
12
,
13
,
/* 470 */
71
,
72
,
73
,
2
,
47
,
127
,
47
,
24
,
130
,
131
,
/* 480 */
24
,
133
,
134
,
45
,
76
,
137
,
138
,
45
,
140
,
141
,
/* 490 */
34
,
48
,
96
,
4
,
146
,
12
,
13
,
14
,
15
,
16
,
/* 500 */
44
,
24
,
46
,
24
,
24
,
24
,
24
,
127
,
47
,
44
,
/* 510 */
130
,
131
,
34
,
133
,
134
,
59
,
0
,
137
,
138
,
139
,
/* 520 */
140
,
0
,
0
,
0
,
24
,
61
,
24
,
71
,
72
,
73
,
/* 530 */
127
,
46
,
24
,
130
,
131
,
47
,
133
,
134
,
45
,
44
,
/* 540 */
137
,
138
,
45
,
140
,
45
,
127
,
34
,
44
,
130
,
131
,
/* 550 */
44
,
133
,
134
,
44
,
24
,
137
,
138
,
139
,
140
,
127
,
/* 560 */
24
,
24
,
130
,
131
,
45
,
133
,
134
,
24
,
44
,
137
,
/* 570 */
138
,
127
,
140
,
170
,
130
,
131
,
45
,
133
,
134
,
61
,
/* 580 */
24
,
137
,
138
,
49
,
140
,
24
,
127
,
61
,
61
,
130
,
/* 590 */
131
,
44
,
133
,
134
,
22
,
21
,
137
,
138
,
34
,
140
,
/* 600 */
127
,
24
,
24
,
130
,
131
,
24
,
133
,
134
,
24
,
177
,
/* 610 */
137
,
138
,
24
,
140
,
127
,
180
,
24
,
130
,
131
,
24
,
/* 620 */
133
,
134
,
24
,
24
,
137
,
138
,
24
,
140
,
127
,
180
,
/* 630 */
24
,
130
,
131
,
24
,
133
,
134
,
24
,
24
,
137
,
138
,
/* 640 */
180
,
140
,
127
,
180
,
24
,
130
,
131
,
24
,
133
,
134
,
/* 650 */
180
,
180
,
137
,
138
,
180
,
140
,
127
,
180
,
180
,
130
,
/* 660 */
131
,
180
,
133
,
134
,
180
,
180
,
137
,
138
,
127
,
140
,
/* 670 */
180
,
130
,
131
,
180
,
133
,
134
,
180
,
180
,
137
,
138
,
/* 680 */
127
,
140
,
180
,
130
,
131
,
180
,
133
,
134
,
180
,
180
,
/* 690 */
137
,
138
,
180
,
140
,
127
,
180
,
180
,
130
,
131
,
180
,
/* 700 */
133
,
134
,
180
,
180
,
137
,
138
,
127
,
140
,
180
,
130
,
/* 710 */
131
,
180
,
133
,
134
,
180
,
180
,
137
,
138
,
127
,
140
,
/* 720 */
180
,
130
,
131
,
180
,
133
,
134
,
180
,
180
,
137
,
138
,
/* 730 */
180
,
140
,
127
,
180
,
180
,
130
,
131
,
180
,
133
,
134
,
/* 740 */
180
,
180
,
137
,
138
,
180
,
140
,
127
,
180
,
76
,
130
,
/* 750 */
131
,
2
,
133
,
134
,
121
,
180
,
137
,
138
,
180
,
140
,
/* 760 */
121
,
12
,
13
,
14
,
15
,
16
,
133
,
12
,
13
,
14
,
/* 770 */
15
,
16
,
133
,
140
,
102
,
103
,
104
,
105
,
106
,
140
,
/* 780 */
180
,
180
,
149
,
150
,
151
,
152
,
180
,
154
,
121
,
150
,
/* 790 */
151
,
152
,
2
,
154
,
180
,
12
,
13
,
14
,
15
,
16
,
/* 800 */
133
,
180
,
12
,
13
,
14
,
15
,
16
,
140
,
180
,
180
,
/* 810 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
150
,
151
,
152
,
/* 820 */
180
,
154
,
180
,
180
,
180
,
180
,
180
,
180
,
45
,
180
,
/* 830 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 840 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 850 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 860 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
114
,
/* 870 */
115
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 880 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 890 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 900 */
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
180
,
/* 910 */
180
,
180
,
180
,
180
,
180
,
/* 0 */
135
,
139
,
135
,
153
,
154
,
168
,
146
,
142
,
143
,
142
,
/* 10 */
143
,
138
,
12
,
13
,
14
,
15
,
16
,
144
,
138
,
182
,
/* 20 */
140
,
21
,
149
,
186
,
164
,
12
,
13
,
14
,
15
,
16
,
/* 30 */
0
,
20
,
128
,
138
,
21
,
142
,
143
,
142
,
143
,
144
,
/* 40 */
145
,
137
,
138
,
148
,
149
,
45
,
151
,
152
,
44
,
1
,
/* 50 */
2
,
156
,
157
,
23
,
50
,
25
,
26
,
27
,
28
,
29
,
/* 60 */
30
,
31
,
32
,
33
,
49
,
35
,
36
,
37
,
38
,
39
,
/* 70 */
40
,
41
,
12
,
13
,
14
,
15
,
16
,
129
,
78
,
79
,
/* 80 */
132
,
81
,
82
,
83
,
84
,
85
,
86
,
87
,
88
,
89
,
/* 90 */
90
,
78
,
79
,
45
,
81
,
82
,
83
,
84
,
85
,
86
,
/* 100 */
87
,
88
,
89
,
90
,
101
,
102
,
103
,
53
,
54
,
55
,
/* 110 */
56
,
57
,
58
,
59
,
60
,
61
,
62
,
63
,
124
,
65
,
/* 120 */
66
,
67
,
68
,
69
,
70
,
138
,
49
,
133
,
141
,
142
,
/* 130 */
143
,
144
,
145
,
124
,
49
,
148
,
149
,
21
,
151
,
152
,
/* 140 */
131
,
78
,
133
,
156
,
157
,
12
,
13
,
14
,
15
,
16
,
/* 150 */
87
,
128
,
138
,
90
,
0
,
168
,
142
,
143
,
144
,
145
,
/* 160 */
137
,
138
,
148
,
149
,
18
,
151
,
152
,
49
,
19
,
182
,
/* 170 */
156
,
157
,
158
,
186
,
20
,
146
,
138
,
92
,
118
,
119
,
/* 180 */
142
,
143
,
144
,
145
,
170
,
146
,
148
,
149
,
42
,
151
,
/* 190 */
176
,
177
,
43
,
164
,
138
,
46
,
80
,
44
,
142
,
143
,
/* 200 */
144
,
145
,
49
,
164
,
148
,
149
,
44
,
151
,
152
,
138
,
/* 210 */
92
,
49
,
156
,
157
,
158
,
144
,
44
,
138
,
72
,
47
,
/* 220 */
149
,
142
,
143
,
144
,
145
,
187
,
188
,
148
,
149
,
48
,
/* 230 */
151
,
152
,
189
,
177
,
138
,
156
,
157
,
158
,
142
,
143
,
/* 240 */
144
,
145
,
96
,
3
,
148
,
149
,
167
,
151
,
152
,
96
,
/* 250 */
128
,
138
,
156
,
157
,
158
,
142
,
143
,
144
,
145
,
137
,
/* 260 */
138
,
148
,
149
,
167
,
151
,
152
,
12
,
13
,
180
,
156
,
/* 270 */
157
,
158
,
136
,
96
,
138
,
21
,
140
,
93
,
24
,
95
,
/* 280 */
167
,
45
,
12
,
13
,
14
,
4
,
24
,
51
,
34
,
0
,
/* 290 */
14
,
21
,
137
,
138
,
24
,
138
,
34
,
51
,
44
,
142
,
/* 300 */
143
,
144
,
145
,
49
,
34
,
148
,
149
,
150
,
151
,
12
,
/* 310 */
13
,
14
,
15
,
16
,
44
,
51
,
62
,
45
,
136
,
49
,
/* 320 */
138
,
32
,
140
,
51
,
62
,
49
,
37
,
1
,
2
,
75
,
/* 330 */
76
,
77
,
62
,
14
,
15
,
16
,
173
,
75
,
76
,
77
,
/* 340 */
147
,
52
,
45
,
94
,
95
,
75
,
76
,
77
,
125
,
166
,
/* 350 */
96
,
138
,
138
,
113
,
141
,
142
,
143
,
144
,
145
,
45
,
/* 360 */
71
,
148
,
149
,
117
,
151
,
51
,
169
,
144
,
12
,
13
,
/* 370 */
45
,
12
,
13
,
183
,
151
,
147
,
51
,
21
,
97
,
115
,
/* 380 */
24
,
168
,
49
,
24
,
161
,
162
,
163
,
105
,
165
,
179
,
/* 390 */
34
,
73
,
74
,
34
,
104
,
182
,
121
,
122
,
178
,
186
,
/* 400 */
44
,
77
,
143
,
44
,
143
,
49
,
138
,
178
,
49
,
45
,
/* 410 */
142
,
143
,
144
,
145
,
179
,
51
,
148
,
149
,
62
,
151
,
/* 420 */
152
,
62
,
45
,
45
,
156
,
157
,
143
,
2
,
51
,
51
,
/* 430 */
125
,
75
,
76
,
77
,
75
,
76
,
77
,
12
,
13
,
14
,
/* 440 */
15
,
16
,
45
,
112
,
175
,
111
,
141
,
138
,
51
,
144
,
/* 450 */
80
,
142
,
143
,
144
,
145
,
96
,
151
,
148
,
149
,
150
,
/* 460 */
151
,
174
,
12
,
13
,
14
,
99
,
161
,
162
,
163
,
45
,
/* 470 */
165
,
125
,
172
,
168
,
24
,
51
,
106
,
107
,
108
,
109
,
/* 480 */
110
,
12
,
13
,
45
,
34
,
98
,
45
,
182
,
171
,
51
,
/* 490 */
144
,
186
,
51
,
24
,
44
,
95
,
49
,
151
,
144
,
49
,
/* 500 */
49
,
146
,
159
,
34
,
91
,
44
,
160
,
161
,
162
,
163
,
/* 510 */
138
,
165
,
62
,
44
,
142
,
143
,
144
,
145
,
49
,
120
,
/* 520 */
148
,
149
,
155
,
151
,
152
,
75
,
76
,
77
,
2
,
157
,
/* 530 */
190
,
62
,
116
,
185
,
114
,
184
,
12
,
13
,
12
,
13
,
/* 540 */
14
,
15
,
16
,
49
,
75
,
76
,
77
,
125
,
24
,
138
,
/* 550 */
132
,
123
,
49
,
142
,
143
,
144
,
145
,
127
,
34
,
148
,
/* 560 */
149
,
124
,
151
,
127
,
44
,
134
,
127
,
127
,
44
,
141
,
/* 570 */
138
,
125
,
124
,
49
,
142
,
143
,
144
,
145
,
126
,
130
,
/* 580 */
148
,
149
,
150
,
151
,
130
,
51
,
62
,
51
,
45
,
100
,
/* 590 */
45
,
44
,
181
,
51
,
24
,
45
,
168
,
44
,
138
,
75
,
/* 600 */
76
,
77
,
142
,
143
,
144
,
145
,
0
,
44
,
148
,
149
,
/* 610 */
182
,
151
,
138
,
45
,
186
,
44
,
142
,
143
,
144
,
145
,
/* 620 */
51
,
45
,
148
,
149
,
50
,
151
,
138
,
44
,
51
,
100
,
/* 630 */
142
,
143
,
144
,
145
,
45
,
45
,
148
,
149
,
32
,
151
,
/* 640 */
2
,
50
,
50
,
37
,
93
,
51
,
50
,
80
,
188
,
138
,
/* 650 */
45
,
51
,
45
,
142
,
143
,
144
,
145
,
100
,
52
,
148
,
/* 660 */
149
,
24
,
151
,
138
,
4
,
24
,
24
,
142
,
143
,
144
,
/* 670 */
145
,
24
,
24
,
148
,
149
,
138
,
151
,
71
,
24
,
142
,
/* 680 */
143
,
144
,
145
,
50
,
44
,
148
,
149
,
138
,
151
,
0
,
/* 690 */
0
,
142
,
143
,
144
,
145
,
0
,
0
,
148
,
149
,
138
,
/* 700 */
151
,
49
,
44
,
142
,
143
,
144
,
145
,
34
,
45
,
148
,
/* 710 */
149
,
47
,
151
,
138
,
44
,
50
,
48
,
142
,
143
,
144
,
/* 720 */
145
,
24
,
24
,
148
,
149
,
138
,
151
,
44
,
24
,
142
,
/* 730 */
143
,
144
,
145
,
45
,
24
,
148
,
149
,
138
,
151
,
45
,
/* 740 */
24
,
142
,
143
,
144
,
145
,
44
,
44
,
148
,
149
,
44
,
/* 750 */
151
,
138
,
45
,
45
,
24
,
142
,
143
,
144
,
145
,
44
,
/* 760 */
34
,
148
,
149
,
64
,
151
,
138
,
52
,
64
,
44
,
142
,
/* 770 */
143
,
144
,
145
,
64
,
24
,
148
,
149
,
64
,
151
,
44
,
/* 780 */
24
,
34
,
125
,
22
,
21
,
34
,
24
,
138
,
24
,
24
,
/* 790 */
24
,
142
,
143
,
144
,
145
,
24
,
24
,
148
,
149
,
138
,
/* 800 */
151
,
144
,
24
,
142
,
143
,
144
,
145
,
24
,
151
,
148
,
/* 810 */
149
,
24
,
151
,
24
,
24
,
24
,
24
,
24
,
161
,
162
,
/* 820 */
163
,
24
,
165
,
24
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 830 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 840 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 850 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 860 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 870 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 880 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 890 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 900 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 910 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 920 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 930 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
191
,
/* 940 */
191
,
191
,
191
,
191
,
191
,
191
,
191
,
};
#define YY_SHIFT_COUNT (2
11
)
#define YY_SHIFT_COUNT (2
38
)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (79
0
)
#define YY_SHIFT_MAX (79
9
)
static
const
unsigned
short
int
yy_shift_ofst
[]
=
{
/* 0 */
97
,
241
,
246
,
303
,
303
,
303
,
303
,
296
,
303
,
303
,
/* 10 */
56
,
383
,
456
,
399
,
456
,
456
,
456
,
456
,
456
,
456
,
/* 20 */
456
,
456
,
456
,
456
,
456
,
456
,
456
,
456
,
456
,
456
,
/* 30 */
456
,
456
,
57
,
57
,
57
,
390
,
43
,
43
,
42
,
96
,
/* 40 */
0
,
13
,
13
,
390
,
150
,
150
,
150
,
96
,
54
,
755
,
/* 50 */
672
,
134
,
151
,
172
,
47
,
172
,
27
,
175
,
181
,
142
,
/* 60 */
163
,
189
,
226
,
226
,
163
,
189
,
226
,
220
,
222
,
239
,
/* 70 */
242
,
254
,
297
,
300
,
264
,
314
,
248
,
259
,
260
,
96
,
/* 80 */
331
,
335
,
367
,
331
,
367
,
871
,
871
,
30
,
749
,
790
,
/* 90 */
783
,
483
,
483
,
483
,
483
,
483
,
483
,
483
,
123
,
129
,
/* 100 */
85
,
34
,
34
,
34
,
34
,
159
,
173
,
209
,
224
,
231
,
/* 110 */
160
,
177
,
155
,
228
,
235
,
253
,
238
,
258
,
108
,
368
,
/* 120 */
370
,
323
,
375
,
376
,
381
,
382
,
391
,
393
,
400
,
401
,
/* 130 */
404
,
402
,
426
,
405
,
410
,
407
,
411
,
356
,
415
,
419
,
/* 140 */
420
,
377
,
417
,
427
,
429
,
471
,
408
,
438
,
442
,
443
,
/* 150 */
396
,
489
,
453
,
477
,
479
,
480
,
481
,
482
,
461
,
465
,
/* 160 */
478
,
516
,
521
,
522
,
523
,
485
,
488
,
493
,
500
,
502
,
/* 170 */
495
,
497
,
508
,
503
,
499
,
530
,
506
,
519
,
536
,
509
,
/* 180 */
531
,
537
,
524
,
464
,
518
,
526
,
527
,
512
,
534
,
543
,
/* 190 */
556
,
561
,
547
,
572
,
574
,
577
,
578
,
581
,
584
,
588
,
/* 200 */
592
,
595
,
564
,
598
,
599
,
602
,
606
,
609
,
612
,
613
,
/* 210 */
620
,
623
,
/* 0 */
146
,
254
,
270
,
356
,
356
,
356
,
356
,
359
,
356
,
356
,
/* 10 */
153
,
469
,
524
,
450
,
524
,
524
,
524
,
524
,
524
,
524
,
/* 20 */
524
,
524
,
524
,
524
,
524
,
524
,
524
,
524
,
524
,
524
,
/* 30 */
524
,
524
,
162
,
162
,
162
,
262
,
262
,
15
,
15
,
177
,
/* 40 */
77
,
77
,
77
,
77
,
77
,
11
,
0
,
13
,
13
,
262
,
/* 50 */
85
,
85
,
85
,
154
,
77
,
77
,
181
,
54
,
60
,
370
,
/* 60 */
3
,
118
,
184
,
249
,
184
,
276
,
240
,
281
,
333
,
282
,
/* 70 */
290
,
324
,
324
,
282
,
290
,
324
,
331
,
334
,
366
,
387
,
/* 80 */
400
,
447
,
451
,
413
,
461
,
399
,
416
,
420
,
77
,
494
,
/* 90 */
181
,
503
,
11
,
503
,
520
,
503
,
503
,
494
,
11
,
824
,
/* 100 */
824
,
824
,
30
,
425
,
526
,
297
,
133
,
133
,
133
,
133
,
/* 110 */
133
,
133
,
133
,
289
,
606
,
48
,
63
,
319
,
319
,
319
,
/* 120 */
319
,
149
,
236
,
272
,
326
,
314
,
116
,
275
,
264
,
246
,
/* 130 */
325
,
4
,
318
,
364
,
377
,
378
,
397
,
424
,
438
,
441
,
/* 140 */
172
,
534
,
536
,
489
,
543
,
545
,
547
,
542
,
550
,
553
,
/* 150 */
563
,
568
,
571
,
576
,
570
,
569
,
574
,
583
,
577
,
529
,
/* 160 */
589
,
590
,
591
,
551
,
594
,
592
,
596
,
638
,
567
,
605
,
/* 170 */
607
,
600
,
557
,
660
,
637
,
641
,
642
,
647
,
648
,
654
,
/* 180 */
633
,
640
,
689
,
690
,
695
,
696
,
658
,
664
,
652
,
665
,
/* 190 */
673
,
670
,
668
,
663
,
697
,
698
,
683
,
688
,
704
,
701
,
/* 200 */
694
,
710
,
702
,
707
,
716
,
705
,
708
,
730
,
715
,
699
,
/* 210 */
703
,
709
,
713
,
726
,
714
,
724
,
735
,
750
,
756
,
747
,
/* 220 */
761
,
763
,
762
,
764
,
765
,
766
,
771
,
772
,
778
,
751
,
/* 230 */
783
,
787
,
789
,
790
,
791
,
792
,
793
,
797
,
799
,
};
#define YY_REDUCE_COUNT (
86
)
#define YY_REDUCE_MIN (-16
8
)
#define YY_REDUCE_MAX (66
7
)
#define YY_REDUCE_COUNT (
101
)
#define YY_REDUCE_MIN (-16
3
)
#define YY_REDUCE_MAX (66
1
)
static
const
short
yy_reduce_ofst
[]
=
{
/* 0 */
71
,
-
5
,
16
,
46
,
68
,
89
,
110
,
164
,
-
94
,
252
,
/* 10 */
251
,
348
,
223
,
301
,
380
,
403
,
418
,
432
,
444
,
459
,
/* 20 */
473
,
487
,
501
,
515
,
529
,
541
,
553
,
567
,
579
,
591
,
/* 30 */
605
,
619
,
633
,
639
,
667
,
-
130
,
-
116
,
31
,
-
152
,
-
120
,
/* 40 */
-
134
,
-
134
,
-
134
,
-
99
,
-
115
,
-
111
,
-
81
,
18
,
-
125
,
-
168
,
/* 50 */
-
151
,
-
127
,
-
72
,
-
79
,
-
79
,
-
79
,
40
,
22
,
59
,
113
,
/* 60 */
103
,
114
,
165
,
179
,
143
,
158
,
195
,
167
,
169
,
180
,
/* 70 */
178
,
-
79
,
211
,
213
,
204
,
215
,
186
,
192
,
200
,
40
,
/* 80 */
257
,
271
,
284
,
285
,
289
,
290
,
288
,
/* 0 */
428
,
-
13
,
14
,
56
,
79
,
96
,
113
,
213
,
-
105
,
268
,
/* 10 */
305
,
372
,
38
,
157
,
309
,
411
,
432
,
460
,
474
,
488
,
/* 20 */
511
,
525
,
537
,
549
,
561
,
575
,
587
,
599
,
613
,
627
,
/* 30 */
649
,
661
,
346
,
223
,
657
,
-
135
,
-
133
,
-
127
,
71
,
-
163
,
/* 40 */
-
96
,
136
,
23
,
182
,
122
,
9
,
-
150
,
-
150
,
-
150
,
-
107
,
/* 50 */
-
140
,
29
,
39
,
-
6
,
155
,
-
120
,
-
52
,
-
138
,
43
,
88
,
/* 60 */
163
,
193
,
183
,
183
,
183
,
214
,
190
,
197
,
228
,
210
,
/* 70 */
220
,
259
,
261
,
235
,
229
,
283
,
269
,
287
,
300
,
317
,
/* 80 */
183
,
354
,
355
,
343
,
367
,
340
,
348
,
351
,
214
,
422
,
/* 90 */
418
,
430
,
437
,
436
,
431
,
439
,
440
,
446
,
448
,
449
,
/* 100 */
454
,
452
,
};
static
const
YYACTIONTYPE
yy_default
[]
=
{
/* 0 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 10 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 20 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 30 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 40 */
550
,
669
,
550
,
550
,
680
,
680
,
680
,
550
,
550
,
744
,
/* 50 */
550
,
704
,
696
,
672
,
686
,
673
,
550
,
729
,
689
,
550
,
/* 60 */
711
,
709
,
550
,
550
,
711
,
709
,
550
,
723
,
719
,
702
,
/* 70 */
700
,
686
,
550
,
550
,
550
,
550
,
747
,
735
,
731
,
550
,
/* 80 */
550
,
550
,
555
,
550
,
555
,
605
,
556
,
550
,
550
,
550
,
/* 90 */
550
,
722
,
721
,
646
,
645
,
644
,
640
,
641
,
550
,
550
,
/* 100 */
550
,
635
,
636
,
634
,
633
,
550
,
550
,
670
,
550
,
550
,
/* 110 */
550
,
732
,
736
,
550
,
623
,
550
,
550
,
550
,
550
,
693
,
/* 120 */
703
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 130 */
550
,
550
,
550
,
550
,
623
,
550
,
720
,
550
,
679
,
675
,
/* 140 */
550
,
550
,
671
,
622
,
550
,
665
,
550
,
550
,
550
,
730
,
/* 150 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 160 */
550
,
550
,
550
,
550
,
550
,
550
,
576
,
550
,
550
,
550
,
/* 170 */
602
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 180 */
550
,
550
,
550
,
587
,
585
,
584
,
583
,
550
,
580
,
550
,
/* 190 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 200 */
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
550
,
/* 210 */
550
,
550
,
/* 0 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 10 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 20 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 30 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 40 */
601
,
601
,
601
,
601
,
601
,
606
,
601
,
734
,
601
,
601
,
/* 50 */
745
,
745
,
745
,
606
,
601
,
601
,
663
,
601
,
809
,
601
,
/* 60 */
769
,
761
,
737
,
751
,
738
,
601
,
794
,
754
,
601
,
776
,
/* 70 */
774
,
601
,
601
,
776
,
774
,
601
,
788
,
784
,
767
,
765
,
/* 80 */
751
,
601
,
601
,
601
,
601
,
812
,
800
,
796
,
601
,
601
,
/* 90 */
601
,
601
,
606
,
601
,
632
,
601
,
601
,
601
,
606
,
666
,
/* 100 */
666
,
607
,
601
,
601
,
601
,
601
,
787
,
786
,
711
,
710
,
/* 110 */
709
,
705
,
706
,
601
,
601
,
601
,
601
,
700
,
701
,
699
,
/* 120 */
698
,
601
,
601
,
601
,
735
,
601
,
601
,
601
,
797
,
801
,
/* 130 */
601
,
688
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 140 */
601
,
758
,
768
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 150 */
601
,
601
,
601
,
601
,
601
,
601
,
688
,
601
,
785
,
601
,
/* 160 */
744
,
740
,
601
,
601
,
736
,
687
,
601
,
730
,
601
,
601
,
/* 170 */
601
,
795
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 180 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
634
,
/* 190 */
601
,
601
,
601
,
601
,
601
,
601
,
660
,
601
,
601
,
601
,
/* 200 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
645
,
/* 210 */
643
,
642
,
641
,
601
,
638
,
601
,
601
,
601
,
601
,
601
,
/* 220 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
/* 230 */
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
601
,
};
/********** End of lemon-generated parsing tables *****************************/
...
...
@@ -614,146 +608,157 @@ static const char *const yyTokenName[] = {
/* 37 */
"TTL"
,
/* 38 */
"WAL"
,
/* 39 */
"VGROUPS"
,
/* 40 */
"SINGLESTABLE"
,
/* 41 */
"STREAMMODE"
,
/* 40 */
"SINGLE
_
STABLE"
,
/* 41 */
"STREAM
_
MODE"
,
/* 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 */
"TABLES"
,
/* 71 */
"NK_FLOAT"
,
/* 72 */
"NK_BOOL"
,
/* 73 */
"NK_VARIABLE"
,
/* 74 */
"BETWEEN"
,
/* 75 */
"IS"
,
/* 76 */
"NULL"
,
/* 77 */
"NK_LT"
,
/* 78 */
"NK_GT"
,
/* 79 */
"NK_LE"
,
/* 80 */
"NK_GE"
,
/* 81 */
"NK_NE"
,
/* 82 */
"NK_EQ"
,
/* 83 */
"LIKE"
,
/* 84 */
"MATCH"
,
/* 85 */
"NMATCH"
,
/* 86 */
"IN"
,
/* 87 */
"FROM"
,
/* 88 */
"AS"
,
/* 89 */
"JOIN"
,
/* 90 */
"ON"
,
/* 91 */
"INNER"
,
/* 92 */
"SELECT"
,
/* 93 */
"DISTINCT"
,
/* 94 */
"WHERE"
,
/* 95 */
"PARTITION"
,
/* 96 */
"BY"
,
/* 97 */
"SESSION"
,
/* 98 */
"STATE_WINDOW"
,
/* 99 */
"INTERVAL"
,
/* 100 */
"SLIDING"
,
/* 101 */
"FILL"
,
/* 102 */
"VALUE"
,
/* 103 */
"NONE"
,
/* 104 */
"PREV"
,
/* 105 */
"LINEAR"
,
/* 106 */
"NEXT"
,
/* 107 */
"GROUP"
,
/* 108 */
"HAVING"
,
/* 109 */
"ORDER"
,
/* 110 */
"SLIMIT"
,
/* 111 */
"SOFFSET"
,
/* 112 */
"LIMIT"
,
/* 113 */
"OFFSET"
,
/* 114 */
"ASC"
,
/* 115 */
"DESC"
,
/* 116 */
"NULLS"
,
/* 117 */
"FIRST"
,
/* 118 */
"LAST"
,
/* 119 */
"cmd"
,
/* 120 */
"exists_opt"
,
/* 121 */
"db_name"
,
/* 122 */
"db_options"
,
/* 123 */
"full_table_name"
,
/* 124 */
"column_def_list"
,
/* 125 */
"table_options"
,
/* 126 */
"column_def"
,
/* 127 */
"column_name"
,
/* 128 */
"type_name"
,
/* 129 */
"query_expression"
,
/* 130 */
"literal"
,
/* 131 */
"duration_literal"
,
/* 132 */
"literal_list"
,
/* 133 */
"table_name"
,
/* 134 */
"function_name"
,
/* 135 */
"table_alias"
,
/* 136 */
"column_alias"
,
/* 137 */
"expression"
,
/* 138 */
"column_reference"
,
/* 139 */
"expression_list"
,
/* 140 */
"subquery"
,
/* 141 */
"predicate"
,
/* 142 */
"compare_op"
,
/* 143 */
"in_op"
,
/* 144 */
"in_predicate_value"
,
/* 145 */
"boolean_value_expression"
,
/* 146 */
"boolean_primary"
,
/* 147 */
"common_expression"
,
/* 148 */
"from_clause"
,
/* 149 */
"table_reference_list"
,
/* 150 */
"table_reference"
,
/* 151 */
"table_primary"
,
/* 152 */
"joined_table"
,
/* 153 */
"alias_opt"
,
/* 154 */
"parenthesized_joined_table"
,
/* 155 */
"join_type"
,
/* 156 */
"search_condition"
,
/* 157 */
"query_specification"
,
/* 158 */
"set_quantifier_opt"
,
/* 159 */
"select_list"
,
/* 160 */
"where_clause_opt"
,
/* 161 */
"partition_by_clause_opt"
,
/* 162 */
"twindow_clause_opt"
,
/* 163 */
"group_by_clause_opt"
,
/* 164 */
"having_clause_opt"
,
/* 165 */
"select_sublist"
,
/* 166 */
"select_item"
,
/* 167 */
"sliding_opt"
,
/* 168 */
"fill_opt"
,
/* 169 */
"fill_mode"
,
/* 170 */
"group_by_list"
,
/* 171 */
"query_expression_body"
,
/* 172 */
"order_by_clause_opt"
,
/* 173 */
"slimit_clause_opt"
,
/* 174 */
"limit_clause_opt"
,
/* 175 */
"query_primary"
,
/* 176 */
"sort_specification_list"
,
/* 177 */
"sort_specification"
,
/* 178 */
"ordering_specification_opt"
,
/* 179 */
"null_ordering_opt"
,
/* 46 */
"STABLE"
,
/* 47 */
"USING"
,
/* 48 */
"TAGS"
,
/* 49 */
"NK_ID"
,
/* 50 */
"NK_DOT"
,
/* 51 */
"NK_COMMA"
,
/* 52 */
"COMMENT"
,
/* 53 */
"BOOL"
,
/* 54 */
"TINYINT"
,
/* 55 */
"SMALLINT"
,
/* 56 */
"INT"
,
/* 57 */
"INTEGER"
,
/* 58 */
"BIGINT"
,
/* 59 */
"FLOAT"
,
/* 60 */
"DOUBLE"
,
/* 61 */
"BINARY"
,
/* 62 */
"TIMESTAMP"
,
/* 63 */
"NCHAR"
,
/* 64 */
"UNSIGNED"
,
/* 65 */
"JSON"
,
/* 66 */
"VARCHAR"
,
/* 67 */
"MEDIUMBLOB"
,
/* 68 */
"BLOB"
,
/* 69 */
"VARBINARY"
,
/* 70 */
"DECIMAL"
,
/* 71 */
"SMA"
,
/* 72 */
"SHOW"
,
/* 73 */
"DATABASES"
,
/* 74 */
"TABLES"
,
/* 75 */
"NK_FLOAT"
,
/* 76 */
"NK_BOOL"
,
/* 77 */
"NK_VARIABLE"
,
/* 78 */
"BETWEEN"
,
/* 79 */
"IS"
,
/* 80 */
"NULL"
,
/* 81 */
"NK_LT"
,
/* 82 */
"NK_GT"
,
/* 83 */
"NK_LE"
,
/* 84 */
"NK_GE"
,
/* 85 */
"NK_NE"
,
/* 86 */
"NK_EQ"
,
/* 87 */
"LIKE"
,
/* 88 */
"MATCH"
,
/* 89 */
"NMATCH"
,
/* 90 */
"IN"
,
/* 91 */
"FROM"
,
/* 92 */
"AS"
,
/* 93 */
"JOIN"
,
/* 94 */
"ON"
,
/* 95 */
"INNER"
,
/* 96 */
"SELECT"
,
/* 97 */
"DISTINCT"
,
/* 98 */
"WHERE"
,
/* 99 */
"PARTITION"
,
/* 100 */
"BY"
,
/* 101 */
"SESSION"
,
/* 102 */
"STATE_WINDOW"
,
/* 103 */
"INTERVAL"
,
/* 104 */
"SLIDING"
,
/* 105 */
"FILL"
,
/* 106 */
"VALUE"
,
/* 107 */
"NONE"
,
/* 108 */
"PREV"
,
/* 109 */
"LINEAR"
,
/* 110 */
"NEXT"
,
/* 111 */
"GROUP"
,
/* 112 */
"HAVING"
,
/* 113 */
"ORDER"
,
/* 114 */
"SLIMIT"
,
/* 115 */
"SOFFSET"
,
/* 116 */
"LIMIT"
,
/* 117 */
"OFFSET"
,
/* 118 */
"ASC"
,
/* 119 */
"DESC"
,
/* 120 */
"NULLS"
,
/* 121 */
"FIRST"
,
/* 122 */
"LAST"
,
/* 123 */
"cmd"
,
/* 124 */
"exists_opt"
,
/* 125 */
"db_name"
,
/* 126 */
"db_options"
,
/* 127 */
"full_table_name"
,
/* 128 */
"column_def_list"
,
/* 129 */
"tags_def_opt"
,
/* 130 */
"table_options"
,
/* 131 */
"multi_create_clause"
,
/* 132 */
"tags_def"
,
/* 133 */
"create_subtable_clause"
,
/* 134 */
"specific_tags_opt"
,
/* 135 */
"literal_list"
,
/* 136 */
"col_name_list"
,
/* 137 */
"column_def"
,
/* 138 */
"column_name"
,
/* 139 */
"type_name"
,
/* 140 */
"col_name"
,
/* 141 */
"query_expression"
,
/* 142 */
"literal"
,
/* 143 */
"duration_literal"
,
/* 144 */
"table_name"
,
/* 145 */
"function_name"
,
/* 146 */
"table_alias"
,
/* 147 */
"column_alias"
,
/* 148 */
"expression"
,
/* 149 */
"column_reference"
,
/* 150 */
"expression_list"
,
/* 151 */
"subquery"
,
/* 152 */
"predicate"
,
/* 153 */
"compare_op"
,
/* 154 */
"in_op"
,
/* 155 */
"in_predicate_value"
,
/* 156 */
"boolean_value_expression"
,
/* 157 */
"boolean_primary"
,
/* 158 */
"common_expression"
,
/* 159 */
"from_clause"
,
/* 160 */
"table_reference_list"
,
/* 161 */
"table_reference"
,
/* 162 */
"table_primary"
,
/* 163 */
"joined_table"
,
/* 164 */
"alias_opt"
,
/* 165 */
"parenthesized_joined_table"
,
/* 166 */
"join_type"
,
/* 167 */
"search_condition"
,
/* 168 */
"query_specification"
,
/* 169 */
"set_quantifier_opt"
,
/* 170 */
"select_list"
,
/* 171 */
"where_clause_opt"
,
/* 172 */
"partition_by_clause_opt"
,
/* 173 */
"twindow_clause_opt"
,
/* 174 */
"group_by_clause_opt"
,
/* 175 */
"having_clause_opt"
,
/* 176 */
"select_sublist"
,
/* 177 */
"select_item"
,
/* 178 */
"sliding_opt"
,
/* 179 */
"fill_opt"
,
/* 180 */
"fill_mode"
,
/* 181 */
"group_by_list"
,
/* 182 */
"query_expression_body"
,
/* 183 */
"order_by_clause_opt"
,
/* 184 */
"slimit_clause_opt"
,
/* 185 */
"limit_clause_opt"
,
/* 186 */
"query_primary"
,
/* 187 */
"sort_specification_list"
,
/* 188 */
"sort_specification"
,
/* 189 */
"ordering_specification_opt"
,
/* 190 */
"null_ordering_opt"
,
};
#endif
/* defined(YYCOVERAGE) || !defined(NDEBUG) */
...
...
@@ -780,184 +785,198 @@ static const char *const yyRuleName[] = {
/* 16 */
"db_options ::= db_options TTL NK_INTEGER"
,
/* 17 */
"db_options ::= db_options WAL NK_INTEGER"
,
/* 18 */
"db_options ::= db_options VGROUPS NK_INTEGER"
,
/* 19 */
"db_options ::= db_options SINGLESTABLE NK_INTEGER"
,
/* 20 */
"db_options ::= db_options STREAMMODE NK_INTEGER"
,
/* 19 */
"db_options ::= db_options SINGLE
_
STABLE NK_INTEGER"
,
/* 20 */
"db_options ::= db_options STREAM
_
MODE NK_INTEGER"
,
/* 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 ::= SHOW TABLES"
,
/* 58 */
"cmd ::= query_expression"
,
/* 59 */
"literal ::= NK_INTEGER"
,
/* 60 */
"literal ::= NK_FLOAT"
,
/* 61 */
"literal ::= NK_STRING"
,
/* 62 */
"literal ::= NK_BOOL"
,
/* 63 */
"literal ::= TIMESTAMP NK_STRING"
,
/* 64 */
"literal ::= duration_literal"
,
/* 65 */
"duration_literal ::= NK_VARIABLE"
,
/* 66 */
"literal_list ::= literal"
,
/* 67 */
"literal_list ::= literal_list NK_COMMA literal"
,
/* 68 */
"db_name ::= NK_ID"
,
/* 69 */
"table_name ::= NK_ID"
,
/* 70 */
"column_name ::= NK_ID"
,
/* 71 */
"function_name ::= NK_ID"
,
/* 72 */
"table_alias ::= NK_ID"
,
/* 73 */
"column_alias ::= NK_ID"
,
/* 74 */
"expression ::= literal"
,
/* 75 */
"expression ::= column_reference"
,
/* 76 */
"expression ::= function_name NK_LP expression_list NK_RP"
,
/* 77 */
"expression ::= function_name NK_LP NK_STAR NK_RP"
,
/* 78 */
"expression ::= subquery"
,
/* 79 */
"expression ::= NK_LP expression NK_RP"
,
/* 80 */
"expression ::= NK_PLUS expression"
,
/* 81 */
"expression ::= NK_MINUS expression"
,
/* 82 */
"expression ::= expression NK_PLUS expression"
,
/* 83 */
"expression ::= expression NK_MINUS expression"
,
/* 84 */
"expression ::= expression NK_STAR expression"
,
/* 85 */
"expression ::= expression NK_SLASH expression"
,
/* 86 */
"expression ::= expression NK_REM expression"
,
/* 87 */
"expression_list ::= expression"
,
/* 88 */
"expression_list ::= expression_list NK_COMMA expression"
,
/* 89 */
"column_reference ::= column_name"
,
/* 90 */
"column_reference ::= table_name NK_DOT column_name"
,
/* 91 */
"predicate ::= expression compare_op expression"
,
/* 92 */
"predicate ::= expression BETWEEN expression AND expression"
,
/* 93 */
"predicate ::= expression NOT BETWEEN expression AND expression"
,
/* 94 */
"predicate ::= expression IS NULL"
,
/* 95 */
"predicate ::= expression IS NOT NULL"
,
/* 96 */
"predicate ::= expression in_op in_predicate_value"
,
/* 97 */
"compare_op ::= NK_LT"
,
/* 98 */
"compare_op ::= NK_GT"
,
/* 99 */
"compare_op ::= NK_LE"
,
/* 100 */
"compare_op ::= NK_GE"
,
/* 101 */
"compare_op ::= NK_NE"
,
/* 102 */
"compare_op ::= NK_EQ"
,
/* 103 */
"compare_op ::= LIKE"
,
/* 104 */
"compare_op ::= NOT LIKE"
,
/* 105 */
"compare_op ::= MATCH"
,
/* 106 */
"compare_op ::= NMATCH"
,
/* 107 */
"in_op ::= IN"
,
/* 108 */
"in_op ::= NOT IN"
,
/* 109 */
"in_predicate_value ::= NK_LP expression_list NK_RP"
,
/* 110 */
"boolean_value_expression ::= boolean_primary"
,
/* 111 */
"boolean_value_expression ::= NOT boolean_primary"
,
/* 112 */
"boolean_value_expression ::= boolean_value_expression OR boolean_value_expression"
,
/* 113 */
"boolean_value_expression ::= boolean_value_expression AND boolean_value_expression"
,
/* 114 */
"boolean_primary ::= predicate"
,
/* 115 */
"boolean_primary ::= NK_LP boolean_value_expression NK_RP"
,
/* 116 */
"common_expression ::= expression"
,
/* 117 */
"common_expression ::= boolean_value_expression"
,
/* 118 */
"from_clause ::= FROM table_reference_list"
,
/* 119 */
"table_reference_list ::= table_reference"
,
/* 120 */
"table_reference_list ::= table_reference_list NK_COMMA table_reference"
,
/* 121 */
"table_reference ::= table_primary"
,
/* 122 */
"table_reference ::= joined_table"
,
/* 123 */
"table_primary ::= table_name alias_opt"
,
/* 124 */
"table_primary ::= db_name NK_DOT table_name alias_opt"
,
/* 125 */
"table_primary ::= subquery alias_opt"
,
/* 126 */
"table_primary ::= parenthesized_joined_table"
,
/* 127 */
"alias_opt ::="
,
/* 128 */
"alias_opt ::= table_alias"
,
/* 129 */
"alias_opt ::= AS table_alias"
,
/* 130 */
"parenthesized_joined_table ::= NK_LP joined_table NK_RP"
,
/* 131 */
"parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP"
,
/* 132 */
"joined_table ::= table_reference join_type JOIN table_reference ON search_condition"
,
/* 133 */
"join_type ::="
,
/* 134 */
"join_type ::= INNER"
,
/* 135 */
"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"
,
/* 136 */
"set_quantifier_opt ::="
,
/* 137 */
"set_quantifier_opt ::= DISTINCT"
,
/* 138 */
"set_quantifier_opt ::= ALL"
,
/* 139 */
"select_list ::= NK_STAR"
,
/* 140 */
"select_list ::= select_sublist"
,
/* 141 */
"select_sublist ::= select_item"
,
/* 142 */
"select_sublist ::= select_sublist NK_COMMA select_item"
,
/* 143 */
"select_item ::= common_expression"
,
/* 144 */
"select_item ::= common_expression column_alias"
,
/* 145 */
"select_item ::= common_expression AS column_alias"
,
/* 146 */
"select_item ::= table_name NK_DOT NK_STAR"
,
/* 147 */
"where_clause_opt ::="
,
/* 148 */
"where_clause_opt ::= WHERE search_condition"
,
/* 149 */
"partition_by_clause_opt ::="
,
/* 150 */
"partition_by_clause_opt ::= PARTITION BY expression_list"
,
/* 151 */
"twindow_clause_opt ::="
,
/* 152 */
"twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP"
,
/* 153 */
"twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP"
,
/* 154 */
"twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt"
,
/* 155 */
"twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt"
,
/* 156 */
"sliding_opt ::="
,
/* 157 */
"sliding_opt ::= SLIDING NK_LP duration_literal NK_RP"
,
/* 158 */
"fill_opt ::="
,
/* 159 */
"fill_opt ::= FILL NK_LP fill_mode NK_RP"
,
/* 160 */
"fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP"
,
/* 161 */
"fill_mode ::= NONE"
,
/* 162 */
"fill_mode ::= PREV"
,
/* 163 */
"fill_mode ::= NULL"
,
/* 164 */
"fill_mode ::= LINEAR"
,
/* 165 */
"fill_mode ::= NEXT"
,
/* 166 */
"group_by_clause_opt ::="
,
/* 167 */
"group_by_clause_opt ::= GROUP BY group_by_list"
,
/* 168 */
"group_by_list ::= expression"
,
/* 169 */
"group_by_list ::= group_by_list NK_COMMA expression"
,
/* 170 */
"having_clause_opt ::="
,
/* 171 */
"having_clause_opt ::= HAVING search_condition"
,
/* 172 */
"query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt"
,
/* 173 */
"query_expression_body ::= query_primary"
,
/* 174 */
"query_expression_body ::= query_expression_body UNION ALL query_expression_body"
,
/* 175 */
"query_primary ::= query_specification"
,
/* 176 */
"order_by_clause_opt ::="
,
/* 177 */
"order_by_clause_opt ::= ORDER BY sort_specification_list"
,
/* 178 */
"slimit_clause_opt ::="
,
/* 179 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER"
,
/* 180 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER"
,
/* 181 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 182 */
"limit_clause_opt ::="
,
/* 183 */
"limit_clause_opt ::= LIMIT NK_INTEGER"
,
/* 184 */
"limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER"
,
/* 185 */
"limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 186 */
"subquery ::= NK_LP query_expression NK_RP"
,
/* 187 */
"search_condition ::= common_expression"
,
/* 188 */
"sort_specification_list ::= sort_specification"
,
/* 189 */
"sort_specification_list ::= sort_specification_list NK_COMMA sort_specification"
,
/* 190 */
"sort_specification ::= expression ordering_specification_opt null_ordering_opt"
,
/* 191 */
"ordering_specification_opt ::="
,
/* 192 */
"ordering_specification_opt ::= ASC"
,
/* 193 */
"ordering_specification_opt ::= DESC"
,
/* 194 */
"null_ordering_opt ::="
,
/* 195 */
"null_ordering_opt ::= NULLS FIRST"
,
/* 196 */
"null_ordering_opt ::= NULLS LAST"
,
/* 22 */
"cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options"
,
/* 23 */
"cmd ::= CREATE TABLE multi_create_clause"
,
/* 24 */
"cmd ::= CREATE STABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options"
,
/* 25 */
"multi_create_clause ::= create_subtable_clause"
,
/* 26 */
"multi_create_clause ::= multi_create_clause create_subtable_clause"
,
/* 27 */
"create_subtable_clause ::= exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP"
,
/* 28 */
"specific_tags_opt ::="
,
/* 29 */
"specific_tags_opt ::= NK_LP col_name_list NK_RP"
,
/* 30 */
"full_table_name ::= NK_ID"
,
/* 31 */
"full_table_name ::= NK_ID NK_DOT NK_ID"
,
/* 32 */
"column_def_list ::= column_def"
,
/* 33 */
"column_def_list ::= column_def_list NK_COMMA column_def"
,
/* 34 */
"column_def ::= column_name type_name"
,
/* 35 */
"column_def ::= column_name type_name COMMENT NK_STRING"
,
/* 36 */
"type_name ::= BOOL"
,
/* 37 */
"type_name ::= TINYINT"
,
/* 38 */
"type_name ::= SMALLINT"
,
/* 39 */
"type_name ::= INT"
,
/* 40 */
"type_name ::= INTEGER"
,
/* 41 */
"type_name ::= BIGINT"
,
/* 42 */
"type_name ::= FLOAT"
,
/* 43 */
"type_name ::= DOUBLE"
,
/* 44 */
"type_name ::= BINARY NK_LP NK_INTEGER NK_RP"
,
/* 45 */
"type_name ::= TIMESTAMP"
,
/* 46 */
"type_name ::= NCHAR NK_LP NK_INTEGER NK_RP"
,
/* 47 */
"type_name ::= TINYINT UNSIGNED"
,
/* 48 */
"type_name ::= SMALLINT UNSIGNED"
,
/* 49 */
"type_name ::= INT UNSIGNED"
,
/* 50 */
"type_name ::= BIGINT UNSIGNED"
,
/* 51 */
"type_name ::= JSON"
,
/* 52 */
"type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP"
,
/* 53 */
"type_name ::= MEDIUMBLOB"
,
/* 54 */
"type_name ::= BLOB"
,
/* 55 */
"type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP"
,
/* 56 */
"type_name ::= DECIMAL"
,
/* 57 */
"type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP"
,
/* 58 */
"type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP"
,
/* 59 */
"tags_def_opt ::="
,
/* 60 */
"tags_def_opt ::= tags_def"
,
/* 61 */
"tags_def ::= TAGS NK_LP column_def_list NK_RP"
,
/* 62 */
"table_options ::="
,
/* 63 */
"table_options ::= table_options COMMENT NK_STRING"
,
/* 64 */
"table_options ::= table_options KEEP NK_INTEGER"
,
/* 65 */
"table_options ::= table_options TTL NK_INTEGER"
,
/* 66 */
"table_options ::= table_options SMA NK_LP col_name_list NK_RP"
,
/* 67 */
"col_name_list ::= col_name"
,
/* 68 */
"col_name_list ::= col_name_list NK_COMMA col_name"
,
/* 69 */
"col_name ::= column_name"
,
/* 70 */
"cmd ::= SHOW DATABASES"
,
/* 71 */
"cmd ::= SHOW TABLES"
,
/* 72 */
"cmd ::= query_expression"
,
/* 73 */
"literal ::= NK_INTEGER"
,
/* 74 */
"literal ::= NK_FLOAT"
,
/* 75 */
"literal ::= NK_STRING"
,
/* 76 */
"literal ::= NK_BOOL"
,
/* 77 */
"literal ::= TIMESTAMP NK_STRING"
,
/* 78 */
"literal ::= duration_literal"
,
/* 79 */
"duration_literal ::= NK_VARIABLE"
,
/* 80 */
"literal_list ::= literal"
,
/* 81 */
"literal_list ::= literal_list NK_COMMA literal"
,
/* 82 */
"db_name ::= NK_ID"
,
/* 83 */
"table_name ::= NK_ID"
,
/* 84 */
"column_name ::= NK_ID"
,
/* 85 */
"function_name ::= NK_ID"
,
/* 86 */
"table_alias ::= NK_ID"
,
/* 87 */
"column_alias ::= NK_ID"
,
/* 88 */
"expression ::= literal"
,
/* 89 */
"expression ::= column_reference"
,
/* 90 */
"expression ::= function_name NK_LP expression_list NK_RP"
,
/* 91 */
"expression ::= function_name NK_LP NK_STAR NK_RP"
,
/* 92 */
"expression ::= subquery"
,
/* 93 */
"expression ::= NK_LP expression NK_RP"
,
/* 94 */
"expression ::= NK_PLUS expression"
,
/* 95 */
"expression ::= NK_MINUS expression"
,
/* 96 */
"expression ::= expression NK_PLUS expression"
,
/* 97 */
"expression ::= expression NK_MINUS expression"
,
/* 98 */
"expression ::= expression NK_STAR expression"
,
/* 99 */
"expression ::= expression NK_SLASH expression"
,
/* 100 */
"expression ::= expression NK_REM expression"
,
/* 101 */
"expression_list ::= expression"
,
/* 102 */
"expression_list ::= expression_list NK_COMMA expression"
,
/* 103 */
"column_reference ::= column_name"
,
/* 104 */
"column_reference ::= table_name NK_DOT column_name"
,
/* 105 */
"predicate ::= expression compare_op expression"
,
/* 106 */
"predicate ::= expression BETWEEN expression AND expression"
,
/* 107 */
"predicate ::= expression NOT BETWEEN expression AND expression"
,
/* 108 */
"predicate ::= expression IS NULL"
,
/* 109 */
"predicate ::= expression IS NOT NULL"
,
/* 110 */
"predicate ::= expression in_op in_predicate_value"
,
/* 111 */
"compare_op ::= NK_LT"
,
/* 112 */
"compare_op ::= NK_GT"
,
/* 113 */
"compare_op ::= NK_LE"
,
/* 114 */
"compare_op ::= NK_GE"
,
/* 115 */
"compare_op ::= NK_NE"
,
/* 116 */
"compare_op ::= NK_EQ"
,
/* 117 */
"compare_op ::= LIKE"
,
/* 118 */
"compare_op ::= NOT LIKE"
,
/* 119 */
"compare_op ::= MATCH"
,
/* 120 */
"compare_op ::= NMATCH"
,
/* 121 */
"in_op ::= IN"
,
/* 122 */
"in_op ::= NOT IN"
,
/* 123 */
"in_predicate_value ::= NK_LP expression_list NK_RP"
,
/* 124 */
"boolean_value_expression ::= boolean_primary"
,
/* 125 */
"boolean_value_expression ::= NOT boolean_primary"
,
/* 126 */
"boolean_value_expression ::= boolean_value_expression OR boolean_value_expression"
,
/* 127 */
"boolean_value_expression ::= boolean_value_expression AND boolean_value_expression"
,
/* 128 */
"boolean_primary ::= predicate"
,
/* 129 */
"boolean_primary ::= NK_LP boolean_value_expression NK_RP"
,
/* 130 */
"common_expression ::= expression"
,
/* 131 */
"common_expression ::= boolean_value_expression"
,
/* 132 */
"from_clause ::= FROM table_reference_list"
,
/* 133 */
"table_reference_list ::= table_reference"
,
/* 134 */
"table_reference_list ::= table_reference_list NK_COMMA table_reference"
,
/* 135 */
"table_reference ::= table_primary"
,
/* 136 */
"table_reference ::= joined_table"
,
/* 137 */
"table_primary ::= table_name alias_opt"
,
/* 138 */
"table_primary ::= db_name NK_DOT table_name alias_opt"
,
/* 139 */
"table_primary ::= subquery alias_opt"
,
/* 140 */
"table_primary ::= parenthesized_joined_table"
,
/* 141 */
"alias_opt ::="
,
/* 142 */
"alias_opt ::= table_alias"
,
/* 143 */
"alias_opt ::= AS table_alias"
,
/* 144 */
"parenthesized_joined_table ::= NK_LP joined_table NK_RP"
,
/* 145 */
"parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP"
,
/* 146 */
"joined_table ::= table_reference join_type JOIN table_reference ON search_condition"
,
/* 147 */
"join_type ::="
,
/* 148 */
"join_type ::= INNER"
,
/* 149 */
"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"
,
/* 150 */
"set_quantifier_opt ::="
,
/* 151 */
"set_quantifier_opt ::= DISTINCT"
,
/* 152 */
"set_quantifier_opt ::= ALL"
,
/* 153 */
"select_list ::= NK_STAR"
,
/* 154 */
"select_list ::= select_sublist"
,
/* 155 */
"select_sublist ::= select_item"
,
/* 156 */
"select_sublist ::= select_sublist NK_COMMA select_item"
,
/* 157 */
"select_item ::= common_expression"
,
/* 158 */
"select_item ::= common_expression column_alias"
,
/* 159 */
"select_item ::= common_expression AS column_alias"
,
/* 160 */
"select_item ::= table_name NK_DOT NK_STAR"
,
/* 161 */
"where_clause_opt ::="
,
/* 162 */
"where_clause_opt ::= WHERE search_condition"
,
/* 163 */
"partition_by_clause_opt ::="
,
/* 164 */
"partition_by_clause_opt ::= PARTITION BY expression_list"
,
/* 165 */
"twindow_clause_opt ::="
,
/* 166 */
"twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP"
,
/* 167 */
"twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP"
,
/* 168 */
"twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt"
,
/* 169 */
"twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt"
,
/* 170 */
"sliding_opt ::="
,
/* 171 */
"sliding_opt ::= SLIDING NK_LP duration_literal NK_RP"
,
/* 172 */
"fill_opt ::="
,
/* 173 */
"fill_opt ::= FILL NK_LP fill_mode NK_RP"
,
/* 174 */
"fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP"
,
/* 175 */
"fill_mode ::= NONE"
,
/* 176 */
"fill_mode ::= PREV"
,
/* 177 */
"fill_mode ::= NULL"
,
/* 178 */
"fill_mode ::= LINEAR"
,
/* 179 */
"fill_mode ::= NEXT"
,
/* 180 */
"group_by_clause_opt ::="
,
/* 181 */
"group_by_clause_opt ::= GROUP BY group_by_list"
,
/* 182 */
"group_by_list ::= expression"
,
/* 183 */
"group_by_list ::= group_by_list NK_COMMA expression"
,
/* 184 */
"having_clause_opt ::="
,
/* 185 */
"having_clause_opt ::= HAVING search_condition"
,
/* 186 */
"query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt"
,
/* 187 */
"query_expression_body ::= query_primary"
,
/* 188 */
"query_expression_body ::= query_expression_body UNION ALL query_expression_body"
,
/* 189 */
"query_primary ::= query_specification"
,
/* 190 */
"order_by_clause_opt ::="
,
/* 191 */
"order_by_clause_opt ::= ORDER BY sort_specification_list"
,
/* 192 */
"slimit_clause_opt ::="
,
/* 193 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER"
,
/* 194 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER"
,
/* 195 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 196 */
"limit_clause_opt ::="
,
/* 197 */
"limit_clause_opt ::= LIMIT NK_INTEGER"
,
/* 198 */
"limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER"
,
/* 199 */
"limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 200 */
"subquery ::= NK_LP query_expression NK_RP"
,
/* 201 */
"search_condition ::= common_expression"
,
/* 202 */
"sort_specification_list ::= sort_specification"
,
/* 203 */
"sort_specification_list ::= sort_specification_list NK_COMMA sort_specification"
,
/* 204 */
"sort_specification ::= expression ordering_specification_opt null_ordering_opt"
,
/* 205 */
"ordering_specification_opt ::="
,
/* 206 */
"ordering_specification_opt ::= ASC"
,
/* 207 */
"ordering_specification_opt ::= DESC"
,
/* 208 */
"null_ordering_opt ::="
,
/* 209 */
"null_ordering_opt ::= NULLS FIRST"
,
/* 210 */
"null_ordering_opt ::= NULLS LAST"
,
};
#endif
/* NDEBUG */
...
...
@@ -1084,121 +1103,124 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
case
119
:
/* cmd */
case
120
:
/* exists_opt */
case
126
:
/* column_def */
case
129
:
/* query_expression */
case
130
:
/* literal */
case
131
:
/* duration_literal */
case
137
:
/* expression */
case
138
:
/* column_reference */
case
140
:
/* subquery */
case
141
:
/* predicate */
case
144
:
/* in_predicate_value */
case
145
:
/* boolean_value_expression */
case
146
:
/* boolean_primary */
case
147
:
/* common_expression */
case
148
:
/* from_clause */
case
149
:
/* table_reference_list */
case
150
:
/* table_reference */
case
151
:
/* table_primary */
case
152
:
/* joined_table */
case
154
:
/* parenthesized_joined_table */
case
156
:
/* search_condition */
case
157
:
/* query_specification */
case
160
:
/* where_clause_opt */
case
162
:
/* twindow_clause_opt */
case
164
:
/* having_clause_opt */
case
166
:
/* select_item */
case
167
:
/* sliding_opt */
case
168
:
/* fill_opt */
case
171
:
/* query_expression_body */
case
173
:
/* slimit_clause_opt */
case
174
:
/* limit_clause_opt */
case
175
:
/* query_primary */
case
177
:
/* sort_specification */
{
PARSER_DESTRUCTOR_TRACE
;
nodesDestroyNode
((
yypminor
->
yy272
));
}
break
;
case
121
:
/* db_name */
case
127
:
/* column_name */
case
133
:
/* table_name */
case
134
:
/* function_name */
case
135
:
/* table_alias */
case
136
:
/* column_alias */
case
153
:
/* alias_opt */
case
123
:
/* cmd */
case
133
:
/* create_subtable_clause */
case
137
:
/* column_def */
case
140
:
/* col_name */
case
141
:
/* query_expression */
case
142
:
/* literal */
case
143
:
/* duration_literal */
case
148
:
/* expression */
case
149
:
/* column_reference */
case
151
:
/* subquery */
case
152
:
/* predicate */
case
155
:
/* in_predicate_value */
case
156
:
/* boolean_value_expression */
case
157
:
/* boolean_primary */
case
158
:
/* common_expression */
case
159
:
/* from_clause */
case
160
:
/* table_reference_list */
case
161
:
/* table_reference */
case
162
:
/* table_primary */
case
163
:
/* joined_table */
case
165
:
/* parenthesized_joined_table */
case
167
:
/* search_condition */
case
168
:
/* query_specification */
case
171
:
/* where_clause_opt */
case
173
:
/* twindow_clause_opt */
case
175
:
/* having_clause_opt */
case
177
:
/* select_item */
case
178
:
/* sliding_opt */
case
179
:
/* fill_opt */
case
182
:
/* query_expression_body */
case
184
:
/* slimit_clause_opt */
case
185
:
/* limit_clause_opt */
case
186
:
/* query_primary */
case
188
:
/* sort_specification */
{
PARSER_DESTRUCTOR_TRACE
;
nodesDestroyNode
((
yypminor
->
yy210
))
;
}
break
;
case
122
:
/* db_options */
case
124
:
/* exists_opt */
case
169
:
/* set_quantifier_opt */
{
tfree
((
yypminor
->
yy199
));
}
break
;
case
123
:
/* full_table_name */
case
125
:
/* db_name */
case
138
:
/* column_name */
case
144
:
/* table_name */
case
145
:
/* function_name */
case
146
:
/* table_alias */
case
147
:
/* column_alias */
case
164
:
/* alias_opt */
{
}
break
;
case
12
4
:
/* column_def_list
*/
case
12
6
:
/* db_options
*/
{
nodesDestroyList
((
yypminor
->
yy64
));
tfree
((
yypminor
->
yy211
));
}
break
;
case
12
5
:
/* table_options
*/
case
12
7
:
/* full_table_name
*/
{
tfree
((
yypminor
->
yy46
));
}
break
;
case
128
:
/* type_name */
case
128
:
/* column_def_list */
case
129
:
/* tags_def_opt */
case
131
:
/* multi_create_clause */
case
132
:
/* tags_def */
case
134
:
/* specific_tags_opt */
case
135
:
/* literal_list */
case
136
:
/* col_name_list */
case
150
:
/* expression_list */
case
170
:
/* select_list */
case
172
:
/* partition_by_clause_opt */
case
174
:
/* group_by_clause_opt */
case
176
:
/* select_sublist */
case
181
:
/* group_by_list */
case
183
:
/* order_by_clause_opt */
case
187
:
/* sort_specification_list */
{
nodesDestroyList
((
yypminor
->
yy182
));
}
break
;
case
132
:
/* literal_list */
case
139
:
/* expression_list */
case
159
:
/* select_list */
case
161
:
/* partition_by_clause_opt */
case
163
:
/* group_by_clause_opt */
case
165
:
/* select_sublist */
case
170
:
/* group_by_list */
case
172
:
/* order_by_clause_opt */
case
176
:
/* sort_specification_list */
case
130
:
/* table_options */
{
PARSER_DESTRUCTOR_TRACE
;
nodesDestroyList
((
yypminor
->
yy64
));
tfree
((
yypminor
->
yy286
));
}
break
;
case
142
:
/* compare_op */
case
143
:
/* in_op */
case
139
:
/* type_name */
{
PARSER_DESTRUCTOR_TRACE
;
}
break
;
case
155
:
/* join_type */
case
153
:
/* compare_op */
case
154
:
/* in_op */
{
PARSER_DESTRUCTOR_TRACE
;
}
break
;
case
1
58
:
/* set_quantifier_opt
*/
case
1
66
:
/* join_type
*/
{
PARSER_DESTRUCTOR_TRACE
;
}
break
;
case
1
69
:
/* fill_mode */
case
1
80
:
/* fill_mode */
{
PARSER_DESTRUCTOR_TRACE
;
}
break
;
case
1
78
:
/* ordering_specification_opt */
case
1
89
:
/* ordering_specification_opt */
{
PARSER_DESTRUCTOR_TRACE
;
}
break
;
case
1
79
:
/* null_ordering_opt */
case
1
90
:
/* null_ordering_opt */
{
PARSER_DESTRUCTOR_TRACE
;
}
break
;
/********* End destructor definitions *****************************************/
...
...
@@ -1495,203 +1517,217 @@ 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
[]
=
{
{
119
,
-
5
},
/* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */
{
120
,
-
3
},
/* (1) exists_opt ::= IF NOT EXISTS */
{
120
,
0
},
/* (2) exists_opt ::= */
{
122
,
0
},
/* (3) db_options ::= */
{
122
,
-
3
},
/* (4) db_options ::= db_options BLOCKS NK_INTEGER */
{
122
,
-
3
},
/* (5) db_options ::= db_options CACHE NK_INTEGER */
{
122
,
-
3
},
/* (6) db_options ::= db_options CACHELAST NK_INTEGER */
{
122
,
-
3
},
/* (7) db_options ::= db_options COMP NK_INTEGER */
{
122
,
-
3
},
/* (8) db_options ::= db_options DAYS NK_INTEGER */
{
122
,
-
3
},
/* (9) db_options ::= db_options FSYNC NK_INTEGER */
{
122
,
-
3
},
/* (10) db_options ::= db_options MAXROWS NK_INTEGER */
{
122
,
-
3
},
/* (11) db_options ::= db_options MINROWS NK_INTEGER */
{
122
,
-
3
},
/* (12) db_options ::= db_options KEEP NK_INTEGER */
{
122
,
-
3
},
/* (13) db_options ::= db_options PRECISION NK_STRING */
{
122
,
-
3
},
/* (14) db_options ::= db_options QUORUM NK_INTEGER */
{
122
,
-
3
},
/* (15) db_options ::= db_options REPLICA NK_INTEGER */
{
122
,
-
3
},
/* (16) db_options ::= db_options TTL NK_INTEGER */
{
122
,
-
3
},
/* (17) db_options ::= db_options WAL NK_INTEGER */
{
122
,
-
3
},
/* (18) db_options ::= db_options VGROUPS NK_INTEGER */
{
122
,
-
3
},
/* (19) db_options ::= db_options SINGLESTABLE NK_INTEGER */
{
122
,
-
3
},
/* (20) db_options ::= db_options STREAMMODE NK_INTEGER */
{
119
,
-
2
},
/* (21) cmd ::= USE db_name */
{
119
,
-
8
},
/* (22) cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP table_options */
{
123
,
-
1
},
/* (23) full_table_name ::= NK_ID */
{
123
,
-
3
},
/* (24) full_table_name ::= NK_ID NK_DOT NK_ID */
{
124
,
-
1
},
/* (25) column_def_list ::= column_def */
{
124
,
-
3
},
/* (26) column_def_list ::= column_def_list NK_COMMA column_def */
{
126
,
-
2
},
/* (27) column_def ::= column_name type_name */
{
126
,
-
4
},
/* (28) column_def ::= column_name type_name COMMENT NK_STRING */
{
128
,
-
1
},
/* (29) type_name ::= BOOL */
{
128
,
-
1
},
/* (30) type_name ::= TINYINT */
{
128
,
-
1
},
/* (31) type_name ::= SMALLINT */
{
128
,
-
1
},
/* (32) type_name ::= INT */
{
128
,
-
1
},
/* (33) type_name ::= INTEGER */
{
128
,
-
1
},
/* (34) type_name ::= BIGINT */
{
128
,
-
1
},
/* (35) type_name ::= FLOAT */
{
128
,
-
1
},
/* (36) type_name ::= DOUBLE */
{
128
,
-
4
},
/* (37) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
{
128
,
-
1
},
/* (38) type_name ::= TIMESTAMP */
{
128
,
-
4
},
/* (39) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
{
128
,
-
2
},
/* (40) type_name ::= TINYINT UNSIGNED */
{
128
,
-
2
},
/* (41) type_name ::= SMALLINT UNSIGNED */
{
128
,
-
2
},
/* (42) type_name ::= INT UNSIGNED */
{
128
,
-
2
},
/* (43) type_name ::= BIGINT UNSIGNED */
{
128
,
-
1
},
/* (44) type_name ::= JSON */
{
128
,
-
4
},
/* (45) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
{
128
,
-
1
},
/* (46) type_name ::= MEDIUMBLOB */
{
128
,
-
1
},
/* (47) type_name ::= BLOB */
{
128
,
-
4
},
/* (48) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
{
128
,
-
1
},
/* (49) type_name ::= DECIMAL */
{
128
,
-
4
},
/* (50) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
{
128
,
-
6
},
/* (51) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
{
125
,
0
},
/* (52) table_options ::= */
{
125
,
-
3
},
/* (53) table_options ::= table_options COMMENT NK_INTEGER */
{
125
,
-
3
},
/* (54) table_options ::= table_options KEEP NK_INTEGER */
{
125
,
-
3
},
/* (55) table_options ::= table_options TTL NK_INTEGER */
{
119
,
-
2
},
/* (56) cmd ::= SHOW DATABASES */
{
119
,
-
2
},
/* (57) cmd ::= SHOW TABLES */
{
119
,
-
1
},
/* (58) cmd ::= query_expression */
{
130
,
-
1
},
/* (59) literal ::= NK_INTEGER */
{
130
,
-
1
},
/* (60) literal ::= NK_FLOAT */
{
130
,
-
1
},
/* (61) literal ::= NK_STRING */
{
130
,
-
1
},
/* (62) literal ::= NK_BOOL */
{
130
,
-
2
},
/* (63) literal ::= TIMESTAMP NK_STRING */
{
130
,
-
1
},
/* (64) literal ::= duration_literal */
{
131
,
-
1
},
/* (65) duration_literal ::= NK_VARIABLE */
{
132
,
-
1
},
/* (66) literal_list ::= literal */
{
132
,
-
3
},
/* (67) literal_list ::= literal_list NK_COMMA literal */
{
121
,
-
1
},
/* (68) db_name ::= NK_ID */
{
133
,
-
1
},
/* (69) table_name ::= NK_ID */
{
127
,
-
1
},
/* (70) column_name ::= NK_ID */
{
134
,
-
1
},
/* (71) function_name ::= NK_ID */
{
135
,
-
1
},
/* (72) table_alias ::= NK_ID */
{
136
,
-
1
},
/* (73) column_alias ::= NK_ID */
{
137
,
-
1
},
/* (74) expression ::= literal */
{
137
,
-
1
},
/* (75) expression ::= column_reference */
{
137
,
-
4
},
/* (76) expression ::= function_name NK_LP expression_list NK_RP */
{
137
,
-
4
},
/* (77) expression ::= function_name NK_LP NK_STAR NK_RP */
{
137
,
-
1
},
/* (78) expression ::= subquery */
{
137
,
-
3
},
/* (79) expression ::= NK_LP expression NK_RP */
{
137
,
-
2
},
/* (80) expression ::= NK_PLUS expression */
{
137
,
-
2
},
/* (81) expression ::= NK_MINUS expression */
{
137
,
-
3
},
/* (82) expression ::= expression NK_PLUS expression */
{
137
,
-
3
},
/* (83) expression ::= expression NK_MINUS expression */
{
137
,
-
3
},
/* (84) expression ::= expression NK_STAR expression */
{
137
,
-
3
},
/* (85) expression ::= expression NK_SLASH expression */
{
137
,
-
3
},
/* (86) expression ::= expression NK_REM expression */
{
139
,
-
1
},
/* (87) expression_list ::= expression */
{
139
,
-
3
},
/* (88) expression_list ::= expression_list NK_COMMA expression */
{
138
,
-
1
},
/* (89) column_reference ::= column_name */
{
138
,
-
3
},
/* (90) column_reference ::= table_name NK_DOT column_name */
{
141
,
-
3
},
/* (91) predicate ::= expression compare_op expression */
{
141
,
-
5
},
/* (92) predicate ::= expression BETWEEN expression AND expression */
{
141
,
-
6
},
/* (93) predicate ::= expression NOT BETWEEN expression AND expression */
{
141
,
-
3
},
/* (94) predicate ::= expression IS NULL */
{
141
,
-
4
},
/* (95) predicate ::= expression IS NOT NULL */
{
141
,
-
3
},
/* (96) predicate ::= expression in_op in_predicate_value */
{
142
,
-
1
},
/* (97) compare_op ::= NK_LT */
{
142
,
-
1
},
/* (98) compare_op ::= NK_GT */
{
142
,
-
1
},
/* (99) compare_op ::= NK_LE */
{
142
,
-
1
},
/* (100) compare_op ::= NK_GE */
{
142
,
-
1
},
/* (101) compare_op ::= NK_NE */
{
142
,
-
1
},
/* (102) compare_op ::= NK_EQ */
{
142
,
-
1
},
/* (103) compare_op ::= LIKE */
{
142
,
-
2
},
/* (104) compare_op ::= NOT LIKE */
{
142
,
-
1
},
/* (105) compare_op ::= MATCH */
{
142
,
-
1
},
/* (106) compare_op ::= NMATCH */
{
143
,
-
1
},
/* (107) in_op ::= IN */
{
143
,
-
2
},
/* (108) in_op ::= NOT IN */
{
144
,
-
3
},
/* (109) in_predicate_value ::= NK_LP expression_list NK_RP */
{
145
,
-
1
},
/* (110) boolean_value_expression ::= boolean_primary */
{
145
,
-
2
},
/* (111) boolean_value_expression ::= NOT boolean_primary */
{
145
,
-
3
},
/* (112) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
145
,
-
3
},
/* (113) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
146
,
-
1
},
/* (114) boolean_primary ::= predicate */
{
146
,
-
3
},
/* (115) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{
147
,
-
1
},
/* (116) common_expression ::= expression */
{
147
,
-
1
},
/* (117) common_expression ::= boolean_value_expression */
{
148
,
-
2
},
/* (118) from_clause ::= FROM table_reference_list */
{
149
,
-
1
},
/* (119) table_reference_list ::= table_reference */
{
149
,
-
3
},
/* (120) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{
150
,
-
1
},
/* (121) table_reference ::= table_primary */
{
150
,
-
1
},
/* (122) table_reference ::= joined_table */
{
151
,
-
2
},
/* (123) table_primary ::= table_name alias_opt */
{
151
,
-
4
},
/* (124) table_primary ::= db_name NK_DOT table_name alias_opt */
{
151
,
-
2
},
/* (125) table_primary ::= subquery alias_opt */
{
151
,
-
1
},
/* (126) table_primary ::= parenthesized_joined_table */
{
153
,
0
},
/* (127) alias_opt ::= */
{
153
,
-
1
},
/* (128) alias_opt ::= table_alias */
{
153
,
-
2
},
/* (129) alias_opt ::= AS table_alias */
{
154
,
-
3
},
/* (130) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{
154
,
-
3
},
/* (131) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{
152
,
-
6
},
/* (132) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{
155
,
0
},
/* (133) join_type ::= */
{
155
,
-
1
},
/* (134) join_type ::= INNER */
{
157
,
-
9
},
/* (135) 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 */
{
158
,
0
},
/* (136) set_quantifier_opt ::= */
{
158
,
-
1
},
/* (137) set_quantifier_opt ::= DISTINCT */
{
158
,
-
1
},
/* (138) set_quantifier_opt ::= ALL */
{
159
,
-
1
},
/* (139) select_list ::= NK_STAR */
{
159
,
-
1
},
/* (140) select_list ::= select_sublist */
{
165
,
-
1
},
/* (141) select_sublist ::= select_item */
{
165
,
-
3
},
/* (142) select_sublist ::= select_sublist NK_COMMA select_item */
{
166
,
-
1
},
/* (143) select_item ::= common_expression */
{
166
,
-
2
},
/* (144) select_item ::= common_expression column_alias */
{
166
,
-
3
},
/* (145) select_item ::= common_expression AS column_alias */
{
166
,
-
3
},
/* (146) select_item ::= table_name NK_DOT NK_STAR */
{
160
,
0
},
/* (147) where_clause_opt ::= */
{
160
,
-
2
},
/* (148) where_clause_opt ::= WHERE search_condition */
{
161
,
0
},
/* (149) partition_by_clause_opt ::= */
{
161
,
-
3
},
/* (150) partition_by_clause_opt ::= PARTITION BY expression_list */
{
162
,
0
},
/* (151) twindow_clause_opt ::= */
{
162
,
-
6
},
/* (152) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{
162
,
-
4
},
/* (153) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{
162
,
-
6
},
/* (154) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{
162
,
-
8
},
/* (155) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{
167
,
0
},
/* (156) sliding_opt ::= */
{
167
,
-
4
},
/* (157) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{
168
,
0
},
/* (158) fill_opt ::= */
{
168
,
-
4
},
/* (159) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{
168
,
-
6
},
/* (160) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{
169
,
-
1
},
/* (161) fill_mode ::= NONE */
{
169
,
-
1
},
/* (162) fill_mode ::= PREV */
{
169
,
-
1
},
/* (163) fill_mode ::= NULL */
{
169
,
-
1
},
/* (164) fill_mode ::= LINEAR */
{
169
,
-
1
},
/* (165) fill_mode ::= NEXT */
{
163
,
0
},
/* (166) group_by_clause_opt ::= */
{
163
,
-
3
},
/* (167) group_by_clause_opt ::= GROUP BY group_by_list */
{
170
,
-
1
},
/* (168) group_by_list ::= expression */
{
170
,
-
3
},
/* (169) group_by_list ::= group_by_list NK_COMMA expression */
{
164
,
0
},
/* (170) having_clause_opt ::= */
{
164
,
-
2
},
/* (171) having_clause_opt ::= HAVING search_condition */
{
129
,
-
4
},
/* (172) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
171
,
-
1
},
/* (173) query_expression_body ::= query_primary */
{
171
,
-
4
},
/* (174) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{
175
,
-
1
},
/* (175) query_primary ::= query_specification */
{
172
,
0
},
/* (176) order_by_clause_opt ::= */
{
172
,
-
3
},
/* (177) order_by_clause_opt ::= ORDER BY sort_specification_list */
{
173
,
0
},
/* (178) slimit_clause_opt ::= */
{
173
,
-
2
},
/* (179) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{
173
,
-
4
},
/* (180) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{
173
,
-
4
},
/* (181) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
174
,
0
},
/* (182) limit_clause_opt ::= */
{
174
,
-
2
},
/* (183) limit_clause_opt ::= LIMIT NK_INTEGER */
{
174
,
-
4
},
/* (184) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{
174
,
-
4
},
/* (185) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
140
,
-
3
},
/* (186) subquery ::= NK_LP query_expression NK_RP */
{
156
,
-
1
},
/* (187) search_condition ::= common_expression */
{
176
,
-
1
},
/* (188) sort_specification_list ::= sort_specification */
{
176
,
-
3
},
/* (189) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{
177
,
-
3
},
/* (190) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
178
,
0
},
/* (191) ordering_specification_opt ::= */
{
178
,
-
1
},
/* (192) ordering_specification_opt ::= ASC */
{
178
,
-
1
},
/* (193) ordering_specification_opt ::= DESC */
{
179
,
0
},
/* (194) null_ordering_opt ::= */
{
179
,
-
2
},
/* (195) null_ordering_opt ::= NULLS FIRST */
{
179
,
-
2
},
/* (196) null_ordering_opt ::= NULLS LAST */
{
123
,
-
5
},
/* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */
{
124
,
-
3
},
/* (1) exists_opt ::= IF NOT EXISTS */
{
124
,
0
},
/* (2) exists_opt ::= */
{
126
,
0
},
/* (3) db_options ::= */
{
126
,
-
3
},
/* (4) db_options ::= db_options BLOCKS NK_INTEGER */
{
126
,
-
3
},
/* (5) db_options ::= db_options CACHE NK_INTEGER */
{
126
,
-
3
},
/* (6) db_options ::= db_options CACHELAST NK_INTEGER */
{
126
,
-
3
},
/* (7) db_options ::= db_options COMP NK_INTEGER */
{
126
,
-
3
},
/* (8) db_options ::= db_options DAYS NK_INTEGER */
{
126
,
-
3
},
/* (9) db_options ::= db_options FSYNC NK_INTEGER */
{
126
,
-
3
},
/* (10) db_options ::= db_options MAXROWS NK_INTEGER */
{
126
,
-
3
},
/* (11) db_options ::= db_options MINROWS NK_INTEGER */
{
126
,
-
3
},
/* (12) db_options ::= db_options KEEP NK_INTEGER */
{
126
,
-
3
},
/* (13) db_options ::= db_options PRECISION NK_STRING */
{
126
,
-
3
},
/* (14) db_options ::= db_options QUORUM NK_INTEGER */
{
126
,
-
3
},
/* (15) db_options ::= db_options REPLICA NK_INTEGER */
{
126
,
-
3
},
/* (16) db_options ::= db_options TTL NK_INTEGER */
{
126
,
-
3
},
/* (17) db_options ::= db_options WAL NK_INTEGER */
{
126
,
-
3
},
/* (18) db_options ::= db_options VGROUPS NK_INTEGER */
{
126
,
-
3
},
/* (19) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
{
126
,
-
3
},
/* (20) db_options ::= db_options STREAM_MODE NK_INTEGER */
{
123
,
-
2
},
/* (21) cmd ::= USE db_name */
{
123
,
-
9
},
/* (22) cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
{
123
,
-
3
},
/* (23) cmd ::= CREATE TABLE multi_create_clause */
{
123
,
-
9
},
/* (24) cmd ::= CREATE STABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
{
131
,
-
1
},
/* (25) multi_create_clause ::= create_subtable_clause */
{
131
,
-
2
},
/* (26) multi_create_clause ::= multi_create_clause create_subtable_clause */
{
133
,
-
9
},
/* (27) create_subtable_clause ::= exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */
{
134
,
0
},
/* (28) specific_tags_opt ::= */
{
134
,
-
3
},
/* (29) specific_tags_opt ::= NK_LP col_name_list NK_RP */
{
127
,
-
1
},
/* (30) full_table_name ::= NK_ID */
{
127
,
-
3
},
/* (31) full_table_name ::= NK_ID NK_DOT NK_ID */
{
128
,
-
1
},
/* (32) column_def_list ::= column_def */
{
128
,
-
3
},
/* (33) column_def_list ::= column_def_list NK_COMMA column_def */
{
137
,
-
2
},
/* (34) column_def ::= column_name type_name */
{
137
,
-
4
},
/* (35) column_def ::= column_name type_name COMMENT NK_STRING */
{
139
,
-
1
},
/* (36) type_name ::= BOOL */
{
139
,
-
1
},
/* (37) type_name ::= TINYINT */
{
139
,
-
1
},
/* (38) type_name ::= SMALLINT */
{
139
,
-
1
},
/* (39) type_name ::= INT */
{
139
,
-
1
},
/* (40) type_name ::= INTEGER */
{
139
,
-
1
},
/* (41) type_name ::= BIGINT */
{
139
,
-
1
},
/* (42) type_name ::= FLOAT */
{
139
,
-
1
},
/* (43) type_name ::= DOUBLE */
{
139
,
-
4
},
/* (44) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
{
139
,
-
1
},
/* (45) type_name ::= TIMESTAMP */
{
139
,
-
4
},
/* (46) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
{
139
,
-
2
},
/* (47) type_name ::= TINYINT UNSIGNED */
{
139
,
-
2
},
/* (48) type_name ::= SMALLINT UNSIGNED */
{
139
,
-
2
},
/* (49) type_name ::= INT UNSIGNED */
{
139
,
-
2
},
/* (50) type_name ::= BIGINT UNSIGNED */
{
139
,
-
1
},
/* (51) type_name ::= JSON */
{
139
,
-
4
},
/* (52) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
{
139
,
-
1
},
/* (53) type_name ::= MEDIUMBLOB */
{
139
,
-
1
},
/* (54) type_name ::= BLOB */
{
139
,
-
4
},
/* (55) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
{
139
,
-
1
},
/* (56) type_name ::= DECIMAL */
{
139
,
-
4
},
/* (57) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
{
139
,
-
6
},
/* (58) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
{
129
,
0
},
/* (59) tags_def_opt ::= */
{
129
,
-
1
},
/* (60) tags_def_opt ::= tags_def */
{
132
,
-
4
},
/* (61) tags_def ::= TAGS NK_LP column_def_list NK_RP */
{
130
,
0
},
/* (62) table_options ::= */
{
130
,
-
3
},
/* (63) table_options ::= table_options COMMENT NK_STRING */
{
130
,
-
3
},
/* (64) table_options ::= table_options KEEP NK_INTEGER */
{
130
,
-
3
},
/* (65) table_options ::= table_options TTL NK_INTEGER */
{
130
,
-
5
},
/* (66) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
{
136
,
-
1
},
/* (67) col_name_list ::= col_name */
{
136
,
-
3
},
/* (68) col_name_list ::= col_name_list NK_COMMA col_name */
{
140
,
-
1
},
/* (69) col_name ::= column_name */
{
123
,
-
2
},
/* (70) cmd ::= SHOW DATABASES */
{
123
,
-
2
},
/* (71) cmd ::= SHOW TABLES */
{
123
,
-
1
},
/* (72) cmd ::= query_expression */
{
142
,
-
1
},
/* (73) literal ::= NK_INTEGER */
{
142
,
-
1
},
/* (74) literal ::= NK_FLOAT */
{
142
,
-
1
},
/* (75) literal ::= NK_STRING */
{
142
,
-
1
},
/* (76) literal ::= NK_BOOL */
{
142
,
-
2
},
/* (77) literal ::= TIMESTAMP NK_STRING */
{
142
,
-
1
},
/* (78) literal ::= duration_literal */
{
143
,
-
1
},
/* (79) duration_literal ::= NK_VARIABLE */
{
135
,
-
1
},
/* (80) literal_list ::= literal */
{
135
,
-
3
},
/* (81) literal_list ::= literal_list NK_COMMA literal */
{
125
,
-
1
},
/* (82) db_name ::= NK_ID */
{
144
,
-
1
},
/* (83) table_name ::= NK_ID */
{
138
,
-
1
},
/* (84) column_name ::= NK_ID */
{
145
,
-
1
},
/* (85) function_name ::= NK_ID */
{
146
,
-
1
},
/* (86) table_alias ::= NK_ID */
{
147
,
-
1
},
/* (87) column_alias ::= NK_ID */
{
148
,
-
1
},
/* (88) expression ::= literal */
{
148
,
-
1
},
/* (89) expression ::= column_reference */
{
148
,
-
4
},
/* (90) expression ::= function_name NK_LP expression_list NK_RP */
{
148
,
-
4
},
/* (91) expression ::= function_name NK_LP NK_STAR NK_RP */
{
148
,
-
1
},
/* (92) expression ::= subquery */
{
148
,
-
3
},
/* (93) expression ::= NK_LP expression NK_RP */
{
148
,
-
2
},
/* (94) expression ::= NK_PLUS expression */
{
148
,
-
2
},
/* (95) expression ::= NK_MINUS expression */
{
148
,
-
3
},
/* (96) expression ::= expression NK_PLUS expression */
{
148
,
-
3
},
/* (97) expression ::= expression NK_MINUS expression */
{
148
,
-
3
},
/* (98) expression ::= expression NK_STAR expression */
{
148
,
-
3
},
/* (99) expression ::= expression NK_SLASH expression */
{
148
,
-
3
},
/* (100) expression ::= expression NK_REM expression */
{
150
,
-
1
},
/* (101) expression_list ::= expression */
{
150
,
-
3
},
/* (102) expression_list ::= expression_list NK_COMMA expression */
{
149
,
-
1
},
/* (103) column_reference ::= column_name */
{
149
,
-
3
},
/* (104) column_reference ::= table_name NK_DOT column_name */
{
152
,
-
3
},
/* (105) predicate ::= expression compare_op expression */
{
152
,
-
5
},
/* (106) predicate ::= expression BETWEEN expression AND expression */
{
152
,
-
6
},
/* (107) predicate ::= expression NOT BETWEEN expression AND expression */
{
152
,
-
3
},
/* (108) predicate ::= expression IS NULL */
{
152
,
-
4
},
/* (109) predicate ::= expression IS NOT NULL */
{
152
,
-
3
},
/* (110) predicate ::= expression in_op in_predicate_value */
{
153
,
-
1
},
/* (111) compare_op ::= NK_LT */
{
153
,
-
1
},
/* (112) compare_op ::= NK_GT */
{
153
,
-
1
},
/* (113) compare_op ::= NK_LE */
{
153
,
-
1
},
/* (114) compare_op ::= NK_GE */
{
153
,
-
1
},
/* (115) compare_op ::= NK_NE */
{
153
,
-
1
},
/* (116) compare_op ::= NK_EQ */
{
153
,
-
1
},
/* (117) compare_op ::= LIKE */
{
153
,
-
2
},
/* (118) compare_op ::= NOT LIKE */
{
153
,
-
1
},
/* (119) compare_op ::= MATCH */
{
153
,
-
1
},
/* (120) compare_op ::= NMATCH */
{
154
,
-
1
},
/* (121) in_op ::= IN */
{
154
,
-
2
},
/* (122) in_op ::= NOT IN */
{
155
,
-
3
},
/* (123) in_predicate_value ::= NK_LP expression_list NK_RP */
{
156
,
-
1
},
/* (124) boolean_value_expression ::= boolean_primary */
{
156
,
-
2
},
/* (125) boolean_value_expression ::= NOT boolean_primary */
{
156
,
-
3
},
/* (126) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
156
,
-
3
},
/* (127) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
157
,
-
1
},
/* (128) boolean_primary ::= predicate */
{
157
,
-
3
},
/* (129) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{
158
,
-
1
},
/* (130) common_expression ::= expression */
{
158
,
-
1
},
/* (131) common_expression ::= boolean_value_expression */
{
159
,
-
2
},
/* (132) from_clause ::= FROM table_reference_list */
{
160
,
-
1
},
/* (133) table_reference_list ::= table_reference */
{
160
,
-
3
},
/* (134) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{
161
,
-
1
},
/* (135) table_reference ::= table_primary */
{
161
,
-
1
},
/* (136) table_reference ::= joined_table */
{
162
,
-
2
},
/* (137) table_primary ::= table_name alias_opt */
{
162
,
-
4
},
/* (138) table_primary ::= db_name NK_DOT table_name alias_opt */
{
162
,
-
2
},
/* (139) table_primary ::= subquery alias_opt */
{
162
,
-
1
},
/* (140) table_primary ::= parenthesized_joined_table */
{
164
,
0
},
/* (141) alias_opt ::= */
{
164
,
-
1
},
/* (142) alias_opt ::= table_alias */
{
164
,
-
2
},
/* (143) alias_opt ::= AS table_alias */
{
165
,
-
3
},
/* (144) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{
165
,
-
3
},
/* (145) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{
163
,
-
6
},
/* (146) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{
166
,
0
},
/* (147) join_type ::= */
{
166
,
-
1
},
/* (148) join_type ::= INNER */
{
168
,
-
9
},
/* (149) 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 */
{
169
,
0
},
/* (150) set_quantifier_opt ::= */
{
169
,
-
1
},
/* (151) set_quantifier_opt ::= DISTINCT */
{
169
,
-
1
},
/* (152) set_quantifier_opt ::= ALL */
{
170
,
-
1
},
/* (153) select_list ::= NK_STAR */
{
170
,
-
1
},
/* (154) select_list ::= select_sublist */
{
176
,
-
1
},
/* (155) select_sublist ::= select_item */
{
176
,
-
3
},
/* (156) select_sublist ::= select_sublist NK_COMMA select_item */
{
177
,
-
1
},
/* (157) select_item ::= common_expression */
{
177
,
-
2
},
/* (158) select_item ::= common_expression column_alias */
{
177
,
-
3
},
/* (159) select_item ::= common_expression AS column_alias */
{
177
,
-
3
},
/* (160) select_item ::= table_name NK_DOT NK_STAR */
{
171
,
0
},
/* (161) where_clause_opt ::= */
{
171
,
-
2
},
/* (162) where_clause_opt ::= WHERE search_condition */
{
172
,
0
},
/* (163) partition_by_clause_opt ::= */
{
172
,
-
3
},
/* (164) partition_by_clause_opt ::= PARTITION BY expression_list */
{
173
,
0
},
/* (165) twindow_clause_opt ::= */
{
173
,
-
6
},
/* (166) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{
173
,
-
4
},
/* (167) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{
173
,
-
6
},
/* (168) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{
173
,
-
8
},
/* (169) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{
178
,
0
},
/* (170) sliding_opt ::= */
{
178
,
-
4
},
/* (171) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{
179
,
0
},
/* (172) fill_opt ::= */
{
179
,
-
4
},
/* (173) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{
179
,
-
6
},
/* (174) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{
180
,
-
1
},
/* (175) fill_mode ::= NONE */
{
180
,
-
1
},
/* (176) fill_mode ::= PREV */
{
180
,
-
1
},
/* (177) fill_mode ::= NULL */
{
180
,
-
1
},
/* (178) fill_mode ::= LINEAR */
{
180
,
-
1
},
/* (179) fill_mode ::= NEXT */
{
174
,
0
},
/* (180) group_by_clause_opt ::= */
{
174
,
-
3
},
/* (181) group_by_clause_opt ::= GROUP BY group_by_list */
{
181
,
-
1
},
/* (182) group_by_list ::= expression */
{
181
,
-
3
},
/* (183) group_by_list ::= group_by_list NK_COMMA expression */
{
175
,
0
},
/* (184) having_clause_opt ::= */
{
175
,
-
2
},
/* (185) having_clause_opt ::= HAVING search_condition */
{
141
,
-
4
},
/* (186) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
182
,
-
1
},
/* (187) query_expression_body ::= query_primary */
{
182
,
-
4
},
/* (188) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{
186
,
-
1
},
/* (189) query_primary ::= query_specification */
{
183
,
0
},
/* (190) order_by_clause_opt ::= */
{
183
,
-
3
},
/* (191) order_by_clause_opt ::= ORDER BY sort_specification_list */
{
184
,
0
},
/* (192) slimit_clause_opt ::= */
{
184
,
-
2
},
/* (193) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{
184
,
-
4
},
/* (194) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{
184
,
-
4
},
/* (195) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
185
,
0
},
/* (196) limit_clause_opt ::= */
{
185
,
-
2
},
/* (197) limit_clause_opt ::= LIMIT NK_INTEGER */
{
185
,
-
4
},
/* (198) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{
185
,
-
4
},
/* (199) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
151
,
-
3
},
/* (200) subquery ::= NK_LP query_expression NK_RP */
{
167
,
-
1
},
/* (201) search_condition ::= common_expression */
{
187
,
-
1
},
/* (202) sort_specification_list ::= sort_specification */
{
187
,
-
3
},
/* (203) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{
188
,
-
3
},
/* (204) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
189
,
0
},
/* (205) ordering_specification_opt ::= */
{
189
,
-
1
},
/* (206) ordering_specification_opt ::= ASC */
{
189
,
-
1
},
/* (207) ordering_specification_opt ::= DESC */
{
190
,
0
},
/* (208) null_ordering_opt ::= */
{
190
,
-
2
},
/* (209) null_ordering_opt ::= NULLS FIRST */
{
190
,
-
2
},
/* (210) null_ordering_opt ::= NULLS LAST */
};
static
void
yy_accept
(
yyParser
*
);
/* Forward Declaration */
...
...
@@ -1779,680 +1815,683 @@ static YYACTIONTYPE yy_reduce(
/********** Begin reduce actions **********************************************/
YYMINORTYPE
yylhsminor
;
case
0
:
/* cmd ::= CREATE DATABASE exists_opt db_name db_options */
{
pCxt
->
pRootNode
=
createCreateDatabaseStmt
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy1
37
,
&
yymsp
[
-
1
].
minor
.
yy209
,
yymsp
[
0
].
minor
.
yy199
);}
{
pCxt
->
pRootNode
=
createCreateDatabaseStmt
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy1
87
,
&
yymsp
[
-
1
].
minor
.
yy175
,
yymsp
[
0
].
minor
.
yy211
);}
break
;
case
1
:
/* exists_opt ::= IF NOT EXISTS */
{
yymsp
[
-
2
].
minor
.
yy1
3
7
=
true
;
}
{
yymsp
[
-
2
].
minor
.
yy1
8
7
=
true
;
}
break
;
case
2
:
/* exists_opt ::= */
{
yymsp
[
1
].
minor
.
yy137
=
false
;
}
case
150
:
/* set_quantifier_opt ::= */
yytestcase
(
yyruleno
==
150
);
{
yymsp
[
1
].
minor
.
yy187
=
false
;
}
break
;
case
3
:
/* db_options ::= */
{
yymsp
[
1
].
minor
.
yy
199
=
createDefaultDatabaseOptions
(
pCxt
);
}
{
yymsp
[
1
].
minor
.
yy
211
=
createDefaultDatabaseOptions
(
pCxt
);
}
break
;
case
4
:
/* db_options ::= db_options BLOCKS NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_BLOCKS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_BLOCKS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
5
:
/* db_options ::= db_options CACHE NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_CACHE
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_CACHE
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
6
:
/* db_options ::= db_options CACHELAST NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_CACHELAST
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_CACHELAST
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
7
:
/* db_options ::= db_options COMP NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_COMP
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_COMP
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
8
:
/* db_options ::= db_options DAYS NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_DAYS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_DAYS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
9
:
/* db_options ::= db_options FSYNC NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_FSYNC
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_FSYNC
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
10
:
/* db_options ::= db_options MAXROWS NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_MAXROWS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_MAXROWS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
11
:
/* db_options ::= db_options MINROWS NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_MINROWS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_MINROWS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
12
:
/* db_options ::= db_options KEEP NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_KEEP
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_KEEP
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
13
:
/* db_options ::= db_options PRECISION NK_STRING */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_PRECISION
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_PRECISION
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
14
:
/* db_options ::= db_options QUORUM NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_QUORUM
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_QUORUM
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
15
:
/* db_options ::= db_options REPLICA NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_REPLICA
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_REPLICA
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
16
:
/* db_options ::= db_options TTL NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_TTL
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_TTL
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
17
:
/* db_options ::= db_options WAL NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_WAL
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_WAL
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
18
:
/* db_options ::= db_options VGROUPS NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_VGROUPS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_VGROUPS
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
19
:
/* db_options ::= db_options SINGLESTABLE NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_SINGLESTABLE
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
case
19
:
/* db_options ::= db_options SINGLE
_
STABLE NK_INTEGER */
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_SINGLESTABLE
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
20
:
/* db_options ::= db_options STREAMMODE NK_INTEGER */
{
yylhsminor
.
yy
199
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy199
,
DB_OPTION_STREAMMODE
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
199
=
yylhsminor
.
yy199
;
case
20
:
/* db_options ::= db_options STREAM
_
MODE NK_INTEGER */
{
yylhsminor
.
yy
211
=
setDatabaseOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy211
,
DB_OPTION_STREAMMODE
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy
211
=
yylhsminor
.
yy211
;
break
;
case
21
:
/* cmd ::= USE db_name */
{
pCxt
->
pRootNode
=
createUseDatabaseStmt
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy
209
);}
{
pCxt
->
pRootNode
=
createUseDatabaseStmt
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy
175
);}
break
;
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
.
yy137
,
&
yymsp
[
-
4
].
minor
.
yy57
,
yymsp
[
-
2
].
minor
.
yy64
,
yymsp
[
0
].
minor
.
yy46
);}
case
22
:
/* cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case
24
:
/* cmd ::= CREATE STABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
yytestcase
(
yyruleno
==
24
);
{
pCxt
->
pRootNode
=
createCreateTableStmt
(
pCxt
,
yymsp
[
-
6
].
minor
.
yy187
,
&
yymsp
[
-
5
].
minor
.
yy341
,
yymsp
[
-
3
].
minor
.
yy182
,
yymsp
[
-
1
].
minor
.
yy182
,
yymsp
[
0
].
minor
.
yy286
);}
break
;
case
23
:
/* full_table_name ::= NK_ID */
{
STokenPair
t
=
{
.
first
=
nil_token
,
.
second
=
yymsp
[
0
].
minor
.
yy0
};
yylhsminor
.
yy57
=
t
;
}
yymsp
[
0
].
minor
.
yy57
=
yylhsminor
.
yy57
;
case
23
:
/* cmd ::= CREATE TABLE multi_create_clause */
{
pCxt
->
pRootNode
=
createCreateMultiTableStmt
(
pCxt
,
yymsp
[
0
].
minor
.
yy182
);}
break
;
case
24
:
/* full_table_name ::= NK_ID NK_DOT NK_ID */
{
STokenPair
t
=
{
.
first
=
yymsp
[
-
2
].
minor
.
yy0
,
.
second
=
yymsp
[
0
].
minor
.
yy0
};
yylhsminor
.
yy57
=
t
;
}
yymsp
[
-
2
].
minor
.
yy57
=
yylhsminor
.
yy57
;
case
25
:
/* multi_create_clause ::= create_subtable_clause */
case
32
:
/* column_def_list ::= column_def */
yytestcase
(
yyruleno
==
32
);
case
67
:
/* col_name_list ::= col_name */
yytestcase
(
yyruleno
==
67
);
case
155
:
/* select_sublist ::= select_item */
yytestcase
(
yyruleno
==
155
);
case
202
:
/* sort_specification_list ::= sort_specification */
yytestcase
(
yyruleno
==
202
);
{
yylhsminor
.
yy182
=
createNodeList
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
0
].
minor
.
yy182
=
yylhsminor
.
yy182
;
break
;
case
2
5
:
/* column_def_list ::= column_def
*/
{
yylhsminor
.
yy
64
=
createNodeList
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
}
yymsp
[
0
].
minor
.
yy64
=
yylhsminor
.
yy64
;
case
2
6
:
/* multi_create_clause ::= multi_create_clause create_subtable_clause
*/
{
yylhsminor
.
yy
182
=
addNodeToList
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy182
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
-
1
].
minor
.
yy182
=
yylhsminor
.
yy182
;
break
;
case
2
6
:
/* column_def_list ::= column_def_list NK_COMMA column_def
*/
{
yylhsminor
.
yy
64
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy64
,
yymsp
[
0
].
minor
.
yy27
2
);
}
yymsp
[
-
2
].
minor
.
yy64
=
yylhsminor
.
yy64
;
case
2
7
:
/* create_subtable_clause ::= exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP
*/
{
yylhsminor
.
yy
210
=
createCreateSubTableClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy187
,
&
yymsp
[
-
7
].
minor
.
yy341
,
&
yymsp
[
-
5
].
minor
.
yy341
,
yymsp
[
-
4
].
minor
.
yy182
,
yymsp
[
-
1
].
minor
.
yy18
2
);
}
yymsp
[
-
8
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
27
:
/* column_def ::= column_name type_name */
{
yylhsminor
.
yy272
=
createColumnDefNode
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy209
,
yymsp
[
0
].
minor
.
yy304
,
NULL
);
}
yymsp
[
-
1
].
minor
.
yy272
=
yylhsminor
.
yy272
;
case
28
:
/* specific_tags_opt ::= */
case
59
:
/* tags_def_opt ::= */
yytestcase
(
yyruleno
==
59
);
case
163
:
/* partition_by_clause_opt ::= */
yytestcase
(
yyruleno
==
163
);
case
180
:
/* group_by_clause_opt ::= */
yytestcase
(
yyruleno
==
180
);
case
190
:
/* order_by_clause_opt ::= */
yytestcase
(
yyruleno
==
190
);
{
yymsp
[
1
].
minor
.
yy182
=
NULL
;
}
break
;
case
28
:
/* column_def ::= column_name type_name COMMENT NK_STRING */
{
yylhsminor
.
yy272
=
createColumnDefNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy209
,
yymsp
[
-
2
].
minor
.
yy304
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
3
].
minor
.
yy272
=
yylhsminor
.
yy272
;
case
29
:
/* specific_tags_opt ::= NK_LP col_name_list NK_RP */
{
yymsp
[
-
2
].
minor
.
yy182
=
yymsp
[
-
1
].
minor
.
yy182
;
}
break
;
case
29
:
/* type_name ::= BOOL */
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_BOOL
);
}
case
30
:
/* full_table_name ::= NK_ID */
{
STokenPair
t
=
{
.
first
=
nil_token
,
.
second
=
yymsp
[
0
].
minor
.
yy0
};
yylhsminor
.
yy341
=
t
;
}
yymsp
[
0
].
minor
.
yy341
=
yylhsminor
.
yy341
;
break
;
case
30
:
/* type_name ::= TINYINT */
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_TINYINT
);
}
case
31
:
/* full_table_name ::= NK_ID NK_DOT NK_ID */
{
STokenPair
t
=
{
.
first
=
yymsp
[
-
2
].
minor
.
yy0
,
.
second
=
yymsp
[
0
].
minor
.
yy0
};
yylhsminor
.
yy341
=
t
;
}
yymsp
[
-
2
].
minor
.
yy341
=
yylhsminor
.
yy341
;
break
;
case
31
:
/* type_name ::= SMALLINT */
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_SMALLINT
);
}
case
33
:
/* column_def_list ::= column_def_list NK_COMMA column_def */
case
68
:
/* col_name_list ::= col_name_list NK_COMMA col_name */
yytestcase
(
yyruleno
==
68
);
case
156
:
/* select_sublist ::= select_sublist NK_COMMA select_item */
yytestcase
(
yyruleno
==
156
);
case
203
:
/* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
yytestcase
(
yyruleno
==
203
);
{
yylhsminor
.
yy182
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy182
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
-
2
].
minor
.
yy182
=
yylhsminor
.
yy182
;
break
;
case
3
2
:
/* type_name ::= INT
*/
case
33
:
/* type_name ::= INTEGER */
yytestcase
(
yyruleno
==
33
);
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_INT
);
}
case
3
4
:
/* column_def ::= column_name type_name
*/
{
yylhsminor
.
yy210
=
createColumnDefNode
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy175
,
yymsp
[
0
].
minor
.
yy42
,
NULL
);
}
yymsp
[
-
1
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
34
:
/* type_name ::= BIGINT */
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_BIGINT
);
}
case
35
:
/* column_def ::= column_name type_name COMMENT NK_STRING */
{
yylhsminor
.
yy210
=
createColumnDefNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy175
,
yymsp
[
-
2
].
minor
.
yy42
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
3
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
3
5
:
/* type_name ::= FLOAT
*/
{
yymsp
[
0
].
minor
.
yy
304
=
createDataType
(
TSDB_DATA_TYPE_FLOAT
);
}
case
3
6
:
/* type_name ::= BOOL
*/
{
yymsp
[
0
].
minor
.
yy
42
=
createDataType
(
TSDB_DATA_TYPE_BOOL
);
}
break
;
case
3
6
:
/* type_name ::= DOUBLE
*/
{
yymsp
[
0
].
minor
.
yy
304
=
createDataType
(
TSDB_DATA_TYPE_DOUBLE
);
}
case
3
7
:
/* type_name ::= TINYINT
*/
{
yymsp
[
0
].
minor
.
yy
42
=
createDataType
(
TSDB_DATA_TYPE_TINYINT
);
}
break
;
case
3
7
:
/* type_name ::= BINARY NK_LP NK_INTEGER NK_RP
*/
{
yymsp
[
-
3
].
minor
.
yy304
=
createVarLenDataType
(
TSDB_DATA_TYPE_BINARY
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
case
3
8
:
/* type_name ::= SMALLINT
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_SMALLINT
);
}
break
;
case
38
:
/* type_name ::= TIMESTAMP */
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_TIMESTAMP
);
}
case
39
:
/* type_name ::= INT */
case
40
:
/* type_name ::= INTEGER */
yytestcase
(
yyruleno
==
40
);
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_INT
);
}
break
;
case
39
:
/* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP
*/
{
yymsp
[
-
3
].
minor
.
yy304
=
createVarLenDataType
(
TSDB_DATA_TYPE_NCHAR
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
case
41
:
/* type_name ::= BIGINT
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_BIGINT
);
}
break
;
case
4
0
:
/* type_name ::= TINYINT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_UTINYIN
T
);
}
case
4
2
:
/* type_name ::= FLOAT
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_FLOA
T
);
}
break
;
case
4
1
:
/* type_name ::= SMALLINT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_USMALLINT
);
}
case
4
3
:
/* type_name ::= DOUBLE
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_DOUBLE
);
}
break
;
case
4
2
:
/* type_name ::= INT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_UINT
);
}
case
4
4
:
/* type_name ::= BINARY NK_LP NK_INTEGER NK_RP
*/
{
yymsp
[
-
3
].
minor
.
yy42
=
createVarLenDataType
(
TSDB_DATA_TYPE_BINARY
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
break
;
case
4
3
:
/* type_name ::= BIGINT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_UBIGINT
);
}
case
4
5
:
/* type_name ::= TIMESTAMP
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_TIMESTAMP
);
}
break
;
case
4
4
:
/* type_name ::= JSON
*/
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_JSON
);
}
case
4
6
:
/* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP
*/
{
yymsp
[
-
3
].
minor
.
yy42
=
createVarLenDataType
(
TSDB_DATA_TYPE_NCHAR
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
break
;
case
4
5
:
/* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP
*/
{
yymsp
[
-
3
].
minor
.
yy304
=
createVarLenDataType
(
TSDB_DATA_TYPE_VARCHAR
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
case
4
7
:
/* type_name ::= TINYINT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_UTINYINT
);
}
break
;
case
4
6
:
/* type_name ::= MEDIUMBLOB
*/
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_MEDIUMBLOB
);
}
case
4
8
:
/* type_name ::= SMALLINT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_USMALLINT
);
}
break
;
case
4
7
:
/* type_name ::= BLOB
*/
{
yymsp
[
0
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_BLOB
);
}
case
4
9
:
/* type_name ::= INT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_UINT
);
}
break
;
case
48
:
/* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP
*/
{
yymsp
[
-
3
].
minor
.
yy304
=
createVarLenDataType
(
TSDB_DATA_TYPE_VARBINARY
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
case
50
:
/* type_name ::= BIGINT UNSIGNED
*/
{
yymsp
[
-
1
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_UBIGINT
);
}
break
;
case
49
:
/* type_name ::= DECIMAL
*/
{
yymsp
[
0
].
minor
.
yy
304
=
createDataType
(
TSDB_DATA_TYPE_DECIMAL
);
}
case
51
:
/* type_name ::= JSON
*/
{
yymsp
[
0
].
minor
.
yy
42
=
createDataType
(
TSDB_DATA_TYPE_JSON
);
}
break
;
case
5
0
:
/* type_name ::= DECIMAL
NK_LP NK_INTEGER NK_RP */
{
yymsp
[
-
3
].
minor
.
yy
304
=
createDataType
(
TSDB_DATA_TYPE_DECIMAL
);
}
case
5
2
:
/* type_name ::= VARCHAR
NK_LP NK_INTEGER NK_RP */
{
yymsp
[
-
3
].
minor
.
yy
42
=
createVarLenDataType
(
TSDB_DATA_TYPE_VARCHAR
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
break
;
case
5
1
:
/* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP
*/
{
yymsp
[
-
5
].
minor
.
yy304
=
createDataType
(
TSDB_DATA_TYPE_DECIMAL
);
}
case
5
3
:
/* type_name ::= MEDIUMBLOB
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_MEDIUMBLOB
);
}
break
;
case
5
2
:
/* table_options ::=
*/
{
yymsp
[
1
].
minor
.
yy46
=
createDefaultTableOptions
(
pCxt
);
}
case
5
4
:
/* type_name ::= BLOB
*/
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_BLOB
);
}
break
;
case
53
:
/* table_options ::= table_options COMMENT NK_INTEGER */
{
yylhsminor
.
yy46
=
setTableOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy46
,
TABLE_OPTION_COMMENT
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy46
=
yylhsminor
.
yy46
;
case
55
:
/* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
{
yymsp
[
-
3
].
minor
.
yy42
=
createVarLenDataType
(
TSDB_DATA_TYPE_VARBINARY
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
break
;
case
54
:
/* table_options ::= table_options KEEP NK_INTEGER */
{
yylhsminor
.
yy46
=
setTableOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy46
,
TABLE_OPTION_KEEP
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy46
=
yylhsminor
.
yy46
;
case
56
:
/* type_name ::= DECIMAL */
{
yymsp
[
0
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_DECIMAL
);
}
break
;
case
55
:
/* table_options ::= table_options TTL NK_INTEGER */
{
yylhsminor
.
yy46
=
setTableOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy46
,
TABLE_OPTION_TTL
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy46
=
yylhsminor
.
yy46
;
case
57
:
/* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
{
yymsp
[
-
3
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_DECIMAL
);
}
break
;
case
56
:
/* cmd ::= SHOW DATABASES */
case
58
:
/* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
{
yymsp
[
-
5
].
minor
.
yy42
=
createDataType
(
TSDB_DATA_TYPE_DECIMAL
);
}
break
;
case
60
:
/* tags_def_opt ::= tags_def */
case
154
:
/* select_list ::= select_sublist */
yytestcase
(
yyruleno
==
154
);
{
yylhsminor
.
yy182
=
yymsp
[
0
].
minor
.
yy182
;
}
yymsp
[
0
].
minor
.
yy182
=
yylhsminor
.
yy182
;
break
;
case
61
:
/* tags_def ::= TAGS NK_LP column_def_list NK_RP */
{
yymsp
[
-
3
].
minor
.
yy182
=
yymsp
[
-
1
].
minor
.
yy182
;
}
break
;
case
62
:
/* table_options ::= */
{
yymsp
[
1
].
minor
.
yy286
=
createDefaultTableOptions
(
pCxt
);}
break
;
case
63
:
/* table_options ::= table_options COMMENT NK_STRING */
{
yylhsminor
.
yy286
=
setTableOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy286
,
TABLE_OPTION_COMMENT
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy286
=
yylhsminor
.
yy286
;
break
;
case
64
:
/* table_options ::= table_options KEEP NK_INTEGER */
{
yylhsminor
.
yy286
=
setTableOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy286
,
TABLE_OPTION_KEEP
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy286
=
yylhsminor
.
yy286
;
break
;
case
65
:
/* table_options ::= table_options TTL NK_INTEGER */
{
yylhsminor
.
yy286
=
setTableOption
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy286
,
TABLE_OPTION_TTL
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy286
=
yylhsminor
.
yy286
;
break
;
case
66
:
/* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
{
yylhsminor
.
yy286
=
setTableSmaOption
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy286
,
yymsp
[
-
1
].
minor
.
yy182
);
}
yymsp
[
-
4
].
minor
.
yy286
=
yylhsminor
.
yy286
;
break
;
case
69
:
/* col_name ::= column_name */
{
yylhsminor
.
yy210
=
createColumnNode
(
pCxt
,
NULL
,
&
yymsp
[
0
].
minor
.
yy175
);
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
70
:
/* cmd ::= SHOW DATABASES */
{
pCxt
->
pRootNode
=
createShowStmt
(
pCxt
,
QUERY_NODE_SHOW_DATABASES_STMT
);
}
break
;
case
57
:
/* cmd ::= SHOW TABLES */
case
71
:
/* cmd ::= SHOW TABLES */
{
pCxt
->
pRootNode
=
createShowStmt
(
pCxt
,
QUERY_NODE_SHOW_TABLES_STMT
);
}
break
;
case
58
:
/* cmd ::= query_expression */
{
PARSER_TRACE
;
pCxt
->
pRootNode
=
yymsp
[
0
].
minor
.
yy272
;
}
break
;
case
59
:
/* literal ::= NK_INTEGER */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_BIGINT
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
60
:
/* literal ::= NK_FLOAT */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_DOUBLE
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
61
:
/* literal ::= NK_STRING */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_BINARY
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
62
:
/* literal ::= NK_BOOL */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_BOOL
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
63
:
/* literal ::= TIMESTAMP NK_STRING */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
-
1
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
64
:
/* literal ::= duration_literal */
case
74
:
/* expression ::= literal */
yytestcase
(
yyruleno
==
74
);
case
75
:
/* expression ::= column_reference */
yytestcase
(
yyruleno
==
75
);
case
78
:
/* expression ::= subquery */
yytestcase
(
yyruleno
==
78
);
case
110
:
/* boolean_value_expression ::= boolean_primary */
yytestcase
(
yyruleno
==
110
);
case
114
:
/* boolean_primary ::= predicate */
yytestcase
(
yyruleno
==
114
);
case
119
:
/* table_reference_list ::= table_reference */
yytestcase
(
yyruleno
==
119
);
case
121
:
/* table_reference ::= table_primary */
yytestcase
(
yyruleno
==
121
);
case
122
:
/* table_reference ::= joined_table */
yytestcase
(
yyruleno
==
122
);
case
126
:
/* table_primary ::= parenthesized_joined_table */
yytestcase
(
yyruleno
==
126
);
case
173
:
/* query_expression_body ::= query_primary */
yytestcase
(
yyruleno
==
173
);
case
175
:
/* query_primary ::= query_specification */
yytestcase
(
yyruleno
==
175
);
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
yymsp
[
0
].
minor
.
yy272
;
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
65
:
/* duration_literal ::= NK_VARIABLE */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createDurationValueNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
66
:
/* literal_list ::= literal */
case
87
:
/* expression_list ::= expression */
yytestcase
(
yyruleno
==
87
);
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
createNodeList
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
));
}
yymsp
[
0
].
minor
.
yy64
=
yylhsminor
.
yy64
;
break
;
case
67
:
/* literal_list ::= literal_list NK_COMMA literal */
case
88
:
/* expression_list ::= expression_list NK_COMMA expression */
yytestcase
(
yyruleno
==
88
);
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy64
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
));
}
yymsp
[
-
2
].
minor
.
yy64
=
yylhsminor
.
yy64
;
break
;
case
68
:
/* db_name ::= NK_ID */
case
69
:
/* table_name ::= NK_ID */
yytestcase
(
yyruleno
==
69
);
case
70
:
/* column_name ::= NK_ID */
yytestcase
(
yyruleno
==
70
);
case
71
:
/* function_name ::= NK_ID */
yytestcase
(
yyruleno
==
71
);
case
72
:
/* table_alias ::= NK_ID */
yytestcase
(
yyruleno
==
72
);
case
73
:
/* column_alias ::= NK_ID */
yytestcase
(
yyruleno
==
73
);
{
PARSER_TRACE
;
yylhsminor
.
yy209
=
yymsp
[
0
].
minor
.
yy0
;
}
yymsp
[
0
].
minor
.
yy209
=
yylhsminor
.
yy209
;
break
;
case
76
:
/* expression ::= function_name NK_LP expression_list NK_RP */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy0
,
createFunctionNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy209
,
yymsp
[
-
1
].
minor
.
yy64
));
}
yymsp
[
-
3
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
77
:
/* expression ::= function_name NK_LP NK_STAR NK_RP */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy0
,
createFunctionNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy209
,
createNodeList
(
pCxt
,
createColumnNode
(
pCxt
,
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
))));
}
yymsp
[
-
3
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
79
:
/* expression ::= NK_LP expression NK_RP */
case
115
:
/* boolean_primary ::= NK_LP boolean_value_expression NK_RP */
yytestcase
(
yyruleno
==
115
);
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy272
));
}
yymsp
[
-
2
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
80
:
/* expression ::= NK_PLUS expression */
case
72
:
/* cmd ::= query_expression */
{
pCxt
->
pRootNode
=
yymsp
[
0
].
minor
.
yy210
;
}
break
;
case
73
:
/* literal ::= NK_INTEGER */
{
yylhsminor
.
yy210
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_BIGINT
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
74
:
/* literal ::= NK_FLOAT */
{
yylhsminor
.
yy210
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_DOUBLE
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
75
:
/* literal ::= NK_STRING */
{
yylhsminor
.
yy210
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_BINARY
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
76
:
/* literal ::= NK_BOOL */
{
yylhsminor
.
yy210
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_BOOL
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
77
:
/* literal ::= TIMESTAMP NK_STRING */
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
createValueNode
(
pCxt
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
-
1
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
78
:
/* literal ::= duration_literal */
case
88
:
/* expression ::= literal */
yytestcase
(
yyruleno
==
88
);
case
89
:
/* expression ::= column_reference */
yytestcase
(
yyruleno
==
89
);
case
92
:
/* expression ::= subquery */
yytestcase
(
yyruleno
==
92
);
case
124
:
/* boolean_value_expression ::= boolean_primary */
yytestcase
(
yyruleno
==
124
);
case
128
:
/* boolean_primary ::= predicate */
yytestcase
(
yyruleno
==
128
);
case
130
:
/* common_expression ::= expression */
yytestcase
(
yyruleno
==
130
);
case
131
:
/* common_expression ::= boolean_value_expression */
yytestcase
(
yyruleno
==
131
);
case
133
:
/* table_reference_list ::= table_reference */
yytestcase
(
yyruleno
==
133
);
case
135
:
/* table_reference ::= table_primary */
yytestcase
(
yyruleno
==
135
);
case
136
:
/* table_reference ::= joined_table */
yytestcase
(
yyruleno
==
136
);
case
140
:
/* table_primary ::= parenthesized_joined_table */
yytestcase
(
yyruleno
==
140
);
case
187
:
/* query_expression_body ::= query_primary */
yytestcase
(
yyruleno
==
187
);
case
189
:
/* query_primary ::= query_specification */
yytestcase
(
yyruleno
==
189
);
{
yylhsminor
.
yy210
=
yymsp
[
0
].
minor
.
yy210
;
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
79
:
/* duration_literal ::= NK_VARIABLE */
{
yylhsminor
.
yy210
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
createDurationValueNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
));
}
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
80
:
/* literal_list ::= literal */
case
101
:
/* expression_list ::= expression */
yytestcase
(
yyruleno
==
101
);
{
yylhsminor
.
yy182
=
createNodeList
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
));
}
yymsp
[
0
].
minor
.
yy182
=
yylhsminor
.
yy182
;
break
;
case
81
:
/* literal_list ::= literal_list NK_COMMA literal */
case
102
:
/* expression_list ::= expression_list NK_COMMA expression */
yytestcase
(
yyruleno
==
102
);
{
yylhsminor
.
yy182
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy182
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
));
}
yymsp
[
-
2
].
minor
.
yy182
=
yylhsminor
.
yy182
;
break
;
case
82
:
/* db_name ::= NK_ID */
case
83
:
/* table_name ::= NK_ID */
yytestcase
(
yyruleno
==
83
);
case
84
:
/* column_name ::= NK_ID */
yytestcase
(
yyruleno
==
84
);
case
85
:
/* function_name ::= NK_ID */
yytestcase
(
yyruleno
==
85
);
case
86
:
/* table_alias ::= NK_ID */
yytestcase
(
yyruleno
==
86
);
case
87
:
/* column_alias ::= NK_ID */
yytestcase
(
yyruleno
==
87
);
{
yylhsminor
.
yy175
=
yymsp
[
0
].
minor
.
yy0
;
}
yymsp
[
0
].
minor
.
yy175
=
yylhsminor
.
yy175
;
break
;
case
90
:
/* expression ::= function_name NK_LP expression_list NK_RP */
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy0
,
createFunctionNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy175
,
yymsp
[
-
1
].
minor
.
yy182
));
}
yymsp
[
-
3
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
91
:
/* expression ::= function_name NK_LP NK_STAR NK_RP */
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy0
,
createFunctionNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy175
,
createNodeList
(
pCxt
,
createColumnNode
(
pCxt
,
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
))));
}
yymsp
[
-
3
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
93
:
/* expression ::= NK_LP expression NK_RP */
case
129
:
/* boolean_primary ::= NK_LP boolean_value_expression NK_RP */
yytestcase
(
yyruleno
==
129
);
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy210
));
}
yymsp
[
-
2
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
94
:
/* expression ::= NK_PLUS expression */
{
PARSER_TRACE
;
SToken
t
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
t
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
));
SToken
t
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
t
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
));
}
yymsp
[
-
1
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
1
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
81
:
/* expression ::= NK_MINUS expression */
case
95
:
/* expression ::= NK_MINUS expression */
{
PARSER_TRACE
;
SToken
t
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
t
,
createOperatorNode
(
pCxt
,
OP_TYPE_SUB
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
),
NULL
));
SToken
t
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
t
,
createOperatorNode
(
pCxt
,
OP_TYPE_SUB
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
),
NULL
));
}
yymsp
[
-
1
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
1
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
82
:
/* expression ::= expression NK_PLUS expression */
case
96
:
/* expression ::= expression NK_PLUS expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_ADD
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_ADD
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
83
:
/* expression ::= expression NK_MINUS expression */
case
97
:
/* expression ::= expression NK_MINUS expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_SUB
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_SUB
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
84
:
/* expression ::= expression NK_STAR expression */
case
98
:
/* expression ::= expression NK_STAR expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_MULTI
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_MULTI
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
85
:
/* expression ::= expression NK_SLASH expression */
case
99
:
/* expression ::= expression NK_SLASH expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_DIV
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_DIV
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
86
:
/* expression ::= expression NK_REM expression */
case
100
:
/* expression ::= expression NK_REM expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_MOD
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_MOD
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
89
:
/* column_reference ::= column_name */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy209
,
createColumnNode
(
pCxt
,
NULL
,
&
yymsp
[
0
].
minor
.
yy209
));
}
yymsp
[
0
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
103
:
/* column_reference ::= column_name */
{
yylhsminor
.
yy210
=
createRawExprNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy175
,
createColumnNode
(
pCxt
,
NULL
,
&
yymsp
[
0
].
minor
.
yy175
));
}
yymsp
[
0
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
90
:
/* column_reference ::= table_name NK_DOT column_name */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy209
,
createColumnNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy209
));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
104
:
/* column_reference ::= table_name NK_DOT column_name */
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy175
,
createColumnNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy175
));
}
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
91
:
/* predicate ::= expression compare_op expression */
case
96
:
/* predicate ::= expression in_op in_predicate_value */
yytestcase
(
yyruleno
==
96
);
case
105
:
/* predicate ::= expression compare_op expression */
case
110
:
/* predicate ::= expression in_op in_predicate_value */
yytestcase
(
yyruleno
==
110
);
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy20
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy140
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
92
:
/* predicate ::= expression BETWEEN expression AND expression */
case
106
:
/* predicate ::= expression BETWEEN expression AND expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createBetweenAnd
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createBetweenAnd
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
4
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
4
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
93
:
/* predicate ::= expression NOT BETWEEN expression AND expression */
case
107
:
/* predicate ::= expression NOT BETWEEN expression AND expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createNotBetweenAnd
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createNotBetweenAnd
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
5
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
5
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
94
:
/* predicate ::= expression IS NULL */
case
108
:
/* predicate ::= expression IS NULL */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
yymsp
[
0
].
minor
.
yy0
,
createOperatorNode
(
pCxt
,
OP_TYPE_IS_NULL
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
NULL
));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
yymsp
[
0
].
minor
.
yy0
,
createOperatorNode
(
pCxt
,
OP_TYPE_IS_NULL
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
NULL
));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
95
:
/* predicate ::= expression IS NOT NULL */
case
109
:
/* predicate ::= expression IS NOT NULL */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
yymsp
[
0
].
minor
.
yy0
,
createOperatorNode
(
pCxt
,
OP_TYPE_IS_NOT_NULL
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy272
),
NULL
));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
yymsp
[
0
].
minor
.
yy0
,
createOperatorNode
(
pCxt
,
OP_TYPE_IS_NOT_NULL
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy210
),
NULL
));
}
yymsp
[
-
3
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
3
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
97
:
/* compare_op ::= NK_LT */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_LOWER_THAN
;
}
case
111
:
/* compare_op ::= NK_LT */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_LOWER_THAN
;
}
break
;
case
98
:
/* compare_op ::= NK_GT */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_GREATER_THAN
;
}
case
112
:
/* compare_op ::= NK_GT */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_GREATER_THAN
;
}
break
;
case
99
:
/* compare_op ::= NK_LE */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_LOWER_EQUAL
;
}
case
113
:
/* compare_op ::= NK_LE */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_LOWER_EQUAL
;
}
break
;
case
1
00
:
/* compare_op ::= NK_GE */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_GREATER_EQUAL
;
}
case
1
14
:
/* compare_op ::= NK_GE */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_GREATER_EQUAL
;
}
break
;
case
1
01
:
/* compare_op ::= NK_NE */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_NOT_EQUAL
;
}
case
1
15
:
/* compare_op ::= NK_NE */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_NOT_EQUAL
;
}
break
;
case
1
02
:
/* compare_op ::= NK_EQ */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_EQUAL
;
}
case
1
16
:
/* compare_op ::= NK_EQ */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_EQUAL
;
}
break
;
case
1
03
:
/* compare_op ::= LIKE */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_LIKE
;
}
case
1
17
:
/* compare_op ::= LIKE */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_LIKE
;
}
break
;
case
1
04
:
/* compare_op ::= NOT LIKE */
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy2
0
=
OP_TYPE_NOT_LIKE
;
}
case
1
18
:
/* compare_op ::= NOT LIKE */
{
yymsp
[
-
1
].
minor
.
yy14
0
=
OP_TYPE_NOT_LIKE
;
}
break
;
case
1
05
:
/* compare_op ::= MATCH */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_MATCH
;
}
case
1
19
:
/* compare_op ::= MATCH */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_MATCH
;
}
break
;
case
1
06
:
/* compare_op ::= NMATCH */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_NMATCH
;
}
case
1
20
:
/* compare_op ::= NMATCH */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_NMATCH
;
}
break
;
case
1
07
:
/* in_op ::= IN */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy2
0
=
OP_TYPE_IN
;
}
case
1
21
:
/* in_op ::= IN */
{
yymsp
[
0
].
minor
.
yy14
0
=
OP_TYPE_IN
;
}
break
;
case
1
08
:
/* in_op ::= NOT IN */
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy2
0
=
OP_TYPE_NOT_IN
;
}
case
1
22
:
/* in_op ::= NOT IN */
{
yymsp
[
-
1
].
minor
.
yy14
0
=
OP_TYPE_NOT_IN
;
}
break
;
case
1
09
:
/* in_predicate_value ::= NK_LP expression_list NK_RP */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
createNodeListNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy64
));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
23
:
/* in_predicate_value ::= NK_LP expression_list NK_RP */
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
createNodeListNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy182
));
}
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
11
:
/* boolean_value_expression ::= NOT boolean_primary */
case
1
25
:
/* boolean_value_expression ::= NOT boolean_primary */
{
PARSER_TRACE
;
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
e
,
createLogicConditionNode
(
pCxt
,
LOGIC_COND_TYPE_NOT
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
),
NULL
));
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
e
,
createLogicConditionNode
(
pCxt
,
LOGIC_COND_TYPE_NOT
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
),
NULL
));
}
yymsp
[
-
1
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
1
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
12
:
/* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
case
1
26
:
/* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createLogicConditionNode
(
pCxt
,
LOGIC_COND_TYPE_OR
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createLogicConditionNode
(
pCxt
,
LOGIC_COND_TYPE_OR
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
13
:
/* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
case
1
27
:
/* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
PARSER_TRACE
;
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createLogicConditionNode
(
pCxt
,
LOGIC_COND_TYPE_AND
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createLogicConditionNode
(
pCxt
,
LOGIC_COND_TYPE_AND
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
116
:
/* common_expression ::= expression */
case
117
:
/* common_expression ::= boolean_value_expression */
yytestcase
(
yyruleno
==
117
);
{
yylhsminor
.
yy272
=
yymsp
[
0
].
minor
.
yy272
;
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
yymsp
[
-
2
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
1
18
:
/* from_clause ::= FROM table_reference_list */
case
1
48
:
/* where_clause_opt ::= WHERE search_condition */
yytestcase
(
yyruleno
==
148
);
case
1
71
:
/* having_clause_opt ::= HAVING search_condition */
yytestcase
(
yyruleno
==
171
);
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy272
=
yymsp
[
0
].
minor
.
yy272
;
}
case
1
32
:
/* from_clause ::= FROM table_reference_list */
case
1
62
:
/* where_clause_opt ::= WHERE search_condition */
yytestcase
(
yyruleno
==
162
);
case
1
85
:
/* having_clause_opt ::= HAVING search_condition */
yytestcase
(
yyruleno
==
185
);
{
yymsp
[
-
1
].
minor
.
yy210
=
yymsp
[
0
].
minor
.
yy210
;
}
break
;
case
1
20
:
/* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createJoinTableNode
(
pCxt
,
JOIN_TYPE_INNER
,
yymsp
[
-
2
].
minor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
,
NULL
);
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
34
:
/* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{
yylhsminor
.
yy210
=
createJoinTableNode
(
pCxt
,
JOIN_TYPE_INNER
,
yymsp
[
-
2
].
minor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
,
NULL
);
}
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
23
:
/* table_primary ::= table_name alias_opt */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRealTableNode
(
pCxt
,
NULL
,
&
yymsp
[
-
1
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy209
);
}
yymsp
[
-
1
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
37
:
/* table_primary ::= table_name alias_opt */
{
yylhsminor
.
yy210
=
createRealTableNode
(
pCxt
,
NULL
,
&
yymsp
[
-
1
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy175
);
}
yymsp
[
-
1
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
24
:
/* table_primary ::= db_name NK_DOT table_name alias_opt */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRealTableNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy209
,
&
yymsp
[
-
1
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy209
);
}
yymsp
[
-
3
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
38
:
/* table_primary ::= db_name NK_DOT table_name alias_opt */
{
yylhsminor
.
yy210
=
createRealTableNode
(
pCxt
,
&
yymsp
[
-
3
].
minor
.
yy175
,
&
yymsp
[
-
1
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy175
);
}
yymsp
[
-
3
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
25
:
/* table_primary ::= subquery alias_opt */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createTempTableNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy272
),
&
yymsp
[
0
].
minor
.
yy209
);
}
yymsp
[
-
1
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
39
:
/* table_primary ::= subquery alias_opt */
{
yylhsminor
.
yy210
=
createTempTableNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy210
),
&
yymsp
[
0
].
minor
.
yy175
);
}
yymsp
[
-
1
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
27
:
/* alias_opt ::= */
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy209
=
nil_token
;
}
case
1
41
:
/* alias_opt ::= */
{
yymsp
[
1
].
minor
.
yy175
=
nil_token
;
}
break
;
case
1
28
:
/* alias_opt ::= table_alias */
{
PARSER_TRACE
;
yylhsminor
.
yy209
=
yymsp
[
0
].
minor
.
yy209
;
}
yymsp
[
0
].
minor
.
yy
209
=
yylhsminor
.
yy209
;
case
1
42
:
/* alias_opt ::= table_alias */
{
yylhsminor
.
yy175
=
yymsp
[
0
].
minor
.
yy175
;
}
yymsp
[
0
].
minor
.
yy
175
=
yylhsminor
.
yy175
;
break
;
case
1
29
:
/* alias_opt ::= AS table_alias */
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy209
=
yymsp
[
0
].
minor
.
yy209
;
}
case
1
43
:
/* alias_opt ::= AS table_alias */
{
yymsp
[
-
1
].
minor
.
yy175
=
yymsp
[
0
].
minor
.
yy175
;
}
break
;
case
1
30
:
/* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case
1
31
:
/* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
yytestcase
(
yyruleno
==
131
);
{
PARSER_TRACE
;
yymsp
[
-
2
].
minor
.
yy272
=
yymsp
[
-
1
].
minor
.
yy272
;
}
case
1
44
:
/* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case
1
45
:
/* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
yytestcase
(
yyruleno
==
145
);
{
yymsp
[
-
2
].
minor
.
yy210
=
yymsp
[
-
1
].
minor
.
yy210
;
}
break
;
case
1
32
:
/* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createJoinTableNode
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy252
,
yymsp
[
-
5
].
minor
.
yy272
,
yymsp
[
-
2
].
minor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
);
}
yymsp
[
-
5
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
46
:
/* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{
yylhsminor
.
yy210
=
createJoinTableNode
(
pCxt
,
yymsp
[
-
4
].
minor
.
yy28
,
yymsp
[
-
5
].
minor
.
yy210
,
yymsp
[
-
2
].
minor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
-
5
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
33
:
/* join_type ::= */
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy252
=
JOIN_TYPE_INNER
;
}
case
1
47
:
/* join_type ::= */
{
yymsp
[
1
].
minor
.
yy28
=
JOIN_TYPE_INNER
;
}
break
;
case
1
34
:
/* join_type ::= INNER */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy252
=
JOIN_TYPE_INNER
;
}
case
1
48
:
/* join_type ::= INNER */
{
yymsp
[
0
].
minor
.
yy28
=
JOIN_TYPE_INNER
;
}
break
;
case
1
35
:
/* 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
1
49
:
/* 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
.
yy272
=
createSelectStmt
(
pCxt
,
yymsp
[
-
7
].
minor
.
yy137
,
yymsp
[
-
6
].
minor
.
yy64
,
yymsp
[
-
5
].
minor
.
yy272
);
yymsp
[
-
8
].
minor
.
yy272
=
addWhereClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy272
,
yymsp
[
-
4
].
minor
.
yy272
);
yymsp
[
-
8
].
minor
.
yy272
=
addPartitionByClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy272
,
yymsp
[
-
3
].
minor
.
yy64
);
yymsp
[
-
8
].
minor
.
yy272
=
addWindowClauseClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy272
,
yymsp
[
-
2
].
minor
.
yy272
);
yymsp
[
-
8
].
minor
.
yy272
=
addGroupByClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy272
,
yymsp
[
-
1
].
minor
.
yy64
);
yymsp
[
-
8
].
minor
.
yy272
=
addHavingClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
);
yymsp
[
-
8
].
minor
.
yy210
=
createSelectStmt
(
pCxt
,
yymsp
[
-
7
].
minor
.
yy187
,
yymsp
[
-
6
].
minor
.
yy182
,
yymsp
[
-
5
].
minor
.
yy210
);
yymsp
[
-
8
].
minor
.
yy210
=
addWhereClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy210
,
yymsp
[
-
4
].
minor
.
yy210
);
yymsp
[
-
8
].
minor
.
yy210
=
addPartitionByClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy210
,
yymsp
[
-
3
].
minor
.
yy182
);
yymsp
[
-
8
].
minor
.
yy210
=
addWindowClauseClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy210
,
yymsp
[
-
2
].
minor
.
yy210
);
yymsp
[
-
8
].
minor
.
yy210
=
addGroupByClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy210
,
yymsp
[
-
1
].
minor
.
yy182
);
yymsp
[
-
8
].
minor
.
yy210
=
addHavingClause
(
pCxt
,
yymsp
[
-
8
].
minor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
);
}
break
;
case
136
:
/* set_quantifier_opt ::= */
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy137
=
false
;
}
break
;
case
137
:
/* set_quantifier_opt ::= DISTINCT */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy137
=
true
;
}
break
;
case
138
:
/* set_quantifier_opt ::= ALL */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy137
=
false
;
}
case
151
:
/* set_quantifier_opt ::= DISTINCT */
{
yymsp
[
0
].
minor
.
yy187
=
true
;
}
break
;
case
1
39
:
/* select_list ::= NK_STAR
*/
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy64
=
NULL
;
}
case
1
52
:
/* set_quantifier_opt ::= ALL
*/
{
yymsp
[
0
].
minor
.
yy187
=
false
;
}
break
;
case
140
:
/* select_list ::= select_sublist */
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
yymsp
[
0
].
minor
.
yy64
;
}
yymsp
[
0
].
minor
.
yy64
=
yylhsminor
.
yy64
;
case
153
:
/* select_list ::= NK_STAR */
{
yymsp
[
0
].
minor
.
yy182
=
NULL
;
}
break
;
case
141
:
/* select_sublist ::= select_item */
case
188
:
/* sort_specification_list ::= sort_specification */
yytestcase
(
yyruleno
==
188
);
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
createNodeList
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
}
yymsp
[
0
].
minor
.
yy64
=
yylhsminor
.
yy64
;
break
;
case
142
:
/* select_sublist ::= select_sublist NK_COMMA select_item */
case
189
:
/* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
yytestcase
(
yyruleno
==
189
);
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy64
,
yymsp
[
0
].
minor
.
yy272
);
}
yymsp
[
-
2
].
minor
.
yy64
=
yylhsminor
.
yy64
;
break
;
case
143
:
/* select_item ::= common_expression */
case
157
:
/* select_item ::= common_expression */
{
PARSER_TRACE
;
SToken
t
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy272
=
setProjectionAlias
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
),
&
t
);
SToken
t
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
yylhsminor
.
yy210
=
setProjectionAlias
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
),
&
t
);
}
yymsp
[
0
].
minor
.
yy272
=
yylhsminor
.
yy272
;
break
;
case
144
:
/* select_item ::= common_expression column_alias */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
setProjectionAlias
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy272
),
&
yymsp
[
0
].
minor
.
yy209
);
}
yymsp
[
-
1
].
minor
.
yy272
=
yylhsminor
.
yy272
;
yymsp
[
0
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
1
45
:
/* select_item ::= common_expression AS
column_alias */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
setProjectionAlias
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
&
yymsp
[
0
].
minor
.
yy209
);
}
yymsp
[
-
2
].
minor
.
yy272
=
yylhsminor
.
yy272
;
case
1
58
:
/* select_item ::= common_expression
column_alias */
{
yylhsminor
.
yy210
=
setProjectionAlias
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy210
),
&
yymsp
[
0
].
minor
.
yy175
);
}
yymsp
[
-
1
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
1
46
:
/* select_item ::= table_name NK_DOT NK_STAR
*/
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createColumnNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy209
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
59
:
/* select_item ::= common_expression AS column_alias
*/
{
yylhsminor
.
yy210
=
setProjectionAlias
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
&
yymsp
[
0
].
minor
.
yy175
);
}
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
147
:
/* where_clause_opt ::= */
case
151
:
/* twindow_clause_opt ::= */
yytestcase
(
yyruleno
==
151
);
case
156
:
/* sliding_opt ::= */
yytestcase
(
yyruleno
==
156
);
case
158
:
/* fill_opt ::= */
yytestcase
(
yyruleno
==
158
);
case
170
:
/* having_clause_opt ::= */
yytestcase
(
yyruleno
==
170
);
case
178
:
/* slimit_clause_opt ::= */
yytestcase
(
yyruleno
==
178
);
case
182
:
/* limit_clause_opt ::= */
yytestcase
(
yyruleno
==
182
);
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy272
=
NULL
;
}
case
160
:
/* select_item ::= table_name NK_DOT NK_STAR */
{
yylhsminor
.
yy210
=
createColumnNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy175
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
-
2
].
minor
.
yy210
=
yylhsminor
.
yy210
;
break
;
case
149
:
/* partition_by_clause_opt ::= */
case
166
:
/* group_by_clause_opt ::= */
yytestcase
(
yyruleno
==
166
);
case
176
:
/* order_by_clause_opt ::= */
yytestcase
(
yyruleno
==
176
);
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy64
=
NULL
;
}
case
161
:
/* where_clause_opt ::= */
case
165
:
/* twindow_clause_opt ::= */
yytestcase
(
yyruleno
==
165
);
case
170
:
/* sliding_opt ::= */
yytestcase
(
yyruleno
==
170
);
case
172
:
/* fill_opt ::= */
yytestcase
(
yyruleno
==
172
);
case
184
:
/* having_clause_opt ::= */
yytestcase
(
yyruleno
==
184
);
case
192
:
/* slimit_clause_opt ::= */
yytestcase
(
yyruleno
==
192
);
case
196
:
/* limit_clause_opt ::= */
yytestcase
(
yyruleno
==
196
);
{
yymsp
[
1
].
minor
.
yy210
=
NULL
;
}
break
;
case
1
50
:
/* partition_by_clause_opt ::= PARTITION BY expression_list */
case
1
67
:
/* group_by_clause_opt ::= GROUP BY group_by_list */
yytestcase
(
yyruleno
==
167
);
case
1
77
:
/* order_by_clause_opt ::= ORDER BY sort_specification_list */
yytestcase
(
yyruleno
==
177
);
{
PARSER_TRACE
;
yymsp
[
-
2
].
minor
.
yy64
=
yymsp
[
0
].
minor
.
yy64
;
}
case
1
64
:
/* partition_by_clause_opt ::= PARTITION BY expression_list */
case
1
81
:
/* group_by_clause_opt ::= GROUP BY group_by_list */
yytestcase
(
yyruleno
==
181
);
case
1
91
:
/* order_by_clause_opt ::= ORDER BY sort_specification_list */
yytestcase
(
yyruleno
==
191
);
{
yymsp
[
-
2
].
minor
.
yy182
=
yymsp
[
0
].
minor
.
yy182
;
}
break
;
case
1
52
:
/* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{
PARSER_TRACE
;
yymsp
[
-
5
].
minor
.
yy272
=
createSessionWindowNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy272
),
&
yymsp
[
-
1
].
minor
.
yy0
);
}
case
1
66
:
/* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{
yymsp
[
-
5
].
minor
.
yy210
=
createSessionWindowNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy210
),
&
yymsp
[
-
1
].
minor
.
yy0
);
}
break
;
case
1
53
:
/* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{
PARSER_TRACE
;
yymsp
[
-
3
].
minor
.
yy272
=
createStateWindowNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy272
));
}
case
1
67
:
/* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{
yymsp
[
-
3
].
minor
.
yy210
=
createStateWindowNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy210
));
}
break
;
case
1
54
:
/* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{
PARSER_TRACE
;
yymsp
[
-
5
].
minor
.
yy272
=
createIntervalWindowNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy272
,
NULL
,
yymsp
[
-
1
].
minor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
);
}
case
1
68
:
/* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{
yymsp
[
-
5
].
minor
.
yy210
=
createIntervalWindowNode
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy210
,
NULL
,
yymsp
[
-
1
].
minor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
);
}
break
;
case
1
55
:
/* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{
PARSER_TRACE
;
yymsp
[
-
7
].
minor
.
yy272
=
createIntervalWindowNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy272
,
yymsp
[
-
3
].
minor
.
yy272
,
yymsp
[
-
1
].
minor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
);
}
case
1
69
:
/* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{
yymsp
[
-
7
].
minor
.
yy210
=
createIntervalWindowNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy210
,
yymsp
[
-
3
].
minor
.
yy210
,
yymsp
[
-
1
].
minor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
);
}
break
;
case
1
57
:
/* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{
PARSER_TRACE
;
yymsp
[
-
3
].
minor
.
yy272
=
yymsp
[
-
1
].
minor
.
yy272
;
}
case
1
71
:
/* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{
yymsp
[
-
3
].
minor
.
yy210
=
yymsp
[
-
1
].
minor
.
yy210
;
}
break
;
case
1
59
:
/* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{
PARSER_TRACE
;
yymsp
[
-
3
].
minor
.
yy272
=
createFillNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy54
,
NULL
);
}
case
1
73
:
/* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{
yymsp
[
-
3
].
minor
.
yy210
=
createFillNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy102
,
NULL
);
}
break
;
case
1
60
:
/* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{
PARSER_TRACE
;
yymsp
[
-
5
].
minor
.
yy272
=
createFillNode
(
pCxt
,
FILL_MODE_VALUE
,
createNodeListNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy64
));
}
case
1
74
:
/* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{
yymsp
[
-
5
].
minor
.
yy210
=
createFillNode
(
pCxt
,
FILL_MODE_VALUE
,
createNodeListNode
(
pCxt
,
yymsp
[
-
1
].
minor
.
yy182
));
}
break
;
case
1
61
:
/* fill_mode ::= NONE */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy54
=
FILL_MODE_NONE
;
}
case
1
75
:
/* fill_mode ::= NONE */
{
yymsp
[
0
].
minor
.
yy102
=
FILL_MODE_NONE
;
}
break
;
case
1
62
:
/* fill_mode ::= PREV */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy54
=
FILL_MODE_PREV
;
}
case
1
76
:
/* fill_mode ::= PREV */
{
yymsp
[
0
].
minor
.
yy102
=
FILL_MODE_PREV
;
}
break
;
case
1
63
:
/* fill_mode ::= NULL */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy54
=
FILL_MODE_NULL
;
}
case
1
77
:
/* fill_mode ::= NULL */
{
yymsp
[
0
].
minor
.
yy102
=
FILL_MODE_NULL
;
}
break
;
case
1
64
:
/* fill_mode ::= LINEAR */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy54
=
FILL_MODE_LINEAR
;
}
case
1
78
:
/* fill_mode ::= LINEAR */
{
yymsp
[
0
].
minor
.
yy102
=
FILL_MODE_LINEAR
;
}
break
;
case
1
65
:
/* fill_mode ::= NEXT */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy54
=
FILL_MODE_NEXT
;
}
case
1
79
:
/* fill_mode ::= NEXT */
{
yymsp
[
0
].
minor
.
yy102
=
FILL_MODE_NEXT
;
}
break
;
case
1
68
:
/* group_by_list ::= expression */
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
createNodeList
(
pCxt
,
createGroupingSetNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
}
yymsp
[
0
].
minor
.
yy
64
=
yylhsminor
.
yy64
;
case
1
82
:
/* group_by_list ::= expression */
{
yylhsminor
.
yy182
=
createNodeList
(
pCxt
,
createGroupingSetNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
0
].
minor
.
yy
182
=
yylhsminor
.
yy182
;
break
;
case
1
69
:
/* group_by_list ::= group_by_list NK_COMMA expression */
{
PARSER_TRACE
;
yylhsminor
.
yy64
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy64
,
createGroupingSetNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
)));
}
yymsp
[
-
2
].
minor
.
yy
64
=
yylhsminor
.
yy64
;
case
1
83
:
/* group_by_list ::= group_by_list NK_COMMA expression */
{
yylhsminor
.
yy182
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy182
,
createGroupingSetNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
)));
}
yymsp
[
-
2
].
minor
.
yy
182
=
yylhsminor
.
yy182
;
break
;
case
1
72
:
/* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
case
1
86
:
/* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
addOrderByClause
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy272
,
yymsp
[
-
2
].
minor
.
yy64
);
yylhsminor
.
yy272
=
addSlimitClause
(
pCxt
,
yylhsminor
.
yy272
,
yymsp
[
-
1
].
minor
.
yy272
);
yylhsminor
.
yy272
=
addLimitClause
(
pCxt
,
yylhsminor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
);
yylhsminor
.
yy210
=
addOrderByClause
(
pCxt
,
yymsp
[
-
3
].
minor
.
yy210
,
yymsp
[
-
2
].
minor
.
yy182
);
yylhsminor
.
yy210
=
addSlimitClause
(
pCxt
,
yylhsminor
.
yy210
,
yymsp
[
-
1
].
minor
.
yy210
);
yylhsminor
.
yy210
=
addLimitClause
(
pCxt
,
yylhsminor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
-
3
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
yymsp
[
-
3
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
74
:
/* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createSetOperator
(
pCxt
,
SET_OP_TYPE_UNION_ALL
,
yymsp
[
-
3
].
minor
.
yy272
,
yymsp
[
0
].
minor
.
yy272
);
}
yymsp
[
-
3
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
1
88
:
/* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{
yylhsminor
.
yy210
=
createSetOperator
(
pCxt
,
SET_OP_TYPE_UNION_ALL
,
yymsp
[
-
3
].
minor
.
yy210
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
-
3
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
1
79
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case
1
83
:
/* limit_clause_opt ::= LIMIT NK_INTEGER */
yytestcase
(
yyruleno
==
183
);
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy272
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
NULL
);
}
case
1
93
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case
1
97
:
/* limit_clause_opt ::= LIMIT NK_INTEGER */
yytestcase
(
yyruleno
==
197
);
{
yymsp
[
-
1
].
minor
.
yy210
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
NULL
);
}
break
;
case
1
80
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case
1
84
:
/* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
yytestcase
(
yyruleno
==
184
);
{
PARSER_TRACE
;
yymsp
[
-
3
].
minor
.
yy272
=
createLimitNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
case
1
94
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case
1
98
:
/* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
yytestcase
(
yyruleno
==
198
);
{
yymsp
[
-
3
].
minor
.
yy210
=
createLimitNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
break
;
case
1
81
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case
1
85
:
/* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
yytestcase
(
yyruleno
==
185
);
{
PARSER_TRACE
;
yymsp
[
-
3
].
minor
.
yy272
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
&
yymsp
[
-
2
].
minor
.
yy0
);
}
case
1
95
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case
1
99
:
/* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
yytestcase
(
yyruleno
==
199
);
{
yymsp
[
-
3
].
minor
.
yy210
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
&
yymsp
[
-
2
].
minor
.
yy0
);
}
break
;
case
186
:
/* subquery ::= NK_LP query_expression NK_RP */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
1
].
minor
.
yy272
);
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
200
:
/* subquery ::= NK_LP query_expression NK_RP */
{
yylhsminor
.
yy210
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
1
].
minor
.
yy210
);
}
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
187
:
/* search_condition ::= common_expression */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy272
);
}
yymsp
[
0
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
201
:
/* search_condition ::= common_expression */
{
yylhsminor
.
yy210
=
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy210
);
}
yymsp
[
0
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
190
:
/* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
PARSER_TRACE
;
yylhsminor
.
yy272
=
createOrderByExprNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy272
),
yymsp
[
-
1
].
minor
.
yy218
,
yymsp
[
0
].
minor
.
yy21
7
);
}
yymsp
[
-
2
].
minor
.
yy2
72
=
yylhsminor
.
yy272
;
case
204
:
/* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
yylhsminor
.
yy210
=
createOrderByExprNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy210
),
yymsp
[
-
1
].
minor
.
yy29
,
yymsp
[
0
].
minor
.
yy30
7
);
}
yymsp
[
-
2
].
minor
.
yy2
10
=
yylhsminor
.
yy210
;
break
;
case
191
:
/* ordering_specification_opt ::= */
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy218
=
ORDER_ASC
;
}
case
205
:
/* ordering_specification_opt ::= */
{
yymsp
[
1
].
minor
.
yy29
=
ORDER_ASC
;
}
break
;
case
192
:
/* ordering_specification_opt ::= ASC */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy218
=
ORDER_ASC
;
}
case
206
:
/* ordering_specification_opt ::= ASC */
{
yymsp
[
0
].
minor
.
yy29
=
ORDER_ASC
;
}
break
;
case
193
:
/* ordering_specification_opt ::= DESC */
{
PARSER_TRACE
;
yymsp
[
0
].
minor
.
yy218
=
ORDER_DESC
;
}
case
207
:
/* ordering_specification_opt ::= DESC */
{
yymsp
[
0
].
minor
.
yy29
=
ORDER_DESC
;
}
break
;
case
194
:
/* null_ordering_opt ::= */
{
PARSER_TRACE
;
yymsp
[
1
].
minor
.
yy21
7
=
NULL_ORDER_DEFAULT
;
}
case
208
:
/* null_ordering_opt ::= */
{
yymsp
[
1
].
minor
.
yy30
7
=
NULL_ORDER_DEFAULT
;
}
break
;
case
195
:
/* null_ordering_opt ::= NULLS FIRST */
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy21
7
=
NULL_ORDER_FIRST
;
}
case
209
:
/* null_ordering_opt ::= NULLS FIRST */
{
yymsp
[
-
1
].
minor
.
yy30
7
=
NULL_ORDER_FIRST
;
}
break
;
case
196
:
/* null_ordering_opt ::= NULLS LAST */
{
PARSER_TRACE
;
yymsp
[
-
1
].
minor
.
yy21
7
=
NULL_ORDER_LAST
;
}
case
210
:
/* null_ordering_opt ::= NULLS LAST */
{
yymsp
[
-
1
].
minor
.
yy30
7
=
NULL_ORDER_LAST
;
}
break
;
default:
break
;
...
...
@@ -2555,7 +2594,6 @@ static void yy_accept(
/* Here code is inserted which will be executed whenever the
** parser accepts */
/*********** Begin %parse_accept code *****************************************/
PARSER_COMPLETE
;
/*********** End %parse_accept code *******************************************/
NewParseARG_STORE
/* Suppress warning about unused %extra_argument variable */
NewParseCTX_STORE
...
...
source/libs/parser/src/parserUtil.c
浏览文件 @
216c5317
...
...
@@ -45,93 +45,6 @@ int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char*
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
int32_t
parserValidateIdToken
(
SToken
*
pToken
)
{
if
(
pToken
==
NULL
||
pToken
->
z
==
NULL
||
pToken
->
type
!=
TK_NK_ID
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
// it is a token quoted with escape char '`'
if
(
pToken
->
z
[
0
]
==
TS_ESCAPE_CHAR
&&
pToken
->
z
[
pToken
->
n
-
1
]
==
TS_ESCAPE_CHAR
)
{
return
TSDB_CODE_SUCCESS
;
}
char
*
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
if
(
sep
==
NULL
)
{
// It is a single part token, not a complex type
if
(
isNumber
(
pToken
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
strntolower
(
pToken
->
z
,
pToken
->
z
,
pToken
->
n
);
}
else
{
// two part
int32_t
oldLen
=
pToken
->
n
;
char
*
pStr
=
pToken
->
z
;
if
(
pToken
->
type
==
TK_SPACE
)
{
pToken
->
n
=
(
uint32_t
)
strtrim
(
pToken
->
z
);
}
pToken
->
n
=
tGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
pToken
->
z
[
pToken
->
n
]
!=
TS_PATH_DELIMITER
[
0
])
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
if
(
pToken
->
type
!=
TK_NK_ID
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
int32_t
firstPartLen
=
pToken
->
n
;
pToken
->
z
=
sep
+
1
;
pToken
->
n
=
(
uint32_t
)(
oldLen
-
(
sep
-
pStr
)
-
1
);
int32_t
len
=
tGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
len
!=
pToken
->
n
||
pToken
->
type
!=
TK_NK_ID
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
// re-build the whole name string
if
(
pStr
[
firstPartLen
]
==
TS_PATH_DELIMITER
[
0
])
{
// first part do not have quote do nothing
}
else
{
pStr
[
firstPartLen
]
=
TS_PATH_DELIMITER
[
0
];
memmove
(
&
pStr
[
firstPartLen
+
1
],
pToken
->
z
,
pToken
->
n
);
uint32_t
offset
=
(
uint32_t
)(
pToken
->
z
-
(
pStr
+
firstPartLen
+
1
));
memset
(
pToken
->
z
+
pToken
->
n
-
offset
,
' '
,
offset
);
}
pToken
->
n
+=
(
firstPartLen
+
sizeof
(
TS_PATH_DELIMITER
[
0
]));
pToken
->
z
=
pStr
;
strntolower
(
pToken
->
z
,
pToken
->
z
,
pToken
->
n
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
KvRowAppend
(
const
void
*
value
,
int32_t
len
,
void
*
param
)
{
SKvParam
*
pa
=
(
SKvParam
*
)
param
;
int32_t
type
=
pa
->
schema
->
type
;
int32_t
colId
=
pa
->
schema
->
colId
;
if
(
TSDB_DATA_TYPE_BINARY
==
type
)
{
STR_WITH_SIZE_TO_VARSTR
(
pa
->
buf
,
value
,
len
);
tdAddColToKVRow
(
pa
->
builder
,
colId
,
type
,
pa
->
buf
);
}
else
if
(
TSDB_DATA_TYPE_NCHAR
==
type
)
{
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
int32_t
output
=
0
;
if
(
!
taosMbsToUcs4
(
value
,
len
,
varDataVal
(
pa
->
buf
),
pa
->
schema
->
bytes
-
VARSTR_HEADER_SIZE
,
&
output
))
{
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
varDataSetLen
(
pa
->
buf
,
output
);
tdAddColToKVRow
(
pa
->
builder
,
colId
,
type
,
pa
->
buf
);
}
else
{
tdAddColToKVRow
(
pa
->
builder
,
colId
,
type
,
value
);
}
return
TSDB_CODE_SUCCESS
;
}
static
uint32_t
getTableMetaSize
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
...
...
@@ -184,3 +97,26 @@ STableComInfo getTableInfo(const STableMeta* pTableMeta) {
assert
(
pTableMeta
!=
NULL
);
return
pTableMeta
->
tableInfo
;
}
int32_t
trimString
(
const
char
*
src
,
int32_t
len
,
char
*
dst
,
int32_t
dlen
)
{
// delete escape character: \\, \', \"
char
delim
=
src
[
0
];
int32_t
cnt
=
0
;
int32_t
j
=
0
;
for
(
uint32_t
k
=
1
;
k
<
len
-
1
;
++
k
)
{
if
(
j
>=
dlen
)
{
break
;
}
if
(
src
[
k
]
==
'\\'
||
(
src
[
k
]
==
delim
&&
src
[
k
+
1
]
==
delim
))
{
dst
[
j
]
=
src
[
k
+
1
];
cnt
++
;
j
++
;
k
++
;
continue
;
}
dst
[
j
]
=
src
[
k
];
j
++
;
}
dst
[
j
]
=
'\0'
;
return
j
;
}
source/libs/parser/src/ttokenizer.c
浏览文件 @
216c5317
...
...
@@ -29,32 +29,103 @@ typedef struct SKeyword {
// keywords in sql string
static
SKeyword
keywordTable
[]
=
{
{
"ALL"
,
TK_ALL
},
{
"AND"
,
TK_AND
},
{
"AS"
,
TK_AS
},
{
"ASC"
,
TK_ASC
},
{
"BETWEEN"
,
TK_BETWEEN
},
{
"BINARY"
,
TK_BINARY
},
{
"BIGINT"
,
TK_BIGINT
},
{
"BLOCKS"
,
TK_BLOCKS
},
{
"BOOL"
,
TK_BOOL
},
{
"BY"
,
TK_BY
},
{
"CACHE"
,
TK_CACHE
},
{
"CACHELAST"
,
TK_CACHELAST
},
{
"COMMENT"
,
TK_COMMENT
},
{
"COMP"
,
TK_COMP
},
{
"CREATE"
,
TK_CREATE
},
{
"DATABASE"
,
TK_DATABASE
},
{
"DATABASES"
,
TK_DATABASES
},
{
"DAYS"
,
TK_DAYS
},
{
"DESC"
,
TK_DESC
},
{
"DISTINCT"
,
TK_DISTINCT
},
{
"DOUBLE"
,
TK_DOUBLE
},
{
"EXISTS"
,
TK_EXISTS
},
// {"FILE", TK_FILE},
{
"FILL"
,
TK_FILL
},
{
"FLOAT"
,
TK_FLOAT
},
{
"FROM"
,
TK_FROM
},
{
"FSYNC"
,
TK_FSYNC
},
{
"GROUP"
,
TK_GROUP
},
{
"HAVING"
,
TK_HAVING
},
{
"IF"
,
TK_IF
},
{
"IMPORT"
,
TK_IMPORT
},
{
"IN"
,
TK_IN
},
{
"INNER"
,
TK_INNER
},
{
"INT"
,
TK_INT
},
{
"INSERT"
,
TK_INSERT
},
{
"INTEGER"
,
TK_INTEGER
},
{
"INTERVAL"
,
TK_INTERVAL
},
{
"INTO"
,
TK_INTO
},
{
"IS"
,
TK_IS
},
{
"JOIN"
,
TK_JOIN
},
{
"JSON"
,
TK_JSON
},
{
"KEEP"
,
TK_KEEP
},
{
"LIKE"
,
TK_LIKE
},
{
"LIMIT"
,
TK_LIMIT
},
{
"LINEAR"
,
TK_LINEAR
},
{
"MATCH"
,
TK_MATCH
},
{
"MAXROWS"
,
TK_MAXROWS
},
{
"MINROWS"
,
TK_MINROWS
},
{
"MINUS"
,
TK_MINUS
},
{
"NCHAR"
,
TK_NCHAR
},
{
"NMATCH"
,
TK_NMATCH
},
{
"NONE"
,
TK_NONE
},
{
"NOT"
,
TK_NOT
},
{
"NOW"
,
TK_NOW
},
{
"NULL"
,
TK_NULL
},
{
"OFFSET"
,
TK_OFFSET
},
{
"PRECISION"
,
TK_PRECISION
},
{
"PREV"
,
TK_PREV
},
{
"ON"
,
TK_ON
},
{
"OR"
,
TK_OR
},
{
"ORDER"
,
TK_ORDER
},
{
"QUORUM"
,
TK_QUORUM
},
{
"REPLICA"
,
TK_REPLICA
},
{
"SELECT"
,
TK_SELECT
},
{
"SESSION"
,
TK_SESSION
},
{
"SHOW"
,
TK_SHOW
},
{
"SINGLE_STABLE"
,
TK_SINGLE_STABLE
},
{
"SLIDING"
,
TK_SLIDING
},
{
"SLIMIT"
,
TK_SLIMIT
},
{
"SMA"
,
TK_SMA
},
{
"SMALLINT"
,
TK_SMALLINT
},
{
"SOFFSET"
,
TK_SOFFSET
},
{
"STABLE"
,
TK_STABLE
},
{
"STATE_WINDOW"
,
TK_STATE_WINDOW
},
{
"STREAM_MODE"
,
TK_STREAM_MODE
},
{
"TABLE"
,
TK_TABLE
},
{
"TABLES"
,
TK_TABLES
},
{
"TAGS"
,
TK_TAGS
},
{
"TIMESTAMP"
,
TK_TIMESTAMP
},
{
"TINYINT"
,
TK_TINYINT
},
{
"TTL"
,
TK_TTL
},
{
"UNION"
,
TK_UNION
},
{
"UNSIGNED"
,
TK_UNSIGNED
},
{
"USE"
,
TK_USE
},
{
"USING"
,
TK_USING
},
{
"VALUES"
,
TK_VALUES
},
{
"VARCHAR"
,
TK_VARCHAR
},
{
"VGROUPS"
,
TK_VGROUPS
},
{
"WAL"
,
TK_WAL
},
{
"WHERE"
,
TK_WHERE
},
// {"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
},
// {"STRING", TK_STRING},
{
"TIMESTAMP"
,
TK_TIMESTAMP
},
{
"BINARY"
,
TK_BINARY
},
{
"NCHAR"
,
TK_NCHAR
},
{
"OR"
,
TK_OR
},
{
"AND"
,
TK_AND
},
{
"NOT"
,
TK_NOT
},
// {"EQ", TK_EQ},
// {"NE", TK_NE},
// {"ISNULL", TK_ISNULL},
// {"NOTNULL", TK_NOTNULL},
{
"IS"
,
TK_IS
},
{
"LIKE"
,
TK_LIKE
},
{
"MATCH"
,
TK_MATCH
},
// {"GLOB", TK_GLOB},
{
"BETWEEN"
,
TK_BETWEEN
},
{
"IN"
,
TK_IN
},
// {"GT", TK_GT},
// {"GE", TK_GE},
// {"LT", TK_LT},
...
...
@@ -64,7 +135,6 @@ static SKeyword keywordTable[] = {
// {"LSHIFT", TK_LSHIFT},
// {"RSHIFT", TK_RSHIFT},
// {"PLUS", TK_PLUS},
{
"MINUS"
,
TK_MINUS
},
// {"DIVIDE", TK_DIVIDE},
// {"TIMES", TK_TIMES},
// {"STAR", TK_STAR},
...
...
@@ -74,8 +144,6 @@ static SKeyword keywordTable[] = {
// {"UMINUS", TK_UMINUS},
// {"UPLUS", TK_UPLUS},
// {"BITNOT", TK_BITNOT},
{
"SHOW"
,
TK_SHOW
},
{
"DATABASES"
,
TK_DATABASES
},
// {"MNODES", TK_MNODES},
// {"DNODES", TK_DNODES},
// {"ACCOUNTS", TK_ACCOUNTS},
...
...
@@ -88,25 +156,17 @@ static SKeyword keywordTable[] = {
// {"SCORES", TK_SCORES},
// {"GRANTS", TK_GRANTS},
// {"DOT", TK_DOT},
{
"TABLES"
,
TK_TABLES
},
// {"STABLES", TK_STABLES},
{
"VGROUPS"
,
TK_VGROUPS
},
// {"DROP", TK_DROP},
{
"TABLE"
,
TK_TABLE
},
{
"DATABASE"
,
TK_DATABASE
},
// {"DNODE", TK_DNODE},
// {"USER", TK_USER},
// {"ACCOUNT", TK_ACCOUNT},
{
"USE"
,
TK_USE
},
// {"DESCRIBE", TK_DESCRIBE},
// {"SYNCDB", TK_SYNCDB},
// {"ALTER", TK_ALTER},
// {"PASS", TK_PASS},
// {"PRIVILEGE", TK_PRIVILEGE},
// {"LOCAL", TK_LOCAL},
{
"IF"
,
TK_IF
},
{
"EXISTS"
,
TK_EXISTS
},
{
"CREATE"
,
TK_CREATE
},
// {"PPS", TK_PPS},
// {"TSERIES", TK_TSERIES},
// {"DBS", TK_DBS},
...
...
@@ -114,51 +174,12 @@ static SKeyword keywordTable[] = {
// {"QTIME", TK_QTIME},
// {"CONNS", TK_CONNS},
// {"STATE", TK_STATE},
{
"KEEP"
,
TK_KEEP
},
{
"REPLICA"
,
TK_REPLICA
},
{
"QUORUM"
,
TK_QUORUM
},
{
"DAYS"
,
TK_DAYS
},
{
"MINROWS"
,
TK_MINROWS
},
{
"MAXROWS"
,
TK_MAXROWS
},
{
"BLOCKS"
,
TK_BLOCKS
},
{
"CACHE"
,
TK_CACHE
},
// {"CTIME", TK_CTIME},
{
"WAL"
,
TK_WAL
},
{
"FSYNC"
,
TK_FSYNC
},
{
"COMP"
,
TK_COMP
},
{
"PRECISION"
,
TK_PRECISION
},
// {"LP", TK_LP},
// {"RP", TK_RP},
// {"UNSIGNED", TK_UNSIGNED},
{
"TAGS"
,
TK_TAGS
},
{
"USING"
,
TK_USING
},
{
"AS"
,
TK_AS
},
// {"COMMA", TK_COMMA},
{
"NULL"
,
TK_NULL
},
{
"SELECT"
,
TK_SELECT
},
// {"EVERY", TK_EVERY},
{
"FROM"
,
TK_FROM
},
// {"VARIABLE", TK_VARIABLE},
{
"INTERVAL"
,
TK_INTERVAL
},
{
"SESSION"
,
TK_SESSION
},
{
"STATE_WINDOW"
,
TK_STATE_WINDOW
},
{
"FILL"
,
TK_FILL
},
{
"SLIDING"
,
TK_SLIDING
},
{
"ORDER"
,
TK_ORDER
},
{
"BY"
,
TK_BY
},
{
"ASC"
,
TK_ASC
},
{
"DESC"
,
TK_DESC
},
{
"GROUP"
,
TK_GROUP
},
{
"HAVING"
,
TK_HAVING
},
{
"LIMIT"
,
TK_LIMIT
},
{
"OFFSET"
,
TK_OFFSET
},
{
"SLIMIT"
,
TK_SLIMIT
},
{
"SOFFSET"
,
TK_SOFFSET
},
{
"WHERE"
,
TK_WHERE
},
{
"NOW"
,
TK_NOW
},
{
"INSERT"
,
TK_INSERT
},
{
"INTO"
,
TK_INTO
},
{
"VALUES"
,
TK_VALUES
},
// {"UPDATE", TK_UPDATE},
// {"RESET", TK_RESET},
// {"QUERY", TK_QUERY},
...
...
@@ -192,8 +213,6 @@ static SKeyword keywordTable[] = {
// {"IMMEDIATE", TK_IMMEDIATE},
// {"INITIALLY", TK_INITIALLY},
// {"INSTEAD", TK_INSTEAD},
{
"MATCH"
,
TK_MATCH
},
{
"NMATCH"
,
TK_NMATCH
},
// {"KEY", TK_KEY},
// {"OF", TK_OF},
// {"RAISE", TK_RAISE},
...
...
@@ -203,20 +222,9 @@ static SKeyword keywordTable[] = {
// {"STATEMENT", TK_STATEMENT},
// {"TRIGGER", TK_TRIGGER},
// {"VIEW", TK_VIEW},
{
"ALL"
,
TK_ALL
},
// {"SEMI", TK_SEMI},
{
"NONE"
,
TK_NONE
},
{
"PREV"
,
TK_PREV
},
{
"LINEAR"
,
TK_LINEAR
},
{
"IMPORT"
,
TK_IMPORT
},
// {"TBNAME", TK_TBNAME},
{
"JOIN"
,
TK_JOIN
},
// {"STABLE", TK_STABLE},
{
"FILE"
,
TK_FILE
},
// {"VNODES", TK_VNODES},
{
"UNION"
,
TK_UNION
},
{
"CACHELAST"
,
TK_CACHELAST
},
{
"DISTINCT"
,
TK_DISTINCT
},
// {"PARTITIONS", TK_PARTITIONS},
// {"TOPIC", TK_TOPIC},
// {"TOPICS", TK_TOPICS},
...
...
@@ -228,8 +236,6 @@ static SKeyword keywordTable[] = {
// {"AGGREGATE", TK_AGGREGATE},
// {"BUFSIZE", TK_BUFSIZE},
// {"PORT", TK_PORT},
{
"INNER"
,
TK_INNER
},
{
"ON"
,
TK_ON
},
// {"MODE", TK_MODE},
};
...
...
@@ -277,7 +283,7 @@ static int32_t tKeywordCode(const char* z, int n) {
}
if
(
keywordHashTable
==
NULL
)
{
return
TK_ILLEGAL
;
return
TK_
NK_
ILLEGAL
;
}
SKeyword
**
pKey
=
(
SKeyword
**
)
taosHashGet
(
keywordHashTable
,
key
,
n
);
...
...
@@ -298,7 +304,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
case
'\r'
:
{
for
(
i
=
1
;
isspace
(
z
[
i
]);
i
++
)
{
}
*
tokenId
=
TK_SPACE
;
*
tokenId
=
TK_
NK_
SPACE
;
return
i
;
}
case
':'
:
{
...
...
@@ -383,7 +389,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
}
case
'!'
:
{
if
(
z
[
1
]
!=
'='
)
{
*
tokenId
=
TK_ILLEGAL
;
*
tokenId
=
TK_
NK_
ILLEGAL
;
return
2
;
}
else
{
*
tokenId
=
TK_NK_NE
;
...
...
@@ -412,7 +418,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return
1
;
}
case
'?'
:
{
*
tokenId
=
TK_QUESTION
;
*
tokenId
=
TK_
NK_
QUESTION
;
return
1
;
}
case
'`'
:
...
...
@@ -475,7 +481,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
char
next
=
z
[
1
];
if
(
next
==
'b'
)
{
// bin number
*
tokenId
=
TK_BIN
;
*
tokenId
=
TK_
NK_
BIN
;
for
(
i
=
2
;
(
z
[
i
]
==
'0'
||
z
[
i
]
==
'1'
);
++
i
)
{
}
...
...
@@ -485,7 +491,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return
i
;
}
else
if
(
next
==
'x'
)
{
//hex number
*
tokenId
=
TK_HEX
;
*
tokenId
=
TK_
NK_
HEX
;
for
(
i
=
2
;
isdigit
(
z
[
i
])
||
(
z
[
i
]
>=
'a'
&&
z
[
i
]
<=
'f'
)
||
(
z
[
i
]
>=
'A'
&&
z
[
i
]
<=
'F'
);
++
i
)
{
}
...
...
@@ -574,7 +580,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
}
}
*
tokenId
=
TK_ILLEGAL
;
*
tokenId
=
TK_
NK_
ILLEGAL
;
return
0
;
}
...
...
@@ -608,7 +614,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
return
t0
;
}
// IGNORE TK_
SPACE, T
K_COMMA, and specified tokens
// IGNORE TK_
NK_SPACE, TK_N
K_COMMA, and specified tokens
while
(
1
)
{
*
i
+=
t0
.
n
;
...
...
@@ -656,7 +662,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
// only id and string are valid
if
((
TK_NK_STRING
!=
t0
.
type
)
&&
(
TK_NK_ID
!=
t0
.
type
))
{
t0
.
type
=
TK_ILLEGAL
;
t0
.
type
=
TK_
NK_
ILLEGAL
;
t0
.
n
=
0
;
return
t0
;
...
...
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
216c5317
...
...
@@ -70,7 +70,6 @@ void initMetaDataEnv() {
stub
.
set
(
catalogGetTableMeta
,
__catalogGetTableMeta
);
stub
.
set
(
catalogGetTableHashVgroup
,
__catalogGetTableHashVgroup
);
stub
.
set
(
catalogGetTableDistVgInfo
,
__catalogGetTableDistVgInfo
);
{
AddrAny
any
(
"libcatalog.so"
);
std
::
map
<
std
::
string
,
void
*>
result
;
...
...
@@ -95,6 +94,14 @@ void initMetaDataEnv() {
stub
.
set
(
f
.
second
,
__catalogGetTableHashVgroup
);
}
}
{
AddrAny
any
(
"libcatalog.so"
);
std
::
map
<
std
::
string
,
void
*>
result
;
any
.
get_global_func_addr_dynsym
(
"^catalogGetTableDistVgInfo$"
,
result
);
for
(
const
auto
&
f
:
result
)
{
stub
.
set
(
f
.
second
,
__catalogGetTableDistVgInfo
);
}
}
}
void
generateMetaData
()
{
...
...
source/libs/parser/test/parserTest.cpp
浏览文件 @
216c5317
...
...
@@ -42,457 +42,41 @@ protected:
bool
run
(
int32_t
parseCode
=
TSDB_CODE_SUCCESS
,
int32_t
translateCode
=
TSDB_CODE_SUCCESS
)
{
int32_t
code
=
doParse
(
&
cxt_
,
&
query_
);
// cout << "doParse return " << code << endl;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
cout
<<
"sql:["
<<
cxt_
.
pSql
<<
"] code:"
<<
tstrerror
(
code
)
<<
", msg:"
<<
errMagBuf_
<<
endl
;
cout
<<
"sql:["
<<
cxt_
.
pSql
<<
"]
parser
code:"
<<
tstrerror
(
code
)
<<
", msg:"
<<
errMagBuf_
<<
endl
;
return
(
TSDB_CODE_SUCCESS
!=
parseCode
);
}
if
(
TSDB_CODE_SUCCESS
!=
parseCode
)
{
return
false
;
}
string
parserStr
=
toString
(
query_
->
pRoot
);
code
=
doTranslate
(
&
cxt_
,
query_
);
// cout << "doTranslate return " << code << endl;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
cout
<<
"sql:["
<<
cxt_
.
pSql
<<
"] code:"
<<
code
<<
", "
<<
translateCode
<<
", msg:"
<<
errMagBuf_
<<
endl
;
cout
<<
"sql:["
<<
cxt_
.
pSql
<<
"]
translate
code:"
<<
code
<<
", "
<<
translateCode
<<
", msg:"
<<
errMagBuf_
<<
endl
;
return
(
code
==
translateCode
);
}
if
(
NULL
!=
query_
->
pRoot
&&
QUERY_NODE_SELECT_STMT
==
nodeType
(
query_
->
pRoot
))
{
cout
<<
"input sql : ["
<<
cxt_
.
pSql
<<
"]"
<<
endl
;
// string sql;
// selectToSql(query_.pRoot, sql);
// cout << "output sql : [" << sql << "]" << endl;
string
str
;
selectToStr
(
query_
->
pRoot
,
str
);
cout
<<
"translate str :
\n
"
<<
str
<<
endl
;
}
cout
<<
"input sql : ["
<<
cxt_
.
pSql
<<
"]"
<<
endl
;
cout
<<
"parser output: "
<<
endl
;
cout
<<
parserStr
<<
endl
;
cout
<<
"translate output: "
<<
endl
;
cout
<<
toString
(
query_
->
pRoot
)
<<
endl
;
return
(
TSDB_CODE_SUCCESS
==
translateCode
);
}
private:
static
const
int
max_err_len
=
1024
;
void
exprNodeToStr
(
const
SNode
*
node
,
string
&
str
,
bool
isProject
)
{
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_COLUMN
:
case
QUERY_NODE_VALUE
:
case
QUERY_NODE_OPERATOR
:
case
QUERY_NODE_FUNCTION
:
case
QUERY_NODE_LOGIC_CONDITION
:
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
node
;
str
.
append
(
" ["
+
dataTypeToStr
(
pExpr
->
resType
)
+
"]"
);
if
(
isProject
)
{
str
.
append
(
" AS "
+
string
(
pExpr
->
aliasName
));
}
break
;
}
default:
break
;
}
}
string
dataTypeToStr
(
const
SDataType
&
dt
)
{
switch
(
dt
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
return
"NULL"
;
case
TSDB_DATA_TYPE_BOOL
:
return
"BOOL"
;
case
TSDB_DATA_TYPE_TINYINT
:
return
"TINYINT"
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
"SMALLINT"
;
case
TSDB_DATA_TYPE_INT
:
return
"INT"
;
case
TSDB_DATA_TYPE_BIGINT
:
return
"BIGINT"
;
case
TSDB_DATA_TYPE_FLOAT
:
return
"FLOAT"
;
case
TSDB_DATA_TYPE_DOUBLE
:
return
"DOUBLE"
;
case
TSDB_DATA_TYPE_BINARY
:
return
"BINART("
+
to_string
(
dt
.
bytes
)
+
")"
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
return
"TIMESTAMP"
;
case
TSDB_DATA_TYPE_NCHAR
:
return
"NCHAR("
+
to_string
(
dt
.
bytes
)
+
")"
;
case
TSDB_DATA_TYPE_UTINYINT
:
return
"UTINYINT"
;
case
TSDB_DATA_TYPE_USMALLINT
:
return
"USMALLINT"
;
case
TSDB_DATA_TYPE_UINT
:
return
"UINT"
;
case
TSDB_DATA_TYPE_UBIGINT
:
return
"UBIGINT"
;
case
TSDB_DATA_TYPE_VARCHAR
:
return
"VARCHAR("
+
to_string
(
dt
.
bytes
)
+
")"
;
case
TSDB_DATA_TYPE_VARBINARY
:
return
"VARBINARY("
+
to_string
(
dt
.
bytes
)
+
")"
;
case
TSDB_DATA_TYPE_JSON
:
return
"JSON"
;
case
TSDB_DATA_TYPE_DECIMAL
:
return
"DECIMAL("
+
to_string
(
dt
.
precision
)
+
", "
+
to_string
(
dt
.
scale
)
+
")"
;
case
TSDB_DATA_TYPE_BLOB
:
return
"BLOB"
;
default:
break
;
}
return
"Unknown Data Type "
+
to_string
(
dt
.
type
);
}
void
valueNodeToStr
(
const
SValueNode
*
pVal
,
string
&
str
)
{
switch
(
pVal
->
node
.
resType
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
str
.
append
(
"null"
);
break
;
case
TSDB_DATA_TYPE_BOOL
:
str
.
append
(
pVal
->
datum
.
b
?
"true"
:
"false"
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_BIGINT
:
str
.
append
(
to_string
(
pVal
->
datum
.
i
));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
str
.
append
(
to_string
(
pVal
->
datum
.
d
));
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
str
.
append
(
pVal
->
datum
.
p
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
str
.
append
(
to_string
(
pVal
->
datum
.
u
));
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
str
.
append
(
to_string
(
pVal
->
datum
.
u
));
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
str
.
append
(
"JSON or DECIMAL or BLOB"
);
break
;
default:
break
;
}
}
void
columnNodeToStr
(
const
SColumnNode
*
pCol
,
string
&
str
)
{
if
(
'\0'
!=
pCol
->
dbName
[
0
])
{
str
.
append
(
pCol
->
dbName
);
str
.
append
(
"."
);
}
if
(
'\0'
!=
pCol
->
tableAlias
[
0
])
{
str
.
append
(
pCol
->
tableAlias
);
str
.
append
(
"."
);
}
str
.
append
(
pCol
->
colName
);
}
void
operatorToStr
(
const
SOperatorNode
*
pOp
,
string
&
str
)
{
nodeToStr
(
pOp
->
pLeft
,
str
,
false
);
str
.
append
(
opTypeToStr
(
pOp
->
opType
));
nodeToStr
(
pOp
->
pRight
,
str
,
false
);
}
void
functionToStr
(
const
SFunctionNode
*
pFunc
,
string
&
str
)
{
str
.
append
(
pFunc
->
functionName
);
str
.
append
(
"("
);
nodeListToStr
(
pFunc
->
pParameterList
,
""
,
str
,
false
,
", "
);
str
.
append
(
")"
);
}
void
groupingSetToStr
(
SGroupingSetNode
*
pGroup
,
string
&
str
)
{
nodeToStr
((
SNode
*
)
nodesListGetNode
(
pGroup
->
pParameterList
,
0
),
str
,
false
);
}
void
orderByExprToStr
(
SOrderByExprNode
*
pOrderBy
,
string
&
str
)
{
nodeToStr
(
pOrderBy
->
pExpr
,
str
,
false
);
str
.
append
((
ORDER_ASC
==
pOrderBy
->
order
?
" ASC"
:
" DESC"
));
str
.
append
((
NULL_ORDER_FIRST
==
pOrderBy
->
nullOrder
?
" NULLS FIRST"
:
" NULLS LAST"
));
}
string
logicConditionTypeToStr
(
ELogicConditionType
type
)
{
switch
(
type
)
{
case
LOGIC_COND_TYPE_AND
:
return
"AND"
;
case
LOGIC_COND_TYPE_OR
:
return
"OR"
;
case
LOGIC_COND_TYPE_NOT
:
return
"NOT"
;
default:
break
;
}
return
"Unknown logic cond type"
;
}
void
logicCondToStr
(
SLogicConditionNode
*
pCond
,
string
&
str
)
{
SNode
*
node
=
nullptr
;
bool
first
=
true
;
FOREACH
(
node
,
pCond
->
pParameterList
)
{
if
(
first
&&
LOGIC_COND_TYPE_NOT
==
pCond
->
condType
)
{
str
.
append
(
logicConditionTypeToStr
(
pCond
->
condType
)
+
" "
);
}
else
if
(
!
first
&&
LOGIC_COND_TYPE_NOT
!=
pCond
->
condType
)
{
str
.
append
(
" "
+
logicConditionTypeToStr
(
pCond
->
condType
)
+
" "
);
}
first
=
false
;
nodeToStr
(
node
,
str
,
false
);
}
}
void
nodeToStr
(
const
SNode
*
node
,
string
&
str
,
bool
isProject
)
{
if
(
nullptr
==
node
)
{
return
;
}
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_COLUMN
:
{
columnNodeToStr
((
SColumnNode
*
)
node
,
str
);
break
;
}
case
QUERY_NODE_VALUE
:
{
valueNodeToStr
((
SValueNode
*
)
node
,
str
);
break
;
}
case
QUERY_NODE_OPERATOR
:
{
operatorToStr
((
SOperatorNode
*
)
node
,
str
);
break
;
}
case
QUERY_NODE_FUNCTION
:
{
functionToStr
((
SFunctionNode
*
)
node
,
str
);
break
;
}
case
QUERY_NODE_LOGIC_CONDITION
:
{
logicCondToStr
((
SLogicConditionNode
*
)
node
,
str
);
break
;
}
case
QUERY_NODE_GROUPING_SET
:
{
groupingSetToStr
((
SGroupingSetNode
*
)
node
,
str
);
break
;
}
case
QUERY_NODE_ORDER_BY_EXPR
:
{
orderByExprToStr
((
SOrderByExprNode
*
)
node
,
str
);
break
;
}
default:
break
;
}
exprNodeToStr
(
node
,
str
,
isProject
);
}
void
nodeListToStr
(
const
SNodeList
*
nodelist
,
const
string
&
prefix
,
string
&
str
,
bool
isProject
=
false
,
const
string
&
sep
=
string
(
"
\n
"
))
{
SNode
*
node
=
nullptr
;
FOREACH
(
node
,
nodelist
)
{
str
.
append
(
prefix
);
nodeToStr
(
node
,
str
,
isProject
);
str
.
append
(
sep
);
}
}
void
tableToStr
(
const
SNode
*
node
,
const
string
&
prefix
,
string
&
str
)
{
const
STableNode
*
table
=
(
const
STableNode
*
)
node
;
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_REAL_TABLE
:
{
SRealTableNode
*
realTable
=
(
SRealTableNode
*
)
table
;
str
.
append
(
prefix
);
if
(
'\0'
!=
realTable
->
table
.
dbName
[
0
])
{
str
.
append
(
realTable
->
table
.
dbName
);
str
.
append
(
"."
);
}
str
.
append
(
realTable
->
table
.
tableName
);
str
.
append
(
string
(
" "
)
+
realTable
->
table
.
tableAlias
);
break
;
}
case
QUERY_NODE_TEMP_TABLE
:
{
STempTableNode
*
tempTable
=
(
STempTableNode
*
)
table
;
str
.
append
(
prefix
+
"(
\n
"
);
selectToStr
(
tempTable
->
pSubquery
,
str
,
prefix
+
"
\t
"
);
str
.
append
(
"
\n
"
);
str
.
append
(
prefix
+
") "
);
str
.
append
(
tempTable
->
table
.
tableAlias
);
break
;
}
case
QUERY_NODE_JOIN_TABLE
:
{
SJoinTableNode
*
joinTable
=
(
SJoinTableNode
*
)
table
;
tableToStr
(
joinTable
->
pLeft
,
prefix
,
str
);
str
.
append
(
"
\n
"
+
prefix
+
"JOIN
\n
"
);
tableToStr
(
joinTable
->
pRight
,
prefix
,
str
);
if
(
nullptr
!=
joinTable
->
pOnCond
)
{
str
.
append
(
"
\n
"
+
prefix
+
"
\t
ON "
);
nodeToStr
(
joinTable
->
pOnCond
,
str
,
false
);
}
break
;
}
default:
break
;
}
}
void
selectToStr
(
const
SNode
*
node
,
string
&
str
,
const
string
&
prefix
=
""
)
{
SSelectStmt
*
select
=
(
SSelectStmt
*
)
node
;
str
.
append
(
prefix
+
"SELECT "
);
if
(
select
->
isDistinct
)
{
str
.
append
(
"DISTINCT"
);
}
str
.
append
(
"
\n
"
);
nodeListToStr
(
select
->
pProjectionList
,
prefix
+
"
\t
"
,
str
,
true
);
str
.
append
(
prefix
+
"FROM
\n
"
);
tableToStr
(
select
->
pFromTable
,
prefix
+
"
\t
"
,
str
);
if
(
nullptr
!=
select
->
pWhere
)
{
str
.
append
(
"
\n
"
+
prefix
+
"WHERE
\n\t
"
);
nodeToStr
(
select
->
pWhere
,
str
,
false
);
}
if
(
nullptr
!=
select
->
pGroupByList
)
{
str
.
append
(
"
\n
"
+
prefix
+
"GROUP BY
\n
"
);
nodeListToStr
(
select
->
pGroupByList
,
prefix
+
"
\t
"
,
str
,
true
);
}
if
(
nullptr
!=
select
->
pOrderByList
)
{
str
.
append
(
prefix
+
"ORDER BY
\n
"
);
nodeListToStr
(
select
->
pOrderByList
,
prefix
+
"
\t
"
,
str
,
true
);
}
}
void
selectToSql
(
const
SNode
*
node
,
string
&
sql
)
{
SSelectStmt
*
select
=
(
SSelectStmt
*
)
node
;
sql
.
append
(
"SELECT "
);
if
(
select
->
isDistinct
)
{
sql
.
append
(
"DISTINCT "
);
}
if
(
nullptr
==
select
->
pProjectionList
)
{
sql
.
append
(
"* "
);
}
else
{
nodeListToSql
(
select
->
pProjectionList
,
sql
);
sql
.
append
(
" "
);
}
sql
.
append
(
"FROM "
);
tableToSql
(
select
->
pFromTable
,
sql
);
if
(
nullptr
!=
select
->
pWhere
)
{
sql
.
append
(
" WHERE "
);
nodeToSql
(
select
->
pWhere
,
sql
);
}
}
void
tableToSql
(
const
SNode
*
node
,
string
&
sql
)
{
const
STableNode
*
table
=
(
const
STableNode
*
)
node
;
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_REAL_TABLE
:
{
SRealTableNode
*
realTable
=
(
SRealTableNode
*
)
table
;
if
(
'\0'
!=
realTable
->
table
.
dbName
[
0
])
{
sql
.
append
(
realTable
->
table
.
dbName
);
sql
.
append
(
"."
);
}
sql
.
append
(
realTable
->
table
.
tableName
);
break
;
}
case
QUERY_NODE_TEMP_TABLE
:
{
STempTableNode
*
tempTable
=
(
STempTableNode
*
)
table
;
sql
.
append
(
"("
);
selectToSql
(
tempTable
->
pSubquery
,
sql
);
sql
.
append
(
") "
);
sql
.
append
(
tempTable
->
table
.
tableAlias
);
break
;
}
case
QUERY_NODE_JOIN_TABLE
:
{
SJoinTableNode
*
joinTable
=
(
SJoinTableNode
*
)
table
;
tableToSql
(
joinTable
->
pLeft
,
sql
);
sql
.
append
(
" JOIN "
);
tableToSql
(
joinTable
->
pRight
,
sql
);
if
(
nullptr
!=
joinTable
->
pOnCond
)
{
sql
.
append
(
" ON "
);
nodeToSql
(
joinTable
->
pOnCond
,
sql
);
}
break
;
}
default:
break
;
}
}
string
opTypeToStr
(
EOperatorType
type
)
{
switch
(
type
)
{
case
OP_TYPE_ADD
:
return
" + "
;
case
OP_TYPE_SUB
:
return
" - "
;
case
OP_TYPE_MULTI
:
return
" * "
;
case
OP_TYPE_DIV
:
return
" / "
;
case
OP_TYPE_MOD
:
return
" % "
;
case
OP_TYPE_GREATER_THAN
:
return
" > "
;
case
OP_TYPE_GREATER_EQUAL
:
return
" >= "
;
case
OP_TYPE_LOWER_THAN
:
return
" < "
;
case
OP_TYPE_LOWER_EQUAL
:
return
" <= "
;
case
OP_TYPE_EQUAL
:
return
" = "
;
case
OP_TYPE_NOT_EQUAL
:
return
" != "
;
case
OP_TYPE_IN
:
case
OP_TYPE_NOT_IN
:
case
OP_TYPE_LIKE
:
case
OP_TYPE_NOT_LIKE
:
case
OP_TYPE_MATCH
:
case
OP_TYPE_NMATCH
:
case
OP_TYPE_JSON_GET_VALUE
:
case
OP_TYPE_JSON_CONTAINS
:
default:
break
;
}
return
" unknown operator "
;
}
void
nodeToSql
(
const
SNode
*
node
,
string
&
sql
)
{
if
(
nullptr
==
node
)
{
return
;
}
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_COLUMN
:
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
node
;
if
(
'\0'
!=
pCol
->
dbName
[
0
])
{
sql
.
append
(
pCol
->
dbName
);
sql
.
append
(
"."
);
}
if
(
'\0'
!=
pCol
->
tableAlias
[
0
])
{
sql
.
append
(
pCol
->
tableAlias
);
sql
.
append
(
"."
);
}
sql
.
append
(
pCol
->
colName
);
break
;
}
case
QUERY_NODE_VALUE
:
break
;
case
QUERY_NODE_OPERATOR
:
{
SOperatorNode
*
pOp
=
(
SOperatorNode
*
)
node
;
nodeToSql
(
pOp
->
pLeft
,
sql
);
sql
.
append
(
opTypeToStr
(
pOp
->
opType
));
nodeToSql
(
pOp
->
pRight
,
sql
);
break
;
}
default:
break
;
}
}
void
nodeListToSql
(
const
SNodeList
*
nodelist
,
string
&
sql
,
const
string
&
seq
=
","
)
{
SNode
*
node
=
nullptr
;
bool
firstNode
=
true
;
FOREACH
(
node
,
nodelist
)
{
if
(
!
firstNode
)
{
sql
.
append
(
", "
);
}
firstNode
=
false
;
nodeToSql
(
node
,
sql
);
string
toString
(
const
SNode
*
pRoot
,
bool
format
=
false
)
{
char
*
pStr
=
NULL
;
int32_t
len
=
0
;
int32_t
code
=
nodesNodeToString
(
pRoot
,
format
,
&
pStr
,
&
len
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
cout
<<
"sql:["
<<
cxt_
.
pSql
<<
"] toString code:"
<<
code
<<
", strerror:"
<<
tstrerror
(
code
)
<<
endl
;
throw
"nodesNodeToString failed!"
;
}
string
str
(
pStr
);
tfree
(
pStr
);
return
str
;
}
void
reset
()
{
...
...
@@ -700,6 +284,27 @@ TEST_F(ParserTest, selectSemanticError) {
TEST_F
(
ParserTest
,
createDatabase
)
{
bind
(
"create database wxy_db"
);
ASSERT_TRUE
(
run
());
bind
(
"create database if not exists wxy_db "
"BLOCKS 100 "
"CACHE 100 "
"CACHELAST 2 "
"COMP 1 "
"DAYS 100 "
"FSYNC 100 "
"MAXROWS 1000 "
"MINROWS 100 "
"KEEP 100 "
"PRECISION 'ms' "
"QUORUM 1 "
"REPLICA 3 "
"TTL 100 "
"WAL 2 "
"VGROUPS 100 "
"SINGLE_STABLE 0 "
"STREAM_MODE 1 "
);
ASSERT_TRUE
(
run
());
}
TEST_F
(
ParserTest
,
showDatabase
)
{
...
...
@@ -715,4 +320,42 @@ TEST_F(ParserTest, useDatabase) {
TEST_F
(
ParserTest
,
createTable
)
{
bind
(
"create table t1(ts timestamp, c1 int)"
);
ASSERT_TRUE
(
run
());
bind
(
"create table if not exists test.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), c8 SMALLINT, "
"c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, c13 NCHAR(30), c14 JSON, c15 VARCHAR(50)) "
"KEEP 100 TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)"
);
ASSERT_TRUE
(
run
());
bind
(
"create table if not exists test.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), c8 SMALLINT, "
"c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, c13 NCHAR(30), c14 JSON, c15 VARCHAR(50)) "
"TAGS (tsa TIMESTAMP, a1 INT, a2 INT UNSIGNED, a3 BIGINT, a4 BIGINT UNSIGNED, a5 FLOAT, a6 DOUBLE, a7 BINARY(20), a8 SMALLINT, "
"a9 SMALLINT UNSIGNED COMMENT 'test column comment', a10 TINYINT, a11 TINYINT UNSIGNED, a12 BOOL, a13 NCHAR(30), a14 JSON, a15 VARCHAR(50)) "
"KEEP 100 TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)"
);
ASSERT_TRUE
(
run
());
bind
(
"create table if not exists t1 using st1 tags(1)"
);
ASSERT_TRUE
(
run
());
bind
(
"create table "
"if not exists test.t1 using test.st1 (tc1, tc2, tc3) tags(1, 2.0, 'abc', TIMESTAMP '2022-3-6 11:20:23') "
"if not exists test.t2 using test.st1 (tc1, tc2, tc3) tags(2, 2.0, 'abc', TIMESTAMP '2022-3-6 11:20:23') "
"if not exists test.t3 using test.st1 (tc1, tc2, tc3) tags(3, 2.0, 'abc', TIMESTAMP '2022-3-6 11:20:23')"
);
ASSERT_TRUE
(
run
());
bind
(
"create stable t1(ts timestamp, c1 int) TAGS(id int)"
);
ASSERT_TRUE
(
run
());
bind
(
"create stable if not exists test.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), c8 SMALLINT, "
"c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, c13 NCHAR(30), c14 JSON, c15 VARCHAR(50)) "
"TAGS (tsa TIMESTAMP, a1 INT, a2 INT UNSIGNED, a3 BIGINT, a4 BIGINT UNSIGNED, a5 FLOAT, a6 DOUBLE, a7 BINARY(20), a8 SMALLINT, "
"a9 SMALLINT UNSIGNED COMMENT 'test column comment', a10 TINYINT, a11 TINYINT UNSIGNED, a12 BOOL, a13 NCHAR(30), a14 JSON, a15 VARCHAR(50)) "
"KEEP 100 TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)"
);
ASSERT_TRUE
(
run
());
}
source/libs/planner/src/logicPlan.c
浏览文件 @
216c5317
...
...
@@ -349,11 +349,15 @@ static SLogicNode* createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
return
pRoot
;
}
static
int32_t
getMsgType
(
ENodeType
sqlType
)
{
return
(
QUERY_NODE_CREATE_TABLE_STMT
==
sqlType
||
QUERY_NODE_CREATE_MULTI_TABLE_STMT
==
sqlType
)
?
TDMT_VND_CREATE_TABLE
:
TDMT_VND_SUBMIT
;
}
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
);
pModif
->
msgType
=
getMsgType
(
pStmt
->
sqlNodeType
);
return
(
SLogicNode
*
)
pModif
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录