NoahKusaba opened a new pull request, #135: URL: https://github.com/apache/datafusion-iceberg/pull/135
## Which issue does this PR close? - Closes #132. ## Rationale for this change With `write.datafusion.fanout.enabled=false`, an `INSERT` into an unpartitioned table fails at planning: ``` Error during planning: Partition column '_partition' not found in schema. Ensure the plan has been extended with partition values using project_with_partition. ``` `insert_into` adds the `_partition` column only for partitioned tables, but sorted by it whenever fanout was disabled. The sort is there for the clustered writer, which partitioned tables use when fanout is disabled. Unpartitioned tables always use `UnpartitionedWriter`, which needs no sort. ## What changes are included in this PR? `insert_into` sorts by `_partition` only when fanout is disabled and the table is partitioned. A comment says why. ## Are these changes tested? Yes. `insert_into::inserts_into_an_unpartitioned_table_without_fanout` inserts two rows into an unpartitioned table with fanout disabled, and snapshots the plan (no sort), the row count and the rows read back. On `main` it fails with the error above. It's the first test that sets `write.datafusion.fanout.enabled`. Partitioned tables with fanout disabled are left to #38, where the optimizer removes this sort. ## Are there any user-facing changes? `INSERT` into an unpartitioned table with `write.datafusion.fanout.enabled=false` now works. -- 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]
