File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
rust/cubesql/cubesql/src/compile/test Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ use cubeclient:: models:: V1LoadRequestQuery ;
12use datafusion:: physical_plan:: displayable;
23use std:: sync:: Arc ;
34
@@ -1001,3 +1002,38 @@ async fn test_wrapper_limit_zero() {
10011002
10021003 let _physical_plan = query_plan. as_physical_plan ( ) . await . unwrap ( ) ;
10031004}
1005+
1006+ /// Aggregation with falsy filter should NOT get pushed to CubeScan with limit=0
1007+ #[ tokio:: test]
1008+ async fn select_agg_where_false ( ) {
1009+ if !Rewriter :: sql_push_down_enabled ( ) {
1010+ return ;
1011+ }
1012+ init_testing_logger ( ) ;
1013+
1014+ let query_plan = convert_select_to_query_plan (
1015+ "SELECT SUM(sumPrice) FROM KibanaSampleDataEcommerce WHERE 1 = 0" . to_string ( ) ,
1016+ DatabaseProtocol :: PostgreSQL ,
1017+ )
1018+ . await ;
1019+
1020+ let physical_plan = query_plan. as_physical_plan ( ) . await . unwrap ( ) ;
1021+ println ! (
1022+ "Physical plan: {}" ,
1023+ displayable( physical_plan. as_ref( ) ) . indent( )
1024+ ) ;
1025+
1026+ let logical_plan = query_plan. as_logical_plan ( ) ;
1027+ assert_eq ! (
1028+ logical_plan. find_cube_scan( ) . request,
1029+ V1LoadRequestQuery {
1030+ measures: Some ( vec![ ] ) ,
1031+ segments: Some ( vec![ ] ) ,
1032+ dimensions: Some ( vec![ ] ) ,
1033+ order: Some ( vec![ ] ) ,
1034+ limit: None ,
1035+ ungrouped: Some ( true ) ,
1036+ ..Default :: default ( )
1037+ }
1038+ ) ;
1039+ }
You can’t perform that action at this time.
0 commit comments