From 85aa924458a7703872474d82fa82a9bd2b8612ae Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Oct 2021 18:35:53 +0800 Subject: [PATCH] TD-6129 fix select jtag error --- src/client/src/tscUtil.c | 13 +++++-------- src/common/inc/tglobal.h | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 086dcfb29b..60238c63fc 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -5221,7 +5221,7 @@ char* parseTagDatatoJson(void *p){ int16_t nCols = kvRowNCols(p); ASSERT(nCols%2 == 1); - char tagJsonKey[TSDB_MAX_TAGS_LEN] = {0}; + char tagJsonKey[TSDB_MAX_JSON_KEY_LEN + 1] = {0}; for (int j = 0; j < nCols; ++j) { SColIdx * pColIdx = kvRowColIdxAt(p, j); void* val = (kvRowColVal(p, pColIdx)); @@ -5230,13 +5230,10 @@ char* parseTagDatatoJson(void *p){ ASSERT(jsonVal == TSDB_DATA_BINARY_PLACEHOLDER); continue; } - if (j%2 != 0) { // json key - memset(tagJsonKey, 0, TSDB_MAX_TAGS_LEN); - int32_t length = taosUcs4ToMbs(varDataVal(val), varDataLen(val), tagJsonKey); - if (length == 0) { - tscError("charset:%s to %s. val:%s convert json key failed.", DEFAULT_UNICODE_ENCODEC, tsCharset, (char*)val); - goto end; - } + if (j%2 != 0) { // json key encode by binary + ASSERT(varDataLen(val) <= TSDB_MAX_JSON_KEY_LEN); + memset(tagJsonKey, 0, sizeof(tagJsonKey)); + memcpy(tagJsonKey, varDataVal(val), varDataLen(val)); }else{ // json value char tagJsonValue[TSDB_MAX_TAGS_LEN] = {0}; char* realData = POINTER_SHIFT(val, CHAR_BYTES); diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 0b682ca573..beeb4e8b24 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -229,8 +229,6 @@ extern int8_t tsDeadLockKillQuery; // schemaless extern char tsDefaultJSONStrType[]; -#define JSON_TYPE_BINARY (strcasecmp(tsDefaultJSONStrType, "binary") == 0) -#define JSON_TYPE_NCHAR (strcasecmp(tsDefaultJSONStrType, "nchar") == 0) typedef struct { char dir[TSDB_FILENAME_LEN]; -- GitLab