@@ -3776,3 +3776,134 @@ async fn test_datafusion_is_not_null_relationship_property() {
37763776 ) ;
37773777 }
37783778}
3779+
3780+ // ============================================================================
3781+ // LIKE Pattern Matching Tests
3782+ // ============================================================================
3783+
3784+ #[ tokio:: test]
3785+ async fn test_datafusion_like_contains_match ( ) {
3786+ // Test LIKE with contains pattern (anywhere in string)
3787+ let config = create_graph_config ( ) ;
3788+ let person_batch = create_person_dataset ( ) ;
3789+
3790+ let query = CypherQuery :: new (
3791+ "MATCH (p:Person) \
3792+ WHERE p.city LIKE '%ea%' \
3793+ RETURN p.name ORDER BY p.name",
3794+ )
3795+ . unwrap ( )
3796+ . with_config ( config) ;
3797+
3798+ let mut datasets = HashMap :: new ( ) ;
3799+ datasets. insert ( "Person" . to_string ( ) , person_batch) ;
3800+
3801+ let result = query
3802+ . execute ( datasets, Some ( ExecutionStrategy :: DataFusion ) )
3803+ . await
3804+ . unwrap ( ) ;
3805+
3806+ // Should match: Seattle (Eve)
3807+ assert_eq ! ( result. num_rows( ) , 1 ) ;
3808+ let names = result
3809+ . column ( 0 )
3810+ . as_any ( )
3811+ . downcast_ref :: < StringArray > ( )
3812+ . unwrap ( ) ;
3813+ assert_eq ! ( names. value( 0 ) , "Eve" ) ;
3814+ }
3815+
3816+ #[ tokio:: test]
3817+ async fn test_datafusion_like_with_and_condition ( ) {
3818+ let config = create_graph_config ( ) ;
3819+ let person_batch = create_person_dataset ( ) ;
3820+
3821+ let query = CypherQuery :: new (
3822+ "MATCH (p:Person) \
3823+ WHERE p.age > 30 AND p.name LIKE '%e' \
3824+ RETURN p.name",
3825+ )
3826+ . unwrap ( )
3827+ . with_config ( config) ;
3828+
3829+ let mut datasets = HashMap :: new ( ) ;
3830+ datasets. insert ( "Person" . to_string ( ) , person_batch) ;
3831+
3832+ let result = query
3833+ . execute ( datasets, Some ( ExecutionStrategy :: DataFusion ) )
3834+ . await
3835+ . unwrap ( ) ;
3836+
3837+ // Should match: Charlie (age 30 is NOT > 30, so excluded)
3838+ // Bob (age 35), David (age 40), Eve (age 28 not > 30)
3839+ // Names ending with 'e': Alice, Charlie, Eve
3840+ // age > 30 AND name ends with 'e': None (Alice is 25, Charlie is 30, Eve is 28)
3841+ assert_eq ! ( result. num_rows( ) , 0 ) ;
3842+ }
3843+
3844+ #[ tokio:: test]
3845+ async fn test_datafusion_like_in_relationship_query ( ) {
3846+ let config = create_graph_config ( ) ;
3847+ let person_batch = create_person_dataset ( ) ;
3848+ let knows_batch = create_knows_dataset ( ) ;
3849+
3850+ let query = CypherQuery :: new (
3851+ "MATCH (a:Person)-[r:KNOWS]->(b:Person) \
3852+ WHERE a.name LIKE 'A%' \
3853+ RETURN a.name, b.name ORDER BY b.name",
3854+ )
3855+ . unwrap ( )
3856+ . with_config ( config) ;
3857+
3858+ let mut datasets = HashMap :: new ( ) ;
3859+ datasets. insert ( "Person" . to_string ( ) , person_batch) ;
3860+ datasets. insert ( "KNOWS" . to_string ( ) , knows_batch) ;
3861+
3862+ let result = query
3863+ . execute ( datasets, Some ( ExecutionStrategy :: DataFusion ) )
3864+ . await
3865+ . unwrap ( ) ;
3866+
3867+ // Alice knows Bob and Charlie
3868+ assert_eq ! ( result. num_rows( ) , 2 ) ;
3869+ let a_names = result
3870+ . column ( 0 )
3871+ . as_any ( )
3872+ . downcast_ref :: < StringArray > ( )
3873+ . unwrap ( ) ;
3874+ let b_names = result
3875+ . column ( 1 )
3876+ . as_any ( )
3877+ . downcast_ref :: < StringArray > ( )
3878+ . unwrap ( ) ;
3879+
3880+ assert_eq ! ( a_names. value( 0 ) , "Alice" ) ;
3881+ assert_eq ! ( b_names. value( 0 ) , "Bob" ) ;
3882+ assert_eq ! ( a_names. value( 1 ) , "Alice" ) ;
3883+ assert_eq ! ( b_names. value( 1 ) , "Charlie" ) ;
3884+ }
3885+
3886+ #[ tokio:: test]
3887+ async fn test_datafusion_like_case_sensitive ( ) {
3888+ let config = create_graph_config ( ) ;
3889+ let person_batch = create_person_dataset ( ) ;
3890+
3891+ let query = CypherQuery :: new (
3892+ "MATCH (p:Person) \
3893+ WHERE p.name LIKE 'a%' \
3894+ RETURN p.name",
3895+ )
3896+ . unwrap ( )
3897+ . with_config ( config) ;
3898+
3899+ let mut datasets = HashMap :: new ( ) ;
3900+ datasets. insert ( "Person" . to_string ( ) , person_batch) ;
3901+
3902+ let result = query
3903+ . execute ( datasets, Some ( ExecutionStrategy :: DataFusion ) )
3904+ . await
3905+ . unwrap ( ) ;
3906+
3907+ // Should not match 'Alice' (lowercase 'a' vs uppercase 'A')
3908+ assert_eq ! ( result. num_rows( ) , 0 ) ;
3909+ }
0 commit comments