Skip to content

Commit 68a1c70

Browse files
committed
Show warning message if mapred.reduce.tasks is set to -1.
1 parent 7dacc08 commit 68a1c70

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@ case class SetCommand(
8484
logWarning(
8585
s"Property ${SQLConf.Deprecated.MAPRED_REDUCE_TASKS} is deprecated, " +
8686
s"automatically converted to ${SQLConf.SHUFFLE_PARTITIONS} instead.")
87-
sqlContext.setConf(SQLConf.SHUFFLE_PARTITIONS, value)
88-
Seq(Row(s"${SQLConf.SHUFFLE_PARTITIONS}=$value"))
87+
if (value == "-1") {
88+
logWarning(
89+
s"Set this property to -1 for automatically determining the number of reducers " +
90+
s"is not supported, showing current ${SQLConf.SHUFFLE_PARTITIONS} instead.")
91+
Seq(Row(s"${SQLConf.SHUFFLE_PARTITIONS}=${sqlContext.conf.numShufflePartitions}"))
92+
} else {
93+
sqlContext.setConf(SQLConf.SHUFFLE_PARTITIONS, value)
94+
Seq(Row(s"${SQLConf.SHUFFLE_PARTITIONS}=$value"))
95+
}
8996

9097
// Configures a single property.
9198
case Some((key, Some(value))) =>

0 commit comments

Comments
 (0)