nevi-me commented on a change in pull request #8291:
URL: https://github.com/apache/arrow/pull/8291#discussion_r497137450
##########
File path: rust/arrow/src/ipc/convert.rs
##########
@@ -609,10 +621,45 @@ pub(crate) fn get_fb_field_type<'a: 'b, 'b>(
children: Some(fbb.create_vector(&children[..])),
}
}
+ Dictionary(_, value_type) => {
+ // In this library, the dictionary "type" is a logical construct.
Here we
+ // pass through to the value type, as we've already captured the
index
+ // type in the DictionaryEncoding metadata in the parent field
+ get_fb_field_type(value_type, fbb)
+ }
t => unimplemented!("Type {:?} not supported", t),
}
}
+/// Create an IPC dictionary encoding
+pub(crate) fn get_fb_dictionary<'a: 'b, 'b>(
+ index_type: &DataType,
+ dict_id: i64,
+ dict_is_ordered: bool,
+ fbb: &mut FlatBufferBuilder<'a>,
+) -> WIPOffset<ipc::DictionaryEncoding<'b>> {
+ // We assume that the dictionary index type (as an integer) has already
been
+ // validated elsewhere, and can safely assume we are dealing with signed
+ // integers
+ let mut index_builder = ipc::IntBuilder::new(fbb);
+ index_builder.add_is_signed(true);
Review comment:
Although signed indices are preferred, we do support unsigned dictionary
indices in the data types, so we might need to populate this based on the
`index_type`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]