async fn execute(&self, partition: usize) -> Result<Pin<Box<dyn BatchStream + Send + Sync>>>;
In general: No. If you have a function in the form async fn f() -> Box<dyn Trait>, there is no need for Pin.
However, returning a Future or Stream is a special case. So if BatchStream is an alias, or supertrait, or just mimics the Stream trait, then the Pin is likely necessary for the return value to be useful.
See other Q&As that explain where Pin is needed with Streams:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With