Helper function to verify that files within each group maintain sort order Used by tests and benchmarks
(file_groups: &[FileGroup])
| 591 | // Helper function to verify that files within each group maintain sort order |
| 592 | /// Used by tests and benchmarks |
| 593 | pub fn verify_sort_integrity(file_groups: &[FileGroup]) -> bool { |
| 594 | for group in file_groups { |
| 595 | let files = group.iter().collect::<Vec<_>>(); |
| 596 | for i in 1..files.len() { |
| 597 | let prev_file = files[i - 1]; |
| 598 | let curr_file = files[i]; |
| 599 | |
| 600 | // Check if the min value of current file is greater than max value of previous file |
| 601 | if let (Some(prev_stats), Some(curr_stats)) = |
| 602 | (&prev_file.statistics, &curr_file.statistics) |
| 603 | { |
| 604 | let prev_max = &prev_stats.column_statistics[0].max_value; |
| 605 | let curr_min = &curr_stats.column_statistics[0].min_value; |
| 606 | if curr_min.get_value().unwrap() <= prev_max.get_value().unwrap() { |
| 607 | return false; |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | } |
| 612 | true |
| 613 | } |
| 614 | |
| 615 | #[cfg(test)] |
| 616 | mod tests { |