fix merge join bug when use interesting ordering for merge key
This commit is contained in:
parent
c65d88d12c
commit
3db2e35a2e
@ -627,7 +627,8 @@ int ObJoinOrder::get_base_path_table_dop(uint64_t index_id, int64_t ¶llel)
|
||||
|
||||
// just generate random parallel for access paths when enable trace point test path
|
||||
// alter system set_tp tp_no = 552, error_code = 4016, frequency = 1;
|
||||
int ObJoinOrder::get_random_parallel(const ObIArray<AccessPath *> &access_paths,
|
||||
// When trace point is enabled, parallel is only limited by parallel_degree_limit.
|
||||
int ObJoinOrder::get_random_parallel(const int64_t parallel_degree_limit,
|
||||
int64_t ¶llel)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -635,13 +636,17 @@ int ObJoinOrder::get_random_parallel(const ObIArray<AccessPath *> &access_paths,
|
||||
if (OB_ISNULL(table_partition_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected params", K(ret), K(table_partition_info_));
|
||||
} else if (is_virtual_table(table_partition_info_->get_ref_table_id())) {
|
||||
} else if (ObGlobalHint::DEFAULT_PARALLEL == parallel_degree_limit
|
||||
|| is_virtual_table(table_partition_info_->get_ref_table_id())) {
|
||||
/* do nothing */
|
||||
LOG_TRACE("Auto DOP get_random_parallel", K(table_partition_info_->get_ref_table_id()),
|
||||
LOG_TRACE("Auto DOP get_random_parallel", K(parallel_degree_limit),
|
||||
K(table_partition_info_->get_ref_table_id()),
|
||||
K(is_virtual_table(table_partition_info_->get_ref_table_id())));
|
||||
} else {
|
||||
const int64_t part_cnt = table_partition_info_->get_phy_tbl_location_info().get_partition_cnt();
|
||||
int64_t parallel_type = ObRandom::rand(0, 2);
|
||||
const bool limit_beyond_part_cnt = ObGlobalHint::UNSET_PARALLEL == parallel_degree_limit
|
||||
|| parallel_degree_limit > part_cnt;
|
||||
int64_t parallel_type = ObRandom::rand(0, limit_beyond_part_cnt ? 2 : 1);
|
||||
switch (parallel_type) {
|
||||
case 0: {
|
||||
parallel = 1;
|
||||
@ -649,7 +654,11 @@ int ObJoinOrder::get_random_parallel(const ObIArray<AccessPath *> &access_paths,
|
||||
}
|
||||
case 1: {
|
||||
if (part_cnt > 1) {
|
||||
parallel = ObRandom::rand(2, part_cnt);
|
||||
if (limit_beyond_part_cnt) {
|
||||
parallel = ObRandom::rand(2, part_cnt);
|
||||
} else {
|
||||
parallel = ObRandom::rand(2, parallel_degree_limit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -658,7 +667,8 @@ int ObJoinOrder::get_random_parallel(const ObIArray<AccessPath *> &access_paths,
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOG_TRACE("Auto DOP get_random_parallel", K(parallel_type), K(parallel));
|
||||
LOG_TRACE("Auto DOP get_random_parallel", K(parallel_degree_limit), K(part_cnt),
|
||||
K(parallel_type), K(parallel));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -700,7 +710,7 @@ int ObJoinOrder::compute_access_path_parallel(ObIArray<AccessPath *> &access_pat
|
||||
ret = OB_SUCCESS;
|
||||
if (!session_info->is_user_session()) {
|
||||
parallel = ObGlobalHint::DEFAULT_PARALLEL;
|
||||
} else if (OB_FAIL(get_random_parallel(access_paths, parallel))) {
|
||||
} else if (OB_FAIL(get_random_parallel(opt_ctx->get_session_parallel_degree_limit(), parallel))) {
|
||||
LOG_WARN("failed to get random parallel", K(ret));
|
||||
}
|
||||
LOG_TRACE("Auto DOP trace point", K(session_info->is_user_session()), K(parallel));
|
||||
|
@ -1778,7 +1778,7 @@ struct NullAwareAntiJoinInfo {
|
||||
int get_base_path_table_dop(uint64_t index_id, int64_t ¶llel);
|
||||
int compute_access_path_parallel(ObIArray<AccessPath *> &access_paths,
|
||||
int64_t ¶llel);
|
||||
int get_random_parallel(const ObIArray<AccessPath *> &access_paths, int64_t ¶llel);
|
||||
int get_random_parallel(const int64_t parallel_degree_limit, int64_t ¶llel);
|
||||
int get_parallel_from_available_access_paths(int64_t ¶llel) const;
|
||||
int compute_base_table_parallel_and_server_info(const OpParallelRule op_parallel_rule,
|
||||
const int64_t parallel,
|
||||
|
@ -309,6 +309,7 @@ ObOptimizerContext(ObSQLSessionInfo *session_info,
|
||||
inline int64_t get_parallel() const { return parallel_; }
|
||||
inline int64_t get_max_parallel() const { return max_parallel_; }
|
||||
inline int64_t get_parallel_degree_limit(const int64_t server_cnt) const { return auto_dop_params_.get_parallel_degree_limit(server_cnt); }
|
||||
inline int64_t get_session_parallel_degree_limit() const { return auto_dop_params_.parallel_degree_limit_; }
|
||||
inline int64_t get_parallel_min_scan_time_threshold() const { return auto_dop_params_.parallel_min_scan_time_threshold_; }
|
||||
inline bool force_disable_parallel() const { return px_parallel_rule_ >= PL_UDF_DAS_FORCE_SERIALIZE
|
||||
&& px_parallel_rule_ < MAX_OPTION; }
|
||||
|
@ -3996,6 +3996,19 @@ int ObOptimizerUtil::decide_sort_keys_for_merge_style_op(const ObDMLStmt *stmt,
|
||||
}
|
||||
} else if (OB_FAIL(merge_key.assign(*interesting_key))) {
|
||||
LOG_WARN("failed to assign merge key", K(ret));
|
||||
/* interesting_key->need_sort_ is true generally.
|
||||
When ObOptimizerUtil::check_need_sort use ordering contain lossless cast, need_sort_ can be false
|
||||
and ObOptimizerUtil::check_need_sort is needed for other path use the interesting_key */
|
||||
} else if (OB_FAIL(ObOptimizerUtil::check_need_sort(merge_key.order_items_,
|
||||
input_ordering,
|
||||
fd_item_set,
|
||||
equal_sets,
|
||||
const_exprs,
|
||||
exec_ref_exprs,
|
||||
is_at_most_one_row,
|
||||
merge_key.need_sort_,
|
||||
merge_key.prefix_pos_))) {
|
||||
LOG_WARN("failed to check need sort", K(ret));
|
||||
} else { /*do nothing*/ }
|
||||
return ret;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ bool ObSQLSessionInfo::is_index_skip_scan_enabled() const
|
||||
int ObSQLSessionInfo::is_enable_range_extraction_for_not_in(bool &enabled) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
enabled = false;
|
||||
enabled = true;
|
||||
int64_t tenant_id = get_effective_tenant_id();
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
||||
if (tenant_config.is_valid()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user