scala spark - No TypeTag available

Developer from somewhere

Received the error No TypeTag available when trying to package a spark sql app. Turns out, it was caused by having a case class defined inside a method. Moving it outside of the method fixes the compilation;