2019-12-18 03:56:03 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.h>
|
|
|
|
#include <Interpreters/DatabaseAndTableWithAlias.h>
|
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
2019-12-18 03:56:03 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-11-26 15:49:40 +00:00
|
|
|
class ASTFunction;
|
|
|
|
class ASTIdentifier;
|
|
|
|
|
2019-12-18 03:56:03 +00:00
|
|
|
|
|
|
|
struct ExpressionInfoMatcher
|
|
|
|
{
|
2021-06-01 12:20:52 +00:00
|
|
|
struct Data : public WithContext
|
2019-12-18 03:56:03 +00:00
|
|
|
{
|
2020-06-05 21:17:00 +00:00
|
|
|
const TablesWithColumns & tables;
|
2019-12-18 03:56:03 +00:00
|
|
|
|
|
|
|
bool is_array_join = false;
|
|
|
|
bool is_stateful_function = false;
|
|
|
|
bool is_aggregate_function = false;
|
2020-12-24 04:03:33 +00:00
|
|
|
bool is_window_function = false;
|
2020-11-22 14:17:09 +00:00
|
|
|
bool is_deterministic_function = true;
|
2020-01-04 04:31:45 +00:00
|
|
|
std::unordered_set<size_t> unique_reference_tables_pos = {};
|
2019-12-18 03:56:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void visit(const ASTPtr & ast, Data & data);
|
|
|
|
|
2020-01-06 10:33:08 +00:00
|
|
|
static bool needChildVisit(const ASTPtr & node, const ASTPtr &);
|
2019-12-18 03:56:03 +00:00
|
|
|
|
|
|
|
static void visit(const ASTFunction & ast_function, const ASTPtr &, Data & data);
|
|
|
|
|
|
|
|
static void visit(const ASTIdentifier & identifier, const ASTPtr &, Data & data);
|
|
|
|
};
|
|
|
|
|
|
|
|
using ExpressionInfoVisitor = ConstInDepthNodeVisitor<ExpressionInfoMatcher, true>;
|
|
|
|
|
2021-06-01 12:20:52 +00:00
|
|
|
bool hasNonRewritableFunction(const ASTPtr & node, ContextPtr context);
|
2020-01-04 04:31:45 +00:00
|
|
|
|
2019-12-18 03:56:03 +00:00
|
|
|
}
|