Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
82555476
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,发现更多精彩内容 >>
提交
82555476
编写于
3月 20, 2020
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added one more check
上级
de5f5593
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
46 addition
and
92 deletion
+46
-92
.clang-tidy
.clang-tidy
+1
-3
dbms/src/DataStreams/CollapsingFinalBlockInputStream.cpp
dbms/src/DataStreams/CollapsingFinalBlockInputStream.cpp
+1
-11
dbms/src/DataStreams/CollapsingFinalBlockInputStream.h
dbms/src/DataStreams/CollapsingFinalBlockInputStream.h
+19
-72
dbms/src/DataStreams/MergingSortedBlockInputStream.cpp
dbms/src/DataStreams/MergingSortedBlockInputStream.cpp
+3
-0
dbms/src/DataStreams/MergingSortedBlockInputStream.h
dbms/src/DataStreams/MergingSortedBlockInputStream.h
+4
-4
dbms/src/DataStreams/SummingSortedBlockInputStream.cpp
dbms/src/DataStreams/SummingSortedBlockInputStream.cpp
+2
-1
dbms/src/DataStreams/SummingSortedBlockInputStream.h
dbms/src/DataStreams/SummingSortedBlockInputStream.h
+3
-1
dbms/src/Functions/GatherUtils/concat.cpp
dbms/src/Functions/GatherUtils/concat.cpp
+5
-0
dbms/src/Functions/GatherUtils/resizeConstantSize.cpp
dbms/src/Functions/GatherUtils/resizeConstantSize.cpp
+4
-0
dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp
dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp
+4
-0
未找到文件。
.clang-tidy
浏览文件 @
82555476
...
...
@@ -136,6 +136,7 @@ Checks: '-*,
clang-analyzer-core.uninitialized.CapturedBlockVariable,
clang-analyzer-core.uninitialized.UndefReturn,
clang-analyzer-cplusplus.InnerPointer,
clang-analyzer-cplusplus.NewDelete,
clang-analyzer-cplusplus.NewDeleteLeaks,
clang-analyzer-cplusplus.PlacementNewChecker,
clang-analyzer-cplusplus.SelfAssignment,
...
...
@@ -161,6 +162,3 @@ Checks: '-*,
boost-use-to-string,
'
WarningsAsErrors: '*'
# TODO:
# clang-analyzer-cplusplus.NewDelete,
dbms/src/DataStreams/CollapsingFinalBlockInputStream.cpp
浏览文件 @
82555476
...
...
@@ -10,17 +10,7 @@ namespace DB
CollapsingFinalBlockInputStream
::~
CollapsingFinalBlockInputStream
()
{
/// You must cancel all `MergingBlockPtr` so that they do not try to put blocks in `output_blocks`.
previous
.
block
.
cancel
();
last_positive
.
block
.
cancel
();
while
(
!
queue
.
empty
())
{
Cursor
c
=
queue
.
top
();
queue
.
pop
();
c
.
block
.
cancel
();
}
queue
=
{};
for
(
auto
&
block
:
output_blocks
)
delete
block
;
}
...
...
dbms/src/DataStreams/CollapsingFinalBlockInputStream.h
浏览文件 @
82555476
#pragma once
#include <common/logger_useful.h>
#include <DataStreams/IBlockInputStream.h>
#include <Core/SortDescription.h>
...
...
@@ -6,6 +7,7 @@
#include <Common/typeid_cast.h>
#include <queue>
#include <cassert>
#include <boost/intrusive_ptr.hpp>
namespace
DB
...
...
@@ -15,6 +17,7 @@ namespace ErrorCodes
extern
const
int
BAD_TYPE_OF_FIELD
;
}
/// Collapses the same rows with the opposite sign roughly like CollapsingSortedBlockInputStream.
/// Outputs the rows in random order (the input streams must still be ordered).
/// Outputs only rows with a positive sign.
...
...
@@ -39,10 +42,7 @@ public:
Block
getHeader
()
const
override
{
return
children
.
at
(
0
)
->
getHeader
();
}
protected:
Block
readImpl
()
override
;
private:
struct
MergingBlock
;
using
BlockPlainPtrs
=
std
::
vector
<
MergingBlock
*>
;
...
...
@@ -97,76 +97,11 @@ private:
BlockPlainPtrs
*
output_blocks
;
};
/// When deleting the last block reference, adds a block to `output_blocks`.
class
MergingBlockPtr
{
public:
MergingBlockPtr
()
:
ptr
()
{}
explicit
MergingBlockPtr
(
MergingBlock
*
ptr_
)
:
ptr
(
ptr_
)
{
if
(
ptr
)
++
ptr
->
refcount
;
}
MergingBlockPtr
(
const
MergingBlockPtr
&
rhs
)
:
ptr
(
rhs
.
ptr
)
{
if
(
ptr
)
++
ptr
->
refcount
;
}
MergingBlockPtr
&
operator
=
(
const
MergingBlockPtr
&
rhs
)
{
assert
(
ptr
!=
rhs
.
ptr
);
destroy
();
ptr
=
rhs
.
ptr
;
if
(
ptr
)
++
ptr
->
refcount
;
return
*
this
;
}
~
MergingBlockPtr
()
{
destroy
();
}
/// Zero the pointer and do not add a block to output_blocks.
void
cancel
()
{
if
(
ptr
)
{
--
ptr
->
refcount
;
if
(
!
ptr
->
refcount
)
delete
ptr
;
ptr
=
nullptr
;
}
}
MergingBlock
&
operator
*
()
const
{
return
*
ptr
;
}
MergingBlock
*
operator
->
()
const
{
return
ptr
;
}
operator
bool
()
const
{
return
!!
ptr
;
}
bool
operator
!
()
const
{
return
!
ptr
;
}
private:
MergingBlock
*
ptr
;
private:
Block
readImpl
()
override
;
void
destroy
()
{
if
(
ptr
)
{
--
ptr
->
refcount
;
if
(
!
ptr
->
refcount
)
{
if
(
std
::
uncaught_exceptions
())
delete
ptr
;
else
ptr
->
output_blocks
->
push_back
(
ptr
);
}
ptr
=
nullptr
;
}
}
};
/// When deleting the last block reference, adds a block to `output_blocks`.
using
MergingBlockPtr
=
boost
::
intrusive_ptr
<
MergingBlock
>
;
struct
Cursor
{
...
...
@@ -261,4 +196,16 @@ private:
void
reportBadSign
(
Int8
sign
);
};
inline
void
intrusive_ptr_add_ref
(
CollapsingFinalBlockInputStream
::
MergingBlock
*
ptr
)
{
++
ptr
->
refcount
;
}
inline
void
intrusive_ptr_release
(
CollapsingFinalBlockInputStream
::
MergingBlock
*
ptr
)
{
if
(
0
==
--
ptr
->
refcount
)
ptr
->
output_blocks
->
push_back
(
ptr
);
}
}
dbms/src/DataStreams/MergingSortedBlockInputStream.cpp
浏览文件 @
82555476
...
...
@@ -2,6 +2,8 @@
#include <iomanip>
#include <sstream>
#include <common/logger_useful.h>
#include <DataStreams/MergingSortedBlockInputStream.h>
#include <DataStreams/ColumnGathererStream.h>
...
...
@@ -21,6 +23,7 @@ MergingSortedBlockInputStream::MergingSortedBlockInputStream(
:
description
(
description_
),
max_block_size
(
max_block_size_
),
limit
(
limit_
),
quiet
(
quiet_
)
,
average_block_sizes
(
average_block_sizes_
),
source_blocks
(
inputs_
.
size
())
,
cursors
(
inputs_
.
size
()),
out_row_sources_buf
(
out_row_sources_buf_
)
,
log
(
&
Logger
::
get
(
"MergingSortedBlockInputStream"
))
{
children
.
insert
(
children
.
end
(),
inputs_
.
begin
(),
inputs_
.
end
());
header
=
children
.
at
(
0
)
->
getHeader
();
...
...
dbms/src/DataStreams/MergingSortedBlockInputStream.h
浏览文件 @
82555476
#pragma once
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include <common/logger_useful.h>
#include <Common/SharedBlockRowRef.h>
#include <Core/Row.h>
...
...
@@ -14,6 +11,9 @@
#include <DataStreams/IBlockInputStream.h>
namespace
Poco
{
class
Logger
;
}
namespace
DB
{
...
...
@@ -176,7 +176,7 @@ private:
template
<
typename
TSortingHeap
>
void
merge
(
MutableColumns
&
merged_columns
,
TSortingHeap
&
queue
);
Logger
*
log
=
&
Logger
::
get
(
"MergingSortedBlockInputStream"
)
;
Poco
::
Logger
*
log
;
/// Read is finished.
bool
finished
=
false
;
...
...
dbms/src/DataStreams/SummingSortedBlockInputStream.cpp
浏览文件 @
82555476
...
...
@@ -129,7 +129,8 @@ SummingSortedBlockInputStream::SummingSortedBlockInputStream(
/// List of columns to be summed. If empty, all numeric columns that are not in the description are taken.
const
Names
&
column_names_to_sum
,
size_t
max_block_size_
)
:
MergingSortedBlockInputStream
(
inputs_
,
description_
,
max_block_size_
)
:
MergingSortedBlockInputStream
(
inputs_
,
description_
,
max_block_size_
),
log
(
&
Logger
::
get
(
"SummingSortedBlockInputStream"
))
{
current_row
.
resize
(
num_columns
);
...
...
dbms/src/DataStreams/SummingSortedBlockInputStream.h
浏览文件 @
82555476
...
...
@@ -10,6 +10,8 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
namespace
Poco
{
class
Logger
;
}
namespace
DB
{
...
...
@@ -47,7 +49,7 @@ protected:
Block
readImpl
()
override
;
private:
Logger
*
log
=
&
Logger
::
get
(
"SummingSortedBlockInputStream"
)
;
Poco
::
Logger
*
log
;
/// Read up to the end.
bool
finished
=
false
;
...
...
dbms/src/Functions/GatherUtils/concat.cpp
浏览文件 @
82555476
#ifndef __clang_analyzer__ // It's too hard to analyze.
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
...
...
@@ -46,6 +48,9 @@ void concat(const std::vector<std::unique_ptr<IArraySource>> & sources, IArraySi
throw
Exception
(
"Concat function should get at least 1 ArraySource"
,
ErrorCodes
::
LOGICAL_ERROR
);
return
ArrayConcat
::
select
(
*
sources
.
front
(),
sink
,
sources
);
}
}
}
#endif
dbms/src/Functions/GatherUtils/resizeConstantSize.cpp
浏览文件 @
82555476
#ifndef __clang_analyzer__ // It's too hard to analyze.
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
...
...
@@ -21,3 +23,5 @@ void resizeConstantSize(IArraySource & array_source, IValueSource & value_source
ArrayResizeConstant
::
select
(
sink
,
array_source
,
value_source
,
size
);
}
}
#endif
dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp
浏览文件 @
82555476
#ifndef __clang_analyzer__ // It's too hard to analyze.
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
...
...
@@ -21,3 +23,5 @@ void resizeDynamicSize(IArraySource & array_source, IValueSource & value_source,
ArrayResizeDynamic
::
select
(
sink
,
array_source
,
value_source
,
size_column
);
}
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录