diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index c23ca2bc98b9790842b0b2a0a910aae5ffe57817..d60c6756d68ad2bc5d6cba0a0ea3e97beb5cdd25 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -41,8 +41,6 @@ extern "C" { // forward declaration struct SSqlInfo; -#define KvRowNColsThresh 128 // default 128 - typedef void (*__async_cb_func_t)(void *param, TAOS_RES *tres, int32_t numOfRows); typedef struct SNewVgroupInfo { @@ -111,7 +109,7 @@ typedef struct SParsedDataColInfo { int8_t orderStatus; // bounded columns: } SParsedDataColInfo; -#define IS_DATA_COL_ORDERED(s) (((s)->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) +#define IS_DATA_COL_ORDERED(s) ((s) == (int8_t)ORDER_STATUS_ORDERED) typedef struct { SSchema * pSchema; diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index bfebed6676574547a72f64330272dc601236562a..b6062b5ad201e3e628b1c14935434eab5a36912e 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -406,7 +406,6 @@ static FORCE_INLINE TDRowLenT tsSetPayloadColValue(char *payloadStart, char *pay payloadColSetId(payload, columnId); payloadColSetType(payload, columnType); memcpy(POINTER_SHIFT(payloadStart,tOffset), value, valueLen); - // payloadSetTLen(payloadStart, payloadTLen(payloadStart) + valueLen); return valueLen; } @@ -867,7 +866,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i TDRowLenT kvRowColLen = 0; TDRowLenT colValAppended = 0; - if (!IS_DATA_COL_ORDERED(spd)) { + if (!IS_DATA_COL_ORDERED(spd->orderStatus)) { ASSERT(spd->colIdxInfo != NULL); if(!isPrimaryKey) { kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN); @@ -891,7 +890,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i payloadColSetOffset(kvPrimaryKeyStart, colValOffset); } else { payloadColSetOffset(kvStart, colValOffset); - if (spd->orderStatus == ORDER_STATUS_ORDERED) { + if (IS_DATA_COL_ORDERED(spd->orderStatus)) { kvStart += PAYLOAD_COL_HEAD_LEN; // move to next column } } @@ -910,10 +909,6 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i *len = (int32_t)(payloadValOffset + colValOffset); payloadSetTLen(payload, *len); - // TSKEY tsKey = payloadKey(payload); - // ASSERT((tsKey < 1627747200000000 && tsKey > 1498838400000000) || (tsKey < 1627747200000 && tsKey > 1498838400000) || - // (tsKey < 1627747200 && tsKey > 1498838400)); - return TSDB_CODE_SUCCESS; } diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 0eb1eaa12fd2d8b0e05ce2dd3600c3575b93e600..36c10f6cd5ecfa1d04a0469e7f1b9c66e5eba05f 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -370,7 +370,7 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) { bool isPrimaryKey = (colIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX); // the primary key locates in 1st column - if (!IS_DATA_COL_ORDERED(spd)) { + if (!IS_DATA_COL_ORDERED(spd->orderStatus)) { ASSERT(spd->colIdxInfo != NULL); if (!isPrimaryKey) { kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN); @@ -406,7 +406,7 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) { kvRowLen += TYPE_BYTES[pSchema->type]; } - if (IS_DATA_COL_ORDERED(spd)) { + if (IS_DATA_COL_ORDERED(spd->orderStatus)) { kvStart += PAYLOAD_COL_HEAD_LEN; // move to next column } } @@ -425,12 +425,6 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) { TDRowTLenT len = payloadValOffset + colValOffset; payloadSetTLen(destPayload, len); -#if 0 - TSKEY tsKey = payloadKey(destPayload); - ASSERT((tsKey < 1627747200000000 && tsKey > 1498838400000000) || (tsKey < 1627747200000 && tsKey > 1498838400000) || - (tsKey < 1627747200 && tsKey > 1498838400)); -#endif - // next loop srcPayload += pBlock->rowSize; destPayload += len; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index d9ad830214950da7de2c680750a32b9dfa17c27e..13fd9a8092642a2b727f61e56e35572ee3ebdb0e 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1245,12 +1245,16 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) { const char* msg4 = "invalid data type"; const char* msg5 = "invalid binary/nchar column length"; const char* msg6 = "invalid column name"; + const char* msg7 = "too many columns"; // number of fields no less than 2 size_t numOfCols = taosArrayGetSize(pFieldList); - if (numOfCols <= 1 || numOfCols > TSDB_MAX_COLUMNS) { + if (numOfCols <= 1 ) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); return false; + } else if (numOfCols > TSDB_MAX_COLUMNS) { + invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); + return false; } // first column must be timestamp diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 7c6b3bbed91dd5a8cca8d6670a848ada7d55a42f..f5be879878f5384dc6805fa4c2be6de77f243a90 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -198,7 +198,7 @@ do { \ /** * In some scenarios uint16_t (0~65535) is used to store the row len. * - Firstly, we use 65531(65535 - 4), as the SDataRow and SKVRow including 4 bits header. - * - Secondly, if all cols are VarType 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. */ #define TSDB_MAX_BYTES_PER_ROW 49151