-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
arrowChanges to the arrow crateChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelog
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I am writing some code that appends multiple of the same value to the FixedSizeDictinoaryBuilder
Describe the solution you'd like
In GenericByteDictionaryBuilder
, we have a helpful method called append_n
, which can save us multiple key lookups:
arrow-rs/arrow-array/src/builder/generic_bytes_dictionary_builder.rs
Lines 304 to 316 in 0737c61
/// Append a value multiple times to the array. | |
/// This is the same as `append` but allows to append the same value multiple times without doing multiple lookups. | |
/// | |
/// Returns an error if the new index would overflow the key type. | |
pub fn append_n( | |
&mut self, | |
value: impl AsRef<T::Native>, | |
count: usize, | |
) -> Result<K::Native, ArrowError> { | |
let key = self.get_or_insert_key(value)?; | |
self.keys_builder.append_value_n(key, count); | |
Ok(key) | |
} |
I would like it if the FixedSizeDictinoaryBuilder
had a similar method.
Describe alternatives you've considered
for _ in 0..count {
builder.append_slice(val)?;
}
Additional context
Metadata
Metadata
Assignees
Labels
arrowChanges to the arrow crateChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelog