MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_create_batch

Function test_create_batch

arrow/src/util/data_gen.rs:604–629  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

602
603 #[test]
604 fn test_create_batch() {
605 let size = 32;
606 let fields = vec![
607 Field::new("a", DataType::Int32, true),
608 Field::new("f16", DataType::Float16, true),
609 Field::new(
610 "timestamp_without_timezone",
611 DataType::Timestamp(TimeUnit::Nanosecond, None),
612 true,
613 ),
614 Field::new(
615 "timestamp_with_timezone",
616 DataType::Timestamp(TimeUnit::Nanosecond, Some("UTC".into())),
617 true,
618 ),
619 ];
620 let schema = Schema::new(fields);
621 let schema_ref = Arc::new(schema);
622 let batch = create_random_batch(schema_ref.clone(), size, 0.35, 0.7).unwrap();
623
624 assert_eq!(batch.schema(), schema_ref);
625 assert_eq!(batch.num_columns(), schema_ref.fields().len());
626 for array in batch.columns() {
627 assert_eq!(array.len(), size);
628 }
629 }
630
631 #[test]
632 fn test_create_batch_non_null() {

Callers

nothing calls this directly

Calls 3

create_random_batchFunction · 0.85
cloneMethod · 0.45
columnsMethod · 0.45

Tested by

no test coverage detected