Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
57d727d0
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,发现更多精彩内容 >>
提交
57d727d0
编写于
7月 02, 2020
作者:
N
Nikolai Kochetov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix result_rows and result_bytes metrics for selects.
上级
4d01fb3c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
4 deletion
+31
-4
src/DataStreams/BlockIO.h
src/DataStreams/BlockIO.h
+9
-3
src/Interpreters/executeQuery.cpp
src/Interpreters/executeQuery.cpp
+10
-1
src/Processors/Formats/IOutputFormat.cpp
src/Processors/Formats/IOutputFormat.cpp
+2
-0
src/Processors/Formats/IOutputFormat.h
src/Processors/Formats/IOutputFormat.h
+8
-0
src/Processors/QueryPipeline.h
src/Processors/QueryPipeline.h
+2
-0
未找到文件。
src/DataStreams/BlockIO.h
浏览文件 @
57d727d0
...
...
@@ -31,8 +31,8 @@ struct BlockIO
QueryPipeline
pipeline
;
/// Callbacks for query logging could be set here.
std
::
function
<
void
(
IBlockInputStream
*
,
IBlockOutputStream
*
)
>
finish_callback
;
std
::
function
<
void
()
>
exception_callback
;
std
::
function
<
void
(
IBlockInputStream
*
,
IBlockOutputStream
*
,
QueryPipeline
*
)
>
finish_callback
;
std
::
function
<
void
()
>
exception_callback
;
/// When it is true, don't bother sending any non-empty blocks to the out stream
bool
null_format
=
false
;
...
...
@@ -41,7 +41,13 @@ struct BlockIO
void
onFinish
()
{
if
(
finish_callback
)
finish_callback
(
in
.
get
(),
out
.
get
());
{
QueryPipeline
*
pipeline_ptr
=
nullptr
;
if
(
pipeline
.
initialized
())
pipeline_ptr
=
&
pipeline
;
finish_callback
(
in
.
get
(),
out
.
get
(),
pipeline_ptr
);
}
}
void
onException
()
...
...
src/Interpreters/executeQuery.cpp
浏览文件 @
57d727d0
...
...
@@ -479,7 +479,8 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
}
/// Also make possible for caller to log successful query finish and exception during execution.
auto
finish_callback
=
[
elem
,
&
context
,
log_queries
,
log_queries_min_type
=
settings
.
log_queries_min_type
]
(
IBlockInputStream
*
stream_in
,
IBlockOutputStream
*
stream_out
)
mutable
auto
finish_callback
=
[
elem
,
&
context
,
log_queries
,
log_queries_min_type
=
settings
.
log_queries_min_type
]
(
IBlockInputStream
*
stream_in
,
IBlockOutputStream
*
stream_out
,
QueryPipeline
*
query_pipeline
)
mutable
{
QueryStatus
*
process_list_elem
=
context
.
getProcessListElement
();
...
...
@@ -528,6 +529,14 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
elem
.
result_bytes
=
counting_stream
->
getProgress
().
read_bytes
;
}
}
else
if
(
query_pipeline
)
{
if
(
const
auto
*
output_format
=
query_pipeline
->
getOutputFormat
())
{
elem
.
result_rows
=
output_format
->
getResultRows
();
elem
.
result_bytes
=
output_format
->
getResultBytes
();
}
}
if
(
elem
.
read_rows
!=
0
)
{
...
...
src/Processors/Formats/IOutputFormat.cpp
浏览文件 @
57d727d0
...
...
@@ -59,6 +59,8 @@ void IOutputFormat::work()
switch
(
current_block_kind
)
{
case
Main
:
result_rows
+=
current_chunk
.
getNumRows
();
result_bytes
+=
current_chunk
.
allocatedBytes
();
consume
(
std
::
move
(
current_chunk
));
break
;
case
Totals
:
...
...
src/Processors/Formats/IOutputFormat.h
浏览文件 @
57d727d0
...
...
@@ -79,6 +79,14 @@ public:
void
setTotals
(
const
Block
&
totals
)
{
consumeTotals
(
Chunk
(
totals
.
getColumns
(),
totals
.
rows
()));
}
void
setExtremes
(
const
Block
&
extremes
)
{
consumeExtremes
(
Chunk
(
extremes
.
getColumns
(),
extremes
.
rows
()));
}
size_t
getResultRows
()
const
{
return
result_rows
;
}
size_t
getResultBytes
()
const
{
return
result_rows
;
}
private:
/// Counters for consumed chunks. Are used for QueryLog.
size_t
result_rows
=
0
;
size_t
result_bytes
=
0
;
};
}
src/Processors/QueryPipeline.h
浏览文件 @
57d727d0
...
...
@@ -110,6 +110,8 @@ public:
void
addCreatingSetsTransform
(
ProcessorPtr
transform
);
/// Resize pipeline to single output and add IOutputFormat. Pipeline will be completed after this transformation.
void
setOutputFormat
(
ProcessorPtr
output
);
/// Get current OutputFormat.
IOutputFormat
*
getOutputFormat
()
const
{
return
output_format
;
}
/// Sink is a processor with single input port and no output ports. Creates sink for each output port.
/// Pipeline will be completed after this transformation.
void
setSinks
(
const
ProcessorGetterWithStreamKind
&
getter
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录