Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/10427#discussion_r52128728
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
---
@@ -210,6 +218,24 @@ class JDBCSuite extends SparkFunSuite
val df2 = sql("SELECT * FROM foobar WHERE NOT (THEID != 2) OR NOT
(NAME != 'mary')")
assert(df1.collect.toSet === Set(Row("mary", 2)))
assert(df2.collect.toSet === Set(Row("mary", 2)))
+
+ def checkNotPushdown(df: DataFrame): DataFrame = {
+ val parentPlan = df.queryExecution.executedPlan
+ // Check if SparkPlan Filter is not removed in a physical plan
because JDBCRDD
+ // cannot compile given predicates.
+
assert(parentPlan.isInstanceOf[org.apache.spark.sql.execution.Filter])
+ df
+ }
+ sql("SELECT * FROM foobar WHERE THEID < 1").explain(true)
+ sql("SELECT * FROM foobar WHERE (THEID + 1) < 2").explain(true)
+ assert(checkNotPushdown(sql("SELECT * FROM foobar WHERE (THEID + 1) <
2")).collect().size == 0)
+ assert(checkNotPushdown(sql("SELECT * FROM foobar WHERE (THEID + 2) !=
4")).collect().size == 2)
+ }
+
+ test("SELECT COUNT(1) WHERE (predicates)") {
+ // Check if an answer is correct when filters are pushed down into
JDBC data sources
+ // and some columns are pruned in DataSourceStrategy.
--- End diff --
Can you also add comment to explain the reason of adding this test?
---
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]