@@ -239,10 +239,13 @@ garrow_record_batch_stream_writer_new(GArrowOutputStream *sink,
239239                                      GError **error)
240240{
241241  auto  arrow_sink = garrow_output_stream_get_raw (sink).get ();
242-   std::shared_ptr<arrow::ipc::RecordBatchWriter> arrow_writer;
243-   auto  status = arrow::ipc::NewStreamWriter (
244-       arrow_sink, garrow_schema_get_raw (schema)).Value (&arrow_writer);
245-   if  (garrow_error_check (error, status, " [record-batch-stream-writer][open]" 
242+   auto  arrow_schema = garrow_schema_get_raw (schema);
243+   auto  arrow_writer_result =
244+     arrow::ipc::NewStreamWriter (arrow_sink, arrow_schema);
245+   if  (garrow::check (error,
246+                     arrow_writer_result,
247+                     " [record-batch-stream-writer][open]" 
248+     auto  arrow_writer = *arrow_writer_result;
246249    return  garrow_record_batch_stream_writer_new_raw (&arrow_writer);
247250  } else  {
248251    return  NULL ;
@@ -280,11 +283,15 @@ garrow_record_batch_file_writer_new(GArrowOutputStream *sink,
280283                       GArrowSchema *schema,
281284                       GError **error)
282285{
283-   auto  arrow_sink = garrow_output_stream_get_raw (sink);
286+   auto  arrow_sink = garrow_output_stream_get_raw (sink).get ();
287+   auto  arrow_schema = garrow_schema_get_raw (schema);
284288  std::shared_ptr<arrow::ipc::RecordBatchWriter> arrow_writer;
285-   auto  status = arrow::ipc::NewFileWriter (
286-       arrow_sink.get (), garrow_schema_get_raw (schema)).Value (&arrow_writer);
287-   if  (garrow_error_check (error, status, " [record-batch-file-writer][open]" 
289+   auto  arrow_writer_result =
290+     arrow::ipc::NewFileWriter (arrow_sink, arrow_schema);
291+   if  (garrow::check (error,
292+                     arrow_writer_result,
293+                     " [record-batch-file-writer][open]" 
294+     auto  arrow_writer = *arrow_writer_result;
288295    return  garrow_record_batch_file_writer_new_raw (&arrow_writer);
289296  } else  {
290297    return  NULL ;
0 commit comments