| 127 | } // namespace |
| 128 | |
| 129 | bool ChunkedArray::Equals(const ChunkedArray& other, const EqualOptions& opts) const { |
| 130 | if (this == &other) { |
| 131 | if (opts.nans_equal()) { |
| 132 | return true; |
| 133 | } else if (!ContainsFloatType(*type_)) { |
| 134 | return true; |
| 135 | } |
| 136 | } |
| 137 | if (length_ != other.length()) { |
| 138 | return false; |
| 139 | } |
| 140 | if (null_count_ != other.null_count()) { |
| 141 | return false; |
| 142 | } |
| 143 | // We cannot toggle check_metadata here yet, so we don't check it |
| 144 | if (!type_->Equals(*other.type_, /*check_metadata=*/false)) { |
| 145 | return false; |
| 146 | } |
| 147 | |
| 148 | // Check contents of the underlying arrays. This checks for equality of |
| 149 | // the underlying data independently of the chunk size. |
| 150 | return internal::ApplyBinaryChunked( |
| 151 | *this, other, |
| 152 | [&](const Array& left_piece, const Array& right_piece, |
| 153 | int64_t ARROW_ARG_UNUSED(position)) { |
| 154 | if (!left_piece.Equals(right_piece, opts)) { |
| 155 | return Status::Invalid("Unequal piece"); |
| 156 | } |
| 157 | return Status::OK(); |
| 158 | }) |
| 159 | .ok(); |
| 160 | } |
| 161 | |
| 162 | bool ChunkedArray::Equals(const std::shared_ptr<ChunkedArray>& other, |
| 163 | const EqualOptions& opts) const { |
no test coverage detected