File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
rust/cubesql/cubesql/src/compile/rewrite/rules Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -1675,7 +1675,34 @@ impl RewriteRules for FilterRules {
16751675 binary_expr(
16761676 self . fun_expr(
16771677 "DatePart" ,
1678- // LOL, DF plans date_part granularity in lowercase, while Extract is uppercase
1678+ vec![ literal_string( "YEAR" ) , column_expr( "?column" ) ] ,
1679+ ) ,
1680+ "=" ,
1681+ literal_expr( "?year" ) ,
1682+ ) ,
1683+ "?alias_to_cube" ,
1684+ "?members" ,
1685+ "?filter_aliases" ,
1686+ ) ,
1687+ filter_member( "?member" , "FilterMemberOp:inDateRange" , "?values" ) ,
1688+ self . transform_filter_extract_year_equals(
1689+ "?year" ,
1690+ "?column" ,
1691+ "?alias_to_cube" ,
1692+ "?members" ,
1693+ "?member" ,
1694+ "?values" ,
1695+ "?filter_aliases" ,
1696+ ) ,
1697+ ) ,
1698+ // Same as the rule above, but it uses different case for granularity.
1699+ // TODO: Remove, whenever we will fix bug with granularity cases. CORE-1761
1700+ transforming_rewrite(
1701+ "extract-year-equals" ,
1702+ filter_replacer(
1703+ binary_expr(
1704+ self . fun_expr(
1705+ "DatePart" ,
16791706 vec![ literal_string( "year" ) , column_expr( "?column" ) ] ,
16801707 ) ,
16811708 "=" ,
@@ -1696,7 +1723,6 @@ impl RewriteRules for FilterRules {
16961723 "?filter_aliases" ,
16971724 ) ,
16981725 ) ,
1699- // Same as the rule above, but wrapped with TRUNC
17001726 // TRUNC(EXTRACT(YEAR FROM "KibanaSampleDataEcommerce"."order_date")) = 2019
17011727 transforming_rewrite(
17021728 "extract-trunc-year-equals" ,
You can’t perform that action at this time.
0 commit comments