From 7ceb5fa94ef7dc5f8a87d8f83f8c28f3f9b88088 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 6 Sep 2021 12:32:49 +0800 Subject: [PATCH] [TD-6443]: Support OpenTSDB HTTP JSON data import format --- src/client/src/tscParseOpenTSDB.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscParseOpenTSDB.c b/src/client/src/tscParseOpenTSDB.c index c5ea4b8084..637382455f 100644 --- a/src/client/src/tscParseOpenTSDB.c +++ b/src/client/src/tscParseOpenTSDB.c @@ -567,6 +567,7 @@ int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char ** } + //only pick up the first ID value as child table name cJSON *id = cJSON_GetObjectItem(tags, "ID"); if (id != NULL) { int32_t idLen = strlen(id->valuestring); @@ -576,8 +577,11 @@ int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char ** } *childTableName = tcalloc(idLen + 1, sizeof(char)); memcpy(*childTableName, id->valuestring, idLen); - //remove ID from tags list no case sensitive - cJSON_DeleteItemFromObject(tags, "ID"); + //remove all ID fields from tags list no case sensitive + while (id != NULL) { + cJSON_DeleteItemFromObject(tags, "ID"); + id = cJSON_GetObjectItem(tags, "ID"); + } } int32_t tagNum = cJSON_GetArraySize(tags); -- GitLab