You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/01 15:33:13 UTC

[GitHub] [arrow] lidavidm commented on a diff in pull request #13490: ARROW-16910: [C++] Add Equals method for FileFragment

lidavidm commented on code in PR #13490:
URL: https://github.com/apache/arrow/pull/13490#discussion_r912062334


##########
cpp/src/arrow/dataset/file_base.h:
##########
@@ -114,6 +114,9 @@ class ARROW_DS_EXPORT FileSource {
   Result<std::shared_ptr<io::InputStream>> OpenCompressed(
       util::optional<Compression::type> compression = util::nullopt) const;
 
+  /// \brief equality comparison with another FileSource
+  bool Equals(const FileSource& other) const;

Review Comment:
   We may want to inherit from EqualityComparable https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/compare.h



##########
cpp/src/arrow/dataset/file_base.cc:
##########
@@ -89,6 +89,12 @@ Result<std::shared_ptr<io::InputStream>> FileSource::OpenCompressed(
   return io::CompressedInputStream::Make(codec.get(), std::move(file));
 }
 
+bool FileSource::Equals(const FileSource& other) const {
+  if (filesystem_ == NULLPTR) return false;

Review Comment:
   This shouldn't be possible right?
   
   Also `NULLPTR` is meant for headers, not source files



##########
cpp/src/arrow/dataset/test_util.h:
##########
@@ -555,6 +555,21 @@ class FileFormatFixtureMixin : public ::testing::Test {
     ASSERT_OK_AND_ASSIGN(predicate, predicate.Bind(*full_schema));
     ASSERT_FINISHES_OK_AND_EQ(util::nullopt, fragment->CountRows(predicate, options));
   }
+  void TestFragmentEquals() {
+    auto options = std::make_shared<ScanOptions>();
+    auto test_schema = schema({field("f64", float64())});
+    auto reader = this->GetRecordBatchReader(test_schema);
+    auto other_reader = this->GetRecordBatchReader(test_schema);
+    auto source = this->GetFileSource(reader.get());
+    auto other_source = this->GetFileSource(other_reader.get());
+
+    auto fragment = this->MakeFragment(*source);
+    auto other = this->MakeFragment(*other_source);
+
+    EXPECT_EQ(fragment->Equals(*other), false);
+    // TODO: Extend the test cases for Fragment
+    // when ARROW-16855 is merged.

Review Comment:
   Is that a TODO for the code here, or for the other PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org