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();
}
Aggregations