fix:error in schemaless

This commit is contained in:
wangmm0220 2022-07-16 16:11:16 +08:00
parent 3417cf469c
commit 887cca3aa8
2 changed files with 27 additions and 1 deletions

View File

@ -609,7 +609,7 @@ static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) {
}
kvVal->type = TSDB_DATA_TYPE_BIGINT;
kvVal->i = (int64_t)result;
} else if ((left == 3 && strncasecmp(endptr, "u64", left) == 0)) {
} else if ((left == 1 && *endptr == 'u') || (left == 3 && strncasecmp(endptr, "u64", left) == 0)) {
if (result >= (double)UINT64_MAX || result < 0) {
errno = 0;
uint64_t tmp = taosStr2UInt64(pVal, &endptr, 10);

View File

@ -499,6 +499,32 @@ TEST(testCase, smlGetTimestampLen_Test) {
ASSERT_EQ(len, 3);
}
TEST(testCase, smlParseNumber_Test) {
SSmlKv kv = {0};
char buf[64] = {0};
SSmlMsgBuf msg = {0};
msg.buf = buf;
msg.len = 64;
kv.value = "3.2e-900";
kv.length = 8;
bool res = smlParseNumber(&kv, &msg);
printf("res:%d,v:%f, %f\n", res,kv.d, HUGE_VAL);
}
//#include <stdlib.h>
//TEST(testCase, number_Test) {
// char *str[] = {
//// "-000 0999",
// "- abc",
// };
// for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){
// errno = 0;
// char *end = NULL;
// long result = strtol(str[i], &end, 10);
// printf("errno:%d,len:%d,result:%ld\n", errno, end - str[i], result);
// }
//
//}
/*
TEST(testCase, smlProcess_influx_Test) {
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);