{"record":{"id":"7c67a804b831ec03","repo":"prestodb/presto","slug":"bigquery-unsupported-column-type","errorCode":"BIGQUERY_UNSUPPORTED_COLUMN_TYPE","errorMessage":"Unhandled type for %s: %s","messagePattern":"Unhandled type for (.+?): (.+?)","errorType":"error_code","errorClass":"BigQueryException","httpStatus":null,"severity":"error","filePath":"presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryResultPageSource.java","lineNumber":186,"sourceCode":"        Class<?> javaType = type.getJavaType();\n        try {\n            if (javaType == boolean.class) {\n                type.writeBoolean(output, (Boolean) value);\n            }\n            else if (javaType == long.class) {\n                writeLong(type, value, output, javaType);\n            }\n            else if (javaType == double.class) {\n                type.writeDouble(output, ((Number) value).doubleValue());\n            }\n            else if (javaType == Slice.class) {\n                writeSlice(output, type, value);\n            }\n            else if (javaType == Block.class) {\n                writeBlock(output, type, value);\n            }\n            else {\n                throw new BigQueryException(BIGQUERY_UNSUPPORTED_COLUMN_TYPE, format(\"Unhandled type for %s: %s\", javaType.getSimpleName(), type));\n            }\n        }\n        catch (ClassCastException exception) {\n            throw new BigQueryException(BIGQUERY_UNSUPPORTED_COLUMN_TYPE, \"Not support type conversion for BigQuery data type: \" + type, exception);\n        }\n    }\n\n    private void writeLong(Type type, Object value, BlockBuilder output, Class<?> javaType)\n    {\n        if (type.equals(BIGINT)) {\n            type.writeLong(output, ((Number) value).longValue());\n        }\n        else if (type.equals(INTEGER)) {\n            type.writeLong(output, ((Number) value).intValue());\n        }\n        else if (type.equals(DATE)) {\n            type.writeLong(output, ((Number) value).intValue());\n        }","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryResultPageSource.java#L168-L204","documentation":"Thrown by BigQueryResultPageSource.appendTo when a BigQuery value's mapped Presto javaType is neither a known primitive type handled by the if/else chain nor Block.class, i.e. the column's Presto type has no writer path in the connector. It signals an internal type-mapping gap between the BigQuery Storage schema and Presto's type system for that column.","triggerScenarios":"Reading a BigQuery column whose type maps to a javaType not covered by appendTo's branches (long, boolean, double, slice, Block). Occurs while getNextPage iterates ReadRows values and calls appendTo for an unsupported column type.","commonSituations":"Newer BigQuery types (e.g. JSON, INTERVAL, RANGE, numeric variants) read with an older connector version; custom type mapping/coercion leaving a column typed unexpectedly; connector version lagging behind the BigQuery Storage API schema.","solutions":["Upgrade the bigquery connector / Presto to a version supporting the column's BigQuery type","Identify the offending column from the message (javaType + Presto type) and exclude or cast it out of the query, e.g. avoid SELECT *","Cast the unsupported column to a supported type in the query (e.g. CAST(json_col AS VARCHAR) if supported)","If the type should be supported, file an issue with the BigQuery type and Presto type from the message"],"exampleFix":"// before\nSELECT * FROM dataset.events;  -- includes unsupported JSON column\n// after\nSELECT id, ts, CAST(payload AS VARCHAR) AS payload FROM dataset.events;","handlingStrategy":"type-guard","validationCode":"// pre-check column types are supported before running the query\nfor (ColumnMetadata c : metadata.listTableColumns(session, schemaTable)) {\n    Class<?> jt = c.getType().getJavaType();\n    boolean supported = jt == long.class || jt == boolean.class || jt == double.class || jt == Slice.class || jt == Block.class;\n    if (!supported) throw new PrestoException(NOT_SUPPORTED, \"Unsupported column: \" + c.getName() + \" -> \" + c.getType());\n}","typeGuard":"function isSupportedColumnType(col) {\n  const supported = ['bigint','boolean','double','varchar','date','timestamp','time','varbinary','row','array','map'];\n  return supported.includes(String(col.type.baseTypeName).toLowerCase());\n}","tryCatchPattern":"try (ResultSet rs = statement.executeQuery(q)) {\n    consume(rs);\n} catch (BigQueryException e) {\n    if (e.getErrorCode() == BIGQUERY_UNSUPPORTED_COLUMN_TYPE && e.getMessage().startsWith(\"Unhandled type\")) {\n        throw new PrestoException(NOT_SUPPORTED, \"Exclude or CAST the column: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Avoid SELECT * on tables with new BigQuery types (JSON, INTERVAL, RANGE) on older connector versions","Upgrade the connector when new BigQuery column types are introduced","Verify types in information_schema.columns before wide SELECTs","CAST unsupported columns to supported types explicitly in queries"],"tags":["bigquery","type-system","unsupported-type","read-path"],"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"}