jbewing opened a new pull request, #15150: URL: https://github.com/apache/iceberg/pull/15150
This PR updates all writes from Spark 4.0 & 3.5 to set the `sort_order_id` of data files when applicable per the [Iceberg Table Spec](https://iceberg.apache.org/spec/#partition-evolution:~:text=A%20data%20or%20delete%20file%20is%20associated%20with%20a%20sort%20order%20by%20the%20sort%20order%27s%20id%20within%20a%20manifest). I've opened this PR to: 1. Gauge interest in this and validate my approach. If the approach is good, the backport for these changes to Spark 4.0 & 3.5 is clean. 2. If the approach is good, make a decision on whether to backport these changes to Spark 3.4. This patch doesn't apply super cleanly to 3.4 as it stands right now, so I don't want to invest effort into it unless others would find value from it. 3. As a follow up to those PRs, implement the ability to then report this ordering information when applicable to Spark to better inform the query planner of potential optimizations. This is rather useful when used in conjunction with SPJ and I have this running on an Iceberg fork with success. I have done this in a fork to great success. @anuragmantri has since also expressed interest in a parallel patch that they are interested in taking to the finish line after this PR is in. Thank you for the continued interest and support of my changes Anurag! I look forward to collaborating on the follow up PR. This is a successor to my initial PRs https://github.com/apache/iceberg/pull/13636 & https://github.com/apache/iceberg/pull/14683. The first of which has since been closed for being stale but I later revived for Spark 3.5 & 4.0 in https://github.com/apache/iceberg/pull/14683 at the request of @anuragmantri to complement a follow up change that we both converged on around using this optimization in conjunction w/ some Spark DSv2 APIs to report sort order when possible to optimize downstream query plans. After some discussion w/ @anuragmantr & @RussellSpitzer, I've forward ported the changes to spark 4.1 as the underlying "base" spark version has since changed. I've re-opened this PR as of late there has been some increased interest in this: - A community member has expressed interest in reviving my older PR https://github.com/apache/iceberg/pull/13636#issuecomment-3505090324 - Other community members have reported this same bug on the issue list https://github.com/apache/iceberg/issues/14531 - Interest by an Iceberg committer @RussellSpitzer So it appears that there is value to these changes being upstreamed instead of confined to a fork. ### 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_id` entry 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: https://github.com/apache/iceberg/issues/13634 cc @anuragmantri & @RussellSpitzer -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
