()
| 2523 | |
| 2524 | #[test] |
| 2525 | fn test_with_fetch_scales_byte_size() { |
| 2526 | // Test that byte_size is scaled by the row ratio in with_fetch |
| 2527 | let original_stats = Statistics { |
| 2528 | num_rows: Precision::Exact(1000), |
| 2529 | total_byte_size: Precision::Exact(8000), |
| 2530 | column_statistics: vec![ |
| 2531 | ColumnStatistics { |
| 2532 | null_count: Precision::Exact(10), |
| 2533 | max_value: Precision::Absent, |
| 2534 | min_value: Precision::Absent, |
| 2535 | sum_value: Precision::Absent, |
| 2536 | distinct_count: Precision::Absent, |
| 2537 | byte_size: Precision::Exact(4000), |
| 2538 | }, |
| 2539 | ColumnStatistics { |
| 2540 | null_count: Precision::Exact(20), |
| 2541 | max_value: Precision::Absent, |
| 2542 | min_value: Precision::Absent, |
| 2543 | sum_value: Precision::Absent, |
| 2544 | distinct_count: Precision::Absent, |
| 2545 | byte_size: Precision::Exact(8000), |
| 2546 | }, |
| 2547 | ], |
| 2548 | }; |
| 2549 | |
| 2550 | // Apply fetch of 100 rows (10% of original) |
| 2551 | let result = original_stats.with_fetch(Some(100), 0, 1).unwrap(); |
| 2552 | |
| 2553 | // byte_size should be scaled: 4000 * 0.1 = 400, 8000 * 0.1 = 800 |
| 2554 | assert_eq!( |
| 2555 | result.column_statistics[0].byte_size, |
| 2556 | Precision::Inexact(400) |
| 2557 | ); |
| 2558 | assert_eq!( |
| 2559 | result.column_statistics[1].byte_size, |
| 2560 | Precision::Inexact(800) |
| 2561 | ); |
| 2562 | |
| 2563 | // total_byte_size should be computed as sum of byte_size values: 400 + 800 = 1200 |
| 2564 | assert_eq!(result.total_byte_size, Precision::Inexact(1200)); |
| 2565 | } |
| 2566 | |
| 2567 | #[test] |
| 2568 | fn test_with_fetch_total_byte_size_fallback() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…