#pragma once #include #include namespace DB { /** Сортирует каждый блок по отдельности по значениям указанных столбцов. * На данный момент, используется не очень оптимальный алгоритм. */ class PartialSortingBlockInputStream : public IProfilingBlockInputStream { public: PartialSortingBlockInputStream(BlockInputStreamPtr input_, SortDescription & description_) : description(description_) { children.push_back(input_); } String getName() const { return "PartialSortingBlockInputStream"; } String getID() const { std::stringstream res; res << "PartialSorting(" << children.back()->getID(); for (size_t i = 0; i < description.size(); ++i) res << ", " << description[i].getID(); res << ")"; return res.str(); } protected: Block readImpl(); private: SortDescription description; }; }