ClickHouse/dbms/src/DataStreams/CreatingSetsBlockInputStream.h

53 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <Poco/Logger.h>
#include <DataStreams/IBlockInputStream.h>
2017-05-23 20:04:42 +00:00
#include <Interpreters/ExpressionAnalyzer.h> /// SubqueriesForSets
namespace Poco { class Logger; }
namespace DB
{
2017-05-13 22:19:04 +00:00
/** Returns the data from the stream of blocks without changes, but
* in the `readPrefix` function or before reading the first block
* initializes all the passed sets.
*/
class CreatingSetsBlockInputStream : public IBlockInputStream
{
public:
CreatingSetsBlockInputStream(
const BlockInputStreamPtr & input,
const SubqueriesForSets & subqueries_for_sets_,
2018-04-19 21:34:04 +00:00
const SizeLimits & network_transfer_limits);
String getName() const override { return "CreatingSets"; }
Block getHeader() const override { return children.back()->getHeader(); }
2017-05-13 22:19:04 +00:00
/// Takes `totals` only from the main source, not from subquery sources.
Block getTotals() override;
protected:
Block readImpl() override;
void readPrefixImpl() override;
private:
SubqueriesForSets subqueries_for_sets;
bool created = false;
SizeLimits network_transfer_limits;
size_t rows_to_transfer = 0;
size_t bytes_to_transfer = 0;
using Logger = Poco::Logger;
Logger * log = &Logger::get("CreatingSetsBlockInputStream");
void createAll();
void createOne(SubqueryForSet & subquery);
};
}