Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
5af4cb27
O
oceanbase
项目概览
Metz
/
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,发现更多精彩内容 >>
提交
5af4cb27
编写于
6月 25, 2022
作者:
W
wangt1xiuyi
提交者:
wangzelin.wzl
6月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] [CP] [CP] fix aggr convert lost origin result type
上级
f4df995a
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
77 addition
and
65 deletion
+77
-65
src/sql/optimizer/ob_raw_expr_pull_up_aggr_expr.cpp
src/sql/optimizer/ob_raw_expr_pull_up_aggr_expr.cpp
+8
-2
src/sql/rewrite/ob_expand_aggregate_utils.cpp
src/sql/rewrite/ob_expand_aggregate_utils.cpp
+7
-1
src/sql/rewrite/ob_expand_aggregate_utils.h
src/sql/rewrite/ob_expand_aggregate_utils.h
+1
-1
unittest/sql/optimizer/test_optimizer_select.result
unittest/sql/optimizer/test_optimizer_select.result
+1
-1
unittest/sql/optimizer/test_optimizer_topk.result
unittest/sql/optimizer/test_optimizer_topk.result
+60
-60
未找到文件。
src/sql/optimizer/ob_raw_expr_pull_up_aggr_expr.cpp
浏览文件 @
5af4cb27
...
...
@@ -280,8 +280,14 @@ int ObRawExprPullUpAggrExpr::visit(ObAggFunRawExpr& expr)
LOG_WARN
(
"failed to set esitmate_ndv param"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
new_expr
->
formalize
(
session_info_
)))
{
LOG_WARN
(
"failed to formalize estimate_ndv function"
,
K
(
ret
));
}
else
{
// do nothing
}
else
if
(
expr
.
get_result_type
()
!=
new_expr_
->
get_result_type
()
&&
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
expr_factory_
,
new_expr_
,
expr
.
get_result_type
(),
new_expr
,
session_info_
)))
{
LOG_WARN
(
"create cast expr failed"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
new_expr_
=
new_expr
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"expr is null"
,
K_
(
new_expr
),
K
(
ret
));
}
else
{
/*do nothing*/
}
}
}
...
...
src/sql/rewrite/ob_expand_aggregate_utils.cpp
浏览文件 @
5af4cb27
...
...
@@ -78,6 +78,9 @@ int ObExpandAggregateUtils::expand_aggr_expr(ObDMLStmt* stmt, ObTransformerCtx*
LOG_WARN
(
"get unexpected error"
,
K
(
ret
),
K
(
replace_expr
),
K
(
aggr_expr
->
get_expr_type
()));
}
else
if
(
OB_FAIL
(
replace_expr
->
formalize
(
ctx
->
session_info_
)))
{
LOG_WARN
(
"failed to formalize"
,
K
(
ret
));
}
else
if
(
aggr_expr
->
get_result_type
()
!=
replace_expr
->
get_result_type
()
&&
OB_FAIL
(
add_cast_expr
(
ctx
,
replace_expr
,
aggr_expr
->
get_result_type
(),
replace_expr
)))
{
LOG_WARN
(
"failed to add cast expr"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
replace_expr
->
pull_relation_id_and_levels
(
stmt
->
get_current_level
())))
{
LOG_WARN
(
"failed to pull relation id and levels"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
replace_exprs
.
push_back
(
replace_expr
)))
{
...
...
@@ -150,6 +153,9 @@ int ObExpandAggregateUtils::expand_window_aggr_expr(ObDMLStmt* stmt, ObTransform
LOG_WARN
(
"get unexpected error"
,
K
(
ret
),
K
(
replace_expr
),
K
(
win_expr
->
get_agg_expr
()
->
get_expr_type
()));
}
else
if
(
OB_FAIL
(
replace_expr
->
formalize
(
ctx
->
session_info_
)))
{
LOG_WARN
(
"failed to formalize"
,
K
(
ret
));
}
else
if
(
win_expr
->
get_agg_expr
()
->
get_result_type
()
!=
replace_expr
->
get_result_type
()
&&
OB_FAIL
(
add_cast_expr
(
ctx
,
replace_expr
,
win_expr
->
get_agg_expr
()
->
get_result_type
(),
replace_expr
)))
{
LOG_WARN
(
"failed to add cast expr"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObRawExprUtils
::
process_window_complex_agg_expr
(
*
ctx
->
expr_factory_
,
replace_expr
->
get_expr_type
(),
win_expr
,
replace_expr
,
&
new_win_exprs
)))
{
LOG_WARN
(
"failed to process window complex agg expr"
,
K
(
ret
));
...
...
@@ -1769,7 +1775,7 @@ int ObExpandAggregateUtils::expand_stddev_samp_expr(ObTransformerCtx* ctx, ObAgg
}
int
ObExpandAggregateUtils
::
add_cast_expr
(
ObTransformerCtx
*
ctx
,
ObRawExpr
*
expr
,
ObExprResType
&
dst_type
,
ObRawExpr
*&
new_expr
)
ObTransformerCtx
*
ctx
,
ObRawExpr
*
expr
,
const
ObExprResType
&
dst_type
,
ObRawExpr
*&
new_expr
)
{
int
ret
=
OB_SUCCESS
;
ObSysFunRawExpr
*
cast_expr
=
NULL
;
...
...
src/sql/rewrite/ob_expand_aggregate_utils.h
浏览文件 @
5af4cb27
...
...
@@ -139,7 +139,7 @@ private:
static
int
expand_stddev_samp_expr
(
ObTransformerCtx
*
ctx
,
ObAggFunRawExpr
*
aggr_expr
,
ObRawExpr
*&
replace_expr
,
ObIArray
<
ObAggFunRawExpr
*>&
new_aggr_items
);
static
int
add_cast_expr
(
ObTransformerCtx
*
ctx
,
ObRawExpr
*
expr
,
ObExprResType
&
dst_type
,
ObRawExpr
*&
new_expr
);
static
int
add_cast_expr
(
ObTransformerCtx
*
ctx
,
ObRawExpr
*
expr
,
const
ObExprResType
&
dst_type
,
ObRawExpr
*&
new_expr
);
static
int
add_win_exprs
(
ObSelectStmt
*
select_stmt
,
ObIArray
<
ObRawExpr
*>&
replace_exprs
,
ObIArray
<
ObWinFunRawExpr
*>&
new_win_exprs
);
...
...
unittest/sql/optimizer/test_optimizer_select.result
浏览文件 @
5af4cb27
...
...
@@ -19819,7 +19819,7 @@ SQL: select avg(1) from t1;
Outputs & filters:
-------------------------------------
0 - output([
T_FUN_SUM(T_FUN_SUM(?)) / T_FUN_COUNT_SUM(T_FUN_COUNT(?
))]), filter(nil),
0 - output([
cast(T_FUN_SUM(T_FUN_SUM(?)) / T_FUN_COUNT_SUM(T_FUN_COUNT(?)), DECIMAL(5, 4
))]), filter(nil),
group(nil), agg_func([T_FUN_SUM(T_FUN_SUM(?))], [T_FUN_COUNT_SUM(T_FUN_COUNT(?))])
1 - output([T_FUN_SUM(?)], [T_FUN_COUNT(?)]), filter(nil)
2 - output([T_FUN_SUM(?)], [T_FUN_COUNT(?)]), filter(nil), dop=1
unittest/sql/optimizer/test_optimizer_topk.result
浏览文件 @
5af4cb27
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录