Package org.apache.druid.server
Class QueryResultPusher
java.lang.Object
org.apache.druid.server.QueryResultPusher
- Direct Known Subclasses:
QueryResourceQueryResultPusherFactory.QueryResourceQueryResultPusher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceclassstatic interface -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQueryResultPusher(javax.servlet.http.HttpServletRequest request, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, ResponseContextConfig responseContextConfig, DruidNode selfNode, QueryResource.QueryMetricCounter counter, String queryId, javax.ws.rs.core.MediaType contentType, Map<String, String> extraHeaders) -
Method Summary
Modifier and TypeMethodDescriptionstatic javax.ws.rs.core.ResponsehandleDruidExceptionBeforeResponseStarted(DruidException e, javax.ws.rs.core.MediaType contentType, Map<String, String> extraHeaders) Generates a response for aDruidExceptionthat occurs prior to any query results being sent out.javax.ws.rs.core.Responsepush()Pushes results out.abstract QueryResultPusher.ResultsWriterstart()Builds a ResultsWriter to start the lifecycle of the QueryResultPusher.abstract voidwriteException(Exception e, OutputStream out)
-
Field Details
-
RESULT_TRAILER_HEADERS
- See Also:
-
-
Constructor Details
-
QueryResultPusher
public QueryResultPusher(javax.servlet.http.HttpServletRequest request, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, ResponseContextConfig responseContextConfig, DruidNode selfNode, QueryResource.QueryMetricCounter counter, String queryId, javax.ws.rs.core.MediaType contentType, Map<String, String> extraHeaders)
-
-
Method Details
-
start
Builds a ResultsWriter to start the lifecycle of the QueryResultPusher. The ResultsWriter encapsulates the logic to run the query, serialize it and also report success/failure.This response must not be null. The job of this ResultsWriter is largely to provide lifecycle management to the query running and reporting, so this object must never be null.
This start() method should do as little work as possible, it should really just make the ResultsWriter and return.
- Returns:
- a new ResultsWriter
-
writeException
- Throws:
IOException
-
push
@Nullable public javax.ws.rs.core.Response push()Pushes results out. Can sometimes return a JAXRS Response object instead of actually pushing to the output stream, primarily for error handling that occurs before switching the servlet to asynchronous mode.- Returns:
- null if the response has already been handled and pushed out, or a non-null Response object if it expects the container to put the bytes on the wire.
-
handleDruidExceptionBeforeResponseStarted
public static javax.ws.rs.core.Response handleDruidExceptionBeforeResponseStarted(DruidException e, javax.ws.rs.core.MediaType contentType, Map<String, String> extraHeaders) Generates a response for aDruidExceptionthat occurs prior to any query results being sent out.
-