Remove TOTALS handling in FillTransform

This commit is contained in:
Igor Nikonov 2023-03-13 19:53:40 +00:00
parent 21ec04bcd1
commit 85b0c5a1a4
3 changed files with 7 additions and 13 deletions

View File

@ -40,8 +40,10 @@ void FillingStep::transformPipeline(QueryPipelineBuilder & pipeline, const Build
{ {
pipeline.addSimpleTransform([&](const Block & header, QueryPipelineBuilder::StreamType stream_type) -> ProcessorPtr pipeline.addSimpleTransform([&](const Block & header, QueryPipelineBuilder::StreamType stream_type) -> ProcessorPtr
{ {
bool on_totals = stream_type == QueryPipelineBuilder::StreamType::Totals; if (stream_type == QueryPipelineBuilder::StreamType::Totals)
return std::make_shared<FillingTransform>(header, sort_description, std::move(interpolate_description), on_totals); return nullptr;
return std::make_shared<FillingTransform>(header, sort_description, std::move(interpolate_description));
}); });
} }

View File

@ -169,17 +169,13 @@ static bool tryConvertFields(FillColumnDescription & descr, const DataTypePtr &
} }
FillingTransform::FillingTransform( FillingTransform::FillingTransform(
const Block & header_, const SortDescription & sort_description_, InterpolateDescriptionPtr interpolate_description_, bool on_totals_) const Block & header_, const SortDescription & sort_description_, InterpolateDescriptionPtr interpolate_description_)
: ISimpleTransform(header_, transformHeader(header_, sort_description_), true) : ISimpleTransform(header_, transformHeader(header_, sort_description_), true)
, sort_description(sort_description_) , sort_description(sort_description_)
, interpolate_description(interpolate_description_) , interpolate_description(interpolate_description_)
, on_totals(on_totals_)
, filling_row(sort_description_) , filling_row(sort_description_)
, next_row(sort_description_) , next_row(sort_description_)
{ {
if (on_totals)
return;
if (interpolate_description) if (interpolate_description)
interpolate_actions = std::make_shared<ExpressionActions>(interpolate_description->actions); interpolate_actions = std::make_shared<ExpressionActions>(interpolate_description->actions);
@ -239,7 +235,7 @@ FillingTransform::FillingTransform(
IProcessor::Status FillingTransform::prepare() IProcessor::Status FillingTransform::prepare()
{ {
if (!on_totals && input.isFinished() && !output.isFinished() && !has_input && !generate_suffix) if (input.isFinished() && !output.isFinished() && !has_input && !generate_suffix)
{ {
should_insert_first = next_row < filling_row || first; should_insert_first = next_row < filling_row || first;
@ -266,9 +262,6 @@ IProcessor::Status FillingTransform::prepare()
void FillingTransform::transform(Chunk & chunk) void FillingTransform::transform(Chunk & chunk)
{ {
if (on_totals)
return;
if (!chunk.hasRows() && !generate_suffix) if (!chunk.hasRows() && !generate_suffix)
return; return;

View File

@ -16,7 +16,7 @@ namespace DB
class FillingTransform : public ISimpleTransform class FillingTransform : public ISimpleTransform
{ {
public: public:
FillingTransform(const Block & header_, const SortDescription & sort_description_, InterpolateDescriptionPtr interpolate_description_, bool on_totals_); FillingTransform(const Block & header_, const SortDescription & sort_description_, InterpolateDescriptionPtr interpolate_description_);
String getName() const override { return "FillingTransform"; } String getName() const override { return "FillingTransform"; }
@ -33,7 +33,6 @@ private:
const SortDescription sort_description; /// Contains only columns with WITH FILL. const SortDescription sort_description; /// Contains only columns with WITH FILL.
const InterpolateDescriptionPtr interpolate_description; /// Contains INTERPOLATE columns const InterpolateDescriptionPtr interpolate_description; /// Contains INTERPOLATE columns
const bool on_totals; /// FillingTransform does nothing on totals.
FillingRow filling_row; /// Current row, which is used to fill gaps. FillingRow filling_row; /// Current row, which is used to fill gaps.
FillingRow next_row; /// Row to which we need to generate filling rows. FillingRow next_row; /// Row to which we need to generate filling rows.