TDengine/source/libs/executor/inc/mergejoin.h

492 lines
18 KiB
C
Raw Normal View History

2023-12-01 10:33:50 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_MERGEJOIN_H
#define TDENGINE_MERGEJOIN_H
#ifdef __cplusplus
extern "C" {
#endif
2024-03-29 00:28:33 +00:00
#if 0
2024-03-22 00:47:07 +00:00
#define MJOIN_DEFAULT_BLK_ROWS_NUM 3 //4096
2024-01-11 11:25:12 +00:00
#define MJOIN_HJOIN_CART_THRESHOLD 10
2024-01-05 06:40:05 +00:00
#define MJOIN_BLK_SIZE_LIMIT 0 //10485760
2023-12-26 11:28:19 +00:00
#define MJOIN_ROW_BITMAP_SIZE (2 * 1048576)
2024-01-05 09:16:51 +00:00
#else
#define MJOIN_DEFAULT_BLK_ROWS_NUM 4096
#define MJOIN_HJOIN_CART_THRESHOLD 16
#define MJOIN_BLK_SIZE_LIMIT 10485760
#define MJOIN_ROW_BITMAP_SIZE (2 * 1048576)
#endif
2024-04-12 07:44:23 +00:00
#define MJOIN_SEMI_ANTI_BLK_ROWS_NUM 64
2024-04-03 01:54:49 +00:00
#define MJOIN_BLK_THRESHOLD_RATIO 0.9
2023-12-07 11:22:46 +00:00
2023-12-14 06:13:01 +00:00
struct SMJoinOperatorInfo;
2023-12-05 11:27:57 +00:00
typedef enum EJoinTableType {
E_JOIN_TB_BUILD = 1,
E_JOIN_TB_PROBE
} EJoinTableType;
2024-02-27 10:18:25 +00:00
2023-12-08 11:25:05 +00:00
#define MJOIN_TBTYPE(_type) (E_JOIN_TB_BUILD == (_type) ? "BUILD" : "PROBE")
2023-12-26 11:28:19 +00:00
#define IS_FULL_OUTER_JOIN(_jtype, _stype) ((_jtype) == JOIN_TYPE_FULL && (_stype) == JOIN_STYPE_OUTER)
2023-12-08 11:25:05 +00:00
2023-12-12 11:31:12 +00:00
typedef struct SMJoinRowPos {
SSDataBlock* pBlk;
int32_t pos;
} SMJoinRowPos;
2023-12-05 11:27:57 +00:00
2023-12-07 11:22:46 +00:00
typedef struct SMJoinColMap {
int32_t srcSlot;
int32_t dstSlot;
2024-01-12 10:29:27 +00:00
bool vardata;
int32_t bytes;
2023-12-07 11:22:46 +00:00
} SMJoinColMap;
2023-12-01 10:33:50 +00:00
typedef struct SMJoinColInfo {
int32_t srcSlot;
int32_t dstSlot;
2024-03-25 07:19:16 +00:00
bool jsonData;
2023-12-07 11:22:46 +00:00
bool vardata;
int32_t* offset;
int32_t bytes;
char* data;
char* bitMap;
2023-12-12 11:31:12 +00:00
SColumnInfoData* colData;
2023-12-01 10:33:50 +00:00
} SMJoinColInfo;
2024-01-03 08:25:45 +00:00
typedef struct SMJoinHashGrpRows {
int32_t rowBitmapOffset;
int32_t rowMatchNum;
bool allRowsMatch;
bool allRowsNMatch;
SArray* pRows;
} SMJoinHashGrpRows;
typedef struct SMJoinNMatchCtx {
void* pGrp;
int32_t iter;
int32_t bitIdx;
int32_t rowIdx;
int32_t grpIdx;
} SMJoinNMatchCtx;
2024-02-29 09:52:53 +00:00
// for now timetruncate only
typedef struct SMJoinPrimExprCtx {
int64_t truncateUnit;
int64_t timezoneUnit;
int32_t targetSlotId;
} SMJoinPrimExprCtx;
2023-12-05 11:27:57 +00:00
2023-12-14 06:13:01 +00:00
typedef struct SMJoinTableCtx {
2024-02-29 09:52:53 +00:00
EJoinTableType type;
int32_t downStreamIdx;
SOperatorInfo* downStream;
bool dsInitDone;
bool dsFetchDone;
SNode* primExpr;
SMJoinPrimExprCtx primCtx;
2023-12-08 11:25:05 +00:00
2024-02-29 09:52:53 +00:00
int32_t blkId;
SQueryStat inputStat;
2023-12-01 10:33:50 +00:00
2024-02-29 09:52:53 +00:00
uint64_t lastInGid;
SSDataBlock* remainInBlk;
2024-02-23 09:59:45 +00:00
2024-02-29 09:52:53 +00:00
SMJoinColMap* primCol;
char* primData;
2023-12-06 11:22:14 +00:00
2024-02-29 09:52:53 +00:00
int32_t finNum;
SMJoinColMap* finCols;
2023-12-01 10:33:50 +00:00
2024-02-29 09:52:53 +00:00
int32_t keyNum;
int32_t keyNullSize;
SMJoinColInfo* keyCols;
char* keyBuf;
char* keyData;
2023-12-08 11:25:05 +00:00
2024-02-29 09:52:53 +00:00
bool newBlk;
SSDataBlock* blk;
int32_t blkRowIdx;
2023-12-12 11:31:12 +00:00
2023-12-14 06:13:01 +00:00
// merge join
2024-02-29 09:52:53 +00:00
int64_t grpTotalRows;
int32_t grpIdx;
bool noKeepEqGrpRows;
bool multiEqGrpRows;
int64_t eqRowLimit;
int64_t eqRowNum;
SArray* eqGrps;
SArray* createdBlks;
2023-12-12 11:31:12 +00:00
2023-12-14 06:13:01 +00:00
// hash join
2024-02-29 09:52:53 +00:00
int32_t grpArrayIdx;
SArray* pGrpArrays;
2023-12-12 11:31:12 +00:00
2024-01-10 10:56:49 +00:00
bool multiRowsGrp;
2024-01-03 05:52:36 +00:00
int32_t grpRowIdx;
SArray* pHashCurGrp;
SMJoinHashGrpRows* pHashGrpRows;
SSHashObj* pGrpHash;
2024-02-29 09:52:53 +00:00
int64_t rowBitmapSize;
int64_t rowBitmapOffset;
char* pRowBitmap;
2024-01-03 05:52:36 +00:00
2024-02-29 09:52:53 +00:00
SMJoinNMatchCtx nMatchCtx;
2023-12-14 06:13:01 +00:00
} SMJoinTableCtx;
2023-12-01 10:33:50 +00:00
2024-02-01 06:58:08 +00:00
typedef struct SMJoinMatchInfo {
int32_t rowBitmapOffset;
int32_t rowMatchNum;
bool allRowsNMatch;
bool allRowsMatch;
} SMJoinMatchInfo;
2023-12-08 11:25:05 +00:00
typedef struct SMJoinGrpRows {
SSDataBlock* blk;
int32_t beginIdx;
2023-12-12 11:31:12 +00:00
int32_t endIdx;
int32_t readIdx;
2023-12-26 11:28:19 +00:00
int32_t rowBitmapOffset;
int32_t rowMatchNum;
2024-01-03 08:25:45 +00:00
bool allRowsNMatch;
2024-01-03 05:52:36 +00:00
bool allRowsMatch;
2023-12-12 11:31:12 +00:00
bool readMatch;
2024-02-01 06:58:08 +00:00
bool clonedBlk;
2023-12-08 11:25:05 +00:00
} SMJoinGrpRows;
2023-12-05 11:27:57 +00:00
2024-01-18 08:50:47 +00:00
#define MJOIN_COMMON_CTX \
struct SMJoinOperatorInfo* pJoin; \
bool ascTs; \
bool grpRemains; \
SSDataBlock* finBlk; \
bool lastEqGrp; \
bool lastProbeGrp; \
2024-02-22 10:59:10 +00:00
bool seqWinGrp; \
2024-02-27 10:18:25 +00:00
bool groupJoin; \
2024-01-18 08:50:47 +00:00
int32_t blkThreshold; \
2024-04-03 01:54:49 +00:00
int64_t limit; \
2024-01-18 08:50:47 +00:00
int64_t jLimit
typedef struct SMJoinCommonCtx {
MJOIN_COMMON_CTX;
} SMJoinCommonCtx;
2024-01-03 05:52:36 +00:00
2024-02-27 10:18:25 +00:00
typedef int32_t (*joinCartFp)(void*);
2023-12-05 11:27:57 +00:00
typedef struct SMJoinMergeCtx {
2024-01-18 08:50:47 +00:00
// KEEP IT FIRST
2023-12-14 06:13:01 +00:00
struct SMJoinOperatorInfo* pJoin;
2024-01-18 08:50:47 +00:00
bool ascTs;
bool grpRemains;
SSDataBlock* finBlk;
bool lastEqGrp;
bool lastProbeGrp;
2024-02-22 10:59:10 +00:00
bool seqWinGrp;
2024-02-27 10:18:25 +00:00
bool groupJoin;
2024-01-18 08:50:47 +00:00
int32_t blkThreshold;
2024-04-03 01:54:49 +00:00
int64_t limit;
2024-01-18 08:50:47 +00:00
int64_t jLimit;
// KEEP IT FIRST
2023-12-13 10:54:16 +00:00
bool hashCan;
bool midRemains;
2024-01-03 05:52:36 +00:00
bool nmatchRemains;
2023-12-13 10:54:16 +00:00
SSDataBlock* midBlk;
int64_t lastEqTs;
SMJoinGrpRows probeNEqGrp;
2023-12-26 11:28:19 +00:00
SMJoinGrpRows buildNEqGrp;
2023-12-13 10:54:16 +00:00
bool hashJoin;
2023-12-26 11:28:19 +00:00
joinCartFp hashCartFp;
joinCartFp mergeCartFp;
2023-12-05 11:27:57 +00:00
} SMJoinMergeCtx;
2024-01-18 08:50:47 +00:00
typedef enum {
E_CACHE_NONE = 0,
E_CACHE_OUTBLK,
E_CACHE_INBLK
} SMJoinCacheMode;
2024-01-12 10:29:27 +00:00
typedef struct SMJoinWinCache {
int32_t pageLimit;
2024-01-18 08:50:47 +00:00
int32_t outRowIdx;
2024-01-12 10:29:27 +00:00
int32_t colNum;
2024-01-18 08:50:47 +00:00
int32_t rowNum;
int8_t grpIdx;
SArray* grps;
2024-01-30 11:19:44 +00:00
SArray* grpsQueue;
2024-01-18 08:50:47 +00:00
SSDataBlock* outBlk;
2024-01-12 10:29:27 +00:00
} SMJoinWinCache;
2024-03-08 08:23:41 +00:00
typedef int32_t (*joinMoveWin)(void*);
2024-01-10 10:56:49 +00:00
typedef struct SMJoinWindowCtx {
2024-01-18 08:50:47 +00:00
// KEEP IT FIRST
2024-01-11 11:25:12 +00:00
struct SMJoinOperatorInfo* pJoin;
2024-01-12 10:29:27 +00:00
bool ascTs;
2024-01-18 08:50:47 +00:00
bool grpRemains;
SSDataBlock* finBlk;
bool lastEqGrp;
bool lastProbeGrp;
2024-02-22 10:59:10 +00:00
bool seqWinGrp;
2024-02-27 10:18:25 +00:00
bool groupJoin;
2024-01-18 08:50:47 +00:00
int32_t blkThreshold;
2024-04-03 01:54:49 +00:00
int64_t limit;
2024-01-18 08:50:47 +00:00
int64_t jLimit;
// KEEP IT FIRST
2024-01-12 10:29:27 +00:00
int32_t asofOpType;
2024-01-30 11:19:44 +00:00
int64_t winBeginOffset;
int64_t winEndOffset;
2024-01-29 08:58:08 +00:00
bool lowerRowsAcq;
bool eqRowsAcq;
bool greaterRowsAcq;
2024-03-08 08:23:41 +00:00
bool forwardRowsAcq;
2024-01-11 11:25:12 +00:00
2024-01-30 11:19:44 +00:00
int64_t winBeginTs;
int64_t winEndTs;
2024-03-08 08:23:41 +00:00
joinMoveWin moveWinBeginFp;
joinMoveWin moveWinEndFp;
2024-01-18 08:50:47 +00:00
bool eqPostDone;
int64_t lastTs;
SMJoinGrpRows probeGrp;
SMJoinGrpRows buildGrp;
2024-01-12 10:29:27 +00:00
SMJoinWinCache cache;
2024-01-10 10:56:49 +00:00
} SMJoinWindowCtx;
2023-12-05 11:27:57 +00:00
typedef struct SMJoinFlowFlags {
bool mergeJoin;
bool windowJoin;
bool preFilter;
bool retrieveAfterBuildDone;
} SMJoinFlowFlags;
typedef struct SMJoinCtx {
SMJoinFlowFlags* pFlags;
2024-03-06 03:18:57 +00:00
bool mergeCtxInUse;
2023-12-05 11:27:57 +00:00
union {
2024-01-10 10:56:49 +00:00
SMJoinMergeCtx mergeCtx;
SMJoinWindowCtx windowCtx;
2023-12-05 11:27:57 +00:00
};
} SMJoinCtx;
typedef struct SMJoinExecInfo {
int64_t buildBlkNum;
int64_t buildBlkRows;
int64_t probeBlkNum;
int64_t probeBlkRows;
int64_t resRows;
int64_t expectRows;
} SMJoinExecInfo;
2024-02-27 10:18:25 +00:00
typedef SSDataBlock* (*joinImplFp)(SOperatorInfo*);
typedef SSDataBlock* (*joinRetrieveFp)(struct SMJoinOperatorInfo*, SMJoinTableCtx*);
typedef void (*joinResetFp)(struct SMJoinOperatorInfo*);
2023-12-05 11:27:57 +00:00
2023-12-01 10:33:50 +00:00
typedef struct SMJoinOperatorInfo {
2024-02-23 09:59:45 +00:00
SOperatorInfo* pOperator;
int32_t joinType;
int32_t subType;
int32_t inputTsOrder;
2024-02-27 10:18:25 +00:00
int32_t errCode;
int64_t outGrpId;
2024-03-28 05:45:55 +00:00
uint64_t outBlkId;
2024-02-23 09:59:45 +00:00
SMJoinTableCtx tbs[2];
SMJoinTableCtx* build;
SMJoinTableCtx* probe;
SFilterInfo* pFPreFilter;
SFilterInfo* pPreFilter;
SFilterInfo* pFinFilter;
joinImplFp joinFp;
2024-02-27 10:18:25 +00:00
joinRetrieveFp retrieveFp;
joinResetFp grpResetFp;
2024-02-23 09:59:45 +00:00
SMJoinCtx ctx;
SMJoinExecInfo execInfo;
2023-12-01 10:33:50 +00:00
} SMJoinOperatorInfo;
2023-12-06 11:22:14 +00:00
#define MJOIN_DS_REQ_INIT(_pOp) ((_pOp)->pOperatorGetParam && ((SSortMergeJoinOperatorParam*)(_pOp)->pOperatorGetParam->value)->initDownstream)
#define MJOIN_DS_NEED_INIT(_pOp, _tbctx) (MJOIN_DS_REQ_INIT(_pOp) && (!(_tbctx)->dsInitDone))
#define MJOIN_TB_LOW_BLK(_tbctx) ((_tbctx)->blkNum <= 0 || ((_tbctx)->blkNum == 1 && (_tbctx)->pHeadBlk->cloned))
2023-12-05 11:27:57 +00:00
2024-01-05 09:16:51 +00:00
#define REACH_HJOIN_THRESHOLD(_prb, _bld) ((_bld)->grpTotalRows >= MJOIN_HJOIN_CART_THRESHOLD)
2023-12-07 11:22:46 +00:00
#define SET_SAME_TS_GRP_HJOIN(_pair, _octx) ((_pair)->hashJoin = (_octx)->hashCan && REACH_HJOIN_THRESHOLD(_pair))
2024-03-08 08:23:41 +00:00
#define PROBE_TS_NMATCH(_asc, _pts, _bts) (((_asc) && (_pts) < (_bts)) || (!(_asc) && (_pts) > (_bts)))
#define PROBE_TS_NREACH(_asc, _pts, _bts) (((_asc) && (_pts) > (_bts)) || (!(_asc) && (_pts) < (_bts)))
#define MJOIN_BUILD_BLK_OOR(_asc, _pts, _pidx, _bts, _bnum) (((_asc) && (*((int64_t*)(_pts) + (_pidx)) > *((int64_t*)(_bts) + (_bnum) - 1))) || ((!(_asc)) && (*((int64_t*)(_pts) + (_pidx)) < *((int64_t*)(_bts) + (_bnum) - 1))))
2023-12-08 11:25:05 +00:00
2023-12-12 11:31:12 +00:00
#define GRP_REMAIN_ROWS(_grp) ((_grp)->endIdx - (_grp)->readIdx + 1)
#define GRP_DONE(_grp) ((_grp)->readIdx > (_grp)->endIdx)
2023-12-14 09:06:19 +00:00
#define MJOIN_PROBE_TB_ROWS_DONE(_tb) ((_tb)->blkRowIdx >= (_tb)->blk->info.rows)
2024-01-05 06:40:05 +00:00
#define FJOIN_PROBE_TB_ROWS_DONE(_tb) ((NULL == (_tb)->blk) || ((_tb)->blkRowIdx >= (_tb)->blk->info.rows))
2023-12-14 09:06:19 +00:00
#define MJOIN_BUILD_TB_ROWS_DONE(_tb) ((NULL == (_tb)->blk) || ((_tb)->blkRowIdx >= (_tb)->blk->info.rows))
2024-02-29 09:52:53 +00:00
#define MJOIN_TB_GRP_ROWS_DONE(_tb, _grpJoin) ((_tb)->dsFetchDone || ((_grpJoin) && NULL == (_tb)->blk && NULL != (_tb)->remainInBlk))
2023-12-13 10:54:16 +00:00
2023-12-12 11:31:12 +00:00
#define BLK_IS_FULL(_blk) ((_blk)->info.rows == (_blk)->info.capacity)
2024-01-03 05:52:36 +00:00
#define MJOIN_ROW_BITMAP_SET(_b, _base, _idx) (!colDataIsNull_f((_b + _base), _idx))
2024-01-03 08:25:45 +00:00
#define MJOIN_SET_ROW_BITMAP(_b, _base, _idx) colDataClearNull_f((_b + _base), _idx)
2024-01-03 05:52:36 +00:00
2024-01-12 10:29:27 +00:00
#define ASOF_EQ_ROW_INCLUDED(_op) (OP_TYPE_GREATER_EQUAL == (_op) || OP_TYPE_LOWER_EQUAL == (_op) || OP_TYPE_EQUAL == (_op))
2024-01-18 08:50:47 +00:00
#define ASOF_LOWER_ROW_INCLUDED(_op) (OP_TYPE_GREATER_EQUAL == (_op) || OP_TYPE_GREATER_THAN == (_op))
#define ASOF_GREATER_ROW_INCLUDED(_op) (OP_TYPE_LOWER_EQUAL == (_op) || OP_TYPE_LOWER_THAN == (_op))
2024-01-30 11:19:44 +00:00
#define WIN_ONLY_EQ_ROW_INCLUDED(_soff, _eoff) (0 == ((SValueNode*)(_soff))->datum.i && 0 == ((SValueNode*)(_eoff))->datum.i)
2024-01-12 10:29:27 +00:00
2024-01-18 08:50:47 +00:00
#define MJOIN_PUSH_BLK_TO_CACHE(_cache, _blk) \
do { \
2024-01-18 09:09:59 +00:00
ASSERT(taosArrayGetSize((_cache)->grps) <= 1); \
SMJoinGrpRows* pGrp = (SMJoinGrpRows*)taosArrayReserve((_cache)->grps, 1); \
2024-01-18 08:50:47 +00:00
(_cache)->rowNum += (_blk)->info.rows; \
pGrp->blk = (_blk); \
pGrp->beginIdx = 0; \
2024-01-19 10:03:16 +00:00
pGrp->endIdx = (_blk)->info.rows - 1; \
2024-01-18 08:50:47 +00:00
} while (0)
#define MJOIN_RESTORE_TB_BLK(_cache, _tb) \
do { \
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
if (NULL != pGrp) { \
(_tb)->blk = pGrp->blk; \
(_tb)->blkRowIdx = pGrp->beginIdx; \
} else { \
(_tb)->blk = NULL; \
(_tb)->blkRowIdx = 0; \
} \
} while (0)
2024-01-19 10:03:16 +00:00
#define MJOIN_SAVE_TB_BLK(_cache, _tb) \
do { \
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
2024-01-29 08:58:08 +00:00
if (NULL != pGrp) { \
ASSERT(pGrp->blk == (_tb)->blk); \
pGrp->beginIdx = (_tb)->blkRowIdx; \
pGrp->readIdx = pGrp->beginIdx; \
} \
2024-01-19 10:03:16 +00:00
} while (0)
2024-01-18 08:50:47 +00:00
#define MJOIN_POP_TB_BLK(_cache) \
do { \
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
if (NULL != pGrp) { \
if (pGrp->blk == (_cache)->outBlk) { \
blockDataCleanup(pGrp->blk); \
} \
taosArrayPopFrontBatch((_cache)->grps, 1); \
} \
} while (0)
2023-12-07 11:22:46 +00:00
2023-12-14 09:06:19 +00:00
#define MJOIN_GET_TB_COL_TS(_col, _ts, _tb) \
do { \
2024-01-18 08:50:47 +00:00
if (NULL != (_tb)->blk && (_tb)->blkRowIdx < (_tb)->blk->info.rows) { \
2024-02-29 09:52:53 +00:00
(_col) = taosArrayGet((_tb)->blk->pDataBlock, (_tb)->primCtx.targetSlotId); \
2023-12-14 09:06:19 +00:00
(_ts) = *((int64_t*)(_col)->pData + (_tb)->blkRowIdx); \
2023-12-22 11:25:55 +00:00
} else { \
2024-01-05 06:40:05 +00:00
(_ts) = INT64_MAX; \
2023-12-14 09:06:19 +00:00
} \
2023-12-12 11:31:12 +00:00
} while (0)
2023-12-05 11:27:57 +00:00
2023-12-13 10:54:16 +00:00
#define MJOIN_GET_TB_CUR_TS(_col, _ts, _tb) \
do { \
(_ts) = *((int64_t*)(_col)->pData + (_tb)->blkRowIdx); \
} while (0)
#define MJ_ERR_RET(c) \
do { \
int32_t _code = (c); \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define MJ_ERR_JRET(c) \
do { \
code = (c); \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
2023-12-22 11:25:55 +00:00
2024-07-22 03:06:24 +00:00
#define MJ_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
} \
return _code; \
} while (0)
2023-12-22 11:25:55 +00:00
2024-01-19 10:03:16 +00:00
void mJoinDestroyMergeCtx(SMJoinOperatorInfo* pJoin);
void mJoinDestroyWindowCtx(SMJoinOperatorInfo* pJoin);
2024-01-18 09:09:59 +00:00
int32_t mJoinInitWindowCtx(SMJoinOperatorInfo* pJoin, SSortMergeJoinPhysiNode* pJoinNode);
2023-12-22 11:25:55 +00:00
int32_t mJoinInitMergeCtx(SMJoinOperatorInfo* pJoin, SSortMergeJoinPhysiNode* pJoinNode);
2024-03-19 09:05:44 +00:00
void mWinJoinResetWindowCache(SMJoinWindowCtx* pCtx, SMJoinWinCache* pCache);
2024-01-05 06:40:05 +00:00
SSDataBlock* mInnerJoinDo(struct SOperatorInfo* pOperator);
2023-12-22 11:25:55 +00:00
SSDataBlock* mLeftJoinDo(struct SOperatorInfo* pOperator);
2024-01-05 06:40:05 +00:00
SSDataBlock* mFullJoinDo(struct SOperatorInfo* pOperator);
2024-01-10 10:56:49 +00:00
SSDataBlock* mSemiJoinDo(struct SOperatorInfo* pOperator);
SSDataBlock* mAntiJoinDo(struct SOperatorInfo* pOperator);
2024-01-30 11:19:44 +00:00
SSDataBlock* mWinJoinDo(struct SOperatorInfo* pOperator);
2024-02-27 10:18:25 +00:00
void mJoinResetGroupTableCtx(SMJoinTableCtx* pCtx);
void mJoinResetTableCtx(SMJoinTableCtx* pCtx);
2024-02-29 09:52:53 +00:00
void mLeftJoinGroupReset(SMJoinOperatorInfo* pJoin);
2024-02-27 10:18:25 +00:00
void mWinJoinGroupReset(SMJoinOperatorInfo* pJoin);
bool mJoinRetrieveBlk(SMJoinOperatorInfo* pJoin, int32_t* pIdx, SSDataBlock** ppBlk, SMJoinTableCtx* pTb);
2023-12-22 11:25:55 +00:00
void mJoinSetDone(SOperatorInfo* pOperator);
2024-02-27 10:18:25 +00:00
bool mJoinIsDone(SOperatorInfo* pOperator);
2023-12-22 11:25:55 +00:00
bool mJoinCopyKeyColsDataToBuf(SMJoinTableCtx* pTable, int32_t rowIdx, size_t *pBufLen);
2023-12-26 11:28:19 +00:00
int32_t mJoinBuildEqGroups(SMJoinTableCtx* pTable, int64_t timestamp, bool* wholeBlk, bool restart);
2024-02-27 10:18:25 +00:00
int32_t mJoinRetrieveEqGrpRows(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTable, int64_t timestamp);
2024-01-03 05:52:36 +00:00
int32_t mJoinCreateFullBuildTbHash(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTable);
int32_t mJoinCreateBuildTbHash(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTable);
2023-12-22 11:25:55 +00:00
int32_t mJoinSetKeyColsData(SSDataBlock* pBlock, SMJoinTableCtx* pTable);
2023-12-26 11:28:19 +00:00
int32_t mJoinProcessEqualGrp(SMJoinMergeCtx* pCtx, int64_t timestamp, bool lastBuildGrp);
2024-07-22 03:06:24 +00:00
int32_t mJoinHashGrpCart(SSDataBlock* pBlk, SMJoinGrpRows* probeGrp, bool append, SMJoinTableCtx* probe, SMJoinTableCtx* build, bool* cont);
2023-12-26 11:28:19 +00:00
int32_t mJoinMergeGrpCart(SMJoinOperatorInfo* pJoin, SSDataBlock* pRes, bool append, SMJoinGrpRows* pFirst, SMJoinGrpRows* pSecond);
int32_t mJoinHandleMidRemains(SMJoinMergeCtx* pCtx);
int32_t mJoinNonEqGrpCart(SMJoinOperatorInfo* pJoin, SSDataBlock* pRes, bool append, SMJoinGrpRows* pGrp, bool probeGrp);
2024-02-22 10:59:10 +00:00
int32_t mJoinNonEqCart(SMJoinCommonCtx* pCtx, SMJoinGrpRows* pGrp, bool probeGrp, bool singleProbeRow);
2023-12-26 11:28:19 +00:00
int32_t mJoinCopyMergeMidBlk(SMJoinMergeCtx* pCtx, SSDataBlock** ppMid, SSDataBlock** ppFin);
2024-01-03 08:25:45 +00:00
int32_t mJoinFilterAndMarkRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SMJoinTableCtx* build, int32_t startGrpIdx, int32_t startRowIdx);
int32_t mJoinFilterAndMarkHashRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SMJoinTableCtx* build, int32_t startRowIdx);
int32_t mJoinGetRowBitmapOffset(SMJoinTableCtx* pTable, int32_t rowNum, int32_t *rowBitmapOffset);
2024-01-18 08:50:47 +00:00
int32_t mJoinProcessLowerGrp(SMJoinMergeCtx* pCtx, SMJoinTableCtx* pTb, SColumnInfoData* pCol, int64_t* probeTs, int64_t* buildTs);
int32_t mJoinProcessGreaterGrp(SMJoinMergeCtx* pCtx, SMJoinTableCtx* pTb, SColumnInfoData* pCol, int64_t* probeTs, int64_t* buildTs);
2024-01-10 10:56:49 +00:00
int32_t mJoinFilterAndKeepSingleRow(SSDataBlock* pBlock, SFilterInfo* pFilterInfo);
int32_t mJoinFilterAndNoKeepRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo);
2024-02-01 06:58:08 +00:00
int32_t mJoinBuildEqGrp(SMJoinTableCtx* pTable, int64_t timestamp, bool* wholeBlk, SMJoinGrpRows* pGrp);
2023-12-13 10:54:16 +00:00
2024-01-19 10:03:16 +00:00
2023-12-01 10:33:50 +00:00
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_MERGEJOIN_H