ClickHouse/src/Interpreters/RemoveInjectiveFunctionsVisitor.h

30 lines
697 B
C++
Raw Normal View History

#pragma once
#include <Interpreters/Context_fwd.h>
#include <Interpreters/InDepthNodeVisitor.h>
#include <Parsers/IAST.h>
namespace DB
{
class ASTFunction;
2020-08-08 01:01:47 +00:00
/// Removes unneeded injective functions inside `uniq*()`.
class RemoveInjectiveFunctionsMatcher
{
public:
2021-06-01 12:20:52 +00:00
struct Data : public WithContext
{
2021-06-01 12:20:52 +00:00
explicit Data(ContextPtr context_) : WithContext(context_) {}
};
static void visit(ASTPtr & ast, const Data & data);
static void visit(ASTFunction &, ASTPtr & ast, const Data & data);
static bool needChildVisit(const ASTPtr & node, const ASTPtr & child);
};
using RemoveInjectiveFunctionsVisitor = InDepthNodeVisitor<RemoveInjectiveFunctionsMatcher, true>;
}