Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
arrow_to_python.h
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 #ifndef ARROW_PYTHON_ARROW_TO_PYTHON_H
19 #define ARROW_PYTHON_ARROW_TO_PYTHON_H
20 
21 #include <cstdint>
22 #include <memory>
23 #include <vector>
24 
26 #include "arrow/status.h"
27 #include "arrow/util/visibility.h"
28 
29 namespace arrow {
30 
31 class RecordBatch;
32 class Tensor;
33 
34 namespace io {
35 
36 class RandomAccessFile;
37 
38 } // namespace io
39 
40 namespace py {
41 
46 ARROW_EXPORT
47 Status ReadSerializedObject(io::RandomAccessFile* src, SerializedPyObject* out);
48 
58 ARROW_EXPORT
59 Status GetSerializedFromComponents(int num_tensors, int num_buffers, PyObject* data,
60  SerializedPyObject* out);
61 
74 ARROW_EXPORT
75 Status DeserializeObject(PyObject* context, const SerializedPyObject& object,
76  PyObject* base, PyObject** out);
77 
82 ARROW_EXPORT
83 Status DeserializeTensor(const SerializedPyObject& object, std::shared_ptr<Tensor>* out);
84 
85 ARROW_EXPORT
86 Status ReadTensor(std::shared_ptr<Buffer> src, std::shared_ptr<Tensor>* out);
87 
88 } // namespace py
89 } // namespace arrow
90 
91 #endif // ARROW_PYTHON_ARROW_TO_PYTHON_H
Status ReadSerializedObject(io::RandomAccessFile *src, SerializedPyObject *out)
Read serialized Python sequence from file interface using Arrow IPC.
Status ReadTensor(std::shared_ptr< Buffer > src, std::shared_ptr< Tensor > *out)
_object PyObject
Definition: python_to_arrow.h:30
Top-level namespace for Apache Arrow C++ API.
Definition: adapter.h:32
Status DeserializeObject(PyObject *context, const SerializedPyObject &object, PyObject *base, PyObject **out)
Reconstruct Python object from Arrow-serialized representation.
Status DeserializeTensor(const SerializedPyObject &object, std::shared_ptr< Tensor > *out)
Reconstruct Tensor from Arrow-serialized representation.
Status GetSerializedFromComponents(int num_tensors, int num_buffers, PyObject *data, SerializedPyObject *out)
Reconstruct SerializedPyObject from representation produced by SerializedPyObject::GetComponents.