1#pragma once
2
3#include <Parsers/IAST.h>
4#include <Parsers/ASTIdentifier.h>
5#include <Interpreters/InDepthNodeVisitor.h>
6#include <Interpreters/DatabaseAndTableWithAlias.h>
7
8namespace DB
9{
10
11struct FindIdentifierBestTableData
12{
13 using TypeToVisit = ASTIdentifier;
14 using IdentifierWithTable = std::pair<ASTIdentifier *, const DatabaseAndTableWithAlias *>;
15
16 const std::vector<TableWithColumnNames> & tables;
17 std::vector<IdentifierWithTable> identifier_table;
18
19 FindIdentifierBestTableData(const std::vector<TableWithColumnNames> & tables_);
20
21 void visit(ASTIdentifier & identifier, ASTPtr &);
22};
23
24using FindIdentifierBestTableMatcher = OneTypeMatcher<FindIdentifierBestTableData>;
25using FindIdentifierBestTableVisitor = InDepthNodeVisitor<FindIdentifierBestTableMatcher, true>;
26
27}
28