alamb commented on code in PR #6424:
URL: https://github.com/apache/arrow-rs/pull/6424#discussion_r1768819672
##########
arrow-buffer/src/util/bit_chunk_iterator.rs:
##########
@@ -212,6 +219,7 @@ pub struct BitChunks<'a> {
}
impl<'a> BitChunks<'a> {
+ /// Create a new [`BitChunks`] from a byte array, and and an offset and
length in bits
Review Comment:
Thank you -- the fact that the length is in bits I think is real value add
to this documentation
```suggestion
/// Create a new [`BitChunks`] from a byte array, and an offset and
length in bits
```
##########
arrow-csv/src/reader/mod.rs:
##########
@@ -236,31 +236,39 @@ pub struct Format {
}
impl Format {
+ /// Specify whether the CSV file has a header, defaults to `true`
Review Comment:
The docs in this module, with the defaults listed, is also a great
improvement
##########
arrow-buffer/src/bigint/mod.rs:
##########
@@ -216,6 +216,7 @@ impl i256 {
}
}
+ /// Create an integer value from its 128-bit counterpart.
Review Comment:
```suggestion
/// Create an `i256` value from a 128-bit value.
```
##########
arrow-csv/src/reader/mod.rs:
##########
@@ -236,31 +236,39 @@ pub struct Format {
}
impl Format {
+ /// Specify whether the CSV file has a header, defaults to `true`
+ ///
+ /// When `true`, the first row of the CSV file is treated as a header row
pub fn with_header(mut self, has_header: bool) -> Self {
self.header = has_header;
self
}
+ /// Specify a custom delimiter character, defaults to comma `','`
pub fn with_delimiter(mut self, delimiter: u8) -> Self {
self.delimiter = Some(delimiter);
self
}
+ /// Specify an escape character
Review Comment:
What is the default? `None`?
##########
arrow-cast/src/parse.rs:
##########
@@ -432,8 +432,12 @@ fn string_to_time(s: &str) -> Option<NaiveTime> {
/// assert_eq!(ts, 1609459200123456789);
/// ```
pub trait Parser: ArrowPrimitiveType {
+ /// Method to parse a string to the native type
Review Comment:
```suggestion
/// Parse a string to the native type
```
##########
arrow-cast/src/parse.rs:
##########
@@ -432,8 +432,12 @@ fn string_to_time(s: &str) -> Option<NaiveTime> {
/// assert_eq!(ts, 1609459200123456789);
/// ```
pub trait Parser: ArrowPrimitiveType {
+ /// Method to parse a string to the native type
fn parse(string: &str) -> Option<Self::Native>;
+ /// Method to parse a string to the native type with a format string
Review Comment:
```suggestion
/// Parse a string to the native type with a format string
```
##########
arrow/src/pyarrow.rs:
##########
@@ -77,23 +77,32 @@ use crate::ffi_stream::{ArrowArrayStreamReader,
FFI_ArrowArrayStream};
use crate::record_batch::RecordBatch;
import_exception!(pyarrow, ArrowException);
+/// Represents an exception raised by PyArrow.
pub type PyArrowException = ArrowException;
fn to_py_err(err: ArrowError) -> PyErr {
PyArrowException::new_err(err.to_string())
}
+/// Trait for converting PyArrow objects to arrow-rs types, opposite of
[ToPyArrow] or [IntoPyArrow].
+///
+/// This is an easy way to keep track of the types that have been implemented.
Review Comment:
I don't really understand this comment
##########
arrow/src/util/string_writer.rs:
##########
@@ -92,13 +89,13 @@ impl std::fmt::Display for StringWriter {
impl Write for StringWriter {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
- let string = match String::from_utf8(buf.to_vec()) {
+ let string = match str::from_utf8(buf) {
Review Comment:
🚀 nice dive by cleanup
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]