Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
野花太放肆
oceanbase
提交
7b9fe433
O
oceanbase
项目概览
野花太放肆
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
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,发现更多精彩内容 >>
提交
7b9fe433
编写于
11月 29, 2021
作者:
L
ls0
提交者:
LINGuanRen
11月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implement expr benchmark in mysql mode
上级
f0e34e03
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
159 addition
and
1 deletion
+159
-1
deps/oblib/src/lib/ob_name_def.h
deps/oblib/src/lib/ob_name_def.h
+2
-0
src/sql/CMakeLists.txt
src/sql/CMakeLists.txt
+2
-0
src/sql/engine/expr/ob_expr_benchmark.cpp
src/sql/engine/expr/ob_expr_benchmark.cpp
+116
-0
src/sql/engine/expr/ob_expr_benchmark.h
src/sql/engine/expr/ob_expr_benchmark.h
+34
-0
src/sql/engine/expr/ob_expr_eval_functions.cpp
src/sql/engine/expr/ob_expr_eval_functions.cpp
+2
-1
src/sql/engine/expr/ob_expr_operator_factory.cpp
src/sql/engine/expr/ob_expr_operator_factory.cpp
+2
-0
src/sql/parser/ob_item_type.h
src/sql/parser/ob_item_type.h
+1
-0
未找到文件。
deps/oblib/src/lib/ob_name_def.h
浏览文件 @
7b9fe433
...
@@ -881,4 +881,6 @@
...
@@ -881,4 +881,6 @@
#define N_MULTI_VALUES_DESC "multi_values_desc"
#define N_MULTI_VALUES_DESC "multi_values_desc"
#define N_MULTI_VALUE_VECTORS "multi_value_vectors"
#define N_MULTI_VALUE_VECTORS "multi_value_vectors"
#define N_MULTI_INSERT_COL_CONV_FUNCS "multi_insert_col_conv_funcs"
#define N_MULTI_INSERT_COL_CONV_FUNCS "multi_insert_col_conv_funcs"
#define N_BENCHMARK "benchmark"
#endif // OCEANBASE_LIB_OB_NAME_DEF_H_
#endif // OCEANBASE_LIB_OB_NAME_DEF_H_
src/sql/CMakeLists.txt
浏览文件 @
7b9fe433
...
@@ -464,6 +464,8 @@ ob_set_subtarget(ob_sql engine
...
@@ -464,6 +464,8 @@ ob_set_subtarget(ob_sql engine
engine/expr/ob_expr_calc_urowid.cpp
engine/expr/ob_expr_calc_urowid.cpp
engine/expr/ob_expr_cardinality.cpp
engine/expr/ob_expr_cardinality.cpp
engine/expr/ob_expr_coll_pred.cpp
engine/expr/ob_expr_coll_pred.cpp
engine/expr/ob_expr_benchmark.cpp
engine/expr/ob_expr_benchmark.h
engine/join/ob_basic_nested_loop_join.cpp
engine/join/ob_basic_nested_loop_join.cpp
engine/join/ob_block_based_nested_loop_join.cpp
engine/join/ob_block_based_nested_loop_join.cpp
engine/join/ob_hash_join.cpp
engine/join/ob_hash_join.cpp
...
...
src/sql/engine/expr/ob_expr_benchmark.cpp
0 → 100644
浏览文件 @
7b9fe433
// (C) Copyright 2013-2016 Alibaba Inc. All Rights Reserved.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
// Version: $Id$
// Authors:
// peihan.dph@alibaba-inc.com
// Normalizer:
// peihan.dph@alibaba-inc.com
// This file is for implementation of func expr_benchmark
#define USING_LOG_PREFIX SQL_ENG
#include "sql/engine/expr/ob_expr_benchmark.h"
#include "sql/engine/ob_exec_context.h"
#include "sql/session/ob_sql_session_info.h"
#include "common/ob_smart_call.h"
namespace
oceanbase
{
using
namespace
common
;
namespace
sql
{
ObExprBenchmark
::
ObExprBenchmark
(
ObIAllocator
&
alloc
)
:
ObFuncExprOperator
(
alloc
,
T_FUN_SYS_BENCHMARK
,
N_BENCHMARK
,
2
,
NOT_ROW_DIMENSION
)
{}
int
ObExprBenchmark
::
calc_result_type2
(
ObExprResType
&
type
,
ObExprResType
&
type1
,
ObExprResType
&
type2
,
ObExprTypeCtx
&
type_ctx
)
const
{
int
ret
=
OB_SUCCESS
;
UNUSED
(
type2
);
UNUSED
(
type_ctx
);
type
.
set_int32
();
type1
.
set_calc_type
(
ObIntType
);
return
ret
;
}
int
ObExprBenchmark
::
calc_result2
(
ObObj
&
res
,
const
ObObj
&
obj1
,
const
ObObj
&
obj2
,
ObExprCtx
&
expr_ctx
)
const
{
UNUSED
(
res
);
UNUSED
(
obj1
);
UNUSED
(
obj2
);
UNUSED
(
expr_ctx
);
int
ret
=
OB_NOT_SUPPORTED
;
LOG_WARN
(
"expr benchmark is not implemented in old engine"
,
K
(
ret
));
return
ret
;
}
int
ObExprBenchmark
::
cg_expr
(
ObExprCGCtx
&
expr_cg_ctx
,
const
ObRawExpr
&
raw_expr
,
ObExpr
&
rt_expr
)
const
{
int
ret
=
OB_SUCCESS
;
UNUSED
(
raw_expr
);
UNUSED
(
expr_cg_ctx
);
CK
(
2
==
rt_expr
.
arg_cnt_
);
if
(
GET_MIN_CLUSTER_VERSION
()
<
CLUSTER_VERSION_3100
)
{
ret
=
OB_NOT_SUPPORTED
;
LOG_WARN
(
"expr benchmark is not implemented"
,
K
(
ret
));
}
else
{
rt_expr
.
eval_func_
=
ObExprBenchmark
::
eval_benchmark
;
}
return
ret
;
}
int
ObExprBenchmark
::
eval_benchmark
(
const
ObExpr
&
expr
,
ObEvalCtx
&
ctx
,
ObDatum
&
expr_datum
)
{
int
ret
=
OB_SUCCESS
;
ObDatum
*
loop_count
;
if
(
OB_FAIL
(
expr
.
args_
[
0
]
->
eval
(
ctx
,
loop_count
)))
{
LOG_WARN
(
"failed to eval loop count"
,
K
(
ret
));
}
else
if
(
loop_count
->
is_null
()
||
loop_count
->
get_int
()
<
0
)
{
expr_datum
.
set_null
();
if
(
!
loop_count
->
is_null
()
&&
loop_count
->
get_int
()
<
0
)
{
LOG_WARN
(
"Incorrect count value for function benchmark"
,
K
(
loop_count
->
get_int
()));
}
}
else
{
ObArray
<
ObExpr
*>
exprs_to_clear
;
int64_t
loops
=
loop_count
->
get_int
();
ObDatum
*
tmp_datum
=
nullptr
;
if
(
OB_FAIL
(
collect_exprs
(
exprs_to_clear
,
expr
,
ctx
)))
{
LOG_WARN
(
"failed to collect expr"
,
K
(
ret
));
}
else
{
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
loops
&&
OB_SUCC
(
THIS_WORKER
.
check_status
());
++
i
)
{
clear_all_flags
(
exprs_to_clear
,
ctx
);
OZ
(
expr
.
args_
[
1
]
->
eval
(
ctx
,
tmp_datum
));
}
}
expr_datum
.
set_int32
(
0
);
exprs_to_clear
.
destroy
();
}
return
ret
;
}
int
ObExprBenchmark
::
collect_exprs
(
common
::
ObIArray
<
ObExpr
*>
&
exprs
,
const
ObExpr
&
root_expr
,
ObEvalCtx
&
ctx
)
{
int
ret
=
OB_SUCCESS
;
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
root_expr
.
arg_cnt_
;
++
i
)
{
ObEvalInfo
&
eval_flag
=
root_expr
.
args_
[
i
]
->
get_eval_info
(
ctx
);
if
(
!
eval_flag
.
evaluated_
)
{
OZ
(
exprs
.
push_back
(
root_expr
.
args_
[
i
]));
OZ
(
SMART_CALL
(
collect_exprs
(
exprs
,
*
root_expr
.
args_
[
i
],
ctx
)));
}
}
return
ret
;
}
void
ObExprBenchmark
::
clear_all_flags
(
common
::
ObIArray
<
ObExpr
*>
&
exprs
,
ObEvalCtx
&
ctx
)
{
for
(
int64_t
i
=
0
;
i
<
exprs
.
count
();
++
i
)
{
ObEvalInfo
&
eval_flag
=
exprs
.
at
(
i
)
->
get_eval_info
(
ctx
);
eval_flag
.
clear_evaluated_flag
();
}
}
}
// end namespace sql
}
// end namespace oceanbase
\ No newline at end of file
src/sql/engine/expr/ob_expr_benchmark.h
0 → 100644
浏览文件 @
7b9fe433
// Copyright 2010-2016 Alibaba Inc. All Rights Reserved.
// Author:
// peihan.dph@alibaba-inc.com
// Normalizer:
// peihan.dph@alibaba-inc.com
//
// This file defines implementation for benchmark operator
#ifndef OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_BENCHMARK_
#define OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_BENCHMARK_
#include "sql/engine/expr/ob_expr_operator.h"
namespace
oceanbase
{
namespace
sql
{
class
ObExprBenchmark
:
public
ObFuncExprOperator
{
public:
explicit
ObExprBenchmark
(
common
::
ObIAllocator
&
alloc
);
virtual
~
ObExprBenchmark
(){};
virtual
int
calc_result_type2
(
ObExprResType
&
type
,
ObExprResType
&
type1
,
ObExprResType
&
type2
,
ObExprTypeCtx
&
type_ctx
)
const
;
virtual
int
calc_result2
(
ObObj
&
res
,
const
ObObj
&
obj1
,
const
ObObj
&
obj2
,
ObExprCtx
&
expr_ctx
)
const
;
virtual
int
cg_expr
(
ObExprCGCtx
&
expr_cg_ctx
,
const
ObRawExpr
&
raw_expr
,
ObExpr
&
rt_expr
)
const
;
static
int
eval_benchmark
(
const
ObExpr
&
expr
,
ObEvalCtx
&
ctx
,
ObDatum
&
expr_datum
);
private:
static
int
collect_exprs
(
common
::
ObIArray
<
ObExpr
*>
&
exprs
,
const
ObExpr
&
root_expr
,
ObEvalCtx
&
ctx
);
static
void
clear_all_flags
(
common
::
ObIArray
<
ObExpr
*>
&
exprs
,
ObEvalCtx
&
ctx
);
DISALLOW_COPY_AND_ASSIGN
(
ObExprBenchmark
);
};
}
// namespace sql
}
// namespace oceanbase
#endif
/* OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_BENCHMARK_ */
src/sql/engine/expr/ob_expr_eval_functions.cpp
浏览文件 @
7b9fe433
...
@@ -187,6 +187,7 @@
...
@@ -187,6 +187,7 @@
#include "ob_expr_degrees.h"
#include "ob_expr_degrees.h"
#include "ob_expr_weight_string.h"
#include "ob_expr_weight_string.h"
#include "ob_expr_any_value.h"
#include "ob_expr_any_value.h"
#include "ob_expr_benchmark.h"
namespace
oceanbase
{
namespace
oceanbase
{
using
namespace
common
;
using
namespace
common
;
...
@@ -709,7 +710,7 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = {
...
@@ -709,7 +710,7 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = {
NULL
,
/* 446 */
NULL
,
/* 446 */
NULL
,
/* 447 */
NULL
,
/* 447 */
NULL
,
/* 448 */
NULL
,
/* 448 */
NULL
,
/* 449 */
ObExprBenchmark
::
eval_benchmark
,
/* 449 */
ObExprExportSet
::
eval_export_set
,
/* 450 */
ObExprExportSet
::
eval_export_set
,
/* 450 */
ObExprInet6Aton
::
calc_inet6_aton
,
/* 451 */
ObExprInet6Aton
::
calc_inet6_aton
,
/* 451 */
ObExprIsIpv4
::
calc_is_ipv4
,
/* 452 */
ObExprIsIpv4
::
calc_is_ipv4
,
/* 452 */
...
...
src/sql/engine/expr/ob_expr_operator_factory.cpp
浏览文件 @
7b9fe433
...
@@ -271,6 +271,7 @@
...
@@ -271,6 +271,7 @@
#include "sql/engine/expr/ob_expr_degrees.h"
#include "sql/engine/expr/ob_expr_degrees.h"
#include "sql/engine/expr/ob_expr_weight_string.h"
#include "sql/engine/expr/ob_expr_weight_string.h"
#include "sql/engine/expr/ob_expr_any_value.h"
#include "sql/engine/expr/ob_expr_any_value.h"
#include "sql/engine/expr/ob_expr_benchmark.h"
using
namespace
oceanbase
::
common
;
using
namespace
oceanbase
::
common
;
namespace
oceanbase
{
namespace
oceanbase
{
...
@@ -683,6 +684,7 @@ void ObExprOperatorFactory::register_expr_operators()
...
@@ -683,6 +684,7 @@ void ObExprOperatorFactory::register_expr_operators()
REG_OP
(
ObExprTimestamp
);
REG_OP
(
ObExprTimestamp
);
REG_OP
(
ObExprDegrees
);
REG_OP
(
ObExprDegrees
);
REG_OP
(
ObExprWeightString
);
REG_OP
(
ObExprWeightString
);
REG_OP
(
ObExprBenchmark
);
// register oracle system function
// register oracle system function
REG_OP_ORCL
(
ObExprSysConnectByPath
);
REG_OP_ORCL
(
ObExprSysConnectByPath
);
REG_OP_ORCL
(
ObExprTimestampNvl
);
REG_OP_ORCL
(
ObExprTimestampNvl
);
...
...
src/sql/parser/ob_item_type.h
浏览文件 @
7b9fe433
...
@@ -428,6 +428,7 @@ typedef enum ObItemType {
...
@@ -428,6 +428,7 @@ typedef enum ObItemType {
T_FUN_SYS_PI
=
713
,
T_FUN_SYS_PI
=
713
,
T_FUN_SYS_ANY_VALUE
=
714
,
T_FUN_SYS_ANY_VALUE
=
714
,
T_FUN_SYS_DEGREES
=
715
,
T_FUN_SYS_DEGREES
=
715
,
T_FUN_SYS_BENCHMARK
=
720
,
T_FUN_SYS_EXPORT_SET
=
721
,
T_FUN_SYS_EXPORT_SET
=
721
,
T_FUN_SYS_INET6NTOA
=
722
,
T_FUN_SYS_INET6NTOA
=
722
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录