Skip to content

Commit adcc8f7

Browse files
committed
shuffle stuff around
1 parent bcebdfe commit adcc8f7

2 files changed

Lines changed: 32 additions & 33 deletions

File tree

python/pyarrow/includes/libarrow.pxd

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,36 @@ cdef extern from "arrow/python/api.h" namespace "arrow::py" nogil:
775775
c_bool strings_to_categorical
776776

777777

778+
cdef extern from "arrow/python/api.h" namespace 'arrow::py':
779+
780+
CStatus SerializePythonSequence(
781+
PyObject* sequence,
782+
shared_ptr[CRecordBatch]* batch_out,
783+
vector[shared_ptr[CTensor]]* tensors_out)
784+
785+
CStatus DeserializePythonSequence(
786+
shared_ptr[CRecordBatch] batch,
787+
vector[shared_ptr[CTensor]] tensors,
788+
PyObject* base,
789+
PyObject** out)
790+
791+
792+
cdef extern from "arrow/python/api.h" namespace 'arrow::py' nogil:
793+
794+
cdef CStatus WriteSerializedPythonSequence(
795+
shared_ptr[CRecordBatch] batch,
796+
vector[shared_ptr[CTensor]] tensors,
797+
OutputStream* dst)
798+
799+
cdef CStatus ReadSerializedPythonSequence(
800+
shared_ptr[RandomAccessFile] src,
801+
shared_ptr[CRecordBatch]* batch_out,
802+
vector[shared_ptr[CTensor]]* tensors_out)
803+
804+
void set_serialization_callbacks(PyObject* serialize_callback,
805+
PyObject* deserialize_callback);
806+
807+
778808
cdef extern from 'arrow/python/init.h':
779809
int arrow_init_numpy() except -1
780810

python/pyarrow/serialization.pxi

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,10 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from libcpp cimport bool as c_bool, nullptr
19-
from libcpp.vector cimport vector as c_vector
2018
from cpython.ref cimport PyObject
21-
from cython.operator cimport dereference as deref
2219

2320
from pyarrow.compat import pickle
2421

25-
cdef extern from "arrow/python/api.h" namespace 'arrow::py':
26-
27-
CStatus SerializePythonSequence(
28-
PyObject* sequence,
29-
shared_ptr[CRecordBatch]* batch_out,
30-
c_vector[shared_ptr[CTensor]]* tensors_out)
31-
32-
CStatus DeserializePythonSequence(
33-
shared_ptr[CRecordBatch] batch,
34-
c_vector[shared_ptr[CTensor]] tensors,
35-
PyObject* base,
36-
PyObject** out)
37-
38-
cdef extern from "arrow/python/api.h" namespace 'arrow::py' nogil:
39-
40-
cdef CStatus WriteSerializedPythonSequence(
41-
shared_ptr[CRecordBatch] batch,
42-
c_vector[shared_ptr[CTensor]] tensors,
43-
OutputStream* dst)
44-
45-
cdef CStatus ReadSerializedPythonSequence(
46-
shared_ptr[RandomAccessFile] src,
47-
shared_ptr[CRecordBatch]* batch_out,
48-
c_vector[shared_ptr[CTensor]]* tensors_out)
49-
50-
void set_serialization_callbacks(PyObject* serialize_callback,
51-
PyObject* deserialize_callback);
52-
5322
def is_named_tuple(cls):
5423
"""Return True if cls is a namedtuple and False otherwise."""
5524
b = cls.__bases__
@@ -170,7 +139,7 @@ def serialize_sequence(object value, NativeFile sink):
170139
sink.write_handle(&stream)
171140

172141
cdef shared_ptr[CRecordBatch] batch
173-
cdef c_vector[shared_ptr[CTensor]] tensors
142+
cdef vector[shared_ptr[CTensor]] tensors
174143

175144
check_status(SerializePythonSequence(<PyObject*> value, &batch, &tensors))
176145

@@ -197,7 +166,7 @@ def deserialize_sequence(NativeFile source, object base):
197166
source.read_handle(&stream)
198167

199168
cdef shared_ptr[CRecordBatch] batch
200-
cdef c_vector[shared_ptr[CTensor]] tensors
169+
cdef vector[shared_ptr[CTensor]] tensors
201170

202171
with nogil:
203172
check_status(ReadSerializedPythonSequence(stream, &batch, &tensors))

0 commit comments

Comments
 (0)