Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
b9fc7921
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看板
提交
b9fc7921
编写于
4月 01, 2022
作者:
J
jh0
提交者:
LINGuanRen
4月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix user variable not do eval
上级
6cdf0345
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
13 deletion
+34
-13
src/share/system_variable/ob_system_variable_factory.h
src/share/system_variable/ob_system_variable_factory.h
+1
-1
src/sql/engine/subquery/ob_subplan_scan_op.cpp
src/sql/engine/subquery/ob_subplan_scan_op.cpp
+12
-0
src/sql/resolver/expr/ob_expr_info_flag.h
src/sql/resolver/expr/ob_expr_info_flag.h
+5
-3
src/sql/resolver/expr/ob_raw_expr_info_extractor.cpp
src/sql/resolver/expr/ob_raw_expr_info_extractor.cpp
+7
-2
unittest/sql/optimizer/test_optimizer_select.result
unittest/sql/optimizer/test_optimizer_select.result
+9
-7
未找到文件。
src/share/system_variable/ob_system_variable_factory.h
浏览文件 @
b9fc7921
...
...
@@ -1470,4 +1470,4 @@ private:
}
}
#endif //OCEANBASE_SHARE_SYSTEM_VARIABLE_OB_SYSTEM_VARIABLE_FACTORY_
\ No newline at end of file
#endif //OCEANBASE_SHARE_SYSTEM_VARIABLE_OB_SYSTEM_VARIABLE_FACTORY_
src/sql/engine/subquery/ob_subplan_scan_op.cpp
浏览文件 @
b9fc7921
...
...
@@ -55,6 +55,18 @@ int ObSubPlanScanOp::inner_get_next_row()
LOG_WARN
(
"get row from child failed"
,
K
(
ret
));
}
}
else
{
// eval child's output expr
// For some expression in the subquery, we must eval, even if it not output.
// e.g.
// select 1 from (select @a=3);
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
child_
->
get_spec
().
output_
.
count
();
i
++
)
{
ObExpr
*
expr
=
child_
->
get_spec
().
output_
[
i
];
ObDatum
*
datum
=
NULL
;
if
(
OB_FAIL
(
expr
->
eval
(
eval_ctx_
,
datum
)))
{
LOG_WARN
(
"expr evaluate failed"
,
K
(
ret
),
K
(
*
expr
));
}
}
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
MY_SPEC
.
projector_
.
count
();
i
+=
2
)
{
ObExpr
*
from
=
MY_SPEC
.
projector_
[
i
];
ObExpr
*
to
=
MY_SPEC
.
projector_
[
i
+
1
];
...
...
src/sql/resolver/expr/ob_expr_info_flag.h
浏览文件 @
b9fc7921
...
...
@@ -56,6 +56,7 @@ enum ObExprInfoFlag {
IS_VOLATILE_CONST
,
// the const expr may be altered by overwrite, non-const in execution.
IS_ORA_ROWSCN_EXPR
,
IS_VAR_EXPR
,
IS_ASSIGN_EXPR
,
IS_CONST_EXPR
,
// expression contains calculable expression
CNT_CONST_EXPR
,
// IS_CONST_EXPR and CNT_CONST_EXPR at most one is true
...
...
@@ -98,6 +99,7 @@ enum ObExprInfoFlag {
CNT_VOLATILE_CONST
,
CNT_ORA_ROWSCN_EXPR
,
CNT_VAR_EXPR
,
CNT_ASSIGN_EXPR
,
BE_USED
,
// expression has been applied
IS_SIMPLE_COND
,
// column = const
...
...
@@ -117,11 +119,11 @@ enum ObExprInfoFlag {
};
#define IS_INFO_MASK_BEGIN IS_CONST
#define IS_INFO_MASK_END IS_
VAR
_EXPR
#define IS_INFO_MASK_END IS_
ASSIGN
_EXPR
#define CNT_INFO_MASK_BEGIN CNT_CONST
#define CNT_INFO_MASK_END CNT_
VAR
_EXPR
#define CNT_INFO_MASK_END CNT_
ASSIGN
_EXPR
#define INHERIT_MASK_BEGIN CNT_CONST_EXPR
#define INHERIT_MASK_END CNT_
VAR
_EXPR
#define INHERIT_MASK_END CNT_
ASSIGN
_EXPR
inline
const
char
*
get_expr_info_flag_str
(
const
ObExprInfoFlag
flag
)
{
...
...
src/sql/resolver/expr/ob_raw_expr_info_extractor.cpp
浏览文件 @
b9fc7921
...
...
@@ -161,7 +161,8 @@ int ObRawExprInfoExtractor::add_const(ObRawExpr& expr)
T_FUN_SYS_ROWKEY_TO_ROWID
==
expr
.
get_expr_type
()
||
T_OP_CONNECT_BY_ROOT
==
expr
.
get_expr_type
()
||
T_FUN_SYS_CONNECT_BY_PATH
==
expr
.
get_expr_type
()
||
T_FUN_SYS_GUID
==
expr
.
get_expr_type
()
||
T_FUN_SYS_STMT_ID
==
expr
.
get_expr_type
()
||
T_FUN_SYS_SLEEP
==
expr
.
get_expr_type
()
||
T_OP_PRIOR
==
expr
.
get_expr_type
()
||
T_OP_GET_USER_VAR
==
expr
.
get_expr_type
()))
{
T_OP_ASSIGN
==
expr
.
get_expr_type
()
||
T_OP_PRIOR
==
expr
.
get_expr_type
()
||
T_OP_GET_USER_VAR
==
expr
.
get_expr_type
()))
{
is_const_expr
=
false
;
}
if
(
is_const_expr
)
{
...
...
@@ -233,7 +234,7 @@ bool ObRawExprInfoExtractor::not_calculable_expr(const ObRawExpr& expr)
expr
.
has_flag
(
CNT_ALIAS
)
||
expr
.
has_flag
(
CNT_ENUM_OR_SET
)
||
expr
.
has_flag
(
CNT_VALUES
)
||
expr
.
has_flag
(
CNT_SEQ_EXPR
)
||
expr
.
has_flag
(
CNT_SYS_CONNECT_BY_PATH
)
||
expr
.
has_flag
(
CNT_RAND_FUNC
)
||
expr
.
has_flag
(
CNT_SO_UDF
)
||
expr
.
has_flag
(
CNT_PRIOR
)
||
expr
.
has_flag
(
CNT_EXEC_PARAM
)
||
expr
.
has_flag
(
CNT_VOLATILE_CONST
)
||
expr
.
has_flag
(
CNT_VAR_EXPR
);
expr
.
has_flag
(
CNT_VOLATILE_CONST
)
||
expr
.
has_flag
(
CNT_VAR_EXPR
)
||
expr
.
has_flag
(
CNT_ASSIGN_EXPR
)
;
}
int
ObRawExprInfoExtractor
::
visit
(
ObOpRawExpr
&
expr
)
...
...
@@ -314,6 +315,10 @@ int ObRawExprInfoExtractor::visit(ObOpRawExpr& expr)
if
(
OB_FAIL
(
expr
.
add_flag
(
IS_OR
)))
{
LOG_WARN
(
"failed to add flag IS_OR"
,
K
(
ret
));
}
}
else
if
(
expr
.
get_expr_type
()
==
T_OP_ASSIGN
)
{
if
(
OB_FAIL
(
expr
.
add_flag
(
IS_ASSIGN_EXPR
)))
{
LOG_WARN
(
"failed to add flag IS_ASSIGN_EXPR"
,
K
(
ret
));
}
}
}
else
if
(
3
==
expr
.
get_param_count
())
{
// triple operator
...
...
unittest/sql/optimizer/test_optimizer_select.result
浏览文件 @
b9fc7921
...
...
@@ -19310,17 +19310,19 @@ Outputs & filters:
SQL: Select distinct 1, 1 + (@var:=1) from t7;
===================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------
|0 |TABLE SCAN|t7 |1 |36 |
===================================
======================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
--------------------------------------
|0 |HASH DISTINCT| |1 |122 |
|1 | TABLE SCAN |t7 |100 |88 |
======================================
Outputs & filters:
-------------------------------------
0 - output([?], [?]), filter(nil),
0 - output([?], [? + (T_OP_ASSIGN, 'var', ?)]), filter(nil),
distinct([? + (T_OP_ASSIGN, 'var', ?)])
1 - output([? + (T_OP_ASSIGN, 'var', ?)]), filter(nil),
access([t7.c1]), partitions(p0),
limit(1), offset(nil),
is_index_back=false,
range_key([t7.c1]), range(MIN ; MAX)always true
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录