[SPARK-4648][SQL] Support COALESCE function in Spark SQL and Hive QL

Support Coalesce function in Spark SQL.
Support type widening in Coalesce function.
And replace Coalesce UDF in Spark Hive with local Coalesce function since it is memory efficient and faster.
Though then you would have to do the map/distinct twice I believe.