@@ -1428,6 +1428,38 @@ mod tests {
14281428 assert_optimized_plan_eq ( plan, expected)
14291429 }
14301430
1431+ /// verifies that filters with unusual identifier names are pushed down through window functions
1432+ #[ test]
1433+ fn filter_window_special_identifier ( ) -> Result < ( ) > {
1434+ let schema = Schema :: new ( vec ! [
1435+ Field :: new( "$a" , DataType :: UInt32 , false ) ,
1436+ Field :: new( "$b" , DataType :: UInt32 , false ) ,
1437+ Field :: new( "$c" , DataType :: UInt32 , false ) ,
1438+ ] ) ;
1439+ let table_scan = table_scan ( Some ( "test" ) , & schema, None ) ?. build ( ) ?;
1440+
1441+ let window = Expr :: WindowFunction ( WindowFunction :: new (
1442+ WindowFunctionDefinition :: WindowUDF (
1443+ datafusion_functions_window:: rank:: rank_udwf ( ) ,
1444+ ) ,
1445+ vec ! [ ] ,
1446+ ) )
1447+ . partition_by ( vec ! [ col( "$a" ) , col( "$b" ) ] )
1448+ . order_by ( vec ! [ col( "$c" ) . sort( true , true ) ] )
1449+ . build ( )
1450+ . unwrap ( ) ;
1451+
1452+ let plan = LogicalPlanBuilder :: from ( table_scan)
1453+ . window ( vec ! [ window] ) ?
1454+ . filter ( col ( "$b" ) . gt ( lit ( 10i64 ) ) ) ?
1455+ . build ( ) ?;
1456+
1457+ let expected = "\
1458+ WindowAggr: windowExpr=[[rank() PARTITION BY [test.$a, test.$b] ORDER BY [test.$c ASC NULLS FIRST] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW]]\
1459+ \n TableScan: test, full_filters=[test.$b > Int64(10)]";
1460+ assert_optimized_plan_eq ( plan, expected)
1461+ }
1462+
14311463 /// verifies that when partitioning by 'a' and 'b', and filtering by 'a' and 'b', both 'a' and
14321464 /// 'b' are pushed
14331465 #[ test]
0 commit comments