(array: ArrayRef, builder: WriterBuilder)
| 323 | } |
| 324 | |
| 325 | fn assert_binary_json_with_writer(array: ArrayRef, builder: WriterBuilder) { |
| 326 | let batch = RecordBatch::try_from_iter([("bytes", array)]).unwrap(); |
| 327 | |
| 328 | let mut buf = Vec::new(); |
| 329 | let json_value: Value = { |
| 330 | let mut writer = builder.build::<_, JsonArray>(&mut buf); |
| 331 | writer.write(&batch).unwrap(); |
| 332 | writer.close().unwrap(); |
| 333 | serde_json::from_slice(&buf).unwrap() |
| 334 | }; |
| 335 | |
| 336 | let json_array = json_value.as_array().unwrap(); |
| 337 | |
| 338 | let decoded = { |
| 339 | let mut decoder = ReaderBuilder::new(batch.schema().clone()) |
| 340 | .build_decoder() |
| 341 | .unwrap(); |
| 342 | decoder.serialize(json_array).unwrap(); |
| 343 | decoder.flush().unwrap().unwrap() |
| 344 | }; |
| 345 | |
| 346 | assert_eq!(batch, decoded); |
| 347 | } |
| 348 | |
| 349 | fn assert_list_view_roundtrip<O: arrow_array::OffsetSizeTrait>() { |
| 350 | let flat_field = Arc::new(Field::new("item", DataType::Int32, true)); |
no test coverage detected