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

Function read_char_column

datafusion/core/src/datasource/file_format/csv.rs:344–367  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

342
343 #[tokio::test]
344 async fn read_char_column() -> Result<()> {
345 let session_ctx = SessionContext::new();
346 let state = session_ctx.state();
347 let task_ctx = session_ctx.task_ctx();
348 let projection = Some(vec![0]);
349 let exec =
350 get_exec(&state, "aggregate_test_100.csv", projection, None, true).await?;
351
352 let batches = collect(exec, task_ctx).await.expect("Collect batches");
353
354 assert_eq!(1, batches.len());
355 assert_eq!(1, batches[0].num_columns());
356 assert_eq!(100, batches[0].num_rows());
357
358 let array = as_string_array(batches[0].column(0))?;
359 let mut values: Vec<&str> = vec![];
360 for i in 0..5 {
361 values.push(array.value(i));
362 }
363
364 assert_eq!(vec!["c", "d", "b", "a", "b"], values);
365
366 Ok(())
367 }
368
369 #[tokio::test]
370 async fn test_infer_schema_stream() -> Result<()> {

Callers

nothing calls this directly

Calls 9

newFunction · 0.85
as_string_arrayFunction · 0.85
columnMethod · 0.80
get_execFunction · 0.70
collectFunction · 0.50
stateMethod · 0.45
task_ctxMethod · 0.45
pushMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…