apache/druid · error · QueryDriver.RequestError
Unsupported query result format:
Error message
Unsupported query result format:
What it means
encodeSqlResults maps the request's result format to a GrpcSqlResultFormatWriter. The recognized formats are handled in a switch; anything else (an unknown or unhandled ResultFormat enum value) reaches the default branch and throws RequestError("Unsupported query result format: ..."). The request's requested output format is not implemented by the gRPC extension for SQL queries.
Source
Thrown at extensions-contrib/grpc-query/src/main/java/org/apache/druid/grpc/server/QueryDriver.java:686
writer = new GrpcSqlResultFormatWriter(
ResultFormat.ARRAY.createFormatter(out, jsonMapper),
rowTransformer
);
break;
case JSON_ARRAY_LINES:
writer = new GrpcSqlResultFormatWriter(
ResultFormat.ARRAYLINES.createFormatter(out, jsonMapper),
rowTransformer
);
break;
case PROTOBUF_INLINE:
writer = new GrpcSqlResultFormatWriter(
new ProtobufWriter(out, getProtobufClass(request)),
rowTransformer
);
break;
default:
throw new RequestError("Unsupported query result format: " + request.getResultFormat().name());
}
GrpcResultsAccumulator accumulator = new GrpcResultsAccumulator(writer);
accumulator.push(result);
return ByteString.copyFrom(out.toByteArray());
}
private ByteString encodeNativeResults(
final QueryRequest request,
final Sequence<Object[]> result,
final RowSignature rowSignature
) throws IOException
{
// Accumulate the results as a byte array.
ByteArrayOutputStream out = new ByteArrayOutputStream();
GrpcResultWriter writer;
final String timeFieldName = request.getContextMap().getOrDefault(TIME_FIELD_KEY, "time");
final List<String> skipColumns = request.getSkipColumnsList();
final List<String> timeColumns = request.getTimeColumnsList();View on GitHub (pinned to 9b90983fd2)
Solutions
- Use a supported result format value from the extension's switch (e.g. the default/protobuf writer format) in the QueryRequest.
- Regenerate client stubs from the same .proto version the server was built with so enum values match.
- Check the extension source/docs for the exact set of supported ResultFormat values for SQL results.
- If a new format is required, add a case to the switch and implement a corresponding GrpcResultFormatWriter, then rebuild the server.
Example fix
// before request.setResultFormat(ResultFormat.CSV); // after request.setResultFormat(ResultFormat.FORMAT_DEFAULT); // a format encodeSqlResults handles
Defensive patterns
Strategy: validation
Validate before calling
// Only send formats the server switch handles
java.util.Set<ResultFormat> SUPPORTED = java.util.Set.of(ResultFormat.FORMAT_DEFAULT /* + others per extension */);
if (!SUPPORTED.contains(request.getResultFormat())) {
throw new IllegalArgumentException("unsupported result format: " + request.getResultFormat());
} Try / catch
try {
return stub.query(req);
} catch (StatusRuntimeException e) {
if (e.getStatus().getDescription() != null && e.getStatus().getDescription().startsWith("Unsupported query result format")) {
req = req.toBuilder().setResultFormat(ResultFormat.FORMAT_DEFAULT).build();
return stub.query(req);
}
throw e;
} Prevention
- Pin client-generated protobuf stubs to the server extension's proto version.
- Centralize result-format selection in one constant/helper in client code.
- Verify supported formats against the deployed extension's source before using a new enum value.
- Add a smoke test per result format against a dev server.
When it happens
Trigger: Sending a QueryRequest with resultFormat set to an enum value the extension's encodeSqlResults switch does not cover (e.g. a newly added protobuf ResultFormat value, or a format only supported for native queries).
Common situations: Client and server protobuf definitions are out of sync (client built from a newer .proto adds a new ResultFormat); a constant copied from another API; fat-fingered enum assignment in generated client code.
Related errors
- Invalid parameter type:
- Cannot translate sqlTypeName[%s] to Druid type for field[%s]
- Unauthorized
- The Protobuf class [%s] is not known. Is your protobuf jar o
- The class [%s] is not a Protobuf
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/4b720c59403bdbdf.
Report an issue: GitHub.