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>,
)
| 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>, |
searching dependent graphs…