diff --git a/src/Interpreters/ExpressionActions.h b/src/Interpreters/ExpressionActions.h index 61d3eb2e4ad..8f66e6c5c3a 100644 --- a/src/Interpreters/ExpressionActions.h +++ b/src/Interpreters/ExpressionActions.h @@ -327,8 +327,12 @@ struct ExpressionActionsChain ExpressionActionsPtr getLastActions(bool allow_empty = false) { - if (steps.empty() && !allow_empty) + if (steps.empty()) + { + if (allow_empty) + return {}; throw Exception("Empty ExpressionActionsChain", ErrorCodes::LOGICAL_ERROR); + } return steps.back().actions; } diff --git a/src/Interpreters/ExpressionAnalyzer.cpp b/src/Interpreters/ExpressionAnalyzer.cpp index c245190cb85..4fbcf252b36 100644 --- a/src/Interpreters/ExpressionAnalyzer.cpp +++ b/src/Interpreters/ExpressionAnalyzer.cpp @@ -1161,8 +1161,7 @@ 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(); - const auto * hash_join = typeid_cast(join_algo.get()); - join_allow_read_in_order = hash_join && !join_algo->hasStreamWithNonJoinedRows(); + join_allow_read_in_order = typeid_cast(join_algo.get()) && !join_algo->hasStreamWithNonJoinedRows(); } optimize_read_in_order =