From 2dffc1412b86bd473502628d9f6f98964efca72e Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sat, 4 Jun 2016 09:06:45 +0200 Subject: [PATCH] Fix min mistake, use equals instead of == --- python/pyarrow/array.pyx | 9 ++------- python/pyarrow/parquet.pyx | 2 +- python/pyarrow/tests/test_parquet.py | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/python/pyarrow/array.pyx b/python/pyarrow/array.pyx index 6d63c3219312e..619e5ef7e3943 100644 --- a/python/pyarrow/array.pyx +++ b/python/pyarrow/array.pyx @@ -68,13 +68,8 @@ cdef class Array: values = array_format(self, window=10) return '{0}\n{1}'.format(type_format, values) - def __richcmp__(Array self, Array other, int op): - if op == cpython.Py_EQ: - return self.ap.Equals(other.sp_array) - elif op == cpython.Py_NE: - return not self.ap.Equals(other.sp_array) - else: - raise TypeError('Invalid comparison') + def equals(Array self, Array other): + return self.ap.Equals(other.sp_array) def __len__(self): if self.sp_array.get(): diff --git a/python/pyarrow/parquet.pyx b/python/pyarrow/parquet.pyx index 78837a45988f8..1dcfd60bee67e 100644 --- a/python/pyarrow/parquet.pyx +++ b/python/pyarrow/parquet.pyx @@ -61,7 +61,7 @@ def write_table(table, filename, chunk_size=None): cdef shared_ptr[OutputStream] sink = shared_ptr[OutputStream](new LocalFileOutputStream(filename)) cdef int64_t chunk_size_ = 0 if chunk_size is None: - chunk_size_ = max(ctable_.num_rows(), int(2**16)) + chunk_size_ = min(ctable_.num_rows(), int(2**16)) else: chunk_size_ = chunk_size diff --git a/python/pyarrow/tests/test_parquet.py b/python/pyarrow/tests/test_parquet.py index ae9a75c0262fa..236f06ca69b7b 100644 --- a/python/pyarrow/tests/test_parquet.py +++ b/python/pyarrow/tests/test_parquet.py @@ -39,5 +39,5 @@ def test_single_pylist_column(tmpdir): assert col_read.data.num_chunks == 1 data_written = col_written.data.chunk(0) data_read = col_read.data.chunk(0) - assert data_written == data_read + assert data_written.equals(data_read)