o-shevchenko commented on a change in pull request #220: [LIVY-654] Ability to validate string
before creating state/kind of session/statement
URL: https://github.com/apache/incubator-livy/pull/220#discussion_r319849996
##########
File path: core/src/main/scala/org/apache/livy/sessions/Kind.scala
##########
@@ -45,6 +45,12 @@ object Kind {
case "sql" => SQL
case other => throw new IllegalArgumentException(s"Invalid kind: $other")
}
+
+ val kinds: Seq[Kind] = Seq(Spark, PySpark, SparkR, Shared, SQL)
+
+ def isValid(kind: String): Boolean = {
Review comment:
to simply use it in the code instead of hardcoding string values like "idle", sometimes
I need to check session state or wait for state, for example, create a session and wait for
status "idle" to be able to run statement. I don't want to use string variables everywhere.
I need an enumeration. I can create my own in my code but better to use it from Livy. it is
the typical case, isn't it?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
|