This repo has some examples on writing clean, readable, testable codes using Spark SQL and Scala implicit classes while building data pipelines.
I would be updating this soon with a link explaining the approach in more details in my blog at http://www.anishc.me