prestodb/presto · error · PrestoException
SYNTAX_ERROR
SYNTAX_ERROR
Error message
Duplicate property found: %s=%s and %s=%s
What it means
This error is thrown by NodeUtils.mapFromProperties when converting a list of Property SQL AST nodes into a map of expression properties. The library throws SYNTAX_ERROR because the same property name appears twice in the source, which would silently lose data if converted to a map. It surfaces while parsing/analyzing DDL statements such as CREATE TABLE ... WITH (...) or CREATE SESSION property lists.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/NodeUtils.java:48
import static java.lang.String.format;
public class NodeUtils
{
private NodeUtils() {}
public static List<SortItem> getSortItemsFromOrderBy(Optional<OrderBy> orderBy)
{
return orderBy.map(OrderBy::getSortItems).orElse(ImmutableList.of());
}
public static Map<String, Expression> mapFromProperties(List<Property> properties)
{
Map<String, Expression> outputMap = new HashMap<>();
for (Property property : properties) {
String key = property.getName().getValue();
if (outputMap.containsKey(key)) {
throw new PrestoException(SYNTAX_ERROR, format("Duplicate property found: %s=%s and %s=%s", key, outputMap.get(key), key, property.getValue()));
}
outputMap.put(key, property.getValue());
}
return ImmutableMap.copyOf(outputMap);
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Remove the duplicate property from the SQL statement, keeping only one entry per name
- If building the AST programmatically, deduplicate properties by name before calling mapFromProperties
- Enable clearer DDL validation upstream so the offending statement is reported with statement text
Example fix
// before CREATE TABLE t WITH (format = 'ORC', format = 'PARQUET') // after CREATE TABLE t WITH (format = 'PARQUET')
Defensive patterns
Strategy: validation
Validate before calling
Set<String> seen = new HashSet<>();
for (Property p : properties) {
if (!seen.add(p.getName().getValue())) {
throw new IllegalArgumentException("Duplicate property: " + p.getName().getValue());
}
} Try / catch
try { Map<String, Expression> m = NodeUtils.mapFromProperties(props); } catch (PrestoException e) { if (e.getErrorCode().getCode() == SYNTAX_ERROR.toErrorCode().getCode()) { /* surface duplicate key to user */ } else throw e; } Prevention
- Deduplicate properties by name before building the AST
- In generated SQL, use a Map (not a List) as the source of properties
- Lint DDL templates for repeated WITH keys
- Write unit tests for property parsing with edge-case inputs
When it happens
Trigger: Calling NodeUtils.mapFromProperties with a properties list containing two Property nodes whose getName().getValue() strings are equal, e.g. 'CREATE TABLE t WITH (partitioned_by = ARRAY['a'], location = ..., partitioned_by = ...)'.
Common situations: Hand-written DDL with a copy-pasted property; generated SQL templates that repeat a key; programmatic AST construction appending the same property twice.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/66319ab94ee0ffd5.
Report an issue: GitHub.