mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 20:12:02 +00:00
45 lines
912 B
C++
45 lines
912 B
C++
#pragma once
|
|
|
|
#include <DB/Parsers/IAST.h>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class WriteBuffer;
|
|
class CollectAliases;
|
|
class CollectTables;
|
|
|
|
|
|
/** For every ARRAY JOIN, collect a map:
|
|
* result alias -> source
|
|
*
|
|
* There could be several variants:
|
|
*
|
|
* SELECT elem FROM t ARRAY JOIN array AS elem elem -> array
|
|
* SELECT n.elem FROM t ARRAY JOIN nested AS n n -> nested
|
|
* SELECT array FROM t ARRAY JOIN array array -> array
|
|
* SELECT nested.elem FROM t ARRAY JOIN nested nested -> nested
|
|
* SELECT elem FROM t ARRAY JOIN [1, 2, 3] AS elem elem -> [1, 2, 3]
|
|
*/
|
|
struct AnalyzeArrayJoins
|
|
{
|
|
void process(const ASTPtr & ast);
|
|
|
|
struct SourceInfo
|
|
{
|
|
String column_name;
|
|
ASTPtr node;
|
|
};
|
|
|
|
using ResultToSource = std::unordered_map<String, SourceInfo>;
|
|
using ArrayJoins = std::vector<ResultToSource>;
|
|
|
|
/// Debug output
|
|
void dump(WriteBuffer & out) const;
|
|
};
|
|
|
|
}
|