[SPARK-2860][SQL] Fix coercion of CASE WHEN.