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 &);
|
2023-09-07 02:35:21 +00:00
|
|
|
static bool needChildVisit(const ASTPtr & ast, const ASTPtr &);
|
2023-02-09 04:26:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using RewriteArrayExistsFunctionVisitor = InDepthNodeVisitor<RewriteArrayExistsFunctionMatcher, false>;
|
|
|
|
}
|