beliefer commented on code in PR #43801:
URL: https://github.com/apache/spark/pull/43801#discussion_r1399950925
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -1262,6 +1275,85 @@ class JDBCV2Suite extends QueryTest with
SharedSparkSession with ExplainSuiteHel
checkAnswer(df17, Seq(Row(6, "jen", 12000, 1200, true)))
}
+ test("SPARK-38432: escape the quote, _ and % for DS V2 pushdown") {
+ val df1 =
spark.table("h2.test.address").filter($"email".startsWith("abc_"))
+ checkFiltersRemoved(df1)
+ checkPushedInfo(df1, "PushedFilters: [EMAIL IS NOT NULL, EMAIL LIKE
'abc\\_%']")
+ checkAnswer(df1,
+ Seq(Row("abc_%[email protected]"), Row("abc_'%[email protected]"),
Row("[email protected]")))
+
+ val df2 =
spark.table("h2.test.address").filter($"email".startsWith("abc%"))
+ checkFiltersRemoved(df2)
+ checkPushedInfo(df2, "PushedFilters: [EMAIL IS NOT NULL, EMAIL LIKE
'abc\\%%']")
+ checkAnswer(df2, Seq(Row("abc%[email protected]"), Row("abc%[email protected]")))
+
+ val df3 =
spark.table("h2.test.address").filter($"email".startsWith("abc%_"))
+ checkFiltersRemoved(df3)
+ checkPushedInfo(df3, "PushedFilters: [EMAIL IS NOT NULL, EMAIL LIKE
'abc\\%\\_%']")
+ checkAnswer(df3, Seq(Row("abc%[email protected]")))
+
+ val df4 =
spark.table("h2.test.address").filter($"email".startsWith("abc_%"))
+ checkFiltersRemoved(df4)
+ checkPushedInfo(df4, "PushedFilters: [EMAIL IS NOT NULL, EMAIL LIKE
'abc\\_\\%%']")
+ checkAnswer(df4, Seq(Row("abc_%[email protected]")))
+
+ val df5 =
spark.table("h2.test.address").filter($"email".startsWith("abc_'%"))
+ checkFiltersRemoved(df5)
+ checkPushedInfo(df5, "PushedFilters: [EMAIL IS NOT NULL, EMAIL LIKE
'abc\\_'\\%%']")
Review Comment:
I don't know the background, but it works good.
--
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]