Skip to content

[SPARK-26564] Fix wrong assertions and error messages for parameter checking #23488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

sekikn
Copy link
Contributor

@sekikn sekikn commented Jan 7, 2019

What changes were proposed in this pull request?

If users set equivalent values to spark.network.timeout and spark.executor.heartbeatInterval, they get the following message:

java.lang.IllegalArgumentException: requirement failed: The value of spark.network.timeout=120s must be no less than the value of spark.executor.heartbeatInterval=120s.

But it's misleading since it can be read as they could be equal. So this PR replaces "no less than" with "greater than". Also, it fixes similar inconsistencies found in MLlib and SQL components.

How was this patch tested?

Ran Spark with equivalent values for them manually and confirmed that the revised message was displayed.

…t and spark.executor.heartbeatInterval

If users set equivalent values to spark.network.timeout and spark.executor.heartbeatInterval, they get the following message:

```
java.lang.IllegalArgumentException: requirement failed: The value of spark.network.timeout=120s must be no less than the value of spark.executor.heartbeatInterval=120s.
```

But it's misleading since it can be read as they could be equal. So this fix replaces "no less than" with "greater than".
@HyukjinKwon
Copy link
Member

It's okay but mind taking a look for similar instances? I think there are more.

@sekikn
Copy link
Contributor Author

sekikn commented Jan 8, 2019

Thank you for the comment @HyukjinKwon. As you said, I found two additional mistakes by grep'ing the codebase.

./mllib/src/main/scala/org/apache/spark/ml/optim/WeightedLeastSquares.scala:  require(maxIter >= 0, s"maxIter must be a positive integer: $maxIter")
./sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala:      require(capacity < 512000000, "Cannot broadcast more than 512 millions rows")

But for the first one, I can't decide which of the constraint and the message is correct since I'm not so familar with ML. It doesn't seem to make sense to execute it with maxIter=0, but is there a use-case for that, such as a dry-run...?

@HyukjinKwon
Copy link
Member

I think it's okay to leave them as are. Let's just get the current change in then.

@HyukjinKwon
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Jan 10, 2019

Test build #101010 has finished for PR 23488 at commit ab9ec65.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Jan 10, 2019

In both of the additional cases above, the assertion is wrong and the message is right. You are welcome to fix both of them here, but I'm OK merging this too.

@sekikn
Copy link
Contributor Author

sekikn commented Jan 10, 2019

Thank you for the advice @HyukjinKwon and @srowen. I'll fix them within this PR so let me update it.

@sekikn sekikn changed the title [SPARK-26564] Fix misleading error message about spark.network.timeout and spark.executor.heartbeatInterval [SPARK-26564] Fix wrong assertions and error messages for parameter checking Jan 10, 2019
@SparkQA
Copy link

SparkQA commented Jan 10, 2019

Test build #101029 has finished for PR 23488 at commit b184363.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -413,7 +413,7 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap

private def init(): Unit = {
if (mm != null) {
require(capacity < 512000000, "Cannot broadcast more than 512 millions rows")
require(capacity <= 512000000, "Cannot broadcast more than 512 millions rows")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the previous condition was true.

if (numRows >= 512000000) {
throw new SparkException(
s"Cannot broadcast the table with more than 512 millions rows: $numRows rows")
}

negated numRows >= 512000000 should be capacity < 512000000

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Sorry @sekikn could we change this one more time, to use < and then fix the error message instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I'm going to update the PR.

@SparkQA
Copy link

SparkQA commented Jan 12, 2019

Test build #101114 has finished for PR 23488 at commit 22a69d1.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 12, 2019

Test build #4505 has finished for PR 23488 at commit 22a69d1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Jan 12, 2019

Merged to master

@srowen srowen closed this in 3bd77aa Jan 12, 2019
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…hecking

## What changes were proposed in this pull request?

If users set equivalent values to spark.network.timeout and spark.executor.heartbeatInterval, they get the following message:

```
java.lang.IllegalArgumentException: requirement failed: The value of spark.network.timeout=120s must be no less than the value of spark.executor.heartbeatInterval=120s.
```

But it's misleading since it can be read as they could be equal. So this PR replaces "no less than" with "greater than". Also, it fixes similar inconsistencies found in MLlib and SQL components.

## How was this patch tested?

Ran Spark with equivalent values for them manually and confirmed that the revised message was displayed.

Closes apache#23488 from sekikn/SPARK-26564.

Authored-by: Kengo Seki <sekikn@apache.org>
Signed-off-by: Sean Owen <sean.owen@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants