mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
keep ArrayJoin optimisation
This commit is contained in:
parent
2d7d389b77
commit
9637dad462
@ -504,11 +504,7 @@ void ExpressionAnalyzer::addJoinAction(ExpressionActionsPtr & actions, JoinPtr j
|
||||
|
||||
bool SelectQueryExpressionAnalyzer::appendJoin(ExpressionActionsChain & chain, bool only_types)
|
||||
{
|
||||
const ASTTablesInSelectQueryElement * ast_join = getSelectQuery()->join();
|
||||
if (!ast_join)
|
||||
return false;
|
||||
|
||||
JoinPtr table_join = makeTableJoin(*ast_join);
|
||||
JoinPtr table_join = makeTableJoin(*syntax->ast_join);
|
||||
|
||||
initChain(chain, sourceColumns());
|
||||
ExpressionActionsChain::Step & step = chain.steps.back();
|
||||
@ -1101,12 +1097,14 @@ ExpressionAnalysisResult::ExpressionAnalysisResult(
|
||||
|
||||
query_analyzer.appendArrayJoin(chain, only_types || !first_stage);
|
||||
|
||||
before_join = chain.getLastActions(true);
|
||||
if (before_join)
|
||||
chain.addStep();
|
||||
|
||||
if (query_analyzer.appendJoin(chain, only_types || !first_stage))
|
||||
if (query_analyzer.hasTableJoin())
|
||||
{
|
||||
before_join = chain.getLastActions(true);
|
||||
if (before_join)
|
||||
chain.addStep();
|
||||
|
||||
query_analyzer.appendJoin(chain, only_types || !first_stage);
|
||||
|
||||
join = chain.getLastActions();
|
||||
if (!join)
|
||||
throw Exception("No expected JOIN", ErrorCodes::LOGICAL_ERROR);
|
||||
|
@ -250,6 +250,7 @@ public:
|
||||
/// Does the expression have aggregate functions or a GROUP BY or HAVING section.
|
||||
bool hasAggregation() const { return has_aggregation; }
|
||||
bool hasGlobalSubqueries() { return has_global_subqueries; }
|
||||
bool hasTableJoin() const { return syntax->ast_join; }
|
||||
|
||||
const NamesAndTypesList & aggregationKeys() const { return aggregation_keys; }
|
||||
const AggregateDescriptions & aggregates() const { return aggregate_descriptions; }
|
||||
|
@ -993,6 +993,7 @@ SyntaxAnalyzerResultPtr SyntaxAnalyzer::analyzeSelect(
|
||||
|
||||
result.aggregates = getAggregates(query, *select_query);
|
||||
result.collectUsedColumns(query, true);
|
||||
result.ast_join = select_query->join();
|
||||
|
||||
if (result.optimize_trivial_count)
|
||||
result.optimize_trivial_count = settings.optimize_trivial_count_query &&
|
||||
|
@ -11,6 +11,7 @@ namespace DB
|
||||
{
|
||||
|
||||
class ASTFunction;
|
||||
struct ASTTablesInSelectQueryElement;
|
||||
class TableJoin;
|
||||
class Context;
|
||||
struct Settings;
|
||||
@ -24,6 +25,7 @@ struct SyntaxAnalyzerResult
|
||||
ConstStoragePtr storage;
|
||||
StorageMetadataPtr metadata_snapshot;
|
||||
std::shared_ptr<TableJoin> analyzed_join;
|
||||
const ASTTablesInSelectQueryElement * ast_join = nullptr;
|
||||
|
||||
NamesAndTypesList source_columns;
|
||||
NameSet source_columns_set; /// Set of names of source_columns.
|
||||
|
Loading…
Reference in New Issue
Block a user