-
Notifications
You must be signed in to change notification settings - Fork 3k
Spark 3.5: Set data file sort_order_id in manifest when writing/compacting data files
#13636
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
Conversation
…a files with Spark 3.5
|
|
||
| public org.apache.iceberg.SortOrder icebergOrdering() { | ||
| return icebergOrdering; | ||
| } |
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'm not in love with this approach, but I went through a couple of iterations of this and plumbing the intended Iceberg SortOrder along through with the Spark SortOrder ended up being the cleanest in my opinion (open to any suggestions of course). I initially had an approach which would attempt to re-guess the Iceberg SortOrder from a Spark SortOrder. It worked pretty well, but was pretty naive in my opinion—the algorithm was to essentially reverse the Iceberg -> Spark SortOrder transformation as best as possible and then see if things matched up. It gets complicated when you start to consider Spark Orderings for stuff like say a positionDeltaUpdateMergeOrdering.
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
|
@jbewing I have same issue and thanks for the fix. What's your plan of this change, do you still plan to drive this to be merged? |
OOC, what's your intended usage of the sort order in the manifest files? I'm assuming to better inform a downstream tool about potential optimizations
Sorry, I put this one up and kinda forgot about it and one of my other Iceberg PRs after I got radio silence from a maintainer in another PR after some feedback. Since this code is running perfectly fine in a fork of Iceberg, there wasn't a big motivation to get things upstreamed. However, given that you would find benefit from this (and it also appears like there's another user with the same issue: #14531), I will find some time next week to update my PR on the current master branch and get this reviewed and integrated! |
|
@jbewing its also for optimization. We need the sort id to be in files table so that we can make some accurate decisions about it. Thanks for the quick response and your continual effort on this. |
What
This PR updates all writes from Spark 3.5 to set the
sort_order_idof data files when applicable per the Iceberg Table Spec. I've opened this PR to:Testing
I've added tests for newer added utility functions and updated existing tests that write data files and compact data files in a sorted manner to verify that we're setting the
sort_order_identry in the manifests to the correct value. Additionally, I've used this patch on an internal fork and verified that it correctly sets this field during compaction and normal writes.Issue: #13634