Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不争之德
oceanbase
提交
97badd00
O
oceanbase
项目概览
不争之德
/
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,发现更多精彩内容 >>
提交
97badd00
编写于
8月 22, 2022
作者:
O
obdev
提交者:
wangyunlai.wyl
8月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] Json bugfix: json column length and create view with json
上级
811b5387
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
26 addition
and
5 deletion
+26
-5
src/observer/virtual_table/ob_table_columns.cpp
src/observer/virtual_table/ob_table_columns.cpp
+4
-0
src/sql/engine/expr/ob_expr_json_array.cpp
src/sql/engine/expr/ob_expr_json_array.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_array_append.cpp
src/sql/engine/expr/ob_expr_json_array_append.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_array_insert.cpp
src/sql/engine/expr/ob_expr_json_array_insert.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_extract.cpp
src/sql/engine/expr/ob_expr_json_extract.cpp
+2
-5
src/sql/engine/expr/ob_expr_json_insert.cpp
src/sql/engine/expr/ob_expr_json_insert.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_keys.cpp
src/sql/engine/expr/ob_expr_json_keys.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_merge_patch.cpp
src/sql/engine/expr/ob_expr_json_merge_patch.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_merge_preserve.cpp
src/sql/engine/expr/ob_expr_json_merge_preserve.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_object.cpp
src/sql/engine/expr/ob_expr_json_object.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_remove.cpp
src/sql/engine/expr/ob_expr_json_remove.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_replace.cpp
src/sql/engine/expr/ob_expr_json_replace.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_search.cpp
src/sql/engine/expr/ob_expr_json_search.cpp
+1
-0
src/sql/engine/expr/ob_expr_json_set.cpp
src/sql/engine/expr/ob_expr_json_set.cpp
+1
-0
src/sql/resolver/expr/ob_raw_expr.cpp
src/sql/resolver/expr/ob_raw_expr.cpp
+5
-0
src/sql/resolver/expr/ob_raw_expr.h
src/sql/resolver/expr/ob_raw_expr.h
+1
-0
src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp
src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp
+2
-0
未找到文件。
src/observer/virtual_table/ob_table_columns.cpp
浏览文件 @
97badd00
...
...
@@ -542,6 +542,10 @@ int ObTableColumns::deduce_column_attributes(
if
(
OB_FAIL
(
set_null_and_default_according_binary_expr
(
select_stmt
,
expr
,
nullable
,
has_default
)))
{
LOG_WARN
(
"fail to get null and default for binary expr"
,
K
(
ret
));
}
}
else
if
(
expr
->
is_json_expr
()
||
(
T_FUN_SYS_CAST
==
expr
->
get_expr_type
()
&&
ob_is_json
(
expr
->
get_result_type
().
get_type
())))
{
nullable
=
true
;
has_default
=
false
;
}
else
{
// ObOpRawExpr, ObCaseOpRawExpr, ObAggFunRawExpr
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
expr
->
get_param_count
();
++
i
)
{
...
...
src/sql/engine/expr/ob_expr_json_array.cpp
浏览文件 @
97badd00
...
...
@@ -51,6 +51,7 @@ int ObExprJsonArray::calc_result_typeN(ObExprResType& type,
}
else
{
// param_num >= 0
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
for
(
int64_t
i
=
0
;
i
<
param_num
;
i
++
)
{
if
(
ob_is_string_type
(
types_stack
[
i
].
get_type
()))
{
if
(
types_stack
[
i
].
get_charset_type
()
!=
CHARSET_UTF8MB4
)
{
...
...
src/sql/engine/expr/ob_expr_json_array_append.cpp
浏览文件 @
97badd00
...
...
@@ -50,6 +50,7 @@ int ObExprJsonArrayAppend::calc_result_typeN(ObExprResType& type,
LOG_USER_ERROR
(
OB_ERR_PARAM_SIZE
,
name
.
length
(),
name
.
ptr
());
}
else
{
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
if
(
OB_FAIL
(
ObJsonExprHelper
::
is_valid_for_json
(
types_stack
,
0
,
N_JSON_ARRAY_APPEND
)))
{
LOG_WARN
(
"wrong type for json doc."
,
K
(
ret
),
K
(
types_stack
[
0
].
get_type
()));
...
...
src/sql/engine/expr/ob_expr_json_array_insert.cpp
浏览文件 @
97badd00
...
...
@@ -48,6 +48,7 @@ int ObExprJsonArrayInsert::calc_result_typeN(ObExprResType& type, ObExprResType*
LOG_USER_ERROR
(
OB_ERR_PARAM_SIZE
,
name
.
length
(),
name
.
ptr
());
}
else
{
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
if
(
OB_FAIL
(
ObJsonExprHelper
::
is_valid_for_json
(
types_stack
,
0
,
N_JSON_ARRAY_INSERT
)))
{
LOG_WARN
(
"wrong type for json doc."
,
K
(
ret
),
K
(
types_stack
[
0
].
get_type
()));
...
...
src/sql/engine/expr/ob_expr_json_extract.cpp
浏览文件 @
97badd00
...
...
@@ -74,11 +74,8 @@ int ObExprJsonExtract::calc_result_typeN(ObExprResType& type,
}
if
(
OB_SUCC
(
ret
))
{
if
(
is_null_result
)
{
type
.
set_null
();
}
else
{
type
.
set_json
();
}
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
}
}
return
ret
;
...
...
src/sql/engine/expr/ob_expr_json_insert.cpp
浏览文件 @
97badd00
...
...
@@ -51,6 +51,7 @@ int ObExprJsonInsert::calc_result_typeN(ObExprResType& type,
LOG_USER_ERROR
(
OB_ERR_PARAM_SIZE
,
name
.
length
(),
name
.
ptr
());
}
else
{
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
if
(
OB_FAIL
(
ObJsonExprHelper
::
is_valid_for_json
(
types_stack
,
0
,
N_JSON_INSERT
)))
{
LOG_WARN
(
"wrong type for json doc."
,
K
(
ret
),
K
(
types_stack
[
0
].
get_type
()));
...
...
src/sql/engine/expr/ob_expr_json_keys.cpp
浏览文件 @
97badd00
...
...
@@ -44,6 +44,7 @@ int ObExprJsonKeys::calc_result_typeN(ObExprResType& type,
}
else
{
// set result to json
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
// set type of json_doc
if
(
OB_FAIL
(
ObJsonExprHelper
::
is_valid_for_json
(
types_stack
,
0
,
N_JSON_KEYS
)))
{
...
...
src/sql/engine/expr/ob_expr_json_merge_patch.cpp
浏览文件 @
97badd00
...
...
@@ -44,6 +44,7 @@ int ObExprJsonMergePatch::calc_result_typeN(ObExprResType& type,
INIT_SUCC
(
ret
);
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
param_num
;
i
++
)
{
if
(
OB_FAIL
(
ObJsonExprHelper
::
is_valid_for_json
(
types_stack
,
i
,
N_JSON_MERGE_PRESERVE
)))
{
LOG_WARN
(
"wrong type for json doc."
,
K
(
ret
),
K
(
types_stack
[
i
].
get_type
()));
...
...
src/sql/engine/expr/ob_expr_json_merge_preserve.cpp
浏览文件 @
97badd00
...
...
@@ -53,6 +53,7 @@ int ObExprJsonMergePreserve::calc_result_typeN(ObExprResType& type,
UNUSED
(
type_ctx
);
INIT_SUCC
(
ret
);
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
bool
is_result_null
=
false
;
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
!
is_result_null
&&
i
<
param_num
;
i
++
)
{
if
(
types_stack
[
0
].
get_type
()
==
ObNullType
)
{
...
...
src/sql/engine/expr/ob_expr_json_object.cpp
浏览文件 @
97badd00
...
...
@@ -45,6 +45,7 @@ int ObExprJsonObject::calc_result_typeN(ObExprResType& type,
LOG_USER_ERROR
(
OB_ERR_PARAM_SIZE
,
name
.
length
(),
name
.
ptr
());
}
else
{
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
param_num
;
i
+=
2
)
{
if
((
types_stack
[
i
].
get_type
()
==
ObNullType
))
{
ret
=
OB_ERR_JSON_DOCUMENT_NULL_KEY
;
...
...
src/sql/engine/expr/ob_expr_json_remove.cpp
浏览文件 @
97badd00
...
...
@@ -49,6 +49,7 @@ int ObExprJsonRemove::calc_result_typeN(ObExprResType& type,
}
}
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
return
ret
;
}
...
...
src/sql/engine/expr/ob_expr_json_replace.cpp
浏览文件 @
97badd00
...
...
@@ -55,6 +55,7 @@ int ObExprJsonReplace::calc_result_typeN(ObExprResType& type,
}
}
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
}
return
ret
;
}
...
...
src/sql/engine/expr/ob_expr_json_search.cpp
浏览文件 @
97badd00
...
...
@@ -218,6 +218,7 @@ int ObExprJsonSearch::calc_result_typeN(ObExprResType& type,
LOG_WARN
(
"invalid param number"
,
K
(
ret
),
K
(
param_num
));
}
else
{
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
// json doc
if
(
OB_FAIL
(
ObJsonExprHelper
::
is_valid_for_json
(
types_stack
,
0
,
"json_search"
)))
{
...
...
src/sql/engine/expr/ob_expr_json_set.cpp
浏览文件 @
97badd00
...
...
@@ -55,6 +55,7 @@ int ObExprJsonSet::calc_result_typeN(ObExprResType& type,
}
}
type
.
set_json
();
type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
}
return
ret
;
}
...
...
src/sql/resolver/expr/ob_raw_expr.cpp
浏览文件 @
97badd00
...
...
@@ -466,6 +466,11 @@ int ObRawExpr::postorder_replace(ObRawExprVisitor& visitor)
return
ret
;
}
bool
ObRawExpr
::
is_json_expr
()
const
{
return
(
T_FUN_SYS_JSON_OBJECT
<=
get_expr_type
()
&&
get_expr_type
()
<=
T_FUN_JSON_OBJECTAGG
)
?
true
:
false
;
}
////////////////////////////////////////////////////////////////
ObRawExpr
*&
ObTerminalRawExpr
::
get_param_expr
(
int64_t
index
)
{
...
...
src/sql/resolver/expr/ob_raw_expr.h
浏览文件 @
97badd00
...
...
@@ -1508,6 +1508,7 @@ public:
{
is_deterministic_
=
is_deterministic
;
}
bool
is_json_expr
()
const
;
VIRTUAL_TO_STRING_KV
(
N_ITEM_TYPE
,
type_
,
N_RESULT_TYPE
,
result_type_
,
N_EXPR_INFO
,
info_
,
N_REL_ID
,
rel_ids_
,
K_
(
expr_level
),
K_
(
expr_levels
),
K_
(
enum_set_values
),
K_
(
is_explicited_reference
),
K_
(
ref_count
),
K_
(
is_for_generated_column
),
K_
(
extra
),
K_
(
is_calculated
));
...
...
src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp
浏览文件 @
97badd00
...
...
@@ -1074,6 +1074,7 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr& expr)
}
case
T_FUN_JSON_ARRAYAGG
:
{
result_type
.
set_json
();
result_type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
expr
.
set_result_type
(
result_type
);
break
;
}
...
...
@@ -1095,6 +1096,7 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr& expr)
need_add_cast
=
true
;
}
result_type
.
set_json
();
result_type
.
set_length
((
ObAccuracy
::
DDL_DEFAULT_ACCURACY
[
ObJsonType
]).
get_length
());
expr
.
set_result_type
(
result_type
);
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录