Skip to content

Commit 1322d25

Browse files
committed
chore: clippy -fix
1 parent 2153c04 commit 1322d25

File tree

3 files changed

+46
-50
lines changed

3 files changed

+46
-50
lines changed

rust/cubesql/cubesql/src/compile/engine/df/optimizers/filter_push_down.rs

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -576,34 +576,32 @@ fn rewrite_map_for_projection(
576576
.collect()
577577
}
578578

579-
/// Generates a rewrite map for union inputs, taking UNION's schema and one of the input's schema.
580-
/// These expressions can't be more complex than simple column references by definition.
581-
///
582-
/// TODO: see `LogicalPlan::Union` above
583-
/*
584-
fn rewrite_map_for_union_input(
585-
union_schema: &DFSchema,
586-
input_schema: &DFSchema,
587-
) -> HashMap<Column, Option<Expr>> {
588-
union_schema
589-
.fields()
590-
.iter()
591-
.zip(input_schema.fields().iter())
592-
.flat_map(|(union_field, input_field)| {
593-
vec![
594-
(
595-
union_field.qualified_column(),
596-
Some(Expr::Column(input_field.unqualified_column())),
597-
),
598-
(
599-
union_field.unqualified_column(),
600-
Some(Expr::Column(input_field.unqualified_column())),
601-
),
602-
]
603-
})
604-
.collect()
605-
}
606-
*/
579+
// /// Generates a rewrite map for union inputs, taking UNION's schema and one of the input's schema.
580+
// /// These expressions can't be more complex than simple column references by definition.
581+
// ///
582+
// /// TODO: see `LogicalPlan::Union` above
583+
// fn rewrite_map_for_union_input(
584+
// union_schema: &DFSchema,
585+
// input_schema: &DFSchema,
586+
// ) -> HashMap<Column, Option<Expr>> {
587+
// union_schema
588+
// .fields()
589+
// .iter()
590+
// .zip(input_schema.fields().iter())
591+
// .flat_map(|(union_field, input_field)| {
592+
// vec![
593+
// (
594+
// union_field.qualified_column(),
595+
// Some(Expr::Column(input_field.unqualified_column())),
596+
// ),
597+
// (
598+
// union_field.unqualified_column(),
599+
// Some(Expr::Column(input_field.unqualified_column())),
600+
// ),
601+
// ]
602+
// })
603+
// .collect()
604+
// }
607605

608606
/// Recursively concatenates several filter predicates into one binary AND expression.
609607
/// `predicates` must contain at least one expression.
@@ -621,24 +619,22 @@ fn concatenate_predicates(predicates: Vec<Expr>) -> Result<Expr> {
621619
))
622620
}
623621

624-
/// Recursively splits filter predicate from binary AND expressions into a flat vec of predicates.
625-
///
626-
/// TODO: see `LogicalPlan::Filter` above
627-
/*
628-
fn split_predicates(predicate: &Expr) -> Vec<Expr> {
629-
match predicate {
630-
Expr::BinaryExpr {
631-
left,
632-
op: Operator::And,
633-
right,
634-
} => split_predicates(left)
635-
.into_iter()
636-
.chain(split_predicates(right).into_iter())
637-
.collect(),
638-
expr => vec![expr.clone()],
639-
}
640-
}
641-
*/
622+
// /// Recursively splits filter predicate from binary AND expressions into a flat vec of predicates.
623+
// ///
624+
// /// TODO: see `LogicalPlan::Filter` above
625+
// fn split_predicates(predicate: &Expr) -> Vec<Expr> {
626+
// match predicate {
627+
// Expr::BinaryExpr {
628+
// left,
629+
// op: Operator::And,
630+
// right,
631+
// } => split_predicates(left)
632+
// .into_iter()
633+
// .chain(split_predicates(right).into_iter())
634+
// .collect(),
635+
// expr => vec![expr.clone()],
636+
// }
637+
// }
642638

643639
/// Recursively checks if the passed expr is a filter predicate that can be pushed down.
644640
/// The predicate should be pushed down the plan if it can ultimately be pushed down to CubeScan.

rust/cubesql/cubesql/src/compile/engine/df/optimizers/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub fn is_const_expr(expr: &Expr) -> bool {
386386
_ => false,
387387
},
388388
Expr::InList { expr, list, .. } => {
389-
is_const_expr(expr) && list.iter().map(|item| is_const_expr(item)).all(|item| item)
389+
is_const_expr(expr) && list.iter().all(|item| is_const_expr(item))
390390
}
391391
_ => false,
392392
}

rust/cubesql/cubesql/src/compile/engine/variable_provider.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl VariablesProvider {
2525

2626
fn get_session_value(&self, identifier: Vec<String>, var_type: VarType) -> Result<ScalarValue> {
2727
let key = if identifier.len() > 1 {
28-
let ignore_first = identifier[0].to_ascii_lowercase() == "@@session";
28+
let ignore_first = identifier[0].eq_ignore_ascii_case("@@session");
2929
if ignore_first {
3030
identifier[1..].concat()
3131
} else {
@@ -48,7 +48,7 @@ impl VariablesProvider {
4848

4949
fn get_global_value(&self, identifier: Vec<String>) -> Result<ScalarValue> {
5050
let key = if identifier.len() > 1 {
51-
let ignore_first = identifier[0].to_ascii_lowercase() == "@@global";
51+
let ignore_first = identifier[0].eq_ignore_ascii_case("@@global");
5252

5353
if ignore_first {
5454
identifier[1..].concat()
@@ -85,7 +85,7 @@ impl VarProvider for VariablesProvider {
8585

8686
match (&first_word_vec[0], &first_word_vec[1]) {
8787
('@', '@') => {
88-
if identifier.len() > 1 && identifier[0].to_ascii_lowercase() == "@@session" {
88+
if identifier.len() > 1 && identifier[0].eq_ignore_ascii_case("@@session") {
8989
return self.get_session_value(identifier, VarType::System);
9090
}
9191

0 commit comments

Comments
 (0)