Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
616d4b62
O
oceanbase
项目概览
oceanbase
/
oceanbase
8 个月 前同步成功
通知
260
Star
6084
Fork
1301
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
616d4b62
编写于
4月 23, 2024
作者:
O
obdev
提交者:
ob-robot
4月 23, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:multivalue index lookup bug, create multivalue index with pk column
上级
814ff31f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
56 addition
and
5 deletion
+56
-5
src/share/ob_fts_index_builder_util.cpp
src/share/ob_fts_index_builder_util.cpp
+2
-0
src/sql/das/ob_domain_index_lookup_op.cpp
src/sql/das/ob_domain_index_lookup_op.cpp
+3
-0
src/sql/engine/expr/ob_expr_json_query.cpp
src/sql/engine/expr/ob_expr_json_query.cpp
+10
-1
src/sql/engine/expr/ob_expr_json_utils.cpp
src/sql/engine/expr/ob_expr_json_utils.cpp
+6
-2
src/sql/rewrite/ob_query_range.cpp
src/sql/rewrite/ob_query_range.cpp
+34
-2
src/sql/rewrite/ob_query_range.h
src/sql/rewrite/ob_query_range.h
+1
-0
未找到文件。
src/share/ob_fts_index_builder_util.cpp
浏览文件 @
616d4b62
...
...
@@ -2161,6 +2161,7 @@ int ObMulValueIndexBuilderUtil::generate_multivalue_column(
}
else
if
(
old_gen_col
!=
NULL
)
{
//got it
gen_col
=
old_gen_col
;
gen_budy_col
=
data_schema
.
get_column_schema
(
gen_col
->
get_column_id
());
}
else
{
//need to add new generated column
ObObj
default_value
;
...
...
@@ -2387,6 +2388,7 @@ int ObMulValueIndexBuilderUtil::set_multivalue_index_table_columns(
"database_id"
,
data_schema
.
get_database_id
(),
"table_name"
,
data_schema
.
get_table_name
(),
"column name"
,
mvi_col_item
.
column_name_
,
K
(
ret
));
}
else
if
(
mvi_column
->
is_rowkey_column
())
{
}
else
if
(
!
mvi_column
->
is_multivalue_generated_array_column
())
{
if
(
OB_FAIL
(
ObIndexBuilderUtil
::
add_column
(
mvi_column
,
true
/*is_index_column*/
,
...
...
src/sql/das/ob_domain_index_lookup_op.cpp
浏览文件 @
616d4b62
...
...
@@ -831,6 +831,8 @@ int ObMulValueIndexLookupOp::save_rowkeys()
if
(
OB_FAIL
(
sorter_
.
do_sort
(
true
)))
{
LOG_WARN
(
"do rowkey sort failed"
,
K
(
ret
));
}
else
{
lookup_rowkey_cnt_
=
0
;
}
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
default_row_batch_cnt
;
++
i
)
{
...
...
@@ -859,6 +861,7 @@ int ObMulValueIndexLookupOp::save_rowkeys()
LOG_WARN
(
"store lookup key range failed"
,
K
(
ret
),
K
(
scan_param_
));
}
last_rowkey_
=
*
idx_row
;
++
lookup_rowkey_cnt_
;
LOG_DEBUG
(
"build data table range"
,
K
(
ret
),
K
(
*
idx_row
),
K
(
lookup_range
),
K
(
scan_param_
.
key_ranges_
.
count
()));
}
}
...
...
src/sql/engine/expr/ob_expr_json_query.cpp
浏览文件 @
616d4b62
...
...
@@ -261,6 +261,14 @@ int ObExprJsonQuery::eval_json_query(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
}
else
if
(
is_null_result
)
{
// ToDo: need check is_multivalue?
res
.
set_null
();
if
(
is_multivalue
&&
OB_FAIL
(
set_multivalue_result
(
ctx
,
temp_allocator
,
nullptr
,
expr
,
param_ctx
->
json_param_
.
error_type_
,
in_coll_type
,
dst_coll_type
,
param_ctx
->
json_param_
.
error_val_
,
param_ctx
->
json_param_
.
accuracy_
,
cast_param
,
res
)))
{
LOG_WARN
(
"multi value result set fail"
,
K
(
ret
));
}
}
else
if
(
param_ctx
->
json_param_
.
on_mismatch_
[
0
]
==
JSN_QUERY_MISMATCH_DOT
&&
hits
.
size
()
==
1
&&
param_ctx
->
json_param_
.
dst_type_
!=
ObJsonType
)
{
// dot notation
...
...
@@ -274,7 +282,6 @@ int ObExprJsonQuery::eval_json_query(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
}
else
if
(
OB_FAIL
(
ObJsonUtil
::
set_lob_datum
(
&
temp_allocator
,
expr
,
ctx
,
param_ctx
->
json_param_
.
dst_type_
,
0
,
res
)))
{
LOG_WARN
(
"fail to set lob datum from string val"
,
K
(
ret
));
}
// ToDo: need set_multivalue_result?
}
else
if
(
use_wrapper
==
1
)
{
size_t
hit_size
=
hits
.
size
();
ObJsonArray
j_arr_res
(
&
temp_allocator
);
...
...
@@ -477,6 +484,7 @@ int ObExprJsonQuery::set_multivalue_result(ObEvalCtx& ctx,
ObObj
tmp_obj
;
int64_t
pos
=
str_buff
.
length
();
tmp_obj
.
set_collation_type
(
dst_collation
);
tmp_obj
.
set_type
(
dest_type
);
if
(
ob_is_numeric_type
(
dest_type
)
||
ob_is_temporal_type
(
dest_type
))
{
tmp_obj
.
set_collation_level
(
CS_LEVEL_NUMERIC
);
}
else
{
...
...
@@ -523,6 +531,7 @@ int ObExprJsonQuery::set_multivalue_result(ObEvalCtx& ctx,
ObObj
tmp_obj
;
int64_t
pos
=
str_buff
.
length
();
tmp_obj
.
set_collation_type
(
dst_collation
);
tmp_obj
.
set_type
(
dest_type
);
if
(
ob_is_numeric_type
(
dest_type
)
||
ob_is_temporal_type
(
dest_type
))
{
tmp_obj
.
set_collation_level
(
CS_LEVEL_NUMERIC
);
}
else
{
...
...
src/sql/engine/expr/ob_expr_json_utils.cpp
浏览文件 @
616d4b62
...
...
@@ -1512,9 +1512,13 @@ int ObJsonUtil::cast_json_scalar_to_sql_obj(common::ObIAllocator *allocator,
uint8_t
is_type_mismatch
=
false
;
if
(
OB_FAIL
(
cast_to_res
(
allocator
,
ctx
,
j_base
,
accuracy
,
cast_param
,
res_datum
,
is_type_mismatch
)))
{
LOG_WARN
(
"fail to cast."
,
K
(
ret
));
}
else
{
res_obj
.
set_type
(
obj_type
);
res_obj
.
set_collation_type
(
collation
);
res_datum
.
to_obj
(
res_obj
,
res_obj
.
meta_
);
res_obj
.
set_collation_type
(
collation
);
}
res_datum
.
to_obj
(
res_obj
,
res_obj
.
meta_
);
res_obj
.
set_collation_type
(
collation
);
}
return
ret
;
}
...
...
src/sql/rewrite/ob_query_range.cpp
浏览文件 @
616d4b62
...
...
@@ -3992,6 +3992,37 @@ int ObQueryRange::init_domain_key_part(const ObRawExpr *expr, ObKeyPart *&out_k
return
ret
;
}
int
ObQueryRange
::
set_normal_key_true_or_false
(
ObKeyPart
*&
out_key_part
,
bool
is_always_true
)
{
int
ret
=
OB_SUCCESS
;
bool
is_create_key_part
=
out_key_part
==
nullptr
;
if
(
is_create_key_part
&&
OB_FAIL
(
alloc_full_key_part
(
out_key_part
)))
{
LOG_WARN
(
"create full key part failed"
,
K
(
ret
));
}
else
if
(
!
is_create_key_part
&&
OB_FAIL
(
out_key_part
->
create_normal_key
()))
{
LOG_WARN
(
"create normal key failed"
,
K
(
ret
));
}
else
{
out_key_part
->
normal_keypart_
->
include_start_
=
false
;
out_key_part
->
normal_keypart_
->
include_end_
=
false
;
out_key_part
->
normal_keypart_
->
always_true_
=
is_always_true
;
out_key_part
->
normal_keypart_
->
always_false_
=
!
is_always_true
;
if
(
is_always_true
)
{
out_key_part
->
normal_keypart_
->
start_
.
set_min_value
();
out_key_part
->
normal_keypart_
->
end_
.
set_max_value
();
}
else
{
out_key_part
->
normal_keypart_
->
start_
.
set_max_value
();
out_key_part
->
normal_keypart_
->
end_
.
set_min_value
();
}
out_key_part
->
id_
=
table_graph_
.
key_part_head_
->
id_
;
out_key_part
->
pos_
=
table_graph_
.
key_part_head_
->
pos_
;
}
return
ret
;
}
int
ObQueryRange
::
get_member_of_keyparts
(
const
common
::
ObObj
&
const_param
,
ObKeyPart
*&
out_key_part
,
const
ObDataTypeCastParams
&
dtc_params
)
{
int
ret
=
OB_SUCCESS
;
...
...
@@ -4004,10 +4035,11 @@ int ObQueryRange::get_member_of_keyparts(const common::ObObj &const_param, ObKey
if
(
OB_FAIL
(
ObKeyPart
::
try_cast_value
(
dtc_params
,
allocator_
,
out_key_part
->
pos_
,
cast_obj
,
cmp
)))
{
LOG_WARN
(
"failed to try cast value type"
,
K
(
ret
));
}
else
if
(
cmp
!=
0
)
{
if
(
OB_NOT_NULL
(
query_range_ctx_
))
{
if
(
OB_FAIL
(
set_normal_key_true_or_false
(
out_key_part
,
true
)))
{
LOG_WARN
(
"failed set normal key"
,
K
(
ret
));
}
else
if
(
OB_NOT_NULL
(
query_range_ctx_
))
{
query_range_ctx_
->
cur_expr_is_precise_
=
false
;
}
GET_ALWAYS_TRUE_OR_FALSE
(
true
,
out_key_part
);
}
else
if
(
OB_FAIL
(
get_domain_equal_keypart
(
cast_obj
,
cast_obj
,
*
out_key_part
)))
{
LOG_WARN
(
"get normal cmp keypart failed"
,
K
(
ret
));
}
...
...
src/sql/rewrite/ob_query_range.h
浏览文件 @
616d4b62
...
...
@@ -885,6 +885,7 @@ private:
int
connect_and_or_domain_keyparts
(
ObIArray
<
ObKeyPart
*>
&
key_parts
,
ObKeyPart
*&
out_key_part
,
ObExecContext
*
exec_ctx
,
const
ObDataTypeCastParams
&
dtc_params
,
bool
is_and_op
);
int
set_normal_key_true_or_false
(
ObKeyPart
*&
out_key_part
,
bool
is_always_true
);
int
get_member_of_keyparts
(
const
common
::
ObObj
&
const_param
,
ObKeyPart
*&
out_key_part
,
const
ObDataTypeCastParams
&
dtc_params
);
int
get_contain_or_overlaps_keyparts
(
const
common
::
ObObj
&
const_param
,
const
common
::
ObDomainOpType
op_type
,
ObIArray
<
ObKeyPart
*>
&
key_parts
,
ObKeyPart
*&
out_key_part
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录