prestodb/presto · error · PinotException

PINOT_REQUEST_GENERATOR_FAILURE

PINOT_REQUEST_GENERATOR_FAILURE

Error message

Unable to Jsonify request: %s

What it means

Thrown when Jackson's ObjectMapper fails to serialize the Pinot request map ({"pql": query}) into JSON before sending it to the broker. This is nearly impossible in practice because the payload is a simple string map, but any JsonProcessingException during payload generation surfaces here.

Source

Thrown at presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotBrokerPageSource.java:362

                rpcService = Optional.empty();
            }
            Request.Builder builder = Request.Builder
                    .preparePost()
                    .setUri(URI.create(String.format(QUERY_URL_TEMPLATE, pinotConfig.isUseSecureConnection() ? "https" : "http", queryHost)));
            brokerAuthenticationProvider.getAuthenticationToken(session).ifPresent(token -> builder.setHeader(AUTHORIZATION, "Basic" + " " + token));
            String body = clusterInfoFetcher.doHttpActionWithHeaders(builder, Optional.of(getRequestPayload(pinotQuery)), rpcService);
            return populateFromQueryResults(pinotQuery, blockBuilders, types, body);
        });
    }

    public static String getRequestPayload(PinotQueryGenerator.GeneratedPinotQuery pinotQuery)
    {
        ImmutableMap<String, String> pinotRequest = ImmutableMap.of(REQUEST_PAYLOAD_KEY, pinotQuery.getQuery());
        try {
            return OBJECT_MAPPER.writeValueAsString(pinotRequest);
        }
        catch (JsonProcessingException e) {
            throw new PinotException(
                    PINOT_REQUEST_GENERATOR_FAILURE,
                    Optional.of(pinotQuery.getQuery()),
                    "Unable to Jsonify request: " + Arrays.toString(pinotRequest.entrySet().toArray()),
                    e);
        }
    }

    // Set Pinot Response from query response json string.
    @VisibleForTesting
    public int populateFromQueryResults(
            PinotQueryGenerator.GeneratedPinotQuery pinotQuery,
            List<BlockBuilder> blockBuilders,
            List<Type> types,
            String responseJsonString)
    {
        String sql = pinotQuery.getQuery();
        JsonNode jsonBody;
        try {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect pinotQuery.getQuery() for malformed content; log the query string before serialization
  2. Verify no custom Jackson ObjectMapper/module overrides break simple String-map serialization
  3. Retry the query; if persistent, capture the query text and file an issue with the connector

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// Sanity check the query string before it is sent
if (pinotQuery == null || pinotQuery.isEmpty()) {
    throw new IllegalArgumentException("Pinot query string must not be empty");
}

Try / catch

try {
    connector.query(sql);
} catch (PinotException e) {
    if (e.getErrorCode() == PinotErrorCode.PINOT_REQUEST_GENERATOR_FAILURE) {
        // log sql and report a connector bug; not user-fixable normally
    }
    throw e;
}

Prevention

When it happens

Trigger: getRequestPayload builds ImmutableMap.of(REQUEST_PAYLOAD_KEY, pinotQuery.getQuery()) and calls OBJECT_MAPPER.writeValueAsString; JsonProcessingException from Jackson serialization (e.g. an ObjectMapper misconfigured or an I/O-backed serialization failure) triggers the throw.

Common situations: Custom builds with a replaced/misconfigured ObjectMapper, or exotic characters breaking serialization in patched Jackson versions.

Understand the failure class

Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.

Related errors


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