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],
)
| 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). |
| 1106 | fn 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 |
no test coverage detected