Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
37d4dcb5
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
37d4dcb5
编写于
2月 01, 2016
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dbms: fixed CAST String to Enum [#METR-19265].
上级
c20a51c5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
12 deletion
+12
-12
dbms/include/DB/DataTypes/DataTypeEnum.h
dbms/include/DB/DataTypes/DataTypeEnum.h
+7
-8
dbms/include/DB/Functions/FunctionsConversion.h
dbms/include/DB/Functions/FunctionsConversion.h
+5
-4
未找到文件。
dbms/include/DB/DataTypes/DataTypeEnum.h
浏览文件 @
37d4dcb5
...
...
@@ -137,14 +137,13 @@ public:
return
it
->
second
;
}
FieldType
getValue
(
const
std
::
string
&
name
)
const
FieldType
getValue
(
StringRef
name
)
const
{
const
auto
it
=
name_to_value_map
.
find
(
StringRef
{
name
}
);
const
auto
it
=
name_to_value_map
.
find
(
name
);
if
(
it
==
std
::
end
(
name_to_value_map
))
throw
Exception
{
"Unknown element '"
+
name
+
"' for type "
+
getName
(),
ErrorCodes
::
LOGICAL_ERROR
};
"Unknown element '"
+
name
.
toString
()
+
"' for type "
+
getName
(),
ErrorCodes
::
LOGICAL_ERROR
};
return
it
->
second
;
}
...
...
@@ -175,7 +174,7 @@ public:
{
std
::
string
name
;
readString
(
name
,
istr
);
field
=
nearestFieldType
(
getValue
(
name
));
field
=
nearestFieldType
(
getValue
(
StringRef
(
name
)
));
}
void
serializeTextEscaped
(
const
Field
&
field
,
WriteBuffer
&
ostr
)
const
override
...
...
@@ -187,7 +186,7 @@ public:
{
std
::
string
name
;
readEscapedString
(
name
,
istr
);
field
=
nearestFieldType
(
getValue
(
name
));
field
=
nearestFieldType
(
getValue
(
StringRef
(
name
)
));
}
void
serializeTextQuoted
(
const
Field
&
field
,
WriteBuffer
&
ostr
)
const
override
...
...
@@ -199,7 +198,7 @@ public:
{
std
::
string
name
;
readQuotedString
(
name
,
istr
);
field
=
nearestFieldType
(
getValue
(
name
));
field
=
nearestFieldType
(
getValue
(
StringRef
(
name
)
));
}
void
serializeTextJSON
(
const
Field
&
field
,
WriteBuffer
&
ostr
)
const
override
...
...
dbms/include/DB/Functions/FunctionsConversion.h
浏览文件 @
37d4dcb5
...
...
@@ -1744,7 +1744,8 @@ class FunctionCast final : public IFunction
template
<
typename
ColumnStringType
,
typename
EnumType
>
auto
createStringToEnumWrapper
()
{
return
[]
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
)
{
return
[]
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
)
{
const
auto
first_col
=
block
.
getByPosition
(
arguments
.
front
()).
column
.
get
();
auto
&
col_with_type_and_name
=
block
.
getByPosition
(
result
);
...
...
@@ -1755,12 +1756,12 @@ class FunctionCast final : public IFunction
{
const
auto
size
=
col
->
size
();
const
auto
res
=
result_type
.
createColumn
();
auto
&
out_data
=
static_cast
<
typename
EnumType
::
ColumnType
&>
(
*
res
ult_col
).
getData
();
auto
res
=
result_type
.
createColumn
();
auto
&
out_data
=
static_cast
<
typename
EnumType
::
ColumnType
&>
(
*
res
).
getData
();
out_data
.
resize
(
size
);
for
(
const
auto
i
:
ext
::
range
(
0
,
size
))
out_data
[
i
]
=
result_type
.
getValue
(
col
->
getDataAt
(
i
)
.
toString
()
);
out_data
[
i
]
=
result_type
.
getValue
(
col
->
getDataAt
(
i
));
result_col
=
res
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录