Build an Arrow [`Schema`](ArrowSchema) from Paimon [`DataField`]s.
(fields: &[DataField])
| 241 | |
| 242 | /// Build an Arrow [`Schema`](ArrowSchema) from Paimon [`DataField`]s. |
| 243 | pub fn build_target_arrow_schema(fields: &[DataField]) -> crate::Result<Arc<ArrowSchema>> { |
| 244 | let arrow_fields: Vec<ArrowField> = fields |
| 245 | .iter() |
| 246 | .map(|f| { |
| 247 | let arrow_type = paimon_type_to_arrow(f.data_type())?; |
| 248 | Ok(ArrowField::new( |
| 249 | f.name(), |
| 250 | arrow_type, |
| 251 | f.data_type().is_nullable(), |
| 252 | )) |
| 253 | }) |
| 254 | .collect::<crate::Result<Vec<_>>>()?; |
| 255 | Ok(Arc::new(ArrowSchema::new(arrow_fields))) |
| 256 | } |
| 257 | |
| 258 | #[cfg(test)] |
| 259 | mod tests { |