From 7fc2e8806734f54bb2fcd722b5c5222d110662b9 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 21 May 2022 20:22:27 +0800 Subject: [PATCH 1/3] fea:add tag default name in schemaless --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index b8dd33b915..1a113a67d1 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -327,7 +327,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1) != 0) return -1; if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1; if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1; - if (cfgAddString(pCfg, "smlTagName", "", 1) != 0) return -1; + if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1; if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1; tsNumOfTaskQueueThreads = tsNumOfCores / 4; From b09750fe7a474404e8f7c6f1e236f713545d81f1 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 21 May 2022 21:05:33 +0800 Subject: [PATCH 2/3] fea:add tag default name in schemaless --- source/client/src/clientSml.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 8b2f47b295..68c47c2d13 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -726,9 +726,6 @@ static int64_t smlGetTimeValue(const char *value, int32_t len, int8_t type) { if(value + len != endPtr){ return -1; } - if(tsInt64 == 0){ - return taosGetTimestampNs(); - } double ts = tsInt64; switch (type) { case TSDB_TIME_PRECISION_HOURS: @@ -794,8 +791,8 @@ static int8_t smlGetTsTypeByPrecision(int8_t precision) { } static int64_t smlParseInfluxTime(SSmlHandle* info, const char* data, int32_t len){ - if(len == 0){ - return taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + if(len == 0 || (len == 1 && data[0] == '0')){ + return taosGetTimestampNs(); } int8_t tsType = smlGetTsTypeByPrecision(info->precision); @@ -817,6 +814,9 @@ static int64_t smlParseOpenTsdbTime(SSmlHandle* info, const char* data, int32_t smlBuildInvalidDataMsg(&info->msgBuf, "timestamp can not be null", NULL); return -1; } + if(len == 1 && data[0] == '0'){ + return taosGetTimestampNs(); + } int8_t tsType = smlGetTsTypeByLen(len); if (tsType == -1) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp precision can only be seconds(10 digits) or milli seconds(13 digits)", data); From 648fa307f2be16c2b3e3d25dd9a1c729f529cf6b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 21 May 2022 21:16:35 +0800 Subject: [PATCH 3/3] fea:add tag default name in schemaless --- source/common/src/tglobal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1a113a67d1..1b61a0bc60 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -78,7 +78,7 @@ char tsTelemServer[TSDB_FQDN_LEN] = "telemetry.taosdata.com"; uint16_t tsTelemPort = 80; // schemaless -char tsSmlTagName[TSDB_COL_NAME_LEN] = "__tag"; +char tsSmlTagName[TSDB_COL_NAME_LEN] = "_tag_null"; char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; //user defined child table name can be specified in tag value. //If set to empty system will generate table name using MD5 hash. bool tsSmlDataFormat = true; // true means that the name and order of cols in each line are the same(only for influx protocol) @@ -327,7 +327,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1) != 0) return -1; if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1; if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1; - if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1; + if (cfgAddString(pCfg, "smlTagNullName", tsSmlTagName, 1) != 0) return -1; if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1; tsNumOfTaskQueueThreads = tsNumOfCores / 4; @@ -524,7 +524,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { } tstrncpy(tsSmlChildTableName, cfgGetItem(pCfg, "smlChildTableName")->str, TSDB_TABLE_NAME_LEN); - tstrncpy(tsSmlTagName, cfgGetItem(pCfg, "smlTagName")->str, TSDB_COL_NAME_LEN); + tstrncpy(tsSmlTagName, cfgGetItem(pCfg, "smlTagNullName")->str, TSDB_COL_NAME_LEN); tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval; tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->i32;