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

  1. Use a supported result format value from the extension's switch (e.g. the default/protobuf writer format) in the QueryRequest.
  2. Regenerate client stubs from the same .proto version the server was built with so enum values match.
  3. Check the extension source/docs for the exact set of supported ResultFormat values for SQL results.
  4. 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

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


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/4b720c59403bdbdf. Report an issue: GitHub.