Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ private LanceDeltaWriter(LanceConfig config, LanceDataWriter writer) {

@Override
public void delete(InternalRow metadata, InternalRow id) throws IOException {
long rowAddr = id.getLong(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Although this modification can workaround this problem, I think it's tricky and confusable. Theoretically, the metadata and id should belong to the same row. Which means that they belong to the same Fragment.

I think we also should fix the Fragment.scan's wrong results with filter _rowaddr == 0.

int fragmentIdFromAddr = (int) (rowAddr >> 32);
int fragmentId = metadata.getInt(0);

if (fragmentId != fragmentIdFromAddr) {
return;
}

deletedRows.compute(
fragmentId,
(k, v) -> {
Expand All @@ -159,7 +166,7 @@ public void delete(InternalRow metadata, InternalRow id) throws IOException {
// Get the row index which is low 32 bits of row address.
// See
// https://github.com/lancedb/lance/blob/main/rust/lance-core/src/utils/address.rs#L36
v.add(RowAddress.rowIndex(id.getLong(0)));
v.add(RowAddress.rowIndex(rowAddr));
return v;
});
}
Expand Down