Convert Arrow fields to Paimon [`DataField`]s with auto-assigned IDs starting from 0.
(fields: &[ArrowField])
| 229 | |
| 230 | /// Convert Arrow fields to Paimon [`DataField`]s with auto-assigned IDs starting from 0. |
| 231 | pub fn arrow_fields_to_paimon(fields: &[ArrowField]) -> crate::Result<Vec<DataField>> { |
| 232 | fields |
| 233 | .iter() |
| 234 | .enumerate() |
| 235 | .map(|(i, f)| { |
| 236 | let paimon_type = arrow_to_paimon_type(f.data_type(), f.is_nullable())?; |
| 237 | Ok(DataField::new(i as i32, f.name().clone(), paimon_type)) |
| 238 | }) |
| 239 | .collect() |
| 240 | } |
| 241 | |
| 242 | /// Build an Arrow [`Schema`](ArrowSchema) from Paimon [`DataField`]s. |
| 243 | pub fn build_target_arrow_schema(fields: &[DataField]) -> crate::Result<Arc<ArrowSchema>> { |