File tree 2 files changed +9
-1
lines changed
arrow-pyarrow-integration-testing/tests 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -421,6 +421,14 @@ def iter_batches():
421
421
with pytest .raises (ValueError , match = "test error" ):
422
422
rust .reader_return_errors (reader )
423
423
424
+ # Due to a long-standing oversight, PyArrow allows binary values in schema
425
+ # metadata that are not valid UTF-8. This is not allowed in Rust, but we
426
+ # make sure we error and not panic here.
427
+ schema = schema .with_metadata ({"key" : b"\xff " })
428
+ reader = pa .RecordBatchReader .from_batches (schema , iter_batches ())
429
+ with pytest .raises (ValueError , match = "invalid utf-8" ):
430
+ rust .round_trip_record_batch_reader (reader )
431
+
424
432
def test_reject_other_classes ():
425
433
# Arbitrary type that is not a PyArrow type
426
434
not_pyarrow = ["hello" ]
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ fn get_stream_schema(stream_ptr: *mut FFI_ArrowArrayStream) -> Result<SchemaRef>
281
281
let ret_code = unsafe { ( * stream_ptr) . get_schema . unwrap ( ) ( stream_ptr, & mut schema) } ;
282
282
283
283
if ret_code == 0 {
284
- let schema = Schema :: try_from ( & schema) . unwrap ( ) ;
284
+ let schema = Schema :: try_from ( & schema) ? ;
285
285
Ok ( Arc :: new ( schema) )
286
286
} else {
287
287
Err ( ArrowError :: CDataInterface ( format ! (
You can’t perform that action at this time.
0 commit comments