File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
rust/cubesql/cubesql/src/compile Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -11023,6 +11023,48 @@ ORDER BY \"COUNT(count)\" DESC"
11023
11023
) ;
11024
11024
}
11025
11025
11026
+ #[ tokio:: test]
11027
+ async fn test_holistics_str_not_contains_filter ( ) {
11028
+ init_logger ( ) ;
11029
+
11030
+ let logical_plan = convert_select_to_query_plan (
11031
+ "SELECT COUNT(\" table\" .\" count\" ) AS \" c_pu_c_d4696e\"
11032
+ FROM \" public\" .\" KibanaSampleDataEcommerce\" \" table\"
11033
+ WHERE NOT(\" table\" .\" customer_gender\" ILIKE ('%' || CAST ( 'test' AS text ) || '%'))
11034
+ ORDER BY 1 DESC
11035
+ LIMIT 100000"
11036
+ . to_string ( ) ,
11037
+ DatabaseProtocol :: PostgreSQL ,
11038
+ )
11039
+ . await
11040
+ . as_logical_plan ( ) ;
11041
+
11042
+ let cube_scan = logical_plan. find_cube_scan ( ) ;
11043
+
11044
+ assert_eq ! (
11045
+ cube_scan. request,
11046
+ V1LoadRequestQuery {
11047
+ measures: Some ( vec![ "KibanaSampleDataEcommerce.count" . to_string( ) , ] ) ,
11048
+ dimensions: Some ( vec![ ] ) ,
11049
+ segments: Some ( vec![ ] ) ,
11050
+ time_dimensions: None ,
11051
+ order: Some ( vec![ vec![
11052
+ "KibanaSampleDataEcommerce.count" . to_string( ) ,
11053
+ "desc" . to_string( )
11054
+ ] ] ) ,
11055
+ limit: Some ( 50000 ) ,
11056
+ offset: None ,
11057
+ filters: Some ( vec![ V1LoadRequestQueryFilterItem {
11058
+ member: Some ( "KibanaSampleDataEcommerce.customer_gender" . to_string( ) ) ,
11059
+ operator: Some ( "notContains" . to_string( ) ) ,
11060
+ values: Some ( vec![ "test" . to_string( ) ] ) ,
11061
+ or: None ,
11062
+ and: None ,
11063
+ } ] ) ,
11064
+ }
11065
+ ) ;
11066
+ }
11067
+
11026
11068
#[ tokio:: test]
11027
11069
async fn test_select_column_with_same_name_as_table ( ) -> Result < ( ) , CubeError > {
11028
11070
init_logger ( ) ;
Original file line number Diff line number Diff line change @@ -714,6 +714,11 @@ impl RewriteRules for FilterRules {
714
714
) ,
715
715
self . unwrap_datetrunc( "?granularity" , "second" ) ,
716
716
) ,
717
+ rewrite(
718
+ "not-expt-ilike-to-expr-not-ilike" ,
719
+ not_expr( binary_expr( "?left" , "ILIKE" , "?right" ) ) ,
720
+ binary_expr( "?left" , "NOT_ILIKE" , "?right" ) ,
721
+ ) ,
717
722
rewrite(
718
723
"not-expt-like-to-expr-not-like" ,
719
724
not_expr( binary_expr( "?left" , "LIKE" , "?right" ) ) ,
@@ -1162,6 +1167,7 @@ impl FilterRules {
1162
1167
Operator :: Like => "contains" ,
1163
1168
Operator :: ILike => "contains" ,
1164
1169
Operator :: NotLike => "notContains" ,
1170
+ Operator :: NotILike => "notContains" ,
1165
1171
// TODO: support regex totally
1166
1172
Operator :: RegexMatch => "startsWith" ,
1167
1173
_ => {
You can’t perform that action at this time.
0 commit comments