diff --git a/source/libs/executor/src/mergejoin.c b/source/libs/executor/src/mergejoin.c index a3f00ed25c..c17abdf160 100755 --- a/source/libs/executor/src/mergejoin.c +++ b/source/libs/executor/src/mergejoin.c @@ -3129,7 +3129,7 @@ int32_t mJoinInitMergeCtx(SMJoinOperatorInfo* pJoin, SSortMergeJoinPhysiNode* pJ pCtx->finBlk = createDataBlockFromDescNode(pJoinNode->node.pOutputDataBlockDesc); blockDataEnsureCapacity(pCtx->finBlk, TMAX(MJOIN_DEFAULT_BLK_ROWS_NUM, MJOIN_BLK_SIZE_LIMIT/pJoinNode->node.pOutputDataBlockDesc->totalRowSize)); - + if (pJoin->pFPreFilter) { pCtx->midBlk = createOneDataBlock(pCtx->finBlk, false); blockDataEnsureCapacity(pCtx->midBlk, pCtx->finBlk->info.capacity); diff --git a/source/libs/executor/src/mergejoinoperator.c b/source/libs/executor/src/mergejoinoperator.c index 32cd4b113c..4d0da62463 100644 --- a/source/libs/executor/src/mergejoinoperator.c +++ b/source/libs/executor/src/mergejoinoperator.c @@ -1393,7 +1393,8 @@ SSDataBlock* mJoinMainProcess(struct SOperatorInfo* pOperator) { doFilter(pBlock, pJoin->pFinFilter, NULL); } - if (pBlock->info.rows > 0 || pOperator->status == OP_EXEC_DONE) { + if (pBlock->info.rows > 0 || pOperator->status == OP_EXEC_DONE) { + pBlock->info.dataLoad = 1; break; } } diff --git a/tests/script/tsim/join/left_asof_join.sim b/tests/script/tsim/join/left_asof_join.sim index 57ad8ca922..8341da1078 100644 --- a/tests/script/tsim/join/left_asof_join.sim +++ b/tests/script/tsim/join/left_asof_join.sim @@ -902,7 +902,63 @@ if $data00 != 6 then return -1 endi +sql select _wstart, count(*) from sta a left asof join sta b on a.ts <= b.ts and a.t1=b.t1 and a.col1=b.col1 jlimit 2 interval(1s); +if $rows != 6 then + return -1 +endi +if $data00 != @23-11-17 16:29:00.000@ then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != @23-11-17 16:29:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @23-11-17 16:29:02.000@ then + return -1 +endi +if $data21 != 1 then + return -1 +endi +if $data30 != @23-11-17 16:29:03.000@ then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data40 != @23-11-17 16:29:04.000@ then + return -1 +endi +if $data41 != 1 then + return -1 +endi +if $data50 != @23-11-17 16:29:05.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +sql select _wstart, count(*) from sta a left asof join sta b on a.ts <= b.ts and a.t1=b.t1 and a.col1=b.col1 jlimit 2 interval(1s) having(count(*) > 1); +if $rows != 2 then + return -1 +endi +if $data00 != @23-11-17 16:29:00.000@ then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != @23-11-17 16:29:03.000@ then + return -1 +endi +if $data11 != 2 then + return -1 +endi sql_error select a.ts, b.ts from sta a left asof join sta b on a.ts >=b.ts and a.col1=a.ts; sql_error select a.ts, b.ts from sta a left asof join sta b on a.ts >=b.ts and a.col1 > 1;