fix(datafusion): return single row with count 0 for empty inserts#2712
Open
u70b3 wants to merge 1 commit into
Open
fix(datafusion): return single row with count 0 for empty inserts#2712u70b3 wants to merge 1 commit into
u70b3 wants to merge 1 commit into
Conversation
When an INSERT produces no data files, IcebergCommitExec previously returned an empty RecordBatch. DataFusion expects a single-row count result, so this change returns a batch with count=0 and skips creating a new snapshot. Includes unit and integration tests for unpartitioned and partitioned tables.
0f90cfc to
21ba002
Compare
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?
What changes are included in this PR?
Fix empty inserts in the DataFusion integration.
When an
INSERTproduces no data files (e.g.INSERT INTO ... SELECT ... WHERE false),IcebergCommitExecpreviously returned an emptyRecordBatch. DataFusion expects a single-row count result for DML statements, so this PR changes the empty-data path to return a batch with count0.Additionally, the commit executor now skips creating a transaction/snapshot when no data files are written, avoiding unnecessary table history entries.
Are these changes tested?
Yes. Added tests verifying that:
UInt64count batch with value0.Local verification:
cargo test -p iceberg-datafusioncargo clippy -p iceberg-datafusion --all-targets -- -D warningscargo fmt --all -- --checkgit diff --check