Skip to content

Apache DataFusion SQL Query Engine

Minor: remove unused methods in datafusion/optimizer/src/utils.rs (#5098)

ygf113da801d9d990
diff --git a/datafusion/optimizer/src/utils.rs b/datafusion/optimizer/src/utils.rs
index 4ac337ec21..4b09ab9562 100644
--- a/datafusion/optimizer/src/utils.rs
+++ b/datafusion/optimizer/src/utils.rs
@@ -24,7 +24,7 @@ use datafusion_expr::expr::{BinaryExpr, Sort};
use datafusion_expr::expr_rewriter::{ExprRewritable, ExprRewriter};
use datafusion_expr::expr_visitor::inspect_expr_pre;
use datafusion_expr::{
- and, col,
+ and,
logical_plan::{Filter, LogicalPlan},
utils::from_plan,
Expr, Operator,
@@ -412,60 +412,6 @@ pub fn only_or_err<T>(slice: &[T]) -> Result<&T> {
}
}
-/// Merge and deduplicate two sets Column slices
-///
-/// # Arguments
-///
-/// * `a` - A tuple of slices of Columns
-/// * `b` - A tuple of slices of Columns
-///
-/// # Return value
-///
-/// The deduplicated union of the two slices
-pub fn merge_cols(
- a: (&[Column], &[Column]),
- b: (&[Column], &[Column]),
-) -> (Vec<Column>, Vec<Column>) {
- let e =
- a.0.iter()
- .map(|it| it.flat_name())
- .chain(a.1.iter().map(|it| it.flat_name()))
- .map(|it| Column::from(it.as_str()));
- let f =
- b.0.iter()
- .map(|it| it.flat_name())
- .chain(b.1.iter().map(|it| it.flat_name()))
- .map(|it| Column::from(it.as_str()));
- let mut g = e.zip(f).collect::<Vec<_>>();
- g.dedup();
- g.into_iter().unzip()
-}
-
-/// Change the relation on a slice of Columns
-///
-/// # Arguments
-///
-/// * `new_table` - The table/relation for the new columns
-/// * `cols` - A slice of Columns
-///
-/// # Return value
-///
-/// A new slice of columns, now belonging to the new table
-pub fn swap_table(new_table: &str, cols: &[Column]) -> Vec<Column> {
- cols.iter()
- .map(|it| Column {
- relation: Some(new_table.to_string()),
- name: it.name.clone(),
- })
- .collect()
-}
-
-pub fn alias_cols(cols: &[Column]) -> Vec<Expr> {
- cols.iter()
- .map(|it| col(it.flat_name().as_str()).alias(it.name.as_str()))
- .collect()
-}
-
/// Rewrites `expr` using `rewriter`, ensuring that the output has the
/// same name as `expr` prior to rewrite, adding an alias if necessary.
///