cloud-fan commented on code in PR #36593:
URL: https://github.com/apache/spark/pull/36593#discussion_r910232604
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -917,6 +994,49 @@ class JDBCV2Suite extends QueryTest with
SharedSparkSession with ExplainSuiteHel
}
}
+ test("scan with filter push-down with UDF") {
+ JdbcDialects.unregisterDialect(H2Dialect)
+ try {
+ JdbcDialects.registerDialect(testH2Dialect)
+ val df1 = sql("SELECT * FROM h2.test.people where h2.my_strlen(name) >
2")
+ checkFiltersRemoved(df1)
+ checkPushedInfo(df1, "PushedFilters: [char_length(NAME) > 2],")
+ checkAnswer(df1, Seq(Row("fred", 1), Row("mary", 2)))
+
+ val df2 = sql("SELECT * FROM h2.test.people where h2.my_strlen(name) >
4")
+ checkFiltersRemoved(df2)
+ checkPushedInfo(df2, "PushedFilters: [char_length(NAME) > 4],")
+ checkAnswer(df2, Seq())
+
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
+ val df3 = sql(
+ """
+ |SELECT *
+ |FROM h2.test.people
+ |WHERE h2.my_strlen(CASE WHEN NAME = 'fred' THEN NAME ELSE "abc"
END) > 2
+ """.stripMargin)
+ checkFiltersRemoved(df3)
+ checkPushedInfo(df3,
+ "PushedFilters: [char_length(CASE WHEN NAME = 'fred' THEN NAME ELSE
'abc' END) > 2],")
+ checkAnswer(df3, Seq(Row("fred", 1), Row("mary", 2)))
+
+ val df4 = sql(
+ """
+ |SELECT *
+ |FROM h2.test.people
+ |WHERE h2.my_strlen(CASE WHEN NAME = 'fred' THEN NAME ELSE "abc"
END) > 3
Review Comment:
ditto, let's remove one test
--
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]