Skip to content

Commit baac87c

Browse files
authored
fix(core): align evolution stats and aggregation flush with Java (#839)
1 parent b33e034 commit baac87c

7 files changed

Lines changed: 866 additions & 102 deletions

File tree

‎crates/paimon/src/table/kv_file_reader.rs‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,10 +2270,9 @@ mod tests {
22702270
assert!(!names.contains(&"banana".to_string()));
22712271
}
22722272

2273-
/// Aggregation (sum): inputs 10 + 20 merge to 30. `value = 30` must match
2274-
/// the merged row (a pre-merge filter would drop both inputs);
2275-
/// `value = 10` must match nothing (a pre-merge filter would keep the
2276-
/// 10-input and leak it).
2273+
/// Each flush aggregates its duplicate keys first (30 and 9); the read
2274+
/// merges both files to 39. `value = 39` must match the merged row, while
2275+
/// `value = 10` must not leak an input row.
22772276
#[tokio::test]
22782277
async fn kv_read_aggregation_filters_on_merged_value() {
22792278
let file_io = test_file_io();
@@ -2288,17 +2287,17 @@ mod tests {
22882287
],
22892288
);
22902289

2291-
write_commit(&table, &int_batch(vec![1], vec![Some(10)])).await;
2292-
write_commit(&table, &int_batch(vec![1], vec![Some(20)])).await;
2290+
write_commit(&table, &int_batch(vec![1, 1], vec![Some(10), Some(20)])).await;
2291+
write_commit(&table, &int_batch(vec![1, 1], vec![Some(4), Some(5)])).await;
22932292

22942293
let fields = table.schema().fields().to_vec();
22952294

22962295
let match_merged = PredicateBuilder::new(&fields)
2297-
.equal("value", Datum::Int(30))
2296+
.equal("value", Datum::Int(39))
22982297
.unwrap();
22992298
let batches = read_rows(&table, None, Some(match_merged)).await;
23002299
assert_eq!(int_column(&batches, "id"), vec![1]);
2301-
assert_eq!(int_column(&batches, "value"), vec![30]);
2300+
assert_eq!(int_column(&batches, "value"), vec![39]);
23022301

23032302
let match_input = PredicateBuilder::new(&fields)
23042303
.equal("value", Datum::Int(10))

0 commit comments

Comments
 (0)