Skip to content

Conversation

@szehon-ho
Copy link
Member

@szehon-ho szehon-ho commented Jun 27, 2024

In recent releases of Iceberg-Spark, there have been changes to Spark defaults for distribution mode, by changes like: #7637 (and previous ones).

I have seen many questions regarding why an extra shuffle is included in writes, and it is often this change in default. One source of confusion I have seen is the doc mentioning table property write.distribution-mode which says default is NONE, so this PR tries to add more to here to explain this.

@github-actions github-actions bot added the docs label Jun 27, 2024
| compression-codec | Table write.(fileformat).compression-codec | Overrides this table's compression codec for this write |
| compression-level | Table write.(fileformat).compression-level | Overrides this table's compression level for Parquet and Avro tables for this write |
| compression-strategy | Table write.orc.compression-strategy | Overrides this table's compression strategy for ORC tables for this write |
| distribution-mode | `Range` if Sort Order Defined ; `Hash` if Partition Defined; `None` otherwise | Override this table's distribution mode for this write |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| distribution-mode | `Range` if Sort Order Defined ; `Hash` if Partition Defined; `None` otherwise | Override this table's distribution mode for this write |
| distribution-mode | `Range` if sort order is defined ; `Hash` if partition is defined; `None` otherwise | Override this table's distribution mode for this write |

| write.target-file-size-bytes | 536870912 (512 MB) | Controls the size of files generated to target about this many bytes |
| write.delete.target-file-size-bytes | 67108864 (64 MB) | Controls the size of delete files generated to target about this many bytes |
| write.distribution-mode | none | Defines distribution of write data: __none__: don't shuffle rows; __hash__: hash distribute by partition key ; __range__: range distribute by partition key or sort key if table has an SortOrder |
| write.distribution-mode | none (see engines for specific defaults) | Defines distribution of write data: __none__: don't shuffle rows; __hash__: hash distribute by partition key ; __range__: range distribute by partition key or sort key if table has an SortOrder |
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering if it's helpful to hyperlink the engine specific defaults here or in notes , for the convenience of lookup

like

[Spark](spark-configuration.md#write-options)

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

@szehon-ho
Copy link
Member Author

@RussellSpitzer do you have time to take a look at this?

| write.target-file-size-bytes | 536870912 (512 MB) | Controls the size of files generated to target about this many bytes |
| write.delete.target-file-size-bytes | 67108864 (64 MB) | Controls the size of delete files generated to target about this many bytes |
| write.distribution-mode | none | Defines distribution of write data: __none__: don't shuffle rows; __hash__: hash distribute by partition key ; __range__: range distribute by partition key or sort key if table has an SortOrder |
| write.distribution-mode | none. Engines may override this default, for example [Spark](spark-configuration.md#write-options) | Defines distribution of write data: __none__: don't shuffle rows; __hash__: hash distribute by partition key ; __range__: range distribute by partition key or sort key if table has an SortOrder |
Copy link
Member

Choose a reason for hiding this comment

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

I didn't really like this description before, but I think the change is good. Might be nice in a follow up to change this since it isn't clear what "distribution of write data" is.

| compression-codec | Table write.(fileformat).compression-codec | Overrides this table's compression codec for this write |
| compression-level | Table write.(fileformat).compression-level | Overrides this table's compression level for Parquet and Avro tables for this write |
| compression-strategy | Table write.orc.compression-strategy | Overrides this table's compression strategy for ORC tables for this write |
| distribution-mode | `Range` if Sort Order Defined ; `Hash` if Partition Defined ; `None` otherwise | Override this table's distribution mode for this write |
Copy link
Member

Choose a reason for hiding this comment

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

Can we change this to a link to the spark-writes section? May be more clear

Copy link
Member Author

Choose a reason for hiding this comment

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

@RussellSpitzer good point, I just linked from both sections, let me know what you think now?

@szehon-ho szehon-ho force-pushed the distribution_mode_doc branch from 3d2b21f to d5aa46a Compare July 16, 2024 20:07
@szehon-ho szehon-ho force-pushed the distribution_mode_doc branch from d5aa46a to ab56f03 Compare July 16, 2024 20:39
@RussellSpitzer
Copy link
Member

Looks good to me now. :) Feel free to merge

@szehon-ho szehon-ho merged commit 4a0ae22 into apache:main Jul 16, 2024
@szehon-ho
Copy link
Member Author

Thanks @RussellSpitzer @dramaticlly @ajantha-bhat for reviews!

jasonf20 pushed a commit to jasonf20/iceberg that referenced this pull request Aug 4, 2024
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants