Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
77b4ad6f
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,发现更多精彩内容 >>
提交
77b4ad6f
编写于
12月 12, 2014
作者:
A
Alexey Arno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Various cleanups
上级
b630f30a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
15 deletion
+24
-15
dbms/include/DB/Core/Block.h
dbms/include/DB/Core/Block.h
+1
-0
dbms/include/DB/DataTypes/typesAreCompatible.h
dbms/include/DB/DataTypes/typesAreCompatible.h
+2
-0
dbms/include/DB/Interpreters/InterpreterSelectQuery.h
dbms/include/DB/Interpreters/InterpreterSelectQuery.h
+5
-2
dbms/src/Core/Block.cpp
dbms/src/Core/Block.cpp
+2
-2
dbms/src/DataTypes/typesAreCompatible.cpp
dbms/src/DataTypes/typesAreCompatible.cpp
+14
-11
未找到文件。
dbms/include/DB/Core/Block.h
浏览文件 @
77b4ad6f
...
...
@@ -125,6 +125,7 @@ typedef std::list<Block> BlocksList;
/// Сравнить типы столбцов у блоков. Порядок столбцов имеет значение. Имена не имеют значения.
bool
blocksHaveEqualStructure
(
const
Block
&
lhs
,
const
Block
&
rhs
);
/// Проверить, что типы столбцов у блоков совместимые. Порядок имеет значение. Имена не имеют значения.
bool
blocksHaveCompatibleStructure
(
const
Block
&
lhs
,
const
Block
&
rhs
);
}
...
...
dbms/include/DB/DataTypes/typesAreCompatible.h
浏览文件 @
77b4ad6f
...
...
@@ -5,6 +5,8 @@
namespace
DB
{
/** Проверить, что типы совместимые.
*/
bool
typesAreCompatible
(
const
IDataType
&
lhs
,
const
IDataType
&
rhs
);
}
dbms/include/DB/Interpreters/InterpreterSelectQuery.h
浏览文件 @
77b4ad6f
...
...
@@ -59,7 +59,9 @@ public:
size_t
subquery_depth_
=
0
,
BlockInputStreamPtr
input
=
nullptr
);
/// Выполнить запрос, получить поток блоков для чтения
/** Выполнить запрос, возможно являющиийся цепочкой UNION ALL.
* Получить поток блоков для чтения
*/
BlockInputStreamPtr
execute
();
/** Выполнить запрос, записать результат в нужном формате в buf.
...
...
@@ -88,6 +90,7 @@ private:
/// Вынимает данные из таблицы. Возвращает стадию, до которой запрос был обработан в Storage.
QueryProcessingStage
::
Enum
executeFetchColumns
(
BlockInputStreams
&
streams
);
/// Выполнить один запрос SELECT из цепочки UNION ALL.
BlockInputStreamPtr
executeSingleQuery
();
void
executeWhere
(
BlockInputStreams
&
streams
,
ExpressionActionsPtr
expression
);
...
...
@@ -115,7 +118,7 @@ private:
ExpressionAnalyzerPtr
query_analyzer
;
BlockInputStreams
streams
;
///
true, если это голова цепочки запросов SELECT объединённых ключевыми словам
и UNION ALL.
///
Проверить, что запрос SELECT - первый элемент цепочк
и UNION ALL.
bool
is_union_all_head
;
/// Таблица, откуда читать данные, если не подзапрос.
...
...
dbms/src/Core/Block.cpp
浏览文件 @
77b4ad6f
...
...
@@ -380,8 +380,8 @@ bool blocksHaveCompatibleStructure(const Block & lhs, const Block & rhs)
for
(
size_t
i
=
0
;
i
<
columns
;
++
i
)
{
const
auto
&
lhs_type
=
*
lhs
.
getByPosition
(
i
).
type
;
const
auto
&
rhs_type
=
*
rhs
.
getByPosition
(
i
).
type
;
const
IDataType
&
lhs_type
=
*
lhs
.
getByPosition
(
i
).
type
;
const
IDataType
&
rhs_type
=
*
rhs
.
getByPosition
(
i
).
type
;
if
(
!
typesAreCompatible
(
lhs_type
,
rhs_type
))
return
false
;
...
...
dbms/src/DataTypes/typesAreCompatible.cpp
浏览文件 @
77b4ad6f
...
...
@@ -11,17 +11,17 @@
namespace
{
#define REGISTER_COMPATIBLE_TYPES(T, U)
\
{ T.getName(), U.getName() },
\
{ U.getName(), T.getName() }
\
#define REGISTER_COMPATIBLE_TYPES(T, U)
\
{ T.getName(), U.getName() },
\
{ U.getName(), T.getName() } \
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
init
()
{
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
types_
desc
=
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
types_
compatibility_list
=
{
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeString
(),
DB
::
DataTypeFixedString
(
1
)),
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeFloat32
(),
DB
::
DataTypeFloat64
()),
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeString
(),
DB
::
DataTypeFixedString
(
1
)),
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeFloat32
(),
DB
::
DataTypeFloat64
()),
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeInt8
(),
DB
::
DataTypeUInt8
()),
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeInt8
(),
DB
::
DataTypeInt16
()),
...
...
@@ -43,8 +43,10 @@ std::vector<std::pair<std::string, std::string> > init()
REGISTER_COMPATIBLE_TYPES
(
DB
::
DataTypeInt64
(),
DB
::
DataTypeUInt64
())
};
std
::
sort
(
types_desc
.
begin
(),
types_desc
.
end
());
return
types_desc
;
std
::
sort
(
types_compatibility_list
.
begin
(),
types_compatibility_list
.
end
());
return
types_compatibility_list
;
}
}
...
...
@@ -54,12 +56,13 @@ namespace DB
bool
typesAreCompatible
(
const
IDataType
&
lhs
,
const
IDataType
&
rhs
)
{
static
const
auto
types_
desc
=
init
();
static
const
auto
types_
compatibility_list
=
init
();
if
(
lhs
.
getName
()
==
rhs
.
getName
())
return
true
;
return
std
::
binary_search
(
types_desc
.
begin
(),
types_desc
.
end
(),
std
::
make_pair
(
lhs
.
getName
(),
rhs
.
getName
()));
return
std
::
binary_search
(
types_compatibility_list
.
begin
(),
types_compatibility_list
.
end
(),
std
::
make_pair
(
lhs
.
getName
(),
rhs
.
getName
()));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录