diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 548a280d9e5c565d015e5cf19ef9e5f0fcd284fc..24b59d205f36bbdbb53d36dc9d8e47a67589acbf 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7201,6 +7201,7 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* } if (IS_MULTIOUTPUT(aAggs[f].status) && f != TSDB_FUNC_TOP && f != TSDB_FUNC_BOTTOM && f != TSDB_FUNC_DIFF && + f != TSDB_FUNC_MAVG && f != TSDB_FUNC_CSUM && f != TSDB_FUNC_SAMPLE && f != TSDB_FUNC_DERIVATIVE && f != TSDB_FUNC_TAGPRJ && f != TSDB_FUNC_PRJ) { return invalidOperationMsg(msg, msg1); } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 60a6e241ccdfd48c7eb5a68f2dd7a251f76097a5..24080662faf5efcc071e67a0c2123a72138f8a89 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -612,7 +612,9 @@ bool isSimpleAggregateRv(SQueryInfo* pQueryInfo) { } if ((!IS_MULTIOUTPUT(aAggs[functionId].status)) || - (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_TS_COMP)) { + (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || + functionId == TSDB_FUNC_TS_COMP || + functionId == TSDB_FUNC_SAMPLE)) { return true; } } diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 3e01f7ed5abbb3f5b138db1f3cd46f55d85c6fa7..32c8630ff2ff04bb6fe453aebf49344adea6fc7a 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -4771,6 +4771,7 @@ static void sample_func_finalizer(SQLFunctionCtx *pCtx) { assert(pResInfo->hasResult != DATA_SET_FLAG); } + pResInfo->numOfRes = pRes->numSampled; GET_TRUE_DATA_TYPE(); copySampleFuncRes(pCtx, type); diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c index bc27e094db3dcb85ffa73810e922d73cd42ab3a0..8babdbf1c39c8da9139c691e24f0a87ab57fb854 100644 --- a/src/query/src/qUtil.c +++ b/src/query/src/qUtil.c @@ -33,7 +33,9 @@ typedef struct SCompSupporter { int32_t getRowNumForMultioutput(SQueryAttr* pQueryAttr, bool topBottomQuery, bool stable) { if (pQueryAttr && (!stable)) { for (int16_t i = 0; i < pQueryAttr->numOfOutput; ++i) { - if (pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_TOP || pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_BOTTOM) { + if (pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_TOP || + pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_BOTTOM || + pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_SAMPLE) { return (int32_t)pQueryAttr->pExpr1[i].base.param[0].i64; } }