MCPcopy Create free account
hub / github.com/apache/arrow / test_byte_stream_split

Function test_byte_stream_split

python/pyarrow/tests/parquet/test_basic.py:368–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

366
367
368def test_byte_stream_split():
369 # This is only a smoke test.
370 arr_float = pa.array(list(map(float, range(100))))
371 arr_int = pa.array(list(map(int, range(100))))
372 arr_bool = pa.array([True, False] * 50)
373 data_float = [arr_float, arr_float]
374 table = pa.Table.from_arrays(data_float, names=['a', 'b'])
375
376 # Check with byte_stream_split for both columns.
377 _check_roundtrip(table, expected=table, compression="gzip",
378 use_dictionary=False, use_byte_stream_split=True)
379
380 # Check with byte_stream_split for column 'b' and dictionary
381 # for column 'a'.
382 _check_roundtrip(table, expected=table, compression="gzip",
383 use_dictionary=['a'],
384 use_byte_stream_split=['b'])
385
386 # Check with a collision for both columns.
387 _check_roundtrip(table, expected=table, compression="gzip",
388 use_dictionary=['a', 'b'],
389 use_byte_stream_split=['a', 'b'])
390
391 # Check with mixed column types.
392 mixed_table = pa.Table.from_arrays([arr_float, arr_float, arr_int, arr_int],
393 names=['a', 'b', 'c', 'd'])
394 _check_roundtrip(mixed_table, expected=mixed_table,
395 use_dictionary=['b', 'd'],
396 use_byte_stream_split=['a', 'c'])
397
398 # Try to use the wrong data type with the byte_stream_split encoding.
399 # This should throw an exception.
400 table = pa.Table.from_arrays([arr_bool], names=['tmp'])
401 with pytest.raises(IOError, match='BYTE_STREAM_SPLIT only supports'):
402 _check_roundtrip(table, expected=table, use_byte_stream_split=True,
403 use_dictionary=False)
404
405
406def test_store_decimal_as_integer(tempdir):

Callers

nothing calls this directly

Calls 4

_check_roundtripFunction · 0.90
listFunction · 0.85
mapFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected