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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6a7ce32  ARROW-1904: [C++] Deprecate PrimitiveArray::raw_values
6a7ce32 is described below

commit 6a7ce328d585fb77121dc09bc55928ca6a0ce69d
Author: Wes McKinney <[email protected]>
AuthorDate: Mon Dec 11 10:42:00 2017 -0500

    ARROW-1904: [C++] Deprecate PrimitiveArray::raw_values
    
    I was mistaken about this method's handling of the offset parameter, but it 
doesn't work correctly for boolean data (also a subclass of `PrimitiveArray`), 
so I think it's better to remove this method altogether
    
    Author: Wes McKinney <[email protected]>
    
    Closes #1409 from wesm/ARROW-1904 and squashes the following commits:
    
    eb735555 [Wes McKinney] clang-format
    fa88b4c9 [Wes McKinney] Deprecate PrimitiveArray::raw_values, add 
implementation for FixedSizeBinary
---
 cpp/src/arrow/array.cc   |  4 ++++
 cpp/src/arrow/array.h    |  8 ++++++++
 cpp/src/arrow/compare.cc | 12 ++++++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/cpp/src/arrow/array.cc b/cpp/src/arrow/array.cc
index 0b235cc..144fbcd 100644
--- a/cpp/src/arrow/array.cc
+++ b/cpp/src/arrow/array.cc
@@ -139,11 +139,15 @@ PrimitiveArray::PrimitiveArray(const 
std::shared_ptr<DataType>& 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<const FixedWidthType&>(*type()).bit_width() / 
CHAR_BIT;
 }
 
+#endif
+
 template <typename T>
 NumericArray<T>::NumericArray(const std::shared_ptr<ArrayData>& data)
     : PrimitiveArray(data) {
diff --git a/cpp/src/arrow/array.h b/cpp/src/arrow/array.h
index ebe54ad..6721c7d 100644
--- a/cpp/src/arrow/array.h
+++ b/cpp/src/arrow/array.h
@@ -334,9 +334,15 @@ class ARROW_EXPORT PrimitiveArray : public FlatArray {
   /// Does not account for any slice offset
   std::shared_ptr<Buffer> 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() {}
 
@@ -567,6 +573,8 @@ class ARROW_EXPORT FixedSizeBinaryArray : public 
PrimitiveArray {
 
   int32_t byte_width() const { return byte_width_; }
 
+  const uint8_t* raw_values() const { return raw_values_ + data_->offset * 
byte_width_; }
+
  protected:
   inline void SetData(const std::shared_ptr<ArrayData>& data) {
     this->PrimitiveArray::SetData(data);
diff --git a/cpp/src/arrow/compare.cc b/cpp/src/arrow/compare.cc
index 72ef122..9f07fa7 100644
--- a/cpp/src/arrow/compare.cc
+++ b/cpp/src/arrow/compare.cc
@@ -312,8 +312,16 @@ static bool IsEqualPrimitive(const PrimitiveArray& left, 
const PrimitiveArray& r
   const auto& size_meta = dynamic_cast<const FixedWidthType&>(*left.type());
   const int byte_width = size_meta.bit_width() / CHAR_BIT;
 
-  const uint8_t* left_data = left.values() ? left.raw_values() : nullptr;
-  const uint8_t* right_data = right.values() ? right.raw_values() : nullptr;
+  const uint8_t* left_data = nullptr;
+  const uint8_t* right_data = nullptr;
+
+  if (left.values()) {
+    left_data = left.values()->data() + left.offset() * byte_width;
+  }
+
+  if (right.values()) {
+    right_data = right.values()->data() + right.offset() * byte_width;
+  }
 
   if (left.null_count() > 0) {
     for (int64_t i = 0; i < left.length(); ++i) {

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to