MCPcopy Create free account
hub / github.com/apache/paimon-rust / arrow_fields_to_paimon

Function arrow_fields_to_paimon

crates/paimon/src/arrow/mod.rs:231–240  ·  view source on GitHub ↗

Convert Arrow fields to Paimon [`DataField`]s with auto-assigned IDs starting from 0.

(fields: &[ArrowField])

Source from the content-addressed store, hash-verified

229
230/// Convert Arrow fields to Paimon [`DataField`]s with auto-assigned IDs starting from 0.
231pub 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.
243pub fn build_target_arrow_schema(fields: &[DataField]) -> crate::Result<Arc<ArrowSchema>> {

Callers 2

arrow_to_paimon_typeFunction · 0.85

Calls 5

arrow_to_paimon_typeFunction · 0.85
data_typeMethod · 0.80
is_nullableMethod · 0.80
iterMethod · 0.45
nameMethod · 0.45

Tested by 1