Skip to content

Commit 602b681

Browse files
committed
fix unit tests
1 parent b527816 commit 602b681

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/parquet_test.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
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

0 commit comments

Comments
 (0)