prestodb/presto · error · IllegalArgumentException

Expected all parameters to be named type, but got %s

Error message

Expected all parameters to be named type, but got %s

What it means

When converting an Iceberg (Presto) row type to a Hive struct type, every type-signature parameter must be a named field signature. This IllegalArgumentException is thrown if any parameter of the row type is a bare (unnamed) type parameter rather than a named field, since Hive struct types require field names.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/TypeConverter.java:383

        }
        if (type instanceof DecimalType) {
            DecimalType decimalType = (DecimalType) type;
            return new DecimalTypeInfo(decimalType.getPrecision(), decimalType.getScale());
        }
        if (isArrayType(type)) {
            TypeInfo elementType = toHiveTypeInfo(type.getTypeParameters().get(0));
            return getListTypeInfo(elementType);
        }
        if (isMapType(type)) {
            TypeInfo keyType = toHiveTypeInfo(type.getTypeParameters().get(0));
            TypeInfo valueType = toHiveTypeInfo(type.getTypeParameters().get(1));
            return getMapTypeInfo(keyType, valueType);
        }
        if (isRowType(type)) {
            ImmutableList.Builder<String> fieldNames = ImmutableList.builder();
            for (TypeSignatureParameter parameter : type.getTypeSignature().getParameters()) {
                if (!parameter.isNamedTypeSignature()) {
                    throw new IllegalArgumentException(format("Expected all parameters to be named type, but got %s", parameter));
                }
                NamedTypeSignature namedTypeSignature = parameter.getNamedTypeSignature();
                if (!namedTypeSignature.getName().isPresent()) {
                    throw new PrestoException(NOT_SUPPORTED, format("Anonymous row type is not supported in Hive. Please give each field a name: %s", type));
                }
                fieldNames.add(namedTypeSignature.getName().get());
            }
            return getStructTypeInfo(
                    fieldNames.build(),
                    type.getTypeParameters().stream()
                            .map(TypeConverter::toHiveTypeInfo)
                            .collect(toList()));
        }
        throw new PrestoException(NOT_SUPPORTED, format("Unsupported Hive type: %s", type));
    }

    public static List<OrcType> toOrcType(Schema schema)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Give every nested row field an explicit name in the Iceberg schema (row(name type, ...)).
  2. If the parameter is genuinely not a row parameter, extend toHiveTypeInfo with a branch handling that parameter kind.
  3. Flatten or restructure the column so anonymous nested types are avoided.

Example fix

// before (anonymous fields in schema)
Types.NestedField.of(1, false, "s", Types.StructType.of(Types.IntegerType.get(), Types.StringType.get()));
// after
Types.NestedField.of(1, false, "s", Types.StructType.of(
    Types.NestedField.of(2, true, "count", Types.IntegerType.get()),
    Types.NestedField.of(3, true, "name", Types.StringType.get())));
Defensive patterns

Strategy: validation

Validate before calling

for (TypeSignatureParameter p : type.getTypeSignature().getParameters()) {
    if (!p.isNamedTypeSignature()) {
        throw new IllegalArgumentException("Row type has unnamed parameter: " + p);
    }
}

Type guard

boolean allNamedRowParams(Type type) {
    return type.getTypeSignature().getParameters().stream().allMatch(TypeSignatureParameter::isNamedTypeSignature);
}

Try / catch

try { hiveType = TypeConverter.toHiveType(icebergType); } catch (IllegalArgumentException e) { /* fix schema / skip column */ }

Prevention

When it happens

Trigger: Calling toHiveType/toHiveTypeInfo (directly or via elementType/keyType/valueType) on a row Type whose TypeSignature contains a non-named TypeSignatureParameter (e.g. a nested plain type instead of row(name type,...)).

Common situations: Iceberg tables with row columns whose fields were never named; schemas built programmatically without field names; schema evolution or third-party writers producing anonymous nested structs.

Related errors


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