Copilot commented on code in PR #158:
URL: https://github.com/apache/fluss-rust/pull/158#discussion_r2689743107
##########
crates/fluss/src/metadata/datatype.rs:
##########
@@ -857,6 +857,20 @@ impl RowType {
self.fields.iter().position(|f| f.name == field_name)
}
+ pub fn get_field_names(&self) -> Vec<&str> {
+ self.fields.iter().map(|f| f.name.as_str()).collect()
+ }
+
+ pub fn project(&self, project_field_positions: &[usize]) -> RowType {
+ RowType::with_nullable(
+ self.nullable,
+ project_field_positions
+ .iter()
+ .map(|pos| self.fields.get(*pos).unwrap().clone())
Review Comment:
The use of `unwrap()` will panic if any position in
`project_field_positions` is out of bounds for `self.fields`. Consider using a
Result return type and proper error handling instead, or add documentation
stating that this method assumes valid positions and will panic otherwise.
--
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]