Skip to content

Commit

Permalink
Make FileStream and FileOpener public (apache#3514)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkharderdev committed Sep 20, 2022
1 parent 9d981da commit f3cdf6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions datafusion/core/src/physical_plan/file_format/file_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ use crate::physical_plan::RecordBatchStream;
pub type FileOpenFuture =
BoxFuture<'static, Result<BoxStream<'static, ArrowResult<RecordBatch>>>>;

/// Generic API for opening a file using an [`ObjectStore`] and resolving to a
/// stream of [`RecordBatch`]
pub trait FileOpener: Unpin {
/// Asynchronously open the specified file and return a stream
/// of [`RecordBatch`]
fn open(
&self,
store: Arc<dyn ObjectStore>,
Expand Down Expand Up @@ -167,6 +171,7 @@ impl FileStreamMetrics {
}

impl<F: FileOpener> FileStream<F> {
/// Create a new `FileStream` using the give `FileOpener` to scan underlying files
pub fn new(
config: &FileScanConfig,
partition: usize,
Expand Down
1 change: 1 addition & 0 deletions datafusion/core/src/physical_plan/file_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use arrow::{
record_batch::RecordBatch,
};
pub use avro::AvroExec;
pub use file_stream::{FileOpenFuture, FileOpener, FileStream};
pub(crate) use json::plan_to_json;
pub use json::NdJsonExec;

Expand Down

0 comments on commit f3cdf6b

Please sign in to comment.