MCPcopy Create free account
hub / github.com/apache/datafusion / widen_batch

Function widen_batch

benchmarks/src/bin/gen_wide_data.rs:211–231  ·  view source on GitHub ↗
(
    batch: &RecordBatch,
    wide_schema: &SchemaRef,
    factor: usize,
)

Source from the content-addressed store, hash-verified

209}
210
211fn widen_batch(
212 batch: &RecordBatch,
213 wide_schema: &SchemaRef,
214 factor: usize,
215) -> Result<RecordBatch> {
216 let cols = batch.columns();
217 let n_rows = batch.num_rows();
218 let mut wide = Vec::with_capacity(cols.len() * factor);
219 // Zero-padded copies first…
220 for _ in 2..=factor {
221 for c in cols {
222 wide.push(zero_array(c.data_type(), n_rows));
223 }
224 }
225 // …then the base data columns at the end.
226 for c in cols {
227 wide.push(Arc::clone(c));
228 }
229 RecordBatch::try_new(Arc::clone(wide_schema), wide)
230 .map_err(|e| exec_datafusion_err!("building wide batch: {e}"))
231}
232
233fn open_writer(
234 path: &Path,

Callers 1

mainFunction · 0.85

Calls 5

zero_arrayFunction · 0.85
columnsMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45
data_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…