2020-07-13 08:24:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IAST.h>
|
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ASTSelectQuery;
|
|
|
|
struct SettingChange;
|
2020-07-22 12:02:47 +00:00
|
|
|
class SettingsChanges;
|
2020-07-13 08:24:51 +00:00
|
|
|
|
|
|
|
/// Pushdown SETTINGS clause that goes after FORMAT to the SELECT query:
|
2022-09-02 08:54:48 +00:00
|
|
|
/// (since settings after FORMAT parsed separately not in the ParserSelectQuery but in ParserQueryWithOutput)
|
2020-07-13 08:24:51 +00:00
|
|
|
///
|
|
|
|
/// SELECT 1 FORMAT Null SETTINGS max_block_size = 1 ->
|
|
|
|
/// SELECT 1 SETTINGS max_block_size = 1 FORMAT Null SETTINGS max_block_size = 1
|
|
|
|
///
|
|
|
|
/// Otherwise settings after FORMAT will not be applied.
|
|
|
|
class QueryWithOutputSettingsPushDownMatcher
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using Visitor = InDepthNodeVisitor<QueryWithOutputSettingsPushDownMatcher, true>;
|
|
|
|
|
|
|
|
struct Data
|
|
|
|
{
|
|
|
|
const ASTPtr & settings_ast;
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool needChildVisit(ASTPtr & node, const ASTPtr & child);
|
|
|
|
static void visit(ASTPtr & ast, Data & data);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void visit(ASTSelectQuery &, ASTPtr &, Data &);
|
|
|
|
};
|
|
|
|
|
|
|
|
using QueryWithOutputSettingsPushDownVisitor = QueryWithOutputSettingsPushDownMatcher::Visitor;
|
|
|
|
|
|
|
|
}
|