Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rust/lance/src/dataset/optimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,10 @@ async fn rewrite_files(
// information.
let fragments = migrate_fragments(dataset.as_ref(), &task.fragments, recompute_stats).await?;
let mut scanner = dataset.scan();
scanner.with_fragments(fragments.clone()).with_row_id();
scanner
.with_fragments(fragments.clone())
.scan_in_order(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this impacts the bug, but I should point out that scan_in_order guarantees that results will be in order of local row ids, but not in order of fragment ids. This is because the fragment list in the manifest is not guaranteed to be sorted by row_id. You should be able to force a scan to be globally sorted by row_id by passing in the .fragments() parameter with the list of fragments sorted by fragment id.

.with_row_id();

let data = SendableRecordBatchStream::from(scanner.try_into_stream().await?);
let row_ids = Arc::new(RwLock::new(RoaringTreemap::new()));
Expand Down