alamb commented on code in PR #2024:
URL: https://github.com/apache/arrow-rs/pull/2024#discussion_r916299588
##########
arrow/src/datatypes/field.rs:
##########
@@ -144,19 +145,62 @@ impl Field {
&self.name
}
- /// Returns an immutable reference to the `Field`'s data-type.
+ /// Set the name of the [`Field`].
+ ///
+ /// ```
+ /// # use arrow::datatypes::*;
+ /// let field = Field::new("c1", DataType::Int64, false)
+ /// .with_name("c2");
+ ///
+ /// assert_eq!(field.name(), "c2");
+ /// ```
+ pub fn with_name(mut self, name: impl Into<String>) -> Self {
+ self.name = name.into();
+ self
+ }
+
+ /// Returns an immutable reference to the [`Field`]'s [`DataType`].
#[inline]
pub const fn data_type(&self) -> &DataType {
&self.data_type
}
- /// Indicates whether this `Field` supports null values.
+ /// Set [`DataType`] of the [`Field`]
Review Comment:
```suggestion
/// Set [`DataType`] of the [`Field`] and return self
```
--
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]