Skip to content

Commit

Permalink
Fix test_time_millis on Windows (#275)
Browse files Browse the repository at this point in the history
* ensure converted to int64 before multiplication
use numpy array operator instead of loop

* ...and enable the test

* revert changes

* remove comment
  • Loading branch information
Kyle Lahnakoski authored and martindurant committed Jan 17, 2018
1 parent 9c9e296 commit 22ec39e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions fastparquet/converted_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import numpy as np
import binascii

import sys

from .thrift_structures import parquet_thrift
from .util import PY2
from .speedups import array_decode_utf8
Expand Down Expand Up @@ -120,6 +122,8 @@ def from_bytes(d):
return (data * DAYS_TO_MILLIS).view('datetime64[ns]')
elif ctype == parquet_thrift.ConvertedType.TIME_MILLIS:
out = np.empty(len(data), dtype='int64')
if sys.platform == 'win32':
data = data.astype('int64')
time_shift(data, out, 1000000)
return out.view('timedelta64[ns]')
elif ctype == parquet_thrift.ConvertedType.TIMESTAMP_MILLIS:
Expand Down
1 change: 0 additions & 1 deletion fastparquet/test/test_converted_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def test_date():
pd.to_datetime([datetime.date(2004, 11, 3)]))


@pytest.mark.skipif(sys.platform == 'win32' and PY2, reason='does not work on windows 32 py2.7')
def test_time_millis():
"""Test int32 encoding a timedelta in millis."""
schema = pt.SchemaElement(
Expand Down

0 comments on commit 22ec39e

Please sign in to comment.