8000 deprecated (#13076) · apache/datafusion@f2da32b · GitHub
[go: up one dir, main page]

Skip to content

Commit f2da32b

Browse files
authored
deprecated (#13076)
1 parent 8adbc23 commit f2da32b

File tree

16 files changed

+32
-299
lines changed

16 files changed

+32
-299
lines changed

datafusion-examples/examples/sql_analysis.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn total_join_count(plan: &LogicalPlan) -> usize {
3939
// We can use the TreeNode API to walk over a LogicalPlan.
4040
plan.apply(|node| {
4141
// if we encounter a join we update the running count
42-
if matches!(node, LogicalPlan::Join(_) | LogicalPlan::CrossJoin(_)) {
42+
if matches!(node, LogicalPlan::Join(_)) {
4343
total += 1;
4444
}
4545
Ok(TreeNodeRecursion::Continue)
@@ -89,7 +89,7 @@ fn count_trees(plan: &LogicalPlan) -> (usize, Vec<usize>) {
8989
while let Some(node) = to_visit.pop() {
9090
// if we encounter a join, we know were at the root of the tree
9191
// count this tree and recurse on it's inputs
92-
if matches!(node, LogicalPlan::Join(_) | LogicalPlan::CrossJoin(_)) {
92+
if matches!(node, LogicalPlan::Join(_)) {
9393
let (group_count, inputs) = count_tree(node);
9494
total += group_count;
9595
groups.push(group_count);
@@ -151,7 +151,7 @@ fn count_tree(join: &LogicalPlan) -> (usize, Vec<&LogicalPlan>) {
151151
}
152152

153153
// any join we count
154-
if matches!(node, LogicalPlan::Join(_) | LogicalPlan::CrossJoin(_)) {
154+
if matches!(node, LogicalPlan::Join(_)) {
155155
total += 1;
156156
Ok(TreeNodeRecursion::Continue)
157157
} else {

datafusion/core/src/physical_planner.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,10 +1127,6 @@ impl DefaultPhysicalPlanner {
11271127
join
11281128
}
11291129
}
1130-
LogicalPlan::CrossJoin(_) => {
1131-
let [left, right] = children.two()?;
1132-
Arc::new(CrossJoinExec::new(left, right))
1133-
}
11341130
LogicalPlan::RecursiveQuery(RecursiveQuery {
11351131
name, is_distinct, ..
11361132
}) => {

datafusion/expr/src/logical_plan/display.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,6 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
504504
"Filter": format!("{}", filter_expr)
505505
})
506506
}
507-
LogicalPlan::CrossJoin(_) => {
508-
json!({
509-
"Node Type": "Cross Join"
510-
})
511-
}
512507
LogicalPlan::Repartition(Repartition {
513508
partitioning_scheme,
514509
..

datafusion/expr/src/logical_plan/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub use ddl::{
3535
};
3636
pub use dml::{DmlStatement, WriteOp};
3737
pub use plan::{
38-
projection_schema, Aggregate, Analyze, ColumnUnnestList, CrossJoin, DescribeTable,
39-
Distinct, DistinctOn, EmptyRelation, Explain, Extension, FetchType, Filter, Join,
38 EF56 +
projection_schema, Aggregate, Analyze, ColumnUnnestList, DescribeTable, Distinct,
39+
DistinctOn, EmptyRelation, Explain, Extension, FetchType, Filter, Join,
4040
JoinConstraint, JoinType, Limit, LogicalPlan, Partitioning, PlanType, Prepare,
4141
Projection, RecursiveQuery, Repartition, SkipType, Sort, StringifiedPlan, Subquery,
4242
SubqueryAlias, TableScan, ToStringifiedPlan, Union, Unnest, Values, Window,

datafusion/expr/src/logical_plan/plan.rs

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,6 @@ pub enum LogicalPlan {
221221
/// Join two logical plans on one or more join columns.
222222
/// This is used to implement SQL `JOIN`
223223
Join(Join),
224-
/// Apply Cross Join to two logical plans.
225-
/// This is used to implement SQL `CROSS JOIN`
226-
/// Deprecated: use [LogicalPlan::Join] instead with empty `on` / no filter
227-
CrossJoin(CrossJoin),
228224
/// Repartitions the input based on a partitioning scheme. This is
229225
/// used to add parallelism and is sometimes referred to as an
230226
/// "exchange" operator in other systems
@@ -312,7 +308,6 @@ impl LogicalPlan {
312308
LogicalPlan::Aggregate(Aggregate { schema, .. }) => schema,
313309
LogicalPlan::Sort(Sort { input, .. }) => input.schema(),
314310
LogicalPlan::Join(Join { schema, .. }) => schema,
315-
LogicalPlan::CrossJoin(CrossJoin { schema, .. }) => schema,
316311
LogicalPlan::Repartition(Repartition { input, .. }) => input.schema(),
317312
LogicalPlan::Limit(Limit { input, .. }) => input.schema(),
318313
LogicalPlan::Statement(statement) => statement.schema(),
@@ -345,8 +340,7 @@ impl LogicalPlan {
345340
| LogicalPlan::Projection(_)
346341
| LogicalPlan::Aggregate(_)
347342
| LogicalPlan::Unnest(_)
348-
| LogicalPlan::Join(_)
349-
| LogicalPlan::CrossJoin(_) => self
343+
| LogicalPlan::Join(_) => self
350344
.inputs()
351345
.iter()
352346
.map(|input| input.schema().as_ref())
@@ -436,7 +430,6 @@ impl LogicalPlan {
436430
LogicalPlan::Aggregate(Aggregate { input, .. }) => vec![input],
437431
LogicalPlan::Sort(Sort { input, .. }) => vec![input],
438432
LogicalPlan::Join(Join { left, F438 right, .. }) => vec![left, right],
439-
LogicalPlan::CrossJoin(CrossJoin { left, right, .. }) => vec![left, right],
440433
LogicalPlan::Limit(Limit { input, .. }) => vec![input],
441434
LogicalPlan::Subquery(Subquery { subquery, .. }) => vec![subquery],
442435
LogicalPlan::SubqueryAlias(SubqueryAlias { input, .. }) => vec![input],
@@ -542,13 +535,6 @@ impl LogicalPlan {
542535
JoinType::LeftSemi | JoinType::LeftAnti => left.head_output_expr(),
543536
JoinType::RightSemi | JoinType::RightAnti => right.head_output_expr(),
544537
},
545-
LogicalPlan::CrossJoin(cross) => {
546-
if cross.left.schema().fields().is_empty() {
547-
cross.right.head_output_expr()
548-
} else {
549-
cross.left.head_output_expr()
550-
}
551-
}
552538
LogicalPlan::RecursiveQuery(RecursiveQuery { static_term, .. }) => {
553539
static_term.head_output_expr()
554540
}
@@ -674,20 +660,6 @@ impl LogicalPlan {
674660
null_equals_null,
675661
}))
676662
}
677-
LogicalPlan::CrossJoin(CrossJoin {
678-
left,
679-
right,
680-
schema: _,
681-
}) => {
682-
let join_schema =
683-
build_join_schema(left.schema(), right.schema(), &JoinType::Inner)?;
684-
685-
Ok(LogicalPlan::CrossJoin(CrossJoin {
686-
left,
687-
right,
688-
schema: join_schema.into(),
689-
}))
690-
}
691663
LogicalPlan::Subquery(_) => Ok(self),
692664
LogicalPlan::SubqueryAlias(SubqueryAlias {
693665
input,
@@ -938,11 +910,6 @@ impl LogicalPlan {
938910
null_equals_null: *null_equals_null,
939911
}))
940912
}
941-
LogicalPlan::CrossJoin(_) => {
942-
self.assert_no_expressions(expr)?;
943-
let (left, right) = self.only_two_inputs(inputs)?;
944-
LogicalPlanBuilder::from(left).cross_join(right)?.build()
945-
}
946913
LogicalPlan::Subquery(Subquery {
947914
outer_ref_columns, ..
948915
}) => {
@@ -1327,12 +1294,6 @@ impl LogicalPlan {
13271294
JoinType::LeftSemi | JoinType::LeftAnti => left.max_rows(),
13281295
JoinType::RightSemi | JoinType::RightAnti => right.max_rows(),
13291296
},
1330-
LogicalPlan::CrossJoin(CrossJoin { left, right, .. }) => {
1331-
match (left.max_rows(), right.max_rows()) {
1332-
(Some(left_max), Some(right_max)) => Some(left_max * right_max),
1333-
_ => None,
1334-
}
1335-
}
13361297
LogicalPlan::Repartition(Repartition { input, .. }) => input.max_rows(),
13371298
LogicalPlan::Union(Union { inputs, .. }) => inputs
13381299
.iter()
@@ -1893,9 +1854,6 @@ impl LogicalPlan {
18931854
}
18941855
}
18951856
}
1896-
LogicalPlan::CrossJoin(_) => {
1897-
write!(f, "CrossJoin:")
1898-
}
18991857
LogicalPlan::Repartition(Repartition {
19001858
partitioning_scheme,
19011859
..
@@ -2601,28 +2559,7 @@ impl TableScan {
26012559
}
26022560
}
26032561

2604-
/// Apply Cross Join to two logical plans
2605-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2606-
pub struct CrossJoin {
2607-
/// Left input
2608-
pub left: Arc<LogicalPlan>,
2609-
/// Right input
2610-
pub right: Arc<LogicalPlan>,
2611-
/// The output schema, containing fields from the left and right inputs
2612-
pub schema: DFSchemaRef,
2613-
}
2614-
2615-
// Manual implementation needed because of `schema` field. Comparison excludes this field.
2616-
impl PartialOrd for CrossJoin {
2617-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
2618-
match self.left.partial_cmp(&other.left) {
2619-
Some(Ordering::Equal) => self.right.partial_cmp(&other.right),
2620-
cmp => cmp,
2621-
}
2622-
}
2623-
}
2624-
2625-
/// Repartition the plan based on a partitioning scheme.
2562+
// Repartition the plan based on a partitioning scheme.
26262563
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Hash)]
26272564
pub struct Repartition {
26282565
/// The incoming logical plan

datafusion/expr/src/logical_plan/tree_node.rs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
//! * [`LogicalPlan::with_new_exprs`]: Create a new plan with different expressions
3838
//! * [`LogicalPlan::expressions`]: Return a copy of the plan's expressions
3939
use crate::{
40-
dml::CopyTo, Aggregate, Analyze, CreateMemoryTable, CreateView, CrossJoin,
41-
DdlStatement, Distinct, DistinctOn, DmlStatement, Explain, Expr, Extension, Filter,
42-
Join, Limit, LogicalPlan, Partitioning, Prepare, Projection, RecursiveQuery,
43-
Repartition, Sort, Subquery, SubqueryAlias, TableScan, Union, Unnest,
44-
UserDefinedLogicalNode, Values, Window,
40+
dml::CopyTo, Aggregate, Analyze, CreateMemoryTable, CreateView, DdlStatement,
41+
Distinct, DistinctOn, DmlStatement, Explain, Expr, Extension, Filter, Join, Limit,
42+
LogicalPlan, Partitioning, Prepare, Projection, RecursiveQuery, Repartition, Sort,
43+
Subquery, SubqueryAlias, TableScan, Union, Unnest, UserDefinedLogicalNode, Values,
44+
Window,
4545
};
4646
use std::ops::Deref;
4747
use std::sync::Arc;
@@ -160,22 +160,6 @@ impl TreeNode for LogicalPlan {
160160
null_equals_null,
161161
})
162162
}),
163-
LogicalPlan::CrossJoin(CrossJoin {
164-
left,
165-
right,
166-
schema,
167-
}) => map_until_stop_and_collect!(
168-
rewrite_arc(left, &mut f),
169-
right,
170-
rewrite_arc(right, &mut f)
171-
)?
172-
.update_data(|(left, right)| {
173-
LogicalPlan::CrossJoin(CrossJoin {
174-
left,
175-
right,
176-
schema,
177-
})
178-
}),
179163
LogicalPlan::Limit(Limit { skip, fetch, input }) => rewrite_arc(input, f)?
180164
.update_data(|input| LogicalPlan::Limit(Limit { skip, fetch, input })),
181165
LogicalPlan::Subquery(Subquery {
@@ -527,7 +511,6 @@ impl LogicalPlan {
527511
| LogicalPlan::Subquery(_)
528512
| LogicalPlan::SubqueryAlias(_)
529513
| LogicalPlan::Statement(_)
530-
| LogicalPlan::CrossJoin(_)
531514
| LogicalPlan::Analyze(_)
532515
| LogicalPlan::Explain(_)
533516
| LogicalPlan::Union(_)
@@ -758,7 +741,6 @@ impl LogicalPlan {
758741
| LogicalPlan::Subquery(_)
759742
| LogicalPlan::SubqueryAlias(_)
760743
| LogicalPlan::Statement(_)
761-
| LogicalPlan::CrossJoin(_)
762744
| LogicalPlan::Analyze(_)
763745
| LogicalPlan::Explain(_)
764746
| LogicalPlan::Union(_)

datafusion/optimizer/src/analyzer/subquery.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ fn check_inner_plan(
180180
LogicalPlan::Projection(_)
181181
| LogicalPlan::Distinct(_)
182182
| LogicalPlan::Sort(_)
183-
| LogicalPlan::CrossJoin(_)
184183
| LogicalPlan::Union(_)
185184
| LogicalPlan::TableScan(_)
186185
| LogicalPlan::EmptyRelation(_)

datafusion/optimizer/src/common_subexpr_eliminate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ impl OptimizerRule for CommonSubexprEliminate {
534534
LogicalPlan::Window(window) => self.try_optimize_window(window, config)?,
535535
LogicalPlan::Aggregate(agg) => self.try_optimize_aggregate(agg, config)?,
536536
LogicalPlan::Join(_)
537-
| LogicalPlan::CrossJoin(_)
538537
| LogicalPlan::Repartition(_)
539538
| LogicalPlan::Union(_)
540539
| LogicalPlan::TableScan(_)

datafusion/optimizer/src/eliminate_cross_join.rs

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl OptimizerRule for EliminateCrossJoin {
9898
LogicalPlan::Join(Join {
9999
join_type: JoinType::Inner,
100100
..
101-
}) | LogicalPlan::CrossJoin(_)
101+
})
102102
);
103103

104104
if !rewriteable {
@@ -241,20 +241,6 @@ fn flatten_join_inputs(
241241
all_filters,
242242
)?;
243243
}
244-
LogicalPlan::CrossJoin(join) => {
245-
flatten_join_inputs(
246-
Arc::unwrap_or_clone(join.left),
247-
possible_join_keys,
248-
all_inputs,
249-
all_filters,
250-
)?;
251-
flatten_join_inputs(
252-
Arc::unwrap_or_clone(join.right),
253-
possible_join_keys,
254-
all_inputs,
255-
all_filters,
256-
)?;
257-
}
258244
_ => {
259245
all_inputs.push(plan);
260246
}
@@ -270,23 +256,18 @@ fn can_flatten_join_inputs(plan: &LogicalPlan) -> bool {
270256
// can only flatten inner / cross joins
271257
match plan {
272258
LogicalPlan::Join(join) if join.join_type == JoinType::Inner => {}
273-
LogicalPlan::CrossJoin(_) => {}
274259
_ => return false,
275260
};
276261

277262
for child in plan.inputs() {
278-
match child {
279-
LogicalPlan::Join(Join {
280-
join_type: JoinType::Inner,
281-
..
282-
})
283-
| LogicalPlan::CrossJoin(_) => {
284-
if !can_flatten_join_inputs(child) {
285-
return false;
286-
}
263+
if let LogicalPlan::Join(Join {
264+
join_type: JoinType::Inner,
265+
..
266+
}) = child
267+
{
268+
if !can_flatten_join_inputs(child) {
269+
return false;
287270
}
288-
// the child is not a join/cross join
289-
_ => (),
290271
}
291272
}
292273
true

datafusion/optimizer/src/optimize_projections/mod.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,6 @@ fn optimize_projections(
367367
right_indices.with_projection_beneficial(),
368368
]
369369
}
370-
LogicalPlan::CrossJoin(cross_join) => {
371-
let left_len = cross_join.left.schema().fields().len();
372-
let (left_indices, right_indices) =
373-
split_join_requirements(left_len, indices, &JoinType::Inner);
374-
// Joins benefit from "small" input tables (lower memory usage).
375-
// Therefore, each child benefits from projection:
376-
vec![
377-
left_indices.with_projection_beneficial(),
378-
right_indices.with_projection_beneficial(),
379-
]
380-
}
381370
// these nodes are explicitly rewritten in the match statement above
382371
LogicalPlan::Projection(_)
383372
| LogicalPlan::Aggregate(_)

0 commit comments

Comments
 (0)
0