PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class);
ColumnResolver resolver = FromCompiler.getResolver(statement, pconn);
statement = StatementNormalizer.normalize(statement, resolver);
context = new StatementContext(statement, pconn, resolver, binds, scan);
GroupBy groupBy = GroupByCompiler.compile(context, statement);
// Optimize the HAVING clause by finding any group by expressions that can be moved
// to the WHERE clause
statement = HavingCompiler.rewrite(context, statement, groupBy);
Expression having = HavingCompiler.compile(context, statement, groupBy);
Expression where = WhereCompiler.compile(context, statement);