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

Method from_arrow

crates/paimon/src/spec/binary_row.rs:351–367  ·  view source on GitHub ↗

Build a BinaryRow from selected columns of an Arrow RecordBatch at a given row. `field_indices` maps each position in the output BinaryRow to a column index in the batch; `fields` provides the Paimon DataField metadata for every column in the schema (indexed by the same column indices).

(
        batch: &RecordBatch,
        row_idx: usize,
        field_indices: &[usize],
        fields: &[crate::spec::DataField],
    )

Source from the content-addressed store, hash-verified

349 /// in the batch; `fields` provides the Paimon DataField metadata for every column
350 /// in the schema (indexed by the same column indices).
351 pub fn from_arrow(
352 batch: &RecordBatch,
353 row_idx: usize,
354 field_indices: &[usize],
355 fields: &[crate::spec::DataField],
356 ) -> crate::Result<Self> {
357 let arity = field_indices.len() as i32;
358 let mut builder = BinaryRowBuilder::new(arity);
359 for (pos, &field_idx) in field_indices.iter().enumerate() {
360 let field = &fields[field_idx];
361 match extract_datum_from_arrow(batch, row_idx, field_idx, field.data_type())? {
362 Some(datum) => builder.write_datum(pos, &datum, field.data_type()),
363 None => builder.set_null_at(pos),
364 }
365 }
366 Ok(builder.build())
367 }
368
369 /// Build a BinaryRow from typed Datum values using `BinaryRowBuilder`.
370 /// `None` entries are written as null fields.

Callers

nothing calls this directly

Calls 7

extract_datum_from_arrowFunction · 0.85
data_typeMethod · 0.80
write_datumMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
set_null_atMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected