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

Merge pull request #10214 from taosdata/feature/3.0_wxy

TD-13338 SELECT statement translate code
......@@ -22,6 +22,81 @@ extern "C" {
#include "nodes.h"
typedef enum EFunctionType {
// aggregate function
FUNCTION_TYPE_APERCENTILE = 1,
FUNCTION_TYPE_AVG,
FUNCTION_TYPE_COUNT,
FUNCTION_TYPE_ELAPSED,
FUNCTION_TYPE_IRATE,
FUNCTION_TYPE_LAST_ROW,
FUNCTION_TYPE_LEASTSQUARES,
FUNCTION_TYPE_MAX,
FUNCTION_TYPE_MIN,
FUNCTION_TYPE_MODE,
FUNCTION_TYPE_PERCENTILE,
FUNCTION_TYPE_SPREAD,
FUNCTION_TYPE_STDDEV,
FUNCTION_TYPE_SUM,
FUNCTION_TYPE_TWA,
// nonstandard SQL function
FUNCTION_TYPE_BOTTOM = 500,
FUNCTION_TYPE_CSUM,
FUNCTION_TYPE_DERIVATIVE,
FUNCTION_TYPE_DIFF,
FUNCTION_TYPE_FIRST,
FUNCTION_TYPE_INTERP,
FUNCTION_TYPE_LAST,
FUNCTION_TYPE_MAVG,
FUNCTION_TYPE_SAMPLE,
FUNCTION_TYPE_TAIL,
FUNCTION_TYPE_TOP,
FUNCTION_TYPE_UNIQUE,
// math function
FUNCTION_TYPE_ABS = 1000,
FUNCTION_TYPE_ACOS,
FUNCTION_TYPE_ASION,
FUNCTION_TYPE_ATAN,
FUNCTION_TYPE_CEIL,
FUNCTION_TYPE_COS,
FUNCTION_TYPE_FLOOR,
FUNCTION_TYPE_LOG,
FUNCTION_TYPE_POW,
FUNCTION_TYPE_ROUND,
FUNCTION_TYPE_SIN,
FUNCTION_TYPE_SQRT,
FUNCTION_TYPE_TAN,
// string function
FUNCTION_TYPE_CHAR_LENGTH = 1500,
FUNCTION_TYPE_CONCAT,
FUNCTION_TYPE_CONCAT_WS,
FUNCTION_TYPE_LENGTH,
// conversion function
FUNCTION_TYPE_CAST = 2000,
FUNCTION_TYPE_TO_ISO8601,
FUNCTION_TYPE_TO_JSON,
FUNCTION_TYPE_UNIXTIMESTAMP,
// date and time function
FUNCTION_TYPE_NOW = 2500,
FUNCTION_TYPE_TIMEDIFF,
FUNCTION_TYPE_TIMETRUNCATE,
FUNCTION_TYPE_TIMEZONE,
FUNCTION_TYPE_TODAY,
// system function
FUNCTION_TYPE_DATABASE = 3000,
FUNCTION_TYPE_CLIENT_VERSION,
FUNCTION_TYPE_SERVER_SERSION,
FUNCTION_TYPE_SERVER_STATUS,
FUNCTION_TYPE_CURRENT_USER,
FUNCTION_TYPE_USER
} EFunctionType;
struct SqlFunctionCtx;
struct SResultRowEntryInfo;
struct STimeWindow;
......@@ -47,14 +122,18 @@ int32_t fmFuncMgtInit();
int32_t fmGetHandle(FuncMgtHandle* pHandle);
int32_t fmGetFuncId(FuncMgtHandle handle, const char* name);
int32_t fmGetFuncResultType(FuncMgtHandle handle, SFunctionNode* pFunc);
int32_t fmGetFuncInfo(FuncMgtHandle handle, const char* pFuncName, int32_t* pFuncId, int32_t* pFuncType);
int32_t fmGetFuncResultType(SFunctionNode* pFunc);
bool fmIsAggFunc(int32_t funcId);
bool fmIsScalarFunc(int32_t funcId);
bool fmIsNonstandardSQLFunc(int32_t funcId);
bool fmIsStringFunc(int32_t funcId);
bool fmIsTimestampFunc(int32_t funcId);
bool fmIsDatetimeFunc(int32_t funcId);
bool fmIsTimelineFunc(int32_t funcId);
bool fmIsTimeorderFunc(int32_t funcId);
bool fmIsNonstandardSQLFunc(int32_t funcId);
int32_t fmFuncScanType(int32_t funcId);
int32_t fmGetFuncExecFuncs(FuncMgtHandle handle, int32_t funcId, SFuncExecFuncs* pFpSet);
......
......@@ -30,6 +30,20 @@ extern "C" {
#define FOREACH(node, list) \
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext)
// only be use in FOREACH
#define ERASE_NODE(list) \
if (NULL == cell->pPrev) { \
(list)->pHead = cell->pNext; \
} else { \
cell->pPrev->pNext = cell->pNext; \
cell->pNext->pPrev = cell->pPrev; \
} \
SListCell* tmp = cell; \
cell = cell->pNext; \
tfree(tmp);
#define REPLACE_NODE(newNode) cell->pNode = (SNode*)(newNode)
#define FORBOTH(node1, list1, node2, list2) \
for (SListCell* cell1 = (NULL != (list1) ? (list1)->pHead : NULL), *cell2 = (NULL != (list2) ? (list2)->pHead : NULL); \
(NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)), (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), (node1 != NULL && node2 != NULL); \
......@@ -71,8 +85,9 @@ typedef struct SNode {
} SNode;
typedef struct SListCell {
SNode* pNode;
struct SListCell* pPrev;
struct SListCell* pNext;
SNode* pNode;
} SListCell;
typedef struct SNodeList {
......@@ -192,6 +207,7 @@ typedef struct SFunctionNode {
SExprNode node; // QUERY_NODE_FUNCTION
char functionName[TSDB_FUNC_NAME_LEN];
int32_t funcId;
int32_t funcType;
SNodeList* pParameterList;
} SFunctionNode;
......@@ -327,6 +343,7 @@ void nodesDestroyNode(SNode* pNode);
SNodeList* nodesMakeList();
SNodeList* nodesListAppend(SNodeList* pList, SNode* pNode);
SNode* nodesListGetNode(SNodeList* pList, int32_t index);
void nodesDestroyList(SNodeList* pList);
typedef bool (*FQueryNodeWalker)(SNode* pNode, void* pContext);
......
......@@ -444,13 +444,15 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SCH_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2502) //scheduler internal error
//parser
#define TSDB_CODE_PAR_INVALID_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2601) //invalid column name
#define TSDB_CODE_PAR_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x2602) //table not exist
#define TSDB_CODE_PAR_AMBIGUOUS_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2603) //ambiguous column
#define TSDB_CODE_PAR_WRONG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x2604) //wrong value type
#define TSDB_CODE_PAR_FUNTION_PARA_NUM TAOS_DEF_ERROR_CODE(0, 0x2605) //invalid number of arguments
#define TSDB_CODE_PAR_FUNTION_PARA_TYPE TAOS_DEF_ERROR_CODE(0, 0x2606) //inconsistent datatypes
#define TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION TAOS_DEF_ERROR_CODE(0, 0x2607) //there mustn't be aggregation
#define TSDB_CODE_PAR_INVALID_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2601) //Invalid column name
#define TSDB_CODE_PAR_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x2602) //Table does not exist
#define TSDB_CODE_PAR_AMBIGUOUS_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2603) //Column ambiguously defined
#define TSDB_CODE_PAR_WRONG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x2604) //Invalid value type
#define TSDB_CODE_PAR_INVALID_FUNTION TAOS_DEF_ERROR_CODE(0, 0x2605) //Invalid function name
#define TSDB_CODE_PAR_FUNTION_PARA_NUM TAOS_DEF_ERROR_CODE(0, 0x2606) //Invalid number of arguments
#define TSDB_CODE_PAR_FUNTION_PARA_TYPE TAOS_DEF_ERROR_CODE(0, 0x2607) //Inconsistent datatypes
#define TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION TAOS_DEF_ERROR_CODE(0, 0x2608) //There mustn't be aggregation
#define TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT TAOS_DEF_ERROR_CODE(0, 0x2609) //ORDER BY item must be the number of a SELECT-list expression
#ifdef __cplusplus
}
......
/*
* 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_BUILDINS_H_
#define _TD_BUILDINS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "functionMgt.h"
#define FUNCTION_NAME_MAX_LENGTH 16
#define FUNC_MGT_FUNC_CLASSIFICATION_MASK(n) (1 << n)
#define FUNC_MGT_AGG_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(0)
#define FUNC_MGT_SCALAR_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(1)
#define FUNC_MGT_NONSTANDARD_SQL_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(2)
#define FUNC_MGT_STRING_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(3)
#define FUNC_MGT_DATETIME_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(4)
#define FUNC_MGT_TIMELINE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(5)
#define FUNC_MGT_TIMEORDER_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(6)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
typedef int32_t (*FCheckAndGetResultType)(SFunctionNode* pFunc);
typedef struct SBuiltinFuncDefinition {
char name[FUNCTION_NAME_MAX_LENGTH];
EFunctionType type;
uint64_t classification;
FCheckAndGetResultType checkFunc;
FExecGetEnv getEnvFunc;
FExecInit initFunc;
FExecProcess processFunc;
FExecFinalize finalizeFunc;
} SBuiltinFuncDefinition;
extern const SBuiltinFuncDefinition funcMgtBuiltins[];
extern const int funcMgtBuiltinsNum;
#ifdef __cplusplus
}
#endif
#endif /*_TD_BUILDINS_H_*/
......@@ -21,53 +21,9 @@ extern "C" {
#endif
#include "functionMgt.h"
// #include "builtins.h"
#define FUNC_MGT_DATA_TYPE_MASK(n) (1 << n)
#define FUNC_MGT_DATA_TYPE_NULL 0
#define FUNC_MGT_DATA_TYPE_BOOL FUNC_MGT_DATA_TYPE_MASK(0)
#define FUNC_MGT_DATA_TYPE_TINYINT FUNC_MGT_DATA_TYPE_MASK(1)
#define FUNC_MGT_DATA_TYPE_SMALLINT FUNC_MGT_DATA_TYPE_MASK(2)
#define FUNC_MGT_DATA_TYPE_INT FUNC_MGT_DATA_TYPE_MASK(3)
#define FUNC_MGT_DATA_TYPE_BIGINT FUNC_MGT_DATA_TYPE_MASK(4)
#define FUNC_MGT_DATA_TYPE_FLOAT FUNC_MGT_DATA_TYPE_MASK(5)
#define FUNC_MGT_DATA_TYPE_DOUBLE FUNC_MGT_DATA_TYPE_MASK(6)
#define FUNC_MGT_DATA_TYPE_BINARY FUNC_MGT_DATA_TYPE_MASK(7)
#define FUNC_MGT_DATA_TYPE_TIMESTAMP FUNC_MGT_DATA_TYPE_MASK(8)
#define FUNC_MGT_DATA_TYPE_NCHAR FUNC_MGT_DATA_TYPE_MASK(9)
#define FUNC_MGT_DATA_TYPE_UTINYINT FUNC_MGT_DATA_TYPE_MASK(10)
#define FUNC_MGT_DATA_TYPE_USMALLINT FUNC_MGT_DATA_TYPE_MASK(11)
#define FUNC_MGT_DATA_TYPE_UINT FUNC_MGT_DATA_TYPE_MASK(12)
#define FUNC_MGT_DATA_TYPE_UBIGINT FUNC_MGT_DATA_TYPE_MASK(13)
#define FUNC_MGT_DATA_TYPE_VARCHAR FUNC_MGT_DATA_TYPE_MASK(14)
#define FUNC_MGT_DATA_TYPE_VARBINARY FUNC_MGT_DATA_TYPE_MASK(15)
#define FUNC_MGT_DATA_TYPE_JSON FUNC_MGT_DATA_TYPE_MASK(16)
#define FUNC_MGT_DATA_TYPE_DECIMAL FUNC_MGT_DATA_TYPE_MASK(17)
#define FUNC_MGT_DATA_TYPE_BLOB FUNC_MGT_DATA_TYPE_MASK(18)
#define FUNC_MGT_EXACT_NUMERIC_DATA_TYPE \
(FUNC_MGT_DATA_TYPE_TINYINT | FUNC_MGT_DATA_TYPE_SMALLINT | FUNC_MGT_DATA_TYPE_INT | FUNC_MGT_DATA_TYPE_BIGINT \
| FUNC_MGT_DATA_TYPE_UTINYINT | FUNC_MGT_DATA_TYPE_USMALLINT | FUNC_MGT_DATA_TYPE_UINT | FUNC_MGT_DATA_TYPE_UBIGINT)
#define FUNC_MGT_APPRO_NUMERIC_DATA_TYPE (FUNC_MGT_DATA_TYPE_FLOAT | FUNC_MGT_DATA_TYPE_DOUBLE)
#define FUNC_MGT_NUMERIC_DATA_TYPE (FUNC_MGT_EXACT_NUMERIC_DATA_TYPE | FUNC_MGT_APPRO_NUMERIC_DATA_TYPE)
typedef void* FuncDef;
typedef struct SFuncElement {
FuncDef (*defineFunc)();
} SFuncElement;
extern const SFuncElement gBuiltinFuncs[];
FuncDef createFuncDef(const char* name, int32_t maxNumOfParams);
FuncDef setOneParamSignature(FuncDef def, int64_t resDataType, int64_t paramDataType);
FuncDef setTwoParamsSignature(FuncDef def, int64_t resDataType, int64_t p1DataType, int64_t p2DataType);
FuncDef setFollowParamSignature(FuncDef def, int64_t paramDataType);
FuncDef setFollowParamsSignature(FuncDef def, int64_t p1DataType, int64_t p2DataType, int32_t followNo);
FuncDef setExecFuncs(FuncDef def, FExecGetEnv getEnv, FExecInit init, FExecProcess process, FExecFinalize finalize);
#ifdef __cplusplus
}
......
......@@ -89,10 +89,6 @@ static FORCE_INLINE void initResultRowEntry(SResultRowEntryInfo *pResInfo, int32
memset(GET_ROWCELL_INTERBUF(pResInfo), 0, bufLen);
}
#include "functionMgtInt.h"
FuncDef defineCount();
#ifdef __cplusplus
}
#endif
......
......@@ -13,9 +13,36 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "functionMgtInt.h"
#include "taggfunction.h"
#include "builtins.h"
#include "taoserror.h"
const SFuncElement gBuiltinFuncs[] = {
{.defineFunc = defineCount}
int32_t stubCheckAndGetResultType(SFunctionNode* pFunc);
const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "count",
.type = FUNCTION_TYPE_COUNT,
.classification = FUNC_MGT_AGG_FUNC,
.checkFunc = stubCheckAndGetResultType,
.getEnvFunc = NULL,
.initFunc = NULL,
.processFunc = NULL,
.finalizeFunc = NULL
},
{
.name = "concat",
.type = FUNCTION_TYPE_CONCAT,
.classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC,
.checkFunc = stubCheckAndGetResultType,
.getEnvFunc = NULL,
.initFunc = NULL,
.processFunc = NULL,
.finalizeFunc = NULL
}
};
const int funcMgtBuiltinsNum = (sizeof(funcMgtBuiltins) / sizeof(SBuiltinFuncDefinition));
int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) {
return TSDB_CODE_SUCCESS;
}
......@@ -19,6 +19,7 @@
#include "taos.h"
#include "taoserror.h"
#include "thash.h"
#include "builtins.h"
typedef struct SFuncMgtService {
SHashObj* pFuncNameHashTable;
......@@ -27,62 +28,46 @@ typedef struct SFuncMgtService {
static SFuncMgtService gFunMgtService;
int32_t fmFuncMgtInit() {
gFunMgtService.pFuncNameHashTable = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
gFunMgtService.pFuncNameHashTable = taosHashInit(funcMgtBuiltinsNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
if (NULL == gFunMgtService.pFuncNameHashTable) {
return TSDB_CODE_FAILED;
}
return TSDB_CODE_SUCCESS;
}
typedef struct SFuncDef {
char name[TSDB_FUNC_NAME_LEN];
int32_t maxNumOfParams;
SFuncExecFuncs execFuncs;
} SFuncDef ;
FuncDef createFuncDef(const char* name, int32_t maxNumOfParams) {
SFuncDef* pDef = calloc(1, sizeof(SFuncDef));
if (NULL == pDef) {
return NULL;
for (int32_t i = 0; i < funcMgtBuiltinsNum; ++i) {
if (TSDB_CODE_SUCCESS != taosHashPut(gFunMgtService.pFuncNameHashTable, funcMgtBuiltins[i].name, strlen(funcMgtBuiltins[i].name), &i, sizeof(int32_t))) {
return TSDB_CODE_FAILED;
}
}
strcpy(pDef->name, name);
pDef->maxNumOfParams = maxNumOfParams;
return pDef;
}
FuncDef setOneParamSignature(FuncDef def, int64_t resDataType, int64_t paramDataType) {
// todo
}
FuncDef setTwoParamsSignature(FuncDef def, int64_t resDataType, int64_t p1DataType, int64_t p2DataType) {
// todo
}
FuncDef setFollowParamSignature(FuncDef def, int64_t paramDataType) {
// todo
}
FuncDef setFollowParamsSignature(FuncDef def, int64_t p1DataType, int64_t p2DataType, int32_t followNo) {
// todo
return TSDB_CODE_SUCCESS;
}
FuncDef setExecFuncs(FuncDef def, FExecGetEnv getEnv, FExecInit init, FExecProcess process, FExecFinalize finalize) {
SFuncDef* pDef = (SFuncDef*)def;
pDef->execFuncs.getEnv = getEnv;
pDef->execFuncs.init = init;
pDef->execFuncs.process = process;
pDef->execFuncs.finalize = finalize;
return def;
int32_t fmGetHandle(FuncMgtHandle* pHandle) {
*pHandle = &gFunMgtService;
return TSDB_CODE_SUCCESS;
}
int32_t registerFunc(FuncDef func) {
int32_t fmGetFuncInfo(FuncMgtHandle handle, const char* pFuncName, int32_t* pFuncId, int32_t* pFuncType) {
SFuncMgtService* pService = (SFuncMgtService*)handle;
pFuncId = taosHashGet(pService->pFuncNameHashTable, pFuncName, strlen(pFuncName));
if (NULL == pFuncId) {
return TSDB_CODE_FAILED;
}
if (*pFuncId < 0 || *pFuncId >= funcMgtBuiltinsNum) {
return TSDB_CODE_FAILED;
}
*pFuncType = funcMgtBuiltins[*pFuncId].type;
return TSDB_CODE_SUCCESS;
}
int32_t fmGetFuncResultType(FuncMgtHandle handle, SFunctionNode* pFunc) {
return TSDB_CODE_SUCCESS;
int32_t fmGetFuncResultType(SFunctionNode* pFunc) {
if (pFunc->funcId < 0 || pFunc->funcId >= funcMgtBuiltinsNum) {
return TSDB_CODE_FAILED;
}
return funcMgtBuiltins[pFunc->funcId].checkFunc(pFunc);
}
bool fmIsAggFunc(int32_t funcId) {
return false;
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
return false;
}
return FUNC_MGT_TEST_MASK(funcMgtBuiltins[funcId].classification, FUNC_MGT_AGG_FUNC);
}
......@@ -4853,9 +4853,3 @@ SAggFunctionInfo aggFunc[35] = {{
statisRequired,
}
};
FuncDef defineCount() {
FuncDef def = createFuncDef("count", 1);
// todo define signature
return setExecFuncs(def, NULL, function_setup, count_function, doFinalizer);
}
......@@ -112,6 +112,7 @@ expression(A) ::= literal(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; }
......
......@@ -138,17 +138,17 @@ typedef union {
#define NewParseCTX_PARAM
#define NewParseCTX_FETCH
#define NewParseCTX_STORE
#define YYNSTATE 143
#define YYNRULE 134
#define YYNSTATE 144
#define YYNRULE 135
#define YYNTOKEN 72
#define YY_MAX_SHIFT 142
#define YY_MIN_SHIFTREDUCE 238
#define YY_MAX_SHIFTREDUCE 371
#define YY_ERROR_ACTION 372
#define YY_ACCEPT_ACTION 373
#define YY_NO_ACTION 374
#define YY_MIN_REDUCE 375
#define YY_MAX_REDUCE 508
#define YY_MAX_SHIFT 143
#define YY_MIN_SHIFTREDUCE 240
#define YY_MAX_SHIFTREDUCE 374
#define YY_ERROR_ACTION 375
#define YY_ACCEPT_ACTION 376
#define YY_NO_ACTION 377
#define YY_MIN_REDUCE 378
#define YY_MAX_REDUCE 512
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
......@@ -215,202 +215,200 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (705)
#define YY_ACTTAB_COUNT (692)
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 384, 382, 89, 22, 64, 385, 382, 458, 29, 27,
/* 10 */ 25, 24, 23, 392, 382, 137, 406, 126, 406, 138,
/* 20 */ 71, 109, 44, 393, 259, 395, 21, 84, 93, 142,
/* 30 */ 277, 278, 279, 280, 281, 282, 283, 285, 286, 287,
/* 40 */ 29, 27, 25, 24, 23, 25, 24, 23, 125, 9,
/* 50 */ 456, 240, 241, 242, 243, 139, 246, 106, 21, 84,
/* 60 */ 93, 51, 277, 278, 279, 280, 281, 282, 283, 285,
/* 70 */ 286, 287, 127, 392, 382, 137, 406, 137, 406, 138,
/* 80 */ 315, 113, 38, 393, 114, 395, 431, 253, 28, 26,
/* 90 */ 83, 427, 487, 443, 131, 240, 241, 242, 243, 139,
/* 100 */ 246, 487, 98, 1, 340, 486, 67, 10, 51, 485,
/* 110 */ 440, 392, 382, 60, 50, 137, 406, 138, 485, 123,
/* 120 */ 39, 393, 314, 395, 431, 51, 125, 9, 91, 427,
/* 130 */ 105, 338, 339, 341, 342, 392, 382, 132, 462, 137,
/* 140 */ 406, 138, 4, 311, 39, 393, 407, 395, 431, 51,
/* 150 */ 443, 443, 91, 427, 29, 27, 25, 24, 23, 323,
/* 160 */ 392, 382, 483, 73, 137, 406, 138, 439, 438, 39,
/* 170 */ 393, 251, 395, 431, 389, 18, 387, 91, 427, 7,
/* 180 */ 6, 29, 27, 25, 24, 23, 134, 447, 127, 392,
/* 190 */ 382, 7, 6, 137, 406, 138, 28, 26, 77, 393,
/* 200 */ 8, 395, 295, 240, 241, 242, 243, 139, 246, 107,
/* 210 */ 98, 1, 28, 26, 469, 10, 104, 487, 52, 240,
/* 220 */ 241, 242, 243, 139, 246, 246, 98, 5, 102, 40,
/* 230 */ 50, 135, 337, 19, 485, 392, 382, 130, 468, 137,
/* 240 */ 406, 138, 103, 284, 39, 393, 288, 395, 431, 51,
/* 250 */ 56, 54, 430, 427, 57, 370, 371, 29, 27, 25,
/* 260 */ 24, 23, 30, 392, 382, 289, 90, 137, 406, 138,
/* 270 */ 3, 254, 39, 393, 117, 395, 431, 28, 26, 316,
/* 280 */ 118, 427, 47, 449, 240, 241, 242, 243, 139, 246,
/* 290 */ 70, 98, 5, 101, 392, 382, 129, 127, 126, 406,
/* 300 */ 138, 122, 43, 44, 393, 119, 395, 274, 30, 59,
/* 310 */ 41, 257, 2, 29, 27, 25, 24, 23, 61, 65,
/* 320 */ 436, 121, 15, 120, 69, 311, 487, 20, 413, 250,
/* 330 */ 99, 455, 42, 29, 27, 25, 24, 23, 253, 50,
/* 340 */ 28, 26, 444, 485, 31, 62, 254, 240, 241, 242,
/* 350 */ 243, 139, 246, 459, 98, 1, 392, 382, 94, 502,
/* 360 */ 137, 406, 138, 136, 484, 39, 393, 72, 395, 431,
/* 370 */ 28, 26, 367, 368, 428, 133, 251, 240, 241, 242,
/* 380 */ 243, 139, 246, 13, 98, 5, 29, 27, 25, 24,
/* 390 */ 23, 115, 110, 108, 392, 382, 12, 30, 137, 406,
/* 400 */ 138, 53, 259, 45, 393, 334, 395, 55, 34, 336,
/* 410 */ 330, 46, 58, 35, 392, 382, 373, 140, 137, 406,
/* 420 */ 138, 329, 111, 81, 393, 100, 395, 392, 382, 112,
/* 430 */ 387, 137, 406, 138, 36, 6, 81, 393, 116, 395,
/* 440 */ 128, 500, 14, 392, 382, 275, 487, 137, 406, 138,
/* 450 */ 309, 308, 81, 393, 92, 395, 392, 382, 33, 50,
/* 460 */ 137, 406, 138, 485, 66, 45, 393, 32, 395, 392,
/* 470 */ 382, 386, 49, 137, 406, 138, 361, 16, 81, 393,
/* 480 */ 97, 395, 37, 11, 356, 355, 74, 95, 360, 392,
/* 490 */ 382, 359, 96, 137, 406, 138, 244, 17, 78, 393,
/* 500 */ 376, 395, 375, 501, 374, 141, 392, 382, 374, 374,
/* 510 */ 137, 406, 138, 374, 374, 75, 393, 374, 395, 392,
/* 520 */ 382, 374, 374, 137, 406, 138, 374, 374, 79, 393,
/* 530 */ 374, 395, 392, 382, 374, 374, 137, 406, 138, 374,
/* 540 */ 374, 76, 393, 374, 395, 392, 382, 374, 374, 137,
/* 550 */ 406, 138, 374, 374, 80, 393, 374, 395, 374, 374,
/* 560 */ 374, 374, 374, 374, 392, 382, 374, 374, 137, 406,
/* 570 */ 138, 374, 374, 403, 393, 374, 395, 374, 392, 382,
/* 580 */ 374, 374, 137, 406, 138, 374, 374, 402, 393, 374,
/* 590 */ 395, 392, 382, 374, 374, 137, 406, 138, 374, 374,
/* 600 */ 401, 393, 374, 395, 392, 382, 374, 374, 137, 406,
/* 610 */ 138, 374, 374, 87, 393, 374, 395, 392, 382, 374,
/* 620 */ 374, 137, 406, 138, 374, 374, 86, 393, 374, 395,
/* 630 */ 392, 382, 374, 374, 137, 406, 138, 374, 374, 88,
/* 640 */ 393, 374, 395, 392, 382, 374, 374, 137, 406, 138,
/* 650 */ 374, 374, 85, 393, 374, 395, 374, 392, 382, 374,
/* 660 */ 374, 137, 406, 138, 374, 374, 82, 393, 374, 395,
/* 670 */ 122, 43, 374, 374, 374, 122, 43, 374, 374, 41,
/* 680 */ 374, 374, 122, 43, 41, 374, 374, 124, 63, 436,
/* 690 */ 437, 41, 441, 48, 436, 437, 374, 441, 374, 374,
/* 700 */ 68, 436, 437, 374, 441,
/* 0 */ 387, 385, 89, 22, 64, 388, 385, 462, 29, 27,
/* 10 */ 25, 24, 23, 395, 385, 138, 410, 138, 410, 139,
/* 20 */ 71, 109, 78, 396, 262, 399, 21, 84, 93, 143,
/* 30 */ 280, 281, 282, 283, 284, 285, 286, 288, 289, 290,
/* 40 */ 29, 27, 25, 24, 23, 395, 385, 138, 410, 138,
/* 50 */ 410, 139, 318, 113, 81, 396, 97, 399, 21, 84,
/* 60 */ 93, 51, 280, 281, 282, 283, 284, 285, 286, 288,
/* 70 */ 289, 290, 128, 395, 385, 114, 447, 138, 410, 139,
/* 80 */ 125, 9, 38, 396, 51, 399, 435, 255, 28, 26,
/* 90 */ 83, 431, 491, 444, 317, 242, 243, 244, 245, 140,
/* 100 */ 248, 491, 98, 1, 343, 490, 67, 10, 106, 489,
/* 110 */ 326, 395, 385, 60, 50, 138, 410, 139, 489, 123,
/* 120 */ 39, 396, 253, 399, 435, 51, 125, 9, 91, 431,
/* 130 */ 105, 341, 342, 344, 345, 395, 385, 73, 466, 138,
/* 140 */ 410, 139, 4, 314, 39, 396, 411, 399, 435, 51,
/* 150 */ 447, 447, 91, 431, 242, 243, 244, 245, 140, 248,
/* 160 */ 395, 385, 487, 8, 138, 410, 139, 443, 442, 39,
/* 170 */ 396, 40, 399, 435, 340, 18, 107, 91, 431, 7,
/* 180 */ 6, 29, 27, 25, 24, 23, 135, 451, 128, 395,
/* 190 */ 385, 7, 6, 138, 410, 139, 28, 26, 77, 396,
/* 200 */ 473, 399, 298, 242, 243, 244, 245, 140, 248, 104,
/* 210 */ 98, 1, 28, 26, 392, 10, 390, 491, 52, 242,
/* 220 */ 243, 244, 245, 140, 248, 248, 98, 5, 102, 54,
/* 230 */ 50, 136, 57, 19, 489, 395, 385, 131, 103, 138,
/* 240 */ 410, 139, 472, 287, 39, 396, 291, 399, 435, 51,
/* 250 */ 373, 374, 434, 431, 25, 24, 23, 29, 27, 25,
/* 260 */ 24, 23, 30, 395, 385, 292, 56, 138, 410, 139,
/* 270 */ 90, 256, 39, 396, 132, 399, 435, 28, 26, 319,
/* 280 */ 118, 431, 3, 453, 242, 243, 244, 245, 140, 248,
/* 290 */ 70, 98, 5, 117, 395, 385, 130, 128, 126, 410,
/* 300 */ 139, 122, 43, 44, 396, 20, 399, 119, 59, 277,
/* 310 */ 41, 29, 27, 25, 24, 23, 101, 133, 47, 65,
/* 320 */ 440, 121, 30, 120, 69, 259, 491, 115, 110, 108,
/* 330 */ 99, 459, 29, 27, 25, 24, 23, 2, 314, 50,
/* 340 */ 28, 26, 127, 489, 61, 16, 417, 242, 243, 244,
/* 350 */ 245, 140, 248, 42, 98, 5, 28, 26, 29, 27,
/* 360 */ 25, 24, 23, 242, 243, 244, 245, 140, 248, 252,
/* 370 */ 98, 1, 395, 385, 262, 255, 138, 410, 139, 31,
/* 380 */ 448, 39, 396, 256, 399, 435, 28, 26, 62, 463,
/* 390 */ 432, 370, 371, 242, 243, 244, 245, 140, 248, 94,
/* 400 */ 98, 5, 506, 137, 488, 395, 385, 253, 134, 138,
/* 410 */ 410, 139, 13, 72, 45, 396, 30, 399, 395, 385,
/* 420 */ 14, 53, 126, 410, 139, 337, 55, 44, 396, 34,
/* 430 */ 399, 395, 385, 339, 46, 138, 410, 139, 58, 35,
/* 440 */ 81, 396, 100, 399, 111, 376, 141, 333, 332, 112,
/* 450 */ 390, 129, 504, 395, 385, 460, 6, 138, 410, 139,
/* 460 */ 36, 15, 81, 396, 116, 399, 312, 278, 395, 385,
/* 470 */ 311, 33, 138, 410, 139, 491, 66, 81, 396, 92,
/* 480 */ 399, 395, 385, 32, 389, 138, 410, 139, 50, 49,
/* 490 */ 45, 396, 489, 399, 395, 385, 260, 364, 138, 410,
/* 500 */ 139, 17, 11, 75, 396, 37, 399, 395, 385, 359,
/* 510 */ 358, 138, 410, 139, 95, 363, 79, 396, 362, 399,
/* 520 */ 29, 27, 25, 24, 23, 96, 395, 385, 505, 12,
/* 530 */ 138, 410, 139, 74, 379, 76, 396, 246, 399, 395,
/* 540 */ 385, 378, 142, 138, 410, 139, 377, 377, 80, 396,
/* 550 */ 377, 399, 395, 385, 377, 377, 138, 410, 139, 377,
/* 560 */ 377, 407, 396, 377, 399, 395, 385, 377, 377, 138,
/* 570 */ 410, 139, 377, 377, 406, 396, 377, 399, 395, 385,
/* 580 */ 377, 377, 138, 410, 139, 377, 377, 405, 396, 377,
/* 590 */ 399, 395, 385, 377, 377, 138, 410, 139, 377, 377,
/* 600 */ 87, 396, 377, 399, 377, 395, 385, 377, 377, 138,
/* 610 */ 410, 139, 377, 377, 86, 396, 377, 399, 395, 385,
/* 620 */ 377, 377, 138, 410, 139, 377, 377, 88, 396, 377,
/* 630 */ 399, 395, 385, 377, 377, 138, 410, 139, 377, 377,
/* 640 */ 85, 396, 377, 399, 395, 385, 377, 377, 138, 410,
/* 650 */ 139, 377, 377, 82, 396, 377, 399, 122, 43, 377,
/* 660 */ 377, 377, 122, 43, 377, 377, 41, 377, 377, 122,
/* 670 */ 43, 41, 377, 377, 124, 63, 440, 441, 41, 445,
/* 680 */ 48, 440, 441, 377, 445, 377, 377, 68, 440, 441,
/* 690 */ 377, 445,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 74, 75, 76, 88, 89, 74, 75, 82, 8, 9,
/* 10 */ 10, 11, 12, 74, 75, 78, 79, 78, 79, 80,
/* 20 */ 122, 84, 83, 84, 24, 86, 26, 27, 28, 13,
/* 30 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
/* 40 */ 8, 9, 10, 11, 12, 10, 11, 12, 22, 23,
/* 50 */ 111, 15, 16, 17, 18, 19, 20, 114, 26, 27,
/* 40 */ 8, 9, 10, 11, 12, 74, 75, 78, 79, 78,
/* 50 */ 79, 80, 4, 84, 83, 84, 85, 86, 26, 27,
/* 60 */ 28, 45, 30, 31, 32, 33, 34, 35, 36, 37,
/* 70 */ 38, 39, 73, 74, 75, 78, 79, 78, 79, 80,
/* 80 */ 4, 84, 83, 84, 22, 86, 87, 22, 8, 9,
/* 90 */ 91, 92, 102, 81, 21, 15, 16, 17, 18, 19,
/* 100 */ 20, 102, 22, 23, 29, 115, 41, 27, 45, 119,
/* 110 */ 98, 74, 75, 107, 115, 78, 79, 80, 119, 100,
/* 120 */ 83, 84, 46, 86, 87, 45, 22, 23, 91, 92,
/* 130 */ 55, 56, 57, 58, 59, 74, 75, 64, 101, 78,
/* 70 */ 38, 39, 73, 74, 75, 22, 81, 78, 79, 80,
/* 80 */ 22, 23, 83, 84, 45, 86, 87, 22, 8, 9,
/* 90 */ 91, 92, 102, 98, 46, 15, 16, 17, 18, 19,
/* 100 */ 20, 102, 22, 23, 29, 115, 41, 27, 114, 119,
/* 110 */ 10, 74, 75, 107, 115, 78, 79, 80, 119, 100,
/* 120 */ 83, 84, 22, 86, 87, 45, 22, 23, 91, 92,
/* 130 */ 55, 56, 57, 58, 59, 74, 75, 116, 101, 78,
/* 140 */ 79, 80, 43, 44, 83, 84, 79, 86, 87, 45,
/* 150 */ 81, 81, 91, 92, 8, 9, 10, 11, 12, 10,
/* 160 */ 74, 75, 101, 116, 78, 79, 80, 98, 98, 83,
/* 170 */ 84, 22, 86, 87, 23, 2, 25, 91, 92, 1,
/* 150 */ 81, 81, 91, 92, 15, 16, 17, 18, 19, 20,
/* 160 */ 74, 75, 101, 103, 78, 79, 80, 98, 98, 83,
/* 170 */ 84, 21, 86, 87, 24, 2, 54, 91, 92, 1,
/* 180 */ 2, 8, 9, 10, 11, 12, 21, 101, 73, 74,
/* 190 */ 75, 1, 2, 78, 79, 80, 8, 9, 83, 84,
/* 200 */ 103, 86, 24, 15, 16, 17, 18, 19, 20, 54,
/* 210 */ 22, 23, 8, 9, 113, 27, 53, 102, 112, 15,
/* 200 */ 113, 86, 24, 15, 16, 17, 18, 19, 20, 53,
/* 210 */ 22, 23, 8, 9, 23, 27, 25, 102, 112, 15,
/* 220 */ 16, 17, 18, 19, 20, 20, 22, 23, 75, 21,
/* 230 */ 115, 66, 24, 26, 119, 74, 75, 3, 113, 78,
/* 240 */ 79, 80, 75, 36, 83, 84, 39, 86, 87, 45,
/* 250 */ 112, 21, 91, 92, 24, 70, 71, 8, 9, 10,
/* 260 */ 11, 12, 21, 74, 75, 24, 75, 78, 79, 80,
/* 270 */ 61, 22, 83, 84, 60, 86, 87, 8, 9, 10,
/* 280 */ 91, 92, 106, 109, 15, 16, 17, 18, 19, 20,
/* 290 */ 41, 22, 23, 48, 74, 75, 62, 73, 78, 79,
/* 300 */ 80, 77, 78, 83, 84, 27, 86, 29, 21, 108,
/* 310 */ 86, 24, 47, 8, 9, 10, 11, 12, 105, 95,
/* 320 */ 96, 97, 23, 99, 104, 44, 102, 2, 90, 22,
/* 330 */ 110, 111, 78, 8, 9, 10, 11, 12, 22, 115,
/* 340 */ 8, 9, 81, 119, 40, 93, 22, 15, 16, 17,
/* 350 */ 18, 19, 20, 82, 22, 23, 74, 75, 69, 123,
/* 360 */ 78, 79, 80, 65, 118, 83, 84, 117, 86, 87,
/* 370 */ 8, 9, 67, 68, 92, 63, 22, 15, 16, 17,
/* 380 */ 18, 19, 20, 49, 22, 23, 8, 9, 10, 11,
/* 390 */ 12, 50, 51, 52, 74, 75, 21, 21, 78, 79,
/* 400 */ 80, 24, 24, 83, 84, 24, 86, 23, 21, 24,
/* 410 */ 24, 23, 23, 23, 74, 75, 72, 73, 78, 79,
/* 420 */ 80, 24, 15, 83, 84, 85, 86, 74, 75, 21,
/* 430 */ 25, 78, 79, 80, 23, 2, 83, 84, 85, 86,
/* 440 */ 120, 121, 49, 74, 75, 29, 102, 78, 79, 80,
/* 450 */ 24, 24, 83, 84, 85, 86, 74, 75, 21, 115,
/* 460 */ 78, 79, 80, 119, 25, 83, 84, 42, 86, 74,
/* 470 */ 75, 25, 25, 78, 79, 80, 24, 21, 83, 84,
/* 480 */ 85, 86, 4, 49, 15, 15, 25, 15, 15, 74,
/* 490 */ 75, 15, 15, 78, 79, 80, 17, 23, 83, 84,
/* 500 */ 0, 86, 0, 121, 124, 14, 74, 75, 124, 124,
/* 510 */ 78, 79, 80, 124, 124, 83, 84, 124, 86, 74,
/* 520 */ 75, 124, 124, 78, 79, 80, 124, 124, 83, 84,
/* 530 */ 124, 86, 74, 75, 124, 124, 78, 79, 80, 124,
/* 540 */ 124, 83, 84, 124, 86, 74, 75, 124, 124, 78,
/* 550 */ 79, 80, 124, 124, 83, 84, 124, 86, 124, 124,
/* 560 */ 124, 124, 124, 124, 74, 75, 124, 124, 78, 79,
/* 570 */ 80, 124, 124, 83, 84, 124, 86, 124, 74, 75,
/* 230 */ 115, 66, 24, 26, 119, 74, 75, 3, 75, 78,
/* 240 */ 79, 80, 113, 36, 83, 84, 39, 86, 87, 45,
/* 250 */ 70, 71, 91, 92, 10, 11, 12, 8, 9, 10,
/* 260 */ 11, 12, 21, 74, 75, 24, 112, 78, 79, 80,
/* 270 */ 75, 22, 83, 84, 21, 86, 87, 8, 9, 10,
/* 280 */ 91, 92, 61, 109, 15, 16, 17, 18, 19, 20,
/* 290 */ 41, 22, 23, 60, 74, 75, 62, 73, 78, 79,
/* 300 */ 80, 77, 78, 83, 84, 2, 86, 27, 108, 29,
/* 310 */ 86, 8, 9, 10, 11, 12, 48, 64, 106, 95,
/* 320 */ 96, 97, 21, 99, 104, 24, 102, 50, 51, 52,
/* 330 */ 110, 111, 8, 9, 10, 11, 12, 47, 44, 115,
/* 340 */ 8, 9, 10, 119, 105, 23, 90, 15, 16, 17,
/* 350 */ 18, 19, 20, 78, 22, 23, 8, 9, 8, 9,
/* 360 */ 10, 11, 12, 15, 16, 17, 18, 19, 20, 22,
/* 370 */ 22, 23, 74, 75, 24, 22, 78, 79, 80, 40,
/* 380 */ 81, 83, 84, 22, 86, 87, 8, 9, 93, 82,
/* 390 */ 92, 67, 68, 15, 16, 17, 18, 19, 20, 69,
/* 400 */ 22, 23, 123, 65, 118, 74, 75, 22, 63, 78,
/* 410 */ 79, 80, 21, 117, 83, 84, 21, 86, 74, 75,
/* 420 */ 49, 24, 78, 79, 80, 24, 23, 83, 84, 21,
/* 430 */ 86, 74, 75, 24, 23, 78, 79, 80, 23, 23,
/* 440 */ 83, 84, 85, 86, 15, 72, 73, 24, 24, 21,
/* 450 */ 25, 120, 121, 74, 75, 111, 2, 78, 79, 80,
/* 460 */ 23, 49, 83, 84, 85, 86, 24, 29, 74, 75,
/* 470 */ 24, 21, 78, 79, 80, 102, 25, 83, 84, 85,
/* 480 */ 86, 74, 75, 42, 25, 78, 79, 80, 115, 25,
/* 490 */ 83, 84, 119, 86, 74, 75, 24, 24, 78, 79,
/* 500 */ 80, 21, 49, 83, 84, 4, 86, 74, 75, 15,
/* 510 */ 15, 78, 79, 80, 15, 15, 83, 84, 15, 86,
/* 520 */ 8, 9, 10, 11, 12, 15, 74, 75, 121, 23,
/* 530 */ 78, 79, 80, 25, 0, 83, 84, 17, 86, 74,
/* 540 */ 75, 0, 14, 78, 79, 80, 124, 124, 83, 84,
/* 550 */ 124, 86, 74, 75, 124, 124, 78, 79, 80, 124,
/* 560 */ 124, 83, 84, 124, 86, 74, 75, 124, 124, 78,
/* 570 */ 79, 80, 124, 124, 83, 84, 124, 86, 74, 75,
/* 580 */ 124, 124, 78, 79, 80, 124, 124, 83, 84, 124,
/* 590 */ 86, 74, 75, 124, 124, 78, 79, 80, 124, 124,
/* 600 */ 83, 84, 124, 86, 74, 75, 124, 124, 78, 79,
/* 610 */ 80, 124, 124, 83, 84, 124, 86, 74, 75, 124,
/* 620 */ 124, 78, 79, 80, 124, 124, 83, 84, 124, 86,
/* 630 */ 74, 75, 124, 124, 78, 79, 80, 124, 124, 83,
/* 640 */ 84, 124, 86, 74, 75, 124, 124, 78, 79, 80,
/* 650 */ 124, 124, 83, 84, 124, 86, 124, 74, 75, 124,
/* 660 */ 124, 78, 79, 80, 124, 124, 83, 84, 124, 86,
/* 670 */ 77, 78, 124, 124, 124, 77, 78, 124, 124, 86,
/* 680 */ 124, 124, 77, 78, 86, 124, 124, 94, 95, 96,
/* 690 */ 97, 86, 99, 95, 96, 97, 124, 99, 124, 124,
/* 700 */ 95, 96, 97, 124, 99,
/* 600 */ 83, 84, 124, 86, 124, 74, 75, 124, 124, 78,
/* 610 */ 79, 80, 124, 124, 83, 84, 124, 86, 74, 75,
/* 620 */ 124, 124, 78, 79, 80, 124, 124, 83, 84, 124,
/* 630 */ 86, 74, 75, 124, 124, 78, 79, 80, 124, 124,
/* 640 */ 83, 84, 124, 86, 74, 75, 124, 124, 78, 79,
/* 650 */ 80, 124, 124, 83, 84, 124, 86, 77, 78, 124,
/* 660 */ 124, 124, 77, 78, 124, 124, 86, 124, 124, 77,
/* 670 */ 78, 86, 124, 124, 94, 95, 96, 97, 86, 99,
/* 680 */ 95, 96, 97, 124, 99, 124, 124, 95, 96, 97,
/* 690 */ 124, 99,
};
#define YY_SHIFT_COUNT (142)
#define YY_SHIFT_COUNT (143)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (502)
#define YY_SHIFT_MAX (541)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 16, 80, 188, 188, 188, 204, 188, 188, 269, 104,
/* 10 */ 332, 362, 362, 362, 362, 362, 362, 362, 362, 362,
/* 20 */ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
/* 30 */ 362, 26, 26, 26, 36, 62, 62, 63, 0, 32,
/* 40 */ 36, 65, 65, 65, 249, 305, 75, 341, 99, 149,
/* 50 */ 234, 76, 155, 163, 205, 205, 155, 163, 205, 209,
/* 60 */ 214, 245, 265, 281, 299, 281, 307, 316, 281, 304,
/* 70 */ 324, 289, 298, 312, 354, 173, 325, 378, 146, 146,
/* 80 */ 146, 146, 146, 178, 207, 35, 35, 35, 35, 208,
/* 90 */ 230, 190, 241, 278, 185, 73, 165, 287, 151, 375,
/* 100 */ 376, 334, 377, 381, 384, 387, 385, 388, 389, 386,
/* 110 */ 390, 397, 407, 408, 405, 411, 376, 393, 433, 416,
/* 120 */ 426, 427, 439, 425, 437, 446, 447, 452, 456, 434,
/* 130 */ 478, 469, 470, 472, 473, 476, 477, 461, 474, 479,
/* 140 */ 500, 502, 491,
/* 10 */ 348, 378, 332, 378, 378, 378, 378, 378, 378, 378,
/* 20 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378,
/* 30 */ 378, 58, 58, 58, 139, 53, 53, 39, 0, 32,
/* 40 */ 139, 65, 65, 65, 249, 324, 75, 277, 99, 100,
/* 50 */ 234, 48, 122, 156, 205, 205, 122, 156, 205, 221,
/* 60 */ 233, 268, 290, 294, 322, 294, 347, 353, 294, 339,
/* 70 */ 361, 330, 338, 345, 385, 173, 303, 350, 512, 512,
/* 80 */ 512, 512, 512, 178, 207, 244, 244, 244, 244, 150,
/* 90 */ 208, 190, 241, 280, 180, 253, 165, 301, 191, 391,
/* 100 */ 395, 371, 397, 401, 403, 408, 409, 411, 415, 423,
/* 110 */ 416, 424, 429, 428, 425, 437, 395, 412, 454, 438,
/* 120 */ 442, 446, 451, 441, 450, 459, 464, 472, 473, 480,
/* 130 */ 453, 501, 494, 495, 499, 500, 503, 510, 508, 506,
/* 140 */ 520, 534, 541, 528,
};
#define YY_REDUCE_COUNT (74)
#define YY_REDUCE_MIN (-102)
#define YY_REDUCE_MAX (605)
#define YY_REDUCE_MAX (592)
static const short yy_reduce_ofst[] = {
/* 0 */ 344, -1, 37, 61, 86, 115, 161, 189, 220, 224,
/* 10 */ 282, 320, -61, 340, 353, 369, 382, 395, 415, 432,
/* 20 */ 445, 458, 471, 490, 504, 517, 530, 543, 556, 569,
/* 30 */ 583, 593, 598, 605, -74, -63, -3, -10, -85, -85,
/* 40 */ -69, 12, 69, 70, -75, -102, -57, 6, 19, 67,
/* 50 */ 47, 97, 101, 106, 153, 167, 125, 138, 191, 174,
/* 60 */ 201, 176, 213, 19, 238, 19, 254, 261, 19, 252,
/* 70 */ 271, 236, 246, 250, 67,
/* 0 */ 373, -1, 37, 61, 86, 115, 161, 189, 220, 224,
/* 10 */ 298, 331, -29, 344, 357, 379, 394, 407, -61, 420,
/* 20 */ 433, 452, 465, 478, 491, 504, 517, 531, 544, 557,
/* 30 */ 570, 580, 585, 592, -74, -63, -31, -10, -85, -85,
/* 40 */ -69, -5, 69, 70, -75, -102, -6, 6, 19, 67,
/* 50 */ 21, 60, 87, 106, 153, 163, 129, 154, 195, 174,
/* 60 */ 200, 212, 239, 19, 256, 19, 275, 299, 19, 295,
/* 70 */ 307, 279, 286, 296, 67,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
/* 10 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
/* 20 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
/* 30 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
/* 40 */ 372, 442, 442, 442, 457, 503, 372, 465, 372, 372,
/* 50 */ 488, 450, 472, 470, 372, 372, 472, 470, 372, 482,
/* 60 */ 480, 463, 461, 434, 372, 372, 372, 372, 435, 372,
/* 70 */ 372, 506, 494, 490, 372, 372, 372, 372, 410, 409,
/* 80 */ 408, 404, 405, 372, 372, 399, 400, 398, 397, 372,
/* 90 */ 372, 499, 372, 372, 372, 491, 495, 372, 388, 454,
/* 100 */ 464, 372, 372, 372, 372, 372, 372, 372, 372, 372,
/* 110 */ 372, 372, 372, 372, 388, 372, 481, 372, 429, 372,
/* 120 */ 441, 437, 372, 372, 433, 387, 372, 372, 489, 372,
/* 130 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
/* 140 */ 372, 372, 372,
/* 0 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
/* 10 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
/* 20 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
/* 30 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
/* 40 */ 375, 446, 446, 446, 461, 507, 375, 469, 375, 375,
/* 50 */ 492, 454, 476, 474, 375, 375, 476, 474, 375, 486,
/* 60 */ 484, 467, 465, 438, 375, 375, 375, 375, 439, 375,
/* 70 */ 375, 510, 498, 494, 375, 375, 375, 375, 414, 413,
/* 80 */ 412, 408, 409, 375, 375, 403, 404, 402, 401, 375,
/* 90 */ 375, 503, 375, 375, 375, 495, 499, 375, 391, 458,
/* 100 */ 468, 375, 375, 375, 375, 375, 375, 375, 375, 375,
/* 110 */ 375, 375, 375, 375, 391, 375, 485, 375, 433, 375,
/* 120 */ 445, 441, 375, 375, 437, 390, 375, 375, 375, 493,
/* 130 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
/* 140 */ 375, 375, 375, 375,
};
/********** End of lemon-generated parsing tables *****************************/
......@@ -668,120 +666,121 @@ static const char *const yyRuleName[] = {
/* 17 */ "expression ::= literal",
/* 18 */ "expression ::= column_reference",
/* 19 */ "expression ::= function_name NK_LP expression_list NK_RP",
/* 20 */ "expression ::= subquery",
/* 21 */ "expression ::= NK_LP expression NK_RP",
/* 22 */ "expression ::= NK_PLUS expression",
/* 23 */ "expression ::= NK_MINUS expression",
/* 24 */ "expression ::= expression NK_PLUS expression",
/* 25 */ "expression ::= expression NK_MINUS expression",
/* 26 */ "expression ::= expression NK_STAR expression",
/* 27 */ "expression ::= expression NK_SLASH expression",
/* 28 */ "expression ::= expression NK_REM expression",
/* 29 */ "expression_list ::= expression",
/* 30 */ "expression_list ::= expression_list NK_COMMA expression",
/* 31 */ "column_reference ::= column_name",
/* 32 */ "column_reference ::= table_name NK_DOT column_name",
/* 33 */ "predicate ::= expression compare_op expression",
/* 34 */ "predicate ::= expression BETWEEN expression AND expression",
/* 35 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 36 */ "predicate ::= expression IS NULL",
/* 37 */ "predicate ::= expression IS NOT NULL",
/* 38 */ "predicate ::= expression in_op in_predicate_value",
/* 39 */ "compare_op ::= NK_LT",
/* 40 */ "compare_op ::= NK_GT",
/* 41 */ "compare_op ::= NK_LE",
/* 42 */ "compare_op ::= NK_GE",
/* 43 */ "compare_op ::= NK_NE",
/* 44 */ "compare_op ::= NK_EQ",
/* 45 */ "compare_op ::= LIKE",
/* 46 */ "compare_op ::= NOT LIKE",
/* 47 */ "compare_op ::= MATCH",
/* 48 */ "compare_op ::= NMATCH",
/* 49 */ "in_op ::= IN",
/* 50 */ "in_op ::= NOT IN",
/* 51 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 52 */ "boolean_value_expression ::= boolean_primary",
/* 53 */ "boolean_value_expression ::= NOT boolean_primary",
/* 54 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 55 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 56 */ "boolean_primary ::= predicate",
/* 57 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 58 */ "from_clause ::= FROM table_reference_list",
/* 59 */ "table_reference_list ::= table_reference",
/* 60 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 61 */ "table_reference ::= table_primary",
/* 62 */ "table_reference ::= joined_table",
/* 63 */ "table_primary ::= table_name alias_opt",
/* 64 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 65 */ "table_primary ::= subquery alias_opt",
/* 66 */ "table_primary ::= parenthesized_joined_table",
/* 67 */ "alias_opt ::=",
/* 68 */ "alias_opt ::= table_alias",
/* 69 */ "alias_opt ::= AS table_alias",
/* 70 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 71 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 72 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 73 */ "join_type ::= INNER",
/* 74 */ "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",
/* 75 */ "set_quantifier_opt ::=",
/* 76 */ "set_quantifier_opt ::= DISTINCT",
/* 77 */ "set_quantifier_opt ::= ALL",
/* 78 */ "select_list ::= NK_STAR",
/* 79 */ "select_list ::= select_sublist",
/* 80 */ "select_sublist ::= select_item",
/* 81 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 82 */ "select_item ::= expression",
/* 83 */ "select_item ::= expression column_alias",
/* 84 */ "select_item ::= expression AS column_alias",
/* 85 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 86 */ "where_clause_opt ::=",
/* 87 */ "where_clause_opt ::= WHERE search_condition",
/* 88 */ "partition_by_clause_opt ::=",
/* 89 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 90 */ "twindow_clause_opt ::=",
/* 91 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
/* 92 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
/* 93 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 94 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 95 */ "sliding_opt ::=",
/* 96 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 97 */ "fill_opt ::=",
/* 98 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 99 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 100 */ "fill_mode ::= NONE",
/* 101 */ "fill_mode ::= PREV",
/* 102 */ "fill_mode ::= NULL",
/* 103 */ "fill_mode ::= LINEAR",
/* 104 */ "fill_mode ::= NEXT",
/* 105 */ "group_by_clause_opt ::=",
/* 106 */ "group_by_clause_opt ::= GROUP BY expression_list",
/* 107 */ "having_clause_opt ::=",
/* 108 */ "having_clause_opt ::= HAVING search_condition",
/* 109 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 110 */ "query_expression_body ::= query_primary",
/* 111 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 112 */ "query_primary ::= query_specification",
/* 113 */ "order_by_clause_opt ::=",
/* 114 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 115 */ "slimit_clause_opt ::=",
/* 116 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 117 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 118 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 119 */ "limit_clause_opt ::=",
/* 120 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 121 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 122 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 123 */ "subquery ::= NK_LP query_expression NK_RP",
/* 124 */ "search_condition ::= boolean_value_expression",
/* 125 */ "sort_specification_list ::= sort_specification",
/* 126 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 127 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 128 */ "ordering_specification_opt ::=",
/* 129 */ "ordering_specification_opt ::= ASC",
/* 130 */ "ordering_specification_opt ::= DESC",
/* 131 */ "null_ordering_opt ::=",
/* 132 */ "null_ordering_opt ::= NULLS FIRST",
/* 133 */ "null_ordering_opt ::= NULLS LAST",
/* 20 */ "expression ::= function_name NK_LP NK_STAR NK_RP",
/* 21 */ "expression ::= subquery",
/* 22 */ "expression ::= NK_LP expression NK_RP",
/* 23 */ "expression ::= NK_PLUS expression",
/* 24 */ "expression ::= NK_MINUS expression",
/* 25 */ "expression ::= expression NK_PLUS expression",
/* 26 */ "expression ::= expression NK_MINUS expression",
/* 27 */ "expression ::= expression NK_STAR expression",
/* 28 */ "expression ::= expression NK_SLASH expression",
/* 29 */ "expression ::= expression NK_REM expression",
/* 30 */ "expression_list ::= expression",
/* 31 */ "expression_list ::= expression_list NK_COMMA expression",
/* 32 */ "column_reference ::= column_name",
/* 33 */ "column_reference ::= table_name NK_DOT column_name",
/* 34 */ "predicate ::= expression compare_op expression",
/* 35 */ "predicate ::= expression BETWEEN expression AND expression",
/* 36 */ "predicate ::= expression NOT BETWEEN expression AND expression",
/* 37 */ "predicate ::= expression IS NULL",
/* 38 */ "predicate ::= expression IS NOT NULL",
/* 39 */ "predicate ::= expression in_op in_predicate_value",
/* 40 */ "compare_op ::= NK_LT",
/* 41 */ "compare_op ::= NK_GT",
/* 42 */ "compare_op ::= NK_LE",
/* 43 */ "compare_op ::= NK_GE",
/* 44 */ "compare_op ::= NK_NE",
/* 45 */ "compare_op ::= NK_EQ",
/* 46 */ "compare_op ::= LIKE",
/* 47 */ "compare_op ::= NOT LIKE",
/* 48 */ "compare_op ::= MATCH",
/* 49 */ "compare_op ::= NMATCH",
/* 50 */ "in_op ::= IN",
/* 51 */ "in_op ::= NOT IN",
/* 52 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
/* 53 */ "boolean_value_expression ::= boolean_primary",
/* 54 */ "boolean_value_expression ::= NOT boolean_primary",
/* 55 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
/* 56 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
/* 57 */ "boolean_primary ::= predicate",
/* 58 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
/* 59 */ "from_clause ::= FROM table_reference_list",
/* 60 */ "table_reference_list ::= table_reference",
/* 61 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
/* 62 */ "table_reference ::= table_primary",
/* 63 */ "table_reference ::= joined_table",
/* 64 */ "table_primary ::= table_name alias_opt",
/* 65 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
/* 66 */ "table_primary ::= subquery alias_opt",
/* 67 */ "table_primary ::= parenthesized_joined_table",
/* 68 */ "alias_opt ::=",
/* 69 */ "alias_opt ::= table_alias",
/* 70 */ "alias_opt ::= AS table_alias",
/* 71 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
/* 72 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
/* 73 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
/* 74 */ "join_type ::= INNER",
/* 75 */ "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",
/* 76 */ "set_quantifier_opt ::=",
/* 77 */ "set_quantifier_opt ::= DISTINCT",
/* 78 */ "set_quantifier_opt ::= ALL",
/* 79 */ "select_list ::= NK_STAR",
/* 80 */ "select_list ::= select_sublist",
/* 81 */ "select_sublist ::= select_item",
/* 82 */ "select_sublist ::= select_sublist NK_COMMA select_item",
/* 83 */ "select_item ::= expression",
/* 84 */ "select_item ::= expression column_alias",
/* 85 */ "select_item ::= expression AS column_alias",
/* 86 */ "select_item ::= table_name NK_DOT NK_STAR",
/* 87 */ "where_clause_opt ::=",
/* 88 */ "where_clause_opt ::= WHERE search_condition",
/* 89 */ "partition_by_clause_opt ::=",
/* 90 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
/* 91 */ "twindow_clause_opt ::=",
/* 92 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP",
/* 93 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP",
/* 94 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
/* 95 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
/* 96 */ "sliding_opt ::=",
/* 97 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
/* 98 */ "fill_opt ::=",
/* 99 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
/* 100 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
/* 101 */ "fill_mode ::= NONE",
/* 102 */ "fill_mode ::= PREV",
/* 103 */ "fill_mode ::= NULL",
/* 104 */ "fill_mode ::= LINEAR",
/* 105 */ "fill_mode ::= NEXT",
/* 106 */ "group_by_clause_opt ::=",
/* 107 */ "group_by_clause_opt ::= GROUP BY expression_list",
/* 108 */ "having_clause_opt ::=",
/* 109 */ "having_clause_opt ::= HAVING search_condition",
/* 110 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
/* 111 */ "query_expression_body ::= query_primary",
/* 112 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
/* 113 */ "query_primary ::= query_specification",
/* 114 */ "order_by_clause_opt ::=",
/* 115 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
/* 116 */ "slimit_clause_opt ::=",
/* 117 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
/* 118 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
/* 119 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 120 */ "limit_clause_opt ::=",
/* 121 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
/* 122 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
/* 123 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
/* 124 */ "subquery ::= NK_LP query_expression NK_RP",
/* 125 */ "search_condition ::= boolean_value_expression",
/* 126 */ "sort_specification_list ::= sort_specification",
/* 127 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
/* 128 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
/* 129 */ "ordering_specification_opt ::=",
/* 130 */ "ordering_specification_opt ::= ASC",
/* 131 */ "ordering_specification_opt ::= DESC",
/* 132 */ "null_ordering_opt ::=",
/* 133 */ "null_ordering_opt ::= NULLS FIRST",
/* 134 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
......@@ -1310,120 +1309,121 @@ static const struct {
{ 83, -1 }, /* (17) expression ::= literal */
{ 83, -1 }, /* (18) expression ::= column_reference */
{ 83, -4 }, /* (19) expression ::= function_name NK_LP expression_list NK_RP */
{ 83, -1 }, /* (20) expression ::= subquery */
{ 83, -3 }, /* (21) expression ::= NK_LP expression NK_RP */
{ 83, -2 }, /* (22) expression ::= NK_PLUS expression */
{ 83, -2 }, /* (23) expression ::= NK_MINUS expression */
{ 83, -3 }, /* (24) expression ::= expression NK_PLUS expression */
{ 83, -3 }, /* (25) expression ::= expression NK_MINUS expression */
{ 83, -3 }, /* (26) expression ::= expression NK_STAR expression */
{ 83, -3 }, /* (27) expression ::= expression NK_SLASH expression */
{ 83, -3 }, /* (28) expression ::= expression NK_REM expression */
{ 85, -1 }, /* (29) expression_list ::= expression */
{ 85, -3 }, /* (30) expression_list ::= expression_list NK_COMMA expression */
{ 84, -1 }, /* (31) column_reference ::= column_name */
{ 84, -3 }, /* (32) column_reference ::= table_name NK_DOT column_name */
{ 87, -3 }, /* (33) predicate ::= expression compare_op expression */
{ 87, -5 }, /* (34) predicate ::= expression BETWEEN expression AND expression */
{ 87, -6 }, /* (35) predicate ::= expression NOT BETWEEN expression AND expression */
{ 87, -3 }, /* (36) predicate ::= expression IS NULL */
{ 87, -4 }, /* (37) predicate ::= expression IS NOT NULL */
{ 87, -3 }, /* (38) predicate ::= expression in_op in_predicate_value */
{ 88, -1 }, /* (39) compare_op ::= NK_LT */
{ 88, -1 }, /* (40) compare_op ::= NK_GT */
{ 88, -1 }, /* (41) compare_op ::= NK_LE */
{ 88, -1 }, /* (42) compare_op ::= NK_GE */
{ 88, -1 }, /* (43) compare_op ::= NK_NE */
{ 88, -1 }, /* (44) compare_op ::= NK_EQ */
{ 88, -1 }, /* (45) compare_op ::= LIKE */
{ 88, -2 }, /* (46) compare_op ::= NOT LIKE */
{ 88, -1 }, /* (47) compare_op ::= MATCH */
{ 88, -1 }, /* (48) compare_op ::= NMATCH */
{ 89, -1 }, /* (49) in_op ::= IN */
{ 89, -2 }, /* (50) in_op ::= NOT IN */
{ 90, -3 }, /* (51) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 91, -1 }, /* (52) boolean_value_expression ::= boolean_primary */
{ 91, -2 }, /* (53) boolean_value_expression ::= NOT boolean_primary */
{ 91, -3 }, /* (54) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 91, -3 }, /* (55) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 92, -1 }, /* (56) boolean_primary ::= predicate */
{ 92, -3 }, /* (57) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 93, -2 }, /* (58) from_clause ::= FROM table_reference_list */
{ 94, -1 }, /* (59) table_reference_list ::= table_reference */
{ 94, -3 }, /* (60) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 95, -1 }, /* (61) table_reference ::= table_primary */
{ 95, -1 }, /* (62) table_reference ::= joined_table */
{ 96, -2 }, /* (63) table_primary ::= table_name alias_opt */
{ 96, -4 }, /* (64) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 96, -2 }, /* (65) table_primary ::= subquery alias_opt */
{ 96, -1 }, /* (66) table_primary ::= parenthesized_joined_table */
{ 98, 0 }, /* (67) alias_opt ::= */
{ 98, -1 }, /* (68) alias_opt ::= table_alias */
{ 98, -2 }, /* (69) alias_opt ::= AS table_alias */
{ 99, -3 }, /* (70) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 99, -3 }, /* (71) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 97, -6 }, /* (72) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 100, -1 }, /* (73) join_type ::= INNER */
{ 102, -9 }, /* (74) 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 */
{ 103, 0 }, /* (75) set_quantifier_opt ::= */
{ 103, -1 }, /* (76) set_quantifier_opt ::= DISTINCT */
{ 103, -1 }, /* (77) set_quantifier_opt ::= ALL */
{ 104, -1 }, /* (78) select_list ::= NK_STAR */
{ 104, -1 }, /* (79) select_list ::= select_sublist */
{ 110, -1 }, /* (80) select_sublist ::= select_item */
{ 110, -3 }, /* (81) select_sublist ::= select_sublist NK_COMMA select_item */
{ 111, -1 }, /* (82) select_item ::= expression */
{ 111, -2 }, /* (83) select_item ::= expression column_alias */
{ 111, -3 }, /* (84) select_item ::= expression AS column_alias */
{ 111, -3 }, /* (85) select_item ::= table_name NK_DOT NK_STAR */
{ 105, 0 }, /* (86) where_clause_opt ::= */
{ 105, -2 }, /* (87) where_clause_opt ::= WHERE search_condition */
{ 106, 0 }, /* (88) partition_by_clause_opt ::= */
{ 106, -3 }, /* (89) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 107, 0 }, /* (90) twindow_clause_opt ::= */
{ 107, -6 }, /* (91) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ 107, -4 }, /* (92) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ 107, -6 }, /* (93) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 107, -8 }, /* (94) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 112, 0 }, /* (95) sliding_opt ::= */
{ 112, -4 }, /* (96) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 113, 0 }, /* (97) fill_opt ::= */
{ 113, -4 }, /* (98) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 113, -6 }, /* (99) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 114, -1 }, /* (100) fill_mode ::= NONE */
{ 114, -1 }, /* (101) fill_mode ::= PREV */
{ 114, -1 }, /* (102) fill_mode ::= NULL */
{ 114, -1 }, /* (103) fill_mode ::= LINEAR */
{ 114, -1 }, /* (104) fill_mode ::= NEXT */
{ 108, 0 }, /* (105) group_by_clause_opt ::= */
{ 108, -3 }, /* (106) group_by_clause_opt ::= GROUP BY expression_list */
{ 109, 0 }, /* (107) having_clause_opt ::= */
{ 109, -2 }, /* (108) having_clause_opt ::= HAVING search_condition */
{ 73, -4 }, /* (109) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 115, -1 }, /* (110) query_expression_body ::= query_primary */
{ 115, -4 }, /* (111) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 119, -1 }, /* (112) query_primary ::= query_specification */
{ 116, 0 }, /* (113) order_by_clause_opt ::= */
{ 116, -3 }, /* (114) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 117, 0 }, /* (115) slimit_clause_opt ::= */
{ 117, -2 }, /* (116) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 117, -4 }, /* (117) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 117, -4 }, /* (118) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 118, 0 }, /* (119) limit_clause_opt ::= */
{ 118, -2 }, /* (120) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 118, -4 }, /* (121) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 118, -4 }, /* (122) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 86, -3 }, /* (123) subquery ::= NK_LP query_expression NK_RP */
{ 101, -1 }, /* (124) search_condition ::= boolean_value_expression */
{ 120, -1 }, /* (125) sort_specification_list ::= sort_specification */
{ 120, -3 }, /* (126) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 121, -3 }, /* (127) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 122, 0 }, /* (128) ordering_specification_opt ::= */
{ 122, -1 }, /* (129) ordering_specification_opt ::= ASC */
{ 122, -1 }, /* (130) ordering_specification_opt ::= DESC */
{ 123, 0 }, /* (131) null_ordering_opt ::= */
{ 123, -2 }, /* (132) null_ordering_opt ::= NULLS FIRST */
{ 123, -2 }, /* (133) null_ordering_opt ::= NULLS LAST */
{ 83, -4 }, /* (20) expression ::= function_name NK_LP NK_STAR NK_RP */
{ 83, -1 }, /* (21) expression ::= subquery */
{ 83, -3 }, /* (22) expression ::= NK_LP expression NK_RP */
{ 83, -2 }, /* (23) expression ::= NK_PLUS expression */
{ 83, -2 }, /* (24) expression ::= NK_MINUS expression */
{ 83, -3 }, /* (25) expression ::= expression NK_PLUS expression */
{ 83, -3 }, /* (26) expression ::= expression NK_MINUS expression */
{ 83, -3 }, /* (27) expression ::= expression NK_STAR expression */
{ 83, -3 }, /* (28) expression ::= expression NK_SLASH expression */
{ 83, -3 }, /* (29) expression ::= expression NK_REM expression */
{ 85, -1 }, /* (30) expression_list ::= expression */
{ 85, -3 }, /* (31) expression_list ::= expression_list NK_COMMA expression */
{ 84, -1 }, /* (32) column_reference ::= column_name */
{ 84, -3 }, /* (33) column_reference ::= table_name NK_DOT column_name */
{ 87, -3 }, /* (34) predicate ::= expression compare_op expression */
{ 87, -5 }, /* (35) predicate ::= expression BETWEEN expression AND expression */
{ 87, -6 }, /* (36) predicate ::= expression NOT BETWEEN expression AND expression */
{ 87, -3 }, /* (37) predicate ::= expression IS NULL */
{ 87, -4 }, /* (38) predicate ::= expression IS NOT NULL */
{ 87, -3 }, /* (39) predicate ::= expression in_op in_predicate_value */
{ 88, -1 }, /* (40) compare_op ::= NK_LT */
{ 88, -1 }, /* (41) compare_op ::= NK_GT */
{ 88, -1 }, /* (42) compare_op ::= NK_LE */
{ 88, -1 }, /* (43) compare_op ::= NK_GE */
{ 88, -1 }, /* (44) compare_op ::= NK_NE */
{ 88, -1 }, /* (45) compare_op ::= NK_EQ */
{ 88, -1 }, /* (46) compare_op ::= LIKE */
{ 88, -2 }, /* (47) compare_op ::= NOT LIKE */
{ 88, -1 }, /* (48) compare_op ::= MATCH */
{ 88, -1 }, /* (49) compare_op ::= NMATCH */
{ 89, -1 }, /* (50) in_op ::= IN */
{ 89, -2 }, /* (51) in_op ::= NOT IN */
{ 90, -3 }, /* (52) in_predicate_value ::= NK_LP expression_list NK_RP */
{ 91, -1 }, /* (53) boolean_value_expression ::= boolean_primary */
{ 91, -2 }, /* (54) boolean_value_expression ::= NOT boolean_primary */
{ 91, -3 }, /* (55) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ 91, -3 }, /* (56) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ 92, -1 }, /* (57) boolean_primary ::= predicate */
{ 92, -3 }, /* (58) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
{ 93, -2 }, /* (59) from_clause ::= FROM table_reference_list */
{ 94, -1 }, /* (60) table_reference_list ::= table_reference */
{ 94, -3 }, /* (61) table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ 95, -1 }, /* (62) table_reference ::= table_primary */
{ 95, -1 }, /* (63) table_reference ::= joined_table */
{ 96, -2 }, /* (64) table_primary ::= table_name alias_opt */
{ 96, -4 }, /* (65) table_primary ::= db_name NK_DOT table_name alias_opt */
{ 96, -2 }, /* (66) table_primary ::= subquery alias_opt */
{ 96, -1 }, /* (67) table_primary ::= parenthesized_joined_table */
{ 98, 0 }, /* (68) alias_opt ::= */
{ 98, -1 }, /* (69) alias_opt ::= table_alias */
{ 98, -2 }, /* (70) alias_opt ::= AS table_alias */
{ 99, -3 }, /* (71) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
{ 99, -3 }, /* (72) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
{ 97, -6 }, /* (73) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ 100, -1 }, /* (74) join_type ::= INNER */
{ 102, -9 }, /* (75) 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 */
{ 103, 0 }, /* (76) set_quantifier_opt ::= */
{ 103, -1 }, /* (77) set_quantifier_opt ::= DISTINCT */
{ 103, -1 }, /* (78) set_quantifier_opt ::= ALL */
{ 104, -1 }, /* (79) select_list ::= NK_STAR */
{ 104, -1 }, /* (80) select_list ::= select_sublist */
{ 110, -1 }, /* (81) select_sublist ::= select_item */
{ 110, -3 }, /* (82) select_sublist ::= select_sublist NK_COMMA select_item */
{ 111, -1 }, /* (83) select_item ::= expression */
{ 111, -2 }, /* (84) select_item ::= expression column_alias */
{ 111, -3 }, /* (85) select_item ::= expression AS column_alias */
{ 111, -3 }, /* (86) select_item ::= table_name NK_DOT NK_STAR */
{ 105, 0 }, /* (87) where_clause_opt ::= */
{ 105, -2 }, /* (88) where_clause_opt ::= WHERE search_condition */
{ 106, 0 }, /* (89) partition_by_clause_opt ::= */
{ 106, -3 }, /* (90) partition_by_clause_opt ::= PARTITION BY expression_list */
{ 107, 0 }, /* (91) twindow_clause_opt ::= */
{ 107, -6 }, /* (92) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ 107, -4 }, /* (93) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ 107, -6 }, /* (94) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 107, -8 }, /* (95) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 112, 0 }, /* (96) sliding_opt ::= */
{ 112, -4 }, /* (97) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 113, 0 }, /* (98) fill_opt ::= */
{ 113, -4 }, /* (99) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 113, -6 }, /* (100) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ 114, -1 }, /* (101) fill_mode ::= NONE */
{ 114, -1 }, /* (102) fill_mode ::= PREV */
{ 114, -1 }, /* (103) fill_mode ::= NULL */
{ 114, -1 }, /* (104) fill_mode ::= LINEAR */
{ 114, -1 }, /* (105) fill_mode ::= NEXT */
{ 108, 0 }, /* (106) group_by_clause_opt ::= */
{ 108, -3 }, /* (107) group_by_clause_opt ::= GROUP BY expression_list */
{ 109, 0 }, /* (108) having_clause_opt ::= */
{ 109, -2 }, /* (109) having_clause_opt ::= HAVING search_condition */
{ 73, -4 }, /* (110) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 115, -1 }, /* (111) query_expression_body ::= query_primary */
{ 115, -4 }, /* (112) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 119, -1 }, /* (113) query_primary ::= query_specification */
{ 116, 0 }, /* (114) order_by_clause_opt ::= */
{ 116, -3 }, /* (115) order_by_clause_opt ::= ORDER BY sort_specification_list */
{ 117, 0 }, /* (116) slimit_clause_opt ::= */
{ 117, -2 }, /* (117) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{ 117, -4 }, /* (118) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{ 117, -4 }, /* (119) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 118, 0 }, /* (120) limit_clause_opt ::= */
{ 118, -2 }, /* (121) limit_clause_opt ::= LIMIT NK_INTEGER */
{ 118, -4 }, /* (122) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{ 118, -4 }, /* (123) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{ 86, -3 }, /* (124) subquery ::= NK_LP query_expression NK_RP */
{ 101, -1 }, /* (125) search_condition ::= boolean_value_expression */
{ 120, -1 }, /* (126) sort_specification_list ::= sort_specification */
{ 120, -3 }, /* (127) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{ 121, -3 }, /* (128) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ 122, 0 }, /* (129) ordering_specification_opt ::= */
{ 122, -1 }, /* (130) ordering_specification_opt ::= ASC */
{ 122, -1 }, /* (131) ordering_specification_opt ::= DESC */
{ 123, 0 }, /* (132) null_ordering_opt ::= */
{ 123, -2 }, /* (133) null_ordering_opt ::= NULLS FIRST */
{ 123, -2 }, /* (134) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
......@@ -1539,16 +1539,16 @@ static YYACTIONTYPE yy_reduce(
case 7: /* literal ::= duration_literal */
case 17: /* expression ::= literal */ yytestcase(yyruleno==17);
case 18: /* expression ::= column_reference */ yytestcase(yyruleno==18);
case 20: /* expression ::= subquery */ yytestcase(yyruleno==20);
case 52: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==52);
case 56: /* boolean_primary ::= predicate */ yytestcase(yyruleno==56);
case 59: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==59);
case 61: /* table_reference ::= table_primary */ yytestcase(yyruleno==61);
case 62: /* table_reference ::= joined_table */ yytestcase(yyruleno==62);
case 66: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==66);
case 110: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==110);
case 112: /* query_primary ::= query_specification */ yytestcase(yyruleno==112);
case 124: /* search_condition ::= boolean_value_expression */ yytestcase(yyruleno==124);
case 21: /* expression ::= subquery */ yytestcase(yyruleno==21);
case 53: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==53);
case 57: /* boolean_primary ::= predicate */ yytestcase(yyruleno==57);
case 60: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==60);
case 62: /* table_reference ::= table_primary */ yytestcase(yyruleno==62);
case 63: /* table_reference ::= joined_table */ yytestcase(yyruleno==63);
case 67: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==67);
case 111: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==111);
case 113: /* query_primary ::= query_specification */ yytestcase(yyruleno==113);
case 125: /* search_condition ::= boolean_value_expression */ yytestcase(yyruleno==125);
{ PARSER_TRACE; yylhsminor.yy168 = yymsp[0].minor.yy168; }
yymsp[0].minor.yy168 = yylhsminor.yy168;
break;
......@@ -1557,12 +1557,12 @@ static YYACTIONTYPE yy_reduce(
yymsp[0].minor.yy168 = yylhsminor.yy168;
break;
case 9: /* literal_list ::= literal */
case 29: /* expression_list ::= expression */ yytestcase(yyruleno==29);
case 30: /* expression_list ::= expression */ yytestcase(yyruleno==30);
{ PARSER_TRACE; yylhsminor.yy192 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); }
yymsp[0].minor.yy192 = yylhsminor.yy192;
break;
case 10: /* literal_list ::= literal_list NK_COMMA literal */
case 30: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==30);
case 31: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==31);
{ PARSER_TRACE; yylhsminor.yy192 = addNodeToList(pCxt, yymsp[-2].minor.yy192, releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); }
yymsp[-2].minor.yy192 = yylhsminor.yy192;
break;
......@@ -1579,11 +1579,15 @@ static YYACTIONTYPE yy_reduce(
{ PARSER_TRACE; yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy241, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy241, yymsp[-1].minor.yy192)); }
yymsp[-3].minor.yy168 = yylhsminor.yy168;
break;
case 21: /* expression ::= NK_LP expression NK_RP */
case 20: /* expression ::= function_name NK_LP NK_STAR NK_RP */
{ PARSER_TRACE; yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy241, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy241, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); }
yymsp[-3].minor.yy168 = yylhsminor.yy168;
break;
case 22: /* expression ::= NK_LP expression NK_RP */
{ PARSER_TRACE; yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168)); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 22: /* expression ::= NK_PLUS expression */
case 23: /* expression ::= NK_PLUS expression */
{
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168);
......@@ -1591,7 +1595,7 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-1].minor.yy168 = yylhsminor.yy168;
break;
case 23: /* expression ::= NK_MINUS expression */
case 24: /* expression ::= NK_MINUS expression */
{
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168);
......@@ -1599,7 +1603,7 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-1].minor.yy168 = yylhsminor.yy168;
break;
case 24: /* expression ::= expression NK_PLUS expression */
case 25: /* expression ::= expression NK_PLUS expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168);
......@@ -1608,7 +1612,7 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 25: /* expression ::= expression NK_MINUS expression */
case 26: /* expression ::= expression NK_MINUS expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168);
......@@ -1617,7 +1621,7 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 26: /* expression ::= expression NK_STAR expression */
case 27: /* expression ::= expression NK_STAR expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168);
......@@ -1626,7 +1630,7 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 27: /* expression ::= expression NK_SLASH expression */
case 28: /* expression ::= expression NK_SLASH expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168);
......@@ -1635,7 +1639,7 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 28: /* expression ::= expression NK_REM expression */
case 29: /* expression ::= expression NK_REM expression */
{
PARSER_TRACE;
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168);
......@@ -1644,132 +1648,132 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 31: /* column_reference ::= column_name */
case 32: /* column_reference ::= column_name */
{ PARSER_TRACE; yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy241, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy241)); }
yymsp[0].minor.yy168 = yylhsminor.yy168;
break;
case 32: /* column_reference ::= table_name NK_DOT column_name */
case 33: /* column_reference ::= table_name NK_DOT column_name */
{ PARSER_TRACE; yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy241, &yymsp[0].minor.yy241, createColumnNode(pCxt, &yymsp[-2].minor.yy241, &yymsp[0].minor.yy241)); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 33: /* predicate ::= expression compare_op expression */
case 34: /* predicate ::= expression compare_op expression */
{ PARSER_TRACE; yylhsminor.yy168 = createOperatorNode(pCxt, yymsp[-1].minor.yy228, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 34: /* predicate ::= expression BETWEEN expression AND expression */
case 35: /* predicate ::= expression BETWEEN expression AND expression */
{ PARSER_TRACE; yylhsminor.yy168 = createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy168), releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); }
yymsp[-4].minor.yy168 = yylhsminor.yy168;
break;
case 35: /* predicate ::= expression NOT BETWEEN expression AND expression */
case 36: /* predicate ::= expression NOT BETWEEN expression AND expression */
{ PARSER_TRACE; yylhsminor.yy168 = createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[-5].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); }
yymsp[-5].minor.yy168 = yylhsminor.yy168;
break;
case 36: /* predicate ::= expression IS NULL */
case 37: /* predicate ::= expression IS NULL */
{ PARSER_TRACE; yylhsminor.yy168 = createIsNullCondNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), true); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 37: /* predicate ::= expression IS NOT NULL */
case 38: /* predicate ::= expression IS NOT NULL */
{ PARSER_TRACE; yylhsminor.yy168 = createIsNullCondNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy168), false); }
yymsp[-3].minor.yy168 = yylhsminor.yy168;
break;
case 38: /* predicate ::= expression in_op in_predicate_value */
case 39: /* predicate ::= expression in_op in_predicate_value */
{ PARSER_TRACE; yylhsminor.yy168 = createOperatorNode(pCxt, yymsp[-1].minor.yy228, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), yymsp[0].minor.yy168); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 39: /* compare_op ::= NK_LT */
case 40: /* compare_op ::= NK_LT */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_LOWER_THAN; }
break;
case 40: /* compare_op ::= NK_GT */
case 41: /* compare_op ::= NK_GT */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_GREATER_THAN; }
break;
case 41: /* compare_op ::= NK_LE */
case 42: /* compare_op ::= NK_LE */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_LOWER_EQUAL; }
break;
case 42: /* compare_op ::= NK_GE */
case 43: /* compare_op ::= NK_GE */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_GREATER_EQUAL; }
break;
case 43: /* compare_op ::= NK_NE */
case 44: /* compare_op ::= NK_NE */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_NOT_EQUAL; }
break;
case 44: /* compare_op ::= NK_EQ */
case 45: /* compare_op ::= NK_EQ */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_EQUAL; }
break;
case 45: /* compare_op ::= LIKE */
case 46: /* compare_op ::= LIKE */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_LIKE; }
break;
case 46: /* compare_op ::= NOT LIKE */
case 47: /* compare_op ::= NOT LIKE */
{ PARSER_TRACE; yymsp[-1].minor.yy228 = OP_TYPE_NOT_LIKE; }
break;
case 47: /* compare_op ::= MATCH */
case 48: /* compare_op ::= MATCH */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_MATCH; }
break;
case 48: /* compare_op ::= NMATCH */
case 49: /* compare_op ::= NMATCH */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_NMATCH; }
break;
case 49: /* in_op ::= IN */
case 50: /* in_op ::= IN */
{ PARSER_TRACE; yymsp[0].minor.yy228 = OP_TYPE_IN; }
break;
case 50: /* in_op ::= NOT IN */
case 51: /* in_op ::= NOT IN */
{ PARSER_TRACE; yymsp[-1].minor.yy228 = OP_TYPE_NOT_IN; }
break;
case 51: /* in_predicate_value ::= NK_LP expression_list NK_RP */
case 52: /* in_predicate_value ::= NK_LP expression_list NK_RP */
{ PARSER_TRACE; yymsp[-2].minor.yy168 = createNodeListNode(pCxt, yymsp[-1].minor.yy192); }
break;
case 53: /* boolean_value_expression ::= NOT boolean_primary */
case 54: /* boolean_value_expression ::= NOT boolean_primary */
{ PARSER_TRACE; yymsp[-1].minor.yy168 = createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, yymsp[0].minor.yy168, NULL); }
break;
case 54: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
case 55: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{ PARSER_TRACE; yylhsminor.yy168 = createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 55: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
case 56: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{ PARSER_TRACE; yylhsminor.yy168 = createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 57: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */
case 70: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ yytestcase(yyruleno==70);
case 71: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==71);
case 58: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */
case 71: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ yytestcase(yyruleno==71);
case 72: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==72);
{ PARSER_TRACE; yymsp[-2].minor.yy168 = yymsp[-1].minor.yy168; }
break;
case 58: /* from_clause ::= FROM table_reference_list */
case 87: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==87);
case 108: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==108);
case 59: /* from_clause ::= FROM table_reference_list */
case 88: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==88);
case 109: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==109);
{ PARSER_TRACE; yymsp[-1].minor.yy168 = yymsp[0].minor.yy168; }
break;
case 60: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
case 61: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
{ PARSER_TRACE; yylhsminor.yy168 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy168, yymsp[0].minor.yy168, NULL); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 63: /* table_primary ::= table_name alias_opt */
case 64: /* table_primary ::= table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy168 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy241, &yymsp[0].minor.yy241); }
yymsp[-1].minor.yy168 = yylhsminor.yy168;
break;
case 64: /* table_primary ::= db_name NK_DOT table_name alias_opt */
case 65: /* table_primary ::= db_name NK_DOT table_name alias_opt */
{ PARSER_TRACE; yylhsminor.yy168 = createRealTableNode(pCxt, &yymsp[-3].minor.yy241, &yymsp[-1].minor.yy241, &yymsp[0].minor.yy241); }
yymsp[-3].minor.yy168 = yylhsminor.yy168;
break;
case 65: /* table_primary ::= subquery alias_opt */
case 66: /* table_primary ::= subquery alias_opt */
{ PARSER_TRACE; yylhsminor.yy168 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168), &yymsp[0].minor.yy241); }
yymsp[-1].minor.yy168 = yylhsminor.yy168;
break;
case 67: /* alias_opt ::= */
case 68: /* alias_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy241 = nil_token; }
break;
case 68: /* alias_opt ::= table_alias */
case 69: /* alias_opt ::= table_alias */
{ PARSER_TRACE; yylhsminor.yy241 = yymsp[0].minor.yy241; }
yymsp[0].minor.yy241 = yylhsminor.yy241;
break;
case 69: /* alias_opt ::= AS table_alias */
case 70: /* alias_opt ::= AS table_alias */
{ PARSER_TRACE; yymsp[-1].minor.yy241 = yymsp[0].minor.yy241; }
break;
case 72: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
case 73: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
{ PARSER_TRACE; yylhsminor.yy168 = createJoinTableNode(pCxt, yymsp[-4].minor.yy229, yymsp[-5].minor.yy168, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); }
yymsp[-5].minor.yy168 = yylhsminor.yy168;
break;
case 73: /* join_type ::= INNER */
case 74: /* join_type ::= INNER */
{ PARSER_TRACE; yymsp[0].minor.yy229 = JOIN_TYPE_INNER; }
break;
case 74: /* 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 75: /* 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.yy168 = createSelectStmt(pCxt, yymsp[-7].minor.yy209, yymsp[-6].minor.yy192, yymsp[-5].minor.yy168);
......@@ -1780,33 +1784,33 @@ static YYACTIONTYPE yy_reduce(
yymsp[-8].minor.yy168 = addHavingClause(pCxt, yymsp[-8].minor.yy168, yymsp[0].minor.yy168);
}
break;
case 75: /* set_quantifier_opt ::= */
case 76: /* set_quantifier_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy209 = false; }
break;
case 76: /* set_quantifier_opt ::= DISTINCT */
case 77: /* set_quantifier_opt ::= DISTINCT */
{ PARSER_TRACE; yymsp[0].minor.yy209 = true; }
break;
case 77: /* set_quantifier_opt ::= ALL */
case 78: /* set_quantifier_opt ::= ALL */
{ PARSER_TRACE; yymsp[0].minor.yy209 = false; }
break;
case 78: /* select_list ::= NK_STAR */
case 79: /* select_list ::= NK_STAR */
{ PARSER_TRACE; yymsp[0].minor.yy192 = NULL; }
break;
case 79: /* select_list ::= select_sublist */
case 80: /* select_list ::= select_sublist */
{ PARSER_TRACE; yylhsminor.yy192 = yymsp[0].minor.yy192; }
yymsp[0].minor.yy192 = yylhsminor.yy192;
break;
case 80: /* select_sublist ::= select_item */
case 125: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==125);
case 81: /* select_sublist ::= select_item */
case 126: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==126);
{ PARSER_TRACE; yylhsminor.yy192 = createNodeList(pCxt, yymsp[0].minor.yy168); }
yymsp[0].minor.yy192 = yylhsminor.yy192;
break;
case 81: /* select_sublist ::= select_sublist NK_COMMA select_item */
case 126: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==126);
case 82: /* select_sublist ::= select_sublist NK_COMMA select_item */
case 127: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==127);
{ PARSER_TRACE; yylhsminor.yy192 = addNodeToList(pCxt, yymsp[-2].minor.yy192, yymsp[0].minor.yy168); }
yymsp[-2].minor.yy192 = yylhsminor.yy192;
break;
case 82: /* select_item ::= expression */
case 83: /* select_item ::= expression */
{
PARSER_TRACE;
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168);
......@@ -1814,74 +1818,74 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[0].minor.yy168 = yylhsminor.yy168;
break;
case 83: /* select_item ::= expression column_alias */
case 84: /* select_item ::= expression column_alias */
{ PARSER_TRACE; yylhsminor.yy168 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168), &yymsp[0].minor.yy241); }
yymsp[-1].minor.yy168 = yylhsminor.yy168;
break;
case 84: /* select_item ::= expression AS column_alias */
case 85: /* select_item ::= expression AS column_alias */
{ PARSER_TRACE; yylhsminor.yy168 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), &yymsp[0].minor.yy241); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 85: /* select_item ::= table_name NK_DOT NK_STAR */
case 86: /* select_item ::= table_name NK_DOT NK_STAR */
{ PARSER_TRACE; yylhsminor.yy168 = createColumnNode(pCxt, &yymsp[-2].minor.yy241, &yymsp[0].minor.yy0); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 86: /* where_clause_opt ::= */
case 90: /* twindow_clause_opt ::= */ yytestcase(yyruleno==90);
case 95: /* sliding_opt ::= */ yytestcase(yyruleno==95);
case 97: /* fill_opt ::= */ yytestcase(yyruleno==97);
case 107: /* having_clause_opt ::= */ yytestcase(yyruleno==107);
case 115: /* slimit_clause_opt ::= */ yytestcase(yyruleno==115);
case 119: /* limit_clause_opt ::= */ yytestcase(yyruleno==119);
case 87: /* where_clause_opt ::= */
case 91: /* twindow_clause_opt ::= */ yytestcase(yyruleno==91);
case 96: /* sliding_opt ::= */ yytestcase(yyruleno==96);
case 98: /* fill_opt ::= */ yytestcase(yyruleno==98);
case 108: /* having_clause_opt ::= */ yytestcase(yyruleno==108);
case 116: /* slimit_clause_opt ::= */ yytestcase(yyruleno==116);
case 120: /* limit_clause_opt ::= */ yytestcase(yyruleno==120);
{ PARSER_TRACE; yymsp[1].minor.yy168 = NULL; }
break;
case 88: /* partition_by_clause_opt ::= */
case 105: /* group_by_clause_opt ::= */ yytestcase(yyruleno==105);
case 113: /* order_by_clause_opt ::= */ yytestcase(yyruleno==113);
case 89: /* partition_by_clause_opt ::= */
case 106: /* group_by_clause_opt ::= */ yytestcase(yyruleno==106);
case 114: /* order_by_clause_opt ::= */ yytestcase(yyruleno==114);
{ PARSER_TRACE; yymsp[1].minor.yy192 = NULL; }
break;
case 89: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 106: /* group_by_clause_opt ::= GROUP BY expression_list */ yytestcase(yyruleno==106);
case 114: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==114);
case 90: /* partition_by_clause_opt ::= PARTITION BY expression_list */
case 107: /* group_by_clause_opt ::= GROUP BY expression_list */ yytestcase(yyruleno==107);
case 115: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==115);
{ PARSER_TRACE; yymsp[-2].minor.yy192 = yymsp[0].minor.yy192; }
break;
case 91: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
case 92: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy168 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy168), &yymsp[-1].minor.yy0); }
break;
case 92: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
case 93: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy168 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168)); }
break;
case 93: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
case 94: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-5].minor.yy168 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy168, NULL, yymsp[-1].minor.yy168, yymsp[0].minor.yy168); }
break;
case 94: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
case 95: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ PARSER_TRACE; yymsp[-7].minor.yy168 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy168, yymsp[-3].minor.yy168, yymsp[-1].minor.yy168, yymsp[0].minor.yy168); }
break;
case 96: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
case 97: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy168 = yymsp[-1].minor.yy168; }
break;
case 98: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
case 99: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ PARSER_TRACE; yymsp[-3].minor.yy168 = createFillNode(pCxt, yymsp[-1].minor.yy14, NULL); }
break;
case 99: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
case 100: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
{ PARSER_TRACE; yymsp[-5].minor.yy168 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy192)); }
break;
case 100: /* fill_mode ::= NONE */
case 101: /* fill_mode ::= NONE */
{ PARSER_TRACE; yymsp[0].minor.yy14 = FILL_MODE_NONE; }
break;
case 101: /* fill_mode ::= PREV */
case 102: /* fill_mode ::= PREV */
{ PARSER_TRACE; yymsp[0].minor.yy14 = FILL_MODE_PREV; }
break;
case 102: /* fill_mode ::= NULL */
case 103: /* fill_mode ::= NULL */
{ PARSER_TRACE; yymsp[0].minor.yy14 = FILL_MODE_NULL; }
break;
case 103: /* fill_mode ::= LINEAR */
case 104: /* fill_mode ::= LINEAR */
{ PARSER_TRACE; yymsp[0].minor.yy14 = FILL_MODE_LINEAR; }
break;
case 104: /* fill_mode ::= NEXT */
case 105: /* fill_mode ::= NEXT */
{ PARSER_TRACE; yymsp[0].minor.yy14 = FILL_MODE_NEXT; }
break;
case 109: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
case 110: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
PARSER_TRACE;
yylhsminor.yy168 = addOrderByClause(pCxt, yymsp[-3].minor.yy168, yymsp[-2].minor.yy192);
......@@ -1890,46 +1894,46 @@ static YYACTIONTYPE yy_reduce(
}
yymsp[-3].minor.yy168 = yylhsminor.yy168;
break;
case 111: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
case 112: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ PARSER_TRACE; yylhsminor.yy168 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy168, yymsp[0].minor.yy168); }
yymsp[-3].minor.yy168 = yylhsminor.yy168;
break;
case 116: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 120: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==120);
case 117: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case 121: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==121);
{ PARSER_TRACE; yymsp[-1].minor.yy168 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
case 117: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 121: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==121);
case 118: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case 122: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==122);
{ PARSER_TRACE; yymsp[-3].minor.yy168 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 118: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case 122: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==122);
case 119: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case 123: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==123);
{ PARSER_TRACE; yymsp[-3].minor.yy168 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
case 123: /* subquery ::= NK_LP query_expression NK_RP */
case 124: /* subquery ::= NK_LP query_expression NK_RP */
{ PARSER_TRACE; yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy168); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 127: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
case 128: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{ PARSER_TRACE; yylhsminor.yy168 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), yymsp[-1].minor.yy10, yymsp[0].minor.yy177); }
yymsp[-2].minor.yy168 = yylhsminor.yy168;
break;
case 128: /* ordering_specification_opt ::= */
case 129: /* ordering_specification_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy10 = ORDER_ASC; }
break;
case 129: /* ordering_specification_opt ::= ASC */
case 130: /* ordering_specification_opt ::= ASC */
{ PARSER_TRACE; yymsp[0].minor.yy10 = ORDER_ASC; }
break;
case 130: /* ordering_specification_opt ::= DESC */
case 131: /* ordering_specification_opt ::= DESC */
{ PARSER_TRACE; yymsp[0].minor.yy10 = ORDER_DESC; }
break;
case 131: /* null_ordering_opt ::= */
case 132: /* null_ordering_opt ::= */
{ PARSER_TRACE; yymsp[1].minor.yy177 = NULL_ORDER_DEFAULT; }
break;
case 132: /* null_ordering_opt ::= NULLS FIRST */
case 133: /* null_ordering_opt ::= NULLS FIRST */
{ PARSER_TRACE; yymsp[-1].minor.yy177 = NULL_ORDER_FIRST; }
break;
case 133: /* null_ordering_opt ::= NULLS LAST */
case 134: /* null_ordering_opt ::= NULLS LAST */
{ PARSER_TRACE; yymsp[-1].minor.yy177 = NULL_ORDER_LAST; }
break;
default:
......
......@@ -238,9 +238,19 @@ abort_parse:
typedef enum ESqlClause {
SQL_CLAUSE_FROM = 1,
SQL_CLAUSE_WHERE
SQL_CLAUSE_WHERE,
SQL_CLAUSE_PARTITION_BY,
SQL_CLAUSE_WINDOW,
SQL_CLAUSE_GROUP_BY,
SQL_CLAUSE_HAVING,
SQL_CLAUSE_SELECT,
SQL_CLAUSE_ORDER_BY
} ESqlClause;
static bool afterGroupBy(ESqlClause clause) {
return clause < SQL_CLAUSE_HAVING;
}
typedef struct STranslateContext {
SParseContext* pParseCxt;
FuncMgtHandle fmgt;
......@@ -249,6 +259,7 @@ typedef struct STranslateContext {
SArray* pNsLevel; // element is SArray*, the element of this subarray is STableNode*
int32_t currLevel;
ESqlClause currClause;
void* pExt;
} STranslateContext;
static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode);
......@@ -263,12 +274,16 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "Column ambiguously defined : %s";
case TSDB_CODE_PAR_WRONG_VALUE_TYPE:
return "Invalid value type : %s";
case TSDB_CODE_PAR_INVALID_FUNTION:
return "Invalid function name : %s";
case TSDB_CODE_PAR_FUNTION_PARA_NUM:
return "Invalid number of arguments : %s";
case TSDB_CODE_PAR_FUNTION_PARA_TYPE:
return "Inconsistent datatypes : %s";
case TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION:
return "There mustn't be aggregation";
case TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT:
return "ORDER BY item must be the number of a SELECT-list expression";
default:
return "Unknown error";
}
......@@ -346,7 +361,9 @@ static void setColumnInfoBySchema(const STableNode* pTable, const SSchema* pColS
static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SColumnNode* pCol) {
pCol->pProjectRef = (SNode*)pExpr;
pExpr->pAssociationList = nodesListAppend(pExpr->pAssociationList, (SNode*)pCol);
strcpy(pCol->tableAlias, pTable->tableAlias);
if (NULL != pTable) {
strcpy(pCol->tableAlias, pTable->tableAlias);
}
strcpy(pCol->colName, pExpr->aliasName);
pCol->node.resType = pExpr->resType;
}
......@@ -435,11 +452,32 @@ static bool translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNode* p
return true;
}
static bool translateColumnUseAlias(STranslateContext* pCxt, SColumnNode* pCol) {
SNodeList* pProjectionList = pCxt->pExt;
SNode* pNode;
FOREACH(pNode, pProjectionList) {
SExprNode* pExpr = (SExprNode*)pNode;
if (0 == strcmp(pCol->colName, pExpr->aliasName)) {
setColumnInfoByExpr(NULL, pExpr, pCol);
return true;
}
}
return false;
}
static bool translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
// count(*)/first(*)/last(*)
if (0 == strcmp(pCol->colName, "*")) {
return true;
}
if ('\0' != pCol->tableAlias[0]) {
return translateColumnWithPrefix(pCxt, pCol);
}
return translateColumnWithoutPrefix(pCxt, pCol);
bool found = false;
if (SQL_CLAUSE_ORDER_BY == pCxt->currClause) {
found = translateColumnUseAlias(pCxt, pCol);
}
return found ? true : translateColumnWithoutPrefix(pCxt, pCol);
}
static int32_t trimStringCopy(const char* src, int32_t len, char* dst) {
......@@ -476,17 +514,32 @@ static bool translateValue(STranslateContext* pCxt, SValueNode* pVal) {
case TSDB_DATA_TYPE_BOOL:
pVal->datum.b = (0 == strcasecmp(pVal->literal, "true"));
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_BIGINT: {
char* endPtr = NULL;
pVal->datum.i = strtoull(pVal->literal, &endPtr, 10);
break;
}
case TSDB_DATA_TYPE_UTINYINT:
case TSDB_DATA_TYPE_USMALLINT:
case TSDB_DATA_TYPE_UINT:
case TSDB_DATA_TYPE_UBIGINT:{
char* endPtr = NULL;
pVal->datum.u = strtoull(pVal->literal, &endPtr, 10);
break;
}
case TSDB_DATA_TYPE_FLOAT:
case TSDB_DATA_TYPE_DOUBLE: {
char* endPtr = NULL;
pVal->datum.d = strtold(pVal->literal, &endPtr);
break;
}
case TSDB_DATA_TYPE_BINARY: {
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR:
case TSDB_DATA_TYPE_VARCHAR:
case TSDB_DATA_TYPE_VARBINARY: {
int32_t n = strlen(pVal->literal);
pVal->datum.p = calloc(1, n);
trimStringCopy(pVal->literal, n, pVal->datum.p);
......@@ -504,6 +557,10 @@ static bool translateValue(STranslateContext* pCxt, SValueNode* pVal) {
tfree(tmp);
break;
}
case TSDB_DATA_TYPE_JSON:
case TSDB_DATA_TYPE_DECIMAL:
case TSDB_DATA_TYPE_BLOB:
// todo
default:
break;
}
......@@ -540,12 +597,16 @@ static bool translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
}
static bool translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc) {
int32_t code = fmGetFuncResultType(pCxt->fmgt, pFunc);
if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pCxt->fmgt, pFunc->functionName, &pFunc->funcId, &pFunc->funcType)) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_INVALID_FUNTION, pFunc->functionName);
return false;
}
int32_t code = fmGetFuncResultType(pFunc);
if (TSDB_CODE_SUCCESS != code) {
generateSyntaxErrMsg(pCxt, code, pFunc->functionName);
return false;
}
if (fmIsAggFunc(pFunc->funcId) && (SQL_CLAUSE_FROM == pCxt->currClause || SQL_CLAUSE_WHERE == pCxt->currClause)) {
if (fmIsAggFunc(pFunc->funcId) && afterGroupBy(pCxt->currClause)) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION);
return false;
}
......@@ -620,11 +681,6 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
return code;
}
static int32_t translateFrom(STranslateContext* pCxt, SNode* pTable) {
pCxt->currClause = SQL_CLAUSE_FROM;
return translateTable(pCxt, pTable);
}
static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect, bool* pIsSelectStar) {
if (NULL == pSelect->pProjectionList) { // select * ...
SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel);
......@@ -641,21 +697,149 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect, bool
return TSDB_CODE_SUCCESS;
}
static int32_t getPositionValue(const SValueNode* pVal) {
switch (pVal->node.resType.type) {
case TSDB_DATA_TYPE_NULL:
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_TIMESTAMP:
case TSDB_DATA_TYPE_NCHAR:
case TSDB_DATA_TYPE_VARCHAR:
case TSDB_DATA_TYPE_VARBINARY:
case TSDB_DATA_TYPE_JSON:
return -1;
case TSDB_DATA_TYPE_BOOL:
return (pVal->datum.b ? 1 : 0);
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_BIGINT:
return pVal->datum.i;
case TSDB_DATA_TYPE_FLOAT:
case TSDB_DATA_TYPE_DOUBLE:
return pVal->datum.d;
case TSDB_DATA_TYPE_UTINYINT:
case TSDB_DATA_TYPE_USMALLINT:
case TSDB_DATA_TYPE_UINT:
case TSDB_DATA_TYPE_UBIGINT:
return pVal->datum.u;
default:
break;
}
return -1;
}
static bool translateOrderByPosition(STranslateContext* pCxt, SNodeList* pProjectionList, SNodeList* pOrderByList, bool* pOther) {
*pOther = false;
SNode* pNode;
FOREACH(pNode, pOrderByList) {
if (QUERY_NODE_VALUE == nodeType(pNode)) {
SValueNode* pVal = (SValueNode*)pNode;
if (translateValue(pCxt, pVal)) {
return false;
}
int32_t pos = getPositionValue((SValueNode*)pNode);
if (pos < 0) {
ERASE_NODE(pOrderByList);
nodesDestroyNode(pNode);
continue;
} else if (0 == pos || pos > LIST_LENGTH(pProjectionList)) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT);
return false;
} else {
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
setColumnInfoByExpr(NULL, (SExprNode*)nodesListGetNode(pProjectionList, pos), pCol);
REPLACE_NODE(pCol);
nodesDestroyNode(pNode);
}
} else {
*pOther = true;
}
}
return true;
}
static int32_t translateOrderBy(STranslateContext* pCxt, SNodeList* pProjectionList, SNodeList* pOrderByList) {
bool other;
if (!translateOrderByPosition(pCxt, pProjectionList, pOrderByList, &other)) {
return pCxt->errCode;
}
if (!other) {
return TSDB_CODE_SUCCESS;
}
pCxt->currClause = SQL_CLAUSE_ORDER_BY;
pCxt->pExt = pProjectionList;
return translateExprList(pCxt, pOrderByList);
}
static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect) {
bool isSelectStar = false;
int32_t code = translateStar(pCxt, pSelect, &isSelectStar);
if (TSDB_CODE_SUCCESS == code && !isSelectStar) {
pCxt->currClause = SQL_CLAUSE_SELECT;
code = translateExprList(pCxt, pSelect->pProjectionList);
}
return code;
}
static int32_t translateHaving(STranslateContext* pCxt, SNode* pHaving) {
pCxt->currClause = SQL_CLAUSE_HAVING;
return translateExpr(pCxt, pHaving);
}
static int32_t translateGroupBy(STranslateContext* pCxt, SNodeList* pGroupByList) {
pCxt->currClause = SQL_CLAUSE_GROUP_BY;
return translateExprList(pCxt, pGroupByList);
}
static int32_t translateWindow(STranslateContext* pCxt, SNode* pWindow) {
pCxt->currClause = SQL_CLAUSE_WINDOW;
return translateExpr(pCxt, pWindow);
}
static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartitionByList) {
pCxt->currClause = SQL_CLAUSE_PARTITION_BY;
return translateExprList(pCxt, pPartitionByList);
}
static int32_t translateWhere(STranslateContext* pCxt, SNode* pWhere) {
pCxt->currClause = SQL_CLAUSE_WHERE;
return translateExpr(pCxt, pWhere);
}
static int32_t translateFrom(STranslateContext* pCxt, SNode* pTable) {
pCxt->currClause = SQL_CLAUSE_FROM;
return translateTable(pCxt, pTable);
}
// typedef struct SSelectStmt {
// bool isDistinct;
// SNode* pLimit;
// SNode* pSlimit;
// } SSelectStmt;
static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
int32_t code = TSDB_CODE_SUCCESS;
code = translateFrom(pCxt, pSelect->pFromTable);
if (TSDB_CODE_SUCCESS == code) {
code = translateExpr(pCxt, pSelect->pWhere);
code = translateWhere(pCxt, pSelect->pWhere);
}
if (TSDB_CODE_SUCCESS == code) {
code = translateExprList(pCxt, pSelect->pGroupByList);
code = translatePartitionBy(pCxt, pSelect->pPartitionByList);
}
bool isSelectStar = false;
if (TSDB_CODE_SUCCESS == code) {
code = translateStar(pCxt, pSelect, &isSelectStar);
code = translateWindow(pCxt, pSelect->pWindow);
}
if (TSDB_CODE_SUCCESS == code && !isSelectStar) {
code = translateExprList(pCxt, pSelect->pProjectionList);
if (TSDB_CODE_SUCCESS == code) {
code = translateGroupBy(pCxt, pSelect->pGroupByList);
}
if (TSDB_CODE_SUCCESS == code) {
code = translateHaving(pCxt, pSelect->pHaving);
}
if (TSDB_CODE_SUCCESS == code) {
code = translateSelectList(pCxt, pSelect);
}
if (TSDB_CODE_SUCCESS == code) {
code = translateOrderBy(pCxt, pSelect->pProjectionList, pSelect->pOrderByList);
}
// printf("%s:%d code = %d\n", __FUNCTION__, __LINE__, code);
return code;
......@@ -676,9 +860,11 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) {
++(pCxt->currLevel);
ESqlClause currClause = pCxt->currClause;
void* pExt = pCxt->pExt;
int32_t code = translateQuery(pCxt, pNode);
--(pCxt->currLevel);
pCxt->currClause = currClause;
pCxt->pExt = pExt;
return code;
}
......@@ -691,5 +877,13 @@ int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery) {
.currLevel = 0,
.currClause = 0
};
int32_t code = fmFuncMgtInit();
if (TSDB_CODE_SUCCESS != code) {
return code;
}
code = fmGetHandle(&cxt.fmgt);
if (TSDB_CODE_SUCCESS != code) {
return code;
}
return translateQuery(&cxt, pQuery->pRoot);
}
......@@ -13,6 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <string>
#include <gtest/gtest.h>
#include "parserImpl.h"
......@@ -30,12 +33,11 @@ protected:
void bind(const char* sql) {
reset();
cxt_.acctId = atoi(acctId_.c_str());
cxt_.db = (char*) db_.c_str();
strcpy(sqlBuf_, sql);
cxt_.db = db_.c_str();
sqlBuf_ = string(sql);
transform(sqlBuf_.begin(), sqlBuf_.end(), sqlBuf_.begin(), ::tolower);
cxt_.sqlLen = strlen(sql);
sqlBuf_[cxt_.sqlLen] = '\0';
cxt_.pSql = sqlBuf_;
cxt_.pSql = sqlBuf_.c_str();
}
bool run(int32_t parseCode = TSDB_CODE_SUCCESS, int32_t translateCode = TSDB_CODE_SUCCESS) {
......@@ -68,7 +70,6 @@ protected:
private:
static const int max_err_len = 1024;
static const int max_sql_len = 1024 * 1024;
string dataTypeToStr(const SDataType& dt) {
switch (dt.type) {
......@@ -409,7 +410,7 @@ private:
string acctId_;
string db_;
char errMagBuf_[max_err_len];
char sqlBuf_[max_sql_len];
string sqlBuf_;
SParseContext cxt_;
SQuery query_;
};
......@@ -450,6 +451,16 @@ TEST_F(NewParserTest, selectExpression) {
ASSERT_TRUE(run());
}
TEST_F(NewParserTest, selectClause) {
setDatabase("root", "test");
bind("SELECT count(*) cnt FROM t1 WHERE c1 > 0 GROUP BY c2 ORDER BY cnt");
ASSERT_TRUE(run());
bind("SELECT count(*) cnt FROM t1 WHERE c1 > 0 GROUP BY c2 ORDER BY 1");
ASSERT_TRUE(run());
}
TEST_F(NewParserTest, selectSyntaxError) {
setDatabase("root", "test");
......@@ -477,4 +488,7 @@ TEST_F(NewParserTest, selectSemanticError) {
bind("SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1");
ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_FAILED));
bind("SELECT c2 FROM t1 where count(*) > 0");
ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_FAILED));
}
......@@ -119,6 +119,16 @@ SNodeList* nodesListAppend(SNodeList* pList, SNode* pNode) {
return pList;
}
SNode* nodesListGetNode(SNodeList* pList, int32_t index) {
SNode* node;
FOREACH(node, pList) {
if (0 == index--) {
return node;
}
}
return NULL;
}
void nodesDestroyList(SNodeList* pList) {
SNode* node;
FOREACH(node, pList) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册