2020-06-17 19:20:30 +00:00
|
|
|
#include <Processors/QueryPlan/FillingStep.h>
|
|
|
|
#include <Processors/Transforms/FillingTransform.h>
|
|
|
|
#include <Processors/QueryPipeline.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-06-18 13:00:16 +00:00
|
|
|
static ITransformingStep::DataStreamTraits getTraits()
|
|
|
|
{
|
2020-06-18 20:11:42 +00:00
|
|
|
return ITransformingStep::DataStreamTraits
|
|
|
|
{
|
2020-06-22 10:18:28 +00:00
|
|
|
.preserves_distinct_columns = false, /// TODO: it seem to actually be true. Check it later.
|
|
|
|
.returns_single_stream = true,
|
|
|
|
.preserves_number_of_streams = true,
|
2020-06-18 13:00:16 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-06-17 19:20:30 +00:00
|
|
|
FillingStep::FillingStep(const DataStream & input_stream_, SortDescription sort_description_)
|
2020-06-18 13:00:16 +00:00
|
|
|
: ITransformingStep(input_stream_, input_stream_.header, getTraits())
|
2020-06-17 19:20:30 +00:00
|
|
|
, sort_description(std::move(sort_description_))
|
|
|
|
{
|
2020-06-22 10:18:28 +00:00
|
|
|
if (!input_stream_.has_single_port)
|
|
|
|
throw Exception("FillingStep expects single input", ErrorCodes::LOGICAL_ERROR);
|
2020-06-17 19:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FillingStep::transformPipeline(QueryPipeline & pipeline)
|
|
|
|
{
|
|
|
|
pipeline.addSimpleTransform([&](const Block & header)
|
|
|
|
{
|
|
|
|
return std::make_shared<FillingTransform>(header, sort_description);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|