Ah, your question is not about the header, but about how to split the lines into (userid, movieid)? Instead of .flatMap(line=>line.split(",")) you should try this:
.map(line => line.split(",") match { case Array(userid, movieid) => (userid, movieid) })