This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 06fe066871 Add factory method to PartitionedFile to create filescan
link (#6909)
06fe066871 is described below
commit 06fe0668710205d6c9f0ffe6d31b2975e3ce94b9
Author: comphead <[email protected]>
AuthorDate: Tue Jul 11 14:24:04 2023 -0700
Add factory method to PartitionedFile to create filescan link (#6909)
---
datafusion/core/src/datasource/listing/mod.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/datafusion/core/src/datasource/listing/mod.rs
b/datafusion/core/src/datasource/listing/mod.rs
index 151efe5cba..aa2e20164b 100644
--- a/datafusion/core/src/datasource/listing/mod.rs
+++ b/datafusion/core/src/datasource/listing/mod.rs
@@ -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 {