Skip to content

Commit

Permalink
ARROW-17675: [C++] Modified the FileSource::Equals method to handle t…
Browse files Browse the repository at this point in the history
…he case where buffer_ is null (#14085)

Authored-by: Weston Pace <[email protected]>
Signed-off-by: David Li <[email protected]>
  • Loading branch information
westonpace authored Sep 10, 2022
1 parent 8a9037d commit a63e60b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cpp/src/arrow/dataset/file_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ bool FileSource::Equals(const FileSource& other) const {
bool match_file_system =
(filesystem_ == nullptr && other.filesystem_ == nullptr) ||
(filesystem_ && other.filesystem_ && filesystem_->Equals(other.filesystem_));
return match_file_system && file_info_.Equals(other.file_info_) &&
buffer_->Equals(*other.buffer_) && compression_ == other.compression_;
bool match_buffer = (buffer_ == nullptr && other.buffer_ == nullptr) ||
((buffer_ != nullptr && other.buffer_ != nullptr) &&
(buffer_->address() == other.buffer_->address()));
return match_file_system && match_buffer && file_info_.Equals(other.file_info_) &&
compression_ == other.compression_;
}

Future<util::optional<int64_t>> FileFormat::CountRows(
Expand Down

0 comments on commit a63e60b

Please sign in to comment.