fix: Prevent native write when input is not Arrow format#3227
Merged
andygrove merged 4 commits intoapache:mainfrom Jan 25, 2026
Merged
fix: Prevent native write when input is not Arrow format#3227andygrove merged 4 commits intoapache:mainfrom
andygrove merged 4 commits intoapache:mainfrom
Conversation
This test verifies that when native_comet scan doesn't support complex types, the native write correctly falls back to Spark instead of failing at runtime with "Comet execution only takes Arrow Arrays" error. Also refactors the test helper methods to reduce code duplication. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3227 +/- ##
============================================
+ Coverage 56.12% 60.05% +3.92%
- Complexity 976 1442 +466
============================================
Files 119 172 +53
Lines 11743 15941 +4198
Branches 2251 2633 +382
============================================
+ Hits 6591 9573 +2982
- Misses 4012 5038 +1026
- Partials 1140 1330 +190 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| case op: DataWritingCommandExec => | ||
| convertToComet(op, CometDataWritingCommand).getOrElse(op) | ||
| // Get the actual data source child that will feed data to the native writer |
Contributor
There was a problem hiding this comment.
Would it be more generic to do this in CometExecRule.convertToComet -
if (op.children.nonEmpty && !op.children.forall(_.isInstanceOf[CometNativeExec])) {
// For operators like writes, require all children to be native
if (requiresNativeChildren(handler)) {
return None // Fallback to Spark
}
...
}
Member
Author
There was a problem hiding this comment.
Yes, thanks. I updated this.
Move the native children check from the DataWritingCommandExec case into convertToComet method using a requiresNativeChildren flag on CometOperatorSerde. This makes the check more generic so other operators can use it by overriding the flag. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
comphead
approved these changes
Jan 25, 2026
Contributor
comphead
left a comment
There was a problem hiding this comment.
Great thanks @andygrove
Member
Author
|
Thanks for the reviews @parthchandra and @comphead |
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.
Rationale
Closes #2944
Closes #3215
Summary
Test plan
"native write falls back when scan produces non-Arrow data"in CometParquetWriterSuitenative_cometscan doesn't support complex types, the native write falls back to Spark instead of failing at runtime🤖 Generated with Claude Code