diff --git a/src/sql/optimizer/ob_join_order.cpp b/src/sql/optimizer/ob_join_order.cpp index fe98c5346c9bbcaa789573ea50f4b7f425ec4fff..fe48774c14156e03eb48244cf4e404fcba252815 100644 --- a/src/sql/optimizer/ob_join_order.cpp +++ b/src/sql/optimizer/ob_join_order.cpp @@ -5701,16 +5701,19 @@ int ObJoinOrder::generate_base_table_paths(PathHelper &helper) ObSEArray tbl_part_infos; uint64_t table_id = table_id_; uint64_t ref_table_id = table_meta_info_.ref_table_id_; - if (OB_FAIL(create_access_paths(table_id, ref_table_id, helper, access_paths))) { + if (!helper.is_inner_path_ && + OB_FAIL(compute_base_table_property(table_id, ref_table_id))) { + LOG_WARN("failed to compute base path property", K(ret)); + } else if (OB_FAIL(create_access_paths(table_id, ref_table_id, helper, access_paths))) { LOG_WARN("failed to add table to join order(single)", K(ret)); } else if (OB_FAIL(compute_table_location_for_paths(access_paths, tbl_part_infos))) { LOG_WARN("failed to calc table location", K(ret)); - } else if (OB_FAIL(compute_base_table_property(table_id, - ref_table_id, - helper, - access_paths))) { - LOG_WARN("failed to compute base path property", K(ret)); + } else if (OB_FAIL(estimate_size_and_width_for_base_table(helper, access_paths))) { + LOG_WARN("failed to estimate_size", K(ret)); + } else if (!helper.is_inner_path_ && !is_virtual_table(ref_table_id) && + OB_FAIL(compute_one_row_info_for_table_scan(access_paths))) { + LOG_WARN("failed to compute one row info", K(ret)); } else if (!access_paths.empty() && // when generate inner path, access_paths may be empty OB_FAIL(pruning_unstable_access_path(helper.table_opt_info_, access_paths))) { LOG_WARN("failed to pruning unstable access path", K(ret)); @@ -5729,16 +5732,10 @@ int ObJoinOrder::generate_base_table_paths(PathHelper &helper) } int ObJoinOrder::compute_base_table_property(uint64_t table_id, - uint64_t ref_table_id, - PathHelper &helper, - ObIArray &access_paths) + uint64_t ref_table_id) { int ret = OB_SUCCESS; - if (OB_FAIL(estimate_size_and_width_for_base_table(helper, access_paths))) { - LOG_WARN("failed to estimate_size", K(ret)); - } else if (helper.is_inner_path_) { - /*do nothing*/ - } else if (OB_FAIL(ObOptimizerUtil::compute_const_exprs(restrict_info_set_, output_const_exprs_))) { + if (OB_FAIL(ObOptimizerUtil::compute_const_exprs(restrict_info_set_, output_const_exprs_))) { LOG_WARN("failed to compute const exprs", K(ret)); } else if (OB_FAIL(ObEqualAnalysis::compute_equal_set(allocator_, restrict_info_set_, @@ -5748,16 +5745,13 @@ int ObJoinOrder::compute_base_table_property(uint64_t table_id, ref_table_id, get_restrict_infos()))) { LOG_WARN("failed to extract fd item set", K(ret)); - } else if (!is_virtual_table(ref_table_id) && - OB_FAIL(compute_one_row_info_for_table_scan(access_paths))) { - LOG_WARN("failed to compute one row info", K(ret)); } else { LOG_TRACE("succeed to compute base table property", K(restrict_info_set_), K(output_const_exprs_), - K(output_equal_sets_), K(is_at_most_one_row_)); + K(output_equal_sets_)); } return ret; -} +} int ObJoinOrder::pruning_unstable_access_path(BaseTableOptInfo *table_opt_info, ObIArray &access_paths) diff --git a/src/sql/optimizer/ob_join_order.h b/src/sql/optimizer/ob_join_order.h index 11931021c6d3a81916c8b02f0ed14c38e2fb1929..bc935201640d967df24443961a20e8f00afc9658 100644 --- a/src/sql/optimizer/ob_join_order.h +++ b/src/sql/optimizer/ob_join_order.h @@ -1456,9 +1456,7 @@ struct NullAwareAntiJoinInfo { int generate_base_table_paths(PathHelper &helper); int compute_base_table_property(uint64_t table_id, - uint64_t ref_table_id, - PathHelper &helper, - ObIArray &access_paths); + uint64_t ref_table_id); /** * @brief generate_subquery_path