@@ -523,6 +523,7 @@ public void testLargeNotInNull() {
523523
524524 @ Test
525525 public void testLike () {
526+ // test eval
526527 assertThat (testLike ("abc" , "a.c" )).isEqualTo (false );
527528 assertThat (testLike ("a.c" , "a.c" )).isEqualTo (true );
528529 assertThat (testLike ("abcd" , "a.*d" )).isEqualTo (false );
@@ -540,6 +541,13 @@ public void testLike() {
540541 assertThat (testLike ("startxx" , "st_rt%" )).isEqualTo (true );
541542 assertThat (testLike ("stbrtxx" , "st_rt%" )).isEqualTo (true );
542543 assertThat (testLike ("xxstbrtxx" , "st_rt%" )).isEqualTo (false );
544+
545+ // test instance
546+ assertThat (getLikeFunc ("equal" )).isEqualTo (Equal .INSTANCE );
547+ assertThat (getLikeFunc ("start%" )).isEqualTo (StartsWith .INSTANCE );
548+ assertThat (getLikeFunc ("%end" )).isEqualTo (EndsWith .INSTANCE );
549+ assertThat (getLikeFunc ("%middle%" )).isEqualTo (Contains .INSTANCE );
550+ assertThat (getLikeFunc ("a_c" )).isEqualTo (Like .INSTANCE );
543551 }
544552
545553 private boolean testLike (String s , String pattern ) {
@@ -548,6 +556,12 @@ private boolean testLike(String s, String pattern) {
548556 return predicate .test (GenericRow .of (fromString (s )));
549557 }
550558
559+ private LeafFunction getLikeFunc (String pattern ) {
560+ PredicateBuilder builder = new PredicateBuilder (RowType .of (new VarCharType ()));
561+ Predicate predicate = builder .like (0 , fromString (pattern ));
562+ return ((LeafPredicate ) predicate ).function ;
563+ }
564+
551565 @ Test
552566 public void testAnd () {
553567 PredicateBuilder builder = new PredicateBuilder (RowType .of (new IntType (), new IntType ()));
0 commit comments