prestodb/presto · error · IllegalArgumentException
Unexpected databaseName, expected: %s, but found: %s
Error message
Unexpected databaseName, expected: %s, but found: %s
What it means
GlueToPrestoConverter's partition-mapping apply() validates that each Glue Partition belongs to the database the query was made against. A mismatch (partition's databaseName differs from the enclosing table's) throws IllegalArgumentException to surface inconsistent catalog data.
Source
Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/glue/converter/GlueToPrestoConverter.java:162
private final Function<Map<String, String>, Map<String, String>> parametersConverter = parametersConverter();
private final StorageConverter storageConverter = new StorageConverter();
private final String databaseName;
private final String tableName;
public GluePartitionConverter(String databaseName, String tableName)
{
this.databaseName = requireNonNull(databaseName, "databaseName is null");
this.tableName = requireNonNull(tableName, "tableName is null");
}
@Override
public Partition apply(software.amazon.awssdk.services.glue.model.Partition gluePartition)
{
requireNonNull(gluePartition.storageDescriptor(), "Partition StorageDescriptor is null");
StorageDescriptor sd = gluePartition.storageDescriptor();
if (!databaseName.equals(gluePartition.databaseName())) {
throw new IllegalArgumentException(format("Unexpected databaseName, expected: %s, but found: %s", databaseName, gluePartition.databaseName()));
}
if (!tableName.equals(gluePartition.tableName())) {
throw new IllegalArgumentException(format("Unexpected tableName, expected: %s, but found: %s", tableName, gluePartition.tableName()));
}
Partition.Builder partitionBuilder = Partition.builder()
.setCatalogName(Optional.empty())
.setDatabaseName(databaseName)
.setTableName(tableName)
.setValues(gluePartition.values()) // No memoization benefit
.setColumns(columnsConverter.apply(sd.columns()))
.setParameters(parametersConverter.apply(gluePartition.parameters()));
storageConverter.setConvertedStorage(sd, partitionBuilder.getStorageBuilder());
return partitionBuilder.build();
}
}View on GitHub (pinned to 55bb57d202)
Solutions
- Verify and repair the Glue partition entries so databaseName matches the parent table
- Re-fetch partitions for the correct database/table
- Upgrade/check the connector path that fetched partitions from another database
Defensive patterns
Strategy: validation
Validate before calling
if (!databaseName.equals(gluePartition.databaseName())) {
// skip or repair partition fetched with mismatched databaseName
return null;
} Type guard
boolean partitionMatches(Partition p, String db, String tbl) {
return db.equals(p.databaseName()) && tbl.equals(p.tableName());
} Try / catch
try {
Partition part = prestoPartition(gluePartition, ...);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unexpected databaseName")) {
// log and skip inconsistent partition
} else throw e;
} Prevention
- Clean up orphaned partitions after table renames/drops
- Fetch partitions only via the owning table's API path
- Periodically validate partition ownership in Glue
When it happens
Trigger: Listing/reading partitions where a returned Glue Partition has a databaseName different from the requested database — inconsistent Glue metadata or API anomaly.
Common situations: Corrupted Glue catalog entries, table renames leaving orphan partitions, or misuse of the converter with partitions fetched for another table.
Related errors
- Unexpected tableName, expected: %s, but found: %s
- Invalid day-time interval:
- Invalid year-month interval:
- dictionarySourceIds must be the same
- blocks is empty
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/2641cea69fd42111.
Report an issue: GitHub.