[SPARK-2225] Turn HAVING without GROUP BY into WHERE.

@willb

Author: Reynold Xin <rxin@apache.org>

Closes #1161 from rxin/having-filter and squashes the following commits:

fa8359a [Reynold Xin] [SPARK-2225] Turn HAVING without GROUP BY into WHERE.

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