Github user jiangxb1987 commented on a diff in the pull request: https://github.com/apache/spark/pull/21454#discussion_r191582665 --- Diff: core/src/main/scala/org/apache/spark/SparkConf.scala --- @@ -394,23 +407,35 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria } - /** Get a parameter as an integer, falling back to a default if not set */ - def getInt(key: String, defaultValue: Int): Int = { + /** + * Get a parameter as an integer, falling back to a default if not set + * @throws IllegalArgumentException If the value can't be interpreted as an integer + */ + def getInt(key: String, defaultValue: Int): Int = catchIllegalArgument(key) { getOption(key).map(_.toInt).getOrElse(defaultValue) } - /** Get a parameter as a long, falling back to a default if not set */ - def getLong(key: String, defaultValue: Long): Long = { + /** + * Get a parameter as a long, falling back to a default if not set + * @throws IllegalArgumentException If the value can't be interpreted as an long + */ + def getLong(key: String, defaultValue: Long): Long = catchIllegalArgument(key) { getOption(key).map(_.toLong).getOrElse(defaultValue) } - /** Get a parameter as a double, falling back to a default if not set */ - def getDouble(key: String, defaultValue: Double): Double = { + /** + * Get a parameter as a double, falling back to a default if not ste + * @throws IllegalArgumentException If the value can't be interpreted as an double + */ + def getDouble(key: String, defaultValue: Double): Double = catchIllegalArgument(key) { getOption(key).map(_.toDouble).getOrElse(defaultValue) } - /** Get a parameter as a boolean, falling back to a default if not set */ - def getBoolean(key: String, defaultValue: Boolean): Boolean = { + /** + * Get a parameter as a boolean, falling back to a default if not set + * @throws IllegalArgumentException If the value can't be interpreted as an boolean --- End diff -- nit: `an boolean` -> `a boolean`
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org