Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 3f8fa1b

Browse files
committed
fix(adv-cost): clippy warnings (#223)
Signed-off-by: Alex Chi <[email protected]>
1 parent 279b561 commit 3f8fa1b

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

optd-core/src/nodes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ impl Value {
190190
}),
191191
DataType::Int64 => Value::Int64(match self {
192192
Value::Int64(i64) => *i64,
193-
Value::Int32(i32) => (*i32).try_into().unwrap(),
193+
Value::Int32(i32) => (*i32).into(),
194194
_ => panic!("{self} could not be converted into an Int64"),
195195
}),
196196
DataType::UInt64 => Value::UInt64(match self {
197197
Value::Int64(i64) => (*i64).try_into().unwrap(),
198198
Value::UInt64(i64) => *i64,
199-
Value::UInt32(i32) => (*i32).try_into().unwrap(),
199+
Value::UInt32(i32) => (*i32).into(),
200200
_ => panic!("{self} could not be converted into an UInt64"),
201201
}),
202202
DataType::Date32 => Value::Date32(match self {

optd-datafusion-repr-adv-cost/src/adv_stats.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const DEFAULT_INEQ_SEL: f64 = 0.3333333333333333;
2626
// Default n-distinct estimate for derived columns or columns lacking statistics
2727
const DEFAULT_NUM_DISTINCT: u64 = 200;
2828
// Default selectivity if we have no information
29+
#[allow(dead_code)]
2930
const DEFAULT_UNK_SEL: f64 = 0.005;
3031

3132
// A placeholder for unimplemented!() for codepaths which are accessed by plannertest
@@ -317,7 +318,7 @@ mod tests {
317318
pub fn in_list(col_ref_idx: u64, list: Vec<Value>, negated: bool) -> InListPred {
318319
InListPred::new(
319320
col_ref(col_ref_idx),
320-
ListPred::new(list.into_iter().map(|v| cnst(v)).collect_vec()),
321+
ListPred::new(list.into_iter().map(cnst).collect_vec()),
321322
negated,
322323
)
323324
}

optd-datafusion-repr-adv-cost/src/adv_stats/agg.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use optd_core::cascades::{CascadesOptimizer, RelNodeContext};
21
use serde::{de::DeserializeOwned, Serialize};
32

43
use crate::adv_stats::{
@@ -7,12 +6,10 @@ use crate::adv_stats::{
76
};
87
use optd_datafusion_repr::{
98
plan_nodes::{ArcDfPredNode, DfReprPredNode, ListPred},
10-
properties::column_ref::{
11-
BaseTableColumnRef, ColumnRef, ColumnRefPropertyBuilder, GroupColumnRefs,
12-
},
9+
properties::column_ref::{BaseTableColumnRef, ColumnRef, GroupColumnRefs},
1310
};
1411

15-
use super::{AdvStats, DEFAULT_UNK_SEL};
12+
use super::AdvStats;
1613

1714
impl<
1815
M: MostCommonValues + Serialize + DeserializeOwned,

optd-datafusion-repr-adv-cost/src/adv_stats/filter.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::ops::Bound;
22

3-
use optd_core::cascades::{CascadesOptimizer, RelNodeContext};
43
use serde::{de::DeserializeOwned, Serialize};
54

65
use crate::adv_stats::{
@@ -13,16 +12,13 @@ use optd_datafusion_repr::{
1312
DfReprPredNode, InListPred, LikePred, LogOpType, UnOpType,
1413
},
1514
properties::{
16-
column_ref::{
17-
BaseTableColumnRef, BaseTableColumnRefs, ColumnRef, ColumnRefPropertyBuilder,
18-
GroupColumnRefs,
19-
},
20-
schema::{Schema, SchemaPropertyBuilder},
15+
column_ref::{BaseTableColumnRef, BaseTableColumnRefs, ColumnRef, GroupColumnRefs},
16+
schema::Schema,
2117
},
2218
Value,
2319
};
2420

25-
use super::{stats::ColumnCombValue, AdvStats, DEFAULT_EQ_SEL, DEFAULT_INEQ_SEL, DEFAULT_UNK_SEL};
21+
use super::{stats::ColumnCombValue, AdvStats, DEFAULT_EQ_SEL, DEFAULT_INEQ_SEL};
2622

2723
mod in_list;
2824
mod like;

optd-datafusion-repr-adv-cost/src/adv_stats/join.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashSet;
22

33
use itertools::Itertools;
4-
use optd_core::cascades::{CascadesOptimizer, RelNodeContext};
4+
55
use serde::{de::DeserializeOwned, Serialize};
66

77
use crate::adv_stats::{
@@ -15,20 +15,21 @@ use optd_datafusion_repr::{
1515
},
1616
properties::{
1717
column_ref::{
18-
BaseTableColumnRef, BaseTableColumnRefs, ColumnRef, ColumnRefPropertyBuilder,
19-
EqBaseTableColumnSets, EqPredicate, GroupColumnRefs, SemanticCorrelation,
18+
BaseTableColumnRef, BaseTableColumnRefs, ColumnRef, EqBaseTableColumnSets, EqPredicate,
19+
GroupColumnRefs, SemanticCorrelation,
2020
},
21-
schema::{Schema, SchemaPropertyBuilder},
21+
schema::Schema,
2222
},
2323
};
2424

25-
use super::{AdvStats, DEFAULT_UNK_SEL};
25+
use super::AdvStats;
2626

2727
impl<
2828
M: MostCommonValues + Serialize + DeserializeOwned,
2929
D: Distribution + Serialize + DeserializeOwned,
3030
> AdvStats<M, D>
3131
{
32+
#[allow(clippy::too_many_arguments)]
3233
pub(crate) fn get_nlj_row_cnt(
3334
&self,
3435
join_typ: JoinType,
@@ -55,6 +56,7 @@ impl<
5556
(left_row_cnt * right_row_cnt * selectivity).max(1.0)
5657
}
5758

59+
#[allow(clippy::too_many_arguments)]
5860
pub(crate) fn get_hash_join_row_cnt(
5961
&self,
6062
join_typ: JoinType,

0 commit comments

Comments
 (0)