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/11/20 10:26:55 UTC
[GitHub] [spark] ulysses-you opened a new pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
ulysses-you opened a new pull request #30443:
URL: https://github.com/apache/spark/pull/30443
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
This PR aims to override maxRows method in these follow `LogicalPlan`:
* `ReturnAnswer`
* `Join`
* `Range`
* `Sample`
* `RepartitionOperation`
* `Deduplicate`
* `LocalRelation`
* `Window`
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
1. Logically, we know the max rows info with these `LogicalPlan`.
2. Before this PR, we already have some max rows with `LogicalPlan`, so we can eliminate limit with more case if we expand more.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
Add 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.
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749762667
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133230/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749426383
**[Test build #133195 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133195/testReport)** for PR 30443 at commit [`85d971b`](https://github.com/apache/spark/commit/85d971b0387b2f7e0bd93b2c18a3ceb65c0811b9).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748078646
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133006/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749331841
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133185/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749445309
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133195/
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545831655
##########
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)
+
+ // test Deduplicate
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
Review comment:
ah I see. It's weird that the previous code still uses `'a`... Anyway let's use Symbol now.
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731239149
Merged build finished. Test FAILed.
----------------------------------------------------------------
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
[GitHub] [spark] maropu commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545810572
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,90 @@ 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()
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1)
+ )
+
+ // test Sample
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1)
+ )
+
+ // test Deduplicate
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a"))
+ )
+
+ // test Repartition
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2)
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2)
+ )
+
+ // test Join
+ checkPlan(
+ testRelation.join(testRelation2, joinType = Inner).limit(20),
+ testRelation.join(testRelation2, joinType = Inner)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftSemi).limit(5),
+ testRelation.join(testRelation2.select(), joinType = LeftSemi).limit(5)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftAnti).limit(10),
+ testRelation.join(testRelation2.select(), joinType = LeftAnti)
+ )
+ checkPlan(
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100)
+ )
+ checkPlan(
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100)
+ )
+
+ // test Window
+ checkPlan(
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)).limit(20),
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc))
+ )
+ }
+}
+
+case class InfiniteRelation(output: Seq[Attribute]) extends LeafNode {
Review comment:
Infinite? How about `RelationWithoutMaxRows`?
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,90 @@ 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()
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1)
+ )
+
+ // test Sample
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1)
+ )
+
+ // test Deduplicate
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a"))
+ )
+
+ // test Repartition
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2)
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2)
+ )
+
+ // test Join
+ checkPlan(
+ testRelation.join(testRelation2, joinType = Inner).limit(20),
+ testRelation.join(testRelation2, joinType = Inner)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftSemi).limit(5),
+ testRelation.join(testRelation2.select(), joinType = LeftSemi).limit(5)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftAnti).limit(10),
+ testRelation.join(testRelation2.select(), joinType = LeftAnti)
+ )
+ checkPlan(
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100)
+ )
+ checkPlan(
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100)
+ )
+
+ // test Window
+ checkPlan(
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)).limit(20),
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc))
+ )
+ }
+}
+
+case class InfiniteRelation(output: Seq[Attribute]) extends LeafNode {
Review comment:
nit: Infinite? How about `RelationWithoutMaxRows`?
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r547325907
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,118 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Eliminate Limit if LocalRelation max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ testRelation.select().limit(10),
+ testRelation.select(),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Range max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ Range(0, 100, 1, None).select().limit(200),
+ Range(0, 100, 1, None).select(),
+ 100
+ )
+ checkPlanAndMaxRow(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ 1
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Sample max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Deduplicate max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a")),
Review comment:
Add a new implicit `DslAttr` in dsl, seems better.
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
##########
@@ -452,6 +453,16 @@ package object dsl {
def hint(name: String, parameters: Any*): LogicalPlan =
UnresolvedHint(name, parameters, logicalPlan)
+
+ def sample(
+ lowerBound: Double = 0.0,
+ upperBound: Double,
Review comment:
OK, let's keep `sample` simple.
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546238769
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,111 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Eliminate Limit if LocalRelation max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().limit(10),
+ testRelation.select(),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Range max rows not larger than Limit") {
+ checkPlan(
+ Range(0, 100, 1, None).select().limit(200),
+ Range(0, 100, 1, None).select(),
+ 100
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ 1
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Sample max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Deduplicate max rows not larger than Limit") {
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a")),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Repartition max rows not larger than Limit") {
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2),
+ 10
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Join max rows not larger than Limit") {
+ checkPlan(
+ testRelation.join(testRelation2, joinType = Inner).limit(20),
+ testRelation.join(testRelation2, joinType = Inner),
+ 20
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ 10
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftSemi).limit(5),
+ testRelation.join(testRelation2.select(), joinType = LeftSemi).limit(5),
+ 5
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftAnti).limit(10),
+ testRelation.join(testRelation2.select(), joinType = LeftAnti),
+ 10
+ )
+ checkPlan(
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ 100
+ )
+ checkPlan(
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ 100
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Window max rows not larger than Limit") {
+ checkPlan(
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)).limit(20),
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)),
+ 10
+ )
+ }
+
+ private def checkPlan(
Review comment:
Updated
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545626058
##########
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:
It's a way, updated.
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -541,6 +561,14 @@ case class Range(
s"Range ($start, $end, step=$step, splits=$numSlices)"
}
+ override def maxRows: Option[Long] = {
+ if (numElements.isValidLong) {
+ Some(numElements.toLong)
+ } else {
+ None
Review comment:
Add the test.
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -958,6 +987,7 @@ case class Distinct(child: LogicalPlan) extends UnaryNode {
abstract class RepartitionOperation extends UnaryNode {
def shuffle: Boolean
def numPartitions: Int
+ override def maxRows: Option[Long] = child.maxRows
Review comment:
Added.
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-750162191
thanks @cloud-fan @maropu
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545581217
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/EliminateSortsSuite.scala
##########
@@ -48,8 +49,18 @@ class EliminateSortsSuite extends AnalysisTest {
Batch("Limit PushDown", FixedPoint(10), LimitPushDown) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- val testRelationB = LocalRelation('d.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
Review comment:
ditto
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545580421
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -39,7 +41,18 @@ class CombiningLimitsSuite extends PlanTest {
SimplifyConditionals) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
Review comment:
nit: `'a.int, 'b.int, 'c.int`
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545580710
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -39,7 +41,18 @@ class CombiningLimitsSuite extends PlanTest {
SimplifyConditionals) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(
Review comment:
nit: 1.to(10).map(_ => Row(1, 2, 3))
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748506846
**[Test build #133067 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133067/testReport)** for PR 30443 at commit [`fbb78e0`](https://github.com/apache/spark/commit/fbb78e081e014b6d45b668eb5d1b335e1e64af0c).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748441412
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37654/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748069583
**[Test build #133006 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133006/testReport)** for PR 30443 at commit [`13f685e`](https://github.com/apache/spark/commit/13f685e675df39e5ced036085a2fde8bed76de1e).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan closed pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #30443:
URL: https://github.com/apache/spark/pull/30443
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-750031870
thanks, merging to master!
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748475761
**[Test build #133067 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133067/testReport)** for PR 30443 at commit [`fbb78e0`](https://github.com/apache/spark/commit/fbb78e081e014b6d45b668eb5d1b335e1e64af0c).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748003795
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37605/
----------------------------------------------------------------
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
[GitHub] [spark] maropu commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546233178
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,111 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Eliminate Limit if LocalRelation max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().limit(10),
+ testRelation.select(),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Range max rows not larger than Limit") {
+ checkPlan(
+ Range(0, 100, 1, None).select().limit(200),
+ Range(0, 100, 1, None).select(),
+ 100
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ 1
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Sample max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Deduplicate max rows not larger than Limit") {
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a")),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Repartition max rows not larger than Limit") {
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2),
+ 10
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Join max rows not larger than Limit") {
+ checkPlan(
+ testRelation.join(testRelation2, joinType = Inner).limit(20),
+ testRelation.join(testRelation2, joinType = Inner),
+ 20
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ 10
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftSemi).limit(5),
+ testRelation.join(testRelation2.select(), joinType = LeftSemi).limit(5),
+ 5
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftAnti).limit(10),
+ testRelation.join(testRelation2.select(), joinType = LeftAnti),
+ 10
+ )
+ checkPlan(
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ 100
+ )
+ checkPlan(
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ 100
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Window max rows not larger than Limit") {
+ checkPlan(
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)).limit(20),
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)),
+ 10
+ )
+ }
+
+ private def checkPlan(
Review comment:
nit: `checkPlan` -> `checkPlanAndMaxRow`
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,111 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Eliminate Limit if LocalRelation max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().limit(10),
+ testRelation.select(),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Range max rows not larger than Limit") {
+ checkPlan(
+ Range(0, 100, 1, None).select().limit(200),
+ Range(0, 100, 1, None).select(),
+ 100
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ 1
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Sample max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Deduplicate max rows not larger than Limit") {
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a")),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Repartition max rows not larger than Limit") {
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2),
+ 10
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Join max rows not larger than Limit") {
Review comment:
It seems this test unit has similar tests, so could you make it more compact just like this?
```
Seq(Inner, FullOuter, LeftOuter, ...).foreach { joinType =>
checkPlan(...)
}
```
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -326,6 +327,25 @@ case class Join(
hint: JoinHint)
extends BinaryNode with PredicateHelper {
+ override def maxRows: Option[Long] = {
+ joinType match {
+ case Inner | Cross | FullOuter | LeftOuter | RightOuter
+ if left.maxRows.isDefined && right.maxRows.isDefined =>
+ val maxRows = BigInt(left.maxRows.get) * BigInt(right.maxRows.get)
+ if (maxRows.isValidLong) {
+ Some(maxRows.toLong)
+ } else {
+ None
Review comment:
Could you add tests for this case in `test("SPARK-33497: Eliminate Limit if Join max rows not larger than Limit")`?
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749751508
**[Test build #133230 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133230/testReport)** for PR 30443 at commit [`5d46a4c`](https://github.com/apache/spark/commit/5d46a4c26a193e7ddea7788510d52376325cb99f).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds the following public classes _(experimental)_:
* ` implicit class DslAttr(attr: UnresolvedAttribute) extends ImplicitAttribute `
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747941102
**[Test build #133006 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133006/testReport)** for PR 30443 at commit [`13f685e`](https://github.com/apache/spark/commit/13f685e675df39e5ced036085a2fde8bed76de1e).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748507741
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133067/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731356620
**[Test build #131428 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/131428/testReport)** for PR 30443 at commit [`58eff1d`](https://github.com/apache/spark/commit/58eff1d2cb6cbc8f6e92985e7397fe40682f303e).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748433535
**[Test build #133054 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133054/testReport)** for PR 30443 at commit [`e5fea45`](https://github.com/apache/spark/commit/e5fea45ae27aa937f721cd21057719c5ac7bb054).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731146236
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36025/
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545581341
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/LimitPushdownSuite.scala
##########
@@ -38,8 +39,12 @@ class LimitPushdownSuite extends PlanTest {
BooleanSimplification) :: Nil
}
- private val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- private val testRelation2 = LocalRelation('d.int, 'e.int, 'f.int)
+ private val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
Review comment:
ditto
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731239157
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/36034/
Test FAILed.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748438443
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37654/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731357698
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749270307
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37783/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731239115
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36034/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731357698
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545580934
##########
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:
why can't we use `checkPlan` here?
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749287008
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37783/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731239149
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r731979768
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -326,6 +327,25 @@ case class Join(
hint: JoinHint)
extends BinaryNode with PredicateHelper {
+ override def maxRows: Option[Long] = {
+ joinType match {
+ case Inner | Cross | FullOuter | LeftOuter | RightOuter
+ if left.maxRows.isDefined && right.maxRows.isDefined =>
+ val maxRows = BigInt(left.maxRows.get) * BigInt(right.maxRows.get)
Review comment:
This is wrong, if one side is empty, the join result is not always empty for outer join.
It should be `product + sth`, `sth` = if (leftOuter) left.maxRows else if (rightOuter) right.maxRows else if (fullOuter) (left.maxRows + right.maxRows)
--
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: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747895651
**[Test build #132998 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/132998/testReport)** for PR 30443 at commit [`3160ab6`](https://github.com/apache/spark/commit/3160ab60260e37e8ce96d6a732e9e5d78586f193).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731197018
**[Test build #131428 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/131428/testReport)** for PR 30443 at commit [`58eff1d`](https://github.com/apache/spark/commit/58eff1d2cb6cbc8f6e92985e7397fe40682f303e).
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546238780
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,111 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Eliminate Limit if LocalRelation max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().limit(10),
+ testRelation.select(),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Range max rows not larger than Limit") {
+ checkPlan(
+ Range(0, 100, 1, None).select().limit(200),
+ Range(0, 100, 1, None).select(),
+ 100
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ 1
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Sample max rows not larger than Limit") {
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Deduplicate max rows not larger than Limit") {
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a")),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Repartition max rows not larger than Limit") {
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2),
+ 10
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Join max rows not larger than Limit") {
Review comment:
yeah it looks better, thanks
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748433535
**[Test build #133054 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133054/testReport)** for PR 30443 at commit [`e5fea45`](https://github.com/apache/spark/commit/e5fea45ae27aa937f721cd21057719c5ac7bb054).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731197018
**[Test build #131428 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/131428/testReport)** for PR 30443 at commit [`58eff1d`](https://github.com/apache/spark/commit/58eff1d2cb6cbc8f6e92985e7397fe40682f303e).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748480837
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37667/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731087953
**[Test build #131419 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/131419/testReport)** for PR 30443 at commit [`f1b8115`](https://github.com/apache/spark/commit/f1b8115b467882cedde6118d4b6b2d72a0e4d832).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749277767
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37783/
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r547252997
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,118 @@ class CombiningLimitsSuite extends PlanTest {
testRelation.select().groupBy()(count(1)).orderBy(count(1).asc).analyze)
comparePlans(optimized4, expected4)
}
+
+ test("SPARK-33497: Eliminate Limit if LocalRelation max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ testRelation.select().limit(10),
+ testRelation.select(),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Range max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ Range(0, 100, 1, None).select().limit(200),
+ Range(0, 100, 1, None).select(),
+ 100
+ )
+ checkPlanAndMaxRow(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ 1
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Sample max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1),
+ 10
+ )
+ }
+
+ test("SPARK-33497: Eliminate Limit if Deduplicate max rows not larger than Limit") {
+ checkPlanAndMaxRow(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a")),
Review comment:
I just found out a better way: `"a".attr`. Can you make a try and see if it can replace `Symbol("a")`?
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731220980
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36034/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748467113
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133054/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748003795
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37605/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749331841
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133185/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747941102
**[Test build #133006 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133006/testReport)** for PR 30443 at commit [`13f685e`](https://github.com/apache/spark/commit/13f685e675df39e5ced036085a2fde8bed76de1e).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748475761
**[Test build #133067 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133067/testReport)** for PR 30443 at commit [`fbb78e0`](https://github.com/apache/spark/commit/fbb78e081e014b6d45b668eb5d1b335e1e64af0c).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749370233
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37793/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749324151
**[Test build #133185 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133185/testReport)** for PR 30443 at commit [`85d971b`](https://github.com/apache/spark/commit/85d971b0387b2f7e0bd93b2c18a3ceb65c0811b9).
* This patch **fails SparkR unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r527721312
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/EliminateSortsSuite.scala
##########
@@ -48,8 +49,18 @@ class EliminateSortsSuite extends AnalysisTest {
Batch("Limit PushDown", FixedPoint(10), LimitPushDown) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- val testRelationB = LocalRelation('d.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(
+ Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3),
+ Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3))
+ )
+ val testRelationB = LocalRelation.fromExternalRows(
+ Seq(Symbol("d").int),
+ Seq(
+ Row(1), Row(1), Row(1), Row(1), Row(1), Row(1),
+ Row(1), Row(1), Row(1), Row(1), Row(1), Row(1))
+ )
Review comment:
This test uses rule `LimitPushDown`, so fill some data to avoid test fail.
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546239107
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -326,6 +327,25 @@ case class Join(
hint: JoinHint)
extends BinaryNode with PredicateHelper {
+ override def maxRows: Option[Long] = {
+ joinType match {
+ case Inner | Cross | FullOuter | LeftOuter | RightOuter
+ if left.maxRows.isDefined && right.maxRows.isDefined =>
+ val maxRows = BigInt(left.maxRows.get) * BigInt(right.maxRows.get)
+ if (maxRows.isValidLong) {
+ Some(maxRows.toLong)
+ } else {
+ None
Review comment:
Added by
```
// maxRow is not valid long
checkPlanAndMaxRow(
testRelation.join(testRelation4, joinType).limit(100),
testRelation.join(testRelation4, joinType).limit(100),
100
)
```
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749677245
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37828/
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r731980237
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -326,6 +327,25 @@ case class Join(
hint: JoinHint)
extends BinaryNode with PredicateHelper {
+ override def maxRows: Option[Long] = {
+ joinType match {
+ case Inner | Cross | FullOuter | LeftOuter | RightOuter
+ if left.maxRows.isDefined && right.maxRows.isDefined =>
+ val maxRows = BigInt(left.maxRows.get) * BigInt(right.maxRows.get)
Review comment:
This together with `EliminateLimit` can cause correctness issues.
--
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: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749762667
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133230/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731148627
Merged build finished. Test FAILed.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749356083
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37793/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749634715
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37828/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749257584
**[Test build #133185 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133185/testReport)** for PR 30443 at commit [`85d971b`](https://github.com/apache/spark/commit/85d971b0387b2f7e0bd93b2c18a3ceb65c0811b9).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731148448
**[Test build #131419 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/131419/testReport)** for PR 30443 at commit [`f1b8115`](https://github.com/apache/spark/commit/f1b8115b467882cedde6118d4b6b2d72a0e4d832).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749257584
**[Test build #133185 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133185/testReport)** for PR 30443 at commit [`85d971b`](https://github.com/apache/spark/commit/85d971b0387b2f7e0bd93b2c18a3ceb65c0811b9).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748482864
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37667/
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748774776
cc @cloud-fan
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749605992
**[Test build #133230 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133230/testReport)** for PR 30443 at commit [`5d46a4c`](https://github.com/apache/spark/commit/5d46a4c26a193e7ddea7788510d52376325cb99f).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749656270
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37828/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748482864
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37667/
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546204044
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,90 @@ 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") {
Review comment:
Yes, it will better.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748441410
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37654/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748078646
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133006/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747939569
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/132998/
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r547251244
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
##########
@@ -452,6 +453,16 @@ package object dsl {
def hint(name: String, parameters: Any*): LogicalPlan =
UnresolvedHint(name, parameters, logicalPlan)
+
+ def sample(
+ lowerBound: Double = 0.0,
+ upperBound: Double,
Review comment:
It's pretty weird that a parameter without default value comes after a parameter with default value. If we want to follow Dataset, let's use overloads. Otherwise, let's make this `sample` method simple and good enough for the added tests.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748462342
**[Test build #133054 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133054/testReport)** for PR 30443 at commit [`e5fea45`](https://github.com/apache/spark/commit/e5fea45ae27aa937f721cd21057719c5ac7bb054).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds the following public classes _(experimental)_:
* `case class RelationWithoutMaxRows(output: Seq[Attribute]) extends LeafNode `
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731130743
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36025/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731146246
Merged build finished. Test FAILed.
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546741522
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/EliminateSortsSuite.scala
##########
@@ -48,8 +49,18 @@ class EliminateSortsSuite extends AnalysisTest {
Batch("Limit PushDown", FixedPoint(10), LimitPushDown) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- val testRelationB = LocalRelation('d.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(
+ Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3),
Review comment:
ditto, `1.to(10).map(_ => Row(1, 2, 3)`
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/EliminateSortsSuite.scala
##########
@@ -48,8 +49,18 @@ class EliminateSortsSuite extends AnalysisTest {
Batch("Limit PushDown", FixedPoint(10), LimitPushDown) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- val testRelationB = LocalRelation('d.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(
+ Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3),
+ Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3))
+ )
+ val testRelationB = LocalRelation.fromExternalRows(
+ Seq(Symbol("d").int),
+ Seq(
+ Row(1), Row(1), Row(1), Row(1), Row(1), Row(1),
Review comment:
ditto
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/LimitPushdownSuite.scala
##########
@@ -38,8 +39,12 @@ class LimitPushdownSuite extends PlanTest {
BooleanSimplification) :: Nil
}
- private val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- private val testRelation2 = LocalRelation('d.int, 'e.int, 'f.int)
+ private val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3)))
Review comment:
ditto
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/LimitPushdownSuite.scala
##########
@@ -38,8 +39,12 @@ class LimitPushdownSuite extends PlanTest {
BooleanSimplification) :: Nil
}
- private val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- private val testRelation2 = LocalRelation('d.int, 'e.int, 'f.int)
+ private val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3)))
+ private val testRelation2 = LocalRelation.fromExternalRows(
+ Seq(Symbol("d").int, Symbol("e").int, Symbol("f").int),
+ Seq(Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3)))
Review comment:
ditto
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749445309
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133195/
----------------------------------------------------------------
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
[GitHub] [spark] maropu commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545809354
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,90 @@ 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") {
Review comment:
Could you split this test into pieces then add clearer test title for them?
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546203992
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala
##########
@@ -1130,7 +1130,7 @@ class StreamSuite extends StreamTest {
verifyLocalLimit(inputDF.dropDuplicates().repartition(1).limit(1), expectStreamingLimit = false)
// Should be LocalLimitExec in the first place, not from optimization of StreamingLocalLimitExec
- val staticDF = spark.range(1).toDF("value").limit(1)
+ val staticDF = spark.range(2).toDF("value").limit(1)
Review comment:
This case test the `LocalLimit`, and `range(1).limit(1)` will eliminate the limit. So here we change to range(2).
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,90 @@ 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()
+ )
+ checkPlan(
+ Range(-1, Long.MaxValue, 1, None).select().limit(1),
+ Range(-1, Long.MaxValue, 1, None).select().limit(1)
+ )
+
+ // test Sample
+ checkPlan(
+ testRelation.select().sample(upperBound = 0.2, seed = 1).limit(10),
+ testRelation.select().sample(upperBound = 0.2, seed = 1)
+ )
+
+ // test Deduplicate
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
+ testRelation.deduplicate(Symbol("a"))
+ )
+
+ // test Repartition
+ checkPlan(
+ testRelation.repartition(2).limit(10),
+ testRelation.repartition(2)
+ )
+ checkPlan(
+ testRelation.distribute(Symbol("a"))(2).limit(10),
+ testRelation.distribute(Symbol("a"))(2)
+ )
+
+ // test Join
+ checkPlan(
+ testRelation.join(testRelation2, joinType = Inner).limit(20),
+ testRelation.join(testRelation2, joinType = Inner)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10),
+ testRelation.join(testRelation2, joinType = FullOuter).limit(10)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftSemi).limit(5),
+ testRelation.join(testRelation2.select(), joinType = LeftSemi).limit(5)
+ )
+ checkPlan(
+ testRelation.join(testRelation2, joinType = LeftAnti).limit(10),
+ testRelation.join(testRelation2.select(), joinType = LeftAnti)
+ )
+ checkPlan(
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100),
+ testRelation.join(testRelation3, joinType = LeftOuter).limit(100)
+ )
+ checkPlan(
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100),
+ testRelation.join(testRelation4, joinType = RightOuter).limit(100)
+ )
+
+ // test Window
+ checkPlan(
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc)).limit(20),
+ testRelation.window(
+ Seq(count(1).as("c")), Seq(Symbol("a")), Seq(Symbol("b").asc))
+ )
+ }
+}
+
+case class InfiniteRelation(output: Seq[Attribute]) extends LeafNode {
Review comment:
Updated
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545626314
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
##########
@@ -452,6 +453,16 @@ package object dsl {
def hint(name: String, parameters: Any*): LogicalPlan =
UnresolvedHint(name, parameters, logicalPlan)
+
+ def sample(
+ lowerBound: Double = 0.0,
+ upperBound: Double,
+ withReplacement: Boolean = false,
+ seed: Long = Utils.random.nextLong): LogicalPlan = {
Review comment:
Just follow the `Dataset.sample` and easy to use.
----------------------------------------------------------------
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
[GitHub] [spark] maropu commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545609783
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
##########
@@ -452,6 +453,16 @@ package object dsl {
def hint(name: String, parameters: Any*): LogicalPlan =
UnresolvedHint(name, parameters, logicalPlan)
+
+ def sample(
+ lowerBound: Double = 0.0,
+ upperBound: Double,
+ withReplacement: Boolean = false,
+ seed: Long = Utils.random.nextLong): LogicalPlan = {
Review comment:
Why do some params above have default values?
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -541,6 +561,14 @@ case class Range(
s"Range ($start, $end, step=$step, splits=$numSlices)"
}
+ override def maxRows: Option[Long] = {
+ if (numElements.isValidLong) {
+ Some(numElements.toLong)
+ } else {
+ None
Review comment:
Could you add tests for this code path?
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -958,6 +987,7 @@ case class Distinct(child: LogicalPlan) extends UnaryNode {
abstract class RepartitionOperation extends UnaryNode {
def shuffle: Boolean
def numPartitions: Int
+ override def maxRows: Option[Long] = child.maxRows
Review comment:
nit: could we add `final` for this?
##########
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:
How about passing a `seed` param into `sample` and then using `checkPlan`?
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r732362054
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -326,6 +327,25 @@ case class Join(
hint: JoinHint)
extends BinaryNode with PredicateHelper {
+ override def maxRows: Option[Long] = {
+ joinType match {
+ case Inner | Cross | FullOuter | LeftOuter | RightOuter
+ if left.maxRows.isDefined && right.maxRows.isDefined =>
+ val maxRows = BigInt(left.maxRows.get) * BigInt(right.maxRows.get)
Review comment:
good catch !
--
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: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] maropu commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545812031
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala
##########
@@ -1130,7 +1130,7 @@ class StreamSuite extends StreamTest {
verifyLocalLimit(inputDF.dropDuplicates().repartition(1).limit(1), expectStreamingLimit = false)
// Should be LocalLimitExec in the first place, not from optimization of StreamingLocalLimitExec
- val staticDF = spark.range(1).toDF("value").limit(1)
+ val staticDF = spark.range(2).toDF("value").limit(1)
Review comment:
Why did you change the number?
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747939345
**[Test build #132998 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/132998/testReport)** for PR 30443 at commit [`3160ab6`](https://github.com/apache/spark/commit/3160ab60260e37e8ce96d6a732e9e5d78586f193).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545596810
##########
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)
+
+ // test Deduplicate
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
Review comment:
@cloud-fan Is these case needed because of [SPARK-29392](https://issues.apache.org/jira/browse/SPARK-29392) ?
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749332723
**[Test build #133195 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133195/testReport)** for PR 30443 at commit [`85d971b`](https://github.com/apache/spark/commit/85d971b0387b2f7e0bd93b2c18a3ceb65c0811b9).
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545596859
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -39,7 +41,18 @@ class CombiningLimitsSuite extends PlanTest {
SimplifyConditionals) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(
Review comment:
Updated.
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731146246
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747915659
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37597/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731087953
**[Test build #131419 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/131419/testReport)** for PR 30443 at commit [`f1b8115`](https://github.com/apache/spark/commit/f1b8115b467882cedde6118d4b6b2d72a0e4d832).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747939569
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/132998/
----------------------------------------------------------------
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
[GitHub] [spark] maropu commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545816868
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala
##########
@@ -117,4 +128,90 @@ 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") {
Review comment:
Also, could you add tests to check if an expected max row value is propagated correctly?
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747387213
cc @maropu @cloud-fan
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747915659
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37597/
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749327611
retest this please
----------------------------------------------------------------
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
[GitHub] [spark] ulysses-you commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r546986950
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/EliminateSortsSuite.scala
##########
@@ -48,8 +49,18 @@ class EliminateSortsSuite extends AnalysisTest {
Batch("Limit PushDown", FixedPoint(10), LimitPushDown) :: Nil
}
- val testRelation = LocalRelation('a.int, 'b.int, 'c.int)
- val testRelationB = LocalRelation('d.int)
+ val testRelation = LocalRelation.fromExternalRows(
+ Seq(Symbol("a").int, Symbol("b").int, Symbol("c").int),
+ Seq(
+ Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3), Row(1, 2, 3),
Review comment:
Updated these.
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749332723
**[Test build #133195 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133195/testReport)** for PR 30443 at commit [`85d971b`](https://github.com/apache/spark/commit/85d971b0387b2f7e0bd93b2c18a3ceb65c0811b9).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748441412
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37654/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749370233
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37793/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749677245
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37828/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731148632
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/131419/
Test FAILed.
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731146254
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/36025/
Test FAILed.
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749287008
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/37783/
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749346069
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/37793/
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748507741
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133067/
----------------------------------------------------------------
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
[GitHub] [spark] cloud-fan commented on a change in pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #30443:
URL: https://github.com/apache/spark/pull/30443#discussion_r545580988
##########
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)
+
+ // test Deduplicate
+ checkPlan(
+ testRelation.deduplicate(Symbol("a")).limit(10),
Review comment:
nit: `'a`
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-731148627
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-747895651
**[Test build #132998 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/132998/testReport)** for PR 30443 at commit [`3160ab6`](https://github.com/apache/spark/commit/3160ab60260e37e8ce96d6a732e9e5d78586f193).
----------------------------------------------------------------
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
[GitHub] [spark] SparkQA removed a comment on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-749605992
**[Test build #133230 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133230/testReport)** for PR 30443 at commit [`5d46a4c`](https://github.com/apache/spark/commit/5d46a4c26a193e7ddea7788510d52376325cb99f).
----------------------------------------------------------------
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
[GitHub] [spark] AmplabJenkins commented on pull request #30443: [SPARK-33497][SQL] Override maxRows in some LogicalPlan
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30443:
URL: https://github.com/apache/spark/pull/30443#issuecomment-748467113
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/133054/
----------------------------------------------------------------
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