提交 f45433df 编写于 作者: C Cary Xu

feat: column support 63K and row support 64k

上级 e619a292
......@@ -55,7 +55,7 @@ extern "C" {
typedef struct {
int8_t type; // Column type
int16_t colId; // column ID
int16_t bytes; // column bytes (restore to int16_t in case of misuse)
uint16_t bytes; // column bytes
uint16_t offset; // point offset in SDataRow after the header part.
} STColumn;
......
......@@ -208,7 +208,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxCapacity, int32_t s, int32_t e);
SSchema1 *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index);
int16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t index);
uint16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t index);
typedef struct SSrcColumnInfo {
int32_t functionId;
......
......@@ -54,7 +54,7 @@ typedef int32_t (*__perc_hash_func_t)(struct tMemBucket *pBucket, const void *va
typedef struct tMemBucket {
int16_t numOfSlots;
int16_t type;
int16_t bytes;
uint16_t bytes;
int32_t total;
int32_t elemPerPage; // number of elements for each object
int32_t maxCapacity; // maximum allowed number of elements that can be sort directly to get the result
......@@ -68,7 +68,7 @@ typedef struct tMemBucket {
__perc_hash_func_t hashFunc;
} tMemBucket;
tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval, double maxval);
tMemBucket *tMemBucketCreate(uint16_t nElemSize, int16_t dataType, double minval, double maxval);
void tMemBucketDestroy(tMemBucket *pBucket);
......
......@@ -62,8 +62,8 @@ typedef struct ScriptCtx {
} ScriptCtx;
int taosLoadScriptInit(void *pInit);
void taosLoadScriptNormal(void *pInit, char *pInput, int16_t iType, int16_t iBytes, int32_t numOfRows,
int64_t *ptsList, int64_t key, char* pOutput, char *ptsOutput, int32_t *numOfOutput, int16_t oType, int16_t oBytes);
void taosLoadScriptNormal(void *pInit, char *pInput, int16_t iType, uint16_t iBytes, int32_t numOfRows,
int64_t *ptsList, int64_t key, char* pOutput, char *ptsOutput, int32_t *numOfOutput, int16_t oType, uint16_t oBytes);
void taosLoadScriptFinalize(void *pInit, int64_t key, char *pOutput, int32_t *output);
void taosLoadScriptMerge(void *pCtx, char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput);
void taosLoadScriptDestroy(void *pInit);
......
......@@ -206,7 +206,7 @@ static void getNextTimeWindow(SQueryAttr* pQueryAttr, STimeWindow* tw) {
tw->ekey -= 1;
}
static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type, int16_t bytes);
static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type, uint16_t bytes);
static void setResultOutputBuf(SQueryRuntimeEnv* pRuntimeEnv, SResultRow* pResult, SQLFunctionCtx* pCtx,
int32_t numOfCols, int32_t* rowCellInfoOffset);
......@@ -10531,7 +10531,7 @@ bool doBuildResCheck(SQInfo* pQInfo) {
return buildRes;
}
static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type, int16_t bytes) {
static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type, uint16_t bytes) {
if (val == NULL) {
setNull(output, type, bytes);
return;
......
......@@ -731,8 +731,8 @@ static void columnwiseMergeSortImpl(tOrderDescriptor *pDescriptor, int32_t numOf
char* p = NULL;
for(int32_t i = 0; i < numOfCols; ++i) {
int16_t colOffset = getColumnModelOffset(pDescriptor->pColumnModel, i);
int32_t colBytes = pDescriptor->pColumnModel->pFields[i].field.bytes;
uint16_t colOffset = getColumnModelOffset(pDescriptor->pColumnModel, i);
int32_t colBytes = pDescriptor->pColumnModel->pFields[i].field.bytes;
// make sure memory buffer is enough
if (prevLength < colBytes) {
char *tmp = realloc(p, colBytes * numOfRows);
......@@ -1181,7 +1181,7 @@ SSchema1* getColumnModelSchema(SColumnModel *pColumnModel, int32_t idx) {
return &pColumnModel->pFields[idx].field;
}
int16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t idx) {
uint16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t idx) {
assert(pColumnModel != NULL && idx >= 0 && idx < pColumnModel->numOfCols);
return pColumnModel->pFields[idx].offset;
}
......@@ -1197,7 +1197,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC
/* start from the second column */
for (int32_t i = 0; i < pModel->numOfCols; ++i) {
int16_t offset = getColumnModelOffset(pModel, i);
uint16_t offset = getColumnModelOffset(pModel, i);
SSchema1* pSchema = getColumnModelSchema(pModel, i);
char *startPos = inputBuffer->data + offset * blockCapacity + s * pSchema->bytes;
......
......@@ -108,8 +108,8 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
continue;
}
int16_t type = pCol->col.type;
int16_t bytes = pCol->col.bytes;
int16_t type = pCol->col.type;
uint16_t bytes = pCol->col.bytes;
char *val1 = elePtrAt(data[i], pCol->col.bytes, idx);
if (type == TSDB_DATA_TYPE_BINARY|| type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BOOL) {
......
......@@ -222,7 +222,7 @@ static void resetSlotInfo(tMemBucket* pBucket) {
}
}
tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval, double maxval) {
tMemBucket *tMemBucketCreate(uint16_t nElemSize, int16_t dataType, double minval, double maxval) {
tMemBucket *pBucket = (tMemBucket *)calloc(1, sizeof(tMemBucket));
if (pBucket == NULL) {
return NULL;
......
......@@ -30,7 +30,7 @@ static void destroyLuaEnv(lua_State *state);
static void destroyScriptEnv(ScriptEnv *pEnv);
static void luaValueToTaosType(lua_State *lua, char *interBuf, int32_t *numOfOutput, int16_t oType, int16_t oBytes);
static void luaValueToTaosType(lua_State *lua, char *interBuf, int32_t *numOfOutput, int16_t oType, uint16_t oBytes);
static void taosValueToLuaType(lua_State *lua, int32_t type, char *val);
static bool hasBaseFuncDefinedInScript(lua_State *lua, const char *funcPrefix, int32_t len);
......@@ -106,8 +106,8 @@ int taosLoadScriptInit(void* pInit) {
lua_setglobal(lua, "global");
return 0;
}
void taosLoadScriptNormal(void *pInit, char *pInput, int16_t iType, int16_t iBytes, int32_t numOfRows,
int64_t *ptsList, int64_t key, char* pOutput, char *ptsOutput, int32_t *numOfOutput, int16_t oType, int16_t oBytes) {
void taosLoadScriptNormal(void *pInit, char *pInput, int16_t iType, uint16_t iBytes, int32_t numOfRows,
int64_t *ptsList, int64_t key, char* pOutput, char *ptsOutput, int32_t *numOfOutput, int16_t oType, uint16_t oBytes) {
ScriptCtx* pCtx = pInit;
char funcName[MAX_FUNC_NAME+1] = {0}; // one-more-space-for-null-terminator
int n = snprintf(funcName, sizeof(funcName), "%s_add", pCtx->funcName);
......@@ -248,7 +248,7 @@ void destroyScriptCtx(void *pCtx) {
free(pCtx);
}
void luaValueToTaosType(lua_State *lua, char *interBuf, int32_t *numOfOutput, int16_t oType, int16_t oBytes) {
void luaValueToTaosType(lua_State *lua, char *interBuf, int32_t *numOfOutput, int16_t oType, uint16_t oBytes) {
int t = lua_type(lua,-1);
int32_t sz = 0;
switch (t) {
......
......@@ -1045,7 +1045,7 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
} else {
bytes = bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
}
pField->bytes = (int16_t)bytes;
pField->bytes = (uint16_t)bytes;
}
} else if (i == TSDB_DATA_TYPE_BINARY) {
/* for binary, the TOKENTYPE is the length of binary */
......@@ -1060,7 +1060,7 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
bytes += VARSTR_HEADER_SIZE;
}
pField->bytes = (int16_t)bytes;
pField->bytes = (uint16_t)bytes;
}
} else {
if (type->type > 0) {
......
......@@ -20,8 +20,8 @@
#pragma pack (push,1)
typedef struct jsonMapValue{
void* table; // STable *
int16_t colId; // the json col ID.
void* table; // STable *
int16_t colId; // the json col ID.
}JsonMapValue;
#pragma pack (pop)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册