prestodb/presto · error · IllegalArgumentException
SchemaTableName should have exactly 2 parts
Error message
SchemaTableName should have exactly 2 parts
What it means
SchemaTableName.valueOf parses a string into a SchemaTableName and requires exactly one dot separating schema and table. IllegalArgumentException("SchemaTableName should have exactly 2 parts") is thrown when the string splits into fewer or more than 2 dot-separated parts.
Source
Thrown at presto-spi/src/main/java/com/facebook/presto/spi/SchemaTableName.java:46
{
private final String schemaName;
private final String tableName;
@JsonCreator
@ThriftConstructor
public SchemaTableName(@JsonProperty("schema") String schemaName, @JsonProperty("table") String tableName)
{
this.schemaName = checkNotEmpty(schemaName, "schemaName");
this.tableName = checkNotEmpty(tableName, "tableName");
}
public static SchemaTableName valueOf(String schemaTableName)
{
checkNotEmpty(schemaTableName, "schemaTableName");
String[] parts = schemaTableName.split("\\.");
if (parts.length != 2) {
throw new IllegalArgumentException("SchemaTableName should have exactly 2 parts");
}
return new SchemaTableName(parts[0], parts[1]);
}
@JsonProperty("schema")
@ThriftField(value = 1, name = "schema")
public String getSchemaName()
{
return schemaName;
}
@JsonProperty("table")
@ThriftField(value = 2, name = "table")
public String getTableName()
{
return tableName;
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Pass exactly "<schema>.<table>" to valueOf; strip the catalog prefix if present
- Split the identifier yourself and construct with new SchemaTableName(schema, table) to control parsing (handles quoted names)
- Trim or unquote the string first; validate it contains exactly one unescaped dot before calling valueOf
Example fix
// before
SchemaTableName name = SchemaTableName.valueOf("mycatalog.myschema.mytable");
// after
SchemaTableName name = new SchemaTableName("myschema", "mytable"); Defensive patterns
Strategy: validation
Validate before calling
if (s.chars().filter(c -> c == '.').count() != 1) throw new IllegalArgumentException("expected schema.table: " + s); Prevention
- Keep identifiers split into components until the last moment; construct with new SchemaTableName(schema, table)
- Strip catalog prefixes before parsing schema.table strings
- Add unit tests for valueOf with 0, 1, and 3-part strings
When it happens
Trigger: Calling SchemaTableName.valueOf with a string that has no dot (e.g. "mytable"), more than one dot (e.g. "catalog.schema.table"), or a trailing/leading dot (e.g. "schema.") .
Common situations: Passing a fully qualified catalog.schema.table identifier instead of schema.table; concatenating table name parts with an extra separator; empty components from config properties or CLI args; catalog name accidentally included in a connector config that expects schema.table.
Related errors
- partitionHandle must be NOT_PARTITIONED
- Invalid NodeState value:
- value must be > 0, found:
- Invalid weight:
- splitCount must be >= 0, found:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/ca82934ff13b027e.
Report an issue: GitHub.