Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions c_glib/arrow-glib/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions c_glib/arrow-glib/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 *
Expand All @@ -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
2 changes: 2 additions & 0 deletions c_glib/arrow-glib/table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions cpp/src/arrow/ipc/feather.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -832,6 +837,8 @@ Status WriteTable(const Table& table, io::OutputStream* dst,
}
}

ARROW_UNSUPPRESS_DEPRECATION_WARNING

} // namespace feather
} // namespace ipc
} // namespace arrow
19 changes: 18 additions & 1 deletion cpp/src/arrow/ipc/feather.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a ARROW_DEPRECATED macro, or does it just not work here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Added ARROW_DEPRECATED on WriteProperties with commit 59f79c1 and that needed extra suppressions for GCC warnings for default argument in WriteTable and member definition WriteProperties::Defaults(). Also needed for GLib as seen failing on my fork CI job (I couldn't get jobs to run on pr manually, might be because of #50293)

struct ARROW_DEPRECATED("Deprecated in 26.0.0. Use arrow::ipc::IpcWriteOptions instead.")
ARROW_EXPORT WriteProperties {
static WriteProperties Defaults();

static WriteProperties DefaultsV1() {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions cpp/src/arrow/ipc/feather_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
10 changes: 8 additions & 2 deletions r/src/feather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down
Loading