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

Function test_print_batches_empty_batch

datafusion-cli/src/print_format.rs:477–503  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

475
476 #[test]
477 fn test_print_batches_empty_batch() {
478 let empty_batch = RecordBatch::new_empty(one_column_batch().schema());
479
480 // Print column headers for empty batch when format is Table
481 let output = PrintBatchesTest::new()
482 .with_format(PrintFormat::Table)
483 .with_schema(one_column_schema())
484 .with_batches(vec![empty_batch])
485 .with_header(WithHeader::Yes)
486 .run();
487 assert_snapshot!(output, @r"
488 +---+
489 | a |
490 +---+
491 +---+
492 ");
493
494 // No output for empty batch when schema contains no columns
495 let empty_batch = RecordBatch::new_empty(Arc::new(Schema::empty()));
496 let output = PrintBatchesTest::new()
497 .with_format(PrintFormat::Table)
498 .with_schema(Arc::new(Schema::empty()))
499 .with_batches(vec![empty_batch])
500 .with_header(WithHeader::Yes)
501 .run();
502 assert_eq!(output, "")
503 }
504
505 #[derive(Debug)]
506 struct PrintBatchesTest {

Callers

nothing calls this directly

Calls 10

one_column_batchFunction · 0.85
newFunction · 0.85
one_column_schemaFunction · 0.85
emptyFunction · 0.50
schemaMethod · 0.45
runMethod · 0.45
with_headerMethod · 0.45
with_batchesMethod · 0.45
with_schemaMethod · 0.45
with_formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…