Examples of compileQuery()


Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.compileQuery()

        try {
            PhoenixPreparedStatement statement = conn.prepareStatement(query).unwrap(PhoenixPreparedStatement.class);
            for (Object bind : binds) {
                statement.setObject(1, bind);
            }
            QueryPlan plan = statement.compileQuery(query);
            return plan.getContext().getScan();
        } finally {
            conn.close();
        }
    }
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.compileQuery()

    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);
        TestUtil.bindParams(pstmt, binds);
        QueryPlan plan = pstmt.compileQuery();
        assertEquals(limit, plan.getLimit());
        return plan.getContext();
    }

    @Test
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.compileQuery()

   
    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();
    }
   
    @Test
    public void testLimit() throws SQLException {
        String tenantId = "000000000000001";
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.compileQuery()

public class SelectStatementRewriterTest extends BaseConnectionlessQueryTest {
    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();
    }

   
    @Test
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.compileQuery()

    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);
        TestUtil.bindParams(pstmt, binds);
        QueryPlan plan = pstmt.compileQuery();
        assertEquals(limit, plan.getLimit());
        return plan.getContext();
    }
   
    @Test
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.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 Connection getTenantSpecificConnection(String tenantId) throws Exception {
      Properties tenantProps = new Properties();
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixPreparedStatement.compileQuery()

   
    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;
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixStatement.compileQuery()

        Connection connection = null;
        try {
            connection = this.phoenixConfiguration.getConnection();
            final Statement  statement = connection.createStatement();
            final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
            final QueryPlan queryPlan = pstmt.compileQuery(selectStatement);
            isValidStatement(queryPlan);
            final String tableName = queryPlan.getTableRef().getTable().getName().getString();
            final List<? extends ColumnProjector> projectedColumns = queryPlan.getProjector().getColumnProjectors();
            final List<String> columns = Lists.transform(projectedColumns,
                                                            new Function<ColumnProjector,String>() {
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixStatement.compileQuery()

    List<ColumnInfo> columnInfos = null;
        try {
            connection = this.phoenixConfiguration.getConnection();
            final Statement  statement = connection.createStatement();
            final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
            final QueryPlan queryPlan = pstmt.compileQuery(sqlQuery);
            final List<? extends ColumnProjector> projectedColumns = queryPlan.getProjector().getColumnProjectors();
            columnInfos = Lists.newArrayListWithCapacity(projectedColumns.size());
            columnInfos = Lists.transform(projectedColumns, new Function<ColumnProjector,ColumnInfo>() {
              @Override
        public ColumnInfo apply(final ColumnProjector columnProjector) {
View Full Code Here

Examples of org.apache.phoenix.jdbc.PhoenixStatement.compileQuery()

                final Connection connection = getConnection();
                final String selectStatement = getConf().getSelectStatement();
                Preconditions.checkNotNull(selectStatement);
                final Statement statement = connection.createStatement();
                final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
                this.queryPlan = pstmt.compileQuery(selectStatement);
            } catch(Exception exception) {
                LOG.error(String.format("Failed to get the query plan with error [%s]",exception.getMessage()));
                throw new RuntimeException(exception);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.