kastolars commented on code in PR #2560:
URL: https://github.com/apache/arrow-rs/pull/2560#discussion_r952836948
##########
arrow/src/array/builder/union_builder.rs:
##########
@@ -225,10 +228,11 @@ impl UnionBuilder {
data
}
None => match self.value_offset_builder {
- Some(_) => FieldData::new::<T>(self.fields.len() as i8,
T::DATA_TYPE),
+ Some(_) => FieldData::new::<T>(self.fields.len() as i8,
T::DATA_TYPE, self.initial_capacity),
+ // In the case of a sparse union, we should pass the maximum
of the currently length and the capacity.
None => {
let mut fd =
- FieldData::new::<T>(self.fields.len() as i8,
T::DATA_TYPE);
+ FieldData::new::<T>(self.fields.len() as i8,
T::DATA_TYPE, std::cmp::max(self.len, self.initial_capacity));
Review Comment:
I did not know you could do that, thanks!
--
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]