Skip to content

Commit ba4a242

Browse files
committed
test(cubesql): Add test for aggregation with WHERE false
1 parent f67418d commit ba4a242

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

rust/cubesql/cubesql/src/compile/test/test_wrapper.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,3 +1205,38 @@ async fn wrapper_agg_dimension_over_limit() {
12051205
.sql
12061206
.contains("\"ungrouped\":true"));
12071207
}
1208+
1209+
/// Aggregation with falsy filter should NOT get pushed to CubeScan with limit=0
1210+
#[tokio::test]
1211+
async fn select_agg_where_false() {
1212+
if !Rewriter::sql_push_down_enabled() {
1213+
return;
1214+
}
1215+
init_testing_logger();
1216+
1217+
let query_plan = convert_select_to_query_plan(
1218+
"SELECT SUM(sumPrice) FROM KibanaSampleDataEcommerce WHERE 1 = 0".to_string(),
1219+
DatabaseProtocol::PostgreSQL,
1220+
)
1221+
.await;
1222+
1223+
let physical_plan = query_plan.as_physical_plan().await.unwrap();
1224+
println!(
1225+
"Physical plan: {}",
1226+
displayable(physical_plan.as_ref()).indent()
1227+
);
1228+
1229+
let logical_plan = query_plan.as_logical_plan();
1230+
assert_eq!(
1231+
logical_plan.find_cube_scan().request,
1232+
V1LoadRequestQuery {
1233+
measures: Some(vec![]),
1234+
segments: Some(vec![]),
1235+
dimensions: Some(vec![]),
1236+
order: Some(vec![]),
1237+
limit: None,
1238+
ungrouped: Some(true),
1239+
..Default::default()
1240+
}
1241+
);
1242+
}

0 commit comments

Comments
 (0)