2727#include < arrow/result.h>
2828#include < avro/DataFile.hh>
2929#include < avro/GenericDatum.hh>
30- #include < avro/NodeImpl.hh>
3130
31+ #include " iceberg/arrow/arrow_error_transform_internal.h"
3232#include " iceberg/arrow/arrow_fs_file_io_internal.h"
3333#include " iceberg/avro/avro_schema_util_internal.h"
3434#include " iceberg/avro/avro_stream_internal.h"
@@ -43,12 +43,8 @@ namespace {
4343Result<std::unique_ptr<AvroOutputStream>> CreateOutputStream (const WriterOptions& options,
4444 int64_t buffer_size) {
4545 auto io = internal::checked_pointer_cast<arrow::ArrowFileSystemFileIO>(options.io );
46- auto result = io->fs ()->OpenOutputStream (options.path );
47- if (!result.ok ()) {
48- return IOError (" Failed to open file {} for {}" , options.path ,
49- result.status ().message ());
50- }
51- return std::make_unique<AvroOutputStream>(result.MoveValueUnsafe (), buffer_size);
46+ ICEBERG_ARROW_ASSIGN_OR_RETURN (auto output, io->fs ()->OpenOutputStream (options.path ));
47+ return std::make_unique<AvroOutputStream>(output, buffer_size);
5248}
5349
5450} // namespace
@@ -120,19 +116,19 @@ Status AvroWriter::Close() {
120116 return {};
121117}
122118
123- Metrics AvroWriter::metrics () {
119+ std::optional< Metrics> AvroWriter::metrics () {
124120 if (impl_->Closed ()) {
125121 // TODO(xiao.dong) implement metrics
126122 return {};
127123 }
128- return {} ;
124+ return std:: nullopt ;
129125}
130126
131- int64_t AvroWriter::length () {
127+ std::optional< int64_t > AvroWriter::length () {
132128 if (impl_->Closed ()) {
133129 return impl_->length ();
134130 }
135- return 0 ;
131+ return std:: nullopt ;
136132}
137133
138134std::vector<int64_t > AvroWriter::split_offsets () { return {}; }
0 commit comments