prestodb/presto · error · RuntimeException

Only [SQL] Payload type is allowed:

Error message

Only [SQL] Payload type is allowed: 

What it means

After the null/empty check, PinotProxyGrpcRequestBuilder.build() enforces that the payload type equals CommonConstants.Query.Request.PayloadType.SQL; any other payload type causes a plain RuntimeException 'Only [SQL] Payload type is allowed: <type>'. The Presto Pinot gRPC proxy path only speaks SQL payloads, so protobuf/other payload modes are rejected.

Source

Thrown at presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/query/PinotProxyGrpcRequestBuilder.java:105

    public PinotProxyGrpcRequestBuilder addExtraMetadata(Map<String, String> extraMetadata)
    {
        this.extraMetadata.putAll(extraMetadata);
        return this;
    }

    public PinotProxyGrpcRequestBuilder setSegments(List<String> segments)
    {
        this.segments = segments;
        return this;
    }

    public Server.ServerRequest build()
    {
        if (payloadType == null || segments.isEmpty()) {
            throw new PinotException(PinotErrorCode.PINOT_INVALID_SEGMENT_QUERY_GENERATED, Optional.empty(), "Query and segmentsToQuery must be set");
        }
        if (!payloadType.equals(CommonConstants.Query.Request.PayloadType.SQL)) {
            throw new RuntimeException("Only [SQL] Payload type is allowed: " + payloadType);
        }
        Map<String, String> metadata = new HashMap<>();
        metadata.put(CommonConstants.Query.Request.MetadataKeys.REQUEST_ID, Integer.toString(requestId));
        metadata.put(CommonConstants.Query.Request.MetadataKeys.BROKER_ID, brokerId);
        metadata.put(CommonConstants.Query.Request.MetadataKeys.ENABLE_TRACE, Boolean.toString(enableTrace));
        metadata.put(CommonConstants.Query.Request.MetadataKeys.ENABLE_STREAMING, Boolean.toString(enableStreaming));
        metadata.put(CommonConstants.Query.Request.MetadataKeys.PAYLOAD_TYPE, payloadType);
        if (this.hostName != null) {
            metadata.put(KEY_OF_PROXY_GRPC_FORWARD_HOST, this.hostName);
        }
        if (this.port > 0) {
            metadata.put(KEY_OF_PROXY_GRPC_FORWARD_PORT, String.valueOf(this.port));
        }
        extraMetadata.forEach((k, v) -> metadata.put(k, v));
        return Server.ServerRequest.newBuilder()
            .putAllMetadata(metadata)
            .setSql(sql)
            .addAllSegments(segments)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set the payload type to CommonConstants.Query.Request.PayloadType.SQL before build().
  2. If you need non-SQL payloads, do not use this Presto connector builder — use Pinot's native gRPC client APIs directly.
  3. Audit the code path that sets payloadType for a wrong constant or stale enum value after a Pinot dependency upgrade.
  4. Handle/replace the RuntimeException with a typed exception at the call site if you control the builder usage.

Example fix

// before
builder.setPayloadType(CommonConstants.Query.Request.PayloadType.PAYLOAD_PROTOBUF);

// after
builder.setPayloadType(CommonConstants.Query.Request.PayloadType.SQL);
Defensive patterns

Strategy: validation

Validate before calling

// Enforce SQL payload before build():
checkArgument(CommonConstants.Query.Request.PayloadType.SQL.equals(payloadType),
    "Only SQL payload supported, got %s", payloadType);

Type guard

boolean isSqlPayload(Object payloadType) {
    return CommonConstants.Query.Request.PayloadType.SQL.equals(payloadType);
}

Try / catch

try {
    Server.ServerRequest req = builder.build();
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Only [SQL] Payload type")) {
        // fix builder config or use Pinot native gRPC client for non-SQL payloads
    } else throw e;
}

Prevention

When it happens

Trigger: Setting the builder's payload type to something other than SQL (e.g. PAYLOAD_PROTOBUF or an internal type) before calling build(), typically when reusing Pinot's gRPC request classes for a non-SQL execution path.

Common situations: Integrating with Pinot's multi-stage or protobuf-based execution APIs via the Presto connector's builder; copy-pasted code from Pinot examples that use non-SQL payloads; version drift where a payload type constant changed.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/2ea323bd45b10fb0. Report an issue: GitHub.