From c9df9188becf1acfdb9cfcd169432cb25977c864 Mon Sep 17 00:00:00 2001 From: Igor Izvekov Date: Tue, 21 Feb 2023 18:25:47 +0000 Subject: [PATCH 1/4] Fixed small typos in files of the optimizer --- datafusion/optimizer/src/eliminate_cross_join.rs | 2 +- datafusion/optimizer/src/eliminate_outer_join.rs | 4 ++-- datafusion/optimizer/src/optimizer.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datafusion/optimizer/src/eliminate_cross_join.rs b/datafusion/optimizer/src/eliminate_cross_join.rs index c19b43d297e3..c6b950c174bd 100644 --- a/datafusion/optimizer/src/eliminate_cross_join.rs +++ b/datafusion/optimizer/src/eliminate_cross_join.rs @@ -38,7 +38,7 @@ impl EliminateCrossJoin { } } -/// Attempt to reorder join tp eliminate cross joins to inner joins. +/// Attempt to reorder join to eliminate cross joins to inner joins. /// for queries: /// 'select ... from a, b where a.x = b.y and b.xx = 100;' /// 'select ... from a, b where (a.x = b.y and b.xx = 100) or (a.x = b.y and b.xx = 200);' diff --git a/datafusion/optimizer/src/eliminate_outer_join.rs b/datafusion/optimizer/src/eliminate_outer_join.rs index 6a7914034bd1..66f22da219d4 100644 --- a/datafusion/optimizer/src/eliminate_outer_join.rs +++ b/datafusion/optimizer/src/eliminate_outer_join.rs @@ -33,7 +33,7 @@ use std::sync::Arc; /// Attempt to replace outer joins with inner joins. /// /// Outer joins are typically more expensive to compute at runtime -/// than inner joins and prevent various forms fo predicate pushdown +/// than inner joins and prevent various forms of predicate pushdown /// and other optimizations, so removing them if possible is beneficial. /// /// Inner joins filter out rows that do match. Outer joins pass rows @@ -44,7 +44,7 @@ use std::sync::Arc; /// For example, in the `select ... from a left join b on ... where b.xx = 100;` /// /// For rows when `b.xx` is null (as it would be after an outer join), -/// the `b.xx = 100` predicate filters them out and there there is no +/// the `b.xx = 100` predicate filters them out and there is no /// need to produce null rows for output. /// /// Generally, an outer join can be rewritten to inner join if the diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rs index b4eea1db86b9..699070fec18a 100644 --- a/datafusion/optimizer/src/optimizer.rs +++ b/datafusion/optimizer/src/optimizer.rs @@ -63,7 +63,7 @@ pub trait OptimizerRule { /// How should the rule be applied by the optimizer? See comments on [`ApplyOrder`] for details. /// - /// If a rule use default None, its should traverse recursively plan inside itself + /// If a rule use default None, it should traverse recursively plan inside itself fn apply_order(&self) -> Option { None } From 74d21b6b7968fc33aefaa1f11b81ed06e25e3e10 Mon Sep 17 00:00:00 2001 From: Igor Izvekov Date: Wed, 22 Feb 2023 19:54:58 +0000 Subject: [PATCH 2/4] Cleaned up the sentence in the file "simplify_expressions/expr_simplifier.rs" --- .../optimizer/src/simplify_expressions/expr_simplifier.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs index 6ee1d017219b..5421c43da123 100644 --- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs +++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs @@ -154,7 +154,7 @@ struct ConstEvaluator<'a> { /// traversal when we are N levels deep in the tree, one entry for /// this Expr and each of its parents. /// - /// After visiting all siblings if `can_evauate.top()`` is true, that + /// After visiting all siblings if `can_evaluate.top()` is true, that /// means there were no non evaluatable siblings (or their /// descendants) so this `Expr` can be evaluated can_evaluate: Vec, From 99b916776ecc72aa94d2f511d06960e73129423f Mon Sep 17 00:00:00 2001 From: Igor Izvekov Date: Thu, 23 Feb 2023 11:22:30 +0000 Subject: [PATCH 3/4] Found more typos in the file "src/utils.rs" --- datafusion/optimizer/src/utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datafusion/optimizer/src/utils.rs b/datafusion/optimizer/src/utils.rs index 747fa62089ed..c6c03ad793e3 100644 --- a/datafusion/optimizer/src/utils.rs +++ b/datafusion/optimizer/src/utils.rs @@ -416,7 +416,7 @@ pub fn only_or_err(slice: &[T]) -> Result<&T> { /// Rewrites `expr` using `rewriter`, ensuring that the output has the /// same name as `expr` prior to rewrite, adding an alias if necessary. /// -/// This is important when optimzing plans to ensure the the output +/// This is important when optimizing plans to ensure the output /// schema of plan nodes don't change after optimization pub fn rewrite_preserving_name(expr: Expr, rewriter: &mut R) -> Result where @@ -436,7 +436,7 @@ fn name_for_alias(expr: &Expr) -> Result { } } -/// Ensure `expr` has the name name as `original_name` by adding an +/// Ensure `expr` has the name as `original_name` by adding an /// alias if necessary. fn add_alias_if_changed(original_name: String, expr: Expr) -> Result { let new_name = name_for_alias(&expr)?; From e67143e5c7179f644cb7f3329a3dcdd85a548e19 Mon Sep 17 00:00:00 2001 From: Igor Izvekov Date: Thu, 23 Feb 2023 11:31:57 +0000 Subject: [PATCH 4/4] Deleted the duplicate in the file "src/unwrap_cast_in_comparison.rs" --- datafusion/optimizer/src/unwrap_cast_in_comparison.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/optimizer/src/unwrap_cast_in_comparison.rs b/datafusion/optimizer/src/unwrap_cast_in_comparison.rs index 604f3531418f..46c4d35227ef 100644 --- a/datafusion/optimizer/src/unwrap_cast_in_comparison.rs +++ b/datafusion/optimizer/src/unwrap_cast_in_comparison.rs @@ -51,7 +51,7 @@ use std::sync::Arc; /// 4. `literal_expr IN (cast(expr1) , cast(expr2), ...)` /// /// If the expression matches one of the forms above, the rule will -/// ensure the value of `literal` is in within range(min, max) of the +/// ensure the value of `literal` is in range(min, max) of the /// expr's data_type, and if the scalar is within range, the literal /// will be casted to the data type of expr on the other side, and the /// cast will be removed from the other side.