提交 405597e5 编写于 作者: C Cary Xu

feat: column support 63K and row support 64k

上级 10b184cc
...@@ -26,10 +26,10 @@ extern "C" { ...@@ -26,10 +26,10 @@ extern "C" {
typedef TSDB_SML_PROTOCOL_TYPE SMLProtocolType; typedef TSDB_SML_PROTOCOL_TYPE SMLProtocolType;
typedef struct { typedef struct {
char* key; char* key;
uint8_t type; uint8_t type;
int16_t length; uint16_t length;
char* value; char* value;
uint32_t fieldSchemaIdx; uint32_t fieldSchemaIdx;
} TAOS_SML_KV; } TAOS_SML_KV;
......
...@@ -141,7 +141,7 @@ int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_ ...@@ -141,7 +141,7 @@ int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_
void tscDestroyBoundColumnInfo(SParsedDataColInfo* pColInfo); void tscDestroyBoundColumnInfo(SParsedDataColInfo* pColInfo);
void doRetrieveSubqueryData(SSchedMsg *pMsg); void doRetrieveSubqueryData(SSchedMsg *pMsg);
SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint8_t timePrec, int16_t bytes, SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint8_t timePrec, uint16_t bytes,
uint32_t offset); uint32_t offset);
void* tscDestroyBlockArrayList(SSqlObj* pSql, SArray* pDataBlockList); void* tscDestroyBlockArrayList(SSqlObj* pSql, SArray* pDataBlockList);
...@@ -205,7 +205,7 @@ bool tscIsInsertData(char* sqlstr); ...@@ -205,7 +205,7 @@ bool tscIsInsertData(char* sqlstr);
int32_t tscAllocPayloadFast(SSqlCmd *pCmd, size_t size); int32_t tscAllocPayloadFast(SSqlCmd *pCmd, size_t size);
int32_t tscAllocPayload(SSqlCmd* pCmd, int size); int32_t tscAllocPayload(SSqlCmd* pCmd, int size);
TAOS_FIELD tscCreateField(int8_t type, const char* name, int16_t bytes); TAOS_FIELD tscCreateField(int8_t type, const char* name, uint16_t bytes);
SInternalField* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField); SInternalField* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField);
SInternalField* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* field); SInternalField* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* field);
...@@ -231,15 +231,15 @@ void addExprParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes) ...@@ -231,15 +231,15 @@ void addExprParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes)
int32_t tscGetResRowLength(SArray* pExprList); int32_t tscGetResRowLength(SArray* pExprList);
SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int32_t interSize, bool isTagCol); uint16_t size, int16_t resColId, int32_t interSize, bool isTagCol);
SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int32_t interSize, int32_t colType); uint16_t size, int16_t resColId, int32_t interSize, int32_t colType);
void tscExprAddParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes); void tscExprAddParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes);
SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int32_t interSize, bool isTagCol); uint16_t size, int16_t resColId, int32_t interSize, bool isTagCol);
SExprInfo* tscExprUpdate(SQueryInfo* pQueryInfo, int32_t index, int16_t functionId, int16_t srcColumnIndex, int16_t type, SExprInfo* tscExprUpdate(SQueryInfo* pQueryInfo, int32_t index, int16_t functionId, int16_t srcColumnIndex, int16_t type,
int32_t size); int32_t size);
......
...@@ -86,7 +86,7 @@ typedef struct SParamInfo { ...@@ -86,7 +86,7 @@ typedef struct SParamInfo {
int32_t idx; int32_t idx;
uint8_t type; uint8_t type;
uint8_t timePrec; uint8_t timePrec;
int16_t bytes; uint16_t bytes;
uint32_t offset; uint32_t offset;
} SParamInfo; } SParamInfo;
......
...@@ -168,12 +168,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols, ...@@ -168,12 +168,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen += ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE); rowLen += ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE);
f.bytes = (int16_t)(typeColLength + VARSTR_HEADER_SIZE); f.bytes = (uint16_t)(typeColLength + VARSTR_HEADER_SIZE);
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
tstrncpy(f.name, "Type", sizeof(f.name)); tstrncpy(f.name, "Type", sizeof(f.name));
pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, (int16_t)(typeColLength + VARSTR_HEADER_SIZE), pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, (uint16_t)(typeColLength + VARSTR_HEADER_SIZE),
-1000, typeColLength, false); -1000, typeColLength, false);
rowLen += typeColLength + VARSTR_HEADER_SIZE; rowLen += typeColLength + VARSTR_HEADER_SIZE;
...@@ -188,12 +188,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols, ...@@ -188,12 +188,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen += sizeof(int32_t); rowLen += sizeof(int32_t);
f.bytes = (int16_t)(noteColLength + VARSTR_HEADER_SIZE); f.bytes = (uint16_t)(noteColLength + VARSTR_HEADER_SIZE);
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
tstrncpy(f.name, "Note", sizeof(f.name)); tstrncpy(f.name, "Note", sizeof(f.name));
pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, (int16_t)(noteColLength + VARSTR_HEADER_SIZE), pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, (uint16_t)(noteColLength + VARSTR_HEADER_SIZE),
-1000, noteColLength, false); -1000, noteColLength, false);
rowLen += noteColLength + VARSTR_HEADER_SIZE; rowLen += noteColLength + VARSTR_HEADER_SIZE;
...@@ -414,31 +414,32 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) { ...@@ -414,31 +414,32 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
// build 'show create table/database' result fields // build 'show create table/database' result fields
static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const char *ddl) { static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const char *ddl) {
int32_t rowLen = 0; int32_t rowLen = 0;
int16_t ddlLen = (int16_t)strlen(ddl); uint16_t ddlLen = (uint16_t)strlen(ddl);
SColumnIndex idx = {0}; SColumnIndex idx = {0};
pSql->cmd.numOfCols = 2; pSql->cmd.numOfCols = 2;
SQueryInfo* pQueryInfo = tscGetQueryInfo(&pSql->cmd); SQueryInfo *pQueryInfo = tscGetQueryInfo(&pSql->cmd);
pQueryInfo->order.order = TSDB_ORDER_ASC; pQueryInfo->order.order = TSDB_ORDER_ASC;
TAOS_FIELD f; TAOS_FIELD f;
if (type == SCREATE_BUILD_TABLE) { if (type == SCREATE_BUILD_TABLE) {
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
f.bytes = (TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE; f.bytes = (TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE;
tstrncpy(f.name, "Table", sizeof(f.name)); tstrncpy(f.name, "Table", sizeof(f.name));
} else { } else {
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
f.bytes = (TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE; f.bytes = (TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE;
tstrncpy(f.name, "Database", sizeof(f.name)); tstrncpy(f.name, "Database", sizeof(f.name));
} }
SInternalField* pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); SInternalField *pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, f.bytes, -1000, f.bytes - VARSTR_HEADER_SIZE, false); pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, f.bytes, -1000,
f.bytes - VARSTR_HEADER_SIZE, false);
rowLen += f.bytes; rowLen += f.bytes;
f.bytes = (int16_t)(ddlLen + VARSTR_HEADER_SIZE); f.bytes = (uint16_t)(ddlLen + VARSTR_HEADER_SIZE);
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
if (type == SCREATE_BUILD_TABLE) { if (type == SCREATE_BUILD_TABLE) {
tstrncpy(f.name, "Create Table", sizeof(f.name)); tstrncpy(f.name, "Create Table", sizeof(f.name));
...@@ -448,7 +449,7 @@ static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const ...@@ -448,7 +449,7 @@ static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const
pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY, pInfo->pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &idx, TSDB_DATA_TYPE_BINARY,
(int16_t)(ddlLen + VARSTR_HEADER_SIZE), -1000, ddlLen, false); (uint16_t)(ddlLen + VARSTR_HEADER_SIZE), -1000, ddlLen, false);
rowLen += ddlLen + VARSTR_HEADER_SIZE; rowLen += ddlLen + VARSTR_HEADER_SIZE;
...@@ -943,7 +944,7 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa ...@@ -943,7 +944,7 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa
tscFieldInfoClear(&pQueryInfo->fieldsInfo); tscFieldInfoClear(&pQueryInfo->fieldsInfo);
pQueryInfo->fieldsInfo.internalField = taosArrayInit(1, sizeof(SInternalField)); pQueryInfo->fieldsInfo.internalField = taosArrayInit(1, sizeof(SInternalField));
TAOS_FIELD f = tscCreateField((int8_t)type, columnName, (int16_t)valueLength); TAOS_FIELD f = tscCreateField((int8_t)type, columnName, (uint16_t)valueLength);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pSql->res.pMerger = tscInitResObjForLocalQuery(1, (int32_t)valueLength, pSql->self); pSql->res.pMerger = tscInitResObjForLocalQuery(1, (int32_t)valueLength, pSql->self);
......
...@@ -1643,8 +1643,8 @@ static int32_t isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, S ...@@ -1643,8 +1643,8 @@ static int32_t isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, S
static bool convertStrToNumber(TAOS_SML_KV *pVal, char *str, SSmlLinesInfo* info) { static bool convertStrToNumber(TAOS_SML_KV *pVal, char *str, SSmlLinesInfo* info) {
errno = 0; errno = 0;
uint8_t type = pVal->type; uint8_t type = pVal->type;
int16_t length = pVal->length; uint16_t length = pVal->length;
int64_t val_s = 0; int64_t val_s = 0;
uint64_t val_u = 0; uint64_t val_u = 0;
double val_d = 0.0; double val_d = 0.0;
...@@ -1761,7 +1761,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1761,7 +1761,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
bool has_sign; bool has_sign;
if (isInteger(value, len, &has_sign)) { if (isInteger(value, len, &has_sign)) {
pVal->type = has_sign ? TSDB_DATA_TYPE_BIGINT : TSDB_DATA_TYPE_UBIGINT; pVal->type = has_sign ? TSDB_DATA_TYPE_BIGINT : TSDB_DATA_TYPE_UBIGINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 1] = '\0'; value[len - 1] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1770,7 +1770,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1770,7 +1770,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isTinyInt(value, len)) { if (isTinyInt(value, len)) {
pVal->type = TSDB_DATA_TYPE_TINYINT; pVal->type = TSDB_DATA_TYPE_TINYINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 2] = '\0'; value[len - 2] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1779,7 +1779,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1779,7 +1779,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isTinyUint(value, len)) { if (isTinyUint(value, len)) {
pVal->type = TSDB_DATA_TYPE_UTINYINT; pVal->type = TSDB_DATA_TYPE_UTINYINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 2] = '\0'; value[len - 2] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1788,7 +1788,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1788,7 +1788,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isSmallInt(value, len)) { if (isSmallInt(value, len)) {
pVal->type = TSDB_DATA_TYPE_SMALLINT; pVal->type = TSDB_DATA_TYPE_SMALLINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1797,7 +1797,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1797,7 +1797,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isSmallUint(value, len)) { if (isSmallUint(value, len)) {
pVal->type = TSDB_DATA_TYPE_USMALLINT; pVal->type = TSDB_DATA_TYPE_USMALLINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1806,7 +1806,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1806,7 +1806,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isInt(value, len)) { if (isInt(value, len)) {
pVal->type = TSDB_DATA_TYPE_INT; pVal->type = TSDB_DATA_TYPE_INT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1815,7 +1815,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1815,7 +1815,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isUint(value, len)) { if (isUint(value, len)) {
pVal->type = TSDB_DATA_TYPE_UINT; pVal->type = TSDB_DATA_TYPE_UINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1824,7 +1824,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1824,7 +1824,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isBigInt(value, len)) { if (isBigInt(value, len)) {
pVal->type = TSDB_DATA_TYPE_BIGINT; pVal->type = TSDB_DATA_TYPE_BIGINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1833,7 +1833,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1833,7 +1833,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isBigUint(value, len)) { if (isBigUint(value, len)) {
pVal->type = TSDB_DATA_TYPE_UBIGINT; pVal->type = TSDB_DATA_TYPE_UBIGINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1843,7 +1843,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1843,7 +1843,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
//floating number //floating number
if (isFloat(value, len)) { if (isFloat(value, len)) {
pVal->type = TSDB_DATA_TYPE_FLOAT; pVal->type = TSDB_DATA_TYPE_FLOAT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1852,7 +1852,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1852,7 +1852,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
} }
if (isDouble(value, len)) { if (isDouble(value, len)) {
pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->type = TSDB_DATA_TYPE_DOUBLE;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) { if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
...@@ -1881,7 +1881,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1881,7 +1881,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
bool bVal; bool bVal;
if (isBool(value, len, &bVal)) { if (isBool(value, len, &bVal)) {
pVal->type = TSDB_DATA_TYPE_BOOL; pVal->type = TSDB_DATA_TYPE_BOOL;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = calloc(pVal->length, 1); pVal->value = calloc(pVal->length, 1);
memcpy(pVal->value, &bVal, pVal->length); memcpy(pVal->value, &bVal, pVal->length);
return true; return true;
...@@ -1890,7 +1890,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, ...@@ -1890,7 +1890,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
//Handle default(no appendix) type as DOUBLE //Handle default(no appendix) type as DOUBLE
if (isValidInteger(value) || isValidFloat(value)) { if (isValidInteger(value) || isValidFloat(value)) {
pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->type = TSDB_DATA_TYPE_DOUBLE;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
if (!convertStrToNumber(pVal, value, info)) { if (!convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
...@@ -1962,7 +1962,7 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, ...@@ -1962,7 +1962,7 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
tscDebug("SML:0x%"PRIx64"Timestamp after conversion:%"PRId64, info->id, tsVal); tscDebug("SML:0x%"PRIx64"Timestamp after conversion:%"PRId64, info->id, tsVal);
pVal->type = TSDB_DATA_TYPE_TIMESTAMP; pVal->type = TSDB_DATA_TYPE_TIMESTAMP;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = calloc(pVal->length, 1); pVal->value = calloc(pVal->length, 1);
memcpy(pVal->value, &tsVal, pVal->length); memcpy(pVal->value, &tsVal, pVal->length);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -2056,7 +2056,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen, ...@@ -2056,7 +2056,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen,
int32_t ret = TSDB_CODE_SUCCESS; int32_t ret = TSDB_CODE_SUCCESS;
char *value = NULL; char *value = NULL;
int32_t bufSize = TSDB_FUNC_BUF_SIZE; int32_t bufSize = TSDB_FUNC_BUF_SIZE;
int16_t len = 0; uint16_t len = 0;
bool kv_done = false; bool kv_done = false;
bool back_slash = false; bool back_slash = false;
......
...@@ -657,7 +657,7 @@ static int32_t parseTimestampFromJSON(cJSON *root, TAOS_SML_KV **pTS, int *num_k ...@@ -657,7 +657,7 @@ static int32_t parseTimestampFromJSON(cJSON *root, TAOS_SML_KV **pTS, int *num_k
memcpy((*pTS)->key, key, sizeof(key)); memcpy((*pTS)->key, key, sizeof(key));
(*pTS)->type = TSDB_DATA_TYPE_TIMESTAMP; (*pTS)->type = TSDB_DATA_TYPE_TIMESTAMP;
(*pTS)->length = (int16_t)tDataTypes[(*pTS)->type].bytes; (*pTS)->length = (uint16_t)tDataTypes[(*pTS)->type].bytes;
(*pTS)->value = tcalloc((*pTS)->length, 1); (*pTS)->value = tcalloc((*pTS)->length, 1);
memcpy((*pTS)->value, &tsVal, (*pTS)->length); memcpy((*pTS)->value, &tsVal, (*pTS)->length);
...@@ -672,7 +672,7 @@ static int32_t convertJSONBool(TAOS_SML_KV *pVal, char* typeStr, int64_t valueIn ...@@ -672,7 +672,7 @@ static int32_t convertJSONBool(TAOS_SML_KV *pVal, char* typeStr, int64_t valueIn
return TSDB_CODE_TSC_INVALID_JSON_TYPE; return TSDB_CODE_TSC_INVALID_JSON_TYPE;
} }
pVal->type = TSDB_DATA_TYPE_BOOL; pVal->type = TSDB_DATA_TYPE_BOOL;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(bool *)(pVal->value) = valueInt ? true : false; *(bool *)(pVal->value) = valueInt ? true : false;
...@@ -688,7 +688,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -688,7 +688,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE;
} }
pVal->type = TSDB_DATA_TYPE_TINYINT; pVal->type = TSDB_DATA_TYPE_TINYINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(int8_t *)(pVal->value) = (int8_t)(value->valueint); *(int8_t *)(pVal->value) = (int8_t)(value->valueint);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -701,7 +701,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -701,7 +701,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE;
} }
pVal->type = TSDB_DATA_TYPE_SMALLINT; pVal->type = TSDB_DATA_TYPE_SMALLINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(int16_t *)(pVal->value) = (int16_t)(value->valueint); *(int16_t *)(pVal->value) = (int16_t)(value->valueint);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -714,7 +714,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -714,7 +714,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE;
} }
pVal->type = TSDB_DATA_TYPE_INT; pVal->type = TSDB_DATA_TYPE_INT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(int32_t *)(pVal->value) = (int32_t)(value->valueint); *(int32_t *)(pVal->value) = (int32_t)(value->valueint);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -723,7 +723,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -723,7 +723,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
if (strcasecmp(typeStr, "i64") == 0 || if (strcasecmp(typeStr, "i64") == 0 ||
strcasecmp(typeStr, "bigint") == 0) { strcasecmp(typeStr, "bigint") == 0) {
pVal->type = TSDB_DATA_TYPE_BIGINT; pVal->type = TSDB_DATA_TYPE_BIGINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
/* cJSON conversion of legit BIGINT may overflow, /* cJSON conversion of legit BIGINT may overflow,
* use original string to do the conversion. * use original string to do the conversion.
...@@ -745,7 +745,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -745,7 +745,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE;
} }
pVal->type = TSDB_DATA_TYPE_FLOAT; pVal->type = TSDB_DATA_TYPE_FLOAT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(float *)(pVal->value) = (float)(value->valuedouble); *(float *)(pVal->value) = (float)(value->valuedouble);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -758,7 +758,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -758,7 +758,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE;
} }
pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->type = TSDB_DATA_TYPE_DOUBLE;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(double *)(pVal->value) = (double)(value->valuedouble); *(double *)(pVal->value) = (double)(value->valuedouble);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -778,7 +778,7 @@ static int32_t convertJSONString(TAOS_SML_KV *pVal, char* typeStr, cJSON *value, ...@@ -778,7 +778,7 @@ static int32_t convertJSONString(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
tscError("OTD:0x%"PRIx64" invalid type(%s) for JSON String", info->id, typeStr); tscError("OTD:0x%"PRIx64" invalid type(%s) for JSON String", info->id, typeStr);
return TSDB_CODE_TSC_INVALID_JSON_TYPE; return TSDB_CODE_TSC_INVALID_JSON_TYPE;
} }
pVal->length = (int16_t)strlen(value->valuestring); pVal->length = (uint16_t)strlen(value->valuestring);
pVal->value = tcalloc(pVal->length + 1, 1); pVal->value = tcalloc(pVal->length + 1, 1);
memcpy(pVal->value, value->valuestring, pVal->length); memcpy(pVal->value, value->valuestring, pVal->length);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -839,7 +839,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* ...@@ -839,7 +839,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
case cJSON_True: case cJSON_True:
case cJSON_False: { case cJSON_False: {
pVal->type = TSDB_DATA_TYPE_BOOL; pVal->type = TSDB_DATA_TYPE_BOOL;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(bool *)(pVal->value) = root->valueint ? true : false; *(bool *)(pVal->value) = root->valueint ? true : false;
break; break;
...@@ -848,7 +848,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* ...@@ -848,7 +848,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
//convert default JSON Number type to BIGINT/DOUBLE //convert default JSON Number type to BIGINT/DOUBLE
//if (isValidInteger(root->numberstring)) { //if (isValidInteger(root->numberstring)) {
// pVal->type = TSDB_DATA_TYPE_BIGINT; // pVal->type = TSDB_DATA_TYPE_BIGINT;
// pVal->length = (int16_t)tDataTypes[pVal->type].bytes; // pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
// pVal->value = tcalloc(pVal->length, 1); // pVal->value = tcalloc(pVal->length, 1);
// /* cJSON conversion of legit BIGINT may overflow, // /* cJSON conversion of legit BIGINT may overflow,
// * use original string to do the conversion. // * use original string to do the conversion.
...@@ -862,7 +862,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* ...@@ -862,7 +862,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
// *(int64_t *)(pVal->value) = val; // *(int64_t *)(pVal->value) = val;
//} else if (isValidFloat(root->numberstring)) { //} else if (isValidFloat(root->numberstring)) {
// pVal->type = TSDB_DATA_TYPE_DOUBLE; // pVal->type = TSDB_DATA_TYPE_DOUBLE;
// pVal->length = (int16_t)tDataTypes[pVal->type].bytes; // pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
// pVal->value = tcalloc(pVal->length, 1); // pVal->value = tcalloc(pVal->length, 1);
// *(double *)(pVal->value) = (double)(root->valuedouble); // *(double *)(pVal->value) = (double)(root->valuedouble);
//} else { //} else {
...@@ -870,7 +870,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* ...@@ -870,7 +870,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
//} //}
if (isValidInteger(root->numberstring) || isValidFloat(root->numberstring)) { if (isValidInteger(root->numberstring) || isValidFloat(root->numberstring)) {
pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->type = TSDB_DATA_TYPE_DOUBLE;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (uint16_t)tDataTypes[pVal->type].bytes;
pVal->value = tcalloc(pVal->length, 1); pVal->value = tcalloc(pVal->length, 1);
*(double *)(pVal->value) = (double)(root->valuedouble); *(double *)(pVal->value) = (double)(root->valuedouble);
} }
...@@ -890,7 +890,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* ...@@ -890,7 +890,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
return TSDB_CODE_TSC_INVALID_JSON_CONFIG; return TSDB_CODE_TSC_INVALID_JSON_CONFIG;
} }
//pVal->length = wcslen((wchar_t *)root->valuestring) * TSDB_NCHAR_SIZE; //pVal->length = wcslen((wchar_t *)root->valuestring) * TSDB_NCHAR_SIZE;
pVal->length = (int16_t)strlen(root->valuestring); pVal->length = (uint16_t)strlen(root->valuestring);
pVal->value = tcalloc(pVal->length + 1, 1); pVal->value = tcalloc(pVal->length + 1, 1);
memcpy(pVal->value, root->valuestring, pVal->length); memcpy(pVal->value, root->valuestring, pVal->length);
break; break;
......
...@@ -922,7 +922,7 @@ static int doBindBatchParam(STableDataBlocks* pBlock, SParamInfo* param, TAOS_MU ...@@ -922,7 +922,7 @@ static int doBindBatchParam(STableDataBlocks* pBlock, SParamInfo* param, TAOS_MU
tscError("binary length too long, ignore it, max:%d, actual:%d", param->bytes, (int32_t)pBind->length[i]); tscError("binary length too long, ignore it, max:%d, actual:%d", param->bytes, (int32_t)pBind->length[i]);
return TSDB_CODE_TSC_INVALID_VALUE; return TSDB_CODE_TSC_INVALID_VALUE;
} }
int16_t bsize = (short)pBind->length[i]; uint16_t bsize = (uint16_t)pBind->length[i];
STR_WITH_SIZE_TO_VARSTR(data + param->offset, (char *)pBind->buffer + pBind->buffer_length * i, bsize); STR_WITH_SIZE_TO_VARSTR(data + param->offset, (char *)pBind->buffer + pBind->buffer_length * i, bsize);
} else if (param->type == TSDB_DATA_TYPE_NCHAR) { } else if (param->type == TSDB_DATA_TYPE_NCHAR) {
if (pBind->length[i] > (uintptr_t)param->bytes) { if (pBind->length[i] > (uintptr_t)param->bytes) {
......
...@@ -81,7 +81,7 @@ static void getColumnName(tSqlExprItem* pItem, char* resultFieldName, char* rawN ...@@ -81,7 +81,7 @@ static void getColumnName(tSqlExprItem* pItem, char* resultFieldName, char* rawN
static int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t colIndex, tSqlExprItem* pItem, static int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t colIndex, tSqlExprItem* pItem,
bool finalResult, SUdfInfo* pUdfInfo); bool finalResult, SUdfInfo* pUdfInfo);
static int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnList* pColList, int16_t bytes, static int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnList* pColList, uint16_t bytes,
int8_t type, char* fieldName, SExprInfo* pSqlExpr); int8_t type, char* fieldName, SExprInfo* pSqlExpr);
static uint8_t convertRelationalOperator(SStrToken *pToken); static uint8_t convertRelationalOperator(SStrToken *pToken);
...@@ -2368,7 +2368,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS ...@@ -2368,7 +2368,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnList* pColList, int16_t bytes, int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnList* pColList, uint16_t bytes,
int8_t type, char* fieldName, SExprInfo* pSqlExpr) { int8_t type, char* fieldName, SExprInfo* pSqlExpr) {
for (int32_t i = 0; i < pColList->num; ++i) { for (int32_t i = 0; i < pColList->num; ++i) {
int32_t tableIndex = pColList->ids[i].tableIndex; int32_t tableIndex = pColList->ids[i].tableIndex;
...@@ -8276,9 +8276,9 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau ...@@ -8276,9 +8276,9 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
int16_t colIndex = tscGetTagColIndexById(pTableMetaInfo->pTableMeta, colId); int16_t colIndex = tscGetTagColIndexById(pTableMetaInfo->pTableMeta, colId);
SColumnIndex idx = {.tableIndex = 0, .columnIndex = colIndex}; SColumnIndex idx = {.tableIndex = 0, .columnIndex = colIndex};
char* name = pTagSchema->name; char* name = pTagSchema->name;
int16_t type = pTagSchema->type; int16_t type = pTagSchema->type;
int16_t bytes = pTagSchema->bytes; uint16_t bytes = pTagSchema->bytes;
pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TAG, &idx, type, bytes, getNewResColId(&pSql->cmd), bytes, true); pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TAG, &idx, type, bytes, getNewResColId(&pSql->cmd), bytes, true);
pExpr->base.colInfo.flag = TSDB_COL_TAG; pExpr->base.colInfo.flag = TSDB_COL_TAG;
...@@ -9350,7 +9350,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -9350,7 +9350,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
// check again after the convert since it may be converted from binary to nchar. // check again after the convert since it may be converted from binary to nchar.
if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
int16_t len = varDataTLen(tagVal); uint16_t len = varDataTLen(tagVal);
if (len > pSchema->bytes) { if (len > pSchema->bytes) {
tdDestroyKVRowBuilder(&kvRowBuilder); tdDestroyKVRowBuilder(&kvRowBuilder);
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
...@@ -9404,7 +9404,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -9404,7 +9404,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
// check again after the convert since it may be converted from binary to nchar. // check again after the convert since it may be converted from binary to nchar.
if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
int16_t len = varDataTLen(tagVal); uint16_t len = varDataTLen(tagVal);
if (len > pSchema->bytes) { if (len > pSchema->bytes) {
tdDestroyKVRowBuilder(&kvRowBuilder); tdDestroyKVRowBuilder(&kvRowBuilder);
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
......
...@@ -1290,7 +1290,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1290,7 +1290,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
*(int8_t*) pMsg = pUdfInfo->resType; *(int8_t*) pMsg = pUdfInfo->resType;
pMsg += sizeof(pUdfInfo->resType); pMsg += sizeof(pUdfInfo->resType);
*(int16_t*) pMsg = htons(pUdfInfo->resBytes); *(uint16_t *)pMsg = htons(pUdfInfo->resBytes);
pMsg += sizeof(pUdfInfo->resBytes); pMsg += sizeof(pUdfInfo->resBytes);
STR_TO_VARSTR(pMsg, pUdfInfo->name); STR_TO_VARSTR(pMsg, pUdfInfo->name);
......
...@@ -3747,7 +3747,7 @@ _error: ...@@ -3747,7 +3747,7 @@ _error:
return pRes->code; return pRes->code;
} }
static char* getResultBlockPosition(SSqlCmd* pCmd, SSqlRes* pRes, int32_t columnIndex, int16_t* bytes) { static char* getResultBlockPosition(SSqlCmd* pCmd, SSqlRes* pRes, int32_t columnIndex, uint16_t* bytes) {
SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd);
SInternalField* pInfo = (SInternalField*) TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.internalField, columnIndex); SInternalField* pInfo = (SInternalField*) TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.internalField, columnIndex);
...@@ -3805,7 +3805,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) { ...@@ -3805,7 +3805,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
pRes->data = pFilePage->data; pRes->data = pFilePage->data;
char* data = pRes->data; char* data = pRes->data;
int16_t bytes = 0; uint16_t bytes = 0;
tscRestoreFuncForSTableQuery(pQueryInfo); tscRestoreFuncForSTableQuery(pQueryInfo);
tscFieldInfoUpdateOffset(pQueryInfo); tscFieldInfoUpdateOffset(pQueryInfo);
......
...@@ -1865,7 +1865,7 @@ void tscDestroyDataBlock(SSqlObj *pSql, STableDataBlocks* pDataBlock, bool remov ...@@ -1865,7 +1865,7 @@ void tscDestroyDataBlock(SSqlObj *pSql, STableDataBlocks* pDataBlock, bool remov
tfree(pDataBlock); tfree(pDataBlock);
} }
SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint8_t timePrec, int16_t bytes, SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint8_t timePrec, uint16_t bytes,
uint32_t offset) { uint32_t offset) {
uint32_t needed = pDataBlock->numOfParams + 1; uint32_t needed = pDataBlock->numOfParams + 1;
if (needed > pDataBlock->numOfAllocedParams) { if (needed > pDataBlock->numOfAllocedParams) {
...@@ -2395,7 +2395,7 @@ int32_t tscAllocPayload(SSqlCmd* pCmd, int size) { ...@@ -2395,7 +2395,7 @@ int32_t tscAllocPayload(SSqlCmd* pCmd, int size) {
return code; return code;
} }
TAOS_FIELD tscCreateField(int8_t type, const char* name, int16_t bytes) { TAOS_FIELD tscCreateField(int8_t type, const char* name, uint16_t bytes) {
TAOS_FIELD f = { .type = type, .bytes = bytes, }; TAOS_FIELD f = { .type = type, .bytes = bytes, };
tstrncpy(f.name, name, sizeof(f.name)); tstrncpy(f.name, name, sizeof(f.name));
return f; return f;
...@@ -2623,7 +2623,7 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr ...@@ -2623,7 +2623,7 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr
SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int32_t interSize, int32_t colType) { uint16_t size, int16_t resColId, int32_t interSize, int32_t colType) {
SExprInfo* pExpr = calloc(1, sizeof(SExprInfo)); SExprInfo* pExpr = calloc(1, sizeof(SExprInfo));
if (pExpr == NULL) { if (pExpr == NULL) {
return NULL; return NULL;
...@@ -2685,7 +2685,7 @@ SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SCo ...@@ -2685,7 +2685,7 @@ SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SCo
} }
SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t idx, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t idx, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int32_t interSize, bool isTagCol) { uint16_t size, int16_t resColId, int32_t interSize, bool isTagCol) {
int32_t num = (int32_t)taosArrayGetSize(pQueryInfo->exprList); int32_t num = (int32_t)taosArrayGetSize(pQueryInfo->exprList);
if (idx == num) { if (idx == num) {
return tscExprAppend(pQueryInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol); return tscExprAppend(pQueryInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol);
...@@ -2698,7 +2698,7 @@ SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t idx, int16_t functionId ...@@ -2698,7 +2698,7 @@ SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t idx, int16_t functionId
} }
SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int32_t interSize, bool isTagCol) { uint16_t size, int16_t resColId, int32_t interSize, bool isTagCol) {
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, pColIndex->tableIndex); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, pColIndex->tableIndex);
SExprInfo* pExpr = tscExprCreate(pTableMetaInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol); SExprInfo* pExpr = tscExprCreate(pTableMetaInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol);
taosArrayPush(pQueryInfo->exprList, &pExpr); taosArrayPush(pQueryInfo->exprList, &pExpr);
......
...@@ -66,7 +66,7 @@ typedef enum { ...@@ -66,7 +66,7 @@ typedef enum {
typedef struct taosField { typedef struct taosField {
char name[65]; char name[65];
uint8_t type; uint8_t type;
int16_t bytes; uint16_t bytes;
} TAOS_FIELD; } TAOS_FIELD;
typedef enum { typedef enum {
......
...@@ -206,7 +206,14 @@ do { \ ...@@ -206,7 +206,14 @@ do { \
// this is the length of its string representation, including the terminator zero // this is the length of its string representation, including the terminator zero
#define TSDB_ACCT_ID_LEN 11 #define TSDB_ACCT_ID_LEN 11
#define TSDB_MODE_RICH_COL_
#ifdef TSDB_MODE_RICH_COL
#define TSDB_MAX_COLUMNS 4096 #define TSDB_MAX_COLUMNS 4096
#else
#define TSDB_MAX_COLUMNS 128
#endif
#define TSDB_MIN_COLUMNS 2 //PRIMARY COLUMN(timestamp) + other columns #define TSDB_MIN_COLUMNS 2 //PRIMARY COLUMN(timestamp) + other columns
#define TSDB_NODE_NAME_LEN 64 #define TSDB_NODE_NAME_LEN 64
...@@ -231,7 +238,12 @@ do { \ ...@@ -231,7 +238,12 @@ do { \
* - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus * - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus
* the final value is 65531-(4096-1)*4 = 49151. * the final value is 65531-(4096-1)*4 = 49151.
*/ */
#define TSDB_MAX_BYTES_PER_ROW 49151 #ifdef TSDB_MODE_RICH_COL
#define TSDB_MAX_BYTES_PER_ROW 49151
#else
#define TSDB_MAX_BYTES_PER_ROW 65023 // 65531-(128-1)*4=65023
#endif
#define TSDB_MAX_TAGS_LEN 16384 #define TSDB_MAX_TAGS_LEN 16384
#define TSDB_MAX_JSON_TAGS_LEN (4096*TSDB_NCHAR_SIZE + 2 + 1) // 2->var_header_len 1->type #define TSDB_MAX_JSON_TAGS_LEN (4096*TSDB_NCHAR_SIZE + 2 + 1) // 2->var_header_len 1->type
#define TSDB_MAX_TAGS 128 #define TSDB_MAX_TAGS 128
...@@ -371,7 +383,12 @@ do { \ ...@@ -371,7 +383,12 @@ do { \
#define TSDB_MAX_JOIN_TABLE_NUM 10 #define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_UNION_CLAUSE 5 #define TSDB_MAX_UNION_CLAUSE 5
#ifdef TSDB_MODE_RICH_COL
#define TSDB_MAX_FIELD_LEN 16384 #define TSDB_MAX_FIELD_LEN 16384
#else
#define TSDB_MAX_FIELD_LEN 64512
#endif
#define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN-TSDB_KEYSIZE) // keep 16384 #define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN-TSDB_KEYSIZE) // keep 16384
#define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN-TSDB_KEYSIZE) // keep 16384 #define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN-TSDB_KEYSIZE) // keep 16384
#define PRIMARYKEY_TIMESTAMP_COL_INDEX 0 #define PRIMARYKEY_TIMESTAMP_COL_INDEX 0
......
...@@ -265,10 +265,10 @@ typedef struct { ...@@ -265,10 +265,10 @@ typedef struct {
} SShellSubmitRspMsg; } SShellSubmitRspMsg;
typedef struct SSchema { typedef struct SSchema {
uint8_t type; uint8_t type;
char name[TSDB_COL_NAME_LEN]; char name[TSDB_COL_NAME_LEN];
int16_t colId; int16_t colId;
int16_t bytes; uint16_t bytes;
} SSchema; } SSchema;
typedef struct STimeWindow { typedef struct STimeWindow {
...@@ -643,14 +643,14 @@ typedef struct { ...@@ -643,14 +643,14 @@ typedef struct {
} SRetrieveFuncMsg; } SRetrieveFuncMsg;
typedef struct { typedef struct {
int8_t extend; int8_t extend;
char name[TSDB_FUNC_NAME_LEN]; char name[TSDB_FUNC_NAME_LEN];
int32_t funcType; int32_t funcType;
int8_t resType; int8_t resType;
int16_t resBytes; uint16_t resBytes;
int32_t bufSize; int32_t bufSize;
int32_t len; int32_t len;
char content[]; char content[];
} SFunctionInfoMsg; } SFunctionInfoMsg;
typedef struct { typedef struct {
......
...@@ -432,8 +432,8 @@ bool tsdbNoProblem(STsdbRepo* pRepo); ...@@ -432,8 +432,8 @@ bool tsdbNoProblem(STsdbRepo* pRepo);
int tsdbCheckWal(STsdbRepo *pRepo, uint32_t walSize); int tsdbCheckWal(STsdbRepo *pRepo, uint32_t walSize);
// for json tag // for json tag
void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* out, int16_t bytes); void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* out, uint16_t bytes);
void getJsonTagValueAll(void* data, void* dst, int16_t bytes); void getJsonTagValueAll(void* data, void* dst, uint16_t bytes);
char* parseTagDatatoJson(void *p); char* parseTagDatatoJson(void *p);
// //
......
...@@ -11,7 +11,7 @@ extern "C" { ...@@ -11,7 +11,7 @@ extern "C" {
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR // ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
typedef int32_t VarDataOffsetT; typedef int32_t VarDataOffsetT;
typedef int16_t VarDataLenT; // maxVarDataLen: 32767 typedef uint16_t VarDataLenT; // maxVarDataLen: 65535
typedef uint16_t TDRowLenT; // not including overhead: 0 ~ 65535 typedef uint16_t TDRowLenT; // not including overhead: 0 ~ 65535
typedef uint32_t TDRowTLenT; // total length, including overhead typedef uint32_t TDRowTLenT; // total length, including overhead
......
...@@ -239,7 +239,7 @@ typedef struct SFuncObj { ...@@ -239,7 +239,7 @@ typedef struct SFuncObj {
int32_t bufSize; int32_t bufSize;
int64_t createdTime; int64_t createdTime;
uint8_t resType; uint8_t resType;
int16_t resBytes; uint16_t resBytes;
int64_t sig; // partial md5 sign int64_t sig; // partial md5 sign
int16_t type; // [lua script|so|js] int16_t type; // [lua script|so|js]
int8_t reserved[64]; int8_t reserved[64];
......
...@@ -42,23 +42,23 @@ enum ScriptState { ...@@ -42,23 +42,23 @@ enum ScriptState {
typedef struct { typedef struct {
SHashObj *funcId; //func already registed in lua_env, may be no use SHashObj *funcId; //func already registed in lua_env, may be no use
lua_State *lua_state; // lua env lua_State *lua_state; // lua env
} ScriptEnv; } ScriptEnv;
typedef struct ScriptCtx { typedef struct ScriptCtx {
// one-more-space-for-null-terminator to support function name // one-more-space-for-null-terminator to support function name
// at most USER_FUNC_NAME_LIMIT bytes long actually // at most USER_FUNC_NAME_LIMIT bytes long actually
char funcName[USER_FUNC_NAME_LIMIT+1]; char funcName[USER_FUNC_NAME_LIMIT + 1];
int8_t state; int8_t state;
ScriptEnv *pEnv; ScriptEnv *pEnv;
int8_t isAgg; // agg function or not int8_t isAgg; // agg function or not
// init value of udf script // init value of udf script
int8_t resType; int8_t resType;
int16_t resBytes; uint16_t resBytes;
int32_t numOfOutput;
int32_t offset;
int32_t numOfOutput;
int32_t offset;
} ScriptCtx; } ScriptCtx;
int taosLoadScriptInit(void *pInit); int taosLoadScriptInit(void *pInit);
...@@ -75,7 +75,7 @@ typedef struct { ...@@ -75,7 +75,7 @@ typedef struct {
pthread_mutex_t mutex; pthread_mutex_t mutex;
} ScriptEnvPool; } ScriptEnvPool;
ScriptCtx* createScriptCtx(char *str, int8_t resType, int16_t resBytes); ScriptCtx* createScriptCtx(char *str, int8_t resType, uint16_t resBytes);
void destroyScriptCtx(void *pScriptCtx); void destroyScriptCtx(void *pScriptCtx);
int32_t scriptEnvPoolInit(); int32_t scriptEnvPoolInit();
......
...@@ -32,26 +32,25 @@ typedef struct SUdfInit{ ...@@ -32,26 +32,25 @@ typedef struct SUdfInit{
void (*destroyCtxFunc)(void *script_ctx); void (*destroyCtxFunc)(void *script_ctx);
} SUdfInit; } SUdfInit;
typedef struct SUdfInfo { typedef struct SUdfInfo {
int32_t functionId; // system assigned function id int32_t functionId; // system assigned function id
int32_t funcType; // scalar function or aggregate function int32_t funcType; // scalar function or aggregate function
int8_t resType; // result type int8_t resType; // result type
int16_t resBytes; // result byte uint16_t resBytes; // result byte
int32_t contLen; // content length int32_t contLen; // content length
int32_t bufSize; //interbuf size int32_t bufSize; // interbuf size
char *name; // function name char* name; // function name
void *handle; // handle loaded in mem void* handle; // handle loaded in mem
void *funcs[TSDB_UDF_FUNC_MAX_NUM]; // function ptr void* funcs[TSDB_UDF_FUNC_MAX_NUM]; // function ptr
// for script like lua/javascript only // for script like lua/javascript only
int isScript; int isScript;
void *pScriptCtx; void* pScriptCtx;
SUdfInit init; SUdfInit init;
char *content; char* content;
char *path; char* path;
bool keep; bool keep;
} SUdfInfo; } SUdfInfo;
//script //script
......
...@@ -3446,7 +3446,7 @@ void filterColRowsInDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SSDataBlock* pBlock ...@@ -3446,7 +3446,7 @@ void filterColRowsInDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SSDataBlock* pBlock
static SColumnInfo* doGetTagColumnInfoById(SColumnInfo* pTagColList, int32_t numOfTags, int16_t colId); static SColumnInfo* doGetTagColumnInfoById(SColumnInfo* pTagColList, int32_t numOfTags, int16_t colId);
static void doSetTagValueInParam(void* pTable, char* param, int32_t paraLen, int32_t tagColId, tVariant* tag, static void doSetTagValueInParam(void* pTable, char* param, int32_t paraLen, int32_t tagColId, tVariant* tag,
int16_t type, int16_t bytes); int16_t type, uint16_t bytes);
static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock) { static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock) {
SQLFunctionCtx* pCtx = pTableScanInfo->pCtx; SQLFunctionCtx* pCtx = pTableScanInfo->pCtx;
...@@ -3732,7 +3732,7 @@ int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) { ...@@ -3732,7 +3732,7 @@ int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) {
* e.g.,tag information into input buffer * e.g.,tag information into input buffer
*/ */
static void doSetTagValueInParam(void* pTable, char* param, int32_t paramLen, int32_t tagColId, tVariant* tag, static void doSetTagValueInParam(void* pTable, char* param, int32_t paramLen, int32_t tagColId, tVariant* tag,
int16_t type, int16_t bytes) { int16_t type, uint16_t bytes) {
tVariantDestroy(tag); tVariantDestroy(tag);
char* val = NULL; char* val = NULL;
...@@ -8580,7 +8580,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) { ...@@ -8580,7 +8580,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
count = 0; count = 0;
int16_t bytes = pExprInfo->base.resBytes; uint16_t bytes = pExprInfo->base.resBytes;
int16_t type = pExprInfo->base.resType; int16_t type = pExprInfo->base.resType;
for (int32_t i = 0; i < pQueryAttr->numOfTags; ++i) { for (int32_t i = 0; i < pQueryAttr->numOfTags; ++i) {
...@@ -8654,7 +8654,8 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) { ...@@ -8654,7 +8654,8 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
STableQueryInfo* item = taosArrayGetP(pa, i); STableQueryInfo* item = taosArrayGetP(pa, i);
char * data = NULL, *dst = NULL; char * data = NULL, *dst = NULL;
int16_t type = 0, bytes = 0; int16_t type = 0;
uint16_t bytes = 0;
for (int32_t j = 0; j < pOperator->numOfOutput; ++j) { for (int32_t j = 0; j < pOperator->numOfOutput; ++j) {
// not assign value in case of user defined constant output column // not assign value in case of user defined constant output column
if (TSDB_COL_IS_UD_COL(pExprInfo[j].base.colInfo.flag)) { if (TSDB_COL_IS_UD_COL(pExprInfo[j].base.colInfo.flag)) {
...@@ -9359,7 +9360,7 @@ int32_t convertQueryMsg(SQueryTableMsg* pQueryMsg, SQueryParam* param) { ...@@ -9359,7 +9360,7 @@ int32_t convertQueryMsg(SQueryTableMsg* pQueryMsg, SQueryParam* param) {
param->pUdfInfo->resType = *(int8_t*)pMsg; param->pUdfInfo->resType = *(int8_t*)pMsg;
pMsg += sizeof(int8_t); pMsg += sizeof(int8_t);
param->pUdfInfo->resBytes = htons(*(int16_t*)pMsg); param->pUdfInfo->resBytes = htons(*(uint16_t*)pMsg);
pMsg += sizeof(int16_t); pMsg += sizeof(int16_t);
tstr* name = (tstr*)(pMsg); tstr* name = (tstr*)(pMsg);
......
...@@ -210,7 +210,7 @@ void taosLoadScriptDestroy(void *pInit) { ...@@ -210,7 +210,7 @@ void taosLoadScriptDestroy(void *pInit) {
destroyScriptCtx(pInit); destroyScriptCtx(pInit);
} }
ScriptCtx* createScriptCtx(char *script, int8_t resType, int16_t resBytes) { ScriptCtx* createScriptCtx(char *script, int8_t resType, uint16_t resBytes) {
ScriptCtx *pCtx = (ScriptCtx *)calloc(1, sizeof(ScriptCtx)); ScriptCtx *pCtx = (ScriptCtx *)calloc(1, sizeof(ScriptCtx));
pCtx->state = SCRIPT_STATE_INIT; pCtx->state = SCRIPT_STATE_INIT;
pCtx->pEnv = getScriptEnvFromPool(); // pCtx->pEnv = getScriptEnvFromPool(); //
......
...@@ -1373,7 +1373,7 @@ static int tsdbEncodeTableName(void **buf, tstr *name) { ...@@ -1373,7 +1373,7 @@ static int tsdbEncodeTableName(void **buf, tstr *name) {
} }
static void *tsdbDecodeTableName(void *buf, tstr **name) { static void *tsdbDecodeTableName(void *buf, tstr **name) {
VarDataLenT len = 0; int16_t len = 0;
buf = taosDecodeFixedI16(buf, &len); buf = taosDecodeFixedI16(buf, &len);
*name = calloc(1, sizeof(tstr) + len + 1); *name = calloc(1, sizeof(tstr) + len + 1);
......
...@@ -1866,11 +1866,11 @@ static int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t c ...@@ -1866,11 +1866,11 @@ static int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t c
static void mergeTwoRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity, int32_t numOfRows, static void mergeTwoRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity, int32_t numOfRows,
SMemRow row1, SMemRow row2, int32_t numOfCols, STable* pTable, SMemRow row1, SMemRow row2, int32_t numOfCols, STable* pTable,
STSchema* pSchema1, STSchema* pSchema2, bool forceSetNull) { STSchema* pSchema1, STSchema* pSchema2, bool forceSetNull) {
char* pData = NULL; char* pData = NULL;
STSchema* pSchema; STSchema* pSchema;
SMemRow row; SMemRow row;
int16_t colId; int16_t colId;
int16_t offset; uint16_t offset;
bool isRow1DataRow = isDataRow(row1); bool isRow1DataRow = isDataRow(row1);
bool isRow2DataRow = false; bool isRow2DataRow = false;
...@@ -4593,7 +4593,7 @@ static int32_t tsdbQueryTableList(STable* pTable, SArray* pRes, void* filterInfo ...@@ -4593,7 +4593,7 @@ static int32_t tsdbQueryTableList(STable* pTable, SArray* pRes, void* filterInfo
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* dst, int16_t bytes){ void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* dst, uint16_t bytes){
char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN] = {0}; char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN] = {0};
jsonKeyMd5(key, keyLen, keyMd5); jsonKeyMd5(key, keyLen, keyMd5);
...@@ -4625,7 +4625,7 @@ void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* dst, in ...@@ -4625,7 +4625,7 @@ void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* dst, in
return result; return result;
} }
void getJsonTagValueAll(void* data, void* dst, int16_t bytes) { void getJsonTagValueAll(void* data, void* dst, uint16_t bytes) {
char* json = parseTagDatatoJson(data); char* json = parseTagDatatoJson(data);
char* tagData = POINTER_SHIFT(dst, CHAR_BYTES); char* tagData = POINTER_SHIFT(dst, CHAR_BYTES);
*(char*)dst = TSDB_DATA_TYPE_JSON; *(char*)dst = TSDB_DATA_TYPE_JSON;
......
...@@ -121,10 +121,10 @@ static int print_result(TAOS_RES* res, int32_t rows) { ...@@ -121,10 +121,10 @@ static int print_result(TAOS_RES* res, int32_t rows) {
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
int32_t charLen = *(int16_t *)col[i]; int32_t charLen = *(uint16_t *)col[i];
int32_t charBytes = (fields[i].type == TSDB_DATA_TYPE_BINARY) ? sizeof(char) : sizeof(wchar_t); int32_t charBytes = (fields[i].type == TSDB_DATA_TYPE_BINARY) ? sizeof(char) : sizeof(wchar_t);
int32_t offset = k * (sizeof(int16_t) + fields[i].bytes * charBytes); int32_t offset = k * (sizeof(uint16_t) + fields[i].bytes * charBytes);
memcpy(str + len, (char *)col[i] + sizeof(int16_t) + offset, charLen); memcpy(str + len, (char *)col[i] + sizeof(uint16_t) + offset, charLen);
len += charLen; len += charLen;
} break; } break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册