prestodb/presto · error · BigQueryException

BIGQUERY_UNSUPPORTED_COLUMN_TYPE

BIGQUERY_UNSUPPORTED_COLUMN_TYPE

Error message

Unhandled type for %s: %s

What it means

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.

Source

Thrown at presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryResultPageSource.java:186

        Class<?> javaType = type.getJavaType();
        try {
            if (javaType == boolean.class) {
                type.writeBoolean(output, (Boolean) value);
            }
            else if (javaType == long.class) {
                writeLong(type, value, output, javaType);
            }
            else if (javaType == double.class) {
                type.writeDouble(output, ((Number) value).doubleValue());
            }
            else if (javaType == Slice.class) {
                writeSlice(output, type, value);
            }
            else if (javaType == Block.class) {
                writeBlock(output, type, value);
            }
            else {
                throw new BigQueryException(BIGQUERY_UNSUPPORTED_COLUMN_TYPE, format("Unhandled type for %s: %s", javaType.getSimpleName(), type));
            }
        }
        catch (ClassCastException exception) {
            throw new BigQueryException(BIGQUERY_UNSUPPORTED_COLUMN_TYPE, "Not support type conversion for BigQuery data type: " + type, exception);
        }
    }

    private void writeLong(Type type, Object value, BlockBuilder output, Class<?> javaType)
    {
        if (type.equals(BIGINT)) {
            type.writeLong(output, ((Number) value).longValue());
        }
        else if (type.equals(INTEGER)) {
            type.writeLong(output, ((Number) value).intValue());
        }
        else if (type.equals(DATE)) {
            type.writeLong(output, ((Number) value).intValue());
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Upgrade the bigquery connector / Presto to a version supporting the column's BigQuery type
  2. Identify the offending column from the message (javaType + Presto type) and exclude or cast it out of the query, e.g. avoid SELECT *
  3. Cast the unsupported column to a supported type in the query (e.g. CAST(json_col AS VARCHAR) if supported)
  4. If the type should be supported, file an issue with the BigQuery type and Presto type from the message

Example fix

// before
SELECT * FROM dataset.events;  -- includes unsupported JSON column
// after
SELECT id, ts, CAST(payload AS VARCHAR) AS payload FROM dataset.events;
Defensive patterns

Strategy: type-guard

Validate before calling

// pre-check column types are supported before running the query
for (ColumnMetadata c : metadata.listTableColumns(session, schemaTable)) {
    Class<?> jt = c.getType().getJavaType();
    boolean supported = jt == long.class || jt == boolean.class || jt == double.class || jt == Slice.class || jt == Block.class;
    if (!supported) throw new PrestoException(NOT_SUPPORTED, "Unsupported column: " + c.getName() + " -> " + c.getType());
}

Type guard

function isSupportedColumnType(col) {
  const supported = ['bigint','boolean','double','varchar','date','timestamp','time','varbinary','row','array','map'];
  return supported.includes(String(col.type.baseTypeName).toLowerCase());
}

Try / catch

try (ResultSet rs = statement.executeQuery(q)) {
    consume(rs);
} catch (BigQueryException e) {
    if (e.getErrorCode() == BIGQUERY_UNSUPPORTED_COLUMN_TYPE && e.getMessage().startsWith("Unhandled type")) {
        throw new PrestoException(NOT_SUPPORTED, "Exclude or CAST the column: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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