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

feat: column support 63K and row support 64k

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