2012-03-11 08:55:04 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-17 14:34:25 +00:00
|
|
|
#include <DataStreams/IBlockStream_fwd.h>
|
2012-03-11 08:55:04 +00:00
|
|
|
|
2019-05-17 18:45:42 +00:00
|
|
|
#include <functional>
|
2012-03-11 08:55:04 +00:00
|
|
|
|
2019-03-26 18:28:37 +00:00
|
|
|
#include <Processors/QueryPipeline.h>
|
|
|
|
|
2012-03-11 08:55:04 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2015-06-21 06:06:04 +00:00
|
|
|
class ProcessListEntry;
|
|
|
|
|
2012-03-11 08:55:04 +00:00
|
|
|
struct BlockIO
|
|
|
|
{
|
2019-03-29 20:31:06 +00:00
|
|
|
BlockIO() = default;
|
2020-02-27 15:40:11 +00:00
|
|
|
BlockIO(BlockIO &&) = default;
|
|
|
|
|
|
|
|
BlockIO & operator= (BlockIO && rhs);
|
|
|
|
~BlockIO();
|
|
|
|
|
|
|
|
BlockIO(const BlockIO &) = delete;
|
|
|
|
BlockIO & operator= (const BlockIO & rhs) = delete;
|
2019-03-29 20:31:06 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::shared_ptr<ProcessListEntry> process_list_entry;
|
|
|
|
|
2019-05-23 13:54:11 +00:00
|
|
|
BlockOutputStreamPtr out;
|
|
|
|
BlockInputStreamPtr in;
|
|
|
|
|
2019-06-25 17:00:54 +00:00
|
|
|
QueryPipeline pipeline;
|
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
/// Callbacks for query logging could be set here.
|
2017-04-13 16:12:56 +00:00
|
|
|
std::function<void(IBlockInputStream *, IBlockOutputStream *)> finish_callback;
|
2017-04-01 07:20:54 +00:00
|
|
|
std::function<void()> exception_callback;
|
|
|
|
|
2019-11-04 03:53:26 +00:00
|
|
|
/// When it is true, don't bother sending any non-empty blocks to the out stream
|
|
|
|
bool null_format = false;
|
|
|
|
|
2017-05-13 22:19:04 +00:00
|
|
|
/// Call these functions if you want to log the request.
|
2017-04-01 07:20:54 +00:00
|
|
|
void onFinish()
|
|
|
|
{
|
|
|
|
if (finish_callback)
|
|
|
|
finish_callback(in.get(), out.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
void onException()
|
|
|
|
{
|
|
|
|
if (exception_callback)
|
|
|
|
exception_callback();
|
|
|
|
}
|
|
|
|
|
2020-02-27 15:40:11 +00:00
|
|
|
private:
|
|
|
|
void reset();
|
2012-03-11 08:55:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|