2010YOUY01 commented on code in PR #27399:
URL: https://github.com/apache/datafusion/pull/27399#discussion_r4600233168
##########
datafusion/physical-plan/src/joins/hash_join/exec.rs:
##########
@@ -1749,72 +1805,53 @@ impl ExecutionPlan for HashJoinExec {
.flatten()
.flatten();
- let left_fut = match (&self.prepared_build, self.mode) {
- (Some(prepared), _) => {
- // Public join fields can change after builder validation.
- prepared.validate(self)?;
- let prepared = Arc::clone(prepared);
- self.left_fut.try_once(|| {
- Ok(async move { Ok(prepared.probe_data(right_partitions))
})
- })?
- }
- (None, PartitionMode::CollectLeft) => self.left_fut.try_once(|| {
- let left_stream = self.left.execute(0, Arc::clone(&context))?;
-
- let reservation =
-
MemoryConsumer::new("HashJoinInput").register(context.memory_pool());
-
- Ok(collect_left_input(
- self.random_state.random_state().clone(),
- left_stream,
- on_left.clone(),
- join_metrics.clone(),
- reservation,
- need_produce_result_in_final(self.join_type),
- right_partitions,
- enable_dynamic_filter_pushdown,
- Arc::clone(context.session_config().options()),
- self.null_equality,
- not_in,
- array_map_created_count,
- BuildMode::Ordinary,
- ))
- })?,
- (None, PartitionMode::Partitioned) => {
- let left_stream = self.left.execute(partition,
Arc::clone(&context))?;
-
- let reservation =
- MemoryConsumer::new(format!("HashJoinInput[{partition}]"))
- .register(context.memory_pool());
- OnceFut::new(collect_left_input(
- self.random_state.random_state().clone(),
- left_stream,
- on_left.clone(),
- join_metrics.clone(),
- reservation,
- need_produce_result_in_final(self.join_type),
- 1,
- enable_dynamic_filter_pushdown,
- Arc::clone(context.session_config().options()),
- self.null_equality,
- not_in,
- array_map_created_count,
- BuildMode::Ordinary,
- ))
- }
- (None, PartitionMode::Auto) => {
- return plan_err!(
- "Invalid HashJoinExec, unsupported PartitionMode {:?} in
execute()",
- PartitionMode::Auto
- );
- }
+ // See the comments on `enable_migration_hash_join` for details.
+ let use_regular = if let Some(prepared) = &self.prepared_build {
+ // Public join fields can change after builder validation.
+ prepared.validate(self)?;
+ prepared.is_regular()
+ } else {
+ context
+ .session_config()
+ .options()
+ .execution
+ .enable_migration_hash_join
+ };
Review Comment:
Good point, fixed in
[ef96c9b](https://github.com/apache/datafusion/pull/27399/commits/ef96c9b538feaf05a3000d15d37e25b1d8ef1830)
It ensured prepared build is compatible regardless of
`enable_migration_hash_join` is true/false, and added a unit test for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]