Merge pull request #20717 from taosdata/fix/TS-3039
fix:int64 parse error in schemaless
This commit is contained in:
commit
3fdbc8c30c
|
@ -257,19 +257,14 @@ cleanup:
|
||||||
kvVal->f = (float)result;
|
kvVal->f = (float)result;
|
||||||
|
|
||||||
#define SET_BIGINT \
|
#define SET_BIGINT \
|
||||||
if (smlDoubleToInt64OverFlow(result)) { \
|
errno = 0; \
|
||||||
errno = 0; \
|
int64_t tmp = taosStr2Int64(pVal, &endptr, 10); \
|
||||||
int64_t tmp = taosStr2Int64(pVal, &endptr, 10); \
|
if (errno == ERANGE) { \
|
||||||
if (errno == ERANGE) { \
|
smlBuildInvalidDataMsg(msg, "big int out of range[-9223372036854775808,9223372036854775807]", pVal); \
|
||||||
smlBuildInvalidDataMsg(msg, "big int out of range[-9223372036854775808,9223372036854775807]", pVal); \
|
return false; \
|
||||||
return false; \
|
} \
|
||||||
} \
|
kvVal->type = TSDB_DATA_TYPE_BIGINT; \
|
||||||
kvVal->type = TSDB_DATA_TYPE_BIGINT; \
|
kvVal->i = tmp;
|
||||||
kvVal->i = tmp; \
|
|
||||||
return true; \
|
|
||||||
} \
|
|
||||||
kvVal->type = TSDB_DATA_TYPE_BIGINT; \
|
|
||||||
kvVal->i = (int64_t)result;
|
|
||||||
|
|
||||||
#define SET_INT \
|
#define SET_INT \
|
||||||
if (!IS_VALID_INT(result)) { \
|
if (!IS_VALID_INT(result)) { \
|
||||||
|
@ -288,19 +283,14 @@ cleanup:
|
||||||
kvVal->i = result;
|
kvVal->i = result;
|
||||||
|
|
||||||
#define SET_UBIGINT \
|
#define SET_UBIGINT \
|
||||||
if (result >= (double)UINT64_MAX || result < 0) { \
|
errno = 0; \
|
||||||
errno = 0; \
|
uint64_t tmp = taosStr2UInt64(pVal, &endptr, 10); \
|
||||||
uint64_t tmp = taosStr2UInt64(pVal, &endptr, 10); \
|
if (errno == ERANGE || result < 0) { \
|
||||||
if (errno == ERANGE || result < 0) { \
|
smlBuildInvalidDataMsg(msg, "unsigned big int out of range[0,18446744073709551615]", pVal); \
|
||||||
smlBuildInvalidDataMsg(msg, "unsigned big int out of range[0,18446744073709551615]", pVal); \
|
return false; \
|
||||||
return false; \
|
} \
|
||||||
} \
|
kvVal->type = TSDB_DATA_TYPE_UBIGINT; \
|
||||||
kvVal->type = TSDB_DATA_TYPE_UBIGINT; \
|
kvVal->u = tmp;
|
||||||
kvVal->u = tmp; \
|
|
||||||
return true; \
|
|
||||||
} \
|
|
||||||
kvVal->type = TSDB_DATA_TYPE_UBIGINT; \
|
|
||||||
kvVal->u = result;
|
|
||||||
|
|
||||||
#define SET_UINT \
|
#define SET_UINT \
|
||||||
if (!IS_VALID_UINT(result)) { \
|
if (!IS_VALID_UINT(result)) { \
|
||||||
|
|
|
@ -850,7 +850,7 @@ int smlProcess_18784_Test() {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
const char *sql[] = {
|
const char *sql[] = {
|
||||||
"disk,device=sdc inodes_used=176059i,total=1081101176832i 1661943960000000000",
|
"disk,device=sdc inodes_used=176059i,total=1076048383523889174i 1661943960000000000",
|
||||||
"disk,device=sdc inodes_free=66932805i 1661943960000000000",
|
"disk,device=sdc inodes_free=66932805i 1661943960000000000",
|
||||||
};
|
};
|
||||||
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0);
|
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0);
|
||||||
|
@ -875,7 +875,7 @@ int smlProcess_18784_Test() {
|
||||||
if (rowIndex == 0) {
|
if (rowIndex == 0) {
|
||||||
ASSERT(ts == 1661943960000);
|
ASSERT(ts == 1661943960000);
|
||||||
ASSERT(used == 176059);
|
ASSERT(used == 176059);
|
||||||
ASSERT(total == 1081101176832);
|
ASSERT(total == 1076048383523889174);
|
||||||
ASSERT(freed == 66932805);
|
ASSERT(freed == 66932805);
|
||||||
// ASSERT_EQ(latitude, 24.5208);
|
// ASSERT_EQ(latitude, 24.5208);
|
||||||
// ASSERT_EQ(longitude, 28.09377);
|
// ASSERT_EQ(longitude, 28.09377);
|
||||||
|
|
Loading…
Reference in New Issue