Skip to content

Commit

Permalink
Add Parquet unit test for fixed size binary
Browse files Browse the repository at this point in the history
Change-Id: I33ed65360d04b61a846d856737c5e46ac5af65ca
  • Loading branch information
wesm committed May 10, 2017
1 parent 0216145 commit 6433c14
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions python/pyarrow/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,7 @@ def test_column_of_lists(tmpdir):


@parquet
def test_date_time_types(tmpdir):
buf = io.BytesIO()

def test_date_time_types():
t1 = pa.date32()
data1 = np.array([17259, 17260, 17261], dtype='int32')
a1 = pa.Array.from_pandas(data1, type=t1)
Expand Down Expand Up @@ -388,11 +386,7 @@ def test_date_time_types(tmpdir):
['date32', 'date64', 'timestamp[us]',
'time32[s]', 'time64[us]', 'time32[s]'])

pq.write_table(table, buf, version="2.0")
buf.seek(0)

result = pq.read_table(buf)
assert result.equals(expected)
_check_roundtrip(table, expected=expected, version='2.0')

# Unsupported stuff
def _assert_unsupported(array):
Expand All @@ -408,6 +402,29 @@ def _assert_unsupported(array):
_assert_unsupported(a7)


@parquet
def test_fixed_size_binary():
t0 = pa.binary(10)
data = [b'fooooooooo', None, b'barooooooo', b'quxooooooo']
a0 = pa.array(data, type=t0)

table = pa.Table.from_arrays([a0],
['binary[10]'])
_check_roundtrip(table)


def _check_roundtrip(table, expected=None, **params):
buf = io.BytesIO()
pq.write_table(table, buf, **params)
buf.seek(0)

if expected is None:
expected = table

result = pq.read_table(buf)
assert result.equals(expected)


@parquet
def test_multithreaded_read():
df = alltypes_sample(size=10000)
Expand Down

0 comments on commit 6433c14

Please sign in to comment.