File tree Expand file tree Collapse file tree 1 file changed +58
-3
lines changed
rust/cubesql/cubesql/src/compile/test Expand file tree Collapse file tree 1 file changed +58
-3
lines changed Original file line number Diff line number Diff line change @@ -1093,11 +1093,66 @@ async fn wrapper_agg_over_limit() {
10931093 . unwrap( )
10941094 . sql
10951095 . contains( "\" limit\" :5" ) ) ;
1096- assert ! ( !query_plan
1097- . as_logical_plan( )
1096+ assert ! ( logical_plan
1097+ . find_cube_scan_wrapper( )
1098+ . wrapped_sql
1099+ . unwrap( )
1100+ . sql
1101+ . contains( "\" ungrouped\" :true" ) ) ;
1102+ }
1103+
1104+ /// Aggregation(dimension) with falsy filter should NOT get pushed to CubeScan with limit=0
1105+ #[ tokio:: test]
1106+ async fn wrapper_dimension_agg_where_false ( ) {
1107+ if !Rewriter :: sql_push_down_enabled ( ) {
1108+ return ;
1109+ }
1110+ init_testing_logger ( ) ;
1111+
1112+ let query_plan = convert_select_to_query_plan (
1113+ // language=PostgreSQL
1114+ r#"
1115+ SELECT
1116+ MAX(customer_gender)
1117+ FROM
1118+ KibanaSampleDataEcommerce
1119+ WHERE 1 = 0
1120+ "#
1121+ . to_string ( ) ,
1122+ DatabaseProtocol :: PostgreSQL ,
1123+ )
1124+ . await ;
1125+
1126+ let physical_plan = query_plan. as_physical_plan ( ) . await . unwrap ( ) ;
1127+ println ! (
1128+ "Physical plan: {}" ,
1129+ displayable( physical_plan. as_ref( ) ) . indent( )
1130+ ) ;
1131+
1132+ let logical_plan = query_plan. as_logical_plan ( ) ;
1133+ assert_eq ! (
1134+ logical_plan. find_cube_scan( ) . request,
1135+ V1LoadRequestQuery {
1136+ measures: Some ( vec![ ] ) ,
1137+ dimensions: Some ( vec![ ] ) ,
1138+ segments: Some ( vec![ ] ) ,
1139+ order: Some ( vec![ ] ) ,
1140+ limit: Some ( 0 ) ,
1141+ ungrouped: Some ( true ) ,
1142+ ..Default :: default ( )
1143+ }
1144+ ) ;
1145+
1146+ assert ! ( logical_plan
1147+ . find_cube_scan_wrapper( )
1148+ . wrapped_sql
1149+ . unwrap( )
1150+ . sql
1151+ . contains( "\" limit\" :0" ) ) ;
1152+ assert ! ( logical_plan
10981153 . find_cube_scan_wrapper( )
10991154 . wrapped_sql
11001155 . unwrap( )
11011156 . sql
1102- . contains( "ungrouped" ) ) ;
1157+ . contains( "\" ungrouped\" :true " ) ) ;
11031158}
You can’t perform that action at this time.
0 commit comments