SQLParser parser = new SQLParser(query);
SelectStatement statement = parser.parseQuery();
PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class);
ColumnResolver resolver = FromCompiler.getResolver(statement, pconn);
statement = StatementNormalizer.normalize(statement, resolver);
StatementContext context = new StatementContext(new PhoenixStatement(pconn), resolver, binds, scan);
Integer limit = LimitCompiler.compile(context, statement);
GroupBy groupBy = GroupByCompiler.compile(context, statement);
statement = HavingCompiler.rewrite(context, statement, groupBy);
HavingCompiler.compile(context, statement, groupBy);