From 64ebe00813ed841686f2983b7a2e03d5f1b2e8e1 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 4 Aug 2021 16:16:45 +0200 Subject: [PATCH] ARROW-13552: [C++] Remove deprecated APIs Remove APIs that have been deprecated for long enough. --- cpp/src/arrow/array/array_nested.cc | 2 - cpp/src/arrow/array/array_nested.h | 6 --- cpp/src/arrow/array/concatenate.cc | 5 --- cpp/src/arrow/array/concatenate.h | 5 --- cpp/src/arrow/compute/api_vector.cc | 39 ---------------- cpp/src/arrow/compute/api_vector.h | 36 --------------- cpp/src/arrow/csv/reader.h | 6 ++- cpp/src/arrow/ipc/writer.h | 4 +- cpp/src/arrow/json/reader.cc | 9 ---- cpp/src/arrow/json/reader.h | 8 ---- cpp/src/arrow/python/pyarrow.cc | 3 -- cpp/src/arrow/python/pyarrow.h | 13 +++--- cpp/src/arrow/sparse_tensor.h | 7 --- cpp/src/arrow/tensor.h | 4 -- cpp/src/arrow/type.h | 15 ++----- cpp/src/arrow/type_fwd.h | 69 ++--------------------------- cpp/src/arrow/util/compiler_util.h | 22 --------- cpp/src/parquet/schema.h | 3 -- 18 files changed, 18 insertions(+), 238 deletions(-) delete mode 100644 cpp/src/arrow/util/compiler_util.h diff --git a/cpp/src/arrow/array/array_nested.cc b/cpp/src/arrow/array/array_nested.cc index f967127c5f1..102a82512e1 100644 --- a/cpp/src/arrow/array/array_nested.cc +++ b/cpp/src/arrow/array/array_nested.cc @@ -730,8 +730,6 @@ Result> SparseUnionArray::Make( return std::make_shared(std::move(internal_data)); } -std::shared_ptr UnionArray::child(int i) const { return field(i); } - std::shared_ptr UnionArray::field(int i) const { if (i < 0 || static_cast(i) >= boxed_fields_.size()) { diff --git a/cpp/src/arrow/array/array_nested.h b/cpp/src/arrow/array/array_nested.h index b0edb9591c5..bd5abaa3a8f 100644 --- a/cpp/src/arrow/array/array_nested.h +++ b/cpp/src/arrow/array/array_nested.h @@ -390,12 +390,6 @@ class ARROW_EXPORT UnionArray : public Array { UnionMode::type mode() const { return union_type_->mode(); } - // Return the given field as an individual array. - // For sparse unions, the returned array has its offset, length and null - // count adjusted. - ARROW_DEPRECATED("Deprecated in 1.0.0. Use field(pos)") - std::shared_ptr child(int pos) const; - /// \brief Return the given field as an individual array. /// /// For sparse unions, the returned array has its offset, length and null diff --git a/cpp/src/arrow/array/concatenate.cc b/cpp/src/arrow/array/concatenate.cc index 32478783394..e2a5898c209 100644 --- a/cpp/src/arrow/array/concatenate.cc +++ b/cpp/src/arrow/array/concatenate.cc @@ -482,9 +482,4 @@ Result> Concatenate(const ArrayVector& arrays, MemoryPool return MakeArray(std::move(out_data)); } -Status Concatenate(const ArrayVector& arrays, MemoryPool* pool, - std::shared_ptr* out) { - return Concatenate(arrays, pool).Value(out); -} - } // namespace arrow diff --git a/cpp/src/arrow/array/concatenate.h b/cpp/src/arrow/array/concatenate.h index a6c1c3cf3c1..e7597aad812 100644 --- a/cpp/src/arrow/array/concatenate.h +++ b/cpp/src/arrow/array/concatenate.h @@ -34,9 +34,4 @@ ARROW_EXPORT Result> Concatenate(const ArrayVector& arrays, MemoryPool* pool = default_memory_pool()); -ARROW_DEPRECATED("Use Result-returning version") -ARROW_EXPORT -Status Concatenate(const ArrayVector& arrays, MemoryPool* pool, - std::shared_ptr* out); - } // namespace arrow diff --git a/cpp/src/arrow/compute/api_vector.cc b/cpp/src/arrow/compute/api_vector.cc index a68969b2ee5..9f3b3fa71b3 100644 --- a/cpp/src/arrow/compute/api_vector.cc +++ b/cpp/src/arrow/compute/api_vector.cc @@ -236,45 +236,6 @@ Result> Take(const Array& values, const Array& indices, // ---------------------------------------------------------------------- // Deprecated functions -Result> Take(const ChunkedArray& values, - const Array& indices, - const TakeOptions& options, ExecContext* ctx) { - ARROW_ASSIGN_OR_RAISE(Datum result, Take(Datum(values), Datum(indices), options, ctx)); - return result.chunked_array(); -} - -Result> Take(const ChunkedArray& values, - const ChunkedArray& indices, - const TakeOptions& options, ExecContext* ctx) { - ARROW_ASSIGN_OR_RAISE(Datum result, Take(Datum(values), Datum(indices), options, ctx)); - return result.chunked_array(); -} - -Result> Take(const Array& values, - const ChunkedArray& indices, - const TakeOptions& options, ExecContext* ctx) { - ARROW_ASSIGN_OR_RAISE(Datum result, Take(Datum(values), Datum(indices), options, ctx)); - return result.chunked_array(); -} - -Result> Take(const RecordBatch& batch, const Array& indices, - const TakeOptions& options, ExecContext* ctx) { - ARROW_ASSIGN_OR_RAISE(Datum result, Take(Datum(batch), Datum(indices), options, ctx)); - return result.record_batch(); -} - -Result> Take(const Table& table, const Array& indices, - const TakeOptions& options, ExecContext* ctx) { - ARROW_ASSIGN_OR_RAISE(Datum result, Take(Datum(table), Datum(indices), options, ctx)); - return result.table(); -} - -Result> Take(const Table& table, const ChunkedArray& indices, - const TakeOptions& options, ExecContext* ctx) { - ARROW_ASSIGN_OR_RAISE(Datum result, Take(Datum(table), Datum(indices), options, ctx)); - return result.table(); -} - Result> SortToIndices(const Array& values, ExecContext* ctx) { return SortIndices(values, SortOrder::Ascending, ctx); } diff --git a/cpp/src/arrow/compute/api_vector.h b/cpp/src/arrow/compute/api_vector.h index 32439980f54..2d9522b0732 100644 --- a/cpp/src/arrow/compute/api_vector.h +++ b/cpp/src/arrow/compute/api_vector.h @@ -366,42 +366,6 @@ Result DictionaryEncode( // ---------------------------------------------------------------------- // Deprecated functions -ARROW_DEPRECATED("Deprecated in 1.0.0. Use Datum-based version") -ARROW_EXPORT -Result> Take( - const ChunkedArray& values, const Array& indices, - const TakeOptions& options = TakeOptions::Defaults(), ExecContext* context = NULLPTR); - -ARROW_DEPRECATED("Deprecated in 1.0.0. Use Datum-based version") -ARROW_EXPORT -Result> Take( - const ChunkedArray& values, const ChunkedArray& indices, - const TakeOptions& options = TakeOptions::Defaults(), ExecContext* context = NULLPTR); - -ARROW_DEPRECATED("Deprecated in 1.0.0. Use Datum-based version") -ARROW_EXPORT -Result> Take( - const Array& values, const ChunkedArray& indices, - const TakeOptions& options = TakeOptions::Defaults(), ExecContext* context = NULLPTR); - -ARROW_DEPRECATED("Deprecated in 1.0.0. Use Datum-based version") -ARROW_EXPORT -Result> Take( - const RecordBatch& batch, const Array& indices, - const TakeOptions& options = TakeOptions::Defaults(), ExecContext* context = NULLPTR); - -ARROW_DEPRECATED("Deprecated in 1.0.0. Use Datum-based version") -ARROW_EXPORT -Result> Take(const Table& table, const Array& indices, - const TakeOptions& options = TakeOptions::Defaults(), - ExecContext* context = NULLPTR); - -ARROW_DEPRECATED("Deprecated in 1.0.0. Use Datum-based version") -ARROW_EXPORT -Result> Take(const Table& table, const ChunkedArray& indices, - const TakeOptions& options = TakeOptions::Defaults(), - ExecContext* context = NULLPTR); - ARROW_DEPRECATED("Deprecated in 3.0.0. Use SortIndices()") ARROW_EXPORT Result> SortToIndices(const Array& values, diff --git a/cpp/src/arrow/csv/reader.h b/cpp/src/arrow/csv/reader.h index 48f02882b10..253db689296 100644 --- a/cpp/src/arrow/csv/reader.h +++ b/cpp/src/arrow/csv/reader.h @@ -53,7 +53,9 @@ class ARROW_EXPORT TableReader { const ParseOptions&, const ConvertOptions&); - ARROW_DEPRECATED("Use MemoryPool-less variant (the IOContext holds a pool already)") + ARROW_DEPRECATED( + "Deprecated in 4.0.0. " + "Use MemoryPool-less variant (the IOContext holds a pool already)") static Result> Make( MemoryPool* pool, io::IOContext io_context, std::shared_ptr input, const ReadOptions&, const ParseOptions&, const ConvertOptions&); @@ -104,7 +106,7 @@ class ARROW_EXPORT StreamingReader : public RecordBatchReader { io::IOContext io_context, std::shared_ptr input, const ReadOptions&, const ParseOptions&, const ConvertOptions&); - ARROW_DEPRECATED("Use IOContext-based overload") + ARROW_DEPRECATED("Deprecated in 4.0.0. Use IOContext-based overload") static Result> Make( MemoryPool* pool, std::shared_ptr input, const ReadOptions& read_options, const ParseOptions& parse_options, diff --git a/cpp/src/arrow/ipc/writer.h b/cpp/src/arrow/ipc/writer.h index 0ea83d7630a..e976b41a1c5 100644 --- a/cpp/src/arrow/ipc/writer.h +++ b/cpp/src/arrow/ipc/writer.h @@ -167,13 +167,13 @@ Result> MakeFileWriter( /// @} -ARROW_DEPRECATED("Use MakeStreamWriter") +ARROW_DEPRECATED("Deprecated in 3.0.0. Use MakeStreamWriter") ARROW_EXPORT Result> NewStreamWriter( io::OutputStream* sink, const std::shared_ptr& schema, const IpcWriteOptions& options = IpcWriteOptions::Defaults()); -ARROW_DEPRECATED("Use MakeFileWriter") +ARROW_DEPRECATED("Deprecated in 2.0.0. Use MakeFileWriter") ARROW_EXPORT Result> NewFileWriter( io::OutputStream* sink, const std::shared_ptr& schema, diff --git a/cpp/src/arrow/json/reader.cc b/cpp/src/arrow/json/reader.cc index 51c77fa4df9..18aed0235ff 100644 --- a/cpp/src/arrow/json/reader.cc +++ b/cpp/src/arrow/json/reader.cc @@ -168,8 +168,6 @@ class TableReaderImpl : public TableReader, std::shared_ptr builder_; }; -Status TableReader::Read(std::shared_ptr* out) { return Read().Value(out); } - Result> TableReader::Make( MemoryPool* pool, std::shared_ptr input, const ReadOptions& read_options, const ParseOptions& parse_options) { @@ -185,13 +183,6 @@ Result> TableReader::Make( return ptr; } -Status TableReader::Make(MemoryPool* pool, std::shared_ptr input, - const ReadOptions& read_options, - const ParseOptions& parse_options, - std::shared_ptr* out) { - return TableReader::Make(pool, input, read_options, parse_options).Value(out); -} - Result> ParseOne(ParseOptions options, std::shared_ptr json) { std::unique_ptr parser; diff --git a/cpp/src/arrow/json/reader.h b/cpp/src/arrow/json/reader.h index c40338c1e1c..3374931a043 100644 --- a/cpp/src/arrow/json/reader.h +++ b/cpp/src/arrow/json/reader.h @@ -50,19 +50,11 @@ class ARROW_EXPORT TableReader { /// Read the entire JSON file and convert it to a Arrow Table virtual Result> Read() = 0; - ARROW_DEPRECATED("Use Result-returning version") - Status Read(std::shared_ptr
* out); - /// Create a TableReader instance static Result> Make(MemoryPool* pool, std::shared_ptr input, const ReadOptions&, const ParseOptions&); - - ARROW_DEPRECATED("Use Result-returning version") - static Status Make(MemoryPool* pool, std::shared_ptr input, - const ReadOptions&, const ParseOptions&, - std::shared_ptr* out); }; ARROW_EXPORT Result> ParseOne(ParseOptions options, diff --git a/cpp/src/arrow/python/pyarrow.cc b/cpp/src/arrow/python/pyarrow.cc index bea35ff3b61..c3244b74bf5 100644 --- a/cpp/src/arrow/python/pyarrow.cc +++ b/cpp/src/arrow/python/pyarrow.cc @@ -57,9 +57,6 @@ int import_pyarrow() { } else { \ return UnwrapError(obj, #TYPE_NAME); \ } \ - } \ - Status unwrap_##FUNC_SUFFIX(PyObject* obj, std::shared_ptr* out) { \ - return unwrap_##FUNC_SUFFIX(obj).Value(out); \ } DEFINE_WRAP_FUNCTIONS(buffer, Buffer) diff --git a/cpp/src/arrow/python/pyarrow.h b/cpp/src/arrow/python/pyarrow.h index 8056e700a0c..4c365081d70 100644 --- a/cpp/src/arrow/python/pyarrow.h +++ b/cpp/src/arrow/python/pyarrow.h @@ -45,14 +45,11 @@ namespace py { // Returns 0 on success, -1 on error. ARROW_PYTHON_EXPORT int import_pyarrow(); -#define DECLARE_WRAP_FUNCTIONS(FUNC_SUFFIX, TYPE_NAME) \ - ARROW_PYTHON_EXPORT bool is_##FUNC_SUFFIX(PyObject*); \ - ARROW_PYTHON_EXPORT Result> unwrap_##FUNC_SUFFIX( \ - PyObject*); \ - ARROW_PYTHON_EXPORT PyObject* wrap_##FUNC_SUFFIX(const std::shared_ptr&); \ - ARROW_DEPRECATED("Use Result-returning version") \ - ARROW_PYTHON_EXPORT Status unwrap_##FUNC_SUFFIX(PyObject*, \ - std::shared_ptr* out); +#define DECLARE_WRAP_FUNCTIONS(FUNC_SUFFIX, TYPE_NAME) \ + ARROW_PYTHON_EXPORT bool is_##FUNC_SUFFIX(PyObject*); \ + ARROW_PYTHON_EXPORT Result> unwrap_##FUNC_SUFFIX( \ + PyObject*); \ + ARROW_PYTHON_EXPORT PyObject* wrap_##FUNC_SUFFIX(const std::shared_ptr&); DECLARE_WRAP_FUNCTIONS(buffer, Buffer) diff --git a/cpp/src/arrow/sparse_tensor.h b/cpp/src/arrow/sparse_tensor.h index 1f2f8c0d82e..4ec824dfa7d 100644 --- a/cpp/src/arrow/sparse_tensor.h +++ b/cpp/src/arrow/sparse_tensor.h @@ -508,13 +508,6 @@ class ARROW_EXPORT SparseTensor { return ToTensor(default_memory_pool()); } - /// \brief Status-return version of ToTensor(). - ARROW_DEPRECATED("Use Result-returning version") - Status ToTensor(std::shared_ptr* out) const { return ToTensor().Value(out); } - Status ToTensor(MemoryPool* pool, std::shared_ptr* out) const { - return ToTensor(pool).Value(out); - } - protected: // Constructor with all attributes SparseTensor(const std::shared_ptr& type, const std::shared_ptr& data, diff --git a/cpp/src/arrow/tensor.h b/cpp/src/arrow/tensor.h index 91e9ad26066..ff6f3735f91 100644 --- a/cpp/src/arrow/tensor.h +++ b/cpp/src/arrow/tensor.h @@ -152,10 +152,6 @@ class ARROW_EXPORT Tensor { /// Compute the number of non-zero values in the tensor Result CountNonZero() const; - /// Compute the number of non-zero values in the tensor - ARROW_DEPRECATED("Use Result-returning version") - Status CountNonZero(int64_t* result) const { return CountNonZero().Value(result); } - /// Return the offset of the given index on the given strides static int64_t CalculateValueOffset(const std::vector& strides, const std::vector& index) { diff --git a/cpp/src/arrow/type.h b/cpp/src/arrow/type.h index 005b4458b91..506fb785957 100644 --- a/cpp/src/arrow/type.h +++ b/cpp/src/arrow/type.h @@ -124,22 +124,13 @@ class ARROW_EXPORT DataType : public detail::Fingerprintable { /// \brief Return whether the types are equal bool Equals(const std::shared_ptr& other) const; - ARROW_DEPRECATED("Use field(i)") - const std::shared_ptr& child(int i) const { return field(i); } - - /// Returns the child-field at index i. + /// \brief Return the child field at index i. const std::shared_ptr& field(int i) const { return children_[i]; } - ARROW_DEPRECATED("Use fields()") - const std::vector>& children() const { return fields(); } - - /// \brief Returns the children fields associated with this type. + /// \brief Return the children fields associated with this type. const std::vector>& fields() const { return children_; } - ARROW_DEPRECATED("Use num_fields()") - int num_children() const { return num_fields(); } - - /// \brief Returns the number of children fields associated with this type. + /// \brief Return the number of children fields associated with this type. int num_fields() const { return static_cast(children_.size()); } Status Accept(TypeVisitor* visitor) const; diff --git a/cpp/src/arrow/type_fwd.h b/cpp/src/arrow/type_fwd.h index 7e564106bbe..d77f519a3c5 100644 --- a/cpp/src/arrow/type_fwd.h +++ b/cpp/src/arrow/type_fwd.h @@ -536,80 +536,19 @@ struct_(const std::vector>& fields); /// \brief Create a SparseUnionType instance std::shared_ptr ARROW_EXPORT sparse_union(FieldVector child_fields, std::vector type_codes = {}); -/// \brief Create a DenseUnionType instance -std::shared_ptr ARROW_EXPORT dense_union(FieldVector child_fields, - std::vector type_codes = {}); - /// \brief Create a SparseUnionType instance std::shared_ptr ARROW_EXPORT sparse_union(const ArrayVector& children, std::vector field_names = {}, std::vector type_codes = {}); + +/// \brief Create a DenseUnionType instance +std::shared_ptr ARROW_EXPORT dense_union(FieldVector child_fields, + std::vector type_codes = {}); /// \brief Create a DenseUnionType instance std::shared_ptr ARROW_EXPORT dense_union(const ArrayVector& children, std::vector field_names = {}, std::vector type_codes = {}); -/// \brief Create a UnionType instance -ARROW_DEPRECATED("Deprecated in 1.0.0") -inline std::shared_ptr ARROW_EXPORT -union_(const std::vector>& child_fields, - const std::vector& type_codes, UnionMode::type mode = UnionMode::SPARSE) { - if (mode == UnionMode::SPARSE) { - return sparse_union(child_fields, type_codes); - } else { - return dense_union(child_fields, type_codes); - } -} - -/// \brief Create a UnionType instance -ARROW_DEPRECATED("Deprecated in 1.0.0") -inline std::shared_ptr ARROW_EXPORT -union_(const std::vector>& child_fields, - UnionMode::type mode = UnionMode::SPARSE) { - if (mode == UnionMode::SPARSE) { - return sparse_union(child_fields); - } else { - return dense_union(child_fields); - } -} - -/// \brief Create a UnionType instance -ARROW_DEPRECATED("Deprecated in 1.0.0") -inline std::shared_ptr ARROW_EXPORT -union_(const std::vector>& children, - const std::vector& field_names, const std::vector& type_codes, - UnionMode::type mode = UnionMode::SPARSE) { - if (mode == UnionMode::SPARSE) { - return sparse_union(children, field_names, type_codes); - } else { - return dense_union(children, field_names, type_codes); - } -} - -/// \brief Create a UnionType instance -ARROW_DEPRECATED("Deprecated in 1.0.0") -inline std::shared_ptr ARROW_EXPORT -union_(const std::vector>& children, - const std::vector& field_names, - UnionMode::type mode = UnionMode::SPARSE) { - if (mode == UnionMode::SPARSE) { - return sparse_union(children, field_names); - } else { - return dense_union(children, field_names); - } -} - -/// \brief Create a UnionType instance -ARROW_DEPRECATED("Deprecated in 1.0.0") -inline std::shared_ptr ARROW_EXPORT -union_(const std::vector>& children, - UnionMode::type mode = UnionMode::SPARSE) { - if (mode == UnionMode::SPARSE) { - return sparse_union(children); - } else { - return dense_union(children); - } -} /// \brief Create a DictionaryType instance /// \param[in] index_type the type of the dictionary indices (must be /// a signed integer) diff --git a/cpp/src/arrow/util/compiler_util.h b/cpp/src/arrow/util/compiler_util.h deleted file mode 100644 index ac1745074a1..00000000000 --- a/cpp/src/arrow/util/compiler_util.h +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -// Deprecated header, here for backwards compatibility in parquet-cpp - -#pragma once - -#include "arrow/util/macros.h" diff --git a/cpp/src/parquet/schema.h b/cpp/src/parquet/schema.h index 7dcfa7d144e..83d0cf24f1e 100644 --- a/cpp/src/parquet/schema.h +++ b/cpp/src/parquet/schema.h @@ -127,9 +127,6 @@ class PARQUET_EXPORT Node { /// Thrift. int field_id() const { return field_id_; } - PARQUET_DEPRECATED("id() is deprecated. Use field_id() instead") - int id() const { return field_id_; } - const Node* parent() const { return parent_; } const std::shared_ptr path() const;