[SPARK-4390][SQL] Handle NaN cast to decimal correctly