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

Function test_with_fetch_inexact_input

datafusion/common/src/stats.rs:2294–2323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2292
2293 #[test]
2294 fn test_with_fetch_inexact_input() {
2295 // Test that inexact input statistics remain inexact
2296 let original_stats = Statistics {
2297 num_rows: Precision::Inexact(1000),
2298 total_byte_size: Precision::Inexact(8000),
2299 column_statistics: vec![ColumnStatistics {
2300 null_count: Precision::Inexact(10),
2301 max_value: Precision::Inexact(ScalarValue::Int32(Some(100))),
2302 min_value: Precision::Inexact(ScalarValue::Int32(Some(0))),
2303 sum_value: Precision::Inexact(ScalarValue::Int32(Some(5050))),
2304 distinct_count: Precision::Inexact(50),
2305 byte_size: Precision::Inexact(4000),
2306 }],
2307 };
2308
2309 let result = original_stats.clone().with_fetch(Some(500), 0, 1).unwrap();
2310
2311 // Check num_rows is inexact
2312 assert_eq!(result.num_rows, Precision::Inexact(500));
2313
2314 // Check total_byte_size is computed as sum of scaled column byte_size values
2315 // Column 1: 4000 * 0.5 = 2000, Sum = 2000
2316 assert_eq!(result.total_byte_size, Precision::Inexact(2000));
2317
2318 // Column stats remain inexact
2319 assert_eq!(
2320 result.column_statistics[0].null_count,
2321 Precision::Inexact(10)
2322 );
2323 }
2324
2325 #[test]
2326 fn test_with_fetch_skip_all_rows() {

Callers

nothing calls this directly

Calls 2

with_fetchMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…