thinkharderdev opened a new issue, #8499:
URL: https://github.com/apache/arrow-datafusion/issues/8499
### Describe the bug
`AnalysisContext` will try and create a `ScalarValue` when there are no
statistics for a given column. Since there is no `ScalarValue` representation
for union types this fails.
The constructor is fallible so this isn't a bug per se, but in other
contexts this value is unwrapped and can cause panics during query planning
### To Reproduce
Minimized example of what we have observed causing panics during query
planning:
```
#[test]
fn test_equivalence_properties_union_type() -> Result<()> {
let union_type = DataType::Union(
UnionFields::new(
vec![0,1],
vec![
Field::new("f1", DataType::Int32, true),
Field::new("f2", DataType::Utf8, true),
],
),
UnionMode::Sparse,
);
let schema = Arc::new(Schema::new(vec![
Field::new("c1", DataType::Int32, true),
Field::new("c2", union_type, true),
]));
let exec = FilterExec::try_new(
binary(
binary(col("c1", &schema)?, Operator::GtEq, lit(1u32),
&schema)?,
Operator::And,
binary(col("c1", &schema)?, Operator::LtEq, lit(4u32),
&schema)?,
&schema,
)?,
Arc::new(EmptyExec::new(true, schema.clone()))
)?;
exec.statistics().unwrap();
Ok(())
}
```
Since `FilterExec::equivalence_properties` unwraps the result of
`FilterExec::statistics` this just panics.
### Expected behavior
`FilterExec::equuivalence_properties` is infallible so it shouldn't panic :)
### Additional context
There is probably a way to patch this but seems like we should just add a
`ScalarValue::Union` variant.
--
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]