From 5cfe7b8ec9ea5556d335fd66a685677e0fe9b5f8 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 11 Sep 2024 14:58:06 +0800 Subject: [PATCH] fix(query):fix the issue of return db error when the timestamp is 0 --- source/libs/executor/src/timewindowoperator.c | 8 +---- tests/parallel_test/cases.task | 1 + tests/script/tsim/compute/interval1.sim | 33 +++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 tests/script/tsim/compute/interval1.sim diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 93b3759c47..640ce5c98b 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -894,13 +894,7 @@ int64_t* extractTsCol(SSDataBlock* pBlock, const SIntervalAggOperatorInfo* pInfo tsCols = (int64_t*)pColDataInfo->pData; if(tsCols[0] == 0) { - pTaskInfo->code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; - T_LONG_JMP(pTaskInfo->env, terrno); - } - - // no data in primary ts - if (tsCols[0] == 0 && tsCols[pBlock->info.rows - 1] == 0) { - return NULL; + qWarn("%s at line %d.block start ts:%" PRId64 ",end ts:%" PRId64, __func__, __LINE__, tsCols[0], tsCols[pBlock->info.rows - 1]); } if (tsCols[0] != 0 && (pBlock->info.window.skey == 0 && pBlock->info.window.ekey == 0)) { diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c8e0a624d5..76ec6422b9 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1453,6 +1453,7 @@ ,,y,script,./test.sh -f tsim/compute/diff2.sim ,,y,script,./test.sh -f tsim/compute/first.sim ,,y,script,./test.sh -f tsim/compute/interval.sim +,,y,script,./test.sh -f tsim/compute/interval1.sim ,,y,script,./test.sh -f tsim/compute/last_row.sim ,,y,script,./test.sh -f tsim/compute/last.sim ,,y,script,./test.sh -f tsim/compute/leastsquare.sim diff --git a/tests/script/tsim/compute/interval1.sim b/tests/script/tsim/compute/interval1.sim new file mode 100644 index 0000000000..74af727917 --- /dev/null +++ b/tests/script/tsim/compute/interval1.sim @@ -0,0 +1,33 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c timezone -v UTC +system sh/exec.sh -n dnode1 -s start +sql connect + + +sql CREATE DATABASE `alphacloud_alphaess` BUFFER 512 CACHESIZE 1024 CACHEMODEL 'both' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 KEEP 365000d; + +sql use alphacloud_alphaess; + +sql create stable st(ts TIMESTAMP ENCODE 'delta-i' COMPRESS 'lz4' LEVEL 'medium', `uk` VARCHAR(64) ENCODE 'disabled' COMPRESS 'lz4' LEVEL 'medium' PRIMARY KEY ) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); + +sql insert into t1 values ("1970-01-29 05:04:53.000"," 22:: "); + +sql select _wstart, count(*) from st interval(1y); + +if $rows != 1 then + print =====rows=$rows + return -1 +endi + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +if $data01 != 1 then + print =====data00=$data00 + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT