File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def pyarrow_array_to_numpy_and_mask(arr, dtype):
34
34
a boolean mask (validity mask, so False means missing)
35
35
"""
36
36
buflist = arr .buffers ()
37
- data = np .frombuffer (buflist [- 1 ], dtype = dtype )[arr .offset : arr .offset + len (arr )]
37
+ data = np .frombuffer (buflist [1 ], dtype = dtype )[arr .offset : arr .offset + len (arr )]
38
38
bitmask = buflist [0 ]
39
39
if bitmask is not None :
40
40
mask = pyarrow .BooleanArray .from_buffers (
Original file line number Diff line number Diff line change 28
28
from pandas .core import nanops , ops
29
29
from pandas .core .algorithms import take
30
30
from pandas .core .arrays import ExtensionArray , ExtensionOpsMixin
31
+ from pandas .core .arrays ._arrow_utils import pyarrow_array_to_numpy_and_mask
31
32
import pandas .core .common as com
32
33
from pandas .core .indexers import check_bool_array_indexer
33
34
from pandas .core .ops import invalid_comparison
@@ -103,18 +104,7 @@ def __from_arrow__(self, array):
103
104
104
105
results = []
105
106
for arr in chunks :
106
- buflist = arr .buffers ()
107
- data = np .frombuffer (buflist [1 ], dtype = self .type )[
108
- arr .offset : arr .offset + len (arr )
109
- ]
110
- bitmask = buflist [0 ]
111
- if bitmask is not None :
112
- mask = pyarrow .BooleanArray .from_buffers (
113
- pyarrow .bool_ (), len (arr ), [None , bitmask ]
114
- )
115
- mask = np .asarray (mask )
116
- else :
117
- mask = np .ones (len (arr ), dtype = bool )
107
+ data , mask = pyarrow_array_to_numpy_and_mask (arr , dtype = self .type )
118
108
int_arr = IntegerArray (data .copy (), ~ mask , copy = False )
119
109
results .append (int_arr )
120
110
You can’t perform that action at this time.
0 commit comments