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


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

Review Comment:
   Maybe try to include `i` in the sentence? (since it's the position that is 
used to compare columns, and not for example column names)



##########
cpp/src/parquet/metadata.cc:
##########
@@ -690,8 +690,9 @@ class FileMetaData::FileMetaDataImpl {
   }
 
   void AppendRowGroups(const std::unique_ptr<FileMetaDataImpl>& other) {
-    if (!schema()->Equals(*other->schema())) {
-      throw ParquetException("AppendRowGroups requires equal schemas.");

Review Comment:
   I would keep this original sentence as the start of the new message (it's 
still useful to know the context of why the schema difference is printed)



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