scovich opened a new issue, #8810:
URL: https://github.com/apache/arrow-rs/issues/8810
The row builder for `DataType::Null` does not currently enforce strict
casting. All values are blindly treated as null, no matter the casting mode.
The simplest fix would be to adjust the null builder's definition:
```diff
define_variant_to_primitive_builder!(
struct VariantToNullArrowRowBuilder<'a>
|capacity| -> FakeNullBuilder { FakeNullBuilder::new(capacity) },
- |_value| Some(Variant::Null),
+ |value| value.as_null(),
type_name: "Null"
);
```
and change the fake row builder's append_value method to suit:
```diff
impl FakeNullBuilder {
fn new(capacity: usize) -> Self {
Self(NullArray::new(capacity))
}
- fn append_value<T>(&mut self, _: T) {}
+ fn append_value(&mut self, _: ()) {}
fn append_null(&mut self) {}
```
... but that might produce clippy warnings about passing unit type as a
function argument. If so, we'd need to adjust the value conversion to produce
Some dummy value instead, e.g. `value.as_null().map(|_| 0)` or `matches!(value,
Variant::Null).then_some(0)`
Also, the fake null builder should _probably_ track how many "values" were
"appended" and either produce a NullArray of that length or blow up if the call
count disagrees with the array's length. The former is probably more correct
than the latter, since it matches all the other builders for whom "capacity" is
only a hint.
_Originally posted by @scovich in
https://github.com/apache/arrow-rs/pull/8796#discussion_r2504096126_
--
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]