Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/19992#discussion_r157326568
--- Diff: core/src/main/scala/org/apache/spark/storage/StorageLevel.scala
---
@@ -132,6 +132,23 @@ class StorageLevel private(
override def hashCode(): Int = toInt * 41 + replication
+ /** Name of the storage level if it is predefined or [[None]] otherwise.
*/
+ def name: Option[String] = this match {
--- End diff --
`fromString` below has basically the opposite of this. How about storing
the mapping in a `Seq[(StorageLevel, String)]` and using that in both methods?
e.g. here it would be:
```
knownLevels.collect { case (level, name) if level == this => name
}.headOption
```
And pretty similar code in `fromString`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]