Skip to content

Commit f42726d

Browse files
getChanjecsand838
andauthored
Apply suggestions from code review - strip mtdt
Co-authored-by: Connor Sanders <170039284+jecsand838@users.noreply.github.com>
1 parent caa0c79 commit f42726d

File tree

1 file changed

+14
-0
lines changed
  • datafusion/datasource-avro/src

1 file changed

+14
-0
lines changed

datafusion/datasource-avro/src/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ fn strip_metadata_from_data_type(data_type: &DataType) -> DataType {
8989
DataType::Map(field, sorted) => {
9090
DataType::Map(Arc::new(strip_metadata_from_field(field.as_ref())), *sorted)
9191
}
92+
DataType::Union(fields, mode) => {
93+
let (type_ids, children): (Vec<_>, Vec<_>) = fields
94+
.iter()
95+
.map(|(type_id, field)| {
96+
(*type_id, Arc::new(strip_metadata_from_field(field.as_ref())))
97+
})
98+
.unzip();
99+
100+
DataType::Union(
101+
UnionFields::try_new(type_ids, children)
102+
.expect("existing union fields should remain valid"),
103+
*mode,
104+
)
105+
}
92106
_ => data_type.clone(),
93107
}
94108
}

0 commit comments

Comments
 (0)