fix: column indices in FFI partition evaluator#16480
Merged
alamb merged 2 commits intoapache:mainfrom Jun 27, 2025
Merged
Conversation
alamb
approved these changes
Jun 26, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @timsaucer -- this makes sense to me
| DataType::Null, | ||
| true, | ||
| ), | ||
| let max_column = required_columns.keys().max(); |
Contributor
There was a problem hiding this comment.
I wonder if it is time to simply pass in the real schema to PartitionEvaluatorArgs 🤔
| } | ||
|
|
||
| #[tokio::test] | ||
| async fn test_lag_udwf() -> datafusion::common::Result<()> { |
Contributor
There was a problem hiding this comment.
I verified these tests fail without the code change in this PR
thread 'udwf::tests::test_lag_udwf' panicked at /Users/andrewlamb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-schema-55.1.0/src/schema.rs:382:10:
index out of bounds: the len is 0 but the index is 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'udwf::tests::test_lag_udwf' panicked at library/core/src/panicking.rs:218:5:
panic in a function that cannot unwind
stack backtrace:
0: 0x108eec990 - std::backtrace_rs::backtrace::libunwind::trace::hd09570c029a6744a
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
1: 0x108eec990 - std::backtrace_rs::backtrace::trace_unsynchronized::h8d2fa64833f91cb3
alamb
pushed a commit
to alamb/datafusion
that referenced
this pull request
Jul 2, 2025
* Column indices were not computed correctly, causing a panic * Add unit tests
alamb
added a commit
that referenced
this pull request
Jul 4, 2025
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
There is a bug in how we compute the indices to create a schema for. It misses the last index and it can erroneously create an index 0 when none exists.
What changes are included in this PR?
Properly handle the
Nonecase when findingmaxindex.Are these changes tested?
Unit test will be added before marking this PR ready. Tested in datafusion-python.
Are there any user-facing changes?
No