ClickHouse/src/Interpreters/RewriteArrayExistsFunctionVisitor.h

26 lines
639 B
C++
Raw Normal View History

2023-02-09 04:26:32 +00:00
#pragma once
#include <Interpreters/InDepthNodeVisitor.h>
2023-02-09 08:30:53 +00:00
#include <Parsers/IAST.h>
2023-02-09 04:26:32 +00:00
namespace DB
{
class ASTFunction;
/// Rewrite possible 'arrayExists(func, arr)' to 'has(arr, elem)' to improve performance
/// arrayExists(x -> x = 1, arr) -> has(arr, 1)
class RewriteArrayExistsFunctionMatcher
{
public:
2023-02-09 08:30:53 +00:00
struct Data
{
};
2023-02-09 04:26:32 +00:00
static void visit(ASTPtr & ast, Data &);
static void visit(const ASTFunction &, ASTPtr & ast, Data &);
static bool needChildVisit(const ASTPtr &, const ASTPtr &) { return true; }
};
using RewriteArrayExistsFunctionVisitor = InDepthNodeVisitor<RewriteArrayExistsFunctionMatcher, false>;
}