Skip to content

Commit

Permalink
Consider other wrong setting values.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed May 4, 2015
1 parent fd9c817 commit e518f96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ case class SetCommand(
logWarning(
s"Property ${SQLConf.Deprecated.MAPRED_REDUCE_TASKS} is deprecated, " +
s"automatically converted to ${SQLConf.SHUFFLE_PARTITIONS} instead.")
if (value == "-1") {
val msg = s"Setting ${SQLConf.Deprecated.MAPRED_REDUCE_TASKS} to -1 for automatically " +
if (value.toInt < 1) {
val msg = s"Setting negative ${SQLConf.Deprecated.MAPRED_REDUCE_TASKS} for automatically " +
"determining the number of reducers is not supported."
throw new IllegalArgumentException(msg)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,11 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {

test("SET commands with illegal or inappropriate argument") {
conf.clear()
// mapred.reduce.tasks=-1 for automatically determing the number of reducers is not supported
// Set negative mapred.reduce.tasks for automatically determing
// the number of reducers is not supported
intercept[IllegalArgumentException](sql(s"SET mapred.reduce.tasks=-1"))
intercept[IllegalArgumentException](sql(s"SET mapred.reduce.tasks=-01"))
intercept[IllegalArgumentException](sql(s"SET mapred.reduce.tasks=-2"))
conf.clear()
}

Expand Down

0 comments on commit e518f96

Please sign in to comment.