Search in sources :

Example 1 with ExchangeClient

use of com.facebook.presto.operator.ExchangeClient in project presto by prestodb.

the class StatementResource method createQuery.

@POST
@Produces(MediaType.APPLICATION_JSON)
public Response createQuery(String statement, @Context HttpServletRequest servletRequest, @Context UriInfo uriInfo) throws InterruptedException {
    if (isNullOrEmpty(statement)) {
        throw new WebApplicationException(Response.status(Status.BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity("SQL statement is empty").build());
    }
    SessionSupplier sessionSupplier = new HttpRequestSessionFactory(servletRequest);
    ExchangeClient exchangeClient = exchangeClientSupplier.get(deltaMemoryInBytes -> {
    });
    Query query = new Query(sessionSupplier, statement, queryManager, sessionPropertyManager, exchangeClient, blockEncodingSerde);
    queries.put(query.getQueryId(), query);
    return getQueryResults(query, Optional.empty(), uriInfo, new Duration(1, MILLISECONDS));
}
Also used : ExchangeClient(com.facebook.presto.operator.ExchangeClient) WebApplicationException(javax.ws.rs.WebApplicationException) Duration(io.airlift.units.Duration) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Aggregations

ExchangeClient (com.facebook.presto.operator.ExchangeClient)1 Duration (io.airlift.units.Duration)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1