sunchao commented on a change in pull request #1430:
URL: https://github.com/apache/arrow-rs/pull/1430#discussion_r824879107
##########
File path: arrow/src/array/array_dictionary.rs
##########
@@ -98,13 +98,19 @@ impl<'a, K: ArrowPrimitiveType> DictionaryArray<K> {
// Note: This does more work than necessary by rebuilding /
// revalidating all the data
- let data = ArrayData::builder(dict_data_type)
+ let mut data = ArrayData::builder(dict_data_type)
.len(keys.len())
.add_buffer(keys.data().buffers()[0].clone())
- .add_child_data(values.data().clone())
- .build()?;
+ .add_child_data(values.data().clone());
- Ok(data.into())
+ match keys.data().null_buffer() {
+ Some(buffer) if keys.data().null_count() > 0 => {
+ data = data.null_bit_buffer(buffer.clone());
Review comment:
nit: we can update the null count here too, instead of calculating it
later in `build`.
--
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]