()
| 349 | |
| 350 | |
| 351 | def test_byte_stream_split(): |
| 352 | # This is only a smoke test. |
| 353 | arr_float = pa.array(list(map(float, range(100)))) |
| 354 | arr_int = pa.array(list(map(int, range(100)))) |
| 355 | arr_bool = pa.array([True, False] * 50) |
| 356 | data_float = [arr_float, arr_float] |
| 357 | table = pa.Table.from_arrays(data_float, names=['a', 'b']) |
| 358 | |
| 359 | # Check with byte_stream_split for both columns. |
| 360 | _check_roundtrip(table, expected=table, compression="gzip", |
| 361 | use_dictionary=False, use_byte_stream_split=True) |
| 362 | |
| 363 | # Check with byte_stream_split for column 'b' and dictionary |
| 364 | # for column 'a'. |
| 365 | _check_roundtrip(table, expected=table, compression="gzip", |
| 366 | use_dictionary=['a'], |
| 367 | use_byte_stream_split=['b']) |
| 368 | |
| 369 | # Check with a collision for both columns. |
| 370 | _check_roundtrip(table, expected=table, compression="gzip", |
| 371 | use_dictionary=['a', 'b'], |
| 372 | use_byte_stream_split=['a', 'b']) |
| 373 | |
| 374 | # Check with mixed column types. |
| 375 | mixed_table = pa.Table.from_arrays([arr_float, arr_float, arr_int, arr_int], |
| 376 | names=['a', 'b', 'c', 'd']) |
| 377 | _check_roundtrip(mixed_table, expected=mixed_table, |
| 378 | use_dictionary=['b', 'd'], |
| 379 | use_byte_stream_split=['a', 'c']) |
| 380 | |
| 381 | # Try to use the wrong data type with the byte_stream_split encoding. |
| 382 | # This should throw an exception. |
| 383 | table = pa.Table.from_arrays([arr_bool], names=['tmp']) |
| 384 | with pytest.raises(IOError, match='BYTE_STREAM_SPLIT only supports'): |
| 385 | _check_roundtrip(table, expected=table, use_byte_stream_split=True, |
| 386 | use_dictionary=False) |
| 387 | |
| 388 | |
| 389 | def test_store_decimal_as_integer(tempdir): |
nothing calls this directly
no test coverage detected