Guest User

Untitled

a guest
Oct 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class SalaryPartition(override val numPartitions: Int) extends Partitioner {
  2.  
  3. override def getPartition(key: Any): Int =
  4. {
  5. import com.csc.emp.spark.tutorial.PartitonObj._
  6. key.asInstanceOf[Emp].EMPLOYEE_ID match {
  7. case salary if salary < 10000 => 1
  8. case salary if salary >= 10001 && salary < 20000 => 2
  9. case _ => 3
  10. }
  11.  
  12. }
  13.  
  14. }
Add Comment
Please, Sign In to add comment