{"record":{"id":"77cd2175d8ce4720","repo":"prestodb/presto","slug":"bigquery-unsupported-type-for-slice","errorCode":"BIGQUERY_UNSUPPORTED_TYPE_FOR_SLICE","errorMessage":"Unhandled type for Slice: ","messagePattern":"Unhandled type for Slice: ","errorType":"error_code","errorClass":"BigQueryException","httpStatus":null,"severity":"error","filePath":"presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryResultPageSource.java","lineNumber":234,"sourceCode":"    private void writeSlice(BlockBuilder output, Type type, Object value)\n    {\n        if (type instanceof VarcharType) {\n            type.writeSlice(output, utf8Slice(((Utf8) value).toString()));\n        }\n        else if (type instanceof DecimalType) {\n            BigDecimal bdValue = DECIMAL_CONVERTER.convert(value);\n            type.writeSlice(output, Decimals.encodeScaledValue(bdValue, NUMERIC_DATA_TYPE_SCALE));\n        }\n        else if (type instanceof VarbinaryType) {\n            if (value instanceof ByteBuffer) {\n                type.writeSlice(output, Slices.wrappedBuffer((ByteBuffer) value));\n            }\n            else {\n                throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_VARBINARY, \"Unhandled type for VarBinaryType: \" + value.getClass());\n            }\n        }\n        else {\n            throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_SLICE, \"Unhandled type for Slice: \" + type.getTypeSignature());\n        }\n    }\n\n    private void writeBlock(BlockBuilder output, Type type, Object value)\n    {\n        if (type instanceof ArrayType && value instanceof List<?>) {\n            BlockBuilder builder = output.beginBlockEntry();\n\n            for (Object element : (List<?>) value) {\n                appendTo(type.getTypeParameters().get(0), element, builder);\n            }\n\n            output.closeEntry();\n            return;\n        }\n        if (type instanceof RowType && value instanceof GenericRecord) {\n            GenericRecord record = (GenericRecord) value;\n            BlockBuilder builder = output.beginBlockEntry();","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryResultPageSource.java#L216-L252","documentation":"writeSlice's final fallback: the Presto column type is neither a VarcharType nor a VarbinaryType, so the connector does not know how to write it as a Slice. It signals an unhandled Presto type in the BigQuery connector's slice-writing path.","triggerScenarios":"appendTo dispatches writeSlice for a type like CHAR, JSON, or another slice-backed type not explicitly supported by the connector when reading BigQuery results.","commonSituations":"Querying BigQuery columns whose mapped Presto types (e.g. JSON) are newer than the connector's supported set; connector version lagging behind server features.","solutions":["Identify the type signature in the message and add a writeSlice branch for it in writeSlice","Upgrade the presto-bigquery plugin to a version supporting that type","Avoid selecting the unsupported column or CAST it to varchar in the query","Track/upvote the connector issue for that type"],"exampleFix":"// before\nelse {\n    throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_SLICE, \"Unhandled type for Slice: \" + type.getTypeSignature());\n}\n// after\nelse if (type instanceof CharType) {\n    type.writeSlice(output, Slices.utf8Buffer(value.toString()));\n}\nelse {\n    throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_SLICE, \"Unhandled type for Slice: \" + type.getTypeSignature());\n}","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"varchar\", \"varbinary\");\nfor (ColumnMetadata col : table.getColumns()) {\n    String sig = col.getType().getTypeSignature().toString();\n    if (!supported.contains(sig.split(\"\\\\(\")[0])) {\n        throw new IllegalStateException(\"Unsupported slice type: \" + sig);\n    }\n}","typeGuard":"boolean isSliceBacked(Type type) {\n    return type instanceof VarcharType || type instanceof VarbinaryType;\n}","tryCatchPattern":"try {\n    session.execute(query);\n} catch (PrestoException e) {\n    if (BIGQUERY_UNSUPPORTED_TYPE_FOR_SLICE.getCode() == e.getErrorCode().getCode()) {\n        // rewrite query without or casting the offending column\n    } else { throw e; }\n}","preventionTips":["Avoid selecting slice-typed columns not in the connector's supported set","CAST exotic types (JSON, CHAR) to VARCHAR in queries","Keep the plugin upgraded for new type support","Document supported types for your catalog users"],"tags":["bigquery","slice","type-mapping"],"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"}