pub struct CountStatisticsRule;Expand description
Optimizer rule that replaces count() with constants from table statistics
Implementations§
Source§impl CountStatisticsRule
impl CountStatisticsRule
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/common/mod.rs (line 53)
50pub fn create_local_context() -> SessionContext {
51 let state = SessionStateBuilder::new()
52 .with_default_features()
53 .with_optimizer_rule(Arc::new(CountStatisticsRule::new()))
54 .with_optimizer_rule(Arc::new(MinMaxStatisticsRule::new()))
55 .build();
56 SessionContext::new_with_state(state)
57}
58
59/// Create a SessionContext configured for remote Zarr access (GCS, S3, etc).
60///
61/// Includes ZarrTableFactory for `CREATE EXTERNAL TABLE ... STORED AS ZARR`,
62/// plus CountStatisticsRule and MinMaxStatisticsRule optimizers.
63pub fn create_remote_context() -> SessionContext {
64 let state = SessionStateBuilder::new()
65 .with_default_features()
66 .with_table_factories(HashMap::from([(
67 "ZARR".to_string(),
68 Arc::new(ZarrTableFactory) as _,
69 )]))
70 .with_optimizer_rule(Arc::new(CountStatisticsRule::new()))
71 .with_optimizer_rule(Arc::new(MinMaxStatisticsRule::new()))
72 .build();
73 SessionContext::new_with_state(state)
74}Trait Implementations§
Source§impl Debug for CountStatisticsRule
impl Debug for CountStatisticsRule
Source§impl Default for CountStatisticsRule
impl Default for CountStatisticsRule
Source§fn default() -> CountStatisticsRule
fn default() -> CountStatisticsRule
Returns the “default value” for a type. Read more
Source§impl OptimizerRule for CountStatisticsRule
impl OptimizerRule for CountStatisticsRule
Source§fn apply_order(&self) -> Option<ApplyOrder>
fn apply_order(&self) -> Option<ApplyOrder>
How should the rule be applied by the optimizer? See comments on
ApplyOrder for details. Read moreSource§fn supports_rewrite(&self) -> bool
fn supports_rewrite(&self) -> bool
👎Deprecated since 47.0.0: This method is no longer used
Does this rule support rewriting owned plans (rather than by reference)?
Source§fn rewrite(
&self,
plan: LogicalPlan,
_config: &dyn OptimizerConfig,
) -> Result<Transformed<LogicalPlan>>
fn rewrite( &self, plan: LogicalPlan, _config: &dyn OptimizerConfig, ) -> Result<Transformed<LogicalPlan>>
Try to rewrite
plan to an optimized form, returning Transformed::yes
if the plan was rewritten and Transformed::no if it was not.Auto Trait Implementations§
impl Freeze for CountStatisticsRule
impl RefUnwindSafe for CountStatisticsRule
impl Send for CountStatisticsRule
impl Sync for CountStatisticsRule
impl Unpin for CountStatisticsRule
impl UnwindSafe for CountStatisticsRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more