{"record":{"id":"5456dbc7d68af4df","repo":"prestodb/presto","slug":"pinot-unsupported-column-type-5456db","errorCode":"PINOT_UNSUPPORTED_COLUMN_TYPE","errorMessage":"Failed to write column %s. pinotColumnType %s, javaType %s","messagePattern":"Failed to write column (.+?)\\. pinotColumnType (.+?), javaType (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java","lineNumber":324,"sourceCode":"        else if (javaType.equals(long.class)) {\n            if (pinotColumnType.toDataType().equals(FieldSpec.DataType.TIMESTAMP)) {\n                writeTimestampBlock(blockBuilder, columnType, columnIndex);\n            }\n            else {\n                writeLongBlock(blockBuilder, columnType, columnIndex);\n            }\n        }\n        else if (javaType.equals(double.class)) {\n            writeDoubleBlock(blockBuilder, columnType, columnIndex);\n        }\n        else if (pinotColumnType == DataSchema.ColumnDataType.BIG_DECIMAL) {\n            writeBigDecimalBlock(blockBuilder, columnType, columnIndex);\n        }\n        else if (javaType.equals(Slice.class)) {\n            writeSliceBlock(blockBuilder, columnType, columnIndex);\n        }\n        else {\n            throw new PrestoException(\n                    PINOT_UNSUPPORTED_COLUMN_TYPE,\n                    String.format(\n                            \"Failed to write column %s. pinotColumnType %s, javaType %s\",\n                            split.getExpectedColumnHandles().get(columnIndex).getColumnName(),\n                            pinotColumnType,\n                            javaType));\n        }\n    }\n\n    private void writeArrayBlock(BlockBuilder blockBuilder, Type columnType, int columnIndex)\n    {\n        for (int rowIndex = 0; rowIndex < currentDataTable.getDataTable().getNumberOfRows(); rowIndex++) {\n            DataSchema.ColumnDataType columnPinotType = currentDataTable.getDataTable().getDataSchema().getColumnDataType(columnIndex);\n            Type columnPrestoType = ((ArrayType) columnType).getElementType();\n            BlockBuilder childBuilder = blockBuilder.beginBlockEntry();\n            switch (columnPinotType) {\n                case BOOLEAN_ARRAY:\n                    int[] booleanArray = currentDataTable.getDataTable().getIntArray(rowIndex, columnIndex);","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotSegmentPageSource.java#L306-L342","documentation":"fillNextPage delegates each column to writeBlock, which dispatches on the column's Java type (Boolean, Long, Double, BigDecimal, Slice). If the Pinot column type maps to a Java type none of the block writers support, this PrestoException is thrown rather than silently producing wrong data.","triggerScenarios":"writeBlock receives a javaType outside {Boolean, Long, Double, BigDecimal/Slice} for a column returned by Pinot, e.g. custom object columns, unknown serialized types, or type mapping drift between PinotColumnHandle.expectedType and the actual server payload.","commonSituations":"Schema changed in Pinot (column converted to a type the connector can't map); connector type-mapping table missing a Pinot type (e.g. JSON/bytes mapped incorrectly); SELECT * picking up new columns of unsupported types.","solutions":["Identify the offending column from the message and exclude it from the SELECT projection or cast it to a supported type in the query","Add/extend the type mapping in the connector so the Pinot type maps to a supported Presto type (e.g. VARCHAR/Slice)","Check the Pinot table schema for recent type changes on that column","Upgrade the connector if a newer version supports the type"],"exampleFix":"// before\nSELECT * FROM pinot_table\n// after\nSELECT col_a, CAST(new_unsupported_col AS VARCHAR) FROM pinot_table","handlingStrategy":"validation","validationCode":"// check expected types before running the query\nfor (PinotColumnHandle h : expectedColumnHandles) {\n  Type t = h.getExpectedType();\n  if (!(t.getJavaType() == Boolean.class || t.getJavaType() == Long.class ||\n        t.getJavaType() == Double.class || t.getJavaType() == Slice.class ||\n        t.getJavaType() == BigDecimal.class)) {\n    throw new IllegalStateException(\"Unsupported column type in projection: \" + h.getColumnName() + \" -> \" + t);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  page = pageSource.getNextPage();\n} catch (PrestoException e) {\n  if (e.getErrorCode().getCode() == PINOT_UNSUPPORTED_COLUMN_TYPE.toErrorCode().getCode()) {\n    log.error(\"Unsupported pinot column: %s\", e.getMessage());\n    // re-plan excluding/casting the offending column\n    executeWithRewrittenQuery(stripOffendingColumn(originalQuery, e.getMessage()));\n  } else throw e;\n}","preventionTips":["Project only explicitly listed, supported columns instead of SELECT *","Cast exotic Pinot types to VARCHAR/standard types in SQL","Keep connector type-mapping tables in sync with Pinot schema changes","Diff the Pinot table schema after schema evolution events"],"tags":["pinot","type-mapping","unsupported-type"],"backgroundTag":"unsupported-column-type","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"}