2017-04-01 09:19:00 +00:00
|
|
|
#include <DataStreams/CountingBlockOutputStream.h>
|
|
|
|
#include <Common/ProfileEvents.h>
|
2016-12-30 16:22:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace ProfileEvents
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
extern const Event InsertedRows;
|
|
|
|
extern const Event InsertedBytes;
|
2016-12-30 16:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
void CountingBlockOutputStream::write(const Block & block)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
stream->write(block);
|
2016-12-30 16:22:37 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
Progress local_progress(block.rows(), block.bytes(), 0);
|
|
|
|
progress.incrementPiecewiseAtomically(local_progress);
|
2016-12-30 16:22:37 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
ProfileEvents::increment(ProfileEvents::InsertedRows, local_progress.rows);
|
|
|
|
ProfileEvents::increment(ProfileEvents::InsertedBytes, local_progress.bytes);
|
2016-12-30 16:22:37 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (process_elem)
|
|
|
|
process_elem->updateProgressOut(local_progress);
|
2016-12-30 16:22:37 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (progress_callback)
|
|
|
|
progress_callback(local_progress);
|
2016-12-30 16:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|