srielau commented on code in PR #59716:
URL: https://github.com/apache/spark/pull/59716#discussion_r4352710135
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -2017,6 +2017,40 @@ class JDBCV2Suite extends SharedSparkSession with
ExplainSuiteHelper {
checkAnswer(df10, Seq(Row(6, "jen", 12000, 1200, true)))
}
+ test("SPARK-60479: CHAR equality is pushed down with read-side padding") {
+ val table = "h2.test.char_pad"
+ withTable(table) {
+ sql(s"CREATE TABLE $table (id INT, flag CHAR(5))")
+ sql(s"INSERT INTO $table VALUES (1, 'Y'), (2, 'N'), (3, 'YES')")
Review Comment:
The H2 table now has a NULL row and a non-ASCII value, and the test covers
`IS NULL`, `NOT IN`, `OR`, `<=>`, a longer literal, a range, `LIKE`, `COUNT`,
`GROUP BY`, and top-N. Same NULL cases are in the SQL Server and Postgres
docker suites.
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -2017,6 +2017,40 @@ class JDBCV2Suite extends SharedSparkSession with
ExplainSuiteHelper {
checkAnswer(df10, Seq(Row(6, "jen", 12000, 1200, true)))
}
+ test("SPARK-60479: CHAR equality is pushed down with read-side padding") {
+ val table = "h2.test.char_pad"
+ withTable(table) {
+ sql(s"CREATE TABLE $table (id INT, flag CHAR(5))")
+ sql(s"INSERT INTO $table VALUES (1, 'Y'), (2, 'N'), (3, 'YES')")
+
+ val eq = sql(s"SELECT id FROM $table WHERE flag = 'Y'")
+ checkFiltersRemoved(eq)
+ checkPushedInfo(eq, "flag IS NOT NULL", "(RPAD(flag, 5, ' ')) = 'Y '")
+ checkAnswer(eq, Seq(Row(1)))
+
+ val in = sql(s"SELECT id FROM $table WHERE flag IN ('Y', 'N')")
+ checkFiltersRemoved(in)
+ checkPushedInfo(in, "RPAD(flag, 5, ' ') IN ('Y ', 'N ')")
Review Comment:
`=` now asserts the full `PushedFilters: [flag IS NOT NULL,
(CHAR_READ_SIDE_PADDING(flag, 5, ' ')) = 'Y ']`. `IN` asserts
`PushedFilters: [CHAR_READ_SIDE_PADDING(...) IN (...)]` with no `IS NOT NULL`.
`NOT IN` is the same (no null-intolerant unwrap).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]