friendlymatthew opened a new issue, #8609:
URL: https://github.com/apache/arrow-rs/issues/8609
**Is your feature request related to a problem or challenge? Please describe
what you are trying to do.**
Consider the following:
```rs
fn foo() {
let mut b = VariantArrayBuilder::new(1);
b.append_null();
let v = b.build();
v.value(0); // will panic
}
```
Probing a `VariantArray` when that element is null will result in a panic:
```rs
thread 'cast_to_variant::tests::foo' panicked at
/Users/matthewkim/.cargo/git/checkouts/arrow-rs-583cca34693b79b8/760b7b6/parquet-variant/src/variant.rs:318:14:
Invalid variant metadata: InvalidArgumentError("Received empty bytes")
```
This seems like an odd pattern, as it's not clear exactly what a user should
do when iterating or probing through a `VariantArray`
**Describe the solution you'd like**
We could have `VariantArray::value(i: usize)` return an
`Option<Variant<'a>>`. This way, it's clear when it's `None`, that element is
considered `null`. _Note, this is different from `Some(Variant::Null))`_
**Additional context**
<!--
Add any other context or screenshots about the feature request here.
-->
This feature is motivated by
[datafusion-variant](https://github.com/datafusion-contrib/datafusion-variant),
a higher-level library that integrates with Datafusion through a series of udfs
--
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]