From 0377f00773503eef222297506d09145e8e0da8ec Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 15 Sep 2021 18:05:22 +0800 Subject: [PATCH] [TD-6645/enhance]: Add default type convertion for numeric values for telnet lines. Interger number -> BIGINT (contains only digits and '+' '-') Floating number -> DOUBLE (including decimal point format or scientific notation format) --- src/client/src/tscParseLineProtocol.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index 6c5407d0a5..297f4680ee 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -1650,9 +1650,19 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, memcpy(pVal->value, &bVal, pVal->length); return true; } - //Handle default(no appendix) as float - if (isValidInteger(value) || isValidFloat(value)) { - pVal->type = TSDB_DATA_TYPE_FLOAT; + //Handle default(no appendix) interger type as BIGINT + if (isValidInteger(value)) { + pVal->type = TSDB_DATA_TYPE_BIGINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + if (!convertStrToNumber(pVal, value, info)) { + return false; + } + return true; + } + + //Handle default(no appendix) floating number type as DOUBLE + if (isValidFloat(value)) { + pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; if (!convertStrToNumber(pVal, value, info)) { return false; -- GitLab