Skip to content

Commit 55a7b73

Browse files
committed
chore: complex test
1 parent 4dbae78 commit 55a7b73

File tree

1 file changed

+42
-0
lines changed
  • rust/cubesql/cubesql/src/compile

1 file changed

+42
-0
lines changed

rust/cubesql/cubesql/src/compile/mod.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9629,6 +9629,48 @@ ORDER BY "source"."str0" ASC
96299629
)
96309630
}
96319631

9632+
#[tokio::test]
9633+
async fn test_filter_date_part_by_year_quarter_month_week() {
9634+
init_testing_logger();
9635+
9636+
let logical_plan = convert_select_to_query_plan(
9637+
r#"
9638+
SELECT
9639+
COUNT(*) AS "count",
9640+
DATE_PART('year', "KibanaSampleDataEcommerce"."order_date") AS "yr:completedAt:ok"
9641+
FROM "public"."KibanaSampleDataEcommerce" "KibanaSampleDataEcommerce"
9642+
WHERE DATE_PART('year', "KibanaSampleDataEcommerce"."order_date") = 2019
9643+
AND DATE_PART('quarter', "KibanaSampleDataEcommerce"."order_date") = 2
9644+
AND DATE_PART('month', "KibanaSampleDataEcommerce"."order_date") = 4
9645+
AND DATE_PART('week', "KibanaSampleDataEcommerce"."order_date") = 15
9646+
GROUP BY 2
9647+
"#
9648+
.to_string(),
9649+
DatabaseProtocol::PostgreSQL,
9650+
)
9651+
.await
9652+
.as_logical_plan();
9653+
9654+
assert_eq!(
9655+
logical_plan.find_cube_scan().request,
9656+
V1LoadRequestQuery {
9657+
measures: Some(vec!["KibanaSampleDataEcommerce.count".to_string()]),
9658+
dimensions: Some(vec![]),
9659+
segments: Some(vec![]),
9660+
time_dimensions: Some(vec![V1LoadRequestQueryTimeDimension {
9661+
dimension: "KibanaSampleDataEcommerce.order_date".to_string(),
9662+
granularity: Some("year".to_string()),
9663+
date_range: Some(json!(vec![
9664+
"2019-04-08".to_string(),
9665+
"2019-04-14".to_string(),
9666+
])),
9667+
},]),
9668+
order: Some(vec![]),
9669+
..Default::default()
9670+
}
9671+
)
9672+
}
9673+
96329674
#[tokio::test]
96339675
async fn test_tableau_filter_extract_by_year() {
96349676
init_testing_logger();

0 commit comments

Comments
 (0)