Skip to content

Commit 7c78fef

Browse files
authored
test: Add additional contains expression tests (#3462)
1 parent 1ccfa14 commit 7c78fef

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,21 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
12521252
// Test with pattern at end
12531253
val queryEnd = sql(s"select id from $table where contains (name, 'Smith')")
12541254
checkSparkAnswerAndOperator(queryEnd)
1255+
1256+
// Test with null haystack
1257+
sql(s"insert into $table values(6, null)")
1258+
checkSparkAnswerAndOperator(sql(s"select id, contains(name, 'Rose') from $table"))
1259+
1260+
// Test case sensitivity (should not match)
1261+
checkSparkAnswerAndOperator(sql(s"select id from $table where contains(name, 'james')"))
1262+
}
1263+
}
1264+
1265+
test("contains with both columns") {
1266+
withParquetTable(
1267+
Seq(("hello world", "world"), ("foo bar", "baz"), ("abc", ""), (null, "x"), ("test", null)),
1268+
"tbl") {
1269+
checkSparkAnswerAndOperator(sql("select contains(_1, _2) from tbl"))
12551270
}
12561271
}
12571272

0 commit comments

Comments
 (0)