diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index f4c97f46580fdd01e3f7075798c2112d3bde8cd4..49c2ec909be5d6dfd9be57448e6fb5664ed466d1 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -30,11 +30,6 @@ extern "C" { #include "tsclient.h" #include "tglobal.h" -#define JSON_TYPE_BINARY (strcasecmp(tsDefaultJSONStrType, "binary") == 0) -#define JSON_TYPE_NCHAR (strcasecmp(tsDefaultJSONStrType, "nchar") == 0) -#define SELECT_ALL_JSON_TAG 1 -#define SELECT_ELEMENT_JSON_TAG 2 - #define UTIL_TABLE_IS_SUPER_TABLE(metaInfo) \ (((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_SUPER_TABLE)) diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index beeb4e8b243e21e33f4162b07ec218c40e4029f9..0b682ca5738744b371fda6f3e512c416167d055f 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -229,6 +229,8 @@ 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]; diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 190e939b302d3122f18d5ad49ab1fa5d4d093175..bc852e7fdaedbfc6cf9cd03ed1c5f77dfc21c4e4 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -4,6 +4,7 @@ #include "tname.h" #include "ttoken.h" #include "tvariant.h" +#include "tglobal.h" #define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS) #define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS) @@ -198,11 +199,11 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen } // 2. valid length for each type - if (pSchema[i].type == TSDB_DATA_TYPE_BINARY) { + if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || (pSchema[i].type == TSDB_DATA_TYPE_JSON && JSON_TYPE_BINARY)) { if (pSchema[i].bytes > TSDB_MAX_BINARY_LEN) { return false; } - } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { + } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR || (pSchema[i].type == TSDB_DATA_TYPE_JSON && JSON_TYPE_BINARY)) { if (pSchema[i].bytes > TSDB_MAX_NCHAR_LEN) { return false; } diff --git a/src/query/inc/qUtil.h b/src/query/inc/qUtil.h index ce607f0fe20a2743579e99e71ddf78fc2e1dbcdc..a091661b74645e07bc657d124bedce3ab987f83e 100644 --- a/src/query/inc/qUtil.h +++ b/src/query/inc/qUtil.h @@ -17,6 +17,9 @@ #include "tbuffer.h" +#define SELECT_ALL_JSON_TAG 1 +#define SELECT_ELEMENT_JSON_TAG 2 + #define SET_RES_WINDOW_KEY(_k, _ori, _len, _uid) \ do { \ assert(sizeof(_uid) == sizeof(uint64_t)); \