Search in sources :

Example 1 with DelegatePreparedStatement

use of org.apache.phoenix.jdbc.DelegatePreparedStatement in project trino by trinodb.

the class PhoenixClient method buildSql.

@Override
public PreparedStatement buildSql(ConnectorSession session, Connection connection, JdbcSplit split, JdbcTableHandle table, List<JdbcColumnHandle> columnHandles) throws SQLException {
    PreparedStatement query = prepareStatement(session, connection, table, columnHandles, Optional.of(split));
    QueryPlan queryPlan = getQueryPlan((PhoenixPreparedStatement) query);
    ResultSet resultSet = getResultSet(((PhoenixSplit) split).getPhoenixInputSplit(), queryPlan);
    return new DelegatePreparedStatement(query) {

        @Override
        public ResultSet executeQuery() {
            return resultSet;
        }
    };
}
Also used : DelegatePreparedStatement(org.apache.phoenix.jdbc.DelegatePreparedStatement) ResultSet(java.sql.ResultSet) PhoenixResultSet(org.apache.phoenix.jdbc.PhoenixResultSet) PreparedStatement(java.sql.PreparedStatement) DelegatePreparedStatement(org.apache.phoenix.jdbc.DelegatePreparedStatement) PhoenixPreparedStatement(org.apache.phoenix.jdbc.PhoenixPreparedStatement) QueryPlan(org.apache.phoenix.compile.QueryPlan)

Example 2 with DelegatePreparedStatement

use of org.apache.phoenix.jdbc.DelegatePreparedStatement in project trino by trinodb.

the class PhoenixClient method buildSql.

@Override
public PreparedStatement buildSql(ConnectorSession session, Connection connection, JdbcSplit split, JdbcTableHandle table, List<JdbcColumnHandle> columnHandles) throws SQLException {
    PreparedStatement query = prepareStatement(session, connection, table, columnHandles, Optional.of(split));
    QueryPlan queryPlan = getQueryPlan((PhoenixPreparedStatement) query);
    ResultSet resultSet = getResultSet(((PhoenixSplit) split).getPhoenixInputSplit(), queryPlan);
    return new DelegatePreparedStatement(query) {

        @Override
        public ResultSet executeQuery() {
            return resultSet;
        }
    };
}
Also used : DelegatePreparedStatement(org.apache.phoenix.jdbc.DelegatePreparedStatement) ResultSet(java.sql.ResultSet) PhoenixResultSet(org.apache.phoenix.jdbc.PhoenixResultSet) PreparedStatement(java.sql.PreparedStatement) DelegatePreparedStatement(org.apache.phoenix.jdbc.DelegatePreparedStatement) PhoenixPreparedStatement(org.apache.phoenix.jdbc.PhoenixPreparedStatement) QueryPlan(org.apache.phoenix.compile.QueryPlan)

Aggregations

PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 QueryPlan (org.apache.phoenix.compile.QueryPlan)2 DelegatePreparedStatement (org.apache.phoenix.jdbc.DelegatePreparedStatement)2 PhoenixPreparedStatement (org.apache.phoenix.jdbc.PhoenixPreparedStatement)2 PhoenixResultSet (org.apache.phoenix.jdbc.PhoenixResultSet)2