Skip to content

Commit d482729

Browse files
xx01cyxlanlou1554
authored andcommitted
move filter-related constants to stats crate
1 parent af550ca commit d482729

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

optd-cost-model/src/cost/filter.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,13 @@ use crate::{
2222
values::Value,
2323
},
2424
cost_model::CostModelImpl,
25-
stats::{AttributeCombValue, AttributeCombValueStats},
25+
stats::{
26+
AttributeCombValue, AttributeCombValueStats, DEFAULT_EQ_SEL, DEFAULT_INEQ_SEL,
27+
FIXED_CHAR_SEL_FACTOR, FULL_WILDCARD_SEL_FACTOR, UNIMPLEMENTED_SEL,
28+
},
2629
CostModelResult, EstimatedStatistic,
2730
};
2831

29-
// A placeholder for unimplemented!() for codepaths which are accessed by plannertest
30-
const UNIMPLEMENTED_SEL: f64 = 0.01;
31-
// Default statistics. All are from selfuncs.h in Postgres unless specified otherwise
32-
// Default selectivity estimate for equalities such as "A = b"
33-
const DEFAULT_EQ_SEL: f64 = 0.005;
34-
// Default selectivity estimate for inequalities such as "A < b"
35-
const DEFAULT_INEQ_SEL: f64 = 0.3333333333333333;
36-
// Used for estimating pattern selectivity character-by-character. These numbers
37-
// are not used on their own. Depending on the characters in the pattern, the
38-
// selectivity is multiplied by these factors.
39-
//
40-
// See `FULL_WILDCARD_SEL` and `FIXED_CHAR_SEL` in Postgres.
41-
const FULL_WILDCARD_SEL_FACTOR: f64 = 5.0;
42-
const FIXED_CHAR_SEL_FACTOR: f64 = 0.2;
43-
4432
impl<S: CostModelStorageLayer> CostModelImpl<S> {
4533
// TODO: is it a good design to pass table_id here? I think it needs to be refactored.
4634
// Consider to remove table_id.

0 commit comments

Comments
 (0)