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

Function test_tensor_array

arrow-pyarrow-integration-testing/tests/test_sql.py:502–519  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

500 del b
501
502def test_tensor_array():
503 tensor_type = pa.fixed_shape_tensor(pa.float32(), [2, 3])
504 inner = pa.array([float(x) for x in range(1, 7)] + [None] * 12, pa.float32())
505 storage = pa.FixedSizeListArray.from_arrays(inner, 6)
506 f32_array = pa.ExtensionArray.from_storage(tensor_type, storage)
507
508 # Round-tripping as an array gives back storage type, because arrow-rs has
509 # no notion of extension types.
510 b = rust.round_trip_array(f32_array)
511 assert b == f32_array.storage
512
513 batch = pa.record_batch([f32_array], ["tensor"], metadata={b'key1': b'value1'})
514 b = rust.round_trip_record_batch(batch)
515 assert b == batch
516 assert b.schema == batch.schema
517 assert b.schema.metadata == batch.schema.metadata
518
519 del b
520
521
522def test_empty_recordbatch_with_row_count():

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.80
record_batchMethod · 0.45

Tested by

no test coverage detected