unikdahal opened a new issue, #24581:
URL: https://github.com/apache/datafusion/issues/24581

   ### Describe the bug
   
   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<>>).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to