[SPARK-2525][SQL] Remove as many compilation warning messages as possible in Spark SQL

JIRA: https://issues.apache.org/jira/browse/SPARK-2525.

Author: Yin Huai <huai@cse.ohio-state.edu>

Closes #1444 from yhuai/SPARK-2517 and squashes the following commits:

edbac3f [Yin Huai] Removed some compiler type erasure warnings.

(cherry picked from commit df95d82da7c76c074fd4064f7c870d55d99e0d8e)
Signed-off-by: Reynold Xin <rxin@apache.org>