Repository navigation
fix: skip the partition sort for unpartitioned tables without fanout - #135
Closed
NoahKusaba wants to merge 1 commit into
Closed
NoahKusaba wants to merge 1 commit into
NoahKusaba wants to merge 1 commit into
Conversation
With write.datafusion.fanout.enabled=false, insert_into sorted its input by _partition, a column only partitioned tables have, so INSERT into an unpartitioned table failed at planning. Only the clustered writer used for partitioned tables needs the sort. Closes apache#132.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
With
write.datafusion.fanout.enabled=false, anINSERTinto an unpartitioned table fails at planning:insert_intoadds the_partitioncolumn 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 useUnpartitionedWriter, which needs no sort.What changes are included in this PR?
insert_intosorts by_partitiononly 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_fanoutinserts two rows into an unpartitioned table with fanout disabled, and snapshots the plan (no sort), the row count and the rows read back. Onmainit fails with the error above. It's the first test that setswrite.datafusion.fanout.enabled.Partitioned tables with fanout disabled are left to #38, where the optimizer removes this sort.
Are there any user-facing changes?
INSERTinto an unpartitioned table withwrite.datafusion.fanout.enabled=falsenow works.