Skip to content

Commit 86d97cc

Browse files
committed
fix: preserve compact locality by default
Signed-off-by: Ethan Urbanski <ethan@urbanskitech.com>
1 parent 17d016b commit 86d97cc

9 files changed

Lines changed: 1089 additions & 102 deletions

File tree

crates/core/src/kernel/snapshot/mod.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl Snapshot {
365365
///
366366
/// ## Returns
367367
///
368-
/// A stream of [`LogicalFileView`] objects.
368+
/// A stream of [`LogicalFileView`] objects, newest first.
369369
pub fn file_views(
370370
&self,
371371
log_store: &dyn LogStore,
@@ -779,7 +779,7 @@ impl EagerSnapshot {
779779
///
780780
/// ## Returns
781781
///
782-
/// A stream of [`LogicalFileView`] objects.
782+
/// A stream of [`LogicalFileView`] objects, newest first.
783783
pub fn file_views(
784784
&self,
785785
log_store: &dyn LogStore,
@@ -1095,6 +1095,31 @@ mod tests {
10951095
Ok(())
10961096
}
10971097

1098+
#[tokio::test]
1099+
async fn test_eager_file_views_return_newest_files_first() -> TestResult {
1100+
let (_dir, mut table) = checkpoint_rebase_table().await?;
1101+
1102+
append_test_add(&mut table, "part-00002.snappy.parquet").await?;
1103+
let version = table.version().unwrap();
1104+
checkpoints::create_checkpoint(&table, None).await?;
1105+
1106+
let snapshot =
1107+
EagerSnapshot::try_new(table.log_store().as_ref(), Default::default(), None).await?;
1108+
assert_eq!(snapshot.version(), version);
1109+
1110+
let paths = eager_file_paths(&snapshot, table.log_store().as_ref()).await?;
1111+
assert_eq!(
1112+
paths,
1113+
vec![
1114+
"part-00002.snappy.parquet",
1115+
"part-00001.snappy.parquet",
1116+
"part-00000.snappy.parquet",
1117+
]
1118+
);
1119+
1120+
Ok(())
1121+
}
1122+
10981123
#[tokio::test]
10991124
async fn test_snapshot_update_explicit_same_version_adopts_late_checkpoint() -> TestResult {
11001125
let (_dir, table) = checkpoint_rebase_table().await?;

0 commit comments

Comments
 (0)