From 0e49a9ed4d65af9891ec65480aa62d0611746ebe Mon Sep 17 00:00:00 2001 From: Artem Zuikov Date: Thu, 25 Jun 2020 21:44:05 +0300 Subject: [PATCH] fix crash --- src/Interpreters/ExpressionActions.h | 6 +++++- src/Interpreters/ExpressionAnalyzer.cpp | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) 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 =