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

Function batch_build_binary_rows

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

Build BinaryRows for all rows in the batch for the given field indices. Downcasts columns once, then iterates rows — O(F) downcasts instead of O(N*F).

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

Source from the content-addressed store, hash-verified

1104/// Build BinaryRows for all rows in the batch for the given field indices.
1105/// Downcasts columns once, then iterates rows — O(F) downcasts instead of O(N*F).
1106fn batch_build_binary_rows(
1107 batch: &RecordBatch,
1108 field_indices: &[usize],
1109 fields: &[crate::spec::DataField],
1110) -> crate::Result<Vec<BinaryRow>> {
1111 let typed_columns = downcast_columns(batch, field_indices, fields)?;
1112 let arity = field_indices.len() as i32;
1113 let num_rows = batch.num_rows();
1114 let mut rows = Vec::with_capacity(num_rows);
1115
1116 for row_idx in 0..num_rows {
1117 let mut builder = BinaryRowBuilder::new(arity);
1118 for (pos, (typed_col, field)) in typed_columns.iter().enumerate() {
1119 write_typed_value(&mut builder, pos, row_idx, typed_col, field.data_type());
1120 }
1121 rows.push(builder.build());
1122 }
1123 Ok(rows)
1124}
1125
1126/// Batch-compute serialized partition bytes for all rows.
1127/// Returns one `Vec<u8>` per row, identical to calling

Callers 2

batch_hash_codesFunction · 0.85

Calls 7

downcast_columnsFunction · 0.85
write_typed_valueFunction · 0.85
num_rowsMethod · 0.80
data_typeMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected