Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
1f7a798c
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,发现更多精彩内容 >>
提交
1f7a798c
编写于
11月 01, 2019
作者:
N
Nikolai Kochetov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add flag to set that set is created.
上级
ddcbc2f9
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
30 addition
and
17 deletion
+30
-17
dbms/src/DataStreams/CreatingSetsBlockInputStream.cpp
dbms/src/DataStreams/CreatingSetsBlockInputStream.cpp
+3
-0
dbms/src/Interpreters/ExpressionActions.cpp
dbms/src/Interpreters/ExpressionActions.cpp
+4
-2
dbms/src/Interpreters/ExpressionAnalyzer.cpp
dbms/src/Interpreters/ExpressionAnalyzer.cpp
+2
-0
dbms/src/Interpreters/Set.cpp
dbms/src/Interpreters/Set.cpp
+1
-0
dbms/src/Interpreters/Set.h
dbms/src/Interpreters/Set.h
+7
-0
dbms/src/Processors/Transforms/CreatingSetsTransform.cpp
dbms/src/Processors/Transforms/CreatingSetsTransform.cpp
+3
-0
dbms/src/Processors/Transforms/FilterTransform.cpp
dbms/src/Processors/Transforms/FilterTransform.cpp
+2
-13
dbms/src/Processors/Transforms/FilterTransform.h
dbms/src/Processors/Transforms/FilterTransform.h
+0
-2
dbms/src/Storages/StorageSet.cpp
dbms/src/Storages/StorageSet.cpp
+5
-0
dbms/src/Storages/StorageSet.h
dbms/src/Storages/StorageSet.h
+3
-0
未找到文件。
dbms/src/DataStreams/CreatingSetsBlockInputStream.cpp
浏览文件 @
1f7a798c
...
...
@@ -146,6 +146,9 @@ void CreatingSetsBlockInputStream::createOne(SubqueryForSet & subquery)
}
}
if
(
subquery
.
set
)
subquery
.
set
->
finishInsert
();
if
(
table_out
)
table_out
->
writeSuffix
();
...
...
dbms/src/Interpreters/ExpressionActions.cpp
浏览文件 @
1f7a798c
...
...
@@ -1188,8 +1188,9 @@ bool ExpressionActions::checkColumnIsAlwaysFalse(const String & column_name) con
/// Check has column in (empty set).
String
set_to_check
;
for
(
auto
&
action
:
actions
)
for
(
auto
it
=
actions
.
rbegin
();
it
!=
actions
.
rend
();
++
it
)
{
auto
&
action
=
*
it
;
if
(
action
.
type
==
action
.
APPLY_FUNCTION
&&
action
.
function_base
)
{
auto
name
=
action
.
function_base
->
getName
();
...
...
@@ -1198,6 +1199,7 @@ bool ExpressionActions::checkColumnIsAlwaysFalse(const String & column_name) con
&&
action
.
argument_names
.
size
()
>
1
)
{
set_to_check
=
action
.
argument_names
[
1
];
break
;
}
}
}
...
...
@@ -1210,7 +1212,7 @@ bool ExpressionActions::checkColumnIsAlwaysFalse(const String & column_name) con
{
if
(
auto
*
column_set
=
typeid_cast
<
const
ColumnSet
*>
(
action
.
added_column
.
get
()))
{
if
(
column_set
->
getData
()
->
getTotalRowCount
()
==
0
)
if
(
column_set
->
getData
()
->
isCreated
()
&&
column_set
->
getData
()
->
empty
()
)
return
true
;
}
}
...
...
dbms/src/Interpreters/ExpressionAnalyzer.cpp
浏览文件 @
1f7a798c
...
...
@@ -249,6 +249,8 @@ void SelectQueryExpressionAnalyzer::tryMakeSetForIndexFromSubquery(const ASTPtr
if
(
!
set
->
insertFromBlock
(
block
))
return
;
}
set
->
finishInsert
();
res
.
in
->
readSuffix
();
prepared_sets
[
set_key
]
=
std
::
move
(
set
);
...
...
dbms/src/Interpreters/Set.cpp
浏览文件 @
1f7a798c
...
...
@@ -291,6 +291,7 @@ void Set::createFromAST(const DataTypes & types, ASTPtr node, const Context & co
Block
block
=
header
.
cloneWithColumns
(
std
::
move
(
columns
));
insertFromBlock
(
block
);
finishInsert
();
}
...
...
dbms/src/Interpreters/Set.h
浏览文件 @
1f7a798c
...
...
@@ -56,6 +56,10 @@ public:
/// Returns false, if some limit was exceeded and no need to insert more data.
bool
insertFromBlock
(
const
Block
&
block
);
/// Call after all blocks were inserted. To get the information that set is already created.
void
finishInsert
()
{
is_created
=
true
;
}
bool
isCreated
()
const
{
return
is_created
;
}
/** For columns of 'block', check belonging of corresponding rows to the set.
* Return UInt8 column with the result.
...
...
@@ -107,6 +111,9 @@ private:
/// Do we need to additionally store all elements of the set in explicit form for subsequent use for index.
bool
fill_set_elements
;
/// Check if set contains all the data.
bool
is_created
=
false
;
/// If in the left part columns contains the same types as the elements of the set.
void
executeOrdinary
(
const
ColumnRawPtrs
&
key_columns
,
...
...
dbms/src/Processors/Transforms/CreatingSetsTransform.cpp
浏览文件 @
1f7a798c
...
...
@@ -141,6 +141,9 @@ void CreatingSetsTransform::work()
auto
finishCurrentSubquery
=
[
&
]()
{
if
(
subquery
.
set
)
subquery
.
set
->
finishInsert
();
if
(
table_out
)
table_out
->
writeSuffix
();
...
...
dbms/src/Processors/Transforms/FilterTransform.cpp
浏览文件 @
1f7a798c
...
...
@@ -64,7 +64,8 @@ FilterTransform::FilterTransform(
IProcessor
::
Status
FilterTransform
::
prepare
()
{
if
(
constant_filter_description
.
always_false
)
if
(
constant_filter_description
.
always_false
||
expression
->
checkColumnIsAlwaysFalse
(
filter_column_name
))
{
input
.
close
();
output
.
finish
();
...
...
@@ -83,18 +84,6 @@ void FilterTransform::removeFilterIfNeed(Chunk & chunk)
void
FilterTransform
::
transform
(
Chunk
&
chunk
)
{
if
(
!
initialized
)
{
initialized
=
true
;
/// Cannot check this in prepare. Because in prepare columns for set may be not created yet.
if
(
expression
->
checkColumnIsAlwaysFalse
(
filter_column_name
))
{
stopReading
();
chunk
=
Chunk
(
getOutputPort
().
getHeader
().
getColumns
(),
0
);
return
;
}
}
size_t
num_rows_before_filtration
=
chunk
.
getNumRows
();
auto
columns
=
chunk
.
detachColumns
();
...
...
dbms/src/Processors/Transforms/FilterTransform.h
浏览文件 @
1f7a798c
...
...
@@ -36,8 +36,6 @@ private:
/// Header after expression, but before removing filter column.
Block
transformed_header
;
bool
initialized
=
false
;
void
removeFilterIfNeed
(
Chunk
&
chunk
);
};
...
...
dbms/src/Storages/StorageSet.cpp
浏览文件 @
1f7a798c
...
...
@@ -70,6 +70,7 @@ void SetOrJoinBlockOutputStream::write(const Block & block)
void
SetOrJoinBlockOutputStream
::
writeSuffix
()
{
table
.
finishInsert
();
backup_stream
.
flush
();
compressed_backup_buf
.
next
();
backup_buf
.
next
();
...
...
@@ -123,6 +124,7 @@ StorageSet::StorageSet(
void
StorageSet
::
insertBlock
(
const
Block
&
block
)
{
set
->
insertFromBlock
(
block
);
}
void
StorageSet
::
finishInsert
()
{
set
->
finishInsert
();
}
size_t
StorageSet
::
getSize
()
const
{
return
set
->
getTotalRowCount
();
}
...
...
@@ -180,8 +182,11 @@ void StorageSetOrJoinBase::restoreFromFile(const String & file_path)
NativeBlockInputStream
backup_stream
(
compressed_backup_buf
,
0
);
backup_stream
.
readPrefix
();
while
(
Block
block
=
backup_stream
.
read
())
insertBlock
(
block
);
finishInsert
();
backup_stream
.
readSuffix
();
/// TODO Add speed, compressed bytes, data volume in memory, compression ratio ... Generalize all statistics logging in project.
...
...
dbms/src/Storages/StorageSet.h
浏览文件 @
1f7a798c
...
...
@@ -50,6 +50,8 @@ private:
/// Insert the block into the state.
virtual
void
insertBlock
(
const
Block
&
block
)
=
0
;
/// Call after all blocks were inserted.
virtual
void
finishInsert
()
=
0
;
virtual
size_t
getSize
()
const
=
0
;
};
...
...
@@ -75,6 +77,7 @@ private:
SetPtr
set
;
void
insertBlock
(
const
Block
&
block
)
override
;
void
finishInsert
()
override
;
size_t
getSize
()
const
override
;
protected:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录