From a63e60bad89b41266d155bc496eb383765702492 Mon Sep 17 00:00:00 2001 From: Weston Pace Date: Sat, 10 Sep 2022 12:50:06 -1000 Subject: [PATCH] ARROW-17675: [C++] Modified the FileSource::Equals method to handle the case where buffer_ is null (#14085) Authored-by: Weston Pace Signed-off-by: David Li --- cpp/src/arrow/dataset/file_base.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/dataset/file_base.cc b/cpp/src/arrow/dataset/file_base.cc index ff5d1e43eb3d9..81bf10abe3039 100644 --- a/cpp/src/arrow/dataset/file_base.cc +++ b/cpp/src/arrow/dataset/file_base.cc @@ -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> FileFormat::CountRows(