prestodb/presto · error · PinotException

PINOT_UNEXPECTED_RESPONSE

PINOT_UNEXPECTED_RESPONSE

Error message

Encountered Pinot exceptions, unknown response type - %s

What it means

Pinot's broker returned a server response whose type the page source iterator does not recognize. This is a defensive default branch in the switch over response types in getNextPage; it means the response protocol between Presto and Pinot diverged from what this connector expects.

Source

Thrown at presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java:226

                            checkExceptions(dataTable, split, PinotSessionProperties.isMarkDataFetchExceptionsAsRetriable(session));
                            currentDataTable = new PinotSegmentPageSource.PinotDataTableWithSize(dataTable, serverResponse.getSerializedSize());
                        }
                        catch (IOException e) {
                            throw new PinotException(
                                PINOT_DATA_FETCH_EXCEPTION,
                                split.getSegmentPinotQuery(),
                                String.format("Encountered Pinot exceptions when fetching data table from Split: < %s >", split),
                                e);
                        }
                        break;
                    case CommonConstants.Query.Response.ResponseType.METADATA:
                        // The last part of the response is Metadata
                        currentDataTable = null;
                        serverResponseIterator = null;
                        close();
                        return null;
                    default:
                        throw new PinotException(
                            PINOT_UNEXPECTED_RESPONSE,
                            split.getSegmentPinotQuery(),
                            String.format("Encountered Pinot exceptions, unknown response type - %s", responseType));
                }
            }
            Page page = fillNextPage();
            completedPositions += currentDataTable.getDataTable().getNumberOfRows();
            return page;
        }
        finally {
            if (byteBuffer != null) {
                ((Buffer) byteBuffer).clear();
            }
        }
    }

    private Iterator<Server.ServerResponse> queryPinot(PinotSplit split)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check broker and Presto Pinot connector version compatibility and align the pinot-segment-spi/client dependency versions with the broker version
  2. Log the full response type and the segment query from the exception and compare against the switch cases in PinotSegmentPageSource.getNextPage
  3. Retry the query; if it reproduces on one segment only, inspect that segment/broker health
  4. Upgrade or patch the connector to handle the new response type

Example fix

// before
default:
    throw new PinotException(PINOT_UNEXPECTED_RESPONSE, split.getSegmentPinotQuery(),
        String.format("Encountered Pinot exceptions, unknown response type - %s", responseType));
// after
// add a case for the new response type reported in the message
case ERROR:
    throw new PinotException(PINOT_EXCEPTION_DURING_QUERY, split.getSegmentPinotQuery(),
        "Pinot server returned error response: " + dataTable);
case METADATA:
    currentDataTable = dataTable; break;
Defensive patterns

Strategy: retry

Validate before calling

// before query: verify connector Pinot client version matches broker
String brokerVersion = pinotBrokerAdmin.getVersion();
assert brokerVersion.startsWith(expectedPinotClientMajorVersion);

Type guard

boolean isKnownResponseType(Server.ServerResponse r) {
  return r.hasMetadata() || r.hasDataTable() || r.hasException();
}

Try / catch

try {
  page = pageSource.getNextPage();
} catch (PinotException e) {
  if (PinotErrorCode.PINOT_UNEXPECTED_RESPONSE.toErrorCodeObject().equals(e.getErrorCode())) {
    log.warn("Unknown pinot response type for query %s, retrying", e.getPushDownQuery());
    pageSource.close(); pageSource = openFreshSource(); page = pageSource.getNextPage();
  } else throw e;
}

Prevention

When it happens

Trigger: getNextPage iterates server responses from queryPinot and hits a ServerResponse subtype or error type not covered by the switch (e.g. a new Pinot protocol response type, metadata-only response arriving in an unexpected position, or a version mismatch between the Pinot client libs and the broker).

Common situations: Upgrading the Pinot broker to a version that emits new response types while the connector was built against older Pinot jars; corrupted or interleaved gRPC responses; broker-side errors surfaced as an unrecognized response class.

Related errors


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