Tpt opened a new issue, #24717:
URL: https://github.com/apache/datafusion/issues/24717
### Describe the bug
The `build_join_column_index` function does not support `RightMark` joins
and panic on them even if `HashJoinExec::maintains_input_order` returns `true`
for `RightMark` joins, leading the `handle_hash_join` to try propagating the
order requirements and failing to do so.
This was working well with DF 54
### To Reproduce
```rust
use std::sync::Arc;
use datafusion::{
arrow::datatypes::{DataType, Field, Schema},
common::JoinType,
datasource::memory::MemorySourceConfig,
error::Result,
physical_expr::{LexOrdering, PhysicalSortExpr, expressions::Column},
physical_optimizer::PhysicalOptimizerRule,
physical_plan::{ExecutionPlan, joins::HashJoinExecBuilder,
sorts::sort::SortExec},
prelude::SessionContext,
};
fn source(name: &str) -> Result<Arc<dyn ExecutionPlan>> {
let schema = Arc::new(Schema::new(vec![Field::new(name,
DataType::Utf8, false)]));
Ok(MemorySourceConfig::try_new_exec(&[vec![]], schema, None)?)
}
#[tokio::test]
async fn right_mark_hash_join_sort_pushdown_panics() -> Result<()> {
let reference = source("ref_id")?; // build side
let local = source("local_id")?; // probe side
let join_on = vec![(
Arc::new(Column::new_with_schema("ref_id", &reference.schema())?)
as _,
Arc::new(Column::new_with_schema("local_id", &local.schema())?) as
_,
)];
let join = HashJoinExecBuilder::new(reference, local, join_on,
JoinType::RightMark)
.build_exec()?;
// Any sort above the join on a probe-side column.
let sort = Arc::new(SortExec::new(
LexOrdering::new(vec![PhysicalSortExpr::new_default(Arc::new(
Column::new_with_schema("local_id", &join.schema())?,
))])
.expect("non-empty ordering"),
join,
));
let config = SessionContext::new().copied_config().options().clone();
let optimized =
datafusion::physical_optimizer::ensure_requirements::EnsureRequirements {}
.optimize(sort, &config)?; // <-- panics here
println!("{}",
datafusion::physical_plan::displayable(optimized.as_ref()).indent(false));
Ok(())
}
```
### Expected behavior
_No response_
### Additional context
_No response_
--
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]