Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
150bde4e
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,发现更多精彩内容 >>
提交
150bde4e
编写于
10月 08, 2014
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dbms: VIEWs: added support for SAMPLE, FINAL, PREWHERE [#METR-13098].
上级
a6dcbb03
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
5 deletion
+25
-5
dbms/include/DB/Storages/StorageMaterializedView.h
dbms/include/DB/Storages/StorageMaterializedView.h
+4
-0
dbms/include/DB/Storages/StorageView.h
dbms/include/DB/Storages/StorageView.h
+8
-4
dbms/src/Storages/StorageView.cpp
dbms/src/Storages/StorageView.cpp
+13
-1
未找到文件。
dbms/include/DB/Storages/StorageMaterializedView.h
浏览文件 @
150bde4e
...
...
@@ -18,6 +18,10 @@ public:
NameAndTypePair
getColumn
(
const
String
&
column_name
)
const
override
;
bool
hasColumn
(
const
String
&
column_name
)
const
override
;
bool
supportsSampling
()
const
override
{
return
data
->
supportsSampling
();
}
bool
supportsFinal
()
const
override
{
return
data
->
supportsFinal
();
}
bool
supportsPrewhere
()
const
override
{
return
data
->
supportsPrewhere
();
}
BlockOutputStreamPtr
write
(
ASTPtr
query
)
override
;
void
drop
()
override
;
bool
optimize
()
override
;
...
...
dbms/include/DB/Storages/StorageView.h
浏览文件 @
150bde4e
...
...
@@ -13,12 +13,16 @@ public:
static
StoragePtr
create
(
const
String
&
table_name_
,
const
String
&
database_name_
,
Context
&
context_
,
ASTPtr
&
query_
,
NamesAndTypesListPtr
columns_
);
virtual
std
::
string
getName
()
const
override
{
return
"View"
;
}
virtual
std
::
string
getTableName
()
const
override
{
return
table_name
;
}
std
::
string
getName
()
const
override
{
return
"View"
;
}
std
::
string
getTableName
()
const
override
{
return
table_name
;
}
const
NamesAndTypesList
&
getColumnsList
()
const
override
{
return
*
columns
;
}
DB
::
ASTPtr
getInnerQuery
()
const
{
return
inner_query
.
clone
();
};
virtual
BlockInputStreams
read
(
/// Пробрасывается внутрь запроса и решается на его уровне.
bool
supportsSampling
()
const
override
{
return
true
;
}
bool
supportsFinal
()
const
override
{
return
true
;
}
BlockInputStreams
read
(
const
Names
&
column_names
,
ASTPtr
query
,
const
Settings
&
settings
,
...
...
@@ -26,7 +30,7 @@ public:
size_t
max_block_size
=
DEFAULT_BLOCK_SIZE
,
unsigned
threads
=
1
)
override
;
v
irtual
v
oid
drop
()
override
;
void
drop
()
override
;
protected:
String
select_database_name
;
...
...
dbms/src/Storages/StorageView.cpp
浏览文件 @
150bde4e
...
...
@@ -61,8 +61,20 @@ BlockInputStreams StorageView::read(
size_t
max_block_size
,
unsigned
threads
)
{
ASTPtr
inner_query_clone
=
getInnerQuery
();
ASTSelectQuery
&
inner_select
=
static_cast
<
ASTSelectQuery
&>
(
*
inner_query_clone
);
const
ASTSelectQuery
&
outer_select
=
typeid_cast
<
const
ASTSelectQuery
&>
(
*
query
);
/// Пробрасываем внутрь SAMPLE и FINAL, если они есть во внешнем запросе и их нет во внутреннем.
if
(
outer_select
.
sample_size
&&
!
inner_select
.
sample_size
)
inner_select
.
sample_size
=
outer_select
.
sample_size
;
if
(
outer_select
.
final
&&
!
inner_select
.
final
)
inner_select
.
final
=
outer_select
.
final
;
return
BlockInputStreams
(
1
,
InterpreterSelectQuery
(
getInnerQuery
()
,
context
,
column_names
).
execute
());
InterpreterSelectQuery
(
inner_query_clone
,
context
,
column_names
).
execute
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录