Skip to content

Commit

Permalink
Merge pull request #105 from JanKaul/fix-file-catalog
Browse files Browse the repository at this point in the history
fix file catalog location ordering
  • Loading branch information
JanKaul authored Jan 24, 2025
2 parents 22cc467 + 18140fc commit 28ce65a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion catalogs/iceberg-file-catalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,21 @@ impl FileCatalog {
.try_collect()
.await
.map_err(IcebergError::from)?;
files.sort_unstable();
files.sort_by(|x, y| {
let x = x
.trim_start_matches((strip_prefix(&path) + "/v").trim_start_matches("/"))
.trim_end_matches("/")
.trim_end_matches(".metadata.json")
.parse::<usize>()
.unwrap();
let y = y
.trim_start_matches((strip_prefix(&path) + "/v").trim_start_matches("/"))
.trim_end_matches("/")
.trim_end_matches(".metadata.json")
.parse::<usize>()
.unwrap();
x.cmp(&y)
});
files
.into_iter()
.last()
Expand Down

0 comments on commit 28ce65a

Please sign in to comment.