andishgar commented on code in PR #47204:
URL: https://github.com/apache/arrow/pull/47204#discussion_r2311953602


##########
cpp/src/arrow/record_batch.cc:
##########
@@ -349,44 +349,27 @@ bool CanIgnoreNaNInEquality(const RecordBatch& batch, 
const EqualOptions& opts)
 
 bool RecordBatch::Equals(const RecordBatch& other, bool check_metadata,
                          const EqualOptions& opts) const {
-  if (this == &other) {
-    if (CanIgnoreNaNInEquality(*this, opts)) {
-      return true;
-    }
-  } else {
-    if (num_columns() != other.num_columns() || num_rows_ != other.num_rows()) 
{
-      return false;
-    } else if (!schema_->Equals(*other.schema(), check_metadata)) {
-      return false;
-    } else if (device_type() != other.device_type()) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < num_columns(); ++i) {
-    if (!column(i)->Equals(other.column(i), opts)) {
-      return false;
-    }
-  }
-
-  return true;
+  return Equals(other, opts.use_metadata(check_metadata));
 }
 
-bool RecordBatch::ApproxEquals(const RecordBatch& other, const EqualOptions& 
opts) const {
+bool RecordBatch::Equals(const RecordBatch& other, const EqualOptions& opts) 
const {
   if (this == &other) {
     if (CanIgnoreNaNInEquality(*this, opts)) {
       return true;
     }
   } else {
     if (num_columns() != other.num_columns() || num_rows_ != other.num_rows()) 
{
       return false;
+    } else if (opts.use_schema() &&
+               !schema_->Equals(*other.schema(), opts.use_metadata())) {
+      return false;
     } else if (device_type() != other.device_type()) {
       return false;
     }
   }
 
   for (int i = 0; i < num_columns(); ++i) {
-    if (!column(i)->ApproxEquals(other.column(i), opts)) {
+    if (!column(i)->Equals(other.column(i), opts)) {
       return false;

Review Comment:
   Should I ignore it? I mean,` arrow::Array::Equals` supports both types of 
comparisons via `EqualOptions::use_atol()`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to