gabotechs commented on code in PR #10206:
URL: https://github.com/apache/arrow-rs/pull/10206#discussion_r3467055329
##########
arrow-flight/src/decode.rs:
##########
@@ -250,9 +254,17 @@ impl FlightDataDecoder {
state: None,
response: response.boxed(),
done: false,
+ skip_validation: false,
}
}
+ /// Only set for trusted senders, invalid data may cause undefined
behavior.
+ /// Can improve performance by skipping validation
+ pub fn with_skip_validation(mut self, skip_validation: bool) -> Self {
+ self.skip_validation = skip_validation;
+ self
+ }
Review Comment:
Rather than exposing this as a plan `bool` flag, I think we should be
requiring an `UnsafeFlag` here.
By requiring an `UnsafeFlag`, we force consumers to explicitly have an
`unsafe` block in their codebase, making sure they are aware that what they are
doing is not safe, and that they are responsible for ensuring memory safety
there.
##########
arrow-flight/src/utils.rs:
##########
@@ -70,12 +71,13 @@ pub fn flight_data_to_arrow_batch(
})
.map(|batch| {
reader::read_record_batch(
- &Buffer::from(data.data_body.as_ref()),
+ &Buffer::from(data.data_body.clone()),
Review Comment:
Nice! I this is a sneaky one, but indeed this is avoiding a full clone
--
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]