You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
panic: 'StructArray::new' on zero-field (empty) structs in ScalarValue::compact and ScalarValue::new_default #24581
Calling ScalarValue::compact() or ScalarValue::new_default() on a zero-field struct schema (DataType::Struct(Fields::empty())) causes a panic during Arrow struct construction.
In datafusion/common/src/scalar/mod.rs:
• compact_view_buffers and ScalarValue::new_default unconditionally call StructArray::new(...). When a struct has zero fields, no child arrays exist to infer the row length from, leading to a panic in arrow-rs
To Reproduce
use std::sync::Arc;
use arrow::array::StructArray;
use datafusion_common::ScalarValue;
let mut scalar = ScalarValue::Struct(Arc::new(StructArray::new_empty_fields(3, None)));
scalar.compact(); // Panics in StructArray::new
Expected behavior
Zero-field structs should be constructed using StructArray::new_empty_fields(length, nulls) instead of StructArray::new(...).
Additional context
Affects downstream consumers (e.g., Comet) when accumulators call ScalarValue::compact() on empty struct columns or nested containers (List<Struct<>>).
Activity
unikdahal commentedon Aug 22, 2026
take
fix(common): support empty struct in ScalarValue::compact and new_def…