Skip to content

Commit

Permalink
Add factory method to PartitionedFile to create filescan link (#6909)
Browse files Browse the repository at this point in the history
  • Loading branch information
comphead authored Jul 11, 2023
1 parent 19c4253 commit 06fe066
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datafusion/core/src/datasource/listing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ impl PartitionedFile {
extensions: None,
}
}

/// Return a file reference from the given path
pub fn from_path(path: String) -> Result<Self> {
let size = std::fs::metadata(path.clone())?.len();
Ok(Self::new(path, size))
}
}

impl From<ObjectMeta> for PartitionedFile {
Expand Down

0 comments on commit 06fe066

Please sign in to comment.