livy-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-livy] o-shevchenko commented on a change in pull request #220: [LIVY-654] Ability to validate string before creating state/kind of session/statement
Date Mon, 02 Sep 2019 10:10:42 GMT
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_r319869964
 
 

 ##########
 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:
   hmm, having a method to check if the object is a part of the enum is common practice for
Scala, it can simplify using of your enum to don't force user to catch exception or write
own method to check if object exists in enum values (if exist, we don't have it now in Kind.scala,
SessionState.scala that's why I have added sequences of values in these classes)

----------------------------------------------------------------
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

Mime
View raw message