diff --git a/src/Storages/WindowView/StorageWindowView.cpp b/src/Storages/WindowView/StorageWindowView.cpp index f942210884d..c0c3eb475e5 100644 --- a/src/Storages/WindowView/StorageWindowView.cpp +++ b/src/Storages/WindowView/StorageWindowView.cpp @@ -1171,8 +1171,8 @@ StorageWindowView::StorageWindowView( throw Exception(ErrorCodes::INCORRECT_QUERY, "SELECT query is not specified for {}", getName()); /// If the target table is not set, use inner target table - inner_target_table = query.to_table_id.empty(); - if (inner_target_table && !query.storage) + has_inner_target_table = query.to_table_id.empty(); + if (has_inner_target_table && !query.storage) throw Exception( "You must specify where to save results of a WindowView query: either ENGINE or an existing table in a TO clause", ErrorCodes::INCORRECT_QUERY); @@ -1192,7 +1192,7 @@ StorageWindowView::StorageWindowView( inner_table_id = StorageID(getStorageID().database_name, generateInnerTableName(getStorageID())); inner_fetch_query = generateInnerFetchQuery(inner_table_id); - target_table_id = inner_target_table ? StorageID(table_id_.database_name, generateTargetTableName(table_id_)) : query.to_table_id; + target_table_id = has_inner_target_table ? StorageID(table_id_.database_name, generateTargetTableName(table_id_)) : query.to_table_id; if (is_proctime) next_fire_signal = getWindowUpperBound(std::time(nullptr)); @@ -1205,7 +1205,7 @@ StorageWindowView::StorageWindowView( InterpreterCreateQuery create_interpreter(inner_create_query, create_context); create_interpreter.setInternal(true); create_interpreter.execute(); - if (inner_target_table) + if (has_inner_target_table) { /// create inner target table auto create_context = Context::createCopy(context_); @@ -1621,7 +1621,7 @@ void StorageWindowView::dropInnerTableIfAny(bool no_delay, ContextPtr local_cont InterpreterDropQuery::executeDropQuery( ASTDropQuery::Kind::Drop, getContext(), local_context, inner_table_id, no_delay); - if (inner_target_table) + if (has_inner_target_table) InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind::Drop, getContext(), local_context, target_table_id, no_delay); } catch (...) diff --git a/src/Storages/WindowView/StorageWindowView.h b/src/Storages/WindowView/StorageWindowView.h index b639a5924ad..8976ef3c912 100644 --- a/src/Storages/WindowView/StorageWindowView.h +++ b/src/Storages/WindowView/StorageWindowView.h @@ -201,7 +201,7 @@ private: std::atomic shutdown_called{false}; std::atomic modifying_query{false}; bool has_inner_table{true}; - bool inner_target_table{false}; + bool has_inner_target_table{false}; mutable Block input_header; mutable Block output_header; UInt64 fire_signal_timeout_s;