diff --git a/src/sql/optimizer/ob_join_order.cpp b/src/sql/optimizer/ob_join_order.cpp index bac82130ca..1e51a86930 100644 --- a/src/sql/optimizer/ob_join_order.cpp +++ b/src/sql/optimizer/ob_join_order.cpp @@ -7428,7 +7428,19 @@ int ObJoinOrder::generate_temp_table_paths() LOG_WARN("failed to compute pipelined path", K(ret)); } else if (OB_FAIL(add_path(temp_table_path))) { LOG_WARN("failed to add path", K(ret)); - } else { /*do nothing*/ } + } else if (ObShardingInfo::is_shuffled_server_list(temp_table_path->server_list_)) { + /** Two temp tables with shuffled server list might not be in the same real server list + * TEMP1 (shuffled : s1,s2) TEMP2 (shuffled : s3,s4) + * | | + * GROUPY BY GROUP BY + * | | + * HASH EXCHANGE HASH EXCHANGE + * | | + * TABLE SCAN(s1, s2) TABLE SCAN(s3, s4) + * TEMP1 and TEMP2 should not be union all by ext partition wise + */ + temp_table_path->server_list_.reuse(); + } } return ret; } diff --git a/src/sql/optimizer/ob_logical_operator.cpp b/src/sql/optimizer/ob_logical_operator.cpp index 8e19c4925e..ba1732fd4f 100644 --- a/src/sql/optimizer/ob_logical_operator.cpp +++ b/src/sql/optimizer/ob_logical_operator.cpp @@ -1229,7 +1229,6 @@ int ObLogicalOperator::check_property_valid() const { int ret = OB_SUCCESS; if (OB_UNLIKELY(ObGlobalHint::DEFAULT_PARALLEL > get_parallel() - || get_server_list().empty() || get_server_cnt() < 1)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("has invalid parallel or server info", K(ret), K(get_parallel()),