Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SalaryPartition(override val numPartitions: Int) extends Partitioner {
- override def getPartition(key: Any): Int =
- {
- import com.csc.emp.spark.tutorial.PartitonObj._
- key.asInstanceOf[Emp].EMPLOYEE_ID match {
- case salary if salary < 10000 => 1
- case salary if salary >= 10001 && salary < 20000 => 2
- case _ => 3
- }
- }
- }
Add Comment
Please, Sign In to add comment