IMPALA-1361: FE Exceptions with BETWEEN predicates

This commit fixes the issue where an exception is thrown in FE when a
statement contains a WITH clause with a BETWEEN predicate. This was
caused by not correctly reseting the analysis state of the BETWEEN
predicate after the WITH clause was analyzed. This also fixes
IMPALA-1360 where an error is thrown when a BETWEEN predicate is used in
conjunction with a subquery.

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