File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2695,6 +2695,30 @@ mod tests {
26952695 }
26962696 }
26972697
2698+ #[ tokio:: test]
2699+ async fn test_maybe_fix_colon_in_physical_name ( ) {
2700+ // The physical schema has a field name with a colon
2701+ let schema = Schema :: new ( vec ! [ Field :: new( "metric:avg" , DataType :: Int32 , false ) ] ) ;
2702+ let schema_ref: SchemaRef = Arc :: new ( schema) ;
2703+
2704+ // What might happen after deduplication
2705+ let logical_col_name = "metric:avg:1" ;
2706+ let expr_with_suffix =
2707+ Arc :: new ( Column :: new ( logical_col_name, 0 ) ) as Arc < dyn PhysicalExpr > ;
2708+ let expr_result = Ok ( expr_with_suffix) ;
2709+
2710+ // Call function under test
2711+ let fixed_expr =
2712+ maybe_fix_physical_column_name ( expr_result, & schema_ref) . unwrap ( ) ;
2713+
2714+ // Downcast back to Column so we can check the name
2715+ let col = fixed_expr
2716+ . as_any ( )
2717+ . downcast_ref :: < Column > ( )
2718+ . expect ( "Column" ) ;
2719+
2720+ assert_eq ! ( col. name( ) , "metric:avg" ) ;
2721+ }
26982722 struct ErrorExtensionPlanner { }
26992723
27002724 #[ async_trait]
You can’t perform that action at this time.
0 commit comments