2018-02-25 00:50:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Core/QueryProcessingStage.h>
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <Interpreters/IInterpreter.h>
|
2019-03-15 13:49:58 +00:00
|
|
|
#include <Interpreters/SelectQueryOptions.h>
|
2018-02-25 00:50:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class InterpreterSelectQuery;
|
|
|
|
|
|
|
|
|
|
|
|
/** Interprets one or multiple SELECT queries inside UNION ALL chain.
|
|
|
|
*/
|
2019-03-15 13:49:58 +00:00
|
|
|
class InterpreterSelectWithUnionQuery : public IInterpreter, private SelectQueryOptions
|
2018-02-25 00:50:53 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
InterpreterSelectWithUnionQuery(
|
|
|
|
const ASTPtr & query_ptr_,
|
|
|
|
const Context & context_,
|
2019-03-15 13:49:58 +00:00
|
|
|
const SelectQueryOptions &,
|
|
|
|
const Names & required_result_column_names = {});
|
2018-02-25 00:50:53 +00:00
|
|
|
|
2018-08-10 04:02:56 +00:00
|
|
|
~InterpreterSelectWithUnionQuery() override;
|
2018-02-25 00:50:53 +00:00
|
|
|
|
|
|
|
BlockIO execute() override;
|
|
|
|
|
|
|
|
/// Execute the query without union of streams.
|
|
|
|
BlockInputStreams executeWithMultipleStreams();
|
|
|
|
|
|
|
|
Block getSampleBlock();
|
|
|
|
|
|
|
|
static Block getSampleBlock(
|
|
|
|
const ASTPtr & query_ptr_,
|
|
|
|
const Context & context_);
|
|
|
|
|
2018-02-25 06:34:20 +00:00
|
|
|
void ignoreWithTotals();
|
|
|
|
|
2019-02-11 19:53:55 +00:00
|
|
|
ASTPtr getQuery() const { return query_ptr; }
|
|
|
|
|
2018-02-25 00:50:53 +00:00
|
|
|
private:
|
|
|
|
ASTPtr query_ptr;
|
|
|
|
Context context;
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<InterpreterSelectQuery>> nested_interpreters;
|
2018-02-26 06:12:59 +00:00
|
|
|
|
|
|
|
Block result_header;
|
2018-02-25 00:50:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|