diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 086dcfb29b225eda391834604ead57942700f712..60238c63fc7c80e3ce74f77086ee129a0967bd29 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 0b682ca5738744b371fda6f3e512c416167d055f..beeb4e8b243e21e33f4162b07ec218c40e4029f9 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];