pitrou commented on code in PR #14219:
URL: https://github.com/apache/arrow/pull/14219#discussion_r1022994287
##########
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:
Can we return `TypeError` here?
##########
cpp/src/arrow/adapters/orc/adapter_test.cc:
##########
@@ -241,7 +241,9 @@ void AssertTableWriteReadEqual(const
std::shared_ptr<Table>& input_table,
write_options.row_index_stride = 5000;
EXPECT_OK_AND_ASSIGN(auto writer, adapters::orc::ORCFileWriter::Open(
buffer_output_stream.get(),
write_options));
- ARROW_EXPECT_OK(writer->Write(*input_table));
+ for (auto& input_table : input_tables) {
Review Comment:
Nit
```suggestion
for (const auto& input_table : input_tables) {
```
--
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]