File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 2323#include < arrow/api.h>
2424#include < arrow/type.h>
2525
26+ #define R_ERROR_NOT_OK (s ) do { if (!s.ok ()) Rcpp::stop (s.ToString ()); } while (0 );
27+
2628template <typename T>
2729class static_ptr {
2830public:
Original file line number Diff line number Diff line change @@ -141,18 +141,16 @@ std::shared_ptr<arrow::Schema> Table_schema(const std::shared_ptr<arrow::Table>&
141141// [[Rcpp::export]]
142142int RecordBatch_to_file (const std::shared_ptr<arrow::RecordBatch>& batch, std::string path) {
143143 std::shared_ptr<arrow::io::OutputStream> stream;
144- auto s = arrow::io::FileOutputStream::Open (path, &stream);
145-
146144 std::shared_ptr<arrow::ipc::RecordBatchWriter> file_writer;
147- s = arrow::ipc::RecordBatchFileWriter::Open (stream.get (), batch->schema (), &file_writer);
148- s = file_writer->WriteRecordBatch (*batch, true );
149- s = file_writer->Close ();
145+
146+ R_ERROR_NOT_OK (arrow::io::FileOutputStream::Open (path, &stream));
147+ R_ERROR_NOT_OK (arrow::ipc::RecordBatchFileWriter::Open (stream.get (), batch->schema (), &file_writer));
148+ R_ERROR_NOT_OK (file_writer->WriteRecordBatch (*batch, true ));
149+ R_ERROR_NOT_OK (file_writer->Close ());
150+
150151 int64_t offset;
151- s = stream->Tell (&offset);
152- s = stream->Close ();
152+ R_ERROR_NOT_OK ( stream->Tell (&offset) );
153+ R_ERROR_NOT_OK ( stream->Close () );
153154 return offset;
154155}
155156
156-
157-
158-
You can’t perform that action at this time.
0 commit comments