Github user sureshthalamati commented on a diff in the pull request:
https://github.com/apache/spark/pull/15662#discussion_r86292199
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
---
@@ -790,4 +807,23 @@ class JDBCSuite extends SparkFunSuite
val schema = JdbcUtils.schemaString(df.schema,
"jdbc:mysql://localhost:3306/temp")
assert(schema.contains("`order` TEXT"))
}
+
+ test("SPARK-18141: Predicates on quoted column names in the jdbc data
source") {
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id < 1").collect().size
== 0)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id <= 1").collect().size
== 1)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id > 1").collect().size
== 2)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id >= 1").collect().size
== 3)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id = 1").collect().size
== 1)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id != 2").collect().size
== 2)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Id <=>
2").collect().size == 1)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE Name LIKE
'fr%'").collect().size == 1)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE NAME LIKE
'%ed'").collect().size == 1)
+ assert(sql("SELECT * FROM mixedCaseCols WHERE NAME LIKE
'%re%'").collect().size == 1)
--- End diff --
Those two statements test String StartsWith , and Contains filters. They
are pushed to jdbc data source, and mapped to SQL LIKE expression.
I will fix the inconsistent column name in above two statements.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]