westonpace commented on code in PR #34970:
URL: https://github.com/apache/arrow/pull/34970#discussion_r1163081979


##########
cpp/src/arrow/record_batch_test.cc:
##########
@@ -81,6 +82,46 @@ TEST_F(TestRecordBatch, Equals) {
   ASSERT_FALSE(b1->Equals(*b2, /*check_metadata=*/true));
 }
 
+TEST_F(TestRecordBatch, EqualsOptions) {

Review Comment:
   ```suggestion
   TEST_F(TestRecordBatch, EqualOptions) {
   ```



##########
cpp/src/arrow/record_batch.h:
##########
@@ -97,11 +98,18 @@ class ARROW_EXPORT RecordBatch {
   ///
   /// \param[in] other the RecordBatch to compare with
   /// \param[in] check_metadata if true, check that Schema metadata is the same
+  /// \param[in] opts the options for equality comparisons
   /// \return true if batches are equal
-  bool Equals(const RecordBatch& other, bool check_metadata = false) const;
+  bool Equals(const RecordBatch& other, bool check_metadata = false,
+              const EqualOptions& opts = EqualOptions::Defaults()) const;
 
   /// \brief Determine if two record batches are approximately equal
-  bool ApproxEquals(const RecordBatch& other) const;
+  ///
+  /// \param[in] other the RecordBatch to compare with
+  /// \param[in] opts the options for equality comparisons
+  /// \return true if batches are equal

Review Comment:
   ```suggestion
     /// \return true if batches are approximately equal
   ```



##########
cpp/src/arrow/record_batch_test.cc:
##########
@@ -81,6 +82,46 @@ TEST_F(TestRecordBatch, Equals) {
   ASSERT_FALSE(b1->Equals(*b2, /*check_metadata=*/true));
 }
 
+TEST_F(TestRecordBatch, EqualsOptions) {
+  int length = 2;
+  auto f = field("f", float64());
+
+  auto metadata = key_value_metadata({"foo"}, {"bar"});
+
+  std::vector<std::shared_ptr<Field>> fields = {f};
+  auto schema = ::arrow::schema(fields);
+
+  std::shared_ptr<Array> array1, array2;
+  ArrayFromVector<DoubleType>(float64(), {true, true}, {0.5, NAN}, &array1);
+  ArrayFromVector<DoubleType>(float64(), {true, true}, {0.5, NAN}, &array2);
+  auto b1 = RecordBatch::Make(schema, length, {array1});
+  auto b2 = RecordBatch::Make(schema, length, {array2});
+
+  EXPECT_FALSE(b1->Equals(*b2, false, 
EqualOptions::Defaults().nans_equal(false)));
+  EXPECT_TRUE(b1->Equals(*b2, false, 
EqualOptions::Defaults().nans_equal(true)));
+}
+
+TEST_F(TestRecordBatch, ApproxEqualsOptions) {
+  int length = 2;
+  auto f = field("f", float64());
+
+  auto metadata = key_value_metadata({"foo"}, {"bar"});
+

Review Comment:
   ```suggestion
   ```



##########
cpp/src/arrow/record_batch_test.cc:
##########
@@ -81,6 +82,46 @@ TEST_F(TestRecordBatch, Equals) {
   ASSERT_FALSE(b1->Equals(*b2, /*check_metadata=*/true));
 }
 
+TEST_F(TestRecordBatch, EqualsOptions) {
+  int length = 2;
+  auto f = field("f", float64());
+
+  auto metadata = key_value_metadata({"foo"}, {"bar"});
+
+  std::vector<std::shared_ptr<Field>> fields = {f};
+  auto schema = ::arrow::schema(fields);
+
+  std::shared_ptr<Array> array1, array2;
+  ArrayFromVector<DoubleType>(float64(), {true, true}, {0.5, NAN}, &array1);
+  ArrayFromVector<DoubleType>(float64(), {true, true}, {0.5, NAN}, &array2);
+  auto b1 = RecordBatch::Make(schema, length, {array1});
+  auto b2 = RecordBatch::Make(schema, length, {array2});
+
+  EXPECT_FALSE(b1->Equals(*b2, false, 
EqualOptions::Defaults().nans_equal(false)));
+  EXPECT_TRUE(b1->Equals(*b2, false, 
EqualOptions::Defaults().nans_equal(true)));

Review Comment:
   ```suggestion
     EXPECT_FALSE(b1->Equals(*b2, /*check_metadata=*/ false, 
EqualOptions::Defaults().nans_equal(false)));
     EXPECT_TRUE(b1->Equals(*b2, /*check_metadata=*/ false, 
EqualOptions::Defaults().nans_equal(true)));
   ```



##########
cpp/src/arrow/record_batch_test.cc:
##########
@@ -81,6 +82,46 @@ TEST_F(TestRecordBatch, Equals) {
   ASSERT_FALSE(b1->Equals(*b2, /*check_metadata=*/true));
 }
 
+TEST_F(TestRecordBatch, EqualsOptions) {
+  int length = 2;
+  auto f = field("f", float64());
+
+  auto metadata = key_value_metadata({"foo"}, {"bar"});
+

Review Comment:
   ```suggestion
   ```



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to