Preparations, part 7: Analyzers use const Context (and could be used in ExpressionAnalyzer) [#CLICKHOUSE-31].

This commit is contained in:
Alexey Milovidov 2017-05-23 21:53:11 +03:00
parent 34cd1b9787
commit c4f58f776b
7 changed files with 16 additions and 16 deletions

View File

@ -20,7 +20,7 @@ namespace ErrorCodes
}
void AnalyzeResultOfQuery::process(ASTPtr & ast, Context & context)
void AnalyzeResultOfQuery::process(ASTPtr & ast, const Context & context)
{
const ASTSelectQuery * select = typeid_cast<const ASTSelectQuery *>(ast.get());
if (!select)

View File

@ -19,7 +19,7 @@ class Context;
*/
struct AnalyzeResultOfQuery
{
void process(ASTPtr & ast, Context & context);
void process(ASTPtr & ast, const Context & context);
/// Block will have non-nullptr columns for constant expressions.
Block result;

View File

@ -31,9 +31,9 @@ struct CollectAliases
enum class Kind
{
Expression, /// Example: SELECT a AS b, f(x) AS y
Table, /// Example: SELECT t.* FROM (SELECT 1) AS t
ArrayJoin /// Example: SELECT t.x.a FROM t ARRAY JOIN arr AS x
Expression, /// Example: SELECT a AS b, f(x) AS y
Table, /// Example: SELECT t.* FROM (SELECT 1) AS t
ArrayJoin /// Example: SELECT t.x.a FROM t ARRAY JOIN arr AS x
};
struct AliasInfo

View File

@ -49,7 +49,7 @@ static CollectTables::TableInfo processOrdinaryTable(const ASTPtr & ast_database
}
static CollectTables::TableInfo processTableFunction(const ASTPtr & ast_table_function, Context & context)
static CollectTables::TableInfo processTableFunction(const ASTPtr & ast_table_function, const Context & context)
{
const ASTFunction & function = typeid_cast<const ASTFunction &>(*ast_table_function);
@ -78,7 +78,7 @@ static CollectTables::TableInfo processNoTables(const Context & context)
}
static CollectTables::TableInfo processSubquery(ASTPtr & ast_subquery, Context & context)
static CollectTables::TableInfo processSubquery(ASTPtr & ast_subquery, const Context & context)
{
AnalyzeResultOfQuery analyzer;
analyzer.process(typeid_cast<ASTSubquery &>(*ast_subquery).children.at(0), context);
@ -91,7 +91,7 @@ static CollectTables::TableInfo processSubquery(ASTPtr & ast_subquery, Context &
}
void CollectTables::process(ASTPtr & ast, Context & context, const CollectAliases & aliases)
void CollectTables::process(ASTPtr & ast, const Context & context, const CollectAliases & aliases)
{
const ASTSelectQuery * select = typeid_cast<const ASTSelectQuery *>(ast.get());
if (!select)

View File

@ -24,7 +24,7 @@ class WriteBuffer;
*/
struct CollectTables
{
void process(ASTPtr & ast, Context & context, const CollectAliases & aliases);
void process(ASTPtr & ast, const Context & context, const CollectAliases & aliases);
enum class Kind
{

View File

@ -56,7 +56,7 @@ using LambdaParameters = std::unordered_map<String, DataTypePtr>;
void processImpl(
ASTPtr & ast, Context & context,
ASTPtr & ast, const Context & context,
CollectAliases & aliases, const AnalyzeColumns & columns,
TypeAndConstantInference::Info & info,
const AnalyzeLambdas & lambdas);
@ -76,7 +76,7 @@ void processLiteral(const String & column_name, const ASTPtr & ast, TypeAndConst
void processIdentifier(const String & column_name, const ASTPtr & ast, TypeAndConstantInference::Info & info,
Context & context, CollectAliases & aliases, const AnalyzeColumns & columns,
const Context & context, CollectAliases & aliases, const AnalyzeColumns & columns,
const AnalyzeLambdas & lambdas)
{
/// Column from table
@ -258,7 +258,7 @@ void processFunction(const String & column_name, ASTPtr & ast, TypeAndConstantIn
void processScalarSubquery(const String & column_name, ASTPtr & ast, TypeAndConstantInference::Info & info,
Context & context)
const Context & context)
{
ASTSubquery * subquery = static_cast<ASTSubquery *>(ast.get());
@ -316,7 +316,7 @@ void processScalarSubquery(const String & column_name, ASTPtr & ast, TypeAndCons
void processHigherOrderFunction(const String & column_name,
ASTPtr & ast, Context & context,
ASTPtr & ast, const Context & context,
CollectAliases & aliases, const AnalyzeColumns & columns,
TypeAndConstantInference::Info & info,
const AnalyzeLambdas & lambdas)
@ -395,7 +395,7 @@ void processHigherOrderFunction(const String & column_name,
void processImpl(
ASTPtr & ast, Context & context,
ASTPtr & ast, const Context & context,
CollectAliases & aliases, const AnalyzeColumns & columns,
TypeAndConstantInference::Info & info,
const AnalyzeLambdas & lambdas)
@ -468,7 +468,7 @@ void processImpl(
}
void TypeAndConstantInference::process(ASTPtr & ast, Context & context,
void TypeAndConstantInference::process(ASTPtr & ast, const Context & context,
CollectAliases & aliases, const AnalyzeColumns & columns, const AnalyzeLambdas & lambdas)
{
processImpl(ast, context, aliases, columns, info, lambdas);

View File

@ -30,7 +30,7 @@ class IAggregateFunction;
*/
struct TypeAndConstantInference
{
void process(ASTPtr & ast, Context & context,
void process(ASTPtr & ast, const Context & context,
CollectAliases & aliases,
const AnalyzeColumns & columns,
const AnalyzeLambdas & analyze_lambdas);