0

I am new to spark-scala, I have a case class as below

case class Session(src: String,
                      id: String,
                      meterId: Option[Long],
                      computerId: Option[String],
                      startTime: Long,
                      endTime: Long,
                      memberId: String,
                      isComplete: Boolean)

How to implement the case class is null/empty check on this?

I did as below by looking out online, but its not working

  def isPCSessionEmpty(pCSession: Session): Boolean = {
    pCSession.productIterator.forall {
      case None => true
      case Some(x: PCSession2) => isPCSessionEmpty(x)
      case _ => false
    }
  }

Please help.

naveen p
  • 74
  • 9

0 Answers0