code optimization and give the same hint when exceed max columns
This commit is contained in:
parent
0063cb84e2
commit
2f271fa684
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue