diff --git a/src/client/src/tscGlobalmerge.c b/src/client/src/tscGlobalmerge.c index aa7cf1dd9d29649bf4eb01dd3cad5ca95644a133..0469b556874ce59d6c87e8237fcedf197766feeb 100644 --- a/src/client/src/tscGlobalmerge.c +++ b/src/client/src/tscGlobalmerge.c @@ -612,7 +612,6 @@ static void doMergeResultImpl(SOperatorInfo* pInfo, SQLFunctionCtx *pCtx, int32_ aAggs[functionId].mergeFunc(&pCtx[j]); } - SQueryAttr* pQueryAttr = pInfo->pRuntimeEnv->pQueryAttr; if (functionId == TSDB_FUNC_UNIQUE && (GET_RES_INFO(&(pCtx[j]))->numOfRes > MAX_UNIQUE_RESULT_ROWS || GET_RES_INFO(&(pCtx[j]))->numOfRes == -1)){ tscError("Unique result num is too large. num: %d, limit: %d", diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 40bb9aa4ac3438524273b32cd9671d42691774cf..430c88a1d7488f72d1fe102dd42ae2a5e32dc9ee 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3248,7 +3248,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col tVariantDump(pVariant, val, TSDB_DATA_TYPE_BIGINT, true); int64_t numRowsSelected = GET_INT32_VAL(val); - if (numRowsSelected <= 0 || numRowsSelected > 100) { // todo use macro + if (functionId != TSDB_FUNC_UNIQUE && (numRowsSelected <= 0 || numRowsSelected > 100)) { // todo use macro return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12); } diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 6f16255f14b8c3c77a9973d304796aa82c591301..60287c8e474cc79a827637639cf5f9b42bebb53f 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -5190,7 +5190,6 @@ static bool unique_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pRes if (!function_setup(pCtx, pResInfo)) { return false; } - SUniqueFuncInfo *uniqueInfo = getUniqueOutputInfo(pCtx); return true; } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 65acec8a203ebc905bcd8c8be2a10a091039886e..c4cfdd1d4d80beb6f896bef69201840d995de9a5 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1276,7 +1276,6 @@ static void doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SQLFunction assert(0); } - SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; if (functionId == TSDB_FUNC_UNIQUE && (GET_RES_INFO(&(pCtx[k]))->numOfRes > MAX_UNIQUE_RESULT_ROWS || GET_RES_INFO(&(pCtx[k]))->numOfRes == -1)){ qError("Unique result num is too large. num: %d, limit: %d", @@ -8994,7 +8993,7 @@ static int32_t updateOutputBufForTopBotQuery(SQueriedTableInfo* pTableInfo, SCol for (int32_t i = 0; i < numOfOutput; ++i) { int16_t functId = pExprs[i].base.functionId; - if (functId == TSDB_FUNC_TOP || functId == TSDB_FUNC_BOTTOM || functId == TSDB_FUNC_SAMPLE || funcIf == TSDB_FUNC_UNIQUE) { + if (functId == TSDB_FUNC_TOP || functId == TSDB_FUNC_BOTTOM || functId == TSDB_FUNC_SAMPLE || functId == TSDB_FUNC_UNIQUE) { int32_t j = getColumnIndexInSource(pTableInfo, &pExprs[i].base, pTagCols); if (j < 0 || j >= pTableInfo->numOfCols) { return TSDB_CODE_QRY_INVALID_MSG;