1 | #include <DataStreams/CountingBlockOutputStream.h> |
---|---|
2 | #include <Common/ProfileEvents.h> |
3 | |
4 | |
5 | namespace ProfileEvents |
6 | { |
7 | extern const Event InsertedRows; |
8 | extern const Event InsertedBytes; |
9 | } |
10 | |
11 | |
12 | namespace DB |
13 | { |
14 | |
15 | void CountingBlockOutputStream::write(const Block & block) |
16 | { |
17 | stream->write(block); |
18 | |
19 | Progress local_progress(block.rows(), block.bytes(), 0); |
20 | progress.incrementPiecewiseAtomically(local_progress); |
21 | |
22 | ProfileEvents::increment(ProfileEvents::InsertedRows, local_progress.read_rows); |
23 | ProfileEvents::increment(ProfileEvents::InsertedBytes, local_progress.read_bytes); |
24 | |
25 | if (process_elem) |
26 | process_elem->updateProgressOut(local_progress); |
27 | |
28 | if (progress_callback) |
29 | progress_callback(local_progress); |
30 | } |
31 | |
32 | } |
33 |