提交 ae9f58af 编写于 作者: H Haojun Liao

Merge remote-tracking branch 'origin/3.0_query_integrate' into 3.0_query_integrate

...@@ -173,6 +173,7 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { ...@@ -173,6 +173,7 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
SCmdMsgInfo* pMsgInfo = pQuery->pCmdMsg; SCmdMsgInfo* pMsgInfo = pQuery->pCmdMsg;
pRequest->type = pMsgInfo->msgType; pRequest->type = pMsgInfo->msgType;
pRequest->body.requestMsg = (SDataBuf){.pData = pMsgInfo->pMsg, .len = pMsgInfo->msgLen, .handle = NULL}; pRequest->body.requestMsg = (SDataBuf){.pData = pMsgInfo->pMsg, .len = pMsgInfo->msgLen, .handle = NULL};
pMsgInfo->pMsg = NULL; // pMsg transferred to SMsgSendInfo management
STscObj* pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest); SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
...@@ -248,7 +249,7 @@ TAOS_RES* taos_query_l(TAOS* taos, const char* sql, int sqlLen) { ...@@ -248,7 +249,7 @@ TAOS_RES* taos_query_l(TAOS* taos, const char* sql, int sqlLen) {
} }
SRequestObj* pRequest = NULL; SRequestObj* pRequest = NULL;
SQuery* pQuery; SQuery* pQuery = NULL;
SArray* pNodeList = taosArrayInit(4, sizeof(struct SQueryNodeAddr)); SArray* pNodeList = taosArrayInit(4, sizeof(struct SQueryNodeAddr));
terrno = TSDB_CODE_SUCCESS; terrno = TSDB_CODE_SUCCESS;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "nodesint.h" #include "nodesUtil.h"
#include "plannodes.h" #include "plannodes.h"
#include "querynodes.h" #include "querynodes.h"
#include "taos.h" #include "taos.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "nodesint.h" #include "nodesUtil.h"
#include "plannodes.h" #include "plannodes.h"
#include "querynodes.h" #include "querynodes.h"
#include "query.h" #include "query.h"
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
#include "cmdnodes.h" #include "cmdnodes.h"
#include "nodesint.h" #include "nodesUtil.h"
#include "plannodes.h" #include "plannodes.h"
#include "querynodes.h" #include "querynodes.h"
#include "taos.h" #include "taos.h"
......
/*
* 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 TDENGINE_INSERTPARSER_H
#define TDENGINE_INSERTPARSER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "parser.h"
int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_INSERTPARSER_H
此差异已折叠。
...@@ -22,9 +22,9 @@ extern "C" { ...@@ -22,9 +22,9 @@ extern "C" {
#include "cmdnodes.h" #include "cmdnodes.h"
#include "parser.h" #include "parser.h"
#include "parserUtil.h" #include "parToken.h"
#include "parUtil.h"
#include "querynodes.h" #include "querynodes.h"
#include "ttoken.h"
typedef struct SAstCreateContext { typedef struct SAstCreateContext {
SParseContext* pQueryCxt; SParseContext* pQueryCxt;
......
...@@ -22,6 +22,7 @@ extern "C" { ...@@ -22,6 +22,7 @@ extern "C" {
#include "parser.h" #include "parser.h"
int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery);
int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery); int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery);
int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery); int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery);
......
...@@ -22,7 +22,6 @@ extern "C" { ...@@ -22,7 +22,6 @@ extern "C" {
#include "os.h" #include "os.h"
#include "query.h" #include "query.h"
#include "ttoken.h"
typedef struct SMsgBuf { typedef struct SMsgBuf {
int32_t len; int32_t len;
......
此差异已折叠。
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "astCreateFuncs.h" #include "parAst.h"
#include "parserUtil.h" #include "parUtil.h"
#define CHECK_OUT_OF_MEM(p) \ #define CHECK_OUT_OF_MEM(p) \
do { \ do { \
......
...@@ -13,28 +13,28 @@ ...@@ -13,28 +13,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "parserInt.h" #include "parInt.h"
#include "astCreateFuncs.h" #include "parAst.h"
#include "ttoken.h" #include "parToken.h"
typedef void* (*FMalloc)(size_t); typedef void* (*FMalloc)(size_t);
typedef void (*FFree)(void*); typedef void (*FFree)(void*);
extern void* NewParseAlloc(FMalloc); extern void* ParseAlloc(FMalloc);
extern void NewParse(void*, int, SToken, void*); extern void Parse(void*, int, SToken, void*);
extern void NewParseFree(void*, FFree); extern void ParseFree(void*, FFree);
extern void NewParseTrace(FILE*, char*); extern void ParseTrace(FILE*, char*);
int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
SAstCreateContext cxt; SAstCreateContext cxt;
initAstCreateContext(pParseCxt, &cxt); initAstCreateContext(pParseCxt, &cxt);
void *pParser = NewParseAlloc(malloc); void *pParser = ParseAlloc(malloc);
int32_t i = 0; int32_t i = 0;
while (1) { while (1) {
SToken t0 = {0}; SToken t0 = {0};
if (cxt.pQueryCxt->pSql[i] == 0) { if (cxt.pQueryCxt->pSql[i] == 0) {
NewParse(pParser, 0, t0, &cxt); Parse(pParser, 0, t0, &cxt);
goto abort_parse; goto abort_parse;
} }
t0.n = tGetToken((char *)&cxt.pQueryCxt->pSql[i], &t0.type); t0.n = tGetToken((char *)&cxt.pQueryCxt->pSql[i], &t0.type);
...@@ -47,7 +47,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { ...@@ -47,7 +47,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
break; break;
} }
case TK_NK_SEMI: { case TK_NK_SEMI: {
NewParse(pParser, 0, t0, &cxt); Parse(pParser, 0, t0, &cxt);
goto abort_parse; goto abort_parse;
} }
case TK_NK_QUESTION: case TK_NK_QUESTION:
...@@ -64,8 +64,8 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { ...@@ -64,8 +64,8 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
goto abort_parse; goto abort_parse;
} }
default: default:
NewParse(pParser, t0.type, t0, &cxt); Parse(pParser, t0.type, t0, &cxt);
// NewParseTrace(stdout, ""); // ParseTrace(stdout, "");
if (!cxt.valid) { if (!cxt.valid) {
goto abort_parse; goto abort_parse;
} }
...@@ -73,7 +73,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { ...@@ -73,7 +73,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) {
} }
abort_parse: abort_parse:
NewParseFree(pParser, free); ParseFree(pParser, free);
if (cxt.valid) { if (cxt.valid) {
*pQuery = calloc(1, sizeof(SQuery)); *pQuery = calloc(1, sizeof(SQuery));
if (NULL == *pQuery) { if (NULL == *pQuery) {
......
...@@ -13,13 +13,12 @@ ...@@ -13,13 +13,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "insertParser.h" #include "parInsertData.h"
#include "parInt.h"
#include "dataBlockMgt.h" #include "parUtil.h"
#include "parserUtil.h" #include "parToken.h"
#include "tglobal.h" #include "tglobal.h"
#include "ttime.h" #include "ttime.h"
#include "ttoken.h"
#include "ttypes.h" #include "ttypes.h"
#define NEXT_TOKEN(pSql, sToken) \ #define NEXT_TOKEN(pSql, sToken) \
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "dataBlockMgt.h" #include "parInsertData.h"
#include "catalog.h" #include "catalog.h"
#include "parserUtil.h" #include "parUtil.h"
#include "querynodes.h" #include "querynodes.h"
#define IS_RAW_PAYLOAD(t) \ #define IS_RAW_PAYLOAD(t) \
......
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
*/ */
#include "os.h" #include "os.h"
#include "parToken.h"
#include "thash.h" #include "thash.h"
#include "taosdef.h" #include "taosdef.h"
#include "ttoken.h"
#include "ttokendef.h" #include "ttokendef.h"
// All the keywords of the SQL language are stored in a hash table // All the keywords of the SQL language are stored in a hash table
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "parserInt.h" #include "parInt.h"
#include "catalog.h" #include "catalog.h"
#include "cmdnodes.h" #include "cmdnodes.h"
#include "functionMgt.h" #include "functionMgt.h"
#include "parserUtil.h" #include "parUtil.h"
#include "ttime.h" #include "ttime.h"
static bool afterGroupBy(ESqlClause clause) { static bool afterGroupBy(ESqlClause clause) {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "parserUtil.h" #include "parUtil.h"
static char* getSyntaxErrFormat(int32_t errCode) { static char* getSyntaxErrFormat(int32_t errCode) {
switch (errCode) { switch (errCode) {
......
...@@ -15,9 +15,8 @@ ...@@ -15,9 +15,8 @@
#include "parser.h" #include "parser.h"
#include "insertParser.h" #include "parInt.h"
#include "parserInt.h" #include "parToken.h"
#include "ttoken.h"
static bool isInsertSql(const char* pStr, size_t length) { static bool isInsertSql(const char* pStr, size_t length) {
int32_t index = 0; int32_t index = 0;
...@@ -47,5 +46,14 @@ int32_t qParseQuerySql(SParseContext* pCxt, SQuery** pQuery) { ...@@ -47,5 +46,14 @@ int32_t qParseQuerySql(SParseContext* pCxt, SQuery** pQuery) {
} }
void qDestroyQuery(SQuery* pQueryNode) { void qDestroyQuery(SQuery* pQueryNode) {
// todo if (NULL == pQueryNode) {
return;
}
nodesDestroyNode(pQueryNode->pRoot);
tfree(pQueryNode->pResSchema);
if (NULL != pQueryNode->pCmdMsg) {
tfree(pQueryNode->pCmdMsg->pMsg);
tfree(pQueryNode->pCmdMsg);
}
tfree(pQueryNode);
} }
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
#include <stdbool.h> #include <stdbool.h>
#include "nodes.h" #include "nodes.h"
#include "ttoken.h" #include "parToken.h"
#include "ttokendef.h" #include "ttokendef.h"
#include "astCreateFuncs.h" #include "parAst.h"
/**************** End of %include directives **********************************/ /**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols /* These constants specify the various numeric values for terminal symbols
** in a format understandable to "makeheaders". This section is blank unless ** in a format understandable to "makeheaders". This section is blank unless
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
** YYACTIONTYPE is the data type used for "action codes" - numbers ** YYACTIONTYPE is the data type used for "action codes" - numbers
** that indicate what to do in response to the next ** that indicate what to do in response to the next
** token. ** token.
** NewParseTOKENTYPE is the data type used for minor type for terminal ** ParseTOKENTYPE is the data type used for minor type for terminal
** symbols. Background: A "minor type" is a semantic ** symbols. Background: A "minor type" is a semantic
** value associated with a terminal or non-terminal ** value associated with a terminal or non-terminal
** symbols. For example, for an "ID" terminal symbol, ** symbols. For example, for an "ID" terminal symbol,
...@@ -70,16 +70,16 @@ ...@@ -70,16 +70,16 @@
** symbols. ** symbols.
** YYMINORTYPE is the data type used for all minor types. ** YYMINORTYPE is the data type used for all minor types.
** This is typically a union of many types, one of ** This is typically a union of many types, one of
** which is NewParseTOKENTYPE. The entry in the union ** which is ParseTOKENTYPE. The entry in the union
** for terminal symbols is called "yy0". ** for terminal symbols is called "yy0".
** YYSTACKDEPTH is the maximum depth of the parser's stack. If ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
** zero the stack is dynamically sized using realloc() ** zero the stack is dynamically sized using realloc()
** NewParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_SDECL A static variable declaration for the %extra_argument
** NewParseARG_PDECL A parameter declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument
** NewParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
** NewParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_STORE Code to store %extra_argument into yypParser
** NewParseARG_FETCH Code to extract %extra_argument from yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser
** NewParseCTX_* As NewParseARG_ except for %extra_context ** ParseCTX_* As ParseARG_ except for %extra_context
** YYERRORSYMBOL is the code number of the error symbol. If not ** YYERRORSYMBOL is the code number of the error symbol. If not
** defined, then do no error processing. ** defined, then do no error processing.
** YYNSTATE the combined number of states. ** YYNSTATE the combined number of states.
...@@ -101,10 +101,10 @@ ...@@ -101,10 +101,10 @@
#define YYCODETYPE unsigned char #define YYCODETYPE unsigned char
#define YYNOCODE 208 #define YYNOCODE 208
#define YYACTIONTYPE unsigned short int #define YYACTIONTYPE unsigned short int
#define NewParseTOKENTYPE SToken #define ParseTOKENTYPE SToken
typedef union { typedef union {
int yyinit; int yyinit;
NewParseTOKENTYPE yy0; ParseTOKENTYPE yy0;
ENullOrder yy9; ENullOrder yy9;
SDatabaseOptions* yy103; SDatabaseOptions* yy103;
SToken yy161; SToken yy161;
...@@ -121,16 +121,16 @@ typedef union { ...@@ -121,16 +121,16 @@ typedef union {
#ifndef YYSTACKDEPTH #ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100 #define YYSTACKDEPTH 100
#endif #endif
#define NewParseARG_SDECL SAstCreateContext* pCxt ; #define ParseARG_SDECL SAstCreateContext* pCxt ;
#define NewParseARG_PDECL , SAstCreateContext* pCxt #define ParseARG_PDECL , SAstCreateContext* pCxt
#define NewParseARG_PARAM ,pCxt #define ParseARG_PARAM ,pCxt
#define NewParseARG_FETCH SAstCreateContext* pCxt =yypParser->pCxt ; #define ParseARG_FETCH SAstCreateContext* pCxt =yypParser->pCxt ;
#define NewParseARG_STORE yypParser->pCxt =pCxt ; #define ParseARG_STORE yypParser->pCxt =pCxt ;
#define NewParseCTX_SDECL #define ParseCTX_SDECL
#define NewParseCTX_PDECL #define ParseCTX_PDECL
#define NewParseCTX_PARAM #define ParseCTX_PARAM
#define NewParseCTX_FETCH #define ParseCTX_FETCH
#define NewParseCTX_STORE #define ParseCTX_STORE
#define YYNSTATE 278 #define YYNSTATE 278
#define YYNRULE 236 #define YYNRULE 236
#define YYNTOKEN 134 #define YYNTOKEN 134
...@@ -544,8 +544,8 @@ struct yyParser { ...@@ -544,8 +544,8 @@ struct yyParser {
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
int yyerrcnt; /* Shifts left before out of the error */ int yyerrcnt; /* Shifts left before out of the error */
#endif #endif
NewParseARG_SDECL /* A place to hold %extra_argument */ ParseARG_SDECL /* A place to hold %extra_argument */
NewParseCTX_SDECL /* A place to hold %extra_context */ ParseCTX_SDECL /* A place to hold %extra_context */
#if YYSTACKDEPTH<=0 #if YYSTACKDEPTH<=0
int yystksz; /* Current side of the stack */ int yystksz; /* Current side of the stack */
yyStackEntry *yystack; /* The parser's stack */ yyStackEntry *yystack; /* The parser's stack */
...@@ -581,7 +581,7 @@ static char *yyTracePrompt = 0; ...@@ -581,7 +581,7 @@ static char *yyTracePrompt = 0;
** Outputs: ** Outputs:
** None. ** None.
*/ */
void NewParseTrace(FILE *TraceFILE, char *zTracePrompt){ void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
yyTraceFILE = TraceFILE; yyTraceFILE = TraceFILE;
yyTracePrompt = zTracePrompt; yyTracePrompt = zTracePrompt;
if( yyTraceFILE==0 ) yyTracePrompt = 0; if( yyTraceFILE==0 ) yyTracePrompt = 0;
...@@ -1082,7 +1082,7 @@ static int yyGrowStack(yyParser *p){ ...@@ -1082,7 +1082,7 @@ static int yyGrowStack(yyParser *p){
#endif #endif
/* Datatype of the argument to the memory allocated passed as the /* Datatype of the argument to the memory allocated passed as the
** second argument to NewParseAlloc() below. This can be changed by ** second argument to ParseAlloc() below. This can be changed by
** putting an appropriate #define in the %include section of the input ** putting an appropriate #define in the %include section of the input
** grammar. ** grammar.
*/ */
...@@ -1092,9 +1092,9 @@ static int yyGrowStack(yyParser *p){ ...@@ -1092,9 +1092,9 @@ static int yyGrowStack(yyParser *p){
/* Initialize a new parser that has already been allocated. /* Initialize a new parser that has already been allocated.
*/ */
void NewParseInit(void *yypRawParser NewParseCTX_PDECL){ void ParseInit(void *yypRawParser ParseCTX_PDECL){
yyParser *yypParser = (yyParser*)yypRawParser; yyParser *yypParser = (yyParser*)yypRawParser;
NewParseCTX_STORE ParseCTX_STORE
#ifdef YYTRACKMAXSTACKDEPTH #ifdef YYTRACKMAXSTACKDEPTH
yypParser->yyhwm = 0; yypParser->yyhwm = 0;
#endif #endif
...@@ -1118,7 +1118,7 @@ void NewParseInit(void *yypRawParser NewParseCTX_PDECL){ ...@@ -1118,7 +1118,7 @@ void NewParseInit(void *yypRawParser NewParseCTX_PDECL){
#endif #endif
} }
#ifndef NewParse_ENGINEALWAYSONSTACK #ifndef Parse_ENGINEALWAYSONSTACK
/* /*
** This function allocates a new parser. ** This function allocates a new parser.
** The only argument is a pointer to a function which works like ** The only argument is a pointer to a function which works like
...@@ -1129,18 +1129,18 @@ void NewParseInit(void *yypRawParser NewParseCTX_PDECL){ ...@@ -1129,18 +1129,18 @@ void NewParseInit(void *yypRawParser NewParseCTX_PDECL){
** **
** Outputs: ** Outputs:
** A pointer to a parser. This pointer is used in subsequent calls ** A pointer to a parser. This pointer is used in subsequent calls
** to NewParse and NewParseFree. ** to Parse and ParseFree.
*/ */
void *NewParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) NewParseCTX_PDECL){ void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){
yyParser *yypParser; yyParser *yypParser;
yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
if( yypParser ){ if( yypParser ){
NewParseCTX_STORE ParseCTX_STORE
NewParseInit(yypParser NewParseCTX_PARAM); ParseInit(yypParser ParseCTX_PARAM);
} }
return (void*)yypParser; return (void*)yypParser;
} }
#endif /* NewParse_ENGINEALWAYSONSTACK */ #endif /* Parse_ENGINEALWAYSONSTACK */
/* The following function deletes the "minor type" or semantic value /* The following function deletes the "minor type" or semantic value
...@@ -1155,8 +1155,8 @@ static void yy_destructor( ...@@ -1155,8 +1155,8 @@ static void yy_destructor(
YYCODETYPE yymajor, /* Type code for object to destroy */ YYCODETYPE yymajor, /* Type code for object to destroy */
YYMINORTYPE *yypminor /* The object to be destroyed */ YYMINORTYPE *yypminor /* The object to be destroyed */
){ ){
NewParseARG_FETCH ParseARG_FETCH
NewParseCTX_FETCH ParseCTX_FETCH
switch( yymajor ){ switch( yymajor ){
/* Here is inserted the actions which take place when a /* Here is inserted the actions which take place when a
** terminal or non-terminal is destroyed. This can happen ** terminal or non-terminal is destroyed. This can happen
...@@ -1321,7 +1321,7 @@ static void yy_pop_parser_stack(yyParser *pParser){ ...@@ -1321,7 +1321,7 @@ static void yy_pop_parser_stack(yyParser *pParser){
/* /*
** Clear all secondary memory allocations from the parser ** Clear all secondary memory allocations from the parser
*/ */
void NewParseFinalize(void *p){ void ParseFinalize(void *p){
yyParser *pParser = (yyParser*)p; yyParser *pParser = (yyParser*)p;
while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0 #if YYSTACKDEPTH<=0
...@@ -1329,7 +1329,7 @@ void NewParseFinalize(void *p){ ...@@ -1329,7 +1329,7 @@ void NewParseFinalize(void *p){
#endif #endif
} }
#ifndef NewParse_ENGINEALWAYSONSTACK #ifndef Parse_ENGINEALWAYSONSTACK
/* /*
** Deallocate and destroy a parser. Destructors are called for ** Deallocate and destroy a parser. Destructors are called for
** all stack elements before shutting the parser down. ** all stack elements before shutting the parser down.
...@@ -1338,23 +1338,23 @@ void NewParseFinalize(void *p){ ...@@ -1338,23 +1338,23 @@ void NewParseFinalize(void *p){
** is defined in a %include section of the input grammar) then it is ** is defined in a %include section of the input grammar) then it is
** assumed that the input pointer is never NULL. ** assumed that the input pointer is never NULL.
*/ */
void NewParseFree( void ParseFree(
void *p, /* The parser to be deleted */ void *p, /* The parser to be deleted */
void (*freeProc)(void*) /* Function used to reclaim memory */ void (*freeProc)(void*) /* Function used to reclaim memory */
){ ){
#ifndef YYPARSEFREENEVERNULL #ifndef YYPARSEFREENEVERNULL
if( p==0 ) return; if( p==0 ) return;
#endif #endif
NewParseFinalize(p); ParseFinalize(p);
(*freeProc)(p); (*freeProc)(p);
} }
#endif /* NewParse_ENGINEALWAYSONSTACK */ #endif /* Parse_ENGINEALWAYSONSTACK */
/* /*
** Return the peak depth of the stack for a parser. ** Return the peak depth of the stack for a parser.
*/ */
#ifdef YYTRACKMAXSTACKDEPTH #ifdef YYTRACKMAXSTACKDEPTH
int NewParseStackPeak(void *p){ int ParseStackPeak(void *p){
yyParser *pParser = (yyParser*)p; yyParser *pParser = (yyParser*)p;
return pParser->yyhwm; return pParser->yyhwm;
} }
...@@ -1378,7 +1378,7 @@ static unsigned char yycoverage[YYNSTATE][YYNTOKEN]; ...@@ -1378,7 +1378,7 @@ static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
** Return the number of missed state/lookahead combinations. ** Return the number of missed state/lookahead combinations.
*/ */
#if defined(YYCOVERAGE) #if defined(YYCOVERAGE)
int NewParseCoverage(FILE *out){ int ParseCoverage(FILE *out){
int stateno, iLookAhead, i; int stateno, iLookAhead, i;
int nMissed = 0; int nMissed = 0;
for(stateno=0; stateno<YYNSTATE; stateno++){ for(stateno=0; stateno<YYNSTATE; stateno++){
...@@ -1500,8 +1500,8 @@ static YYACTIONTYPE yy_find_reduce_action( ...@@ -1500,8 +1500,8 @@ static YYACTIONTYPE yy_find_reduce_action(
** The following routine is called if the stack overflows. ** The following routine is called if the stack overflows.
*/ */
static void yyStackOverflow(yyParser *yypParser){ static void yyStackOverflow(yyParser *yypParser){
NewParseARG_FETCH ParseARG_FETCH
NewParseCTX_FETCH ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
...@@ -1512,8 +1512,8 @@ static void yyStackOverflow(yyParser *yypParser){ ...@@ -1512,8 +1512,8 @@ static void yyStackOverflow(yyParser *yypParser){
** stack every overflows */ ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/ /******** Begin %stack_overflow code ******************************************/
/******** End %stack_overflow code ********************************************/ /******** End %stack_overflow code ********************************************/
NewParseARG_STORE /* Suppress warning about unused %extra_argument var */ ParseARG_STORE /* Suppress warning about unused %extra_argument var */
NewParseCTX_STORE ParseCTX_STORE
} }
/* /*
...@@ -1544,7 +1544,7 @@ static void yy_shift( ...@@ -1544,7 +1544,7 @@ static void yy_shift(
yyParser *yypParser, /* The parser to be shifted */ yyParser *yypParser, /* The parser to be shifted */
YYACTIONTYPE yyNewState, /* The new state to shift in */ YYACTIONTYPE yyNewState, /* The new state to shift in */
YYCODETYPE yyMajor, /* The major token to shift in */ YYCODETYPE yyMajor, /* The major token to shift in */
NewParseTOKENTYPE yyMinor /* The minor token to shift in */ ParseTOKENTYPE yyMinor /* The minor token to shift in */
){ ){
yyStackEntry *yytos; yyStackEntry *yytos;
yypParser->yytos++; yypParser->yytos++;
...@@ -1840,14 +1840,14 @@ static YYACTIONTYPE yy_reduce( ...@@ -1840,14 +1840,14 @@ static YYACTIONTYPE yy_reduce(
yyParser *yypParser, /* The parser */ yyParser *yypParser, /* The parser */
unsigned int yyruleno, /* Number of the rule by which to reduce */ unsigned int yyruleno, /* Number of the rule by which to reduce */
int yyLookahead, /* Lookahead token, or YYNOCODE if none */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */
NewParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
NewParseCTX_PDECL /* %extra_context */ ParseCTX_PDECL /* %extra_context */
){ ){
int yygoto; /* The next state */ int yygoto; /* The next state */
YYACTIONTYPE yyact; /* The next action */ YYACTIONTYPE yyact; /* The next action */
yyStackEntry *yymsp; /* The top of the parser's stack */ yyStackEntry *yymsp; /* The top of the parser's stack */
int yysize; /* Amount to pop the stack */ int yysize; /* Amount to pop the stack */
NewParseARG_FETCH ParseARG_FETCH
(void)yyLookahead; (void)yyLookahead;
(void)yyLookaheadToken; (void)yyLookaheadToken;
yymsp = yypParser->yytos; yymsp = yypParser->yytos;
...@@ -2680,8 +2680,8 @@ static YYACTIONTYPE yy_reduce( ...@@ -2680,8 +2680,8 @@ static YYACTIONTYPE yy_reduce(
static void yy_parse_failed( static void yy_parse_failed(
yyParser *yypParser /* The parser */ yyParser *yypParser /* The parser */
){ ){
NewParseARG_FETCH ParseARG_FETCH
NewParseCTX_FETCH ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
...@@ -2692,8 +2692,8 @@ static void yy_parse_failed( ...@@ -2692,8 +2692,8 @@ static void yy_parse_failed(
** parser fails */ ** parser fails */
/************ Begin %parse_failure code ***************************************/ /************ Begin %parse_failure code ***************************************/
/************ End %parse_failure code *****************************************/ /************ End %parse_failure code *****************************************/
NewParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
NewParseCTX_STORE ParseCTX_STORE
} }
#endif /* YYNOERRORRECOVERY */ #endif /* YYNOERRORRECOVERY */
...@@ -2703,10 +2703,10 @@ static void yy_parse_failed( ...@@ -2703,10 +2703,10 @@ static void yy_parse_failed(
static void yy_syntax_error( static void yy_syntax_error(
yyParser *yypParser, /* The parser */ yyParser *yypParser, /* The parser */
int yymajor, /* The major type of the error token */ int yymajor, /* The major type of the error token */
NewParseTOKENTYPE yyminor /* The minor type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */
){ ){
NewParseARG_FETCH ParseARG_FETCH
NewParseCTX_FETCH ParseCTX_FETCH
#define TOKEN yyminor #define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/ /************ Begin %syntax_error code ****************************************/
...@@ -2717,8 +2717,8 @@ static void yy_syntax_error( ...@@ -2717,8 +2717,8 @@ static void yy_syntax_error(
} }
pCxt->valid = false; pCxt->valid = false;
/************ End %syntax_error code ******************************************/ /************ End %syntax_error code ******************************************/
NewParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
NewParseCTX_STORE ParseCTX_STORE
} }
/* /*
...@@ -2727,8 +2727,8 @@ static void yy_syntax_error( ...@@ -2727,8 +2727,8 @@ static void yy_syntax_error(
static void yy_accept( static void yy_accept(
yyParser *yypParser /* The parser */ yyParser *yypParser /* The parser */
){ ){
NewParseARG_FETCH ParseARG_FETCH
NewParseCTX_FETCH ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
...@@ -2742,13 +2742,13 @@ static void yy_accept( ...@@ -2742,13 +2742,13 @@ static void yy_accept(
** parser accepts */ ** parser accepts */
/*********** Begin %parse_accept code *****************************************/ /*********** Begin %parse_accept code *****************************************/
/*********** End %parse_accept code *******************************************/ /*********** End %parse_accept code *******************************************/
NewParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
NewParseCTX_STORE ParseCTX_STORE
} }
/* The main parser program. /* The main parser program.
** The first argument is a pointer to a structure obtained from ** The first argument is a pointer to a structure obtained from
** "NewParseAlloc" which describes the current state of the parser. ** "ParseAlloc" which describes the current state of the parser.
** The second argument is the major token number. The third is ** The second argument is the major token number. The third is
** the minor token. The fourth optional argument is whatever the ** the minor token. The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for ** user wants (and specified in the grammar) and is available for
...@@ -2765,11 +2765,11 @@ static void yy_accept( ...@@ -2765,11 +2765,11 @@ static void yy_accept(
** Outputs: ** Outputs:
** None. ** None.
*/ */
void NewParse( void Parse(
void *yyp, /* The parser */ void *yyp, /* The parser */
int yymajor, /* The major token code number */ int yymajor, /* The major token code number */
NewParseTOKENTYPE yyminor /* The value for the token */ ParseTOKENTYPE yyminor /* The value for the token */
NewParseARG_PDECL /* Optional %extra_argument parameter */ ParseARG_PDECL /* Optional %extra_argument parameter */
){ ){
YYMINORTYPE yyminorunion; YYMINORTYPE yyminorunion;
YYACTIONTYPE yyact; /* The parser action. */ YYACTIONTYPE yyact; /* The parser action. */
...@@ -2780,8 +2780,8 @@ void NewParse( ...@@ -2780,8 +2780,8 @@ void NewParse(
int yyerrorhit = 0; /* True if yymajor has invoked an error */ int yyerrorhit = 0; /* True if yymajor has invoked an error */
#endif #endif
yyParser *yypParser = (yyParser*)yyp; /* The parser */ yyParser *yypParser = (yyParser*)yyp; /* The parser */
NewParseCTX_FETCH ParseCTX_FETCH
NewParseARG_STORE ParseARG_STORE
assert( yypParser->yytos!=0 ); assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
...@@ -2806,7 +2806,7 @@ void NewParse( ...@@ -2806,7 +2806,7 @@ void NewParse(
yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
if( yyact >= YY_MIN_REDUCE ){ if( yyact >= YY_MIN_REDUCE ){
yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
yyminor NewParseCTX_PARAM); yyminor ParseCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){ }else if( yyact <= YY_MAX_SHIFTREDUCE ){
yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
...@@ -2939,7 +2939,7 @@ void NewParse( ...@@ -2939,7 +2939,7 @@ void NewParse(
** Return the fallback token corresponding to canonical token iToken, or ** Return the fallback token corresponding to canonical token iToken, or
** 0 if iToken has no fallback. ** 0 if iToken has no fallback.
*/ */
int NewParseFallback(int iToken){ int ParseFallback(int iToken){
#ifdef YYFALLBACK #ifdef YYFALLBACK
if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){ if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
return yyFallback[iToken]; return yyFallback[iToken];
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "parserInt.h" #include "parInt.h"
using namespace std; using namespace std;
using namespace testing; using namespace testing;
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "insertParser.h" #include "parInt.h"
// #include "mockCatalog.h"
using namespace std; using namespace std;
using namespace testing; using namespace testing;
......
此差异已折叠。
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "plannerInt.h" #include "planInt.h"
#include "functionMgt.h" #include "functionMgt.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "plannerInt.h" #include "planInt.h"
#include "functionMgt.h" #include "functionMgt.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "plannerInt.h" #include "planInt.h"
#define SPLIT_FLAG_MASK(n) (1 << n) #define SPLIT_FLAG_MASK(n) (1 << n)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "planner.h" #include "planner.h"
#include "plannerInt.h" #include "planInt.h"
int32_t optimize(SPlanContext* pCxt, SLogicNode* pLogicNode) { int32_t optimize(SPlanContext* pCxt, SLogicNode* pLogicNode) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "parser.h" #include "parser.h"
#include "plannerInt.h" #include "planInt.h"
using namespace std; using namespace std;
using namespace testing; using namespace testing;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册