diff --git a/datafusion/macros/src/user_doc.rs b/datafusion/macros/src/user_doc.rs index 71ce381ec431..58c2cc2b1b2a 100644 --- a/datafusion/macros/src/user_doc.rs +++ b/datafusion/macros/src/user_doc.rs @@ -61,7 +61,6 @@ use syn::{parse_macro_input, DeriveInput, LitStr}; /// } /// ``` /// will generate the following code -/// /// ```ignore /// pub struct ToDateFunc { /// signature: Signature, diff --git a/datafusion/optimizer/src/push_down_filter.rs b/datafusion/optimizer/src/push_down_filter.rs index a8251d669002..1c0790b3e3ac 100644 --- a/datafusion/optimizer/src/push_down_filter.rs +++ b/datafusion/optimizer/src/push_down_filter.rs @@ -562,7 +562,6 @@ fn push_down_join( /// /// * `on_filters` filters from the join ON clause that have not already been /// identified as join predicates -/// fn infer_join_predicates( join: &Join, predicates: &[Expr], @@ -649,7 +648,6 @@ impl InferredPredicates { /// * `predicates` the pushed down predicates /// /// * `inferred_predicates` the inferred results -/// fn infer_join_predicates_from_predicates( join_col_keys: &[(&Column, &Column)], predicates: &[Expr], @@ -673,7 +671,6 @@ fn infer_join_predicates_from_predicates( /// identified as join predicates /// /// * `inferred_predicates` the inferred results -/// fn infer_join_predicates_from_on_filters( join_col_keys: &[(&Column, &Column)], join_type: JoinType, @@ -719,7 +716,6 @@ fn infer_join_predicates_from_on_filters( /// /// * `ENABLE_RIGHT_TO_LEFT` indicates that the left table related predicate can /// be inferred from the right table related predicate -/// fn infer_join_predicates_impl< const ENABLE_LEFT_TO_RIGHT: bool, const ENABLE_RIGHT_TO_LEFT: bool, diff --git a/datafusion/optimizer/src/push_down_limit.rs b/datafusion/optimizer/src/push_down_limit.rs index c5a2e6578805..80d4a2de6679 100644 --- a/datafusion/optimizer/src/push_down_limit.rs +++ b/datafusion/optimizer/src/push_down_limit.rs @@ -30,7 +30,6 @@ use datafusion_expr::logical_plan::{Join, JoinType, Limit, LogicalPlan}; use datafusion_expr::{lit, FetchType, SkipType}; /// Optimization rule that tries to push down `LIMIT`. -/// //. It will push down through projection, limits (taking the smaller limit) #[derive(Default, Debug)] pub struct PushDownLimit {} diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs index 204ce14e37d8..85e9d9b6a0ed 100644 --- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs +++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs @@ -69,23 +69,21 @@ use regex::Regex; /// /// For example: /// ``` -/// use arrow::datatypes::{Schema, Field, DataType}; -/// use datafusion_expr::{col, lit}; +/// use arrow::datatypes::{DataType, Field, Schema}; /// use datafusion_common::{DataFusionError, ToDFSchema}; /// use datafusion_expr::execution_props::ExecutionProps; /// use datafusion_expr::simplify::SimplifyContext; +/// use datafusion_expr::{col, lit}; /// use datafusion_optimizer::simplify_expressions::ExprSimplifier; /// /// // Create the schema -/// let schema = Schema::new(vec![ -/// Field::new("i", DataType::Int64, false), -/// ]) -/// .to_dfschema_ref().unwrap(); +/// let schema = Schema::new(vec![Field::new("i", DataType::Int64, false)]) +/// .to_dfschema_ref() +/// .unwrap(); /// /// // Create the simplifier /// let props = ExecutionProps::new(); -/// let context = SimplifyContext::new(&props) -/// .with_schema(schema); +/// let context = SimplifyContext::new(&props).with_schema(schema); /// let simplifier = ExprSimplifier::new(context); /// /// // Use the simplifier @@ -144,35 +142,35 @@ impl ExprSimplifier { /// /// ``` /// use arrow::datatypes::DataType; - /// use datafusion_expr::{col, lit, Expr}; + /// use datafusion_common::DFSchema; /// use datafusion_common::Result; /// use datafusion_expr::execution_props::ExecutionProps; /// use datafusion_expr::simplify::SimplifyContext; /// use datafusion_expr::simplify::SimplifyInfo; + /// use datafusion_expr::{col, lit, Expr}; /// use datafusion_optimizer::simplify_expressions::ExprSimplifier; - /// use datafusion_common::DFSchema; /// use std::sync::Arc; /// /// /// Simple implementation that provides `Simplifier` the information it needs /// /// See SimplifyContext for a structure that does this. /// #[derive(Default)] /// struct Info { - /// execution_props: ExecutionProps, + /// execution_props: ExecutionProps, /// }; /// /// impl SimplifyInfo for Info { - /// fn is_boolean_type(&self, expr: &Expr) -> Result { - /// Ok(false) - /// } - /// fn nullable(&self, expr: &Expr) -> Result { - /// Ok(true) - /// } - /// fn execution_props(&self) -> &ExecutionProps { - /// &self.execution_props - /// } - /// fn get_data_type(&self, expr: &Expr) -> Result { - /// Ok(DataType::Int32) - /// } + /// fn is_boolean_type(&self, expr: &Expr) -> Result { + /// Ok(false) + /// } + /// fn nullable(&self, expr: &Expr) -> Result { + /// Ok(true) + /// } + /// fn execution_props(&self) -> &ExecutionProps { + /// &self.execution_props + /// } + /// fn get_data_type(&self, expr: &Expr) -> Result { + /// Ok(DataType::Int32) + /// } /// } /// /// // Create the simplifier @@ -198,7 +196,6 @@ impl ExprSimplifier { /// optimizations. /// /// See [Self::simplify] for details and usage examples. - /// #[deprecated( since = "48.0.0", note = "Use `simplify_with_cycle_count_transformed` instead" @@ -222,7 +219,6 @@ impl ExprSimplifier { /// - The number of simplification cycles that were performed /// /// See [Self::simplify] for details and usage examples. - /// pub fn simplify_with_cycle_count_transformed( &self, mut expr: Expr, @@ -286,24 +282,24 @@ impl ExprSimplifier { /// /// ```rust /// use arrow::datatypes::{DataType, Field, Schema}; - /// use datafusion_expr::{col, lit, Expr}; - /// use datafusion_expr::interval_arithmetic::{Interval, NullableInterval}; /// use datafusion_common::{Result, ScalarValue, ToDFSchema}; /// use datafusion_expr::execution_props::ExecutionProps; + /// use datafusion_expr::interval_arithmetic::{Interval, NullableInterval}; /// use datafusion_expr::simplify::SimplifyContext; + /// use datafusion_expr::{col, lit, Expr}; /// use datafusion_optimizer::simplify_expressions::ExprSimplifier; /// /// let schema = Schema::new(vec![ - /// Field::new("x", DataType::Int64, false), - /// Field::new("y", DataType::UInt32, false), - /// Field::new("z", DataType::Int64, false), - /// ]) - /// .to_dfschema_ref().unwrap(); + /// Field::new("x", DataType::Int64, false), + /// Field::new("y", DataType::UInt32, false), + /// Field::new("z", DataType::Int64, false), + /// ]) + /// .to_dfschema_ref() + /// .unwrap(); /// /// // Create the simplifier /// let props = ExecutionProps::new(); - /// let context = SimplifyContext::new(&props) - /// .with_schema(schema); + /// let context = SimplifyContext::new(&props).with_schema(schema); /// /// // Expression: (x >= 3) AND (y + 2 < 10) AND (z > 5) /// let expr_x = col("x").gt_eq(lit(3_i64)); @@ -312,15 +308,18 @@ impl ExprSimplifier { /// let expr = expr_x.and(expr_y).and(expr_z.clone()); /// /// let guarantees = vec![ - /// // x ∈ [3, 5] - /// ( - /// col("x"), - /// NullableInterval::NotNull { - /// values: Interval::make(Some(3_i64), Some(5_i64)).unwrap() - /// } - /// ), - /// // y = 3 - /// (col("y"), NullableInterval::from(ScalarValue::UInt32(Some(3)))), + /// // x ∈ [3, 5] + /// ( + /// col("x"), + /// NullableInterval::NotNull { + /// values: Interval::make(Some(3_i64), Some(5_i64)).unwrap(), + /// }, + /// ), + /// // y = 3 + /// ( + /// col("y"), + /// NullableInterval::from(ScalarValue::UInt32(Some(3))), + /// ), /// ]; /// let simplifier = ExprSimplifier::new(context).with_guarantees(guarantees); /// let output = simplifier.simplify(expr).unwrap(); @@ -345,24 +344,24 @@ impl ExprSimplifier { /// /// ```rust /// use arrow::datatypes::{DataType, Field, Schema}; - /// use datafusion_expr::{col, lit, Expr}; - /// use datafusion_expr::interval_arithmetic::{Interval, NullableInterval}; /// use datafusion_common::{Result, ScalarValue, ToDFSchema}; /// use datafusion_expr::execution_props::ExecutionProps; + /// use datafusion_expr::interval_arithmetic::{Interval, NullableInterval}; /// use datafusion_expr::simplify::SimplifyContext; + /// use datafusion_expr::{col, lit, Expr}; /// use datafusion_optimizer::simplify_expressions::ExprSimplifier; /// /// let schema = Schema::new(vec![ - /// Field::new("a", DataType::Int64, false), - /// Field::new("b", DataType::Int64, false), - /// Field::new("c", DataType::Int64, false), - /// ]) - /// .to_dfschema_ref().unwrap(); + /// Field::new("a", DataType::Int64, false), + /// Field::new("b", DataType::Int64, false), + /// Field::new("c", DataType::Int64, false), + /// ]) + /// .to_dfschema_ref() + /// .unwrap(); /// /// // Create the simplifier /// let props = ExecutionProps::new(); - /// let context = SimplifyContext::new(&props) - /// .with_schema(schema); + /// let context = SimplifyContext::new(&props).with_schema(schema); /// let simplifier = ExprSimplifier::new(context); /// /// // Expression: a = c AND 1 = b @@ -376,9 +375,9 @@ impl ExprSimplifier { /// /// // If canonicalization is disabled, the expression is not changed /// let non_canonicalized = simplifier - /// .with_canonicalize(false) - /// .simplify(expr.clone()) - /// .unwrap(); + /// .with_canonicalize(false) + /// .simplify(expr.clone()) + /// .unwrap(); /// /// assert_eq!(non_canonicalized, expr); /// ``` @@ -437,7 +436,6 @@ impl ExprSimplifier { /// assert_eq!(simplified_expr.data, lit(true)); /// // Only 1 cycle was executed /// assert_eq!(count, 1); - /// /// ``` pub fn with_max_cycles(mut self, max_simplifier_cycles: u32) -> Self { self.max_simplifier_cycles = max_simplifier_cycles; diff --git a/datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs b/datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs index 5286cbd7bdf6..b1f3b006e0cf 100644 --- a/datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs +++ b/datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs @@ -53,7 +53,6 @@ //! ```text //! c1 > INT32(10) //! ``` -//! use arrow::datatypes::DataType; use datafusion_common::{internal_err, tree_node::Transformed};