AlenkaF commented on code in PR #14029:
URL: https://github.com/apache/arrow/pull/14029#discussion_r961699361


##########
cpp/src/parquet/schema.cc:
##########
@@ -795,12 +795,27 @@ void SchemaDescriptor::Init(NodePtr schema) {
 }
 
 bool SchemaDescriptor::Equals(const SchemaDescriptor& other) const {
+  return this->Equals(other, nullptr);
+}
+
+bool SchemaDescriptor::Equals(
+    const SchemaDescriptor& other,
+    std::shared_ptr<std::stringstream> diff_msg = NULLPTR) const {
   if (this->num_columns() != other.num_columns()) {
+    if (diff_msg != nullptr) {
+      *diff_msg.get() << "This schema has " << this->num_columns()
+                      << " columns, other has " << other.num_columns();
+    }
     return false;
   }
 
   for (int i = 0; i < this->num_columns(); ++i) {
     if (!this->Column(i)->Equals(*other.Column(i))) {
+      if (diff_msg != nullptr) {
+        *diff_msg.get() << "These two columns differ:" << std::endl
+                        << this->Column(i)->ToString() << std::endl
+                        << other.Column(i)->ToString();

Review Comment:
   I hope I didn't complicate things for you!
   
   In the example you added I was thinking something like:
   ```python
   # meta1 and meta2 differ in number of columns
   meta1.append_row_groups(meta2)
   *** RuntimeError: AppendRowGroups requires equal schemas but meta1 has 2 
columns and meta2 has 1.
   ```
   
   ```python
   # meta1 and meta2 differ in column types
   meta1.append_row_groups(meta2)
   *** RuntimeError: AppendRowGroups requires equal schemas but schemas meta1 
and meta2 differ in these columns:
   ...
   ```
   
   But note, this is just me thinking about it. Feel free to ignore it ;)



-- 
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