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