{"record":{"id":"8bc1b767f13a637b","repo":"prestodb/presto","slug":"pinot-data-fetch-exception-or-pinot-exception","errorCode":"PINOT_DATA_FETCH_EXCEPTION_OR_PINOT_EXCEPTION","errorMessage":"Encountered %d pinot exceptions for split %s: %s","messagePattern":"Encountered (.+?) pinot exceptions for split (.+?): (.+?)","errorType":"error_code","errorClass":"PinotException","httpStatus":null,"severity":"error","filePath":"presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java","lineNumber":104,"sourceCode":"            PinotStreamingQueryClient pinotStreamingQueryClient,\n            PinotSplit split,\n            List<PinotColumnHandle> columnHandles)\n    {\n        this.pinotConfig = requireNonNull(pinotConfig, \"pinotConfig is null\");\n        this.split = requireNonNull(split, \"split is null\");\n        this.columnHandles = requireNonNull(columnHandles, \"columnHandles is null\");\n        this.session = requireNonNull(session, \"session is null\");\n        this.columnTypes = columnHandles.stream()\n                .map(PinotSegmentPageSource::getTypeForBlock)\n                .collect(Collectors.toList());\n        this.pinotStreamingQueryClient = requireNonNull(pinotStreamingQueryClient, \"pinotStreamingQueryClient is null\");\n    }\n\n    public static void checkExceptions(DataTable dataTable, PinotSplit split, boolean markDataFetchExceptionsAsRetriable)\n    {\n        List<String> exceptions = dataTable.getExceptions().values().stream().toList();\n        if (!exceptions.isEmpty()) {\n            throw new PinotException(\n                markDataFetchExceptionsAsRetriable ? PINOT_DATA_FETCH_EXCEPTION : PINOT_EXCEPTION,\n                split.getSegmentPinotQuery(),\n                String.format(\"Encountered %d pinot exceptions for split %s: %s\", exceptions.size(), split, exceptions));\n        }\n        int numColumnsExpected = split.getExpectedColumnHandles().size();\n        int numColumnsActual = dataTable.getDataSchema().size();\n        if (numColumnsActual != numColumnsExpected) {\n            throw new PinotException(\n                    PINOT_EXCEPTION,\n                    split.getSegmentPinotQuery(),\n                    String.format(\"Expected pinot to contain %d columns but got %d: %s\", numColumnsExpected, numColumnsActual, dataTable.getDataSchema()));\n        }\n    }\n\n    @Override\n    public long getCompletedBytes()\n    {\n        return completedBytes;","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java#L86-L122","documentation":"After receiving a DataTable from a Pinot server, the connector checks the table's exception map. If Pinot reported any server-side exceptions while executing the segment query, the connector wraps them into a single PinotException — retriable PINOT_DATA_FETCH_EXCEPTION when markDataFetchExceptionsAsRetriable is on, otherwise PINOT_EXCEPTION — including the count, split, and exception list.","triggerScenarios":"getNextPage receives a server response whose DataTable has non-empty getExceptions(); checkExceptions then throws before returning any page.","commonSituations":"Pinot server-side query failures: timeouts, segment load errors, broker/server resource limits, query limits exceeded, or corrupted segments on the server.","solutions":["Read the embedded exception list in the message to see the actual Pinot server error and address that root cause","If transient, retry the query; consider setting pinot.mark-data-fetch-exceptions-as-retriable=true (session property) so fetch exceptions are retried","Check Pinot server/broker logs and segment health; reload or repair failing segments","Reduce query resource usage (limits, timeouts, column count) if Pinot is rejecting the query on quotas"],"exampleFix":"// before\nSELECT * FROM huge_table  -- server times out per segment\n// after\nSELECT needed_cols FROM huge_table WHERE time_col > ... LIMIT 100000","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (PinotException e) {\n    if (e.getErrorCode() == PINOT_DATA_FETCH_EXCEPTION.toErrorCode().getCode()\n            || e.getErrorCode() == PINOT_EXCEPTION.toErrorCode().getCode()) {\n        // inspect message for embedded Pinot exceptions; retry with backoff if transient\n    }\n}","preventionTips":["Enable pinot.mark-data-fetch-exceptions-as-retriable session property for transient-tolerant workloads","Monitor Pinot server health and segment status","Keep queries within Pinot timeouts/limits to avoid server-side rejections"],"tags":["pinot","data-fetch","server-exception","retriable"],"backgroundTag":"pinot-server-query-exception","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}