prestodb/presto · error · IllegalArgumentException

unsupported column type

Error message

unsupported column type 

What it means

TpchMetadata.toDouble converts a decoded statistics value to a numeric form, supporting BIGINT/INTEGER/DATE (as long) and DOUBLE. Any other column type reaches the final throw IllegalArgumentException 'unsupported column type'. It enforces that only numeric stats columns are converted.

Source

Thrown at presto-tpch/src/main/java/com/facebook/presto/tpch/TpchMetadata.java:438

        }
        if (!min.isPresent() || !max.isPresent()) {
            return Optional.empty();
        }
        return Optional.of(new DoubleRange(toDouble(min.get(), columnType), toDouble(max.get(), columnType)));
    }

    private static double toDouble(Object value, Type columnType)
    {
        if (value instanceof String && columnType.equals(DATE)) {
            return LocalDate.parse((CharSequence) value).toEpochDay();
        }
        if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE)) {
            return ((Number) value).longValue();
        }
        if (columnType.equals(DOUBLE)) {
            return ((Number) value).doubleValue();
        }
        throw new IllegalArgumentException("unsupported column type " + columnType);
    }

    @Override
    public TableStatisticsMetadata getStatisticsCollectionMetadata(ConnectorSession session, ConnectorTableMetadata tableMetadata)
    {
        return new TableStatisticsMetadata(ImmutableSet.of(), ImmutableSet.of(ROW_COUNT), ImmutableList.of());
    }

    @Override
    public ConnectorTableHandle beginStatisticsCollection(ConnectorSession session, ConnectorTableHandle tableHandle)
    {
        return (TpchTableHandle) tableHandle;
    }

    @Override
    public void finishStatisticsCollection(ConnectorSession session, ConnectorTableHandle tableHandle, Collection<ComputedStatistics> computedStatistics)
    {
        // do nothing

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Only invoke range-statistics conversion for BIGINT/INTEGER/DATE/DOUBLE columns
  2. Regenerate table statistics after schema changes so types match
  3. Add a DECIMAL (or other needed) branch in toDouble if support is required
  4. Drop/refresh stale stats files whose column types no longer match the table

Example fix

// before
Object min = toDouble(columnType, minValue); // columnType = VARCHAR
// after
if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE) || columnType.equals(DOUBLE)) {
    Object min = toDouble(columnType, minValue);
}
Defensive patterns

Strategy: validation

Validate before calling

Set<Type> supported = ImmutableSet.of(BIGINT, INTEGER, DATE, DOUBLE);
if (!supported.contains(columnType)) {
    throw new IllegalArgumentException("No numeric stats conversion for " + columnType);
}

Type guard

boolean isStatsConvertible(Type t) {
    return t.equals(BIGINT) || t.equals(INTEGER) || t.equals(DATE) || t.equals(DOUBLE);
}

Try / catch

try {
    Object v = toDouble(columnType, value);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("unsupported column type")) {
        return Optional.empty(); // skip this column's range
    }
    throw e;
}

Prevention

When it happens

Trigger: toRange called with a TPC-H column whose type is e.g. VARCHAR, CHAR, or DECIMAL while computing statistics ranges from a stats block.

Common situations: Stale statistics collected before a column type change; stats data referencing columns of unsupported types; misuse of the internal conversion helper for non-numeric columns.

Related errors


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