Skip to content

feat(transaction): Implement TransactionAction for ReplaceSortOrderAction #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

CTTY
Copy link
Contributor

@CTTY CTTY commented Jun 14, 2025

@CTTY CTTY force-pushed the ctty/tx-impl-2 branch from ec402dc to f904270 Compare June 14, 2025 04:30
@CTTY CTTY marked this pull request as ready for review June 14, 2025 04:33
direction: SortDirection,
null_order: NullOrder,
}

Copy link
Contributor Author

@CTTY CTTY Jun 14, 2025

Choose a reason for hiding this comment

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

PendingSortField is added to defer the construction of Vec<SortField> from asc/desc to commit to avoid passing Table to methods like asc

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add this as comment for PendingSortField

Copy link
Contributor

@ZENOTME ZENOTME left a comment

Choose a reason for hiding this comment

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

Thanks @CTTY! Others LGTM

/// Adds a field for sorting in ascending order.
pub fn asc(self, name: &str, null_order: NullOrder) -> Result<Self> {
pub fn asc(self, name: &str, null_order: NullOrder) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that in iceberg-java user can provide an expression here to indicates the transform of the sort field. We can do this here or open issue to do in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I think supporting Transform based sorting in ReplaceSortOrderAction is a bigger effort and should be treated separately. I've created an issue here to track: #1443

let sort_fields: Result<Vec<SortField>> = pending_sort_fields
.iter()
.map(|p| {
let field_id = table
Copy link
Contributor

Choose a reason for hiding this comment

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

how about convert code here as a function of PendingSortField, e.g. PendingSortField::to_sort_field

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.

2 participants