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

Function assert_partitioning

datafusion/datasource/src/memory.rs:1106–1122  ·  view source on GitHub ↗

Assert that we get the expected count of partitions after repartitioning. If None, then we expected the [`DataSource::repartitioned`] to return None.

(
        partitioned_datasrc: Option<Arc<dyn DataSource>>,
        partition_cnt: Option<usize>,
    )

Source from the content-addressed store, hash-verified

1104 ///
1105 /// If None, then we expected the [`DataSource::repartitioned`] to return None.
1106 fn assert_partitioning(
1107 partitioned_datasrc: Option<Arc<dyn DataSource>>,
1108 partition_cnt: Option<usize>,
1109 ) {
1110 let should_exist = if let Some(partition_cnt) = partition_cnt {
1111 format!("new datasource should exist and have {partition_cnt:?} partitions")
1112 } else {
1113 "new datasource should not exist".into()
1114 };
1115
1116 let actual = partitioned_datasrc
1117 .map(|datasrc| datasrc.output_partitioning().partition_count());
1118 assert_eq!(
1119 actual, partition_cnt,
1120 "partitioned datasrc does not match expected, we expected {should_exist}, instead found {actual:?}"
1121 );
1122 }
1123
1124 fn run_all_test_scenarios(
1125 output_ordering: Option<LexOrdering>,

Calls 4

partition_countMethod · 0.80
intoMethod · 0.45
mapMethod · 0.45
output_partitioningMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…