arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-901: [Python] Add Parquet unit test for fixed size binary
Date Thu, 11 May 2017 20:00:41 GMT
Repository: arrow
Updated Branches:
  refs/heads/master c10b7d798 -> 84413b0ec


ARROW-901: [Python] Add Parquet unit test for fixed size binary

This verifies that all is working properly after PARQUET-965.

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #665 from wesm/ARROW-901 and squashes the following commits:

6433c14 [Wes McKinney] Add Parquet unit test for fixed size binary


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/84413b0e
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/84413b0e
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/84413b0e

Branch: refs/heads/master
Commit: 84413b0eceeeacc985e7fc6bb95e0bfe76506480
Parents: c10b7d7
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Thu May 11 16:00:36 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Thu May 11 16:00:36 2017 -0400

----------------------------------------------------------------------
 python/pyarrow/tests/test_parquet.py | 33 +++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/84413b0e/python/pyarrow/tests/test_parquet.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_parquet.py b/python/pyarrow/tests/test_parquet.py
index bb3a9ed..7144de2 100644
--- a/python/pyarrow/tests/test_parquet.py
+++ b/python/pyarrow/tests/test_parquet.py
@@ -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)
@@ -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):
@@ -409,6 +403,29 @@ def test_date_time_types(tmpdir):
 
 
 @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)
 


Mime
View raw message