Merge branch 'refs/heads/feat/non-append-metadata-count' into review/metadata-count-partial

Signed-off-by: aumnertic <aumnertic@gmail.com>
This commit is contained in:
aumnertic
2026-11-25 21:58:21 -05:00
2 changed files with 25 additions and 9 deletions
+1 -1
View File
@@ -6611,7 +6611,7 @@ async fn test_two_phase_raw_stream_stays_key_ordered_across_disjoint_partition_a
);
assert_eq!(
round_rows.iter().sum::<usize>(),
input.total_rows(),
input.scanner_properties().total_rows(),
"the sources must add up to every written row"
);
}
+24 -8
View File
@@ -27,6 +27,7 @@ use datafusion_common::ScalarValue;
use datafusion_expr::{Expr, Operator};
use datatypes::data_type::DataType;
use datatypes::value::Value;
use futures::future::BoxFuture;
use futures::{FutureExt, StreamExt};
use mito_codec::row_converter::{PrimaryKeyCodec, build_primary_key_codec};
use parquet::file::metadata::ParquetMetaData;
@@ -105,12 +106,17 @@ async fn read_file_evidence(input: &ScanInput, classification: &Classification)
if input.append_mode {
return vec![true; classification.exact.len()];
}
let reads = classification.exact.iter().map(|&index| {
let file = input.files[index].clone();
let reader = input
.access_layer
.read_sst(file.clone())
.cache(input.cache_strategy.clone());
// The stream owns its inputs and creates readers only as buffer slots
// become available.
let files: Vec<_> = classification
.exact
.iter()
.map(|&index| input.files[index].clone())
.collect();
let access_layer = input.access_layer.clone();
let cache = input.cache_strategy.clone();
let reads = futures::stream::iter(files).map(move |file| -> BoxFuture<'static, bool> {
let reader = access_layer.read_sst(file.clone()).cache(cache.clone());
async move {
match reader.read_statistics().await {
Ok(metadata) => footer_proves_visible_rows(&metadata, file.num_rows()),
@@ -125,7 +131,7 @@ async fn read_file_evidence(input: &ScanInput, classification: &Classification)
}
.boxed()
});
futures::stream::iter(reads)
reads
.buffered(input.max_concurrent_scan_files.max(1))
.collect()
.await
@@ -875,7 +881,17 @@ mod tests {
async fn test_metadata_aggr_narrowed_partition_falls_back() {
use partition::expr::col as partition_col;
let mut input = input(vec![file(0, 10, 3, true)], &[]).await;
let original_scope = partition_col("k0").gt_eq(Value::String("a".into()));
let file = FileHandle::new(
FileMeta {
partition_expr: Some(original_scope.clone().into()),
..file(0, 10, 3, true).meta_ref().clone()
},
new_noop_file_purger(),
);
let mut input = input(vec![file], &[]).await;
input.region_partition_expr = Some(original_scope);
assert_eq!(exact_count(&input, &ScanRequest::default()), Some(3));
input.region_partition_expr = Some(partition_col("k0").gt_eq(Value::String("x".into())));
assert_eq!(exact_count(&input, &ScanRequest::default()), None);
}