prestodb/presto · error · IllegalArgumentException

unsupported column type

Error message

unsupported column type 

What it means

TpcdsTableStatisticsFactory.toDouble only supports numeric statistics columns: decimal (short/long) and DOUBLE. When asked to convert a value of any other Type it throws IllegalArgumentException 'unsupported column type'. Statistics conversion is intentionally limited to numeric columns.

Source

Thrown at presto-tpcds/src/main/java/com/facebook/presto/tpcds/statistics/TpcdsTableStatisticsFactory.java:117

            return LocalDate.parse((CharSequence) value).toEpochDay();
        }
        if (type.equals(BIGINT) || type.equals(INTEGER) || type.equals(DATE)) {
            return ((Number) value).doubleValue();
        }
        if (type instanceof DecimalType) {
            DecimalType decimalType = (DecimalType) type;
            if (isShortDecimal(decimalType)) {
                return parseDouble(Decimals.toString(((Number) value).longValue(), decimalType.getScale()));
            }
            if (isLongDecimal(decimalType)) {
                return parseDouble(Decimals.toString((Slice) value, decimalType.getScale()));
            }
            throw new IllegalArgumentException("Unexpected decimal type: " + decimalType);
        }
        if (type.equals(DOUBLE)) {
            return ((Number) value).doubleValue();
        }
        throw new IllegalArgumentException("unsupported column type " + type);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure statistics data only contains min/max ranges for numeric (DOUBLE/decimal) columns
  2. Remove or regenerate statistics files that include non-numeric column ranges
  3. Update the stats-generation code to skip unsupported column types
  4. Regenerate table statistics after any schema/type change

Example fix

// before
// stats json includes range for varchar column "comment"
// after
// remove the range entry for non-numeric columns from stats json
Defensive patterns

Strategy: validation

Validate before calling

if (!(type.equals(DOUBLE) || type instanceof DecimalType)) {
    throw new IllegalArgumentException("Skip range stats for non-numeric column type " + type);
}

Type guard

boolean supportsRangeStats(Type t) { return t.equals(DOUBLE) || t instanceof DecimalType; }

Try / catch

try {
    DoubleRange r = toRange(columnStats);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("unsupported column type")) {
        return Optional.empty(); // skip range for unsupported column
    }
    throw e;
}

Prevention

When it happens

Trigger: toRange invoked for a column whose Type is not DOUBLE or decimal — e.g. VARCHAR, DATE, or BIGINT statistics data passed into the TPC-DS statistics factory path.

Common situations: Statistics files listing non-numeric columns with min/max values; schema change making a column non-numeric while old stats remain; bug in code selecting columns for range statistics.

Related errors


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