Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Messij2001
oceanbase
提交
0121cc45
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,体验更适合开发者的 AI 搜索 >>
提交
0121cc45
编写于
11月 02, 2021
作者:
B
br0
提交者:
LINGuanRen
11月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add new type default string length
上级
22d5eee2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
43 addition
and
4 deletion
+43
-4
src/sql/engine/expr/ob_expr_cast.cpp
src/sql/engine/expr/ob_expr_cast.cpp
+14
-1
src/sql/engine/expr/ob_expr_cast.h
src/sql/engine/expr/ob_expr_cast.h
+29
-3
未找到文件。
src/sql/engine/expr/ob_expr_cast.cpp
浏览文件 @
0121cc45
...
...
@@ -137,11 +137,24 @@ int ObExprCast::get_cast_string_len(ObExprResType& type1, ObExprResType& type2,
case
ObHexStringType
:
case
ObRawType
:
case
ObNVarchar2Type
:
case
ObNCharType
:
{
case
ObNCharType
:
case
ObEnumType
:
case
ObSetType
:
case
ObEnumInnerType
:
case
ObSetInnerType
:
case
ObURowIDType
:
case
ObLobType
:
{
res_len
=
type1
.
get_length
();
length_semantics
=
type1
.
get_length_semantics
();
break
;
}
case
ObBitType
:
{
if
(
scale
>
0
)
{
res_len
=
scale
;
}
res_len
=
(
res_len
+
7
)
/
8
;
break
;
}
default:
{
break
;
}
...
...
src/sql/engine/expr/ob_expr_cast.h
浏览文件 @
0121cc45
...
...
@@ -13,13 +13,14 @@
#ifndef _OB_EXPR_CAST_H_
#define _OB_EXPR_CAST_H_
#include "common/object/ob_obj_type.h"
#include "sql/engine/expr/ob_expr_operator.h"
namespace
oceanbase
{
namespace
sql
{
// T
ODO::only support 26??
static
const
int32_t
CAST_STRING_DEFUALT_LENGTH
[
26
]
=
{
// T
he length of array need to be equal to the number of types defined at ObObjType
static
const
int32_t
CAST_STRING_DEFUALT_LENGTH
[
48
]
=
{
0
,
// null
4
,
// tinyint
6
,
// smallint
...
...
@@ -45,9 +46,34 @@ static const int32_t CAST_STRING_DEFUALT_LENGTH[26] = {
1
,
// varchar
1
,
// char
1
,
// binary
0
// extend
0
,
// extend
0
,
// unknown
1
,
// tinytext text share default length with varchar
1
,
// text
1
,
// mediumtext
1
,
// longtext
64
,
// bit
1
,
// enum
1
,
// set
1
,
// enuminner
1
,
// setinner
25
,
// timestampTZ timestamp + time zone('+00:00')
25
,
// timestampLTZ
19
,
// timestampNano timestamp + nanosecond scale
1
,
// raw
7
,
// intervalYM yyyy-mm
19
,
// intervalDS ddd hh:mm:ss.fractionsecond(6)
12
,
// numberfloat same with float
1
,
// nvarchar2 share default length with varchar
1
,
// nchar share default length with char
1
,
// urowid
1
,
// lob
0
// max, invalid type, or count of obj type
};
static_assert
(
common
::
ObMaxType
+
1
==
sizeof
(
CAST_STRING_DEFUALT_LENGTH
)
/
sizeof
(
int32_t
),
"Please keep the length of CAST_STRING_DEFUALT_LENGTH must equal to the number of types"
);
class
ObExprCast
:
public
ObFuncExprOperator
{
OB_UNIS_VERSION_V
(
1
);
const
static
int32_t
OB_LITERAL_MAX_INT_LEN
=
21
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录