From a13931c9a746c89676731b144efca05494ab95b8 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Wed, 21 Feb 2018 12:57:27 -0500 Subject: [PATCH] Remove deprecated C++ APIs from 0.8.0 cycle Change-Id: I2987abc3fdf30c16a6458739af3c80ea10f86fd8 --- cpp/src/arrow/array.cc | 20 -------------------- cpp/src/arrow/array.h | 29 ----------------------------- cpp/src/arrow/buffer.h | 16 ---------------- cpp/src/arrow/compare.cc | 26 -------------------------- cpp/src/arrow/compare.h | 27 --------------------------- cpp/src/arrow/table.cc | 26 -------------------------- cpp/src/arrow/table.h | 12 ------------ cpp/src/arrow/type.cc | 20 -------------------- cpp/src/arrow/type.h | 12 ------------ 9 files changed, 188 deletions(-) diff --git a/cpp/src/arrow/array.cc b/cpp/src/arrow/array.cc index a8043d69b92..83142dfefaa 100644 --- a/cpp/src/arrow/array.cc +++ b/cpp/src/arrow/array.cc @@ -140,15 +140,6 @@ PrimitiveArray::PrimitiveArray(const std::shared_ptr& type, int64_t le SetData(ArrayData::Make(type, length, {null_bitmap, data}, null_count, offset)); } -#ifndef ARROW_NO_DEPRECATED_API - -const uint8_t* PrimitiveArray::raw_values() const { - return raw_values_ + - offset() * static_cast(*type()).bit_width() / CHAR_BIT; -} - -#endif - template NumericArray::NumericArray(const std::shared_ptr& data) : PrimitiveArray(data) { @@ -752,17 +743,6 @@ class ArrayDataWrapper { } // namespace internal -#ifndef ARROW_NO_DEPRECATED_API - -Status MakeArray(const std::shared_ptr& data, std::shared_ptr* out) { - internal::ArrayDataWrapper wrapper_visitor(data, out); - RETURN_NOT_OK(VisitTypeInline(*data->type, &wrapper_visitor)); - DCHECK(out); - return Status::OK(); -} - -#endif - std::shared_ptr MakeArray(const std::shared_ptr& data) { std::shared_ptr out; internal::ArrayDataWrapper wrapper_visitor(data, &out); diff --git a/cpp/src/arrow/array.h b/cpp/src/arrow/array.h index 5b9ce9a01fb..faa9211c674 100644 --- a/cpp/src/arrow/array.h +++ b/cpp/src/arrow/array.h @@ -146,13 +146,6 @@ struct ARROW_EXPORT ArrayData { std::shared_ptr Copy() const { return std::make_shared(*this); } -#ifndef ARROW_NO_DEPRECATED_API - - // Deprecated since 0.8.0 - std::shared_ptr ShallowCopy() const { return Copy(); } - -#endif - std::shared_ptr type; int64_t length; int64_t null_count; @@ -161,19 +154,6 @@ struct ARROW_EXPORT ArrayData { std::vector> child_data; }; -#ifndef ARROW_NO_DEPRECATED_API - -/// \brief Create a strongly-typed Array instance from generic ArrayData -/// \param[in] data the array contents -/// \param[out] out the resulting Array instance -/// \return Status -/// -/// \note Deprecated since 0.8.0 -ARROW_EXPORT -Status MakeArray(const std::shared_ptr& data, std::shared_ptr* out); - -#endif - /// \brief Create a strongly-typed Array instance from generic ArrayData /// \param[in] data the array contents /// \return the resulting Array instance @@ -335,15 +315,6 @@ class ARROW_EXPORT PrimitiveArray : public FlatArray { /// Does not account for any slice offset std::shared_ptr values() const { return data_->buffers[1]; } -#ifndef ARROW_NO_DEPRECATED_API - - /// \brief Return pointer to start of raw data - /// - /// \note Deprecated since 0.8.0 - const uint8_t* raw_values() const; - -#endif - protected: PrimitiveArray() {} diff --git a/cpp/src/arrow/buffer.h b/cpp/src/arrow/buffer.h index 74a3c680d26..cf25ccd0364 100644 --- a/cpp/src/arrow/buffer.h +++ b/cpp/src/arrow/buffer.h @@ -371,22 +371,6 @@ ARROW_EXPORT Status AllocateResizableBuffer(MemoryPool* pool, const int64_t size, std::shared_ptr* out); -#ifndef ARROW_NO_DEPRECATED_API - -/// \brief Create Buffer referencing std::string memory -/// -/// Warning: string instance must stay alive -/// -/// \param str std::string instance -/// \return std::shared_ptr -/// -/// \note Deprecated Since 0.8.0 -static inline std::shared_ptr GetBufferFromString(const std::string& str) { - return std::make_shared(str); -} - -#endif // ARROW_NO_DEPRECATED_API - } // namespace arrow #endif // ARROW_BUFFER_H diff --git a/cpp/src/arrow/compare.cc b/cpp/src/arrow/compare.cc index 9ed54ca3a4f..69cacbfac81 100644 --- a/cpp/src/arrow/compare.cc +++ b/cpp/src/arrow/compare.cc @@ -783,30 +783,4 @@ bool TypeEquals(const DataType& left, const DataType& right) { return are_equal; } -Status ArrayEquals(const Array& left, const Array& right, bool* are_equal) { - *are_equal = ArrayEquals(left, right); - return Status::OK(); -} - -Status TensorEquals(const Tensor& left, const Tensor& right, bool* are_equal) { - *are_equal = TensorEquals(left, right); - return Status::OK(); -} - -Status ArrayApproxEquals(const Array& left, const Array& right, bool* are_equal) { - *are_equal = ArrayApproxEquals(left, right); - return Status::OK(); -} - -Status ArrayRangeEquals(const Array& left, const Array& right, int64_t start_idx, - int64_t end_idx, int64_t other_start_idx, bool* are_equal) { - *are_equal = ArrayRangeEquals(left, right, start_idx, end_idx, other_start_idx); - return Status::OK(); -} - -Status TypeEquals(const DataType& left, const DataType& right, bool* are_equal) { - *are_equal = TypeEquals(left, right); - return Status::OK(); -} - } // namespace arrow diff --git a/cpp/src/arrow/compare.h b/cpp/src/arrow/compare.h index df3386e4bfc..956ae897efd 100644 --- a/cpp/src/arrow/compare.h +++ b/cpp/src/arrow/compare.h @@ -31,33 +31,6 @@ class DataType; class Status; class Tensor; -#ifndef ARROW_NO_DEPRECATED_API -/// Returns true if the arrays are exactly equal -/// \note Deprecated since 0.8.0 -Status ARROW_EXPORT ArrayEquals(const Array& left, const Array& right, bool* are_equal); - -/// \note Deprecated since 0.8.0 -Status ARROW_EXPORT TensorEquals(const Tensor& left, const Tensor& right, - bool* are_equal); - -/// Returns true if the arrays are approximately equal. For non-floating point -/// types, this is equivalent to ArrayEquals(left, right) -/// \note Deprecated since 0.8.0 -Status ARROW_EXPORT ArrayApproxEquals(const Array& left, const Array& right, - bool* are_equal); - -/// Returns true if indicated equal-length segment of arrays is exactly equal -/// \note Deprecated since 0.8.0 -Status ARROW_EXPORT ArrayRangeEquals(const Array& left, const Array& right, - int64_t start_idx, int64_t end_idx, - int64_t other_start_idx, bool* are_equal); - -/// Returns true if the type metadata are exactly equal -/// \note Deprecated since 0.8.0 -Status ARROW_EXPORT TypeEquals(const DataType& left, const DataType& right, - bool* are_equal); -#endif - /// Returns true if the arrays are exactly equal bool ARROW_EXPORT ArrayEquals(const Array& left, const Array& right); diff --git a/cpp/src/arrow/table.cc b/cpp/src/arrow/table.cc index 62ea32a8d90..ed5858624ae 100644 --- a/cpp/src/arrow/table.cc +++ b/cpp/src/arrow/table.cc @@ -388,32 +388,6 @@ bool Table::Equals(const Table& other) const { return true; } -#ifndef ARROW_NO_DEPRECATED_API - -Status MakeTable(const std::shared_ptr& schema, - const std::vector>& arrays, - std::shared_ptr* table) { - // Make sure the length of the schema corresponds to the length of the vector - if (schema->num_fields() != static_cast(arrays.size())) { - std::stringstream ss; - ss << "Schema and Array vector have different lengths: " << schema->num_fields() - << " != " << arrays.size(); - return Status::Invalid(ss.str()); - } - - std::vector> columns; - columns.reserve(schema->num_fields()); - for (int i = 0; i < schema->num_fields(); i++) { - columns.emplace_back(std::make_shared(schema->field(i), arrays[i])); - } - - *table = Table::Make(schema, columns); - - return Status::OK(); -} - -#endif // ARROW_NO_DEPRECATED_API - // ---------------------------------------------------------------------- // Convert a table to a sequence of record batches diff --git a/cpp/src/arrow/table.h b/cpp/src/arrow/table.h index 6938db1be3a..7274fca4d23 100644 --- a/cpp/src/arrow/table.h +++ b/cpp/src/arrow/table.h @@ -244,18 +244,6 @@ ARROW_EXPORT Status ConcatenateTables(const std::vector>& tables, std::shared_ptr
* table); -#ifndef ARROW_NO_DEPRECATED_API - -/// \brief Construct table from multiple input tables. -/// \return Status, fails if any schemas are different -/// \note Deprecated since 0.8.0 -ARROW_EXPORT -Status MakeTable(const std::shared_ptr& schema, - const std::vector>& arrays, - std::shared_ptr
* table); - -#endif - } // namespace arrow #endif // ARROW_TABLE_H diff --git a/cpp/src/arrow/type.cc b/cpp/src/arrow/type.cc index 6574cce50ee..792d1bfd035 100644 --- a/cpp/src/arrow/type.cc +++ b/cpp/src/arrow/type.cc @@ -38,16 +38,6 @@ std::shared_ptr Field::AddMetadata( return std::make_shared(name_, type_, nullable_, metadata); } -#ifndef ARROW_NO_DEPRECATED_API - -Status Field::AddMetadata(const std::shared_ptr& metadata, - std::shared_ptr* out) const { - *out = AddMetadata(metadata); - return Status::OK(); -} - -#endif - std::shared_ptr Field::RemoveMetadata() const { return std::make_shared(name_, type_, nullable_); } @@ -307,16 +297,6 @@ std::shared_ptr Schema::AddMetadata( return std::make_shared(fields_, metadata); } -#ifndef ARROW_NO_DEPRECATED_API - -Status Schema::AddMetadata(const std::shared_ptr& metadata, - std::shared_ptr* out) const { - *out = AddMetadata(metadata); - return Status::OK(); -} - -#endif - std::shared_ptr Schema::metadata() const { return metadata_; } std::shared_ptr Schema::RemoveMetadata() const { diff --git a/cpp/src/arrow/type.h b/cpp/src/arrow/type.h index cfee6fd0e23..95f010a8f23 100644 --- a/cpp/src/arrow/type.h +++ b/cpp/src/arrow/type.h @@ -232,12 +232,6 @@ class ARROW_EXPORT Field { std::shared_ptr metadata() const { return metadata_; } -#ifndef ARROW_NO_DEPRECATED_API - /// \note Deprecated since 0.8.0 - Status AddMetadata(const std::shared_ptr& metadata, - std::shared_ptr* out) const; -#endif - std::shared_ptr AddMetadata( const std::shared_ptr& metadata) const; std::shared_ptr RemoveMetadata() const; @@ -768,12 +762,6 @@ class ARROW_EXPORT Schema { std::shared_ptr* out) const; Status RemoveField(int i, std::shared_ptr* out) const; -#ifndef ARROW_NO_DEPRECATED_API - /// \note Deprecated since 0.8.0 - Status AddMetadata(const std::shared_ptr& metadata, - std::shared_ptr* out) const; -#endif - /// \brief Replace key-value metadata with new metadata /// /// \param[in] metadata new KeyValueMetadata