LouisClt commented on code in PR #14219:
URL: https://github.com/apache/arrow/pull/14219#discussion_r1023045420


##########
cpp/src/arrow/adapters/orc/adapter.cc:
##########
@@ -727,12 +727,22 @@ class ORCFileWriter::Impl {
   }
 
   Status Write(const Table& table) {
-    ARROW_ASSIGN_OR_RAISE(auto orc_schema, GetOrcType(*(table.schema())));
-    ARROW_ASSIGN_OR_RAISE(auto orc_options, 
MakeOrcWriterOptions(write_options_));
+    if (!writer_.get()) {
+      ARROW_ASSIGN_OR_RAISE(orc_schema_, GetOrcType(*(table.schema())));
+      ARROW_ASSIGN_OR_RAISE(auto orc_options, 
MakeOrcWriterOptions(write_options_));
+      arrow_schema_ = table.schema();
+      ORC_CATCH_NOT_OK(
+          writer_ = liborc::createWriter(*orc_schema_, out_stream_.get(), 
orc_options))
+    } else {
+      bool schemas_matching = table.schema()->Equals(arrow_schema_, false);
+      if (!schemas_matching) {
+        return Status::Invalid(

Review Comment:
   Yes, I made the change. I also added some info by printing both schemas in 
the error message.



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