Apache DataFusion SQL Query Engine
minor: correct name and typo (#4359)
jakevin3b7f76714c72
diff --git a/datafusion/optimizer/src/eliminate_cross_join.rs b/datafusion/optimizer/src/eliminate_cross_join.rsindex 23e80ee542..83fc9e164b 100644--- a/datafusion/optimizer/src/eliminate_cross_join.rs+++ b/datafusion/optimizer/src/eliminate_cross_join.rs@@ -15,7 +15,7 @@// specific language governing permissions and limitations// under the License.-//! Optimizer rule to reduce cross join to inner join if join predicates are available in filters.+//! Optimizer rule to eliminate cross join to inner join if join predicates are available in filters.use crate::{utils, OptimizerConfig, OptimizerRule};use datafusion_common::{Column, DFSchema, DataFusionError, Result};use datafusion_expr::{@@ -35,16 +35,16 @@ use datafusion_expr::logical_plan::JoinConstraint;use std::sync::Arc;#[derive(Default)]-pub struct ReduceCrossJoin;+pub struct EliminateCrossJoin;-impl ReduceCrossJoin {+impl EliminateCrossJoin {#[allow(missing_docs)]pub fn new() -> Self {Self {}}}-/// Attempt to reorder join tp reduce cross joins to inner joins.+/// Attempt to reorder join tp 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);'@@ -54,7 +54,7 @@ impl ReduceCrossJoin {/// join nodes appropriately/// This fix helps to improve the performance of TPCH Q19. issue#78///-impl OptimizerRule for ReduceCrossJoin {+impl OptimizerRule for EliminateCrossJoin {fn optimize(&self,plan: &LogicalPlan,@@ -133,7 +133,7 @@ impl OptimizerRule for ReduceCrossJoin {}fn name(&self) -> &str {- "reduce_cross_join"+ "eliminate_cross_join"}}@@ -349,7 +349,7 @@ mod tests {};fn assert_optimized_plan_eq(plan: &LogicalPlan, expected: Vec<&str>) {- let rule = ReduceCrossJoin::new();+ let rule = EliminateCrossJoin::new();let optimized_plan = rule.optimize(plan, &mut OptimizerConfig::new()).expect("failed to optimize plan");@@ -366,11 +366,11 @@ mod tests {}#[test]- fn reduce_cross_with_simple_and() -> Result<()> {+ fn eliminate_cross_with_simple_and() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;- // could reduce to inner join since filter has Join predicates+ // could eliminate to inner join since filter has Join predicateslet plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -393,11 +393,11 @@ mod tests {}#[test]- fn reduce_cross_with_simple_or() -> Result<()> {+ fn eliminate_cross_with_simple_or() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;- // could not reduce to inner join since filter OR expression and there is no common+ // could not eliminate to inner join since filter OR expression and there is no common// Join predicates in left and right of OR expr.let plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?@@ -421,11 +421,11 @@ mod tests {}#[test]- fn reduce_cross_with_and() -> Result<()> {+ fn eliminate_cross_with_and() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -448,11 +448,11 @@ mod tests {}#[test]- fn reduce_cross_with_or() -> Result<()> {+ fn eliminate_cross_with_or() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;- // could reduce to inner join since Or predicates have common Join predicates+ // could eliminate to inner join since Or predicates have common Join predicateslet plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -478,11 +478,11 @@ mod tests {}#[test]- fn reduce_cross_not_possible_simple() -> Result<()> {+ fn eliminate_cross_not_possible_simple() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;- // could not reduce to inner join+ // could not eliminate to inner joinlet plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -508,11 +508,11 @@ mod tests {}#[test]- fn reduce_cross_not_possible() -> Result<()> {+ fn eliminate_cross_not_possible() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;- // could not reduce to inner join+ // could not eliminate to inner joinlet plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -549,12 +549,12 @@ mod tests {/// inner_join (ab)c and a.id = c.id/// inner_join a b on a.id = b.id/// ```- fn reorder_join_to_reduce_cross_join_multi_tables() -> Result<()> {+ fn reorder_join_to_eliminate_cross_join_multi_tables() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan = LogicalPlanBuilder::from(t1).cross_join(&t2)?.cross_join(&t3)?@@ -581,13 +581,13 @@ mod tests {}#[test]- fn reduce_cross_join_multi_tables() -> Result<()> {+ fn eliminate_cross_join_multi_tables() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;let t4 = test_table_scan_with_name("t4")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan1 = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -658,13 +658,13 @@ mod tests {}#[test]- fn reduce_cross_join_multi_tables_1() -> Result<()> {+ fn eliminate_cross_join_multi_tables_1() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;let t4 = test_table_scan_with_name("t4")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan1 = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -678,7 +678,7 @@ mod tests {))?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan2 = LogicalPlanBuilder::from(t3).cross_join(&t4)?.filter(binary_expr(@@ -704,7 +704,7 @@ mod tests {))?.build()?;- // could not reduce to inner join+ // could not eliminate to inner joinlet plan = LogicalPlanBuilder::from(plan1).cross_join(&plan2)?.filter(binary_expr(@@ -733,13 +733,13 @@ mod tests {}#[test]- fn reduce_cross_join_multi_tables_2() -> Result<()> {+ fn eliminate_cross_join_multi_tables_2() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;let t4 = test_table_scan_with_name("t4")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan1 = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -753,7 +753,7 @@ mod tests {))?.build()?;- // could not reduce to inner join+ // could not eliminate to inner joinlet plan2 = LogicalPlanBuilder::from(t3).cross_join(&t4)?.filter(binary_expr(@@ -775,7 +775,7 @@ mod tests {))?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan = LogicalPlanBuilder::from(plan1).cross_join(&plan2)?.filter(binary_expr(@@ -808,13 +808,13 @@ mod tests {}#[test]- fn reduce_cross_join_multi_tables_3() -> Result<()> {+ fn eliminate_cross_join_multi_tables_3() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;let t4 = test_table_scan_with_name("t4")?;- // could not reduce to inner join+ // could not eliminate to inner joinlet plan1 = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -828,7 +828,7 @@ mod tests {))?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan2 = LogicalPlanBuilder::from(t3).cross_join(&t4)?.filter(binary_expr(@@ -854,7 +854,7 @@ mod tests {))?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan = LogicalPlanBuilder::from(plan1).cross_join(&plan2)?.filter(binary_expr(@@ -887,13 +887,13 @@ mod tests {}#[test]- fn reduce_cross_join_multi_tables_4() -> Result<()> {+ fn eliminate_cross_join_multi_tables_4() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;let t4 = test_table_scan_with_name("t4")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan1 = LogicalPlanBuilder::from(t1).cross_join(&t2)?.filter(binary_expr(@@ -907,10 +907,10 @@ mod tests {))?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan2 = LogicalPlanBuilder::from(t3).cross_join(&t4)?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan = LogicalPlanBuilder::from(plan1).cross_join(&plan2)?.filter(binary_expr(@@ -970,19 +970,19 @@ mod tests {}#[test]- fn reduce_cross_join_multi_tables_5() -> Result<()> {+ fn eliminate_cross_join_multi_tables_5() -> Result<()> {let t1 = test_table_scan_with_name("t1")?;let t2 = test_table_scan_with_name("t2")?;let t3 = test_table_scan_with_name("t3")?;let t4 = test_table_scan_with_name("t4")?;- // could reduce to inner join+ // could eliminate to inner joinlet plan1 = LogicalPlanBuilder::from(t1).cross_join(&t2)?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan2 = LogicalPlanBuilder::from(t3).cross_join(&t4)?.build()?;- // could reduce to inner join+ // could eliminate to inner joinlet plan = LogicalPlanBuilder::from(plan1).cross_join(&plan2)?.filter(binary_expr(diff --git a/datafusion/optimizer/src/limit_push_down.rs b/datafusion/optimizer/src/limit_push_down.rsindex d6c1eae079..fd29015d5b 100644--- a/datafusion/optimizer/src/limit_push_down.rs+++ b/datafusion/optimizer/src/limit_push_down.rs@@ -362,7 +362,7 @@ mod test {}#[test]- fn multi_stage_limit_recurses_to_deeper_limit() -> Result<()> {+ fn multi_stage_limit_recursive_to_deeper_limit() -> Result<()> {let table_scan = test_table_scan()?;let plan = LogicalPlanBuilder::from(table_scan)diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rsindex fd70c805c3..2ac3fda23b 100644--- a/datafusion/optimizer/src/optimizer.rs+++ b/datafusion/optimizer/src/optimizer.rs@@ -20,7 +20,7 @@use crate::common_subexpr_eliminate::CommonSubexprEliminate;use crate::decorrelate_where_exists::DecorrelateWhereExists;use crate::decorrelate_where_in::DecorrelateWhereIn;-use crate::eliminate_cross_join::ReduceCrossJoin;+use crate::eliminate_cross_join::EliminateCrossJoin;use crate::eliminate_filter::EliminateFilter;use crate::eliminate_limit::EliminateLimit;use crate::eliminate_outer_join::EliminateOuterJoin;@@ -174,7 +174,7 @@ impl Optimizer {// subqueries to joinsArc::new(SimplifyExpressions::new()),Arc::new(EliminateFilter::new()),- Arc::new(ReduceCrossJoin::new()),+ Arc::new(EliminateCrossJoin::new()),Arc::new(CommonSubexprEliminate::new()),Arc::new(EliminateLimit::new()),Arc::new(PropagateEmptyRelation::new()),diff --git a/datafusion/optimizer/src/rewrite_disjunctive_predicate.rs b/datafusion/optimizer/src/rewrite_disjunctive_predicate.rsindex 7d7184b064..6a2ba2bde6 100644--- a/datafusion/optimizer/src/rewrite_disjunctive_predicate.rs+++ b/datafusion/optimizer/src/rewrite_disjunctive_predicate.rs@@ -50,7 +50,7 @@ use std::sync::Arc;/// main use is that it appears in TPCH Q19 and is required to avoid a/// CROSS JOIN.///-/// Specificially, Q19 has a WHERE clause that looks like+/// Specifically, Q19 has a WHERE clause that looks like////// ```sql/// where@@ -81,7 +81,7 @@ use std::sync::Arc;/// )/// ```///-/// Niavely planning this query will result in a CROSS join with that+/// Naively planning this query will result in a CROSS join with that/// single large OR filter. However, rewriting it using the rewrite in/// this pass results in a proper join predicate, `p_partkey = l_partkey`:///diff --git a/datafusion/row/src/lib.rs b/datafusion/row/src/lib.rsindex 7d715f9da4..aab929f270 100644--- a/datafusion/row/src/lib.rs+++ b/datafusion/row/src/lib.rs@@ -386,11 +386,8 @@ mod tests {#[test]#[should_panic(expected = "not supported yet")]fn test_unsupported_type_read() {- let schema = Arc::new(Schema::new(vec![Field::new(- "a",- DataType::Decimal128(5, 2),- false,- )]));+ let schema =+ Arc::new(Schema::new(vec![Field::new("a", Decimal128(5, 2), false)]));let vector = vec![0; 1024];let row_offsets = vec![0];read_as_batch(&vector, schema, &row_offsets, Compact).unwrap();