Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d0b4210e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d0b4210e
编写于
9月 15, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6645/enhance]: allow user to configure default JSON String type
to binary/nchar through smlDefaultJSONStrType param
上级
fb2cf3ba
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
34 addition
and
6 deletion
+34
-6
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+11
-2
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+5
-2
src/common/src/tglobal.c
src/common/src/tglobal.c
+14
-0
src/inc/taoserror.h
src/inc/taoserror.h
+2
-1
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
src/util/src/terror.c
src/util/src/terror.c
+1
-0
未找到文件。
src/client/src/tscParseOpenTSDB.c
浏览文件 @
d0b4210e
...
...
@@ -749,8 +749,17 @@ int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo* info)
break
;
}
case
cJSON_String
:
{
//convert default JSON String type to nchar
pVal
->
type
=
TSDB_DATA_TYPE_NCHAR
;
/* set default JSON type to binary/nchar according to
* user configured parameter tsSmlDefaultJSONStrType
*/
if
(
strcasecmp
(
tsSmlDefaultJSONStrType
,
"binary"
)
==
0
)
{
pVal
->
type
=
TSDB_DATA_TYPE_BINARY
;
}
else
if
(
strcasecmp
(
tsSmlDefaultJSONStrType
,
"nchar"
)
==
0
)
{
pVal
->
type
=
TSDB_DATA_TYPE_NCHAR
;
}
else
{
tscError
(
"OTD:0x%"
PRIx64
" Invalid default JSON string type set from config %s"
,
info
->
id
,
tsSmlDefaultJSONStrType
);
return
TSDB_CODE_TSC_INVALID_JSON_CONFIG
;
}
//pVal->length = wcslen((wchar_t *)root->valuestring) * TSDB_NCHAR_SIZE;
pVal
->
length
=
(
int16_t
)
strlen
(
root
->
valuestring
);
pVal
->
value
=
tcalloc
(
pVal
->
length
+
1
,
1
);
...
...
src/common/inc/tglobal.h
浏览文件 @
d0b4210e
...
...
@@ -216,7 +216,7 @@ extern int32_t cqDebugFlag;
extern
int32_t
debugFlag
;
#ifdef TD_TSZ
// lossy
// lossy
extern
char
lossyColumns
[];
extern
double
fPrecision
;
extern
double
dPrecision
;
...
...
@@ -224,9 +224,12 @@ extern uint32_t maxRange;
extern
uint32_t
curRange
;
extern
char
Compressor
[];
#endif
// long query
// long query
extern
int8_t
tsDeadLockKillQuery
;
// schemaless
extern
char
tsSmlDefaultJSONStrType
[];
typedef
struct
{
char
dir
[
TSDB_FILENAME_LEN
];
int
level
;
...
...
src/common/src/tglobal.c
浏览文件 @
d0b4210e
...
...
@@ -282,6 +282,9 @@ char Compressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESS
// long query death-lock
int8_t
tsDeadLockKillQuery
=
0
;
// schemaless
char
tsSmlDefaultJSONStrType
[
7
]
=
"binary"
;
int32_t
(
*
monStartSystemFp
)()
=
NULL
;
void
(
*
monStopSystemFp
)()
=
NULL
;
void
(
*
monExecuteSQLFp
)(
char
*
sql
)
=
NULL
;
...
...
@@ -1637,6 +1640,17 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
// Schemaless config
cfg
.
option
=
"smlDefaultJSONStrType"
;
cfg
.
ptr
=
tsSmlDefaultJSONStrType
;
cfg
.
valType
=
TAOS_CFG_VTYPE_STRING
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
0
;
cfg
.
ptrLength
=
tListLen
(
tsSmlDefaultJSONStrType
);
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
#ifdef TD_TSZ
// lossy compress
cfg
.
option
=
"lossyColumns"
;
...
...
src/inc/taoserror.h
浏览文件 @
d0b4210e
...
...
@@ -110,7 +110,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_DUP_TAG_NAMES TAOS_DEF_ERROR_CODE(0, 0x0220) //"duplicated tag names")
#define TSDB_CODE_TSC_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x0221) //"Invalid JSON format")
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222) //"Invalid JSON data type")
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223) //"Value out of range")
#define TSDB_CODE_TSC_INVALID_JSON_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0223) //"Invalid JSON configuration")
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0224) //"Value out of range")
// mnode
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed")
...
...
src/util/inc/tconfig.h
浏览文件 @
d0b4210e
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#define TSDB_CFG_MAX_NUM 12
3
#define TSDB_CFG_MAX_NUM 12
4
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
...
...
src/util/src/terror.c
浏览文件 @
d0b4210e
...
...
@@ -118,6 +118,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_COLUMN_LENGTH, "Invalid column length
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_DUP_TAG_NAMES
,
"duplicated tag names"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON
,
"Invalid JSON format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON_TYPE
,
"Invalid JSON data type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON_CONFIG
,
"Invalid JSON configuration"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
,
"Value out of range"
)
// mnode
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录