From 64a0baa3afa837797fcd5748c4bef064384e3e5e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 23 Sep 2021 16:15:34 +0800 Subject: [PATCH] TD-6129 add tag-> select logic --- src/client/inc/tscUtil.h | 5 ----- src/common/inc/tglobal.h | 2 ++ src/common/src/tname.c | 5 +++-- src/query/inc/qUtil.h | 3 +++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index f4c97f4658..49c2ec909b 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 beeb4e8b24..0b682ca573 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 190e939b30..bc852e7fda 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 ce607f0fe2..a091661b74 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)); \ -- GitLab