prestodb/presto · error · BigQueryException

BIGQUERY_UNSUPPORTED_TYPE_FOR_BLOCK

BIGQUERY_UNSUPPORTED_TYPE_FOR_BLOCK

Error message

Unhandled type for Block: 

What it means

writeBlock throws this when a nested (row/array) Presto type or value cannot be assembled into a Block — the type is not a supported ArrayType/RowType combination (or the value is not the expected List/record). It is the connector's guard for unhandled nested types read from BigQuery.

Source

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

            return;
        }
        if (type instanceof RowType && value instanceof GenericRecord) {
            GenericRecord record = (GenericRecord) value;
            BlockBuilder builder = output.beginBlockEntry();

            List<String> fieldNames = new ArrayList<>();
            for (int i = 0; i < type.getTypeSignature().getParameters().size(); i++) {
                TypeSignatureParameter parameter = type.getTypeSignature().getParameters().get(i);
                fieldNames.add(parameter.getNamedTypeSignature().getName().orElse("field" + i));
            }
            checkState(fieldNames.size() == type.getTypeParameters().size(), "fieldName doesn't match with type size : %s", type);
            for (int index = 0; index < type.getTypeParameters().size(); index++) {
                appendTo(type.getTypeParameters().get(index), record.get(fieldNames.get(index)), builder);
            }
            output.closeEntry();
            return;
        }
        throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_BLOCK, "Unhandled type for Block: " + type.getTypeSignature());
    }

    @Override
    public long getSystemMemoryUsage()
    {
        return 0;
    }

    @Override
    public void close()
            throws IOException
    {
        bigQueryReadClient.close();
        closed = true;
    }

    Iterable<GenericRecord> parse(ReadRowsResponse response)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Flatten the nested BigQuery columns in SQL (unnest / selecting leaf fields)
  2. Add an explicit branch in writeBlock for the reported type signature
  3. Upgrade the connector to a version with broader nested-type support
  4. Exclude the nested column from the query

Example fix

// before
throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_BLOCK, "Unhandled type for Block: " + type.getTypeSignature());
// after
if (type instanceof MapType && value instanceof Map) {
    // build map block
    return;
}
throw new BigQueryException(BIGQUERY_UNSUPPORTED_TYPE_FOR_BLOCK, "Unhandled type for Block: " + type.getTypeSignature());
Defensive patterns

Strategy: validation

Validate before calling

// verify nested columns are supported before querying
if (column.getType() instanceof ArrayType || column.getType() instanceof RowType) {
    // ensure connector version supports this nested signature
    checkSupportedNestedSignature(column.getType().getTypeSignature());
}

Type guard

boolean isSupportedNestedType(Type type) {
    return (type instanceof ArrayType || type instanceof RowType)
        && SUPPORTED_NESTED_SIGNATURES.contains(type.getTypeSignature().toString());
}

Try / catch

try {
    query.execute();
} catch (BigQueryException e) {
    if (BIGQUERY_UNSUPPORTED_TYPE_FOR_BLOCK.getCode() == e.getErrorCode().getCode()) {
        // retry with flattened columns (UNNEST / leaf fields only)
    } else { throw e; }
}

Prevention

When it happens

Trigger: Reading a BigQuery STRUCT/RECORD or ARRAY whose resulting Presto type/value does not match the ArrayType-with-List or row-record branches, e.g. unexpected nested type signature.

Common situations: BigQuery nested/repeated fields with unusual schemas; legacy RECORD columns; connector lacking support for nested maps or deeply nested structs.

Related errors


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