mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
revert old architecture visitor until I get it working if needed
This commit is contained in:
parent
75e3faed85
commit
0f2b9612e3
@ -1,37 +0,0 @@
|
||||
#include "AutoFinalOnQueryVisitor.h"
|
||||
#include <Storages/IStorage.h>
|
||||
#include <Interpreters/Context.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
void AutoFinalOnQuery::visit(ASTPtr & query, Data & data)
|
||||
{
|
||||
if (auto * select_query = query->as<ASTSelectQuery>())
|
||||
visit(*select_query, data.storage, data.context);
|
||||
}
|
||||
|
||||
void AutoFinalOnQuery::visit(ASTSelectQuery & query, StoragePtr storage, ContextPtr context)
|
||||
{
|
||||
if (autoFinalOnQuery(query, storage, context))
|
||||
{
|
||||
query.setFinal();
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoFinalOnQuery::needChildVisit(ASTPtr &, const ASTPtr &)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoFinalOnQuery::autoFinalOnQuery(ASTSelectQuery & query, StoragePtr storage, ContextPtr context)
|
||||
{
|
||||
// query.tables() is required because not all queries have tables in it, it could be a function.
|
||||
bool is_auto_final_setting_on = context->getSettingsRef().final;
|
||||
bool is_final_supported = storage && storage->supportsFinal() && !storage->isRemote() && query.tables();
|
||||
bool is_query_already_final = query.final();
|
||||
|
||||
return is_auto_final_setting_on && !is_query_already_final && is_final_supported;
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Parsers/ASTSelectQuery.h>
|
||||
#include <Interpreters/Context_fwd.h>
|
||||
#include <Storages/IStorage_fwd.h>
|
||||
#include <Interpreters/InDepthNodeVisitor.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class AutoFinalOnQuery
|
||||
{
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
StoragePtr storage;
|
||||
ContextPtr context;
|
||||
};
|
||||
|
||||
static bool needChildVisit(ASTPtr &, const ASTPtr &);
|
||||
static void visit(ASTPtr & query, Data & data);
|
||||
|
||||
private:
|
||||
static void visit(ASTSelectQuery & select, StoragePtr storage, ContextPtr context);
|
||||
static bool autoFinalOnQuery(ASTSelectQuery & select_query, StoragePtr storage, ContextPtr context);
|
||||
|
||||
};
|
||||
|
||||
using AutoFinalOnQueryVisitor = InDepthNodeVisitor<AutoFinalOnQuery, true>;
|
||||
|
||||
}
|
@ -38,7 +38,6 @@
|
||||
#include <Interpreters/QueryLog.h>
|
||||
#include <Interpreters/replaceAliasColumnsInQuery.h>
|
||||
#include <Interpreters/RewriteCountDistinctVisitor.h>
|
||||
#include <Interpreters/AutoFinalOnQueryVisitor.h>
|
||||
|
||||
#include <QueryPipeline/Pipe.h>
|
||||
#include <Processors/QueryPlan/AggregatingStep.h>
|
||||
@ -504,14 +503,10 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
||||
query_info.additional_filter_ast = parseAdditionalFilterConditionForTable(
|
||||
settings.additional_table_filters, joined_tables.tablesWithColumns().front().table, *context);
|
||||
|
||||
AutoFinalOnQuery::Data abc{storage, context};
|
||||
|
||||
AutoFinalOnQueryVisitor(abc).visit(query_ptr);
|
||||
|
||||
// if (autoFinalOnQuery(query))
|
||||
// {
|
||||
// query.setFinal();
|
||||
// }
|
||||
if (autoFinalOnQuery(query))
|
||||
{
|
||||
query.setFinal();
|
||||
}
|
||||
|
||||
auto analyze = [&] (bool try_move_to_prewhere)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user