klion26 commented on code in PR #8825:
URL: https://github.com/apache/arrow-rs/pull/8825#discussion_r2518703496
##########
parquet-variant-compute/src/variant_to_arrow.rs:
##########
@@ -678,23 +678,32 @@ impl VariantToBinaryVariantArrowRowBuilder {
}
}
-struct FakeNullBuilder(NullArray);
+pub(crate) struct VariantToNullArrowRowBuilder {
+ capacity: usize,
+}
-impl FakeNullBuilder {
+impl VariantToNullArrowRowBuilder {
fn new(capacity: usize) -> Self {
- Self(NullArray::new(capacity))
+ Self { capacity }
}
- fn append_value<T>(&mut self, _: T) {}
- fn append_null(&mut self) {}
- fn finish(self) -> NullArray {
- self.0
+ fn append_value(&mut self, value: &Variant<'_, '_>) -> Result<bool> {
+ if let Some(_) = value.as_null() {
+ Ok(true)
+ } else {
+ // Null type only accepts nulls
Review Comment:
Choose to return err because `Arrays of type Null cannot contain a null
bitmask`. If we return `NullArray::new(valid_value_count)`, then the length of
the result may not be the same as the input(the other types will add `None` in
the result)
--
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]