Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Messij2001
oceanbase
提交
de99c9e0
O
oceanbase
项目概览
Messij2001
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
2
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,发现更多精彩内容 >>
提交
de99c9e0
编写于
10月 18, 2021
作者:
Z
zz0
提交者:
wangzelin.wzl
10月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some small bugs
上级
f335d5a1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
62 addition
and
21 deletion
+62
-21
src/sql/engine/expr/ob_expr_is.cpp
src/sql/engine/expr/ob_expr_is.cpp
+1
-1
src/sql/resolver/dml/ob_select_resolver.cpp
src/sql/resolver/dml/ob_select_resolver.cpp
+22
-15
src/sql/rewrite/ob_transform_groupby_placement.cpp
src/sql/rewrite/ob_transform_groupby_placement.cpp
+30
-4
src/sql/rewrite/ob_transform_utils.cpp
src/sql/rewrite/ob_transform_utils.cpp
+9
-1
未找到文件。
src/sql/engine/expr/ob_expr_is.cpp
浏览文件 @
de99c9e0
...
...
@@ -349,7 +349,7 @@ int ObExprIsNot::cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObEx
}
}
else
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"second param of is expr is not null, true
or false
"
,
K
(
ret
),
K
(
param2
->
get_value
()));
LOG_WARN
(
"second param of is expr is not null, true
, false or infinite or nan
"
,
K
(
ret
),
K
(
param2
->
get_value
()));
}
return
ret
;
}
...
...
src/sql/resolver/dml/ob_select_resolver.cpp
浏览文件 @
de99c9e0
...
...
@@ -4507,23 +4507,30 @@ int ObSelectResolver::resolve_column_ref_in_group_by(const ObQualifiedName& q_na
LOG_WARN
(
"select stmt is null"
);
}
else
if
(
!
is_oracle_mode
()
&&
q_name
.
parent_aggr_level_
<
current_level_
)
{
// the column don't located in aggregate function in having clause
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
select_stmt
->
get_group_expr_size
();
++
i
)
{
// resolve column refs from group by and rollup exprs
ObSEArray
<
ObRawExpr
*
,
16
>
group_and_rollup_exprs
;
if
(
OB_FAIL
(
append
(
group_and_rollup_exprs
,
select_stmt
->
get_group_exprs
())))
{
LOG_WARN
(
"failed to append group exprs"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
append
(
group_and_rollup_exprs
,
select_stmt
->
get_rollup_exprs
())))
{
LOG_WARN
(
"failed to append rollup exprs"
,
K
(
ret
));
}
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
group_and_rollup_exprs
.
count
();
++
i
)
{
bool
is_hit
=
false
;
ObRawExpr
*
group_
expr
=
NULL
;
ObColumnRefRawExpr
*
col_ref
=
NULL
;
if
(
OB_ISNULL
(
group_expr
=
select_stmt
->
get_group_exprs
()
.
at
(
i
)))
{
ObRawExpr
*
expr
=
NULL
;
ObColumnRefRawExpr
*
col_ref
=
NULL
;
if
(
OB_ISNULL
(
expr
=
group_and_rollup_exprs
.
at
(
i
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"
group expr is null"
);
}
else
if
(
group_
expr
->
is_column_ref_expr
())
{
col_ref
=
static_cast
<
ObColumnRefRawExpr
*>
(
group_expr
);
if
(
OB_FAIL
(
ObResolverUtils
::
check_column_name
(
session_info_
,
q_name
,
*
col_ref
,
is_hit
)))
{
LOG_WARN
(
"check column name failed"
,
K
(
ret
),
K
(
q_name
));
}
else
if
(
is_hit
)
{
if
(
NULL
==
real_ref_expr
)
{
real_ref_expr
=
col_ref
;
}
else
if
(
real_ref_expr
!=
col_ref
)
{
ret
=
OB_NON_UNIQ_ERROR
;
}
LOG_WARN
(
"
expr is null"
,
K
(
ret
)
);
}
else
if
(
!
expr
->
is_column_ref_expr
())
{
// do nothing
}
else
if
(
OB_FALSE_IT
(
col_ref
=
static_cast
<
ObColumnRefRawExpr
*>
(
expr
)))
{
}
else
if
(
OB_FAIL
(
ObResolverUtils
::
check_column_name
(
session_info_
,
q_name
,
*
col_ref
,
is_hit
)))
{
LOG_WARN
(
"check column name failed"
,
K
(
ret
),
K
(
q_name
));
}
else
if
(
is_hit
)
{
if
(
OB_ISNULL
(
real_ref_expr
))
{
real_ref_expr
=
col_ref
;
}
else
if
(
real_ref_expr
!=
col_ref
)
{
ret
=
OB_NON_UNIQ_ERROR
;
}
}
}
...
...
src/sql/rewrite/ob_transform_groupby_placement.cpp
浏览文件 @
de99c9e0
...
...
@@ -1015,10 +1015,36 @@ int ObTransformGroupByPlacement::push_down_group_by_into_view(ObSelectStmt* stmt
if
(
OB_ISNULL
(
expr
)
||
OB_UNLIKELY
(
!
expr
->
is_aggr_expr
()))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"aggr expr is null"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
sub_stmt
->
add_agg_item
(
static_cast
<
ObAggFunRawExpr
&>
(
*
expr
))))
{
LOG_WARN
(
"failed to add aggr item"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObTransformUtils
::
create_select_item
(
*
ctx_
->
allocator_
,
expr
,
sub_stmt
)))
{
LOG_WARN
(
"failed to add select item"
,
K
(
ret
));
}
else
{
ObSEArray
<
ObRawExpr
*
,
8
>
old_params
;
ObSEArray
<
ObRawExpr
*
,
8
>
new_params
;
ObRawExpr
*
old_param
=
NULL
;
ObRawExpr
*
new_param
=
NULL
;
for
(
uint8_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
expr
->
get_param_count
();
++
i
)
{
if
(
OB_ISNULL
(
old_param
=
expr
->
get_param_expr
(
i
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"expr param should not be null"
,
K
(
ret
),
K
(
*
expr
));
}
else
if
(
OB_FAIL
(
ObRawExprUtils
::
copy_expr
(
*
ctx_
->
expr_factory_
,
old_param
,
new_param
,
COPY_REF_DEFAULT
)))
{
LOG_WARN
(
"failed to copy expr"
,
K
(
ret
),
K
(
*
old_param
),
K
(
*
new_param
));
}
else
if
(
OB_ISNULL
(
new_param
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get unexpected null expr"
,
K
(
ret
),
K
(
*
old_param
),
K
(
*
new_param
));
}
else
if
(
OB_FAIL
(
old_params
.
push_back
(
old_param
)))
{
LOG_WARN
(
"failed to push pack old param"
,
K
(
ret
),
K
(
*
old_param
));
}
else
if
(
OB_FAIL
(
new_params
.
push_back
(
new_param
)))
{
LOG_WARN
(
"failed to push back new param"
,
K
(
ret
),
K
(
*
new_param
));
}
}
if
(
OB_FAIL
(
ret
))
{
}
else
if
(
OB_FAIL
(
ObTransformUtils
::
replace_expr
(
old_params
,
new_params
,
expr
)))
{
LOG_WARN
(
"failed to replace params"
,
K
(
ret
),
K
(
old_params
),
K
(
new_params
));
}
else
if
(
OB_FAIL
(
sub_stmt
->
add_agg_item
(
static_cast
<
ObAggFunRawExpr
&>
(
*
expr
))))
{
LOG_WARN
(
"failed to add aggr item"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
expr
->
formalize
(
ctx_
->
session_info_
)))
{
LOG_WARN
(
"failed to formalize expr"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObTransformUtils
::
create_select_item
(
*
ctx_
->
allocator_
,
expr
,
sub_stmt
)))
{
LOG_WARN
(
"failed to add select item"
,
K
(
ret
));
}
}
}
return
ret
;
...
...
src/sql/rewrite/ob_transform_utils.cpp
浏览文件 @
de99c9e0
...
...
@@ -7590,7 +7590,15 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt* select_stmt, ObRa
}
else
if
(
OB_FAIL
(
check_context
.
init
(
select_stmt
->
get_query_ctx
())))
{
LOG_WARN
(
"failed to init check context."
,
K
(
ret
));
}
else
{
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
expr
->
get_param_count
();
i
++
)
{
int64_t
param_cnt
=
expr
->
get_param_count
();
// only first param should be replaced (if needed) for T_OP_IS and T_OP_IS_NOT expr
// select null as aa group by aa having null is null;
// the first null in having exprs is allowed to be parameterized
// but the second null is not allowed
if
(
T_OP_IS
==
expr
->
get_expr_type
()
||
T_OP_IS_NOT
==
expr
->
get_expr_type
())
{
param_cnt
=
1
;
}
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
param_cnt
;
i
++
)
{
if
(
OB_FAIL
(
SMART_CALL
(
replace_with_groupby_exprs
(
select_stmt
,
expr
->
get_param_expr
(
i
)))))
{
LOG_WARN
(
"failed to replace with groupby columns."
,
K
(
ret
));
}
else
{
/*do nothing.*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录