[CP] Fix the issue of incorrect results with batch NLJ + SET OP
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
#include "sql/optimizer/ob_log_exchange.h"
|
||||
#include "sql/optimizer/ob_log_table_scan.h"
|
||||
#include "sql/optimizer/ob_log_join_filter.h"
|
||||
#include "sql/optimizer/ob_log_set.h"
|
||||
#include "sql/optimizer/ob_optimizer_util.h"
|
||||
#include "sql/optimizer/ob_log_granule_iterator.h"
|
||||
#include "sql/rewrite/ob_transform_utils.h"
|
||||
@ -1414,6 +1415,13 @@ int ObLogJoin::check_if_disable_batch(ObLogicalOperator* root, bool &can_use_bat
|
||||
LOG_WARN("failed to check if disable batch", K(ret));
|
||||
}
|
||||
} else if (log_op_def::LOG_SET == root->get_type()) {
|
||||
ObLogSet *log_set = static_cast<ObLogSet *>(root);
|
||||
if (log_set->get_set_op() != ObSelectStmt::UNION) {
|
||||
//Disable batch nested loop join that contains set operations other than UNION
|
||||
//because other set operations may involve short-circuit operations.
|
||||
//Currently, batch NLJ does not support short-circuit execution.
|
||||
can_use_batch_nlj = false;
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && can_use_batch_nlj && i < root->get_num_of_child(); ++i) {
|
||||
ObLogicalOperator *child = root->get_child(i);
|
||||
if (OB_ISNULL(child)) {
|
||||
@ -1424,10 +1432,16 @@ int ObLogJoin::check_if_disable_batch(ObLogicalOperator* root, bool &can_use_bat
|
||||
}
|
||||
}
|
||||
} else if (log_op_def::LOG_JOIN == root->get_type()) {
|
||||
ObLogJoin *join = NULL;
|
||||
if (OB_ISNULL(join = static_cast<ObLogJoin *>(root))) {
|
||||
ObLogJoin *join = static_cast<ObLogJoin *>(root);
|
||||
ObSQLSessionInfo *session_info = NULL;
|
||||
ObLogPlan *plan = NULL;
|
||||
if (OB_ISNULL(plan = get_plan())
|
||||
|| OB_ISNULL(session_info = plan->get_optimizer_context().get_session_info())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid input", K(ret));
|
||||
LOG_WARN("unexpected null", K(ret), K(plan), K(session_info));
|
||||
} else if (!session_info->is_spf_mlj_group_rescan_enabled()) {
|
||||
//Group rescan optimization for nested joins at multiple levels is disabled by default.
|
||||
can_use_batch_nlj = false;
|
||||
} else if (!join->can_use_batch_nlj()) {
|
||||
can_use_batch_nlj = false;
|
||||
LOG_TRACE("child join not support batch_nlj", K(root->get_name()));
|
||||
|
||||
@ -535,17 +535,10 @@ int ObLogSubPlanFilter::check_and_set_das_group_rescan()
|
||||
|| OB_ISNULL(session_info = plan->get_optimizer_context().get_session_info())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected null", K(ret));
|
||||
} else if (!session_info->is_spf_mlj_group_rescan_enabled()) {
|
||||
enable_das_group_rescan_ = false;
|
||||
} else if (OB_FAIL(session_info->get_nlj_batching_enabled(enable_das_group_rescan_))) {
|
||||
LOG_WARN("failed to get enable batch variable", K(ret));
|
||||
} else {
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(session_info->get_effective_tenant_id()));
|
||||
if (tenant_config.is_valid()) {
|
||||
enable_das_group_rescan_ = tenant_config->_enable_spf_batch_rescan;
|
||||
LOG_TRACE("trace disable hash groupby in second stage for three-stage",
|
||||
K(enable_das_group_rescan_));
|
||||
} else {
|
||||
enable_das_group_rescan_ = false;
|
||||
}
|
||||
}
|
||||
// check use batch
|
||||
for (int64_t i = 1; OB_SUCC(ret) && enable_das_group_rescan_ && i < get_num_of_child(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user