Skip to content

Commit

Permalink
More trivial implementation of Box<dyn AsyncArrowWriter> and `Box<d…
Browse files Browse the repository at this point in the history
…yn AsyncArrowReader>` (#6748)

* Wilder implementor of Box<dyn AsyncArrowWriter> and Box<dyn AsyncArrowReader> in parquet

* Update parquet/src/arrow/async_reader/mod.rs

Co-authored-by: Jay Zhan <[email protected]>

* remove empty line

---------

Co-authored-by: Jay Zhan <[email protected]>
  • Loading branch information
ethe and jayzhan211 authored Nov 20, 2024
1 parent 390f0ba commit 70f415d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion parquet/src/arrow/async_reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ pub trait AsyncFileReader: Send {
fn get_metadata(&mut self) -> BoxFuture<'_, Result<Arc<ParquetMetaData>>>;
}

impl AsyncFileReader for Box<dyn AsyncFileReader> {
/// This allows Box<dyn AsyncFileReader + '_> to be used as an AsyncFileReader,
impl<'reader> AsyncFileReader for Box<dyn AsyncFileReader + 'reader> {
fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, Result<Bytes>> {
self.as_mut().get_bytes(range)
}
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/arrow/async_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub trait AsyncFileWriter: Send {
fn complete(&mut self) -> BoxFuture<'_, Result<()>>;
}

impl AsyncFileWriter for Box<dyn AsyncFileWriter> {
impl<'writer> AsyncFileWriter for Box<dyn AsyncFileWriter + 'writer> {
fn write(&mut self, bs: Bytes) -> BoxFuture<'_, Result<()>> {
self.as_mut().write(bs)
}
Expand Down

0 comments on commit 70f415d

Please sign in to comment.