Skip to content

Apache DataFusion SQL Query Engine

feat: Add file_schema, cache, and expr_adapter_factory accessors to ListingTable and ListingTableConfig (#27363)

Sruhvx60e3d5c40487
diff --git a/datafusion/catalog-listing/src/config.rs b/datafusion/catalog-listing/src/config.rs
index d1bcff2c75..ede1894b27 100644
--- a/datafusion/catalog-listing/src/config.rs
+++ b/datafusion/catalog-listing/src/config.rs
@@ -269,6 +269,11 @@ impl ListingTableConfig {
}
}
+ /// Returns the [`PhysicalExprAdapterFactory`] used by this configuration, if set.
+ pub fn expr_adapter_factory(&self) -> Option<&Arc<dyn PhysicalExprAdapterFactory>> {
+ self.expr_adapter_factory.as_ref()
+ }
+
/// Set the [`PhysicalExprAdapterFactory`] for the [`crate::ListingTable`]
///
/// The expression adapter factory is used to create physical expression adapters that can
diff --git a/datafusion/catalog-listing/src/table.rs b/datafusion/catalog-listing/src/table.rs
index b6e70667a8..05e3c6c9d1 100644
--- a/datafusion/catalog-listing/src/table.rs
+++ b/datafusion/catalog-listing/src/table.rs
@@ -302,6 +302,11 @@ impl ListingTable {
self
}
+ /// Returns the [`FileStatisticsCache`] used to cache parquet file statistics, if set.
+ pub fn cache(&self) -> Option<&Arc<FileStatisticsCache>> {
+ self.collected_statistics.as_ref()
+ }
+
/// Specify the SQL definition for this table, if any
pub fn with_definition(mut self, definition: Option<String>) -> Self {
self.definition = definition;
@@ -323,6 +328,11 @@ impl ListingTable {
self.schema_source
}
+ /// Returns the physical schema of the files, excluding partition columns.
+ pub fn file_schema(&self) -> &SchemaRef {
+ &self.file_schema
+ }
+
/// Deprecated: Set the [`SchemaAdapterFactory`] for this [`ListingTable`]
///
/// `SchemaAdapterFactory` has been removed. Use [`ListingTableConfig::with_expr_adapter_factory`]