MCPcopy Create free account
hub / github.com/apache/datafusion / verify_join_output_partitioning

Function verify_join_output_partitioning

datafusion/core/tests/dataframe/mod.rs:2558–2630  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2556
2557#[tokio::test]
2558async fn verify_join_output_partitioning() -> Result<()> {
2559 let left = test_table().await?.select_columns(&["c1", "c2"])?;
2560 let right = test_table_with_name("c2")
2561 .await?
2562 .select_columns(&["c1", "c2"])?
2563 .with_column_renamed("c2.c1", "c2_c1")?
2564 .with_column_renamed("c2.c2", "c2_c2")?;
2565
2566 let all_join_types = vec![
2567 JoinType::Inner,
2568 JoinType::Left,
2569 JoinType::Right,
2570 JoinType::Full,
2571 JoinType::LeftSemi,
2572 JoinType::RightSemi,
2573 JoinType::LeftAnti,
2574 JoinType::RightAnti,
2575 JoinType::LeftMark,
2576 JoinType::RightMark,
2577 ];
2578
2579 let default_partition_count = SessionConfig::new().target_partitions();
2580
2581 for join_type in all_join_types {
2582 let join = left.clone().join(
2583 right.clone(),
2584 join_type,
2585 &["c1", "c2"],
2586 &["c2_c1", "c2_c2"],
2587 None,
2588 )?;
2589 let physical_plan = join.create_physical_plan().await?;
2590 let out_partitioning = physical_plan.output_partitioning();
2591 let join_schema = physical_plan.schema();
2592
2593 match join_type {
2594 JoinType::Left
2595 | JoinType::LeftSemi
2596 | JoinType::LeftAnti
2597 | JoinType::LeftMark => {
2598 let left_exprs: Vec<Arc<dyn PhysicalExpr>> = vec![
2599 Arc::new(Column::new_with_schema("c1", &join_schema)?),
2600 Arc::new(Column::new_with_schema("c2", &join_schema)?),
2601 ];
2602 assert_eq!(
2603 out_partitioning,
2604 &Partitioning::Hash(left_exprs, default_partition_count)
2605 );
2606 }
2607 JoinType::Inner
2608 | JoinType::Right
2609 | JoinType::RightSemi
2610 | JoinType::RightAnti
2611 | JoinType::RightMark => {
2612 let right_exprs: Vec<Arc<dyn PhysicalExpr>> = vec![
2613 Arc::new(Column::new_with_schema("c2_c1", &join_schema)?),
2614 Arc::new(Column::new_with_schema("c2_c2", &join_schema)?),
2615 ];

Callers

nothing calls this directly

Calls 11

test_tableFunction · 0.85
test_table_with_nameFunction · 0.85
newFunction · 0.85
select_columnsMethod · 0.80
with_column_renamedMethod · 0.80
target_partitionsMethod · 0.80
joinMethod · 0.45
cloneMethod · 0.45
create_physical_planMethod · 0.45
output_partitioningMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…