From 30e09c4b19dfa2941b3b7db93e21c96627b60872 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 15 Jul 2022 16:41:19 +0800 Subject: [PATCH] fix(query): fix when select percentile() has no from table clause report error issue --- source/libs/parser/src/parTranslater.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c88e38ddff..8cb0e3b32d 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1165,7 +1165,11 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p if (!fmIsRepeatScanFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { + if (isSelectStmt(pCxt->pCurrStmt)) { + //select percentile() is also valid + if (NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { + return TSDB_CODE_SUCCESS; + } SNode* pTable = ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable; if (QUERY_NODE_REAL_TABLE == nodeType(pTable) && (TSDB_CHILD_TABLE == ((SRealTableNode*)pTable)->pMeta->tableType ||