@@ -4127,4 +4127,37 @@ mod tests {
4127
4127
"
4128
4128
)
4129
4129
}
4130
+
4131
+ /// Create a test table scan with uppercase column names for case sensitivity testing
4132
+ fn test_table_scan_with_uppercase_columns ( ) -> Result < LogicalPlan > {
4133
+ let schema = Schema :: new ( vec ! [
4134
+ Field :: new( "A" , DataType :: UInt32 , false ) ,
4135
+ Field :: new( "B" , DataType :: UInt32 , false ) ,
4136
+ Field :: new( "C" , DataType :: UInt32 , false ) ,
4137
+ ] ) ;
4138
+ table_scan ( Some ( "test" ) , & schema, None ) ?. build ( )
4139
+ }
4140
+
4141
+ #[ test]
4142
+ fn filter_agg_case_insensitive ( ) -> Result < ( ) > {
4143
+ // Create a table with uppercase column names to test case sensitivity
4144
+ let table_scan = test_table_scan_with_uppercase_columns ( ) ?;
4145
+ let plan = LogicalPlanBuilder :: from ( table_scan)
4146
+ . aggregate (
4147
+ vec ! [ col( r#""A""# ) ] ,
4148
+ vec ! [ sum( col( r#""B""# ) ) . alias( "total_salary" ) ] ,
4149
+ ) ?
4150
+ // Use a lowercase column name in the filter to test case insensitivity
4151
+ . filter ( col ( r#""A""# ) . gt ( lit ( 10i64 ) ) ) ?
4152
+ . build ( ) ?;
4153
+
4154
+ // With the fix, the filter should be pushed down through the aggregation
4155
+ assert_optimized_plan_equal ! (
4156
+ plan,
4157
+ @r"
4158
+ Aggregate: groupBy=[[test.A]], aggr=[[sum(test.B) AS total_salary]]
4159
+ TableScan: test, full_filters=[test.A > Int64(10)]
4160
+ "
4161
+ )
4162
+ }
4130
4163
}
0 commit comments