update
This commit is contained in:
parent
1f554061e1
commit
fa4f529795
|
@ -175,38 +175,6 @@ static FORCE_INLINE void tscGetMemRowAppendInfo(SSchema *pSchema, uint8_t memRow
|
||||||
*colId = pSchema[schemaIdx].colId;
|
*colId = pSchema[schemaIdx].colId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Applicable to consume by multi-columns
|
|
||||||
*
|
|
||||||
* @param row
|
|
||||||
* @param value
|
|
||||||
* @param isCopyVarData In some scenario, the varVal is copied to row directly before calling tdAppend***ColVal()
|
|
||||||
* @param colId
|
|
||||||
* @param colType
|
|
||||||
* @param idx index in SSchema
|
|
||||||
* @param pBuilder
|
|
||||||
* @param spd
|
|
||||||
* @return FORCE_INLINE
|
|
||||||
*/
|
|
||||||
static FORCE_INLINE void tscAppendMemRowColVal(SMemRow row, const void *value, bool isCopyVarData, int16_t colId,
|
|
||||||
int8_t colType, int32_t toffset, SMemRowBuilder *pBuilder,
|
|
||||||
int32_t rowNum) {
|
|
||||||
tdAppendMemRowColVal(row, value, isCopyVarData, colId, colType, toffset);
|
|
||||||
if (pBuilder->compareStat == ROW_COMPARE_NEED) {
|
|
||||||
SMemRowInfo *pRowInfo = pBuilder->rowInfo + rowNum;
|
|
||||||
tdGetColAppendDeltaLen(value, colType, &pRowInfo->dataLen, &pRowInfo->kvLen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Applicable to consume by one row
|
|
||||||
static FORCE_INLINE void tscAppendMemRowColVal(SMemRow row, const void *value, bool isCopyVarData, int16_t colId,
|
|
||||||
int8_t colType, int32_t toffset, int32_t *dataLen, int32_t *kvLen,
|
|
||||||
uint8_t compareStat) {
|
|
||||||
tdAppendMemRowColVal(row, value, isCopyVarData, colId, colType, toffset);
|
|
||||||
if (compareStat == ROW_COMPARE_NEED) {
|
|
||||||
tdGetColAppendDeltaLen(value, colType, dataLen, kvLen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
typedef struct STableDataBlocks {
|
typedef struct STableDataBlocks {
|
||||||
SName tableName;
|
SName tableName;
|
||||||
int8_t tsSource; // where does the UNIX timestamp come from, server or client
|
int8_t tsSource; // where does the UNIX timestamp come from, server or client
|
||||||
|
@ -624,22 +592,22 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
switch (pSchema->type) {
|
switch (pSchema->type) {
|
||||||
case TSDB_DATA_TYPE_BOOL: { // bool
|
case TSDB_DATA_TYPE_BOOL: { // bool
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
if ((pToken->type == TK_BOOL || pToken->type == TK_STRING) && (pToken->n != 0)) {
|
if ((pToken->type == TK_BOOL || pToken->type == TK_STRING) && (pToken->n != 0)) {
|
||||||
if (strncmp(pToken->z, "true", pToken->n) == 0) {
|
if (strncmp(pToken->z, "true", pToken->n) == 0) {
|
||||||
tscAppendMemRowColVal(row, &TRUE_VALUE, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &TRUE_VALUE, true, colId, pSchema->type, toffset);
|
||||||
} else if (strncmp(pToken->z, "false", pToken->n) == 0) {
|
} else if (strncmp(pToken->z, "false", pToken->n) == 0) {
|
||||||
tscAppendMemRowColVal(row, &FALSE_VALUE, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &FALSE_VALUE, true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
return tscSQLSyntaxErrMsg(msg, "invalid bool data", pToken->z);
|
return tscSQLSyntaxErrMsg(msg, "invalid bool data", pToken->z);
|
||||||
}
|
}
|
||||||
} else if (pToken->type == TK_INTEGER) {
|
} else if (pToken->type == TK_INTEGER) {
|
||||||
iv = strtoll(pToken->z, NULL, 10);
|
iv = strtoll(pToken->z, NULL, 10);
|
||||||
tscAppendMemRowColVal(row, ((iv == 0) ? &FALSE_VALUE : &TRUE_VALUE), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, ((iv == 0) ? &FALSE_VALUE : &TRUE_VALUE), true, colId, pSchema->type, toffset);
|
||||||
} else if (pToken->type == TK_FLOAT) {
|
} else if (pToken->type == TK_FLOAT) {
|
||||||
double dv = strtod(pToken->z, NULL);
|
double dv = strtod(pToken->z, NULL);
|
||||||
tscAppendMemRowColVal(row, ((dv == 0) ? &FALSE_VALUE : &TRUE_VALUE), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, ((dv == 0) ? &FALSE_VALUE : &TRUE_VALUE), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
return tscInvalidOperationMsg(msg, "invalid bool data", pToken->z);
|
return tscInvalidOperationMsg(msg, "invalid bool data", pToken->z);
|
||||||
}
|
}
|
||||||
|
@ -649,7 +617,7 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -659,14 +627,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t tmpVal = (uint8_t)iv;
|
uint8_t tmpVal = (uint8_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_UTINYINT:
|
case TSDB_DATA_TYPE_UTINYINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -676,14 +644,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t tmpVal = (uint8_t)iv;
|
uint8_t tmpVal = (uint8_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_SMALLINT:
|
case TSDB_DATA_TYPE_SMALLINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -693,14 +661,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t tmpVal = (int16_t)iv;
|
int16_t tmpVal = (int16_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_USMALLINT:
|
case TSDB_DATA_TYPE_USMALLINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -710,14 +678,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t tmpVal = (uint16_t)iv;
|
uint16_t tmpVal = (uint16_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_INT:
|
case TSDB_DATA_TYPE_INT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -727,14 +695,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tmpVal = (int32_t)iv;
|
int32_t tmpVal = (int32_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_UINT:
|
case TSDB_DATA_TYPE_UINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -744,14 +712,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tmpVal = (uint32_t)iv;
|
uint32_t tmpVal = (uint32_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -760,13 +728,13 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
return tscInvalidOperationMsg(msg, "bigint data overflow", pToken->z);
|
return tscInvalidOperationMsg(msg, "bigint data overflow", pToken->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
tscAppendMemRowColVal(row, &iv, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &iv, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_UBIGINT:
|
case TSDB_DATA_TYPE_UBIGINT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -776,13 +744,13 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t tmpVal = (uint64_t)iv;
|
uint64_t tmpVal = (uint64_t)iv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
double dv;
|
double dv;
|
||||||
if (TK_ILLEGAL == tscToDouble(pToken, &dv, &endptr)) {
|
if (TK_ILLEGAL == tscToDouble(pToken, &dv, &endptr)) {
|
||||||
|
@ -795,13 +763,13 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
}
|
}
|
||||||
|
|
||||||
float tmpVal = (float)dv;
|
float tmpVal = (float)dv;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
if (isNullStr(pToken)) {
|
if (isNullStr(pToken)) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
double dv;
|
double dv;
|
||||||
if (TK_ILLEGAL == tscToDouble(pToken, &dv, &endptr)) {
|
if (TK_ILLEGAL == tscToDouble(pToken, &dv, &endptr)) {
|
||||||
|
@ -812,14 +780,14 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
return tscInvalidOperationMsg(msg, "illegal double data", pToken->z);
|
return tscInvalidOperationMsg(msg, "illegal double data", pToken->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
tscAppendMemRowColVal(row, &dv, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &dv, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
// binary data cannot be null-terminated char string, otherwise the last char of the string is lost
|
// binary data cannot be null-terminated char string, otherwise the last char of the string is lost
|
||||||
if (pToken->type == TK_NULL) {
|
if (pToken->type == TK_NULL) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else { // too long values will return invalid sql, not be truncated automatically
|
} else { // too long values will return invalid sql, not be truncated automatically
|
||||||
if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { // todo refactor
|
if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { // todo refactor
|
||||||
return tscInvalidOperationMsg(msg, "string data overflow", pToken->z);
|
return tscInvalidOperationMsg(msg, "string data overflow", pToken->z);
|
||||||
|
@ -827,13 +795,13 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
// STR_WITH_SIZE_TO_VARSTR(payload, pToken->z, pToken->n);
|
// STR_WITH_SIZE_TO_VARSTR(payload, pToken->z, pToken->n);
|
||||||
char *rowEnd = memRowEnd(row);
|
char *rowEnd = memRowEnd(row);
|
||||||
STR_WITH_SIZE_TO_VARSTR(rowEnd, pToken->z, pToken->n);
|
STR_WITH_SIZE_TO_VARSTR(rowEnd, pToken->z, pToken->n);
|
||||||
tscAppendMemRowColVal(row, rowEnd, false, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, rowEnd, false, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_NCHAR:
|
case TSDB_DATA_TYPE_NCHAR:
|
||||||
if (pToken->type == TK_NULL) {
|
if (pToken->type == TK_NULL) {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
|
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
|
||||||
int32_t output = 0;
|
int32_t output = 0;
|
||||||
|
@ -845,7 +813,7 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
return tscInvalidOperationMsg(msg, buf, pToken->z);
|
return tscInvalidOperationMsg(msg, buf, pToken->z);
|
||||||
}
|
}
|
||||||
varDataSetLen(rowEnd, output);
|
varDataSetLen(rowEnd, output);
|
||||||
tscAppendMemRowColVal(row, rowEnd, false, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, rowEnd, false, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -854,16 +822,16 @@ static FORCE_INLINE int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pTok
|
||||||
if (primaryKey) {
|
if (primaryKey) {
|
||||||
// When building SKVRow primaryKey, we should not skip even with NULL value.
|
// When building SKVRow primaryKey, we should not skip even with NULL value.
|
||||||
int64_t tmpVal = 0;
|
int64_t tmpVal = 0;
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
} else {
|
} else {
|
||||||
tscAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, getNullValue(pSchema->type), true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int64_t tmpVal;
|
int64_t tmpVal;
|
||||||
if (tsParseTime(pToken, &tmpVal, str, msg, timePrec) != TSDB_CODE_SUCCESS) {
|
if (tsParseTime(pToken, &tmpVal, str, msg, timePrec) != TSDB_CODE_SUCCESS) {
|
||||||
return tscInvalidOperationMsg(msg, "invalid timestamp", pToken->z);
|
return tscInvalidOperationMsg(msg, "invalid timestamp", pToken->z);
|
||||||
}
|
}
|
||||||
tscAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
tdAppendMemRowColVal(row, &tmpVal, true, colId, pSchema->type, toffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -573,7 +573,7 @@ static FORCE_INLINE int tdAddColToKVRow(SKVRowBuilder *pBuilder, int16_t colId,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------- SRow appended with tuple row structure
|
// ----------------- SMemRow appended with tuple row structure
|
||||||
/*
|
/*
|
||||||
* |---------|------------------------------------------------- len ---------------------------------->|
|
* |---------|------------------------------------------------- len ---------------------------------->|
|
||||||
* |<-------- Head ------>|<--------- flen -------------->| |
|
* |<-------- Head ------>|<--------- flen -------------->| |
|
||||||
|
@ -586,7 +586,7 @@ static FORCE_INLINE int tdAddColToKVRow(SKVRowBuilder *pBuilder, int16_t colId,
|
||||||
* NOTE: timestamp in this row structure is TKEY instead of TSKEY
|
* NOTE: timestamp in this row structure is TKEY instead of TSKEY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ----------------- SRow appended with extended K-V data row structure
|
// ----------------- SMemRow appended with extended K-V data row structure
|
||||||
/* |--------------------|------------------------------------------------ len ---------------------------------->|
|
/* |--------------------|------------------------------------------------ len ---------------------------------->|
|
||||||
* |<------------- Head ------------>|<--------- flen -------------->| |
|
* |<------------- Head ------------>|<--------- flen -------------->| |
|
||||||
* |--------------------+----------+--------------------------------------------+---------------------------------+
|
* |--------------------+----------+--------------------------------------------+---------------------------------+
|
||||||
|
|
|
@ -113,16 +113,6 @@ static FORCE_INLINE int32_t getExtendedRowSize(STableDataBlocks *pBlock) {
|
||||||
return pBlock->rowSize + TD_MEM_ROW_DATA_HEAD_SIZE + pBlock->boundColumnInfo.extendedVarLen;
|
return pBlock->rowSize + TD_MEM_ROW_DATA_HEAD_SIZE + pBlock->boundColumnInfo.extendedVarLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applicable to consume by one row
|
|
||||||
static FORCE_INLINE void appendMemRowColValEx(SMemRow row, const void *value, bool isCopyVarData, int16_t colId,
|
|
||||||
int8_t colType, int32_t toffset, int32_t *dataLen, int32_t *kvLen,
|
|
||||||
uint8_t compareStat) {
|
|
||||||
tdAppendMemRowColVal(row, value, isCopyVarData, colId, colType, toffset);
|
|
||||||
if (compareStat == ROW_COMPARE_NEED) {
|
|
||||||
tdGetColAppendDeltaLen(value, colType, dataLen, kvLen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void getMemRowAppendInfo(SSchema *pSchema, uint8_t memRowType, SParsedDataColInfo *spd,
|
static FORCE_INLINE void getMemRowAppendInfo(SSchema *pSchema, uint8_t memRowType, SParsedDataColInfo *spd,
|
||||||
int32_t idx, int32_t *toffset) {
|
int32_t idx, int32_t *toffset) {
|
||||||
int32_t schemaIdx = 0;
|
int32_t schemaIdx = 0;
|
||||||
|
|
|
@ -272,7 +272,7 @@ static FORCE_INLINE int32_t MemRowAppend(const void *value, int32_t len, void *p
|
||||||
if (TSDB_DATA_TYPE_BINARY == pa->schema->type) {
|
if (TSDB_DATA_TYPE_BINARY == pa->schema->type) {
|
||||||
char *rowEnd = memRowEnd(pa->row);
|
char *rowEnd = memRowEnd(pa->row);
|
||||||
STR_WITH_SIZE_TO_VARSTR(rowEnd, value, len);
|
STR_WITH_SIZE_TO_VARSTR(rowEnd, value, len);
|
||||||
appendMemRowColValEx(pa->row, rowEnd, true, pa->schema->colId, pa->schema->type, pa->toffset, &pa->dataLen, &pa->kvLen, pa->compareStat);
|
tdAppendMemRowColVal(pa->row, rowEnd, true, pa->schema->colId, pa->schema->type, pa->toffset);
|
||||||
} else if (TSDB_DATA_TYPE_NCHAR == pa->schema->type) {
|
} else if (TSDB_DATA_TYPE_NCHAR == pa->schema->type) {
|
||||||
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
|
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
|
||||||
int32_t output = 0;
|
int32_t output = 0;
|
||||||
|
@ -281,9 +281,9 @@ static FORCE_INLINE int32_t MemRowAppend(const void *value, int32_t len, void *p
|
||||||
return TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
|
return TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
varDataSetLen(rowEnd, output);
|
varDataSetLen(rowEnd, output);
|
||||||
appendMemRowColValEx(pa->row, rowEnd, false, pa->schema->colId, pa->schema->type, pa->toffset, &pa->dataLen, &pa->kvLen, pa->compareStat);
|
tdAppendMemRowColVal(pa->row, rowEnd, false, pa->schema->colId, pa->schema->type, pa->toffset);
|
||||||
} else {
|
} else {
|
||||||
appendMemRowColValEx(pa->row, value, true, pa->schema->colId, pa->schema->type, pa->toffset, &pa->dataLen, &pa->kvLen, pa->compareStat);
|
tdAppendMemRowColVal(pa->row, value, true, pa->schema->colId, pa->schema->type, pa->toffset);
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue