You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/18 06:20:02 UTC
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545596135
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +130,85 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Override maxRows in some LogicalPlan") {
+ def checkPlan(p1: LogicalPlan, p2: LogicalPlan): Unit = {
+ comparePlans(Optimize.execute(p1.analyze), p2.analyze)
+ }
+
+ // test LocalRelation
+ checkPlan(
+ testRelation.select().limit(10),
+ testRelation.select()
+ )
+
+ // test Range
+ checkPlan(
+ Range(1, 100, 1, None).select().limit(200),
+ Range(1, 100, 1, None).select()
+ )
+
+ // test Sample
+ val sampleQuery = testRelation.select().sample(upperBound = 0.2).limit(10).analyze
+ val sampleOptimized = Optimize.execute(sampleQuery)
+ assert(sampleOptimized.collect { case l @ Limit(_, _) => l }.isEmpty)
Review comment:
The `Sample` has a seed which is rand.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org