This is an automated email from the ASF dual-hosted git repository.

pitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new fcf9e9793d GH-49231: [C++] Deprecate Feather reader and writer (#50321)
fcf9e9793d is described below

commit fcf9e9793d2d6d8f443440be2022c52163dadc4f
Author: tadeja <[email protected]>
AuthorDate: Mon Jul 6 10:54:07 2026 +0200

    GH-49231: [C++] Deprecate Feather reader and writer (#50321)
    
    ### Rationale for this change
    See #49231. Deprecate the Feather reader/writer and point users to the 
Arrow IPC file API.
    
    ### What changes are included in this PR?
    `ipc::feather::Reader::Open`, `ipc::feather::WriteTable` and the 
`WriteProperties` struct marked with `ARROW_DEPRECATED`, pointing users to 
`ipc::RecordBatchFileReader` and `ipc::MakeFileWriter`.
    Deprecation warnings supressed at the internal call sites: `feather.cc`, 
`feather_test.cc`, the R binding `r/src/feather.cpp` (R deprecation is in 
#49276), and the GLib binding (GLib deprecation is in #49673).
    
    ### Are these changes tested?
    `-Werror` build of arrow-feather-test passes locally.
    
    ### Are there any user-facing changes?
    No functional change, compile-time deprecation warning for 
`feather::Reader::Open`, `feather::WriteTable` or feather::WriteProperties.
    
    * GitHub Issue: #49231
    
    Authored-by: Tadeja Kadunc <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 c_glib/arrow-glib/reader.cpp      |  2 ++
 c_glib/arrow-glib/table.cpp       |  7 +++++++
 c_glib/arrow-glib/table.hpp       |  2 ++
 cpp/src/arrow/ipc/feather.cc      |  7 +++++++
 cpp/src/arrow/ipc/feather.h       | 19 ++++++++++++++++++-
 cpp/src/arrow/ipc/feather_test.cc |  6 ++++++
 r/src/feather.cpp                 | 10 ++++++++--
 7 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/c_glib/arrow-glib/reader.cpp b/c_glib/arrow-glib/reader.cpp
index f6e0d3064d..8e84eb58b1 100644
--- a/c_glib/arrow-glib/reader.cpp
+++ b/c_glib/arrow-glib/reader.cpp
@@ -781,7 +781,9 @@ GArrowFeatherFileReader *
 garrow_feather_file_reader_new(GArrowSeekableInputStream *file, GError **error)
 {
   auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(file);
+  ARROW_SUPPRESS_DEPRECATION_WARNING
   auto reader = arrow::ipc::feather::Reader::Open(arrow_random_access_file);
+  ARROW_UNSUPPRESS_DEPRECATION_WARNING
   if (garrow::check(error, reader, "[feather-file-reader][new]")) {
     return garrow_feather_file_reader_new_raw(&(*reader));
   } else {
diff --git a/c_glib/arrow-glib/table.cpp b/c_glib/arrow-glib/table.cpp
index 4595ae7593..da7134cc0b 100644
--- a/c_glib/arrow-glib/table.cpp
+++ b/c_glib/arrow-glib/table.cpp
@@ -772,6 +772,9 @@ garrow_table_validate_full(GArrowTable *table, GError 
**error)
   return garrow::check(error, arrow_table->ValidateFull(), 
"[table][validate-full]");
 }
 
+// The Feather C++ API is deprecated; this GLib binding still wraps it.
+ARROW_SUPPRESS_DEPRECATION_WARNING
+
 typedef struct GArrowFeatherWritePropertiesPrivate_
 {
   arrow::ipc::feather::WriteProperties properties;
@@ -932,6 +935,8 @@ garrow_table_write_as_feather(GArrowTable *table,
   return garrow::check(error, status, "[feather-write-file]");
 }
 
+ARROW_UNSUPPRESS_DEPRECATION_WARNING
+
 G_END_DECLS
 
 GArrowTable *
@@ -948,9 +953,11 @@ garrow_table_get_raw(GArrowTable *table)
   return priv->table;
 }
 
+ARROW_SUPPRESS_DEPRECATION_WARNING
 arrow::ipc::feather::WriteProperties *
 garrow_feather_write_properties_get_raw(GArrowFeatherWriteProperties 
*properties)
 {
   auto priv = GARROW_FEATHER_WRITE_PROPERTIES_GET_PRIVATE(properties);
   return &(priv->properties);
 }
+ARROW_UNSUPPRESS_DEPRECATION_WARNING
diff --git a/c_glib/arrow-glib/table.hpp b/c_glib/arrow-glib/table.hpp
index 79fc97471a..472b24866b 100644
--- a/c_glib/arrow-glib/table.hpp
+++ b/c_glib/arrow-glib/table.hpp
@@ -32,6 +32,8 @@ GARROW_EXTERN
 std::shared_ptr<arrow::Table>
 garrow_table_get_raw(GArrowTable *table);
 
+ARROW_SUPPRESS_DEPRECATION_WARNING
 GARROW_EXTERN
 arrow::ipc::feather::WriteProperties *
 garrow_feather_write_properties_get_raw(GArrowFeatherWriteProperties 
*properties);
+ARROW_UNSUPPRESS_DEPRECATION_WARNING
diff --git a/cpp/src/arrow/ipc/feather.cc b/cpp/src/arrow/ipc/feather.cc
index 54f16103ae..51d11927a9 100644
--- a/cpp/src/arrow/ipc/feather.cc
+++ b/cpp/src/arrow/ipc/feather.cc
@@ -770,7 +770,9 @@ class ReaderV2 : public Reader {
 
 Result<std::shared_ptr<Reader>> Reader::Open(
     const std::shared_ptr<io::RandomAccessFile>& source) {
+  ARROW_SUPPRESS_DEPRECATION_WARNING
   return Reader::Open(source, IpcReadOptions::Defaults());
+  ARROW_UNSUPPRESS_DEPRECATION_WARNING
 }
 
 Result<std::shared_ptr<Reader>> Reader::Open(
@@ -803,6 +805,9 @@ Result<std::shared_ptr<Reader>> Reader::Open(
   }
 }
 
+// GCC warns about the deprecated type in these definitions, Clang doesn't
+ARROW_SUPPRESS_DEPRECATION_WARNING
+
 WriteProperties WriteProperties::Defaults() {
   WriteProperties result;
 #ifdef ARROW_WITH_LZ4
@@ -832,6 +837,8 @@ Status WriteTable(const Table& table, io::OutputStream* dst,
   }
 }
 
+ARROW_UNSUPPRESS_DEPRECATION_WARNING
+
 }  // namespace feather
 }  // namespace ipc
 }  // namespace arrow
diff --git a/cpp/src/arrow/ipc/feather.h b/cpp/src/arrow/ipc/feather.h
index da88ee22f8..c6cf9ff6e2 100644
--- a/cpp/src/arrow/ipc/feather.h
+++ b/cpp/src/arrow/ipc/feather.h
@@ -28,6 +28,7 @@
 #include "arrow/ipc/options.h"
 #include "arrow/type_fwd.h"
 #include "arrow/util/compression.h"
+#include "arrow/util/macros.h"
 #include "arrow/util/visibility.h"
 
 namespace arrow {
@@ -54,6 +55,9 @@ static constexpr const int kFeatherV2Version = 3;
 
 /// \class Reader
 /// \brief An interface for reading columns from Feather files
+///
+/// \note Deprecated in 26.0.0. Feather V2 is the Arrow IPC file format;
+///   use arrow::ipc::RecordBatchFileReader instead.
 class ARROW_EXPORT Reader {
  public:
   virtual ~Reader() = default;
@@ -62,6 +66,8 @@ class ARROW_EXPORT Reader {
   ///
   /// \param[in] source a RandomAccessFile instance
   /// \return the table reader
+  /// \deprecated Deprecated in 26.0.0. Use arrow::ipc::RecordBatchFileReader 
instead.
+  ARROW_DEPRECATED("Deprecated in 26.0.0. Use 
arrow::ipc::RecordBatchFileReader instead.")
   static Result<std::shared_ptr<Reader>> Open(
       const std::shared_ptr<io::RandomAccessFile>& source);
 
@@ -71,6 +77,8 @@ class ARROW_EXPORT Reader {
   /// \param[in] source a RandomAccessFile instance
   /// \param[in] options IPC Read options
   /// \return the table reader
+  /// \deprecated Deprecated in 26.0.0. Use arrow::ipc::RecordBatchFileReader 
instead.
+  ARROW_DEPRECATED("Deprecated in 26.0.0. Use 
arrow::ipc::RecordBatchFileReader instead.")
   static Result<std::shared_ptr<Reader>> Open(
       const std::shared_ptr<io::RandomAccessFile>& source, const 
IpcReadOptions& options);
 
@@ -107,7 +115,10 @@ class ARROW_EXPORT Reader {
                       std::shared_ptr<Table>* out) = 0;
 };
 
-struct ARROW_EXPORT WriteProperties {
+/// \deprecated Deprecated in 26.0.0. Feather V2 is the Arrow IPC file format;
+///   use arrow::ipc::MakeFileWriter with arrow::ipc::IpcWriteOptions instead.
+struct ARROW_DEPRECATED("Deprecated in 26.0.0. Use arrow::ipc::IpcWriteOptions 
instead.")
+    ARROW_EXPORT WriteProperties {
   static WriteProperties Defaults();
 
   static WriteProperties DefaultsV1() {
@@ -141,9 +152,15 @@ struct ARROW_EXPORT WriteProperties {
   int compression_level = ::arrow::util::kUseDefaultCompressionLevel;
 };
 
+// Only suppresses the deprecated WriteProperties in the default argument
+ARROW_SUPPRESS_DEPRECATION_WARNING
+/// \deprecated Deprecated in 26.0.0. Feather V2 is the Arrow IPC file format;
+///   use arrow::ipc::MakeFileWriter instead.
+ARROW_DEPRECATED("Deprecated in 26.0.0. Use arrow::ipc::MakeFileWriter 
instead.")
 ARROW_EXPORT
 Status WriteTable(const Table& table, io::OutputStream* dst,
                   const WriteProperties& properties = 
WriteProperties::Defaults());
+ARROW_UNSUPPRESS_DEPRECATION_WARNING
 
 }  // namespace feather
 }  // namespace ipc
diff --git a/cpp/src/arrow/ipc/feather_test.cc 
b/cpp/src/arrow/ipc/feather_test.cc
index e1dc6046a1..a9d701422f 100644
--- a/cpp/src/arrow/ipc/feather_test.cc
+++ b/cpp/src/arrow/ipc/feather_test.cc
@@ -44,6 +44,10 @@ using internal::checked_cast;
 namespace ipc {
 namespace feather {
 
+// These tests intentionally exercise the deprecated Feather API, suppressing
+// the deprecation warnings for the whole file.
+ARROW_SUPPRESS_DEPRECATION_WARNING
+
 struct TestParam {
   TestParam(int arg_version,
             Compression::type arg_compression = Compression::UNCOMPRESSED)
@@ -383,6 +387,8 @@ TEST_P(TestFeatherRoundTrip, RoundTrip) {
 INSTANTIATE_TEST_SUITE_P(FeatherRoundTripTests, TestFeatherRoundTrip,
                          ::testing::ValuesIn(kBatchCases));
 
+ARROW_UNSUPPRESS_DEPRECATION_WARNING
+
 }  // namespace feather
 }  // namespace ipc
 }  // namespace arrow
diff --git a/r/src/feather.cpp b/r/src/feather.cpp
index cf68faef1b..a46850db94 100644
--- a/r/src/feather.cpp
+++ b/r/src/feather.cpp
@@ -29,6 +29,7 @@ void ipc___WriteFeather__Table(const 
std::shared_ptr<arrow::io::OutputStream>& s
                                const std::shared_ptr<arrow::Table>& table, int 
version,
                                int chunk_size, arrow::Compression::type 
compression,
                                int compression_level) {
+  ARROW_SUPPRESS_DEPRECATION_WARNING
   auto properties = arrow::ipc::feather::WriteProperties::Defaults();
   properties.version = version;
   properties.chunksize = chunk_size;
@@ -37,6 +38,7 @@ void ipc___WriteFeather__Table(const 
std::shared_ptr<arrow::io::OutputStream>& s
     properties.compression_level = compression_level;
   }
   StopIfNotOk(arrow::ipc::feather::WriteTable(*table, stream.get(), 
properties));
+  ARROW_UNSUPPRESS_DEPRECATION_WARNING
 }
 
 // ----------- Reader
@@ -82,8 +84,12 @@ std::shared_ptr<arrow::Table> ipc___feather___Reader__Read(
 // [[arrow::export]]
 std::shared_ptr<arrow::ipc::feather::Reader> ipc___feather___Reader__Open(
     const std::shared_ptr<arrow::io::RandomAccessFile>& stream) {
-  auto result = 
RunWithCapturedRIfPossible<std::shared_ptr<arrow::ipc::feather::Reader>>(
-      [&]() { return arrow::ipc::feather::Reader::Open(stream); });
+  auto result =
+      
RunWithCapturedRIfPossible<std::shared_ptr<arrow::ipc::feather::Reader>>([&]() {
+        ARROW_SUPPRESS_DEPRECATION_WARNING
+        return arrow::ipc::feather::Reader::Open(stream);
+        ARROW_UNSUPPRESS_DEPRECATION_WARNING
+      });
   return ValueOrStop(result);
 }
 

Reply via email to