Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
dc96e6d1
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,发现更多精彩内容 >>
提交
dc96e6d1
编写于
1月 31, 2020
作者:
N
Nikolai Kochetov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Processors support for StorageMemory reading.
上级
fc783971
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
17 deletion
+20
-17
dbms/src/Storages/StorageMemory.cpp
dbms/src/Storages/StorageMemory.cpp
+17
-16
dbms/src/Storages/StorageMemory.h
dbms/src/Storages/StorageMemory.h
+3
-1
未找到文件。
dbms/src/Storages/StorageMemory.cpp
浏览文件 @
dc96e6d1
...
...
@@ -6,6 +6,8 @@
#include <Storages/StorageFactory.h>
#include <IO/WriteHelpers.h>
#include <Processors/Sources/SourceWithProgress.h>
#include <Processors/Pipe.h>
namespace
DB
...
...
@@ -17,34 +19,34 @@ namespace ErrorCodes
}
class
Memory
BlockInputStream
:
public
IBlockInputStream
class
Memory
Source
:
public
SourceWithProgress
{
public:
MemoryBlockInputStream
(
const
Names
&
column_names_
,
BlocksList
::
iterator
begin_
,
BlocksList
::
iterator
end_
,
const
StorageMemory
&
storage_
)
:
column_names
(
column_names_
),
begin
(
begin_
),
end
(
end_
),
it
(
begin
),
storage
(
storage_
)
{}
MemorySource
(
Names
column_names_
,
BlocksList
::
iterator
begin_
,
BlocksList
::
iterator
end_
,
const
StorageMemory
&
storage
)
:
SourceWithProgress
(
storage
.
getSampleBlockForColumns
(
column_names
))
,
column_names
(
std
::
move
(
column_names_
)),
begin
(
begin_
),
end
(
end_
),
it
(
begin
)
{}
String
getName
()
const
override
{
return
"Memory"
;
}
Block
getHeader
()
const
override
{
return
storage
.
getSampleBlockForColumns
(
column_names
);
}
protected:
Block
readImpl
()
override
Chunk
generate
()
override
{
if
(
it
==
end
)
{
return
Block
()
;
return
{}
;
}
else
{
Block
src
=
*
it
;
Block
res
;
Columns
columns
;
columns
.
reserve
(
column_names
.
size
());
/// Add only required columns to `res`.
for
(
size_t
i
=
0
,
size
=
column_names
.
size
();
i
<
size
;
++
i
)
res
.
insert
(
src
.
getByName
(
column_names
[
i
])
);
for
(
const
auto
&
name
:
column_names
)
columns
.
emplace_back
(
src
.
getByName
(
name
).
column
);
++
it
;
return
res
;
return
Chunk
(
std
::
move
(
columns
),
src
.
rows
())
;
}
}
private:
...
...
@@ -52,7 +54,6 @@ private:
BlocksList
::
iterator
begin
;
BlocksList
::
iterator
end
;
BlocksList
::
iterator
it
;
const
StorageMemory
&
storage
;
};
...
...
@@ -82,7 +83,7 @@ StorageMemory::StorageMemory(const StorageID & table_id_, ColumnsDescription col
}
BlockInputStreams
StorageMemory
::
read
(
Pipes
StorageMemory
::
readWithProcessors
(
const
Names
&
column_names
,
const
SelectQueryInfo
&
/*query_info*/
,
const
Context
&
/*context*/
,
...
...
@@ -99,7 +100,7 @@ BlockInputStreams StorageMemory::read(
if
(
num_streams
>
size
)
num_streams
=
size
;
BlockInputStreams
r
es
;
Pipes
pip
es
;
for
(
size_t
stream
=
0
;
stream
<
num_streams
;
++
stream
)
{
...
...
@@ -109,10 +110,10 @@ BlockInputStreams StorageMemory::read(
std
::
advance
(
begin
,
stream
*
size
/
num_streams
);
std
::
advance
(
end
,
(
stream
+
1
)
*
size
/
num_streams
);
res
.
push_back
(
std
::
make_shared
<
MemoryBlockInputStream
>
(
column_names
,
begin
,
end
,
*
this
));
pipes
.
emplace_back
(
std
::
make_shared
<
MemorySource
>
(
column_names
,
begin
,
end
,
*
this
));
}
return
r
es
;
return
pip
es
;
}
...
...
dbms/src/Storages/StorageMemory.h
浏览文件 @
dc96e6d1
...
...
@@ -28,7 +28,7 @@ public:
size_t
getSize
()
const
{
return
data
.
size
();
}
BlockInputStreams
read
(
Pipes
readWithProcessors
(
const
Names
&
column_names
,
const
SelectQueryInfo
&
query_info
,
const
Context
&
context
,
...
...
@@ -36,6 +36,8 @@ public:
size_t
max_block_size
,
unsigned
num_streams
)
override
;
bool
supportProcessorsPipeline
()
const
override
{
return
true
;
}
BlockOutputStreamPtr
write
(
const
ASTPtr
&
query
,
const
Context
&
context
)
override
;
void
drop
(
TableStructureWriteLockHolder
&
)
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录