[SPARK-2395][SQL] Optimize common LIKE patterns.

We are conservative in that case and the optimization won't apply (but we'll still give a correct answer).  I'm happy to update the regex if you have a better one... (this one is taken from Hive... though AFICT they don't check for `\` at the end at all).