-
Notifications
You must be signed in to change notification settings - Fork 272
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
base: main
Are you sure you want to change the base?
Conversation
direction: SortDirection, | ||
null_order: NullOrder, | ||
} | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
Which issue does this PR close?
Related Issues:
Transaction::commit
method #1387TableMetadata
to new location. #1388What changes are included in this PR?
TransactionAction
trait forReplaceSortOrderAction
Are these changes tested?
Added unit tests