2016-12-06 20:55:13 +00:00
|
|
|
#pragma once
|
2017-03-13 23:13:49 +00:00
|
|
|
|
2018-01-06 18:10:44 +00:00
|
|
|
#include <Parsers/IAST.h>
|
2019-01-23 14:48:50 +00:00
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
2017-03-13 23:13:49 +00:00
|
|
|
#include <cstddef>
|
2018-01-08 01:14:43 +00:00
|
|
|
#include <memory>
|
2017-03-13 23:13:49 +00:00
|
|
|
|
2016-12-06 20:55:13 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-01-06 18:10:44 +00:00
|
|
|
struct BlockIO;
|
|
|
|
class Context;
|
2016-12-06 20:55:13 +00:00
|
|
|
|
2016-12-09 10:10:12 +00:00
|
|
|
/** Prepares an input stream which produce data containing in INSERT query
|
|
|
|
* Head of inserting data could be stored in INSERT ast directly
|
|
|
|
* Remaining (tail) data could be stored in input_buffer_tail_part
|
|
|
|
*/
|
2019-01-23 14:48:50 +00:00
|
|
|
class InputStreamFromASTInsertQuery : public IBlockInputStream
|
2016-12-06 20:55:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-05-30 20:12:44 +00:00
|
|
|
InputStreamFromASTInsertQuery(const ASTPtr & ast,
|
|
|
|
ReadBuffer * input_buffer_tail_part,
|
|
|
|
const Block & header,
|
|
|
|
const Context & context,
|
|
|
|
const ASTPtr & input_function);
|
2016-12-06 20:55:13 +00:00
|
|
|
|
2017-11-20 04:46:00 +00:00
|
|
|
Block readImpl() override { return res_stream->read(); }
|
|
|
|
void readPrefixImpl() override { return res_stream->readPrefix(); }
|
|
|
|
void readSuffixImpl() override { return res_stream->readSuffix(); }
|
2016-12-06 20:55:13 +00:00
|
|
|
|
2017-11-20 04:46:00 +00:00
|
|
|
String getName() const override { return "InputStreamFromASTInsertQuery"; }
|
2016-12-06 20:55:13 +00:00
|
|
|
|
2018-02-18 03:23:48 +00:00
|
|
|
Block getHeader() const override { return res_stream->getHeader(); }
|
2016-12-09 10:10:12 +00:00
|
|
|
|
2018-01-06 18:10:44 +00:00
|
|
|
private:
|
2018-01-08 01:14:43 +00:00
|
|
|
std::unique_ptr<ReadBuffer> input_buffer_ast_part;
|
|
|
|
std::unique_ptr<ReadBuffer> input_buffer_contacenated;
|
2016-12-06 20:55:13 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
BlockInputStreamPtr res_stream;
|
2016-12-06 20:55:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|