From 6b6f85e22f27adc8f61cc9e59fa2db6e12ed8496 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 3 Aug 2022 21:24:47 +0800 Subject: [PATCH 1/2] fix(query): fix interp function core dump TD-18115 --- source/libs/executor/src/timewindowoperator.c | 2 ++ source/libs/function/src/builtins.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index a14f554cf5..356c11af82 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2375,6 +2375,8 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTimeslice, NULL, NULL, destroyBasicOperatorInfo, NULL, NULL, NULL); + blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); + code = appendDownstream(pOperator, &downstream, 1); return pOperator; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index dd84535eac..49c37fc24f 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2246,7 +2246,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "derivative", .type = FUNCTION_TYPE_DERIVATIVE, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, .translateFunc = translateDerivative, .getEnvFunc = getDerivativeFuncEnv, From c99e1adc7de9f49038eec57e466d0d000c3f5162 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 5 Aug 2022 19:23:30 +0800 Subject: [PATCH 2/2] fix test cases --- tests/script/tsim/parser/nestquery.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/tsim/parser/nestquery.sim b/tests/script/tsim/parser/nestquery.sim index 101205db74..8cb7a3790b 100644 --- a/tests/script/tsim/parser/nestquery.sim +++ b/tests/script/tsim/parser/nestquery.sim @@ -160,12 +160,12 @@ endi sql select stddev(c1) from (select c1 from nest_tb0); sql_error select percentile(c1, 20) from (select * from nest_tb0); -sql select interp(c1) from (select * from nest_tb0); +#sql select interp(c1) from (select * from nest_tb0); sql_error select derivative(val, 1s, 0) from (select c1 val from nest_tb0); sql_error select twa(c1) from (select c1 from nest_tb0); sql_error select irate(c1) from (select c1 from nest_tb0); sql_error select diff(c1), twa(c1) from (select * from nest_tb0); -sql_error select irate(c1), interp(c1), twa(c1) from (select * from nest_tb0); +#sql_error select irate(c1), interp(c1), twa(c1) from (select * from nest_tb0); sql select _wstart, apercentile(c1, 50) from (select * from nest_tb0) interval(1d) if $rows != 7 then