You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rust/cubesql/cubesql/src/compile/mod.rs
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -18570,6 +18570,35 @@ ORDER BY \"COUNT(count)\" DESC"
18570
18570
);
18571
18571
}
18572
18572
18573
+
#[tokio::test]
18574
+
async fn test_case_wrapper_alias_with_order() {
18575
+
if !Rewriter::sql_push_down_enabled() {
18576
+
return;
18577
+
}
18578
+
init_logger();
18579
+
18580
+
let query_plan = convert_select_to_query_plan(
18581
+
"SELECT CASE WHEN customer_gender = 'female' THEN 'f' ELSE 'm' END AS \"f822c516-3515-11c2-8464-5d4845a02f73\", AVG(avgPrice) mp FROM KibanaSampleDataEcommerce a GROUP BY CASE WHEN customer_gender = 'female' THEN 'f' ELSE 'm' END ORDER BY CASE WHEN customer_gender = 'female' THEN 'f' ELSE 'm' END NULLS FIRST LIMIT 500"
18582
+
.to_string(),
18583
+
DatabaseProtocol::PostgreSQL,
18584
+
)
18585
+
.await;
18586
+
18587
+
let logical_plan = query_plan.as_logical_plan();
18588
+
assert!(logical_plan
18589
+
.find_cube_scan_wrapper()
18590
+
.wrapped_sql
18591
+
.unwrap()
18592
+
.sql
18593
+
.contains("ORDER BY \"case_when_a_cust\""));
18594
+
18595
+
let physical_plan = query_plan.as_physical_plan().await.unwrap();
0 commit comments