cloud-fan commented on a change in pull request #34291:
URL: https://github.com/apache/spark/pull/34291#discussion_r738106476
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala
##########
@@ -92,6 +93,55 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession
with ExplainSuiteHel
checkAnswer(sql("SELECT name, id FROM h2.test.people"), Seq(Row("fred",
1), Row("mary", 2)))
}
+ test("simple scan with LIMIT") {
+ val df1 = spark.read.table("h2.test.employee")
+ .where($"dept" === 1).limit(1)
+ checkPushedLimit(df1, true, 1)
+ checkAnswer(df1, Seq(Row(1, "amy", 10000.00, 1000.0)))
+
+ val df2 = spark.read
+ .option("partitionColumn", "dept")
+ .option("lowerBound", "0")
+ .option("upperBound", "2")
+ .option("numPartitions", "2")
+ .table("h2.test.employee")
+ .filter($"dept" > 1)
+ .limit(1)
+ checkPushedLimit(df2, true, 1)
+ checkAnswer(df2, Seq(Row(2, "alex", 12000.00, 1200.0)))
+
+ val df3 = sql("SELECT name FROM h2.test.employee WHERE dept > 1 LIMIT 1")
Review comment:
can we also test if column pruning works? e.g. this query the JDBC
should only read the column `name`.
--
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]