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

Function csv_expected_batch

datafusion/core/src/datasource/file_format/csv.rs:1300–1324  ·  view source on GitHub ↗
(schema: SchemaRef, line_count: usize)

Source from the content-addressed store, hash-verified

1298 }
1299
1300 fn csv_expected_batch(schema: SchemaRef, line_count: usize) -> Result<RecordBatch> {
1301 let mut c1 = Vec::with_capacity(line_count);
1302 let mut c2 = Vec::with_capacity(line_count);
1303 let mut c3 = Vec::with_capacity(line_count);
1304 let mut c4 = Vec::with_capacity(line_count);
1305
1306 for i in 0..line_count {
1307 let (int_value, float_value, bool_value, char_value) = csv_values(i);
1308 c1.push(int_value);
1309 c2.push(float_value);
1310 c3.push(bool_value);
1311 c4.push(char_value);
1312 }
1313
1314 let expected = RecordBatch::try_new(
1315 schema.clone(),
1316 vec![
1317 Arc::new(Int32Array::from(c1)),
1318 Arc::new(Float64Array::from(c2)),
1319 Arc::new(BooleanArray::from(c3)),
1320 Arc::new(StringArray::from(c4)),
1321 ],
1322 )?;
1323 Ok(expected)
1324 }
1325
1326 fn csv_line(line_number: usize) -> Bytes {
1327 let (int_value, float_value, bool_value, char_value) = csv_values(line_number);

Calls 3

csv_valuesFunction · 0.85
pushMethod · 0.45
cloneMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…