Remove the forward declaration changes

This commit is contained in:
Alexander Kuzmenkov 2020-12-24 12:09:35 +03:00
parent 2bb0f5772e
commit c6c2b3ba00
44 changed files with 61 additions and 64 deletions

View File

@ -156,12 +156,12 @@ void AggregatingStep::transformPipeline(QueryPipeline & pipeline)
}
}
void AggregatingStep::describeActions(QueryPlanStepFormatSettings & settings) const
void AggregatingStep::describeActions(FormatSettings & settings) const
{
params.explain(settings.out, settings.offset);
}
void AggregatingStep::describePipeline(QueryPlanStepFormatSettings & settings) const
void AggregatingStep::describePipeline(FormatSettings & settings) const
{
if (!aggregating.empty())
IQueryPlanStep::describePipeline(aggregating, settings);

View File

@ -29,8 +29,8 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings &) const override;
void describePipeline(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings &) const override;
void describePipeline(FormatSettings & settings) const override;
private:
Aggregator::Params params;

View File

@ -69,7 +69,7 @@ void ArrayJoinStep::transformPipeline(QueryPipeline & pipeline)
}
}
void ArrayJoinStep::describeActions(QueryPlanStepFormatSettings & settings) const
void ArrayJoinStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
bool first = true;

View File

@ -15,7 +15,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
void updateInputStream(DataStream input_stream, Block result_header);

View File

@ -47,7 +47,7 @@ void CreatingSetStep::transformPipeline(QueryPipeline & pipeline)
pipeline.addCreatingSetsTransform(getOutputStream().header, std::move(subquery_for_set), network_transfer_limits, context);
}
void CreatingSetStep::describeActions(QueryPlanStepFormatSettings & settings) const
void CreatingSetStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
@ -102,7 +102,7 @@ QueryPipelinePtr CreatingSetsStep::updatePipeline(QueryPipelines pipelines)
return main_pipeline;
}
void CreatingSetsStep::describePipeline(QueryPlanStepFormatSettings & settings) const
void CreatingSetsStep::describePipeline(FormatSettings & settings) const
{
IQueryPlanStep::describePipeline(processors, settings);
}

View File

@ -22,7 +22,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
String description;
@ -40,7 +40,7 @@ public:
QueryPipelinePtr updatePipeline(QueryPipelines pipelines) override;
void describePipeline(QueryPlanStepFormatSettings & settings) const override;
void describePipeline(FormatSettings & settings) const override;
private:
Processors processors;

View File

@ -79,7 +79,7 @@ void DistinctStep::transformPipeline(QueryPipeline & pipeline)
});
}
void DistinctStep::describeActions(QueryPlanStepFormatSettings & settings) const
void DistinctStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Columns: ";

View File

@ -20,7 +20,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
SizeLimits set_size_limits;

View File

@ -87,7 +87,7 @@ void ExpressionStep::transformPipeline(QueryPipeline & pipeline)
}
}
void ExpressionStep::describeActions(QueryPlanStepFormatSettings & settings) const
void ExpressionStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
bool first = true;

View File

@ -26,7 +26,7 @@ public:
void updateInputStream(DataStream input_stream, bool keep_header);
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
const ActionsDAGPtr & getExpression() const { return actions_dag; }

View File

@ -43,7 +43,7 @@ void FillingStep::transformPipeline(QueryPipeline & pipeline)
});
}
void FillingStep::describeActions(QueryPlanStepFormatSettings & settings) const
void FillingStep::describeActions(FormatSettings & settings) const
{
settings.out << String(settings.offset, ' ');
dumpSortDescription(sort_description, input_streams.front().header, settings.out);

View File

@ -15,7 +15,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
SortDescription sort_description;

View File

@ -80,7 +80,7 @@ void FilterStep::transformPipeline(QueryPipeline & pipeline)
}
}
void FilterStep::describeActions(QueryPlanStepFormatSettings & settings) const
void FilterStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Filter column: " << filter_column_name << '\n';

View File

@ -22,7 +22,7 @@ public:
void updateInputStream(DataStream input_stream, bool keep_header);
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
const ActionsDAGPtr & getExpression() const { return actions_dag; }
const String & getFilterColumnName() const { return filter_column_name; }

View File

@ -85,7 +85,7 @@ void FinishSortingStep::transformPipeline(QueryPipeline & pipeline)
}
}
void FinishSortingStep::describeActions(QueryPlanStepFormatSettings & settings) const
void FinishSortingStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');

View File

@ -20,7 +20,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
/// Add limit or change it to lower value.
void updateLimit(size_t limit_);

View File

@ -18,8 +18,7 @@ const DataStream & IQueryPlanStep::getOutputStream() const
return *output_stream;
}
static void doDescribeHeader(const Block & header, size_t count,
QueryPlanStepFormatSettings & settings)
static void doDescribeHeader(const Block & header, size_t count, IQueryPlanStep::FormatSettings & settings)
{
String prefix(settings.offset, settings.indent_char);
prefix += "Header";
@ -53,8 +52,7 @@ static void doDescribeHeader(const Block & header, size_t count,
}
}
static void doDescribeProcessor(const IProcessor & processor, size_t count,
QueryPlanStepFormatSettings & settings)
static void doDescribeProcessor(const IProcessor & processor, size_t count, IQueryPlanStep::FormatSettings & settings)
{
settings.out << String(settings.offset, settings.indent_char) << processor.getName();
if (count > 1)
@ -91,7 +89,7 @@ static void doDescribeProcessor(const IProcessor & processor, size_t count,
settings.offset += settings.indent;
}
void IQueryPlanStep::describePipeline(const Processors & processors, QueryPlanStepFormatSettings & settings)
void IQueryPlanStep::describePipeline(const Processors & processors, FormatSettings & settings)
{
const IProcessor * prev = nullptr;
size_t count = 0;

View File

@ -61,16 +61,6 @@ public:
using DataStreams = std::vector<DataStream>;
// Not a nested class so that we can forward declare it.
struct QueryPlanStepFormatSettings
{
WriteBuffer & out;
size_t offset = 0;
const size_t indent = 2;
const char indent_char = ' ';
const bool write_header = false;
};
/// Single step of query plan.
class IQueryPlanStep
{
@ -96,11 +86,20 @@ public:
const std::string & getStepDescription() const { return step_description; }
void setStepDescription(std::string description) { step_description = std::move(description); }
struct FormatSettings
{
WriteBuffer & out;
size_t offset = 0;
const size_t indent = 2;
const char indent_char = ' ';
const bool write_header = false;
};
/// Get detailed description of step actions. This is shown in EXPLAIN query with options `actions = 1`.
virtual void describeActions(QueryPlanStepFormatSettings & /*settings*/) const {}
virtual void describeActions(FormatSettings & /*settings*/) const {}
/// Get description of processors added in current step. Should be called after updatePipeline().
virtual void describePipeline(QueryPlanStepFormatSettings & /*settings*/) const {}
virtual void describePipeline(FormatSettings & /*settings*/) const {}
protected:
DataStreams input_streams;
@ -109,7 +108,7 @@ protected:
/// Text description about what current step does.
std::string step_description;
static void describePipeline(const Processors & processors, QueryPlanStepFormatSettings & settings);
static void describePipeline(const Processors & processors, FormatSettings & settings);
};
using QueryPlanStepPtr = std::unique_ptr<IQueryPlanStep>;

View File

@ -19,7 +19,7 @@ QueryPipelinePtr ISourceStep::updatePipeline(QueryPipelines)
return pipeline;
}
void ISourceStep::describePipeline(QueryPlanStepFormatSettings & settings) const
void ISourceStep::describePipeline(FormatSettings & settings) const
{
IQueryPlanStep::describePipeline(processors, settings);
}

View File

@ -14,7 +14,7 @@ public:
virtual void initializePipeline(QueryPipeline & pipeline) = 0;
void describePipeline(QueryPlanStepFormatSettings & settings) const override;
void describePipeline(FormatSettings & settings) const override;
protected:
/// We collect processors got after pipeline transformation.

View File

@ -65,7 +65,7 @@ void ITransformingStep::updateDistinctColumns(const Block & res_header, NameSet
}
}
void ITransformingStep::describePipeline(QueryPlanStepFormatSettings & settings) const
void ITransformingStep::describePipeline(FormatSettings & settings) const
{
IQueryPlanStep::describePipeline(processors, settings);
}

View File

@ -55,7 +55,7 @@ public:
const TransformTraits & getTransformTraits() const { return transform_traits; }
const DataStreamTraits & getDataStreamTraits() const { return data_stream_traits; }
void describePipeline(QueryPlanStepFormatSettings & settings) const override;
void describePipeline(FormatSettings & settings) const override;
protected:
/// Clear distinct_columns if res_header doesn't contain all of them.

View File

@ -46,7 +46,7 @@ void LimitByStep::transformPipeline(QueryPipeline & pipeline)
});
}
void LimitByStep::describeActions(QueryPlanStepFormatSettings & settings) const
void LimitByStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');

View File

@ -16,7 +16,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
size_t group_length;

View File

@ -50,7 +50,7 @@ void LimitStep::transformPipeline(QueryPipeline & pipeline)
pipeline.addTransform(std::move(transform));
}
void LimitStep::describeActions(QueryPlanStepFormatSettings & settings) const
void LimitStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Limit " << limit << '\n';

View File

@ -20,7 +20,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
size_t getLimitForSorting() const
{

View File

@ -73,7 +73,7 @@ void MergeSortingStep::transformPipeline(QueryPipeline & pipeline)
});
}
void MergeSortingStep::describeActions(QueryPlanStepFormatSettings & settings) const
void MergeSortingStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Sort description: ";

View File

@ -26,7 +26,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
/// Add limit or change it to lower value.
void updateLimit(size_t limit_);

View File

@ -63,7 +63,7 @@ void MergingAggregatedStep::transformPipeline(QueryPipeline & pipeline)
}
}
void MergingAggregatedStep::describeActions(QueryPlanStepFormatSettings & settings) const
void MergingAggregatedStep::describeActions(FormatSettings & settings) const
{
return params->params.explain(settings.out, settings.offset);
}

View File

@ -23,7 +23,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
AggregatingTransformParamsPtr params;

View File

@ -153,7 +153,7 @@ void MergingFinal::transformPipeline(QueryPipeline & pipeline)
});
}
void MergingFinal::describeActions(QueryPlanStepFormatSettings & settings) const
void MergingFinal::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Sort description: ";

View File

@ -22,7 +22,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
size_t num_output_streams;

View File

@ -62,7 +62,7 @@ void MergingSortedStep::transformPipeline(QueryPipeline & pipeline)
}
}
void MergingSortedStep::describeActions(QueryPlanStepFormatSettings & settings) const
void MergingSortedStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Sort description: ";

View File

@ -21,7 +21,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
/// Add limit or change it to lower value.
void updateLimit(size_t limit_);

View File

@ -36,7 +36,7 @@ void OffsetStep::transformPipeline(QueryPipeline & pipeline)
pipeline.addTransform(std::move(transform));
}
void OffsetStep::describeActions(QueryPlanStepFormatSettings & settings) const
void OffsetStep::describeActions(FormatSettings & settings) const
{
settings.out << String(settings.offset, ' ') << "Offset " << offset << '\n';
}

View File

@ -15,7 +15,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
size_t offset;

View File

@ -70,7 +70,7 @@ void PartialSortingStep::transformPipeline(QueryPipeline & pipeline)
});
}
void PartialSortingStep::describeActions(QueryPlanStepFormatSettings & settings) const
void PartialSortingStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Sort description: ";

View File

@ -20,7 +20,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
/// Add limit or change it to lower value.
void updateLimit(size_t limit_);

View File

@ -74,7 +74,7 @@ static String totalsModeToString(TotalsMode totals_mode, double auto_include_thr
__builtin_unreachable();
}
void TotalsHavingStep::describeActions(QueryPlanStepFormatSettings & settings) const
void TotalsHavingStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Filter column: " << filter_column_name << '\n';

View File

@ -26,7 +26,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
bool overflow_row;

View File

@ -36,7 +36,7 @@ QueryPipelinePtr UnionStep::updatePipeline(QueryPipelines pipelines)
return pipeline;
}
void UnionStep::describePipeline(QueryPlanStepFormatSettings & settings) const
void UnionStep::describePipeline(FormatSettings & settings) const
{
IQueryPlanStep::describePipeline(processors, settings);
}

View File

@ -15,7 +15,7 @@ public:
QueryPipelinePtr updatePipeline(QueryPipelines pipelines) override;
void describePipeline(QueryPlanStepFormatSettings & settings) const override;
void describePipeline(FormatSettings & settings) const override;
private:
Block header;

View File

@ -71,7 +71,7 @@ void WindowStep::transformPipeline(QueryPipeline & pipeline)
"WindowStep transform for '" + window_description.window_name + "'");
}
void WindowStep::describeActions(QueryPlanStepFormatSettings & settings) const
void WindowStep::describeActions(FormatSettings & settings) const
{
String prefix(settings.offset, ' ');
settings.out << prefix << "Window: (";

View File

@ -22,7 +22,7 @@ public:
void transformPipeline(QueryPipeline & pipeline) override;
void describeActions(QueryPlanStepFormatSettings & settings) const override;
void describeActions(FormatSettings & settings) const override;
private:
WindowDescription window_description;