From 51e37a9d825f10d8feeb5f4c3133ec8a02e025a4 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/src/tscParseOpenTSDB.c b/src/client/src/tscParseOpenTSDB.c index c2a58e1315..bae8b3acb1 100644 --- a/src/client/src/tscParseOpenTSDB.c +++ b/src/client/src/tscParseOpenTSDB.c @@ -559,7 +559,7 @@ int32_t parseMetricValueFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, } int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char **childTableName, SSmlLinesInfo* info) { - int32_t ret; + int32_t ret = TSDB_CODE_SUCCESS; cJSON *tags = cJSON_GetObjectItem(root, "tags"); if (tags == NULL || tags->type != cJSON_Object) { @@ -567,15 +567,15 @@ int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char ** } - cJSON *id = cJSON_GetObjectItem(root, "ID"); + cJSON *id = cJSON_GetObjectItem(tags, "ID"); if (id != NULL) { int32_t idLen = strlen(id->string); - ret = isValidChildTableName(id->string, idLen); + ret = isValidChildTableName(id->valuestring, idLen); if (ret != TSDB_CODE_SUCCESS) { return ret; } *childTableName = tcalloc(idLen + 1, sizeof(char)); - memcpy(*childTableName, id->string, idLen); + memcpy(*childTableName, id->valuestring, idLen); //remove ID from tags list no case sensitive cJSON_DeleteItemFromObject(tags, "ID"); } @@ -605,7 +605,7 @@ int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char ** pkv++; } - return TSDB_CODE_SUCCESS; + return ret; } -- GitLab