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

Function extract_count

datafusion/core/src/datasource/memory_test.rs:321–337  ·  view source on GitHub ↗

Returns the value of results. For example, returns 6 given the following ```text +-------+, | count |, +-------+, | 6 |, +-------+, ```

(res: Vec<RecordBatch>)

Source from the content-addressed store, hash-verified

319 /// +-------+,
320 /// ```
321 fn extract_count(res: Vec<RecordBatch>) -> u64 {
322 assert_eq!(res.len(), 1, "expected one batch, got {}", res.len());
323 let batch = &res[0];
324 assert_eq!(
325 batch.num_columns(),
326 1,
327 "expected 1 column, got {}",
328 batch.num_columns()
329 );
330 let col = batch.column(0).as_primitive::<UInt64Type>();
331 assert_eq!(col.len(), 1, "expected 1 row, got {}", col.len());
332
333 col.iter()
334 .next()
335 .expect("had value")
336 .expect("expected non null")
337 }
338
339 // Test inserting a single batch of data into a single partition
340 #[tokio::test]

Callers

nothing calls this directly

Calls 3

columnMethod · 0.80
nextMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…