From ac0c75ab2dd76d2dddf5e5dc35473b45a6affe50 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Jun 2022 13:28:33 +0800 Subject: [PATCH] fix: a problem of parser async --- source/libs/parser/src/parAstParser.c | 3 ++- source/libs/parser/src/parInsert.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index e6a905103a..f05987c307 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -110,7 +110,8 @@ static EDealRes collectMetaKeyFromFunction(SCollectMetaKeyFromExprCxt* pCxt, SFu if (fmIsBuiltinFunc(pFunc->functionName)) { return TSDB_CODE_SUCCESS; } - return reserveUdfInCache(pFunc->functionName, pCxt->pComCxt->pMetaCache); + pCxt->errCode = reserveUdfInCache(pFunc->functionName, pCxt->pComCxt->pMetaCache); + return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; } static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, SRealTableNode* pRealTable, diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 8f17d500ab..2cfc06b575 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1006,7 +1006,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint } SSchema* pTagSchema = &pSchema[pCxt->tags.boundColumns[i]]; - char* tmpTokenBuf = taosMemoryCalloc(1, sToken.n); //todo this can be optimize with parse column + char* tmpTokenBuf = taosMemoryCalloc(1, sToken.n); // todo this can be optimize with parse column code = checkAndTrimValue(&sToken, tmpTokenBuf, &pCxt->msg); if (code != TSDB_CODE_SUCCESS) { taosMemoryFree(tmpTokenBuf); @@ -1018,7 +1018,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint taosMemoryFree(tmpTokenBuf); goto end; } - if(isNullStr(&sToken)) { + if (isNullStr(&sToken)) { code = tTagNew(pTagVals, 1, true, &pTag); } else { code = parseJsontoTagData(sToken.z, pTagVals, &pTag, &pCxt->msg); @@ -1530,10 +1530,13 @@ typedef struct SInsertParseSyntaxCxt { } SInsertParseSyntaxCxt; static int32_t skipParentheses(SInsertParseSyntaxCxt* pCxt) { - SToken sToken; + SToken sToken; + int32_t expectRightParenthesis = 1; while (1) { NEXT_TOKEN(pCxt->pSql, sToken); - if (TK_NK_RP == sToken.type) { + if (TK_NK_LP == sToken.type) { + ++expectRightParenthesis; + } else if (TK_NK_RP == sToken.type && 0 == --expectRightParenthesis) { break; } if (0 == sToken.n) { -- GitLab