Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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