prestodb/presto · error · IllegalArgumentException

Unsupported type:

Error message

Unsupported type: 

What it means

writeMinMax only supports scalar ORC types for pushed-down min/max aggregation; for BINARY, UNION, LIST, STRUCT, MAP (and the default branch) min/max statistics are not representable, so it throws IllegalArgumentException. The message is just the prefix 'Unsupported type: ' concatenated with the ORC type kind.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/orc/AggregatedOrcPageSource.java:228

                    Type definedType = hiveType.getType(typeManager);
                    if (Decimals.isShortDecimal(definedType)) {
                        blockBuilder.writeLong(value.unscaledValue().longValue());
                    }
                    else {
                        type.writeSlice(blockBuilder, Decimals.encodeUnscaledValue(value.unscaledValue()));
                    }
                }
                break;

            case BYTE:
            case BOOLEAN:
            case BINARY:
            case UNION:
            case LIST:
            case STRUCT:
            case MAP:
            default:
                throw new IllegalArgumentException("Unsupported type: " + orcType.getOrcTypeKind());
        }
    }

    private void writeNonNullCount(int columnIndex, BlockBuilder blockBuilder)
    {
        ColumnStatistics columnStatistics = footer.getFileStats().get(columnIndex + 1);
        if (!columnStatistics.hasNumberOfValues()) {
            throw new UnsupportedOperationException("Number of values not set for orc file. Set session property hive.pushdown_partial_aggregations_into_scan=false and execute query again");
        }
        blockBuilder.writeLong(columnStatistics.getNumberOfValues());
    }

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

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set session property hive.pushdown_partial_aggregations_into_scan=false and rerun
  2. Restrict the aggregation to scalar columns (numeric, string, date, boolean) instead of complex types
  3. Upgrade Presto if a newer version excludes complex types from pushdown planning

Example fix

// before
SELECT max(tags) FROM events; // tags is array<string>

// after (compute client-side or on a scalar)
SET SESSION hive.pushdown_partial_aggregations_into_scan = false;
SELECT max(tags) FROM events;
Defensive patterns

Strategy: validation

Validate before calling

-- only push min/max onto scalar columns
SELECT data_type FROM information_schema.columns
WHERE table_name = 'events' AND column_name = 'tags'; -- must not be array/map/struct/binary/varbinary

Type guard

boolean isScalarPushdownSafe(String hiveType) {
    return !hiveType.matches("(array|map|struct|binary|varbinary)(<.*")
        && !hiveType.equalsIgnoreCase("binary");
}

Try / catch

try {
    return runQuery(aggSql);
} catch (IllegalArgumentException e) {
    if (String.valueOf(e.getMessage()).startsWith("Unsupported type:")) {
        return runQueryWithoutAggregatePushdown(aggSql);
    }
    throw e;
}

Prevention

When it happens

Trigger: A pushed-down partial aggregation (min/max) references a column whose ORC type kind is BINARY, UNION, LIST, STRUCT, or MAP; getNextPage -> writeMinMax hits the default switch branch.

Common situations: Aggregating min/max on complex columns (arrays, maps, structs, binary) against ORC with hive.pushdown_partial_aggregations_into_scan enabled; planner allows the column but the aggregated scan cannot serve it.

Related errors


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