@@ -53,9 +53,6 @@ Result<std::unique_ptr<AvroOutputStream>> CreateOutputStream(const WriterOptions
5353
5454} // namespace
5555
56- // A stateful context to keep track of the writing progress.
57- struct WriteContext {};
58-
5956class AvroWriter ::Impl {
6057 public:
6158 Status Open (const WriterOptions& options) {
@@ -70,7 +67,7 @@ class AvroWriter::Impl {
7067 constexpr int64_t kDefaultBufferSize = 1024 * 1024 ;
7168 ICEBERG_ASSIGN_OR_RAISE (auto output_stream,
7269 CreateOutputStream (options, kDefaultBufferSize ));
73- arrow_output_stream_ = output_stream->get_output_stream ();
70+ arrow_output_stream_ = output_stream->arrow_output_stream ();
7471 writer_ = std::make_unique<::avro::DataFileWriter<::avro::GenericDatum>>(
7572 std::move (output_stream), *avro_schema_);
7673 datum_ = std::make_unique<::avro::GenericDatum>(*avro_schema_);
@@ -105,19 +102,19 @@ class AvroWriter::Impl {
105102 int64_t length () { return total_bytes_; }
106103
107104 private:
108- int64_t total_bytes_ = 0 ;
109105 // The schema to write.
110106 std::shared_ptr<::iceberg::Schema> write_schema_;
111107 // The avro schema to write.
112108 std::shared_ptr<::avro::ValidSchema> avro_schema_;
109+ // Arrow output stream of the Avro file to write
110+ std::shared_ptr<::arrow::io::OutputStream> arrow_output_stream_;
113111 // The avro writer to write the data into a datum.
114112 std::unique_ptr<::avro::DataFileWriter<::avro::GenericDatum>> writer_;
115- // Arrow schema for data conversion (C API format)
116- ArrowSchema arrow_schema_;
117- // Reusable Avro datum for writing individual records
113+ // Reusable Avro datum for writing individual records.
118114 std::unique_ptr<::avro::GenericDatum> datum_;
119- // Arrow output stream for writing data to filesystem
120- std::shared_ptr<::arrow::io::OutputStream> arrow_output_stream_;
115+ // Arrow schema to write data.
116+ ArrowSchema arrow_schema_;
117+ int64_t total_bytes_ = 0 ;
121118};
122119
123120AvroWriter::~AvroWriter () = default ;
0 commit comments