| 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: |