Skip to content

Commit dd00d09

Browse files
committed
refactor(cubesql): Remove unused plan argument from CubeScanWrapperNode::generate_sql_for_expr
1 parent ce48b2d commit dd00d09

File tree

1 file changed

+1
-38
lines changed
  • rust/cubesql/cubesql/src/compile/engine/df

1 file changed

+1
-38
lines changed

rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,6 @@ impl CubeScanWrapperNode {
862862
// Here it should just generate the literal
863863
// 2. It would not allow to provide aliases for expressions, instead it usually generates them
864864
let (expr, sql) = Self::generate_sql_for_expr(
865-
plan.clone(),
866865
new_sql,
867866
generator.clone(),
868867
expr,
@@ -1583,7 +1582,7 @@ impl CubeScanWrapperNode {
15831582
}
15841583

15851584
async fn generate_column_expr(
1586-
plan: Arc<Self>,
1585+
_plan: Arc<Self>,
15871586
schema: DFSchemaRef,
15881587
exprs: impl IntoIterator<Item = Expr>,
15891588
mut sql: SqlQuery,
@@ -1611,7 +1610,6 @@ impl CubeScanWrapperNode {
16111610

16121611
let mut used_members = HashSet::new();
16131612
let (expr_sql, new_sql_query) = Self::generate_sql_for_expr(
1614-
plan.clone(),
16151613
sql,
16161614
generator.clone(),
16171615
expr.clone(),
@@ -1736,7 +1734,6 @@ impl CubeScanWrapperNode {
17361734
/// This function is async to be able to call to JS land,
17371735
/// in case some SQL generation could not be done through Jinja
17381736
pub fn generate_sql_for_expr<'ctx>(
1739-
plan: Arc<Self>,
17401737
mut sql_query: SqlQuery,
17411738
sql_generator: Arc<dyn SqlGenerator>,
17421739
expr: Expr,
@@ -1748,7 +1745,6 @@ impl CubeScanWrapperNode {
17481745
match expr {
17491746
Expr::Alias(expr, _) => {
17501747
let (expr, sql_query) = Self::generate_sql_for_expr(
1751-
plan.clone(),
17521748
sql_query,
17531749
sql_generator.clone(),
17541750
*expr,
@@ -1787,7 +1783,6 @@ impl CubeScanWrapperNode {
17871783
// So we can generate that as if it were regular column expression
17881784

17891785
return Self::generate_sql_for_expr(
1790-
plan.clone(),
17911786
sql_query,
17921787
sql_generator.clone(),
17931788
expr,
@@ -1810,7 +1805,6 @@ impl CubeScanWrapperNode {
18101805
}
18111806
MemberField::Literal(value) => {
18121807
Self::generate_sql_for_expr(
1813-
plan.clone(),
18141808
sql_query,
18151809
sql_generator.clone(),
18161810
Expr::Literal(value.clone()),
@@ -1862,7 +1856,6 @@ impl CubeScanWrapperNode {
18621856
// Expr::ScalarVariable(_, _) => {}
18631857
Expr::BinaryExpr { left, op, right } => {
18641858
let (left, sql_query) = Self::generate_sql_for_expr(
1865-
plan.clone(),
18661859
sql_query,
18671860
sql_generator.clone(),
18681861
*left,
@@ -1872,7 +1865,6 @@ impl CubeScanWrapperNode {
18721865
)
18731866
.await?;
18741867
let (right, sql_query) = Self::generate_sql_for_expr(
1875-
plan.clone(),
18761868
sql_query,
18771869
sql_generator.clone(),
18781870
*right,
@@ -1895,7 +1887,6 @@ impl CubeScanWrapperNode {
18951887
// Expr::AnyExpr { .. } => {}
18961888
Expr::Like(like) => {
18971889
let (expr, sql_query) = Self::generate_sql_for_expr(
1898-
plan.clone(),
18991890
sql_query,
19001891
sql_generator.clone(),
19011892
*like.expr,
@@ -1905,7 +1896,6 @@ impl CubeScanWrapperNode {
19051896
)
19061897
.await?;
19071898
let (pattern, sql_query) = Self::generate_sql_for_expr(
1908-
plan.clone(),
19091899
sql_query,
19101900
sql_generator.clone(),
19111901
*like.pattern,
@@ -1917,7 +1907,6 @@ impl CubeScanWrapperNode {
19171907
let (escape_char, sql_query) = match like.escape_char {
19181908
Some(escape_char) => {
19191909
let (escape_char, sql_query) = Self::generate_sql_for_expr(
1920-
plan.clone(),
19211910
sql_query,
19221911
sql_generator.clone(),
19231912
Expr::Literal(ScalarValue::Utf8(Some(escape_char.to_string()))),
@@ -1943,7 +1932,6 @@ impl CubeScanWrapperNode {
19431932
}
19441933
Expr::ILike(ilike) => {
19451934
let (expr, sql_query) = Self::generate_sql_for_expr(
1946-
plan.clone(),
19471935
sql_query,
19481936
sql_generator.clone(),
19491937
*ilike.expr,
@@ -1953,7 +1941,6 @@ impl CubeScanWrapperNode {
19531941
)
19541942
.await?;
19551943
let (pattern, sql_query) = Self::generate_sql_for_expr(
1956-
plan.clone(),
19571944
sql_query,
19581945
sql_generator.clone(),
19591946
*ilike.pattern,
@@ -1965,7 +1952,6 @@ impl CubeScanWrapperNode {
19651952
let (escape_char, sql_query) = match ilike.escape_char {
19661953
Some(escape_char) => {
19671954
let (escape_char, sql_query) = Self::generate_sql_for_expr(
1968-
plan.clone(),
19691955
sql_query,
19701956
sql_generator.clone(),
19711957
Expr::Literal(ScalarValue::Utf8(Some(escape_char.to_string()))),
@@ -1992,7 +1978,6 @@ impl CubeScanWrapperNode {
19921978
// Expr::SimilarTo(_) => {}
19931979
Expr::Not(expr) => {
19941980
let (expr, sql_query) = Self::generate_sql_for_expr(
1995-
plan.clone(),
19961981
sql_query,
19971982
sql_generator.clone(),
19981983
*expr,
@@ -2015,7 +2000,6 @@ impl CubeScanWrapperNode {
20152000
}
20162001
Expr::IsNotNull(expr) => {
20172002
let (expr, sql_query) = Self::generate_sql_for_expr(
2018-
plan.clone(),
20192003
sql_query,
20202004
sql_generator.clone(),
20212005
*expr,
@@ -2037,7 +2021,6 @@ impl CubeScanWrapperNode {
20372021
}
20382022
Expr::IsNull(expr) => {
20392023
let (expr, sql_query) = Self::generate_sql_for_expr(
2040-
plan.clone(),
20412024
sql_query,
20422025
sql_generator.clone(),
20432026
*expr,
@@ -2059,7 +2042,6 @@ impl CubeScanWrapperNode {
20592042
}
20602043
Expr::Negative(expr) => {
20612044
let (expr, sql_query) = Self::generate_sql_for_expr(
2062-
plan.clone(),
20632045
sql_query,
20642046
sql_generator.clone(),
20652047
*expr,
@@ -2088,7 +2070,6 @@ impl CubeScanWrapperNode {
20882070
} => {
20892071
let expr = if let Some(expr) = expr {
20902072
let (expr, sql_query_next) = Self::generate_sql_for_expr(
2091-
plan.clone(),
20922073
sql_query,
20932074
sql_generator.clone(),
20942075
*expr,
@@ -2105,7 +2086,6 @@ impl CubeScanWrapperNode {
21052086
let mut when_then_expr_sql = Vec::new();
21062087
for (when, then) in when_then_expr {
21072088
let (when, sql_query_next) = Self::generate_sql_for_expr(
2108-
plan.clone(),
21092089
sql_query,
21102090
sql_generator.clone(),
21112091
*when,
@@ -2115,7 +2095,6 @@ impl CubeScanWrapperNode {
21152095
)
21162096
.await?;
21172097
let (then, sql_query_next) = Self::generate_sql_for_expr(
2118-
plan.clone(),
21192098
sql_query_next,
21202099
sql_generator.clone(),
21212100
*then,
@@ -2129,7 +2108,6 @@ impl CubeScanWrapperNode {
21292108
}
21302109
let else_expr = if let Some(else_expr) = else_expr {
21312110
let (else_expr, sql_query_next) = Self::generate_sql_for_expr(
2132-
plan.clone(),
21332111
sql_query,
21342112
sql_generator.clone(),
21352113
*else_expr,
@@ -2153,7 +2131,6 @@ impl CubeScanWrapperNode {
21532131
}
21542132
Expr::Cast { expr, data_type } => {
21552133
let (expr, sql_query) = Self::generate_sql_for_expr(
2156-
plan.clone(),
21572134
sql_query,
21582135
sql_generator.clone(),
21592136
*expr,
@@ -2174,7 +2151,6 @@ impl CubeScanWrapperNode {
21742151
nulls_first,
21752152
} => {
21762153
let (expr, sql_query) = Self::generate_sql_for_expr(
2177-
plan.clone(),
21782154
sql_query,
21792155
sql_generator.clone(),
21802156
*expr,
@@ -2508,7 +2484,6 @@ impl CubeScanWrapperNode {
25082484
let mut sql_args = Vec::new();
25092485
for arg in args {
25102486
let (sql, query) = Self::generate_sql_for_expr(
2511-
plan.clone(),
25122487
sql_query,
25132488
sql_generator.clone(),
25142489
arg,
@@ -2546,7 +2521,6 @@ impl CubeScanWrapperNode {
25462521
)));
25472522
}
25482523
let (arg_sql, query) = Self::generate_sql_for_expr(
2549-
plan.clone(),
25502524
sql_query,
25512525
sql_generator.clone(),
25522526
args[1].clone(),
@@ -2590,7 +2564,6 @@ impl CubeScanWrapperNode {
25902564
let mut sql_args = Vec::new();
25912565
for arg in args {
25922566
let (sql, query) = Self::generate_sql_for_expr(
2593-
plan.clone(),
25942567
sql_query,
25952568
sql_generator.clone(),
25962569
arg,
@@ -2631,7 +2604,6 @@ impl CubeScanWrapperNode {
26312604
}
26322605
}
26332606
let (sql, query) = Self::generate_sql_for_expr(
2634-
plan.clone(),
26352607
sql_query,
26362608
sql_generator.clone(),
26372609
arg,
@@ -2661,7 +2633,6 @@ impl CubeScanWrapperNode {
26612633
let mut sql_exprs = Vec::new();
26622634
for expr in exprs {
26632635
let (sql, query) = Self::generate_sql_for_expr(
2664-
plan.clone(),
26652636
sql_query,
26662637
sql_generator.clone(),
26672638
expr,
@@ -2690,7 +2661,6 @@ impl CubeScanWrapperNode {
26902661
let mut sql_exprs = Vec::new();
26912662
for expr in exprs {
26922663
let (sql, query) = Self::generate_sql_for_expr(
2693-
plan.clone(),
26942664
sql_query,
26952665
sql_generator.clone(),
26962666
expr,
@@ -2732,7 +2702,6 @@ impl CubeScanWrapperNode {
27322702
let mut sql_args = Vec::new();
27332703
for arg in args {
27342704
let (sql, query) = Self::generate_sql_for_expr(
2735-
plan.clone(),
27362705
sql_query,
27372706
sql_generator.clone(),
27382707
arg,
@@ -2747,7 +2716,6 @@ impl CubeScanWrapperNode {
27472716
let mut sql_partition_by = Vec::new();
27482717
for arg in partition_by {
27492718
let (sql, query) = Self::generate_sql_for_expr(
2750-
plan.clone(),
27512719
sql_query,
27522720
sql_generator.clone(),
27532721
arg,
@@ -2762,7 +2730,6 @@ impl CubeScanWrapperNode {
27622730
let mut sql_order_by = Vec::new();
27632731
for arg in order_by {
27642732
let (sql, query) = Self::generate_sql_for_expr(
2765-
plan.clone(),
27662733
sql_query,
27672734
sql_generator.clone(),
27682735
arg,
@@ -2847,7 +2814,6 @@ impl CubeScanWrapperNode {
28472814
} => {
28482815
let mut sql_query = sql_query;
28492816
let (sql_expr, query) = Self::generate_sql_for_expr(
2850-
plan.clone(),
28512817
sql_query,
28522818
sql_generator.clone(),
28532819
*expr,
@@ -2860,7 +2826,6 @@ impl CubeScanWrapperNode {
28602826
let mut sql_in_exprs = Vec::new();
28612827
for expr in list {
28622828
let (sql, query) = Self::generate_sql_for_expr(
2863-
plan.clone(),
28642829
sql_query,
28652830
sql_generator.clone(),
28662831
expr,
@@ -2892,7 +2857,6 @@ impl CubeScanWrapperNode {
28922857
} => {
28932858
let mut sql_query = sql_query;
28942859
let (sql_expr, query) = Self::generate_sql_for_expr(
2895-
plan.clone(),
28962860
sql_query,
28972861
sql_generator.clone(),
28982862
*expr,
@@ -2903,7 +2867,6 @@ impl CubeScanWrapperNode {
29032867
.await?;
29042868
sql_query = query;
29052869
let (subquery_sql, query) = Self::generate_sql_for_expr(
2906-
plan.clone(),
29072870
sql_query,
29082871
sql_generator.clone(),
29092872
*subquery,

0 commit comments

Comments
 (0)