Skip to content

Apache DataFusion SQL Query Engine

ARROW-1195: [Rust] [DataFusion] Add accessor methods for Parquet and CSV TableProviders

Andy Groveddad8c2b89ae
diff --git a/rust/datafusion/src/datasource/csv.rs b/rust/datafusion/src/datasource/csv.rs
index 6b5a79531d..898e0c6b10 100644
--- a/rust/datafusion/src/datasource/csv.rs
+++ b/rust/datafusion/src/datasource/csv.rs
@@ -81,6 +81,26 @@ impl CsvFile {
statistics: Statistics::default(),
})
}
+
+ /// Get the path for the CSV file(s) represented by this CsvFile instance
+ pub fn path(&self) -> &str {
+ &self.path
+ }
+
+ /// Determine whether the CSV file(s) represented by this CsvFile instance have a header row
+ pub fn has_header(&self) -> bool {
+ self.has_header
+ }
+
+ /// Get the delimiter for the CSV file(s) represented by this CsvFile instance
+ pub fn delimiter(&self) -> u8 {
+ self.delimiter
+ }
+
+ /// Get the file extension for the CSV file(s) represented by this CsvFile instance
+ pub fn file_extension(&self) -> &str {
+ &self.file_extension
+ }
}
impl TableProvider for CsvFile {
diff --git a/rust/datafusion/src/datasource/parquet.rs b/rust/datafusion/src/datasource/parquet.rs
index a9d69a6f9b..3e60d03eb2 100644
--- a/rust/datafusion/src/datasource/parquet.rs
+++ b/rust/datafusion/src/datasource/parquet.rs
@@ -50,6 +50,11 @@ impl ParquetTable {
max_concurrency,
})
}
+
+ /// Get the path for the Parquet file(s) represented by this ParquetTable instance
+ pub fn path(&self) -> &str {
+ &self.path
+ }
}
impl TableProvider for ParquetTable {