diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 9bc81d8fba5445266870a310d1e51a5c03a9bcc4..7d2d928aa953cba66c8e69073b613f801dfda8fd 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -738,7 +738,7 @@ static int32_t KvRowAppend(SMsgBuf* pMsgBuf, const void *value, int32_t len, voi } varDataSetLen(pa->buf, output); - tdAddColToKVRow(pa->builder, colId, varDataTLen(pa->buf)); + tdAddColToKVRow(pa->builder, colId, pa->buf, varDataTLen(pa->buf)); } else { tdAddColToKVRow(pa->builder, colId, value, TYPE_BYTES[type]); } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 4ace62a2f15cac4a4fe534f3667329fa8e3a4339..a423643e42d8a64563f8fee04f74d021451ce8ff 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -242,6 +242,7 @@ int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen) { j++; } dst[j] = '\0'; + strtrim(dst); return j; } @@ -259,7 +260,7 @@ int parseJsontoTagData(const char* json, SKVRowBuilder* kvRowBuilder, SMsgBuf* p uint8_t jsonNULL = TSDB_JSON_NULL; int jsonIndex = startColId + 1; tdAddColToKVRow(kvRowBuilder, jsonIndex++, &jsonKeyNULL, CHAR_BYTES); // add json null type - if (!json || strtrim(json) == 0 || strncasecmp(json, "null", 4) == 0){ + if (!json || strcasecmp(json, TSDB_DATA_NULL_STR_L) == 0){ tdAddColToKVRow(kvRowBuilder, jsonIndex++, &jsonNULL, CHAR_BYTES); // add json null value return TSDB_CODE_SUCCESS; } @@ -281,13 +282,13 @@ int parseJsontoTagData(const char* json, SKVRowBuilder* kvRowBuilder, SMsgBuf* p cJSON* item = cJSON_GetArrayItem(root, i); if (!item) { qError("json inner error:%d", i); - return buildSyntaxErrMsg(pMsgBuf, "json inner error", json); + retCode = buildSyntaxErrMsg(pMsgBuf, "json inner error", json); goto end; } char *jsonKey = item->string; if(!isValidateTag(jsonKey)){ - retCode = buildSyntaxErrMsg(pMsgBuf, "json key not validate", jsonKey); + retCode = buildSyntaxErrMsg(pMsgBuf, "json key not validate", jsonKey); goto end; } // if(strlen(jsonKey) > TSDB_MAX_JSON_KEY_LEN){