File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2626#include < arrow/table.h>
2727#include < arrow/type.h>
2828#include < arrow/util/key_value_metadata.h>
29+ #include < iceberg/arrow_c_data_guard_internal.h>
2930#include < iceberg/file_reader.h>
3031#include < iceberg/file_writer.h>
3132#include < iceberg/result.h>
@@ -52,9 +53,14 @@ Status WriteTable(std::shared_ptr<::arrow::Array> data,
5253 const WriterOptions& writer_options) {
5354 ArrowArray arr;
5455 ICEBERG_ARROW_RETURN_NOT_OK (::arrow::ExportArray (*data, &arr));
55- ICEBERG_ASSIGN_OR_RAISE (
56- auto writer, WriterFactoryRegistry::Open (FileFormatType::kParquet , writer_options));
57- ICEBERG_RETURN_UNEXPECTED (writer->Write (arr));
56+
57+ std::unique_ptr<Writer> writer;
58+ {
59+ internal::ArrowArrayGuard guard (&arr);
60+ ICEBERG_ASSIGN_OR_RAISE (
61+ writer, WriterFactoryRegistry::Open (FileFormatType::kParquet , writer_options));
62+ ICEBERG_RETURN_UNEXPECTED (writer->Write (arr));
63+ }
5864 return writer->Close ();
5965}
6066
You can’t perform that action at this time.
0 commit comments