2020-07-10 10:42:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.h>
|
2020-07-10 10:42:41 +00:00
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Parsers/IAST.h>
|
2020-07-10 10:42:41 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ASTFunction;
|
|
|
|
|
2020-08-08 01:01:47 +00:00
|
|
|
/// Removes unneeded injective functions inside `uniq*()`.
|
2020-07-10 10:42:41 +00:00
|
|
|
class RemoveInjectiveFunctionsMatcher
|
|
|
|
{
|
|
|
|
public:
|
2021-06-01 12:20:52 +00:00
|
|
|
struct Data : public WithContext
|
2020-07-10 10:42:41 +00:00
|
|
|
{
|
2021-06-01 12:20:52 +00:00
|
|
|
explicit Data(ContextPtr context_) : WithContext(context_) {}
|
2020-07-10 10:42:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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>;
|
|
|
|
|
|
|
|
}
|