ClickHouse/dbms/include/DB/DataStreams/MergeSortingBlockInputStream.h

36 lines
840 B
C
Raw Normal View History

2011-09-04 01:42:14 +00:00
#pragma once
#include <DB/Core/SortDescription.h>
2011-09-04 21:23:19 +00:00
#include <DB/DataStreams/IProfilingBlockInputStream.h>
2011-09-04 01:42:14 +00:00
namespace DB
{
/** Соединяет поток сортированных по отдельности блоков в сортированный целиком поток.
*/
2011-09-04 21:23:19 +00:00
class MergeSortingBlockInputStream : public IProfilingBlockInputStream
2011-09-04 01:42:14 +00:00
{
public:
MergeSortingBlockInputStream(BlockInputStreamPtr input_, SortDescription & description_)
2011-09-04 21:23:19 +00:00
: input(input_), description(description_)
{
children.push_back(input);
}
2011-09-04 01:42:14 +00:00
2011-09-04 21:23:19 +00:00
Block readImpl();
String getName() const { return "MergeSortingBlockInputStream"; }
2011-09-04 01:42:14 +00:00
2011-10-24 12:10:59 +00:00
BlockInputStreamPtr clone() { return new MergeSortingBlockInputStream(input, description); }
2011-09-04 01:42:14 +00:00
private:
BlockInputStreamPtr input;
SortDescription description;
void merge(Block & left, Block & right);
};
}