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

Function read_small_batches

datafusion/core/src/datasource/file_format/json.rs:99–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97
98 #[tokio::test]
99 async fn read_small_batches() -> Result<()> {
100 let config = SessionConfig::new().with_batch_size(2);
101 let session_ctx = SessionContext::new_with_config(config);
102 let state = session_ctx.state();
103 let task_ctx = state.task_ctx();
104 let projection = None;
105 let exec = get_exec(&state, projection, None).await?;
106 let stream = exec.execute(0, task_ctx)?;
107
108 let tt_batches: i32 = stream
109 .map(|batch| {
110 let batch = batch.unwrap();
111 assert_eq!(4, batch.num_columns());
112 assert_eq!(2, batch.num_rows());
113 })
114 .fold(0, |acc, _| async move { acc + 1i32 })
115 .await;
116
117 assert_eq!(tt_batches, 6 /* 12/2 */);
118
119 // test metadata
120 assert_eq!(exec.partition_statistics(None)?.num_rows, Precision::Absent);
121 assert_eq!(
122 exec.partition_statistics(None)?.total_byte_size,
123 Precision::Absent
124 );
125
126 Ok(())
127 }
128
129 #[tokio::test]
130 async fn read_limit() -> Result<()> {

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
get_execFunction · 0.70
with_batch_sizeMethod · 0.45
stateMethod · 0.45
task_ctxMethod · 0.45
executeMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…