Skip to content

Commit e44f1ad

Browse files
authored
fix(ipc): Support serializing structs containing dictionaries (apache#848)
* fix(ipc): Support serializing structs containing dictionaries Dictionary fields nested in structs were not properly marked as dictionary fields when serializing to fb. * style: cargo fmt
1 parent c38ac2a commit e44f1ad

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

arrow/src/ipc/convert.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -610,21 +610,7 @@ pub(crate) fn get_fb_field_type<'a>(
610610
// struct's fields are children
611611
let mut children = vec![];
612612
for field in fields {
613-
let inner_types =
614-
get_fb_field_type(field.data_type(), field.is_nullable(), fbb);
615-
let field_name = fbb.create_string(field.name());
616-
children.push(ipc::Field::create(
617-
fbb,
618-
&ipc::FieldArgs {
619-
name: Some(field_name),
620-
nullable: field.is_nullable(),
621-
type_type: inner_types.type_type,
622-
type_: Some(inner_types.type_),
623-
dictionary: None,
624-
children: inner_types.children,
625-
custom_metadata: None,
626-
},
627-
));
613+
children.push(build_field(fbb, field));
628614
}
629615
FBFieldType {
630616
type_type: ipc::Type::Struct_,
@@ -791,6 +777,18 @@ mod tests {
791777
))),
792778
false,
793779
),
780+
Field::new(
781+
"struct<dictionary<int32, utf8>>",
782+
DataType::Struct(vec![Field::new(
783+
"dictionary<int32, utf8>",
784+
DataType::Dictionary(
785+
Box::new(DataType::Int32),
786+
Box::new(DataType::Utf8),
787+
),
788+
false,
789+
)]),
790+
false,
791+
),
794792
Field::new(
795793
"struct<int64, list[struct<date32, list[struct<>]>]>",
796794
DataType::Struct(vec![

0 commit comments

Comments
 (0)