Skip to content

Conversation

@zhoulii
Copy link
Member

@zhoulii zhoulii commented Dec 22, 2025

Purpose

Linked issue: close #6859

Tests

API and Format

Documentation

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

Please document this too.

@JingsongLi
Copy link
Contributor

@zhoulii Can you find a rough reference for other systems? This API definition provides a global RowID.

@JingsongLi
Copy link
Contributor

Maybe new API: write_builder.update_columns_by_row_id(Table) is better.

@zhoulii
Copy link
Member Author

zhoulii commented Dec 23, 2025

@zhoulii Can you find a rough reference for other systems? This API definition provides a global RowID.

rust/lance/src/dataset/fragment.rs:1605 lance provides update_columns api that can accept data with rowids, but it's more complicated, it can update columns based on other conditions.

@zhoulii
Copy link
Member Author

zhoulii commented Dec 23, 2025

Maybe new API: write_builder.update_columns_by_row_id(Table) is better.

Thanks for the review ! @JingsongLi Comments are addressed, please take a look again, thanks.

self._partial_column_write = PartialColumnWrite(self.table, self.commit_user)

def write_arrow(self, table: pa.Table):
if self._partial_column_write is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you abstract file_store_write to avoid so many if else?

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't figured out the exact approach yet, so I just deleted the else branch for now.

file_store_write.write(partition_tuple, 0, batch)

# Prepare commit and assign first_row_id
commit_messages = file_store_write.prepare_commit(BATCH_COMMIT_IDENTIFIER)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should set sequence number to define the version.

Copy link
Member Author

Choose a reason for hiding this comment

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

sequence number will be set in commit stage.

"""Find the partition for a given first_row_id using pre-built partition map."""
return self.first_row_id_to_partition_map.get(first_row_id)

def _write_group(self, partition: GenericRow, first_row_id: int,
Copy link
Contributor

Choose a reason for hiding this comment

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

What should I do if all the data in the file is not included?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added some row counts validations, if not match, an error would be raised.

@zhoulii zhoulii force-pushed the sort-partial-update branch from 99bacc9 to 6ae9bff Compare December 23, 2025 11:47
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit 6fe570b into apache:master Dec 23, 2025
4 checks passed
@zhoulii zhoulii deleted the sort-partial-update branch December 23, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Introduce update_columns api in python.

2 participants