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

Function build_array_binary_view

arrow-json/src/writer/mod.rs:1800–1815  ·  view source on GitHub ↗
(values: &[Option<&[u8]>])

Source from the content-addressed store, hash-verified

1798 }
1799
1800 fn build_array_binary_view(values: &[Option<&[u8]>]) -> RecordBatch {
1801 let schema = SchemaRef::new(Schema::new(vec![Field::new(
1802 "bytes",
1803 DataType::BinaryView,
1804 true,
1805 )]));
1806 let mut builder = BinaryViewBuilder::new();
1807 for value in values {
1808 match value {
1809 Some(v) => builder.append_value(v),
1810 None => builder.append_null(),
1811 }
1812 }
1813 let array = Arc::new(builder.finish()) as ArrayRef;
1814 RecordBatch::try_new(schema, vec![array]).unwrap()
1815 }
1816
1817 fn assert_binary_json(batch: &RecordBatch) {
1818 // encode and check JSON with explicit nulls:

Callers 1

test_writer_binaryFunction · 0.85

Calls 4

try_newFunction · 0.85
append_valueMethod · 0.45
append_nullMethod · 0.45
finishMethod · 0.45

Tested by 1

test_writer_binaryFunction · 0.68