Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
1eaee035
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,发现更多精彩内容 >>
提交
1eaee035
编写于
7月 04, 2022
作者:
O
obdev
提交者:
linzhigang.lzg
7月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fix bug for opensouce
上级
649f70df
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
120 addition
and
75 deletion
+120
-75
src/sql/engine/basic/ob_chunk_row_store.cpp
src/sql/engine/basic/ob_chunk_row_store.cpp
+10
-1
src/sql/engine/expr/ob_datum_cast.cpp
src/sql/engine/expr/ob_datum_cast.cpp
+96
-65
src/sql/engine/expr/ob_expr_div.cpp
src/sql/engine/expr/ob_expr_div.cpp
+10
-5
src/sql/engine/expr/ob_expr_nvl_promotion.map
src/sql/engine/expr/ob_expr_nvl_promotion.map
+3
-3
src/sql/engine/expr/ob_expr_quote.cpp
src/sql/engine/expr/ob_expr_quote.cpp
+1
-1
未找到文件。
src/sql/engine/basic/ob_chunk_row_store.cpp
浏览文件 @
1eaee035
...
...
@@ -980,7 +980,7 @@ int ObChunkRowStore::load_next_chunk_blocks(ChunkIterator& it)
LOG_DEBUG
(
"load chunk"
,
KP
(
last_blk_end
),
K_
(
it
.
cur_iter_blk_
->
blk_size
),
KP
(
chunk_end
),
K
(
chunk_end
-
last_blk_end
));
if
(
chunk_end
>
last_blk_end
)
{
MEM
CPY
(
it
.
chunk_mem_
,
last_blk_end
,
chunk_end
-
last_blk_end
);
MEM
MOVE
(
it
.
chunk_mem_
,
last_blk_end
,
chunk_end
-
last_blk_end
);
read_off
+=
chunk_end
-
last_blk_end
;
}
}
...
...
@@ -1103,6 +1103,10 @@ int ObChunkRowStore::load_next_block(ChunkIterator& it)
}
else
if
(
it
.
cur_nth_blk_
<
-
1
||
it
.
cur_nth_blk_
>=
n_blocks_
)
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"row should be saved"
,
K
(
ret
),
K_
(
it
.
cur_nth_blk
),
K_
(
n_blocks
));
}
else
if
(
it
.
chunk_read_size_
>
ObChunkRowStore
::
BLOCK_SIZE
&&
it
.
chunk_read_size_
<
this
->
max_blk_size_
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get unexpected read size"
,
K
(
ret
),
K
(
it
.
chunk_read_size_
),
K
(
this
->
max_blk_size_
));
}
else
if
(
is_file_open
()
&&
!
it
.
read_file_iter_end
())
{
if
(
it
.
chunk_read_size_
>
0
&&
it
.
chunk_read_size_
>=
this
->
max_blk_size_
)
{
if
(
OB_FAIL
(
load_next_chunk_blocks
(
it
)))
{
...
...
@@ -1351,6 +1355,11 @@ int ObChunkRowStore::ChunkIterator::init(ObChunkRowStore* store, int64_t chunk_r
int
ret
=
OB_SUCCESS
;
store_
=
store
;
chunk_read_size_
=
chunk_read_size
;
CK
(
is_valid
());
if
(
OB_SUCC
(
ret
)
&&
chunk_read_size
>
ObChunkRowStore
::
BLOCK_SIZE
&&
chunk_read_size
<
store_
->
max_blk_size_
)
{
chunk_read_size_
=
store_
->
max_blk_size_
;
}
return
ret
;
}
...
...
src/sql/engine/expr/ob_datum_cast.cpp
浏览文件 @
1eaee035
...
...
@@ -2327,8 +2327,11 @@ CAST_FUNC_NAME(number, double)
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
const
number
::
ObNumber
nmb
(
child_res
->
get_number
());
const
char
*
nmb_buf
=
nmb
.
format
();
const
char
*
nmb_buf
=
nmb
.
format
();
if
(
OB_ISNULL
(
nmb_buf
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"nmb_buf is NULL"
,
K
(
ret
));
...
...
@@ -2340,6 +2343,7 @@ CAST_FUNC_NAME(number, double)
}
}
}
}
return
ret
;
}
...
...
@@ -5277,105 +5281,130 @@ int uint_to_set(const uint64_t input_value, const ObIArray<ObString>& str_values
CAST_ENUMSET_FUNC_NAME
(
int
,
enum
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
child_res
->
get_int
());
uint64_t
value
=
0
;
ret
=
uint_to_enum
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_ENUM
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
int
,
set
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
child_res
->
get_int
());
uint64_t
value
=
0
;
ret
=
uint_to_set
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_SET
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
uint
,
enum
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
child_res
->
get_uint
();
uint64_t
value
=
0
;
ret
=
uint_to_enum
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_ENUM
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
uint
,
set
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
child_res
->
get_uint
();
uint64_t
value
=
0
;
ret
=
uint_to_set
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_SET
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
float
,
enum
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
static_cast
<
int64_t
>
(
child_res
->
get_float
()));
uint64_t
value
=
0
;
ret
=
uint_to_enum
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_ENUM
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
float
,
set
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
static_cast
<
int64_t
>
(
child_res
->
get_float
()));
uint64_t
value
=
0
;
ret
=
uint_to_set
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_SET
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
double
,
enum
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
static_cast
<
int64_t
>
(
child_res
->
get_double
()));
uint64_t
value
=
0
;
ret
=
uint_to_enum
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_ENUM
(
value
);
}
}
return
ret
;
}
CAST_ENUMSET_FUNC_NAME
(
double
,
set
)
{
EVAL_ARG
()
{
EVAL_ARG
()
{
if
(
child_res
->
is_null
())
{
res_datum
.
set_null
();
}
else
{
int
warning
=
0
;
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
static_cast
<
int64_t
>
(
child_res
->
get_double
()));
uint64_t
value
=
0
;
ret
=
uint_to_set
(
val_uint
,
str_values
,
cast_mode
,
warning
,
value
);
SET_RES_SET
(
value
);
}
}
return
ret
;
}
...
...
@@ -5385,6 +5414,7 @@ CAST_ENUMSET_FUNC_NAME(number, enum)
int
warning
=
0
;
if
(
OB_FAIL
(
number_double
(
expr
,
ctx
,
res_datum
)))
{
LOG_WARN
(
"fail to cast number to double"
,
K
(
expr
),
K
(
ret
));
}
else
if
(
res_datum
.
is_null
())
{
}
else
{
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
static_cast
<
int64_t
>
(
res_datum
.
get_double
()));
uint64_t
value
=
0
;
...
...
@@ -5400,6 +5430,7 @@ CAST_ENUMSET_FUNC_NAME(number, set)
int
warning
=
0
;
if
(
OB_FAIL
(
number_double
(
expr
,
ctx
,
res_datum
)))
{
LOG_WARN
(
"fail to cast number to double"
,
K
(
expr
),
K
(
ret
));
}
else
if
(
res_datum
.
is_null
())
{
}
else
{
uint64_t
val_uint
=
static_cast
<
uint64_t
>
(
static_cast
<
int64_t
>
(
res_datum
.
get_double
()));
uint64_t
value
=
0
;
...
...
src/sql/engine/expr/ob_expr_div.cpp
浏览文件 @
1eaee035
...
...
@@ -698,11 +698,16 @@ int ObExprDiv::div_number(
// const int64_t new_scale2 = ROUND_UP(scale2);
// const int64_t calc_scale = ROUND_UP(new_scale1 + new_scale2 + div_pi);
const
int64_t
calc_scale
=
expr
.
div_calc_scale_
;
if
(
calc_scale
>
0
&&
OB_FAIL
(
result_num
.
trunc
(
calc_scale
)))
{
// calc_scale is calc_scale ,not res_scale.
// trunc with calc_scale and round with res_scale
LOG_WARN
(
"failed to trunc result number"
,
K
(
ret
),
K
(
result_num
),
K
(
calc_scale
));
}
else
{
if
(
calc_scale
>
0
)
{
if
(
T_OP_AGG_DIV
==
expr
.
type_
)
{
if
(
OB_FAIL
(
result_num
.
round
(
expr
.
datum_meta_
.
scale_
)))
{
LOG_WARN
(
"failed to round result number"
,
K
(
ret
),
K
(
result_num
),
K
(
calc_scale
));
}
}
else
if
(
OB_FAIL
(
result_num
.
trunc
(
calc_scale
)))
{
LOG_WARN
(
"failed to round result number"
,
K
(
ret
),
K
(
result_num
),
K
(
calc_scale
));
}
}
if
(
OB_SUCC
(
ret
))
{
result
.
set_number
(
result_num
);
}
LOG_DEBUG
(
"finish div"
,
...
...
src/sql/engine/expr/ob_expr_nvl_promotion.map
浏览文件 @
1eaee035
...
...
@@ -111,7 +111,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] =
ObDoubleType,/*uint*/
ObDoubleType,/*float*/
ObDoubleType,/*double*/
Ob
Number
Type,/*number*/
Ob
Double
Type,/*number*/
ObVarcharType,/*datetime*/
ObVarcharType,/*date*/
ObVarcharType,/*time*/
...
...
@@ -135,8 +135,8 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] =
ObNumberType,/*null*/
ObNumberType,/*int*/
ObNumberType,/*uint*/
Ob
Number
Type,/*float*/
Ob
Number
Type,/*double*/
Ob
Double
Type,/*float*/
Ob
Double
Type,/*double*/
ObNumberType,/*number*/
ObVarcharType,/*datetime*/
ObVarcharType,/*date*/
...
...
src/sql/engine/expr/ob_expr_quote.cpp
浏览文件 @
1eaee035
...
...
@@ -44,7 +44,7 @@ int ObExprQuote::calc_result_type1(ObExprResType& type, ObExprResType& type1, Ob
}
}
else
{
type
.
set_varchar
();
type
.
set_length
(
type1
.
get_length
()
);
type
.
set_length
(
2
*
type1
.
get_length
()
+
2
);
if
OB_FAIL
(
aggregate_charsets_for_string_result
(
type
,
&
type1
,
1
,
type_ctx
.
get_coll_type
()))
{
LOG_WARN
(
"aggregate charset for res failed"
,
K
(
ret
));
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录