2022-02-28 09:39:07 +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 _TD_COMMON_EP_H_
|
|
|
|
|
#define _TD_COMMON_EP_H_
|
|
|
|
|
|
2022-02-28 09:55:07 +00:00
|
|
|
#include "tcommon.h"
|
2022-04-09 08:44:31 +00:00
|
|
|
#include "tcompression.h"
|
2022-02-28 09:39:07 +00:00
|
|
|
#include "tmsg.h"
|
2021-12-09 10:59:48 +00:00
|
|
|
|
2022-01-26 06:00:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-02-04 14:41:54 +00:00
|
|
|
typedef struct SBlockOrderInfo {
|
2022-03-28 11:08:07 +00:00
|
|
|
bool nullFirst;
|
2022-02-09 09:13:39 +00:00
|
|
|
int32_t order;
|
2022-03-28 11:08:07 +00:00
|
|
|
int32_t slotId;
|
2023-09-04 01:41:02 +00:00
|
|
|
void* compFn;
|
2022-02-28 09:39:07 +00:00
|
|
|
SColumnInfoData* pColData;
|
2022-02-04 14:41:54 +00:00
|
|
|
} SBlockOrderInfo;
|
|
|
|
|
|
2024-07-25 00:51:19 +00:00
|
|
|
#define BLOCK_VERSION_1 1
|
|
|
|
|
#define BLOCK_VERSION_2 2
|
2024-02-22 07:44:50 +00:00
|
|
|
|
2022-02-09 03:06:59 +00:00
|
|
|
#define NBIT (3u)
|
2022-02-09 02:58:02 +00:00
|
|
|
#define BitPos(_n) ((_n) & ((1 << NBIT) - 1))
|
2023-12-07 11:22:46 +00:00
|
|
|
#define CharPos(r_) ((r_) >> NBIT)
|
2022-02-09 03:06:59 +00:00
|
|
|
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
|
|
|
|
|
#define colDataIsNull_f(bm_, r_) ((BMCharPos(bm_, r_) & (1u << (7u - BitPos(r_)))) == (1u << (7u - BitPos(r_))))
|
2022-02-09 02:09:42 +00:00
|
|
|
|
2024-07-28 06:29:56 +00:00
|
|
|
#define QRY_OPTR_CHECK(_o) \
|
|
|
|
|
do { \
|
|
|
|
|
if ((_o) == NULL) { \
|
|
|
|
|
return TSDB_CODE_INVALID_PARA; \
|
|
|
|
|
} else { \
|
|
|
|
|
*(_o) = NULL; \
|
|
|
|
|
} \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
2022-02-09 09:13:39 +00:00
|
|
|
#define colDataSetNull_f(bm_, r_) \
|
|
|
|
|
do { \
|
|
|
|
|
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
|
|
|
|
|
} while (0)
|
2022-02-04 14:41:54 +00:00
|
|
|
|
2024-07-25 00:51:19 +00:00
|
|
|
#define colDataSetNull_f_s(c_, r_) \
|
|
|
|
|
do { \
|
|
|
|
|
colDataSetNull_f((c_)->nullbitmap, r_); \
|
2024-07-20 09:34:29 +00:00
|
|
|
(void)memset(((char*)(c_)->pData) + (c_)->info.bytes * (r_), 0, (c_)->info.bytes); \
|
2023-01-11 02:27:23 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
2022-12-02 02:07:48 +00:00
|
|
|
#define colDataClearNull_f(bm_, r_) \
|
|
|
|
|
do { \
|
|
|
|
|
BMCharPos(bm_, r_) &= ((char)(~(1u << (7u - BitPos(r_))))); \
|
2022-05-05 11:03:05 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
2022-05-07 15:19:05 +00:00
|
|
|
#define colDataIsNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] == -1)
|
|
|
|
|
#define colDataSetNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] = -1)
|
2022-04-18 05:36:01 +00:00
|
|
|
|
2022-04-20 08:52:32 +00:00
|
|
|
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
|
|
|
|
|
|
|
|
|
|
#define colDataGetVarData(p1_, r_) ((p1_)->pData + (p1_)->varmeta.offset[(r_)])
|
|
|
|
|
#define colDataGetNumData(p1_, r_) ((p1_)->pData + ((r_) * (p1_)->info.bytes))
|
|
|
|
|
// SColumnInfoData, rowNumber
|
2022-05-05 10:57:09 +00:00
|
|
|
#define colDataGetData(p1_, r_) \
|
|
|
|
|
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
|
2022-04-20 08:52:32 +00:00
|
|
|
|
2022-06-23 14:05:00 +00:00
|
|
|
#define IS_JSON_NULL(type, data) \
|
|
|
|
|
((type) == TSDB_DATA_TYPE_JSON && (*(data) == TSDB_DATA_TYPE_NULL || tTagIsJsonNull(data)))
|
2022-04-24 13:17:30 +00:00
|
|
|
|
2022-06-05 05:50:31 +00:00
|
|
|
static FORCE_INLINE bool colDataIsNull_s(const SColumnInfoData* pColumnInfoData, uint32_t row) {
|
2022-03-17 09:48:21 +00:00
|
|
|
if (!pColumnInfoData->hasNull) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-04-20 08:52:32 +00:00
|
|
|
|
2022-06-05 05:50:31 +00:00
|
|
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
2022-04-18 05:36:01 +00:00
|
|
|
return colDataIsNull_var(pColumnInfoData, row);
|
2022-03-17 09:48:21 +00:00
|
|
|
} else {
|
|
|
|
|
if (pColumnInfoData->nullbitmap == NULL) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return colDataIsNull_f(pColumnInfoData->nullbitmap, row);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 05:51:09 +00:00
|
|
|
static FORCE_INLINE bool colDataIsNull_t(const SColumnInfoData* pColumnInfoData, uint32_t row, bool isVarType) {
|
|
|
|
|
if (!pColumnInfoData->hasNull) return false;
|
|
|
|
|
if (isVarType) {
|
|
|
|
|
return colDataIsNull_var(pColumnInfoData, row);
|
|
|
|
|
} else {
|
|
|
|
|
return pColumnInfoData->nullbitmap ? colDataIsNull_f(pColumnInfoData->nullbitmap, row) : false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-28 09:39:07 +00:00
|
|
|
static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, uint32_t totalRows, uint32_t row,
|
|
|
|
|
SColumnDataAgg* pColAgg) {
|
2022-02-09 02:09:42 +00:00
|
|
|
if (!pColumnInfoData->hasNull) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-13 11:14:44 +00:00
|
|
|
if (pColAgg != NULL && pColAgg->colId != -1) {
|
2022-02-09 02:09:42 +00:00
|
|
|
if (pColAgg->numOfNull == totalRows) {
|
|
|
|
|
ASSERT(pColumnInfoData->nullbitmap == NULL);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (pColAgg->numOfNull == 0) {
|
|
|
|
|
ASSERT(pColumnInfoData->nullbitmap == NULL);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
2022-04-18 05:36:01 +00:00
|
|
|
return colDataIsNull_var(pColumnInfoData, row);
|
2022-02-09 02:09:42 +00:00
|
|
|
} else {
|
|
|
|
|
if (pColumnInfoData->nullbitmap == NULL) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return colDataIsNull_f(pColumnInfoData->nullbitmap, row);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetNULL(SColumnInfoData* pColumnInfoData, uint32_t rowIndex) {
|
2022-03-27 07:30:46 +00:00
|
|
|
// There is a placehold for each NULL value of binary or nchar type.
|
|
|
|
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
2023-02-20 02:14:25 +00:00
|
|
|
colDataSetNull_var(pColumnInfoData, rowIndex); // it is a null value of VAR type.
|
2022-03-27 07:30:46 +00:00
|
|
|
} else {
|
2023-02-20 02:14:25 +00:00
|
|
|
colDataSetNull_f_s(pColumnInfoData, rowIndex);
|
2022-03-27 07:30:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pColumnInfoData->hasNull = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:04:08 +00:00
|
|
|
static FORCE_INLINE void colDataSetNNULL(SColumnInfoData* pColumnInfoData, uint32_t start, size_t nRows) {
|
2022-04-02 02:43:28 +00:00
|
|
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
2022-04-09 08:44:31 +00:00
|
|
|
for (int32_t i = start; i < start + nRows; ++i) {
|
2022-05-05 10:57:09 +00:00
|
|
|
colDataSetNull_var(pColumnInfoData, i); // it is a null value of VAR type.
|
2022-04-02 02:43:28 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-09 08:44:31 +00:00
|
|
|
for (int32_t i = start; i < start + nRows; ++i) {
|
2022-04-02 02:43:28 +00:00
|
|
|
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
|
|
|
|
}
|
2024-07-25 00:51:19 +00:00
|
|
|
(void)memset(pColumnInfoData->pData + start * pColumnInfoData->info.bytes, 0, pColumnInfoData->info.bytes * nRows);
|
2022-04-02 02:43:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pColumnInfoData->hasNull = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetInt8(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int8_t* v) {
|
2022-03-27 07:30:46 +00:00
|
|
|
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT ||
|
|
|
|
|
pColumnInfoData->info.type == TSDB_DATA_TYPE_UTINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_BOOL);
|
2023-02-20 02:14:25 +00:00
|
|
|
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
2022-03-27 07:30:46 +00:00
|
|
|
*(int8_t*)p = *(int8_t*)v;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetInt16(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int16_t* v) {
|
2022-04-12 02:45:34 +00:00
|
|
|
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT ||
|
|
|
|
|
pColumnInfoData->info.type == TSDB_DATA_TYPE_USMALLINT);
|
2023-02-20 02:14:25 +00:00
|
|
|
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
2022-03-27 07:30:46 +00:00
|
|
|
*(int16_t*)p = *(int16_t*)v;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetInt32(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int32_t* v) {
|
2022-03-27 07:30:46 +00:00
|
|
|
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT);
|
2023-02-20 02:14:25 +00:00
|
|
|
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
2022-03-27 07:30:46 +00:00
|
|
|
*(int32_t*)p = *(int32_t*)v;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetInt64(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int64_t* v) {
|
2022-03-30 05:41:15 +00:00
|
|
|
int32_t type = pColumnInfoData->info.type;
|
|
|
|
|
ASSERT(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP);
|
2023-02-20 02:14:25 +00:00
|
|
|
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
2022-03-27 07:30:46 +00:00
|
|
|
*(int64_t*)p = *(int64_t*)v;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetFloat(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, float* v) {
|
2022-03-27 07:30:46 +00:00
|
|
|
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT);
|
2023-02-20 02:14:25 +00:00
|
|
|
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
2022-03-27 07:30:46 +00:00
|
|
|
*(float*)p = *(float*)v;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-20 02:14:25 +00:00
|
|
|
static FORCE_INLINE void colDataSetDouble(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, double* v) {
|
2022-03-27 07:30:46 +00:00
|
|
|
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE);
|
2023-02-20 02:14:25 +00:00
|
|
|
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
2022-03-27 07:30:46 +00:00
|
|
|
*(double*)p = *(double*)v;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-07 07:40:11 +00:00
|
|
|
int32_t getJsonValueLen(const char* data);
|
2022-06-04 11:28:30 +00:00
|
|
|
|
2023-02-20 02:04:08 +00:00
|
|
|
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
|
2023-06-05 02:47:15 +00:00
|
|
|
int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData);
|
2024-07-25 00:51:19 +00:00
|
|
|
int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows,
|
|
|
|
|
bool trimValue);
|
|
|
|
|
void colDataSetNItemsNull(SColumnInfoData* pColumnInfoData, uint32_t currentRow, uint32_t numOfRows);
|
|
|
|
|
int32_t colDataCopyNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows,
|
|
|
|
|
bool isNull);
|
2022-07-23 05:18:36 +00:00
|
|
|
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
|
|
|
|
const SColumnInfoData* pSource, int32_t numOfRow2);
|
2022-06-23 14:05:00 +00:00
|
|
|
int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows,
|
|
|
|
|
const SDataBlockInfo* pBlockInfo);
|
2024-07-25 00:51:19 +00:00
|
|
|
int32_t colDataAssignNRows(SColumnInfoData* pDst, int32_t dstIdx, const SColumnInfoData* pSrc, int32_t srcIdx,
|
|
|
|
|
int32_t numOfRows);
|
2022-05-21 03:02:53 +00:00
|
|
|
int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex);
|
2024-03-21 02:44:27 +00:00
|
|
|
int32_t blockDataUpdatePkRange(SSDataBlock* pDataBlock, int32_t pkColumnIndex, bool asc);
|
2022-02-04 14:41:54 +00:00
|
|
|
|
2022-02-22 05:12:03 +00:00
|
|
|
int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows);
|
2022-02-04 14:41:54 +00:00
|
|
|
|
2023-06-27 09:50:50 +00:00
|
|
|
int32_t colDataGetRowLength(const SColumnInfoData* pColumnInfoData, int32_t rowIdx);
|
2022-02-22 05:12:03 +00:00
|
|
|
void colDataTrim(SColumnInfoData* pColumnInfoData);
|
2022-02-04 14:41:54 +00:00
|
|
|
|
2022-03-09 02:22:53 +00:00
|
|
|
size_t blockDataGetNumOfCols(const SSDataBlock* pBlock);
|
|
|
|
|
size_t blockDataGetNumOfRows(const SSDataBlock* pBlock);
|
2022-02-04 14:41:54 +00:00
|
|
|
|
2022-05-25 07:22:34 +00:00
|
|
|
int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc);
|
2023-12-13 10:54:16 +00:00
|
|
|
int32_t blockDataMergeNRows(SSDataBlock* pDest, const SSDataBlock* pSrc, int32_t srcIdx, int32_t numOfRows);
|
2024-07-25 00:51:19 +00:00
|
|
|
void blockDataShrinkNRows(SSDataBlock* pBlock, int32_t numOfRows);
|
2022-03-25 12:19:09 +00:00
|
|
|
int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startIndex, int32_t* stopIndex,
|
|
|
|
|
int32_t pageSize);
|
2022-02-04 14:41:54 +00:00
|
|
|
int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock);
|
2022-02-08 02:21:00 +00:00
|
|
|
int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf);
|
2022-04-08 02:24:35 +00:00
|
|
|
int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity);
|
2024-07-28 06:29:56 +00:00
|
|
|
int32_t blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int32_t rowCount, SSDataBlock** pResBlock);
|
2022-03-18 16:13:07 +00:00
|
|
|
|
2022-02-04 14:41:54 +00:00
|
|
|
size_t blockDataGetSize(const SSDataBlock* pBlock);
|
2022-03-17 05:11:06 +00:00
|
|
|
size_t blockDataGetRowSize(SSDataBlock* pBlock);
|
2022-02-15 06:40:29 +00:00
|
|
|
double blockDataGetSerialRowSize(const SSDataBlock* pBlock);
|
2022-06-08 08:08:26 +00:00
|
|
|
size_t blockDataGetSerialMetaSize(uint32_t numOfCols);
|
2022-02-15 06:40:29 +00:00
|
|
|
|
2022-03-28 11:08:07 +00:00
|
|
|
int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo);
|
2023-09-04 01:41:02 +00:00
|
|
|
/**
|
|
|
|
|
* @brief find how many rows already in order start from first row
|
|
|
|
|
*/
|
|
|
|
|
int32_t blockDataGetSortedRows(SSDataBlock* pDataBlock, SArray* pOrderInfo);
|
2022-02-04 14:41:54 +00:00
|
|
|
|
2022-11-04 10:46:48 +00:00
|
|
|
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload);
|
2022-03-30 05:41:15 +00:00
|
|
|
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
2022-04-08 12:04:17 +00:00
|
|
|
|
2024-07-25 00:51:19 +00:00
|
|
|
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
|
|
|
|
void blockDataCleanup(SSDataBlock* pDataBlock);
|
|
|
|
|
void blockDataReset(SSDataBlock* pDataBlock);
|
|
|
|
|
void blockDataEmpty(SSDataBlock* pDataBlock);
|
2024-01-12 10:29:27 +00:00
|
|
|
int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows,
|
2024-07-25 00:51:19 +00:00
|
|
|
bool clearPayload);
|
2022-04-08 12:04:17 +00:00
|
|
|
|
2023-05-19 09:27:15 +00:00
|
|
|
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int32_t extraSize);
|
2022-03-30 05:41:15 +00:00
|
|
|
|
2023-02-20 02:04:08 +00:00
|
|
|
int32_t blockDataTrimFirstRows(SSDataBlock* pBlock, size_t n);
|
2024-07-19 08:15:37 +00:00
|
|
|
void blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n);
|
2022-04-01 09:21:24 +00:00
|
|
|
|
2022-09-02 07:34:16 +00:00
|
|
|
int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src);
|
2024-04-29 08:50:00 +00:00
|
|
|
int32_t copyDataBlock(SSDataBlock* pDst, const SSDataBlock* pSrc);
|
2022-07-14 05:53:23 +00:00
|
|
|
|
2024-07-27 10:55:34 +00:00
|
|
|
int32_t createDataBlock(SSDataBlock** pResBlock);
|
|
|
|
|
void blockDataDestroy(SSDataBlock* pBlock);
|
|
|
|
|
void blockDataFreeRes(SSDataBlock* pBlock);
|
|
|
|
|
int32_t createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData, SSDataBlock** pResBlock);
|
|
|
|
|
int32_t createSpecialDataBlock(EStreamType type, SSDataBlock** pBlock);
|
|
|
|
|
|
|
|
|
|
int32_t blockCopyOneRow(const SSDataBlock* pDataBlock, int32_t rowIdx, SSDataBlock** pResBlock);
|
|
|
|
|
int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData);
|
2022-06-22 09:21:04 +00:00
|
|
|
|
2024-07-28 06:29:56 +00:00
|
|
|
SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId);
|
|
|
|
|
int32_t bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index, SColumnInfoData** pColInfoData);
|
2022-02-08 07:40:13 +00:00
|
|
|
|
2024-07-28 06:29:56 +00:00
|
|
|
int32_t blockGetEncodeSize(const SSDataBlock* pBlock);
|
|
|
|
|
int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols);
|
|
|
|
|
int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos);
|
2022-05-30 14:35:01 +00:00
|
|
|
|
2022-06-25 08:12:00 +00:00
|
|
|
// for debug
|
2024-07-28 06:29:56 +00:00
|
|
|
int32_t dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** dumpBuf, const char* taskIdStr);
|
2022-03-25 12:19:09 +00:00
|
|
|
|
2024-07-25 00:51:19 +00:00
|
|
|
int32_t buildSubmitReqFromDataBlock(SSubmitReq2** pReq, const SSDataBlock* pDataBlocks, const STSchema* pTSchema,
|
|
|
|
|
int64_t uid, int32_t vgId, tb_uid_t suid);
|
2022-05-01 16:30:47 +00:00
|
|
|
|
2024-07-25 00:51:19 +00:00
|
|
|
bool alreadyAddGroupId(char* ctbName, int64_t groupId);
|
|
|
|
|
bool isAutoTableName(char* ctbName);
|
|
|
|
|
void buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId);
|
2024-07-28 06:29:56 +00:00
|
|
|
int32_t buildCtbNameByGroupId(const char* stbName, uint64_t groupId, char** pName);
|
2023-06-07 02:45:27 +00:00
|
|
|
int32_t buildCtbNameByGroupIdImpl(const char* stbName, uint64_t groupId, char* pBuf);
|
2022-06-07 07:40:11 +00:00
|
|
|
|
2024-07-28 06:29:56 +00:00
|
|
|
int32_t trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList);
|
2022-04-12 02:45:34 +00:00
|
|
|
|
2024-06-04 11:05:19 +00:00
|
|
|
void copyPkVal(SDataBlockInfo* pDst, const SDataBlockInfo* pSrc);
|
|
|
|
|
|
2022-01-26 06:00:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-03-17 09:48:21 +00:00
|
|
|
#endif /*_TD_COMMON_EP_H_*/
|