From 5be0cc7c8483a5f4baebaa1ba3efdc1baab1da5e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 27 Feb 2024 18:07:04 +0800 Subject: [PATCH 1/2] opti:deal with escape in the end of field in schemaless --- source/client/src/clientSmlLine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 8bdbec0f2b..7535cbfd0c 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -485,8 +485,8 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine if (unlikely(IS_SPACE(tmp,escapeChar))) { break; } - if(unlikely(IS_SLASH_LETTER_IN_TAG_FIELD_KEY(sql))){ - escapeChar = sql; + if(unlikely(IS_SLASH_LETTER_IN_TAG_FIELD_KEY(tmp))){ + escapeChar = tmp; } tmp++; } From 828889a6d8ca7ab7dab065db91ef5ca93b9d1963 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 27 Feb 2024 19:16:11 +0800 Subject: [PATCH 2/2] opti:deal with escape in the end of field in schemaless --- utils/test/c/sml_test.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index f81f13fc68..01619decc5 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1079,7 +1079,7 @@ int sml_escape1_Test() { ASSERT(taos_affected_rows(pRes) == 5); taos_free_result(pRes); - pRes = taos_query(taos, "select * from stab order by _ts"); //check stable name + pRes = taos_query(taos, "select * from stab"); //check stable name ASSERT(pRes); int fieldNum = taos_field_count(pRes); ASSERT(fieldNum == 6); @@ -1099,22 +1099,19 @@ int sml_escape1_Test() { while ((row = taos_fetch_row(pRes)) != NULL) { int64_t ts = *(int64_t *)row[0]; - if (rowIndex == 0) { - ASSERT(ts == 1661943970000); + if (ts == 1661943970000) { ASSERT(*(double *)row[1] == 3); ASSERT(strncmp(row[2], "32fw", sizeof("32fw") - 1) == 0); ASSERT(row[3] == NULL); ASSERT(strncmp(row[4], "1", sizeof("1") - 1) == 0); ASSERT(row[5] == NULL); - }else if (rowIndex == 1) { - ASSERT(ts == 1661943980000); + }else if (ts == 1661943980000) { ASSERT(*(double *)row[1] == 3); ASSERT(strncmp(row[2], "32fw", sizeof("32fw") - 1) == 0); ASSERT(row[3] == NULL); ASSERT(row[4] == NULL); ASSERT(strncmp(row[5], "1\\", sizeof("1\\") - 1) == 0); - }else if (rowIndex == 2) { - ASSERT(ts == 1661943990000); + }else if (ts == 1661943990000) { ASSERT(row[1] == NULL); ASSERT(strncmp(row[2], "32fw", sizeof("32fw") - 1) == 0); ASSERT(*(double *)row[3] == 3);