Skip to content

Commit 7e728e3

Browse files
committed
Add doc for SQLConfEntry and fix 'toString'
1 parent 5e95b10 commit 7e728e3

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ private[spark] object SQLConf {
2929
private val sqlConfEntries = java.util.Collections.synchronizedMap(
3030
new java.util.HashMap[String, SQLConfEntry[_]]())
3131

32+
/**
33+
* An entry contains all meta information for a configuration.
34+
*
35+
* @param key the key for the configuration
36+
* @param defaultValue the default value for the configuration
37+
* @param valueConverter how to convert a string to the value. It should throw an exception if the
38+
* string does not have the required format.
39+
* @param stringConverter how to convert a value to a string that the user can use it as a valid
40+
* string value. It's usually `toString`. But sometimes, a custom converter
41+
* is necessary. E.g., if T is List[String], `a, b, c` is better than
42+
* `List(a, b, c)`.
43+
* @param doc the document for the configuration
44+
* @param isPublic if this configuration is public to the user. If it's `false`, this
45+
* configuration is only used internally and we should not expose it to the user.
46+
* @tparam T the value type
47+
*/
3248
private[sql] class SQLConfEntry[T] private(
3349
val key: String,
3450
val defaultValue: Option[T],
@@ -40,10 +56,7 @@ private[spark] object SQLConf {
4056
def defaultValueString: String = defaultValue.map(stringConverter).getOrElse("<undefined>")
4157

4258
override def toString: String = {
43-
// Fail tests that use `SQLConfEntry` as a string.
44-
throw new IllegalStateException("Force to fail tests")
45-
// s"SQLConfEntry(key = $key, defaultValue=$defaultValueString, doc=$doc,
46-
// isPublic = $isPublic)"
59+
s"SQLConfEntry(key = $key, defaultValue=$defaultValueString, doc=$doc, isPublic = $isPublic)"
4760
}
4861
}
4962

0 commit comments

Comments
 (0)