tustvold commented on code in PR #6983: URL: https://github.com/apache/arrow-rs/pull/6983#discussion_r1925381805
########## arrow-ipc/src/reader.rs: ########## @@ -993,7 +997,45 @@ impl FileReaderBuilder { } } -/// Arrow File reader +/// Arrow File Reader +/// +/// Reads Arrow [`RecordBatch`]es from bytes in the [IPC File Format], +/// providing random access to the record batches. +/// +/// # See Also +/// +/// * [`Self::set_index`] for random access +/// * [`StreamReader`] for a reading streaming data Review Comment: ```suggestion /// * [`StreamReader`] for reading streaming data ``` ########## arrow-ipc/src/writer.rs: ########## @@ -905,7 +909,30 @@ impl DictionaryTracker { } } -/// Writer for an IPC file +/// Arrow File Writer +/// +/// Writes Arrow [`RecordBatch`]es in the [IPC File Format]. +/// +/// # See Also +/// +/// * [`StreamWriter`] for writing IPC Streams +/// +/// # Example +/// ``` +/// # use arrow_array::record_batch; +/// # use arrow_ipc::writer::StreamWriter; +/// # let mut file = vec![]; // mimic a file for the example +/// let batch = record_batch!(("a", Int32, [1, 2, 3])).unwrap(); +/// // create a new writer, the schema must be known in advance +/// let mut writer = StreamWriter::try_new(&mut file, &batch.schema()).unwrap(); +/// // write each batch to the underlying writer +/// writer.write(&batch).unwrap(); +/// // When all batches are written, call finish to flush all buffers +/// writer.finish().unwrap(); +/// // must drop the writer to release the reference to the file. +/// drop(writer); Review Comment: ```suggestion ``` I don't think this is necessary, the writer will get dropped at the end of the scope regardless ########## arrow-ipc/src/writer.rs: ########## @@ -1135,7 +1162,31 @@ impl<W: Write> RecordBatchWriter for FileWriter<W> { } } -/// Writer for an IPC stream +/// Arrow Stream Writer +/// +/// Writes Arrow [`RecordBatch`]es to bytes using the [IPC Streaming Format]. +/// +/// # See Also +/// +/// * [`FileWriter`] for writing IPC Files +/// +/// # Example +/// ``` +/// # use arrow_array::record_batch; +/// # use arrow_ipc::writer::StreamWriter; +/// # let mut stream = vec![]; // mimic a stream for the example +/// let batch = record_batch!(("a", Int32, [1, 2, 3])).unwrap(); +/// // create a new writer, the schema must be known in advance +/// let mut writer = StreamWriter::try_new(&mut stream, &batch.schema()).unwrap(); +/// // write each batch to the underlying stream +/// writer.write(&batch).unwrap(); +/// // When all batches are written, call finish to flush all buffers +/// writer.finish().unwrap(); +/// // must drop the writer to release the stream reference +/// drop(writer); Review Comment: ```suggestion ``` I don't think this is necessary? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org