From 3a0df8be8d6fb255990bd8586d039b4a6fe78aa6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Mar 2024 23:13:24 +0800 Subject: [PATCH] fix(query): handle the calculation of logic expression with different result rows, when constant expression exists. --- source/libs/scalar/src/scalar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index b1cd10eac9..5f43ae9f3c 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -808,7 +808,11 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o complete = false; continue; } - char *p = colDataGetData(params[m].columnData, i); + + // 1=1 and tag_column = 1 + int32_t ind = (i >= params[m].numOfRows)? (params[m].numOfRows - 1):i; + char* p = colDataGetData(params[m].columnData, ind); + GET_TYPED_DATA(value, bool, params[m].columnData->info.type, p); if (LOGIC_COND_TYPE_AND == node->condType && (false == value)) {