alamb commented on code in PR #18948:
URL: https://github.com/apache/datafusion/pull/18948#discussion_r2577746717
##########
datafusion/datasource/src/file_groups.rs:
##########
@@ -837,6 +899,91 @@ mod test {
assert_partitioned_files(expected, actual);
}
+ #[test]
+ fn repartition_ordered_one_large_one_small_file_with_full_range() {
+ // "Rebalance" the single large file across empty partitions, but
can't split
+ // small file
+ let source_partitions = vec![
+ FileGroup::new(vec![pfile("a", 100).with_range(0, 100)]),
+ FileGroup::new(vec![pfile("b", 30)]),
+ ];
+
+ let actual = FileGroupPartitioner::new()
+ .with_preserve_order_within_groups(true)
+ .with_target_partitions(4)
+ .with_repartition_file_min_size(10)
+ .repartition_file_groups(&source_partitions);
+
+ let expected = Some(vec![
+ // scan first third of "a"
+ FileGroup::new(vec![pfile("a", 100).with_range(0, 33)]),
+ // only b in this group (can't do this)
+ FileGroup::new(vec![pfile("b", 30).with_range(0, 30)]),
+ // second third of "a"
+ FileGroup::new(vec![pfile("a", 100).with_range(33, 66)]),
+ // final third of "a"
+ FileGroup::new(vec![pfile("a", 100).with_range(66, 100)]),
+ ]);
+ assert_partitioned_files(expected, actual);
+ }
+
+ #[test]
+ fn repartition_ordered_one_large_one_small_file_with_split_range() {
Review Comment:
this is cool
--
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]