Skip to content

Commit

Permalink
Throw exception instead of warning message.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed May 1, 2015
1 parent 68a1c70 commit 4ede705
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ case class SetCommand(
s"Property ${SQLConf.Deprecated.MAPRED_REDUCE_TASKS} is deprecated, " +
s"automatically converted to ${SQLConf.SHUFFLE_PARTITIONS} instead.")
if (value == "-1") {
logWarning(
s"Set this property to -1 for automatically determining the number of reducers " +
s"is not supported, showing current ${SQLConf.SHUFFLE_PARTITIONS} instead.")
Seq(Row(s"${SQLConf.SHUFFLE_PARTITIONS}=${sqlContext.conf.numShufflePartitions}"))
val msg = s"Setting ${SQLConf.Deprecated.MAPRED_REDUCE_TASKS} to -1 for automatically " +
"determining the number of reducers is not supported."
throw new IllegalArgumentException(msg)
} else {
sqlContext.setConf(SQLConf.SHUFFLE_PARTITIONS, value)
Seq(Row(s"${SQLConf.SHUFFLE_PARTITIONS}=$value"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,13 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
conf.clear()
}

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

test("apply schema") {
val schema1 = StructType(
StructField("f1", IntegerType, false) ::
Expand Down

0 comments on commit 4ede705

Please sign in to comment.