Skip to content

Commit

Permalink
Add TableProvider.statistics method (apache#3986)
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Oct 28, 2022
1 parent 0678093 commit 4ea970d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions datafusion/common/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// specific language governing permissions and limitations
// under the License.

//! This module provides an interface for plan level statistics.
//! This module provides data structures to represent statistics

use crate::ScalarValue;

/// Statistics for a physical plan node
/// Statistics for a relation
/// Fields are optional and can be inexact because the sources
/// sometimes provide approximate estimates for performance reasons
/// and the transformations output are not always predictable.
Expand All @@ -37,7 +37,7 @@ pub struct Statistics {
pub is_exact: bool,
}

/// This table statistics are estimates about column
/// Statistics for a column within a relation
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct ColumnStatistics {
/// Number of null values on column
Expand Down
6 changes: 6 additions & 0 deletions datafusion/core/src/datasource/datasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::any::Any;
use std::sync::Arc;

use async_trait::async_trait;
use datafusion_common::Statistics;
use datafusion_expr::LogicalPlan;
pub use datafusion_expr::{TableProviderFilterPushDown, TableType};

Expand Down Expand Up @@ -77,6 +78,11 @@ pub trait TableProvider: Sync + Send {
) -> Result<TableProviderFilterPushDown> {
Ok(TableProviderFilterPushDown::Unsupported)
}

/// Get statistics for this table, if available
fn statistics(&self) -> Option<Statistics> {
None
}
}

/// A factory which creates [`TableProvider`]s at runtime given a URL.
Expand Down

0 comments on commit 4ea970d

Please sign in to comment.