Window constructors panic when the expression list is empty
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in windows/window_agg_exec.rs and read WindowAggExec::try_new and BoundedWindowAggExec::try_new, where the issue identifies unchecked reads of the first expression. Add regression coverage for empty expression lists and verify both constructors return DataFusionError::Plan before deriving schema or partition properties. Done means the empty-list cases return errors instead of panicking, while nonempty plans retain their behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
WindowAggExec::try_new and BoundedWindowAggExec::try_new index window_expr[0] when the list is empty. Both constructors return Result, but this input panics instead of returning an error.
The physical plan decoder reaches these constructors when a WindowAggExecNode contains a valid child and no window_expr entries. With panic = "abort", decoding that node stops the process.
To reproduce
use std::sync::Arc;
use arrow::datatypes::Schema;
use datafusion_physical_plan::empty::EmptyExec;
use datafusion_physical_plan::windows::{BoundedWindowAggExec, WindowAggExec};
use datafusion_physical_plan::InputOrderMode;
let input = Arc::new(EmptyExec::new(Arc::new(Schema::empty())));
WindowAggExec::try_new(vec![], input.clone(), false); // panics
BoundedWindowAggExec::try_new(vec![], input, InputOrderMode::Linear, false); // panics
The first panic was found in a peer-plan fuzz run using DataFusion 55.1.0: https://github.com/telekom/sutura/actions/runs/42873920210/job/130032073633
The unchanged input is 21 bytes, base64 ehMKBhoECgAQARoEEgKgARgUUIBA. The failure is index out of bounds: the len is 0 but the index is 0 in windows/window_agg_exec.rs. The current upstream source also has the unchecked first-element reads in both constructors; I have not run the reproducer on upstream main.
Expected behavior
Return DataFusionError::Plan when there is no window expression, before deriving the schema or partition properties. Nonempty window plans keep their current behavior.
Additional context
We are preparing a small vendored fix and worker-decode regression tests in sutura. This report is limited to the empty expression list. It does not establish that every malformed physical plan is refused.
AI assistance was used to investigate and draft this report.
- Dominant language
- Rust
- Stars
- 9.6k
- Forks
- 2.6k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 352
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/datafusion
-
`verify-release-candidate.sh` version check doesn't catch `-dev` versions and is skipped on macOSPossibly taken @vinycalves claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/datafusion#27563 · 1 comment ·
Maintainers usually reply within 1 day
-
`MoveTowardsLeafNodes` placement implies speculative evaluation, but the docs don't say soPossibly taken @Inf1mum claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/datafusion#27487 · 3 comments ·
Maintainers usually reply within 1 day
-
`lpad` and `rpad` with a literal length above `i32::MAX` error on a NULL string or fillPossibly taken @TechWizard9999 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
apache/datafusion#27482 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/datafusion#27094 · 1 comment ·
Maintainers usually reply within 1 day
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlPossibly taken @jonasHanhan claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/datafusion#27059 ·
Maintainers usually reply within 1 day
All issues in apache/datafusion
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
tinystream-dev/tinystream#132 ·
-
contract good first issue testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Emmyt24/nova-launch#2436 ·
Maintainers usually reply within 1 day