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

Function build_target_arrow_schema

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

Build an Arrow [`Schema`](ArrowSchema) from Paimon [`DataField`]s.

(fields: &[DataField])

Source from the content-addressed store, hash-verified

241
242/// Build an Arrow [`Schema`](ArrowSchema) from Paimon [`DataField`]s.
243pub 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)]
259mod tests {

Callers 11

try_newMethod · 0.85
read_batch_streamMethod · 0.85
read_batch_streamMethod · 0.85
read_batch_streamMethod · 0.85
readMethod · 0.85
create_append_writerMethod · 0.85
newMethod · 0.85

Calls 5

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

Tested by 2