fix: full join issues
This commit is contained in:
parent
0695ed8974
commit
0ef7f089be
|
@ -906,7 +906,10 @@ static int32_t mFullJoinHandleMergeGrpRemains(SMJoinMergeCtx* pCtx) {
|
|||
}
|
||||
|
||||
if (pGrpRows->rowMatchNum <= 0 || pGrpRows->allRowsNMatch) {
|
||||
pGrpRows->allRowsNMatch = true;
|
||||
if (pGrpRows->rowMatchNum <= 0) {
|
||||
pGrpRows->allRowsNMatch = true;
|
||||
pNMatch->rowIdx = pGrpRows->beginIdx;
|
||||
}
|
||||
|
||||
MJ_ERR_RET(mFullJoinOutputMergeGrpRows(pCtx, pGrpRows, pNMatch, &grpDone));
|
||||
|
||||
|
@ -1033,7 +1036,9 @@ SSDataBlock* mFullJoinDo(struct SOperatorInfo* pOperator) {
|
|||
} else {
|
||||
MJOIN_GET_TB_CUR_TS(pProbeCol, probeTs, pJoin->probe);
|
||||
}
|
||||
} else if (pCtx->lastEqGrp && pJoin->build->rowBitmapSize > 0) {
|
||||
}
|
||||
|
||||
if (pCtx->lastEqGrp && pJoin->build->rowBitmapSize > 0) {
|
||||
MJ_ERR_JRET(mFullJoinHandleBuildTableRemains(pCtx));
|
||||
if (pCtx->finBlk->info.rows >= pCtx->blkThreshold) {
|
||||
return pCtx->finBlk;
|
||||
|
@ -1051,14 +1056,14 @@ SSDataBlock* mFullJoinDo(struct SOperatorInfo* pOperator) {
|
|||
MJOIN_GET_TB_COL_TS(pBuildCol, buildTs, pJoin->build);
|
||||
MJOIN_GET_TB_COL_TS(pProbeCol, probeTs, pJoin->probe);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pCtx->lastEqGrp && pJoin->build->rowBitmapSize > 0) {
|
||||
MJ_ERR_JRET(mFullJoinHandleBuildTableRemains(pCtx));
|
||||
if (pCtx->finBlk->info.rows >= pCtx->blkThreshold) {
|
||||
return pCtx->finBlk;
|
||||
if (!FJOIN_PROBE_TB_ROWS_DONE(pJoin->probe) && probeTs != pCtx->lastEqTs && pJoin->build->rowBitmapSize > 0) {
|
||||
MJ_ERR_JRET(mFullJoinHandleBuildTableRemains(pCtx));
|
||||
if (pCtx->finBlk->info.rows >= pCtx->blkThreshold) {
|
||||
return pCtx->finBlk;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PROBE_TS_UNREACH(pCtx->ascTs, probeTs, buildTs)) {
|
||||
|
@ -1073,6 +1078,13 @@ SSDataBlock* mFullJoinDo(struct SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
if (pJoin->build->dsFetchDone && !FJOIN_PROBE_TB_ROWS_DONE(pJoin->probe)) {
|
||||
if (pCtx->lastEqGrp && pJoin->build->rowBitmapSize > 0) {
|
||||
MJ_ERR_JRET(mFullJoinHandleBuildTableRemains(pCtx));
|
||||
if (pCtx->finBlk->info.rows >= pCtx->blkThreshold) {
|
||||
return pCtx->finBlk;
|
||||
}
|
||||
}
|
||||
|
||||
pCtx->probeNEqGrp.blk = pJoin->probe->blk;
|
||||
pCtx->probeNEqGrp.beginIdx = pJoin->probe->blkRowIdx;
|
||||
pCtx->probeNEqGrp.readIdx = pCtx->probeNEqGrp.beginIdx;
|
||||
|
@ -1087,6 +1099,13 @@ SSDataBlock* mFullJoinDo(struct SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
if (pJoin->probe->dsFetchDone && !MJOIN_BUILD_TB_ROWS_DONE(pJoin->build)) {
|
||||
if (pCtx->lastEqGrp && pJoin->build->rowBitmapSize > 0) {
|
||||
MJ_ERR_JRET(mFullJoinHandleBuildTableRemains(pCtx));
|
||||
if (pCtx->finBlk->info.rows >= pCtx->blkThreshold) {
|
||||
return pCtx->finBlk;
|
||||
}
|
||||
}
|
||||
|
||||
pCtx->buildNEqGrp.blk = pJoin->build->blk;
|
||||
pCtx->buildNEqGrp.beginIdx = pJoin->build->blkRowIdx;
|
||||
pCtx->buildNEqGrp.readIdx = pCtx->buildNEqGrp.beginIdx;
|
||||
|
|
|
@ -1777,7 +1777,7 @@ void runSingleTest(char* caseName, SJoinTestParam* param) {
|
|||
bool contLoop = true;
|
||||
|
||||
SSortMergeJoinPhysiNode* pNode = createDummySortMergeJoinPhysiNode(param->joinType, param->subType, param->cond, param->filter, param->asc);
|
||||
createDummyBlkList(10, 10, 10, 10, 3);
|
||||
createDummyBlkList(20000, 20000, 20000, 20000, 4096);
|
||||
|
||||
while (contLoop) {
|
||||
rerunBlockedHere();
|
||||
|
|
|
@ -2,67 +2,25 @@ sql connect
|
|||
sql use test0;
|
||||
|
||||
sql select a.col1, b.col1 from sta a full join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
|
||||
if $rows != 10 then
|
||||
if $rows != 16 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 1 then
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
if $data01 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != 1 then
|
||||
if $data10 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 2 then
|
||||
if $data11 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != 2 then
|
||||
if $data20 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data50 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data51 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data60 != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data61 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data70 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data71 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data80 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data81 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data90 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data91 != NULL then
|
||||
if $data21 != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -101,88 +59,88 @@ if $rows != 12 then
|
|||
endi
|
||||
|
||||
sql select a.col1, b.col1 from tba1 a full join tba2 b on a.ts = b.ts order by a.col1, b.col1;
|
||||
if $rows != 4 then
|
||||
if $rows != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 1 then
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2 then
|
||||
if $data01 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != 3 then
|
||||
if $data10 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != NULL then
|
||||
if $data11 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != 4 then
|
||||
if $data20 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 5 then
|
||||
if $data21 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != 5 then
|
||||
if $data30 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data50 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data51 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select a.col1, b.col1 from tba2 a full join tba1 b on a.ts = b.ts order by a.col1, b.col1;
|
||||
if $rows != 4 then
|
||||
if $rows != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 2 then
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
if $data01 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != 3 then
|
||||
if $data10 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != NULL then
|
||||
if $data11 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != 5 then
|
||||
if $data20 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 4 then
|
||||
if $data21 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != 7 then
|
||||
if $data30 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data50 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data51 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select a.ts, b.ts from tba1 a full join tba2 b on a.ts = b.ts and a.ts < '2023-11-17 16:29:03' and b.ts < '2023-11-17 16:29:03';
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != NULL then
|
||||
sql select a.ts, b.ts from tba1 a full join tba2 b on a.ts = b.ts and a.ts < '2023-11-17 16:29:03' and b.ts < '2023-11-17 16:29:03' order by a.ts;
|
||||
if $rows != 7 then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -60,6 +60,7 @@ sql insert into ctb24 using st2 tags(4) values('2023-10-16 09:10:14', 110224, 11
|
|||
run tsim/join/inner_join.sim
|
||||
run tsim/join/left_join.sim
|
||||
run tsim/join/right_join.sim
|
||||
run tsim/join/full_join.sim
|
||||
|
||||
print ================== restart server to commit data into disk
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
@ -69,5 +70,6 @@ print ================== server restart completed
|
|||
run tsim/join/inner_join.sim
|
||||
run tsim/join/left_join.sim
|
||||
run tsim/join/right_join.sim
|
||||
run tsim/join/full_join.sim
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
Loading…
Reference in New Issue