diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index 193ce5bab71bd403dd72e605e64cd5c15ce18226..7d1d420db019556e472a924714302a3d27dfbc33 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -121,7 +121,7 @@ typedef struct { int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version); void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder); void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version); -int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int16_t bytes); +int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, uint16_t bytes); STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder); // ----------------- Semantic timestamp key definition @@ -262,9 +262,9 @@ static FORCE_INLINE bool tdIsColOfRowNullBySchema(SDataRow row, STSchema *pSchem } static FORCE_INLINE void tdSetColOfRowNullBySchema(SDataRow row, STSchema *pSchema, int idx) { - int16_t offset = TD_DATA_ROW_HEAD_SIZE + pSchema->columns[idx].offset; - int8_t type = pSchema->columns[idx].type; - int16_t bytes = pSchema->columns[idx].bytes; + uint16_t offset = TD_DATA_ROW_HEAD_SIZE + pSchema->columns[idx].offset; + int8_t type = pSchema->columns[idx].type; + uint16_t bytes = pSchema->columns[idx].bytes; setNull(tdGetRowDataOfCol(row, type, offset), type, bytes); } diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 4786700f97ab488e33df81810f3f061b5bb67111..3f4e13e341fd5497304a3c7616d45121b3a656ca 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -91,12 +91,12 @@ void *tdDecodeSchema(void *buf, STSchema **pRSchema) { if (tdInitTSchemaBuilder(&schemaBuilder, version) < 0) return NULL; for (int i = 0; i < numOfCols; i++) { - int8_t type = 0; - int16_t colId = 0; - int16_t bytes = 0; + int8_t type = 0; + int16_t colId = 0; + uint16_t bytes = 0; buf = taosDecodeFixedI8(buf, &type); buf = taosDecodeFixedI16(buf, &colId); - buf = taosDecodeFixedI16(buf, &bytes); + buf = taosDecodeFixedU16(buf, &bytes); if (tdAddColToSchema(&schemaBuilder, type, colId, bytes) < 0) { tdDestroyTSchemaBuilder(&schemaBuilder); return NULL; @@ -133,7 +133,7 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version) { pBuilder->version = version; } -int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int16_t bytes) { +int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, uint16_t bytes) { if (!isValidDataType(type)) return -1; if (pBuilder->nCols >= pBuilder->tCols) { diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 72b303bb14f8302ced115fa03af1367834846154..3020e9f52bc00d658f18725cc50fda97f3a19d6c 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -384,7 +384,7 @@ static uint8_t UNUSED_FUNC isQueryOnPrimaryKey(const char *primaryColumnName, co } } -static void reverseCopy(char* dest, const char* src, int16_t type, int32_t numOfRows, int16_t colSize) { +static void reverseCopy(char* dest, const char* src, int16_t type, int32_t numOfRows, uint16_t colSize) { switch(type) { case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_UTINYINT:{ @@ -2054,7 +2054,7 @@ void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, int32_t numInpu } } -void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t OutputType, int16_t outputBytes, char *output) { +void castConvert(int16_t inputType, uint16_t inputBytes, char *input, int16_t OutputType, uint16_t outputBytes, char *output) { switch (OutputType) { case TSDB_DATA_TYPE_BIGINT: if (inputType == TSDB_DATA_TYPE_BINARY) { diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 7653df3879db6596accad6fd46f8734110960c2f..ef79d334a2480bd7b6bf55f3bb8aa92ceb1e1772 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -39,7 +39,7 @@ SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const s.type = pVal->nType; if (s.type == TSDB_DATA_TYPE_BINARY || s.type == TSDB_DATA_TYPE_NCHAR) { - s.bytes = (int16_t)(pVal->nLen + VARSTR_HEADER_SIZE); + s.bytes = (uint16_t)(pVal->nLen + VARSTR_HEADER_SIZE); } else { s.bytes = tDataTypes[pVal->nType].bytes; } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 90fb1970b8fd5dd7e3143ca60de8de9981a3334f..57cbc2301ccf7ac197bc826bd6cddf294ec68098 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -335,18 +335,18 @@ typedef struct { } SAlterTableMsg; typedef struct { - SMsgHead head; - int8_t extend; - int64_t uid; - int32_t tid; - int16_t tversion; - int16_t colId; - int8_t type; - int16_t bytes; - int32_t tagValLen; - int16_t numOfTags; - int32_t schemaLen; - char data[]; + SMsgHead head; + int8_t extend; + int64_t uid; + int32_t tid; + int16_t tversion; + int16_t colId; + int8_t type; + uint16_t bytes; + int32_t tagValLen; + int16_t numOfTags; + int32_t schemaLen; + char data[]; } SUpdateTableTagValMsg; typedef struct { diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 277765351757fcecaffe9ec63e4dbcad9147ee50..9e21dba80b1073f55f18125757436e1fd8b1f5a6 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -872,7 +872,7 @@ static int calcColWidth(TAOS_FIELD* field, int precision) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON:{ - int16_t bytes = field->bytes * TSDB_NCHAR_SIZE; + int32_t bytes = field->bytes * TSDB_NCHAR_SIZE; if (bytes > tsMaxBinaryDisplayWidth) { return MAX(tsMaxBinaryDisplayWidth, width); } else { @@ -1453,7 +1453,7 @@ TAOS_FIELD *wsclient_print_header(cJSON *query, int *pcols, int *pprecison) { for (int i = 0; i < (int)fields_count->valueint; i++) { strncpy(fields[i].name, cJSON_GetArrayItem(fields_names, i)->valuestring, 65); fields[i].type = (uint8_t)cJSON_GetArrayItem(fields_types, i)->valueint; - fields[i].bytes = (int16_t)cJSON_GetArrayItem(fields_lengths, i)->valueint; + fields[i].bytes = (uint16_t)cJSON_GetArrayItem(fields_lengths, i)->valueint; } cJSON *precision = cJSON_GetObjectItem(query, "precision"); if (cJSON_IsNumber(precision)) { @@ -1610,7 +1610,7 @@ void wsclient_query(char *command) { cJSON *lengths = cJSON_GetObjectItem(fetch, "lengths"); if (cJSON_IsArray(lengths)) { for (int i = 0; i < cols; i++) { - fields[i].bytes = (int16_t)(cJSON_GetArrayItem(lengths, i)->valueint); + fields[i].bytes = (uint16_t)(cJSON_GetArrayItem(lengths, i)->valueint); } if (showed_rows < DEFAULT_RES_SHOW_NUM) { if (wsclient_send_sql(NULL, WS_FETCH_BLOCK, (int)id->valueint) == 0) {