IMPALA-1228 Incorrect rewrite of scalar agg subquery

This commit fixes an issue where, for the case of a scalar agg subquery
with count, the zeroifnull fn is applied to the wrong column during
query rewrite.

This commit also fixes IMPALA-1237.

Change-Id: Ic00ae5799d6970171c007e3ed25348d7fc09d825
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4286
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins