remove useless logic

This commit is contained in:
Artem Zuikov 2020-06-25 21:18:27 +03:00
parent 801efc387a
commit ae5ed098f4
2 changed files with 13 additions and 34 deletions

View File

@ -1161,7 +1161,8 @@ ExpressionAnalysisResult::ExpressionAnalysisResult(
{
/// You may find it strange but we support read_in_order for HashJoin and do not support for MergeJoin.
auto join_algo = join->getTableJoinAlgo();
join_allow_read_in_order = typeid_cast<HashJoin *>(join_algo.get()) && !join_algo->hasStreamWithNonJoinedRows();
const auto * hash_join = typeid_cast<HashJoin *>(join_algo.get());
join_allow_read_in_order = hash_join && !join_algo->hasStreamWithNonJoinedRows();
}
optimize_read_in_order =

View File

@ -864,6 +864,7 @@ void InterpreterSelectQuery::executeImpl(QueryPlan & query_plan, const BlockInpu
query_plan.getCurrentDataStream(),
expressions.before_join,
true);
before_join_step->setStepDescription("Before JOIN");
query_plan.addStep(std::move(before_join_step));
}
@ -874,45 +875,22 @@ void InterpreterSelectQuery::executeImpl(QueryPlan & query_plan, const BlockInpu
join_result_sample = ExpressionTransform::transformHeader(query_plan.getCurrentDataStream().header, expressions.join);
bool inflating_join = false;
if (join)
{
inflating_join = true;
if (auto * hash_join = typeid_cast<HashJoin *>(join.get()))
inflating_join = isCross(hash_join->getKind());
}
QueryPlanStepPtr join_step;
if (inflating_join)
{
join_step = std::make_unique<InflatingExpressionStep>(
query_plan.getCurrentDataStream(),
expressions.join,
true);
}
else
{
join_step = std::make_unique<ExpressionStep>(
query_plan.getCurrentDataStream(),
expressions.join,
true);
}
QueryPlanStepPtr join_step = std::make_unique<InflatingExpressionStep>(
query_plan.getCurrentDataStream(),
expressions.join,
true);
join_step->setStepDescription("JOIN");
query_plan.addStep(std::move(join_step));
if (join)
if (auto stream = join->createStreamWithNonJoinedRows(join_result_sample, settings.max_block_size))
{
if (auto stream = join->createStreamWithNonJoinedRows(join_result_sample, settings.max_block_size))
{
auto source = std::make_shared<SourceFromInputStream>(std::move(stream));
auto add_non_joined_rows_step = std::make_unique<AddingDelayedStreamStep>(
query_plan.getCurrentDataStream(), std::move(source));
auto source = std::make_shared<SourceFromInputStream>(std::move(stream));
auto add_non_joined_rows_step = std::make_unique<AddingDelayedStreamStep>(
query_plan.getCurrentDataStream(), std::move(source));
add_non_joined_rows_step->setStepDescription("Add non-joined rows after JOIN");
query_plan.addStep(std::move(add_non_joined_rows_step));
}
add_non_joined_rows_step->setStepDescription("Add non-joined rows after JOIN");
query_plan.addStep(std::move(add_non_joined_rows_step));
}
}