Search in sources :

Example 1 with HttpRequestSessionContext

use of com.facebook.presto.server.HttpRequestSessionContext in project presto by prestodb.

the class QueuedStatementResource method postStatement.

@POST
@Path("/v1/statement")
@Produces(APPLICATION_JSON)
public Response postStatement(String statement, @HeaderParam(X_FORWARDED_PROTO) String xForwardedProto, @Context HttpServletRequest servletRequest, @Context UriInfo uriInfo) {
    if (isNullOrEmpty(statement)) {
        throw badRequest(BAD_REQUEST, "SQL statement is empty");
    }
    // TODO: For future cases we may want to start tracing from client. Then continuation of tracing
    // will be needed instead of creating a new trace here.
    SessionContext sessionContext = new HttpRequestSessionContext(servletRequest, sqlParserOptions, tracerProvider, Optional.of(sessionPropertyManager));
    Query query = new Query(statement, sessionContext, dispatchManager, queryResultsProvider, 0);
    queries.put(query.getQueryId(), query);
    return withCompressionConfiguration(Response.ok(query.getInitialQueryResults(uriInfo, xForwardedProto)), compressionEnabled).build();
}
Also used : HttpRequestSessionContext(com.facebook.presto.server.HttpRequestSessionContext) SessionContext(com.facebook.presto.server.SessionContext) HttpRequestSessionContext(com.facebook.presto.server.HttpRequestSessionContext) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Aggregations

HttpRequestSessionContext (com.facebook.presto.server.HttpRequestSessionContext)1 SessionContext (com.facebook.presto.server.SessionContext)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1