File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ use optd_persistent:: CostModelStorageLayer ;
2+
3+ use crate :: {
4+ common:: {
5+ nodes:: { ArcPredicateNode , ReprPredicateNode } ,
6+ predicates:: constant_pred:: ConstantPred ,
7+ } ,
8+ cost_model:: CostModelImpl ,
9+ CostModelResult , EstimatedStatistic ,
10+ } ;
11+
12+ impl < S : CostModelStorageLayer > CostModelImpl < S > {
13+ pub ( crate ) fn get_limit_row_cnt (
14+ & self ,
15+ child_row_cnt : EstimatedStatistic ,
16+ fetch_expr : ArcPredicateNode ,
17+ ) -> CostModelResult < EstimatedStatistic > {
18+ let fetch = ConstantPred :: from_pred_node ( fetch_expr)
19+ . unwrap ( )
20+ . value ( )
21+ . as_u64 ( ) ;
22+ // u64::MAX represents None
23+ if fetch == u64:: MAX {
24+ Ok ( child_row_cnt)
25+ } else {
26+ Ok ( EstimatedStatistic ( child_row_cnt. 0 . min ( fetch) ) )
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ #![ allow( unused) ]
2+
13pub mod agg;
24pub mod filter;
35pub mod join;
6+ pub mod limit;
You can’t perform that action at this time.
0 commit comments