ClickHouse/src/Interpreters/InterpreterSelectWithUnionQuery.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.9 KiB
C++
Raw Normal View History

2018-02-25 00:50:53 +00:00
#pragma once
#include <Core/QueryProcessingStage.h>
2020-11-01 13:54:07 +00:00
#include <Interpreters/IInterpreterUnionOrSelectQuery.h>
2018-02-25 00:50:53 +00:00
namespace DB
{
class InterpreterSelectQuery;
class QueryPlan;
2018-02-25 00:50:53 +00:00
/** Interprets one or multiple SELECT queries inside UNION/UNION ALL/UNION DISTINCT chain.
2018-02-25 00:50:53 +00:00
*/
2020-11-01 13:54:07 +00:00
class InterpreterSelectWithUnionQuery : public IInterpreterUnionOrSelectQuery
2018-02-25 00:50:53 +00:00
{
public:
2020-11-01 13:54:07 +00:00
using IInterpreterUnionOrSelectQuery::getSampleBlock;
2018-02-25 00:50:53 +00:00
InterpreterSelectWithUnionQuery(
const ASTPtr & query_ptr_,
ContextPtr context_,
const SelectQueryOptions &,
const Names & required_result_column_names = {});
2018-02-25 00:50:53 +00:00
InterpreterSelectWithUnionQuery(
const ASTPtr & query_ptr_,
ContextMutablePtr context_,
const SelectQueryOptions &,
const Names & required_result_column_names = {});
~InterpreterSelectWithUnionQuery() override;
2018-02-25 00:50:53 +00:00
/// Builds QueryPlan for current query.
void buildQueryPlan(QueryPlan & query_plan) override;
2018-02-25 00:50:53 +00:00
BlockIO execute() override;
bool ignoreLimits() const override { return options.ignore_limits; }
bool ignoreQuota() const override { return options.ignore_quota; }
2018-02-25 00:50:53 +00:00
static Block getSampleBlock(
const ASTPtr & query_ptr_,
ContextPtr context_,
bool is_subquery = false,
bool is_create_parameterized_view = false);
2018-02-25 00:50:53 +00:00
void ignoreWithTotals() override;
bool supportsTransactions() const override { return true; }
2022-08-13 13:03:16 +00:00
void extendQueryLogElemImpl(QueryLogElement & elem, const ASTPtr & ast, ContextPtr context) const override;
2018-02-25 00:50:53 +00:00
private:
2020-11-01 13:54:07 +00:00
std::vector<std::unique_ptr<IInterpreterUnionOrSelectQuery>> nested_interpreters;
2018-02-26 06:12:59 +00:00
2020-11-01 13:54:07 +00:00
static Block getCommonHeaderForUnion(const Blocks & headers);
2019-04-09 13:07:07 +00:00
2020-11-01 13:54:07 +00:00
Block getCurrentChildResultHeader(const ASTPtr & ast_ptr_, const Names & required_result_column_names);
2020-11-01 13:54:07 +00:00
std::unique_ptr<IInterpreterUnionOrSelectQuery>
buildCurrentChildInterpreter(const ASTPtr & ast_ptr_, const Names & current_required_result_column_names);
2018-02-25 00:50:53 +00:00
};
}