public QueryPlan compileQuery() throws SQLException { return compileQuery(statement, query); }
private QueryPlan getQueryPlan(String query, List<Object> binds) throws SQLException { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PhoenixPreparedStatement statement = conn.prepareStatement(query).unwrap(PhoenixPreparedStatement.class); for (Object bind : binds) { statement.setObject(1, bind); } QueryPlan plan = statement.compileQuery(query); return plan; } finally { conn.close(); } }
private static QueryPlan compileStatement(String query, List<Object> binds) throws SQLException { PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); return pstmt.compileQuery(); }
private static StatementContext compileStatementTenantSpecific(String tenantId, String query, List<Object> binds) throws Exception { PhoenixConnection pconn = getTenantSpecificConnection("tenantId").unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); QueryPlan plan = pstmt.compileQuery(); return plan.getContext(); }
private static QueryPlan compileStatement(String query, List<Object> binds, Integer limit) throws SQLException { PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); QueryPlan plan = pstmt.compileQuery(); assertEquals(limit, plan.getLimit()); return plan; }
private static Filter compileStatement(String query) throws SQLException { PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); QueryPlan plan = pstmt.compileQuery(); return plan.getContext().getScan().getFilter(); }
private static StatementContext compileStatement(String query, List<Object> binds, Integer limit) throws SQLException { PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); assertRoundtrip(query); TestUtil.bindParams(pstmt, binds); QueryPlan plan = pstmt.compileQuery(); assertEquals(limit, plan.getLimit()); return plan.getContext(); }
public QueryPlan compileQuery() throws SQLException { return compileQuery(statement, query); }
public QueryPlan compileQuery() throws SQLException { return compileQuery(statement, query); }
private static Expressions compileStatement(String query, List<Object> binds) throws SQLException { PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); QueryPlan plan = pstmt.compileQuery(); assertTrue(plan instanceof AggregatePlan); Filter filter = plan.getContext().getScan().getFilter(); assertTrue(filter == null || filter instanceof BooleanExpressionFilter); BooleanExpressionFilter boolFilter = (BooleanExpressionFilter)filter; AggregatePlan aggPlan = (AggregatePlan)plan; return new Expressions(boolFilter == null ? null : boolFilter.getExpression(), aggPlan.getHaving()); }