prestodb/presto · error · SemanticException
DUPLICATE_PROPERTY
DUPLICATE_PROPERTY
Error message
Duplicate property: %s
What it means
A SemanticException raised by validateProperties during analysis of statements that accept properties (e.g. CREATE TABLE ... WITH (...), CREATE SESSION property lists). The same property name appears more than once in the property list, which is ambiguous, so analysis fails immediately with DUPLICATE_PROPERTY.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java:1598
analyze(querySpecification, scope);
TableHandle tableHandle = metadata.getHandleVersion(session, tableName, Optional.empty())
.orElseThrow(() -> (new SemanticException(MISSING_TABLE, call, "Table '%s' does not exist", tableName)));
TableDataRewriteAnalysisContext tableDataRewriteAnalysisContext = new TableDataRewriteAnalysisContext(tableHandle, querySpecification, zOrderColumns);
analysis.setCallDistributedProcedureAnalysis(new Analysis.CallDistributedProcedureAnalysis(procedureType, values, Optional.of(tableDataRewriteAnalysisContext)));
break;
default:
throw new PrestoException(StandardErrorCode.NOT_SUPPORTED, "Unsupported distributed procedure type: " + procedure.getType());
}
return createAndAssignScope(call, scope, Field.newUnqualified(Optional.empty(), "rows", BIGINT));
}
private void validateProperties(List<Property> properties, Optional<Scope> scope)
{
Set<String> propertyNames = new HashSet<>();
for (Property property : properties) {
if (!propertyNames.add(property.getName().getValue())) {
throw new SemanticException(DUPLICATE_PROPERTY, property, "Duplicate property: %s", property.getName().getValue());
}
}
for (Property property : properties) {
process(property, scope);
}
}
private void validateColumns(Statement node, RelationType descriptor)
{
// verify that all column names are specified and unique
// TODO: collect errors and return them all at once
Set<String> names = new HashSet<>();
for (Field field : descriptor.getVisibleFields()) {
Optional<String> fieldName = field.getName();
if (!fieldName.isPresent()) {
throw new SemanticException(COLUMN_NAME_NOT_SPECIFIED, node, "Column name not specified at position %s", descriptor.indexOf(field) + 1);
}
if (!names.add(fieldName.get())) {View on GitHub (pinned to 55bb57d202)
Solutions
- Remove the duplicate property from the WITH/properties clause, keeping a single definition
- If SQL is generated, deduplicate keys before rendering (e.g. use a Map so later values overwrite earlier ones deliberately)
- Re-run the statement after fixing the clause
Example fix
// before CREATE TABLE hive.web.page_views WITH (partitioned_by = ARRAY['ds'], format = 'ORC', format = 'ORC') AS ... // after CREATE TABLE hive.web.page_views WITH (partitioned_by = ARRAY['ds'], format = 'ORC') AS ...
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 {
session.execute(ddlSql);
} catch (SemanticException e) {
if (e.getCode() == SemanticErrorCode.DUPLICATE_PROPERTY) {
// deduplicate WITH clause and retry once
} else throw e;
} Prevention
- Build property clauses from a Map<String, String> so duplicates are impossible
- Deduplicate programmatically-generated SQL fragments before rendering
- Review hand-written WITH clauses for copy-paste duplicates
When it happens
Trigger: Running DDL such as `CREATE TABLE t WITH (format = 'ORC', format = 'PARQUET')` or ALTER/CREATE with two properties sharing the same name (property.getName().getValue() repeated in the List<Property>).
Common situations: Programmatic DDL generation concatenating property maps/lists without deduplication; copy-pasted WITH clauses; template-generated SQL where a default property plus a user property collide.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/a44865e445637b8f.
Report an issue: GitHub.