Skip to content

Commit

Permalink
apacheGH-44063: [Python] Deprecate the no longer used serialize/deser…
Browse files Browse the repository at this point in the history
…ialize Pyarrow C++ functions
  • Loading branch information
jorisvandenbossche committed Sep 11, 2024
1 parent 21f5968 commit efc6d67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/pyarrow/src/arrow/python/deserialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "arrow/python/serialize.h"
#include "arrow/python/visibility.h"
#include "arrow/status.h"
#include "arrow/util/macros.h"

namespace arrow {

Expand Down Expand Up @@ -55,6 +56,7 @@ struct ARROW_PYTHON_EXPORT SparseTensorCounts {
/// \param[in] src a RandomAccessFile
/// \param[out] out the reconstructed data
/// \return Status
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status ReadSerializedObject(io::RandomAccessFile* src, SerializedPyObject* out);

Expand All @@ -70,6 +72,7 @@ Status ReadSerializedObject(io::RandomAccessFile* src, SerializedPyObject* out);
/// num_csf_tensors * (2 * ndim_csf + 3) + num_buffers in length
/// \param[out] out the reconstructed object
/// \return Status
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status GetSerializedFromComponents(int num_tensors,
const SparseTensorCounts& num_sparse_tensors,
Expand All @@ -88,6 +91,7 @@ Status GetSerializedFromComponents(int num_tensors,
/// \param[out] out The returned object
/// \return Status
/// This acquires the GIL
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status DeserializeObject(PyObject* context, const SerializedPyObject& object,
PyObject* base, PyObject** out);
Expand All @@ -96,9 +100,11 @@ Status DeserializeObject(PyObject* context, const SerializedPyObject& object,
/// \param[in] object Object to deserialize
/// \param[out] out The deserialized tensor
/// \return Status
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status DeserializeNdarray(const SerializedPyObject& object, std::shared_ptr<Tensor>* out);

ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status NdarrayFromBuffer(std::shared_ptr<Buffer> src, std::shared_ptr<Tensor>* out);

Expand Down
4 changes: 4 additions & 0 deletions python/pyarrow/src/arrow/python/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "arrow/python/visibility.h"
#include "arrow/sparse_tensor.h"
#include "arrow/status.h"
#include "arrow/util/macros.h"

// Forward declaring PyObject, see
// https://mail.python.org/pipermail/python-dev/2003-August/037601.html
Expand Down Expand Up @@ -92,13 +93,15 @@ struct ARROW_PYTHON_EXPORT SerializedPyObject {
/// \return Status
///
/// Release GIL before calling
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status SerializeObject(PyObject* context, PyObject* sequence, SerializedPyObject* out);

/// \brief Serialize an Arrow Tensor as a SerializedPyObject.
/// \param[in] tensor Tensor to be serialized
/// \param[out] out The serialized representation
/// \return Status
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
ARROW_PYTHON_EXPORT
Status SerializeTensor(std::shared_ptr<Tensor> tensor, py::SerializedPyObject* out);

Expand All @@ -109,6 +112,7 @@ Status SerializeTensor(std::shared_ptr<Tensor> tensor, py::SerializedPyObject* o
/// \param[in] dst The OutputStream to write the Tensor header to
/// \return Status
ARROW_PYTHON_EXPORT
ARROW_DEPRECATED("Deprecated in 18.0.0. Will be removed in 20.0.0")
Status WriteNdarrayHeader(std::shared_ptr<DataType> dtype,
const std::vector<int64_t>& shape, int64_t tensor_num_bytes,
io::OutputStream* dst);
Expand Down

0 comments on commit efc6d67

Please sign in to comment.