Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
clmforever
oceanbase
提交
8a519477
O
oceanbase
项目概览
clmforever
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
8a519477
编写于
7月 29, 2021
作者:
L
ls0
提交者:
wangzelin.wzl
7月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix merge group by overwrite T_QUESTIONMARK leads div core
上级
2614023c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
13 deletion
+38
-13
src/sql/engine/basic/ob_chunk_datum_store.h
src/sql/engine/basic/ob_chunk_datum_store.h
+28
-3
src/sql/engine/join/ob_hash_join_op.cpp
src/sql/engine/join/ob_hash_join_op.cpp
+7
-5
src/sql/engine/join/ob_hash_join_op.h
src/sql/engine/join/ob_hash_join_op.h
+2
-4
src/sql/optimizer/ob_logical_operator.cpp
src/sql/optimizer/ob_logical_operator.cpp
+1
-1
未找到文件。
src/sql/engine/basic/ob_chunk_datum_store.h
浏览文件 @
8a519477
...
@@ -120,7 +120,13 @@ public:
...
@@ -120,7 +120,13 @@ public:
template
<
typename
T
=
ObChunkDatumStore
::
StoredRow
>
template
<
typename
T
=
ObChunkDatumStore
::
StoredRow
>
class
LastStoredRow
{
class
LastStoredRow
{
public:
public:
LastStoredRow
(
ObIAllocator
&
alloc
)
:
store_row_
(
nullptr
),
alloc_
(
alloc
),
max_size_
(
0
),
reuse_
(
false
)
LastStoredRow
(
ObIAllocator
&
alloc
)
:
store_row_
(
nullptr
),
alloc_
(
alloc
),
max_size_
(
0
),
reuse_
(
false
),
pre_alloc_row1_
(
nullptr
),
pre_alloc_row2_
(
nullptr
)
{}
{}
~
LastStoredRow
()
~
LastStoredRow
()
{}
{}
...
@@ -141,17 +147,31 @@ public:
...
@@ -141,17 +147,31 @@ public:
int64_t
head_size
=
sizeof
(
T
);
int64_t
head_size
=
sizeof
(
T
);
reuse
=
OB_ISNULL
(
store_row_
)
?
false
:
reuse
&&
(
max_size_
>=
row_size
+
head_size
+
extra_size
);
reuse
=
OB_ISNULL
(
store_row_
)
?
false
:
reuse
&&
(
max_size_
>=
row_size
+
head_size
+
extra_size
);
if
(
reuse
&&
OB_NOT_NULL
(
store_row_
))
{
if
(
reuse
&&
OB_NOT_NULL
(
store_row_
))
{
// switch buffer for write
store_row_
=
(
store_row_
==
pre_alloc_row1_
?
pre_alloc_row2_
:
pre_alloc_row1_
);
buf
=
reinterpret_cast
<
char
*>
(
store_row_
);
buf
=
reinterpret_cast
<
char
*>
(
store_row_
);
new_row
=
store_row_
;
new_row
=
store_row_
;
buffer_len
=
max_size_
;
buffer_len
=
max_size_
;
}
else
{
}
else
{
// alloc 2 buffer with same length
buffer_len
=
(
!
reuse_
?
row_size
:
row_size
*
2
)
+
head_size
+
extra_size
;
buffer_len
=
(
!
reuse_
?
row_size
:
row_size
*
2
)
+
head_size
+
extra_size
;
if
(
OB_ISNULL
(
buf
=
reinterpret_cast
<
char
*>
(
alloc_
.
alloc
(
buffer_len
))))
{
char
*
buf1
=
nullptr
;
char
*
buf2
=
nullptr
;
if
(
OB_ISNULL
(
buf1
=
reinterpret_cast
<
char
*>
(
alloc_
.
alloc
(
buffer_len
))))
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
SQL_ENG_LOG
(
ERROR
,
"alloc buf failed"
,
K
(
ret
));
SQL_ENG_LOG
(
ERROR
,
"alloc buf failed"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
new_row
=
new
(
buf
)
T
()))
{
}
else
if
(
OB_ISNULL
(
buf2
=
reinterpret_cast
<
char
*>
(
alloc_
.
alloc
(
buffer_len
))))
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
SQL_ENG_LOG
(
ERROR
,
"alloc buf failed"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
pre_alloc_row1_
=
new
(
buf1
)
T
()))
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
SQL_ENG_LOG
(
ERROR
,
"failed to new row"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
pre_alloc_row2_
=
new
(
buf2
)
T
()))
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
SQL_ENG_LOG
(
ERROR
,
"failed to new row"
,
K
(
ret
));
SQL_ENG_LOG
(
ERROR
,
"failed to new row"
,
K
(
ret
));
}
else
{
buf
=
buf1
;
new_row
=
pre_alloc_row1_
;
}
}
}
}
if
(
OB_SUCC
(
ret
))
{
if
(
OB_SUCC
(
ret
))
{
...
@@ -221,6 +241,11 @@ public:
...
@@ -221,6 +241,11 @@ public:
ObIAllocator
&
alloc_
;
ObIAllocator
&
alloc_
;
int64_t
max_size_
;
int64_t
max_size_
;
bool
reuse_
;
bool
reuse_
;
private:
// To avoid writing memory overwrite, alloc 2 row for alternate writing
T
*
pre_alloc_row1_
;
T
*
pre_alloc_row2_
;
};
};
template
<
typename
T
=
ObChunkDatumStore
::
StoredRow
>
template
<
typename
T
=
ObChunkDatumStore
::
StoredRow
>
...
...
src/sql/engine/join/ob_hash_join_op.cpp
浏览文件 @
8a519477
...
@@ -1561,15 +1561,13 @@ void ObHashJoinOp::calc_cache_aware_partition_count()
...
@@ -1561,15 +1561,13 @@ void ObHashJoinOp::calc_cache_aware_partition_count()
int64_t
tmp_partition_cnt_per_level
=
max_partition_count_per_level_
;
int64_t
tmp_partition_cnt_per_level
=
max_partition_count_per_level_
;
if
(
total_partition_cnt
>
tmp_partition_cnt_per_level
)
{
if
(
total_partition_cnt
>
tmp_partition_cnt_per_level
)
{
level1_part_count_
=
part_count_
;
level1_part_count_
=
part_count_
;
OB_ASSERT
(
0
!=
level1_part_count_
);
level1_bit_
=
(
0
==
level1_part_count_
)
?
0
:
__builtin_ctz
(
level1_part_count_
);
level1_bit_
=
__builtin_ctz
(
level1_part_count_
);
level2_part_count_
=
total_partition_cnt
/
level1_part_count_
;
level2_part_count_
=
total_partition_cnt
/
level1_part_count_
;
level2_part_count_
=
level2_part_count_
=
level2_part_count_
>
tmp_partition_cnt_per_level
?
tmp_partition_cnt_per_level
:
level2_part_count_
;
level2_part_count_
>
tmp_partition_cnt_per_level
?
tmp_partition_cnt_per_level
:
level2_part_count_
;
}
else
{
}
else
{
level1_part_count_
=
total_partition_cnt
>
part_count_
?
total_partition_cnt
:
part_count_
;
level1_part_count_
=
total_partition_cnt
>
part_count_
?
total_partition_cnt
:
part_count_
;
OB_ASSERT
(
0
!=
level1_part_count_
);
level1_bit_
=
(
0
==
level1_part_count_
)
?
0
:
__builtin_ctz
(
level1_part_count_
);
level1_bit_
=
__builtin_ctz
(
level1_part_count_
);
}
}
LOG_TRACE
(
"partition count"
,
LOG_TRACE
(
"partition count"
,
K
(
total_partition_cnt
),
K
(
total_partition_cnt
),
...
@@ -2758,7 +2756,11 @@ int ObHashJoinOp::get_next_probe_partition()
...
@@ -2758,7 +2756,11 @@ int ObHashJoinOp::get_next_probe_partition()
}
else
{
}
else
{
// two level
// two level
OB_ASSERT
(
0
!=
level2_part_count_
);
OB_ASSERT
(
0
!=
level2_part_count_
);
int64_t
level1_part_idx
=
(
cur_full_right_partition_
>>
(
__builtin_ctz
(
level2_part_count_
)));
int64_t
leading_zero
=
0
;
if
(
0
!=
level2_part_count_
)
{
leading_zero
=
__builtin_ctz
(
level2_part_count_
);
}
int64_t
level1_part_idx
=
(
cur_full_right_partition_
>>
(
leading_zero
));
if
(
level1_part_idx
<
dump_part_count
)
{
if
(
level1_part_idx
<
dump_part_count
)
{
cur_left_hist_
=
&
part_histograms_
[
cur_full_right_partition_
];
cur_left_hist_
=
&
part_histograms_
[
cur_full_right_partition_
];
break
;
break
;
...
...
src/sql/engine/join/ob_hash_join_op.h
浏览文件 @
8a519477
...
@@ -307,13 +307,11 @@ private:
...
@@ -307,13 +307,11 @@ private:
void
set_part_count
(
int64_t
part_shift
,
int64_t
level1_part_count
,
int64_t
level2_part_count
)
void
set_part_count
(
int64_t
part_shift
,
int64_t
level1_part_count
,
int64_t
level2_part_count
)
{
{
OB_ASSERT
(
0
!=
level1_part_count
);
OB_ASSERT
(
0
!=
level2_part_count
);
part_shift_
=
part_shift
;
part_shift_
=
part_shift
;
level_one_part_count_
=
level1_part_count
;
level_one_part_count_
=
level1_part_count
;
level_two_part_count_
=
level2_part_count
;
level_two_part_count_
=
level2_part_count
;
level1_bit_
=
__builtin_ctz
(
level1_part_count
);
level1_bit_
=
(
0
==
level1_part_count
)
?
0
:
__builtin_ctz
(
level1_part_count
);
level2_bit_
=
__builtin_ctz
(
level2_part_count
);
level2_bit_
=
(
0
==
level2_part_count
)
?
0
:
__builtin_ctz
(
level2_part_count
);
}
}
bool
is_valid
()
bool
is_valid
()
{
{
...
...
src/sql/optimizer/ob_logical_operator.cpp
浏览文件 @
8a519477
...
@@ -1507,7 +1507,7 @@ int ObLogicalOperator::do_pre_traverse_operation(const TraverseOp& op, void* ctx
...
@@ -1507,7 +1507,7 @@ int ObLogicalOperator::do_pre_traverse_operation(const TraverseOp& op, void* ctx
// select /*+NO_REWRITE*/ count(*) from t1 group by 1 + (select 1 > all (select 0));
// select /*+NO_REWRITE*/ count(*) from t1 group by 1 + (select 1 > all (select 0));
//
//
if
((
*
e
)
->
has_const_or_const_expr_flag
()
&&
!
(
*
e
)
->
has_flag
(
CNT_VOLATILE_CONST
)
&&
if
((
*
e
)
->
has_const_or_const_expr_flag
()
&&
!
(
*
e
)
->
has_flag
(
CNT_VOLATILE_CONST
)
&&
!
(
*
e
)
->
has_flag
(
IS
_EXEC_PARAM
))
{
!
(
*
e
)
->
has_flag
(
CNT
_EXEC_PARAM
))
{
ObRawExpr
*
remove_const_expr
=
NULL
;
ObRawExpr
*
remove_const_expr
=
NULL
;
OZ
(
ObRawExprUtils
::
build_remove_const_expr
(
OZ
(
ObRawExprUtils
::
build_remove_const_expr
(
get_plan
()
->
get_optimizer_context
().
get_expr_factory
(),
*
session
,
*
e
,
remove_const_expr
));
get_plan
()
->
get_optimizer_context
().
get_expr_factory
(),
*
session
,
*
e
,
remove_const_expr
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录