File tree Expand file tree Collapse file tree 5 files changed +29
-3
lines changed
Expand file tree Collapse file tree 5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 6060 echo " $t "
6161 fp=" ` pwd` /data/$t .csv"
6262 echo " copy into ${MYSQL_DATABASE} .$t from 'fs://${fp} ' file_format = (type = CSV skip_header = 1 field_delimiter = '|' record_delimiter = '\n')" | $BENDSQL_CLIENT_CONNECT
63+ echo " analyze table ${MYSQL_DATABASE} .$t " | $BENDSQL_CLIENT_CONNECT
6364done
6465
6566
Original file line number Diff line number Diff line change 117117 echo " $t "
118118 fp=" ` pwd` /data/$t .tbl"
119119 echo " copy into ${MYSQL_DATABASE} .$t from 'fs://${fp} ' file_format = (type = CSV skip_header = 1 field_delimiter = '|' record_delimiter = '\n')" | $BENDSQL_CLIENT_CONNECT
120+ echo " analyze table ${MYSQL_DATABASE} .$t " | $BENDSQL_CLIENT_CONNECT
120121done
Original file line number Diff line number Diff line change @@ -182,4 +182,21 @@ impl Datum {
182182 ) ) ) ,
183183 }
184184 }
185+
186+ pub fn can_compare ( & self , other : & Self ) -> bool {
187+ match ( self , other) {
188+ ( Datum :: Bool ( _) , Datum :: Bool ( _) )
189+ | ( Datum :: Int ( _) , Datum :: Int ( _) )
190+ | ( Datum :: Int ( _) , Datum :: UInt ( _) )
191+ | ( Datum :: Int ( _) , Datum :: Float ( _) )
192+ | ( Datum :: UInt ( _) , Datum :: UInt ( _) )
193+ | ( Datum :: UInt ( _) , Datum :: Int ( _) )
194+ | ( Datum :: UInt ( _) , Datum :: Float ( _) )
195+ | ( Datum :: Float ( _) , Datum :: Float ( _) )
196+ | ( Datum :: Float ( _) , Datum :: Int ( _) )
197+ | ( Datum :: Float ( _) , Datum :: UInt ( _) )
198+ | ( Datum :: Bytes ( _) , Datum :: Bytes ( _) ) => true ,
199+ _ => false ,
200+ }
201+ }
185202}
Original file line number Diff line number Diff line change @@ -442,6 +442,10 @@ impl<'a> SelectivityEstimator<'a> {
442442 let lower_bound = bucket. lower_bound ( ) ;
443443 let upper_bound = bucket. upper_bound ( ) ;
444444
445+ if !const_datum. can_compare ( & lower_bound) {
446+ return Ok ( DEFAULT_SELECTIVITY ) ;
447+ }
448+
445449 let const_gte_upper_bound = matches ! (
446450 const_datum. compare( upper_bound) ?,
447451 Ordering :: Greater | Ordering :: Equal
Original file line number Diff line number Diff line change @@ -3169,10 +3169,10 @@ impl<'a> TypeChecker<'a> {
31693169 if let SetExpr :: Select ( select_stmt) = & subquery. body {
31703170 if typ == SubqueryType :: Scalar {
31713171 let select = & select_stmt. select_list [ 0 ] ;
3172- if let SelectTarget :: AliasedExpr { expr , .. } = select {
3172+ if matches ! ( select , SelectTarget :: AliasedExpr { .. } ) {
31733173 // Check if contain aggregation function
31743174 #[ derive( Visitor ) ]
3175- #[ visitor( ASTFunctionCall ( enter) ) ]
3175+ #[ visitor( Expr ( enter ) , ASTFunctionCall ( enter) ) ]
31763176 struct AggFuncVisitor {
31773177 contain_agg : bool ,
31783178 }
@@ -3182,9 +3182,12 @@ impl<'a> TypeChecker<'a> {
31823182 || AggregateFunctionFactory :: instance ( )
31833183 . contains ( func. name . to_string ( ) ) ;
31843184 }
3185+ fn enter_expr ( & mut self , expr : & Expr ) {
3186+ self . contain_agg = matches ! ( expr, Expr :: CountAll { window: None , .. } ) ;
3187+ }
31853188 }
31863189 let mut visitor = AggFuncVisitor { contain_agg : false } ;
3187- expr . drive ( & mut visitor) ;
3190+ select . drive ( & mut visitor) ;
31883191 contain_agg = Some ( visitor. contain_agg ) ;
31893192 }
31903193 }
You can’t perform that action at this time.
0 commit comments