ajwerner commented on code in PR #6845:
URL: https://github.com/apache/arrow-rs/pull/6845#discussion_r1873555322
##########
arrow-array/src/builder/struct_builder.rs:
##########
@@ -291,29 +290,38 @@ pub fn make_builder(datatype: &DataType, capacity: usize)
-> Box<dyn ArrayBuilde
t => panic!("The field of Map data type {t:?} should has a child
Struct field"),
},
DataType::Struct(fields) =>
Box::new(StructBuilder::from_fields(fields.clone(), capacity)),
- DataType::Dictionary(key_type, value_type) if **key_type ==
DataType::Int32 => {
- match &**value_type {
- DataType::Utf8 => {
- let dict_builder: StringDictionaryBuilder<Int32Type> =
- StringDictionaryBuilder::with_capacity(capacity, 256,
1024);
- Box::new(dict_builder)
- }
- DataType::LargeUtf8 => {
- let dict_builder: LargeStringDictionaryBuilder<Int32Type> =
- LargeStringDictionaryBuilder::with_capacity(capacity,
256, 1024);
- Box::new(dict_builder)
- }
- DataType::Binary => {
- let dict_builder: BinaryDictionaryBuilder<Int32Type> =
- BinaryDictionaryBuilder::with_capacity(capacity, 256,
1024);
- Box::new(dict_builder)
- }
- DataType::LargeBinary => {
- let dict_builder: LargeBinaryDictionaryBuilder<Int32Type> =
- LargeBinaryDictionaryBuilder::with_capacity(capacity,
256, 1024);
- Box::new(dict_builder)
- }
- t => panic!("Unsupported dictionary value type {t:?} is not
currently supported"),
+ DataType::Dictionary(key_type, value_type) if matches!(**key_type,
DataType::Int8 | DataType::Int32 ) => {
Review Comment:
Heh, I had originally typed it with all of them and backtracked when I read
the thread in the initial PR that introduced this code that was concerned with
code bloat. Done.
--
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]