[CP] [CP] [CP] fix: fix the 4377 error induced by NLJ batch Rescan
This commit is contained in:
		@ -1361,6 +1361,8 @@ int ObLogJoin::check_and_set_use_batch()
 | 
			
		||||
      can_use_batch_nlj_ = false;
 | 
			
		||||
    } else if (OB_FAIL(check_if_disable_batch(get_child(1), can_use_batch_nlj_))) {
 | 
			
		||||
      LOG_WARN("failed to check if disable batch", K(ret));
 | 
			
		||||
    } else if (can_use_batch_nlj_ && OB_FAIL(ObOptimizerUtil::check_ancestor_node_support_skip_scan(this, can_use_batch_nlj_))) {
 | 
			
		||||
      LOG_WARN("failed to check whether ancestor node support skip read", K(ret));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  // set use batch
 | 
			
		||||
@ -1372,6 +1374,7 @@ int ObLogJoin::check_and_set_use_batch()
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int ObLogJoin::check_if_disable_batch(ObLogicalOperator* root, bool &can_use_batch_nlj)
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
 | 
			
		||||
@ -562,6 +562,10 @@ int ObLogSubPlanFilter::check_and_set_das_group_rescan()
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (OB_SUCC(ret) && enable_das_group_rescan_ &&
 | 
			
		||||
      OB_FAIL(ObOptimizerUtil::check_ancestor_node_support_skip_scan(this, enable_das_group_rescan_))) {
 | 
			
		||||
      LOG_WARN("failed to check whether ancestor node support skip read", K(ret));
 | 
			
		||||
  }
 | 
			
		||||
  // check if exec params contain sub_query
 | 
			
		||||
  for (int64_t i = 0; OB_SUCC(ret) && enable_das_group_rescan_ && i < exec_params_.count(); i++) {
 | 
			
		||||
    const ObExecParamRawExpr *exec_param = exec_params_.at(i);
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,7 @@
 | 
			
		||||
#include "share/location_cache/ob_location_service.h"
 | 
			
		||||
#include "share/ob_order_perserving_encoder.h"
 | 
			
		||||
#include "sql/rewrite/ob_predicate_deduce.h"
 | 
			
		||||
#include "sql/optimizer/ob_log_join.h"
 | 
			
		||||
 | 
			
		||||
using namespace oceanbase;
 | 
			
		||||
using namespace sql;
 | 
			
		||||
@ -9488,4 +9489,29 @@ bool ObOptimizerUtil::find_superset(const ObRelIds &rel_ids,
 | 
			
		||||
    bret = (single_table_ids.at(i).is_superset(rel_ids));
 | 
			
		||||
  }
 | 
			
		||||
  return bret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObOptimizerUtil::check_ancestor_node_support_skip_scan(ObLogicalOperator* op, bool &can_use_batch_nlj)
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  ObLogicalOperator* parent = nullptr;
 | 
			
		||||
  if (OB_ISNULL(op)) {
 | 
			
		||||
    ret = OB_ERR_UNEXPECTED;
 | 
			
		||||
    LOG_WARN("Current operator node is null", K(ret));
 | 
			
		||||
  } else if (OB_ISNULL(parent = op->get_parent())) {
 | 
			
		||||
    // do nothing
 | 
			
		||||
  } else if (can_use_batch_nlj) {
 | 
			
		||||
    if (parent->get_type() == log_op_def::LOG_SUBPLAN_FILTER) {
 | 
			
		||||
      can_use_batch_nlj = false;
 | 
			
		||||
    } else if (parent->get_type() == log_op_def::LOG_JOIN) {
 | 
			
		||||
      ObLogJoin *join = static_cast<ObLogJoin*>(parent);
 | 
			
		||||
      if (IS_SEMI_ANTI_JOIN(join->get_join_type())) {
 | 
			
		||||
        can_use_batch_nlj = false;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (can_use_batch_nlj && OB_FAIL(SMART_CALL(check_ancestor_node_support_skip_scan(parent, can_use_batch_nlj)))) {
 | 
			
		||||
      LOG_WARN("failed to check parent node can use batch NLJ", K(ret));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
@ -1534,6 +1534,8 @@ public:
 | 
			
		||||
                                         ObSqlTempTableInfo &temp_table_info,
 | 
			
		||||
                                         ObRawExpr *&temp_table_filter,
 | 
			
		||||
                                         ObSelectStmt *temp_table_query = NULL);
 | 
			
		||||
 | 
			
		||||
  static int check_ancestor_node_support_skip_scan(ObLogicalOperator* op, bool &can_use_batch_nlj);
 | 
			
		||||
private:
 | 
			
		||||
  //disallow construct
 | 
			
		||||
  ObOptimizerUtil();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user