@@ -1175,12 +1175,31 @@ async fn numeric_cast(service: Box<dyn SqlClient>) {
11751175 "INSERT INTO foo.managers (id, department_id) VALUES ('a', 1), ('b', 3), ('c', 3), ('d', 5)"
11761176 ) . await . unwrap ( ) ;
11771177
1178+ let query = "SELECT count(*) from foo.managers WHERE department_id in ('3', '5')" ;
11781179 let result = service
1179- . exec_query ( "SELECT count(*) from foo.managers WHERE department_id in ('3', '5')" )
1180+ . exec_query ( query )
11801181 . await
11811182 . unwrap ( ) ;
11821183
11831184 assert_eq ! ( result. get_rows( ) [ 0 ] , Row :: new( vec![ TableValue :: Int ( 3 ) ] ) ) ;
1185+
1186+ // Check that we're casting '3' to int and not department_id to Utf8, with our Cube-specific type_coercion changes in DF.
1187+ let plans = service. plan_query ( query) . await . unwrap ( ) ;
1188+ let expected =
1189+ "Projection, [count(Int64(1))@0:count(*)]\
1190+ \n LinearFinalAggregate\
1191+ \n CoalescePartitions\
1192+ \n ClusterSend, partitions: [[1]]\
1193+ \n CoalescePartitions\
1194+ \n LinearPartialAggregate\
1195+ \n Projection, []\
1196+ \n Filter, predicate: department_id@0 = 3 OR department_id@0 = 5\
1197+ \n Scan, index: default:1:[1], fields: [department_id], predicate: department_id = Int64(3) OR department_id = Int64(5)\
1198+ \n Empty";
1199+ assert_eq ! (
1200+ expected,
1201+ pp_phys_plan_ext( plans. router. as_ref( ) , & PPOptions { traverse_past_clustersend: true , show_filters: true , ..PPOptions :: none( ) } ) ,
1202+ ) ;
11841203}
11851204
11861205async fn cast_timestamp_to_utf8 ( service : Box < dyn SqlClient > ) {
@@ -7562,12 +7581,34 @@ async fn filter_multiple_in_for_decimal(service: Box<dyn SqlClient>) {
75627581 . exec_query ( "INSERT INTO s.t(i) VALUES (1), (2), (3)" )
75637582 . await
75647583 . unwrap ( ) ;
7584+ let query = "SELECT count(*) FROM s.t WHERE i in ('2', '3')" ;
75657585 let r = service
7566- . exec_query ( "SELECT count(*) FROM s.t WHERE i in ('2', '3')" )
7586+ . exec_query ( query )
75677587 . await
75687588 . unwrap ( ) ;
75697589
75707590 assert_eq ! ( to_rows( & r) , rows( & [ ( 2 ) ] ) ) ;
7591+
7592+ // Verify we're casting '2' and '3' to decimal type and not casting i to Utf8, with Cube-specific DF comparison coercion changes.
7593+ let plans = service. plan_query ( query) . await . unwrap ( ) ;
7594+ let expected =
7595+ "Projection, [count(Int64(1))@0:count(*)]\
7596+ \n LinearFinalAggregate\
7597+ \n CoalescePartitions\
7598+ \n ClusterSend, partitions: [[1]]\
7599+ \n CoalescePartitions\
7600+ \n LinearPartialAggregate\
7601+ \n Projection, []\
7602+ \n Filter, predicate: i@0 = Some(200000),18,5 OR i@0 = Some(300000),18,5\
7603+ \n Scan, index: default:1:[1], fields: *, predicate: i = Decimal128(Some(200000),18,5) OR i = Decimal128(Some(300000),18,5)\
7604+ \n Sort\
7605+ \n Empty";
7606+
7607+ assert_eq ! (
7608+ expected,
7609+ pp_phys_plan_ext( plans. router. as_ref( ) , & PPOptions { traverse_past_clustersend: true , show_filters: true , ..PPOptions :: none( ) } ) ,
7610+ ) ;
7611+
75717612}
75727613
75737614async fn planning_aggregate_index ( service : Box < dyn SqlClient > ) {
0 commit comments