Skip to content

Spark writers should set the sort_order_id data file entry in manifests to the write ordering #13634

Closed as not planned

Description

@jbewing

Apache Iceberg version

1.9.0

Query engine

Spark

Please describe the bug 🐞

Currently, when writing files with Spark—I'm using 3.5.6—and Iceberg 1.9.0, when a table declares a sort order—or honestly even when it doesn't—I would expect that when writing files from the Spark compute engine in a manner that is ordered e.g. not using the fanout writer that the sort_order_id field be set for written data files in the manifests (Data File Entry Manifest Spec). Currently, this field is never set when writing data files with Spark.

Per the Iceberg Table Spec on Sorting

A data or delete file is associated with a sort order by the sort order's id within a manifest. Therefore, the table must declare all the sort orders for lookup. A table could also be configured with a default sort order id, indicating how the new data should be sorted by default. Writers should use this default sort order to sort the data on write, but are not required to if the default order is prohibitively expensive, as it would be for streaming writes.

I realize that this is an optional field, so it's not required to be set, however, theoretically setting this field can unlock performance optimizations in the future. For example, I have a feature that I'd love to contribute after this one from an Iceberg fork which enables reporting file ordering to Spark during scans by implementing the SupportsReportOrdering interface to enable the query optimizer to eliminate redundant sorts.

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time

Activity

  1. added
    bug
    on Jul 23, 2025
  2. github-actions commented on Jan 20, 2026

    @github-actions

    This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

  3. github-actions commented on Feb 3, 2026

    @github-actions

    This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions