Window constructors panic when the expression list is empty

Open Beginner friendly
#27,315 3 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@abp002 is already working on this.

Since Nov 14, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend, testing

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

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/datafusion

All issues in apache/datafusion

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.