Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
uestcdwn
oceanbase
提交
4ad6e00e
O
oceanbase
项目概览
uestcdwn
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4ad6e00e
编写于
10月 21, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
10月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: json type object support empty string key
上级
82519cc5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
28 deletion
+30
-28
deps/oblib/src/lib/json_type/ob_json_bin.cpp
deps/oblib/src/lib/json_type/ob_json_bin.cpp
+10
-5
deps/oblib/src/lib/json_type/ob_json_path.cpp
deps/oblib/src/lib/json_type/ob_json_path.cpp
+1
-1
deps/oblib/src/lib/json_type/ob_json_tree.cpp
deps/oblib/src/lib/json_type/ob_json_tree.cpp
+0
-3
src/sql/engine/expr/ob_expr_json_search.cpp
src/sql/engine/expr/ob_expr_json_search.cpp
+1
-1
src/sql/engine/expr/ob_expr_json_value.cpp
src/sql/engine/expr/ob_expr_json_value.cpp
+18
-18
未找到文件。
deps/oblib/src/lib/json_type/ob_json_bin.cpp
浏览文件 @
4ad6e00e
...
...
@@ -1322,11 +1322,16 @@ int ObJsonBin::deserialize_json_object_v0(const char *data, uint64_t length, ObJ
}
else
{
// TODO if with key dict, read key from dict
// to consider, add option to controll need alloc or not
void
*
key_buf
=
allocator_
->
alloc
(
key_len
);
if
(
key_buf
==
NULL
)
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
LOG_WARN
(
"fail to alloc memory for data buf"
,
K
(
ret
));
}
else
{
void
*
key_buf
=
nullptr
;
if
(
key_len
>
0
)
{
key_buf
=
allocator_
->
alloc
(
key_len
);
if
(
key_buf
==
NULL
)
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
LOG_WARN
(
"fail to alloc memory for data buf"
,
K
(
ret
));
}
}
if
(
OB_SUCC
(
ret
))
{
MEMCPY
(
key_buf
,
data
+
key_offset
,
key_len
);
ObString
key
(
key_len
,
reinterpret_cast
<
const
char
*>
(
key_buf
));
const
char
*
val
=
data
+
value_offset
;
...
...
deps/oblib/src/lib/json_type/ob_json_path.cpp
浏览文件 @
4ad6e00e
...
...
@@ -1051,7 +1051,7 @@ int ObJsonPath::parse_name_with_rapidjson(char*& str, uint64_t& len)
ObJsonString
*
val
=
static_cast
<
ObJsonString
*>
(
dom
);
len
=
val
->
value
().
length
();
str
=
static_cast
<
char
*>
(
allocator_
->
alloc
(
len
));
if
(
OB_ISNULL
(
str
))
{
if
(
len
>
0
&&
OB_ISNULL
(
str
))
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
LOG_WARN
(
"fail to allocate memory for member_name."
,
K
(
ret
),
K
(
len
),
K
(
val
->
value
()));
...
...
deps/oblib/src/lib/json_type/ob_json_tree.cpp
浏览文件 @
4ad6e00e
...
...
@@ -630,9 +630,6 @@ int ObJsonObject::add(const common::ObString &key, ObJsonNode *value)
if
(
OB_ISNULL
(
value
))
{
// check param
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"param value is NULL"
,
K
(
ret
));
}
else
if
(
key
.
empty
())
{
ret
=
OB_ERR_JSON_DOCUMENT_NULL_KEY
;
LOG_WARN
(
"key is NULL"
,
K
(
ret
));
}
else
{
value
->
set_parent
(
this
);
ObJsonObjectPair
pair
(
key
,
value
);
...
...
src/sql/engine/expr/ob_expr_json_search.cpp
浏览文件 @
4ad6e00e
...
...
@@ -493,7 +493,7 @@ int ObExprJsonSearch::eval_json_search(const ObExpr &expr, ObEvalCtx &ctx, ObDat
}
// check one_or_all flag
bool
one_flag
;
bool
one_flag
=
false
;
if
(
OB_SUCC
(
ret
)
&&
!
is_null
)
{
json_arg
=
expr
.
args_
[
1
];
val_type
=
json_arg
->
datum_meta_
.
type_
;
...
...
src/sql/engine/expr/ob_expr_json_value.cpp
浏览文件 @
4ad6e00e
...
...
@@ -1155,7 +1155,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case
ObMediumIntType
:
case
ObInt32Type
:
case
ObIntType
:
{
int64_t
val
;
int64_t
val
=
0
;
ret
=
cast_to_int
(
j_base
,
dst_type
,
val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_int
(
dst_type
,
val
);
...
...
@@ -1167,7 +1167,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case
ObUMediumIntType
:
case
ObUInt32Type
:
case
ObUInt64Type
:
{
uint64_t
val
;
uint64_t
val
=
0
;
ret
=
cast_to_uint
(
j_base
,
dst_type
,
val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_uint
(
dst_type
,
val
);
...
...
@@ -1175,7 +1175,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObDateTimeType
:
{
int64_t
val
;
int64_t
val
=
0
;
ret
=
cast_to_datetime
(
j_base
,
accuracy
,
val
);
if
(
ret
==
OB_ERR_NULL_VALUE
)
{
res
.
set_null
();
...
...
@@ -1194,7 +1194,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObDateType
:
{
int32_t
val
;
int32_t
val
=
0
;
ret
=
cast_to_date
(
j_base
,
val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_date
(
val
);
...
...
@@ -1202,7 +1202,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObTimeType
:
{
int64_t
val
;
int64_t
val
=
0
;
ret
=
cast_to_time
(
j_base
,
accuracy
,
val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_time
(
val
);
...
...
@@ -1210,7 +1210,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObYearType
:
{
uint8_t
val
;
uint8_t
val
=
0
;
ret
=
cast_to_year
(
j_base
,
val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_year
(
val
);
...
...
@@ -1219,7 +1219,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case
ObFloatType
:
case
ObUFloatType
:
{
float
out_val
;
float
out_val
=
0
;
ret
=
cast_to_float
(
j_base
,
dst_type
,
out_val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_float
(
dst_type
,
out_val
);
...
...
@@ -1228,7 +1228,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case
ObDoubleType
:
case
ObUDoubleType
:
{
double
out_val
;
double
out_val
=
0
;
ret
=
cast_to_double
(
j_base
,
dst_type
,
out_val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_double
(
dst_type
,
out_val
);
...
...
@@ -1262,7 +1262,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObBitType
:
{
uint64_t
out_val
;
uint64_t
out_val
=
0
;
ret
=
cast_to_bit
(
j_base
,
out_val
);
if
(
!
try_set_error_val
<
ObObj
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_bit
(
out_val
);
...
...
@@ -1325,7 +1325,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case
ObMediumIntType
:
case
ObInt32Type
:
case
ObIntType
:
{
int64_t
val
;
int64_t
val
=
0
;
ret
=
cast_to_int
(
j_base
,
dst_type
,
val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_int
(
val
);
...
...
@@ -1337,7 +1337,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case
ObUMediumIntType
:
case
ObUInt32Type
:
case
ObUInt64Type
:
{
uint64_t
val
;
uint64_t
val
=
0
;
ret
=
cast_to_uint
(
j_base
,
dst_type
,
val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_uint
(
val
);
...
...
@@ -1345,7 +1345,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObDateTimeType
:
{
int64_t
val
;
int64_t
val
=
0
;
ret
=
cast_to_datetime
(
j_base
,
accuracy
,
val
);
if
(
ret
==
OB_ERR_NULL_VALUE
)
{
res
.
set_null
();
...
...
@@ -1366,7 +1366,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObDateType
:
{
int32_t
val
;
int32_t
val
=
0
;
ret
=
cast_to_date
(
j_base
,
val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_date
(
val
);
...
...
@@ -1374,7 +1374,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObTimeType
:
{
int64_t
val
;
int64_t
val
=
0
;
ret
=
cast_to_time
(
j_base
,
accuracy
,
val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_time
(
val
);
...
...
@@ -1382,7 +1382,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObYearType
:
{
uint8_t
val
;
uint8_t
val
=
0
;
ret
=
cast_to_year
(
j_base
,
val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_year
(
val
);
...
...
@@ -1391,7 +1391,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case
ObFloatType
:
case
ObUFloatType
:
{
float
out_val
;
float
out_val
=
0
;
ret
=
cast_to_float
(
j_base
,
dst_type
,
out_val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_float
(
out_val
);
...
...
@@ -1400,7 +1400,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case
ObDoubleType
:
case
ObUDoubleType
:
{
double
out_val
;
double
out_val
=
0
;
ret
=
cast_to_double
(
j_base
,
dst_type
,
out_val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_double
(
out_val
);
...
...
@@ -1442,7 +1442,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break
;
}
case
ObBitType
:
{
uint64_t
out_val
;
uint64_t
out_val
=
0
;
ret
=
cast_to_bit
(
j_base
,
out_val
);
if
(
!
try_set_error_val
<
ObDatum
>
(
res
,
ret
,
error_type
,
error_val
))
{
res
.
set_bit
(
out_val
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录