From 3fadb431f697e4dab8eddbba525be1b38af3c445 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Sun, 10 Oct 2021 21:42:15 +0800 Subject: [PATCH] [TD-10532]: schemaless fix test cases --- src/client/src/tscParseLineProtocol.c | 11 ++++++++--- tests/examples/c/apitest.c | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index e0ee0f6c52..f8c6348870 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -1408,8 +1408,12 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSml //Default no appendix if (isdigit(pVal[len - 1]) && isdigit(pVal[len - 2])) { - if (info->protocol == SML_LINE_PROTOCOL && info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) { - *tsType = info->tsType; + if (info->protocol == SML_LINE_PROTOCOL) { + if (info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) { + *tsType = info->tsType; + } else { + *tsType = SML_TIME_STAMP_NANO_SECONDS; + } } else if (info->protocol == SML_TELNET_PROTOCOL) { if (len == SML_TIMESTAMP_SECOND_DIGITS) { *tsType = SML_TIME_STAMP_SECONDS; @@ -1421,6 +1425,7 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSml } return true; } + if (pVal[len - 1] == 's') { switch (pVal[len - 2]) { case 'm': @@ -1716,7 +1721,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len, } //No appendix or no timestamp given (len = 0) - if (len >= 1 && isdigit(value[len - 1]) && type != SML_TIME_STAMP_NOW) { + if (len != 0 && type != SML_TIME_STAMP_NOW) { *ts = (int64_t)strtoll(value, NULL, 10); } else { type = SML_TIME_STAMP_NOW; diff --git a/tests/examples/c/apitest.c b/tests/examples/c/apitest.c index 7217de3d55..da846de261 100644 --- a/tests/examples/c/apitest.c +++ b/tests/examples/c/apitest.c @@ -984,7 +984,7 @@ int32_t verify_schema_less(TAOS* taos) { char* lines2[] = { "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", - "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000" + "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833641000000" }; code = taos_schemaless_insert(taos, &lines2[0], 1, 0, "ns"); code = taos_schemaless_insert(taos, &lines2[1], 1, 0, "ns"); @@ -1036,7 +1036,6 @@ int main(int argc, char *argv[]) { printf("************ verify schema-less *************\n"); verify_schema_less(taos); - return 0; printf("************ verify query *************\n"); verify_query(taos); -- GitLab