Hello

I have a column whose value (Int type as score) is from 0 to 5.
I want to query that, when the score > 3, classified as "good". else classified as "bad".
How do I implement that? A UDF like something as this?

scala> implicit class Foo(i:Int) {
     |   def classAs(f:Int=>String) = f(i)
     | }
class Foo

scala> 4.classAs { x => if (x > 3) "good" else "bad" }
val res13: String = good

scala> 2.classAs { x => if (x > 3) "good" else "bad" }
val res14: String = bad


Thank you.

---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscr...@spark.apache.org

Reply via email to