From 3cea46db0022b5ed8dfc2aa04bceb5edaa5e7258 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 8 Mar 2023 17:45:25 +0800 Subject: [PATCH] fix(query): fix scalar calculation crash in stream when input rows is 0 --- source/libs/scalar/src/scalar.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 25938a7678..fe01977b2e 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -59,6 +59,8 @@ int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarPara pParam->columnData = pColumnData; pParam->colAlloced = true; + pParam->numOfRows = numOfRows; + return TSDB_CODE_SUCCESS; } @@ -740,6 +742,10 @@ int32_t sclExecFunction(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outp SCL_ERR_JRET(code); } + if (rowNum == 0) { + goto _return; + } + code = (*ffpSet.process)(params, paramNum, output); if (code) { sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code)); -- GitLab