[CP] fix temp table access location constraint bug
This commit is contained in:
		 zzg19950727
					zzg19950727
				
			
				
					committed by
					
						 wangzelin.wzl
						wangzelin.wzl
					
				
			
			
				
	
			
			
			 wangzelin.wzl
						wangzelin.wzl
					
				
			
						parent
						
							dc95d872c2
						
					
				
				
					commit
					3ef3fad8a3
				
			| @ -159,3 +159,34 @@ int ObLogTempTableAccess::print_my_plan_annotation(char *buf, | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| int ObLogTempTableAccess::get_temp_table_plan(ObLogicalOperator *& insert_op) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   insert_op = NULL; | ||||
|   ObLogPlan *plan = get_plan(); | ||||
|   const uint64_t temp_table_id = get_temp_table_id(); | ||||
|   if (OB_ISNULL(plan)) { | ||||
|     ret = OB_ERR_UNEXPECTED; | ||||
|     LOG_ERROR("unexpected null", K(ret)); | ||||
|   } else { | ||||
|     ObIArray<ObSqlTempTableInfo*> &temp_tables = plan->get_optimizer_context().get_temp_table_infos(); | ||||
|     bool find = false; | ||||
|     for (int64_t i = 0; OB_SUCC(ret) && !find && i < temp_tables.count(); ++i) { | ||||
|       if (OB_ISNULL(temp_tables.at(i))) { | ||||
|         ret = OB_ERR_UNEXPECTED; | ||||
|         LOG_ERROR("unexpected null", K(ret)); | ||||
|       } else if (temp_table_id != temp_tables.at(i)->temp_table_id_) { | ||||
|         /* do nothing */ | ||||
|       } else { | ||||
|         find = true; | ||||
|         insert_op = temp_tables.at(i)->table_plan_; | ||||
|       } | ||||
|     } | ||||
|     if (OB_SUCC(ret) && !find) { | ||||
|       ret = OB_ERR_UNEXPECTED; | ||||
|       LOG_ERROR("failed to find table plan", K(ret)); | ||||
|     } | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| @ -45,6 +45,9 @@ public: | ||||
|                                        int64_t &buf_len, | ||||
|                                        int64_t &pos, | ||||
|                                        ExplainType type); | ||||
|  | ||||
|   int get_temp_table_plan(ObLogicalOperator *& insert_op); | ||||
|  | ||||
| private: | ||||
|   DISALLOW_COPY_AND_ASSIGN(ObLogTempTableAccess); | ||||
|  | ||||
|  | ||||
| @ -2848,6 +2848,19 @@ int ObLogicalOperator::gen_location_constraint(void *ctx) | ||||
|                     loc_cons_ctx->base_table_constraints_.count() - 1))) { | ||||
|           LOG_WARN("failed to push back location constraint offset", K(ret)); | ||||
|         } | ||||
|       } else if (log_op_def::LOG_TEMP_TABLE_ACCESS == get_type()) { | ||||
|         ObLogTempTableAccess *access = static_cast<ObLogTempTableAccess*>(this); | ||||
|         ObLogicalOperator *insert_op = NULL; | ||||
|         if (OB_FAIL(access->get_temp_table_plan(insert_op))) { | ||||
|           LOG_WARN("failed to get temp table plan", K(ret)); | ||||
|         } else if (OB_ISNULL(insert_op)) { | ||||
|           ret = OB_ERR_UNEXPECTED; | ||||
|           LOG_WARN("unexpect null operator", K(ret)); | ||||
|         } else if (OB_FAIL(append(strict_pwj_constraint_, insert_op->strict_pwj_constraint_))) { | ||||
|           LOG_WARN("failed to append child pwj constraint", K(ret)); | ||||
|         } else if (OB_FAIL(append(non_strict_pwj_constraint_, insert_op->non_strict_pwj_constraint_))) { | ||||
|           LOG_WARN("failed to append child pwj constraint", K(ret)); | ||||
|         } | ||||
|       } | ||||
|     } else if (get_num_of_child() > 0) { | ||||
|       /** | ||||
|  | ||||
| @ -2119,7 +2119,7 @@ int ObDMLStmt::remove_useless_sharable_expr() | ||||
|     } else if (OB_FAIL(column_items_.remove(i))) { | ||||
|       LOG_WARN("failed to remove column item", K(ret)); | ||||
|     } else { | ||||
|       LOG_TRACE("succeed to remove column items", K(*expr), K(lbt())); | ||||
|       LOG_TRACE("succeed to remove column items", K(expr), K(lbt())); | ||||
|     } | ||||
|   } | ||||
|   for (int64_t i = subquery_exprs_.count() - 1; OB_SUCC(ret) && i >= 0; i--) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user