@@ -661,6 +661,124 @@ func TestStringMatchingFunctions(t *testing.T) {
661661 }
662662}
663663
664+ func TestCaseInsensitiveStringFunctions (t * testing.T ) {
665+ tests := []struct {
666+ name string
667+ op types.BinaryOp
668+ lhs []string
669+ rhs []string
670+ expected []bool
671+ }{
672+ {
673+ name : "case insensitive equality - lowercase pattern" ,
674+ op : types .BinaryOpEqCaseInsensitive ,
675+ lhs : []string {"Hello" , "WORLD" , "TeSt" , "" },
676+ rhs : []string {"HELLO" , "WORLD" , "TEST" , "" },
677+ expected : []bool {true , true , true , true },
678+ },
679+ {
680+ name : "case insensitive equality - mixed case pattern" ,
681+ op : types .BinaryOpEqCaseInsensitive ,
682+ lhs : []string {"ERROR" , "Warning" , "info" },
683+ rhs : []string {"ERROR" , "WARNING" , "INFO" },
684+ expected : []bool {true , true , true },
685+ },
686+ {
687+ name : "case insensitive equality - no match" ,
688+ op : types .BinaryOpEqCaseInsensitive ,
689+ lhs : []string {"HELLO" , "WORLD" , "TEST" },
690+ rhs : []string {"GOODBYE" , "EARTH" , "EXAM" },
691+ expected : []bool {false , false , false },
692+ },
693+ {
694+ name : "case insensitive inequality - match" ,
695+ op : types .BinaryOpNotEqCaseInsensitive ,
696+ lhs : []string {"Hello" , "WORLD" },
697+ rhs : []string {"HELLO" , "WORLD" },
698+ expected : []bool {false , false },
699+ },
700+ {
701+ name : "case insensitive inequality - no match" ,
702+ op : types .BinaryOpNotEqCaseInsensitive ,
703+ lhs : []string {"HELLO" , "WORLD" },
704+ rhs : []string {"GOODBYE" , "EARTH" },
705+ expected : []bool {true , true },
706+ },
707+ {
708+ name : "case insensitive substring - basic" ,
709+ op : types .BinaryOpMatchSubstrCaseInsensitive ,
710+ lhs : []string {"Hello World" , "TEST STRING" , "FooBar" },
711+ rhs : []string {"WORLD" , "STRING" , "FOOBAR" },
712+ expected : []bool {true , true , true },
713+ },
714+ {
715+ name : "case insensitive substring - mixed case lhs and rhs" ,
716+ op : types .BinaryOpMatchSubstrCaseInsensitive ,
717+ lhs : []string {"Error Occurred" , "WARNING message" , "Info: log" },
718+ rhs : []string {"ERROR" , "WARNING" , "INFO" },
719+ expected : []bool {true , true , true },
720+ },
721+ {
722+ name : "case insensitive substring - no match" ,
723+ op : types .BinaryOpMatchSubstrCaseInsensitive ,
724+ lhs : []string {"hello world" , "test string" },
725+ rhs : []string {"GOODBYE" , "EXAM" },
726+ expected : []bool {false , false },
727+ },
728+ {
729+ name : "case insensitive substring - empty string" ,
730+ op : types .BinaryOpMatchSubstrCaseInsensitive ,
731+ lhs : []string {"anything" , "" },
732+ rhs : []string {"" , "" },
733+ expected : []bool {true , true },
734+ },
735+ {
736+ name : "case insensitive not substring - match" ,
737+ op : types .BinaryOpNotMatchSubstrCaseInsensitive ,
738+ lhs : []string {"Hello World" , "TEST" },
739+ rhs : []string {"WORLD" , "TEST" },
740+ expected : []bool {false , false },
741+ },
742+ {
743+ name : "case insensitive not substring - no match" ,
744+ op : types .BinaryOpNotMatchSubstrCaseInsensitive ,
745+ lhs : []string {"hello world" , "test string" },
746+ rhs : []string {"GOODBYE" , "EXAM" },
747+ expected : []bool {true , true },
748+ },
749+ {
750+ name : "case insensitive with unicode" ,
751+ op : types .BinaryOpMatchSubstrCaseInsensitive ,
752+ lhs : []string {"Error in MÜNCHEN" , "ΑΒΓΔ test" },
753+ rhs : []string {"MÜNCHEN" , "ΑΒΓΔ" },
754+ expected : []bool {true , true },
755+ },
756+ {
757+ name : "case insensitive with numbers and special chars" ,
758+ op : types .BinaryOpEqCaseInsensitive ,
759+ lhs : []string {"Error123!" , "Test@456" },
760+ rhs : []string {"ERROR123!" , "TEST@456" },
761+ expected : []bool {true , true },
762+ },
763+ }
764+
765+ for _ , tt := range tests {
766+ t .Run (tt .name , func (t * testing.T ) {
767+ lhsArray := createStringArray (tt .lhs , nil )
768+ rhsArray := createStringArray (tt .rhs , nil )
769+
770+ fn , err := binaryFunctions .GetForSignature (tt .op , arrow .BinaryTypes .String )
771+ require .NoError (t , err )
772+
773+ result , err := fn .Evaluate (lhsArray , rhsArray , false , false )
774+ require .NoError (t , err )
775+
776+ actual , _ := extractBoolValues (result )
777+ assert .Equal (t , tt .expected , actual )
778+ })
779+ }
780+ }
781+
664782func TestCompileRegexMatchFunctions (t * testing.T ) {
665783 tests := []struct {
666784 name string
0 commit comments