{"record":{"id":"a44865e445637b8f","repo":"prestodb/presto","slug":"duplicate-property","errorCode":"DUPLICATE_PROPERTY","errorMessage":"Duplicate property: %s","messagePattern":"Duplicate property: (.+?)","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java","lineNumber":1598,"sourceCode":"                    analyze(querySpecification, scope);\n\n                    TableHandle tableHandle = metadata.getHandleVersion(session, tableName, Optional.empty())\n                            .orElseThrow(() -> (new SemanticException(MISSING_TABLE, call, \"Table '%s' does not exist\", tableName)));\n                    TableDataRewriteAnalysisContext tableDataRewriteAnalysisContext = new TableDataRewriteAnalysisContext(tableHandle, querySpecification, zOrderColumns);\n                    analysis.setCallDistributedProcedureAnalysis(new Analysis.CallDistributedProcedureAnalysis(procedureType, values, Optional.of(tableDataRewriteAnalysisContext)));\n                    break;\n                default:\n                    throw new PrestoException(StandardErrorCode.NOT_SUPPORTED, \"Unsupported distributed procedure type: \" + procedure.getType());\n            }\n            return createAndAssignScope(call, scope, Field.newUnqualified(Optional.empty(), \"rows\", BIGINT));\n        }\n\n        private void validateProperties(List<Property> properties, Optional<Scope> scope)\n        {\n            Set<String> propertyNames = new HashSet<>();\n            for (Property property : properties) {\n                if (!propertyNames.add(property.getName().getValue())) {\n                    throw new SemanticException(DUPLICATE_PROPERTY, property, \"Duplicate property: %s\", property.getName().getValue());\n                }\n            }\n            for (Property property : properties) {\n                process(property, scope);\n            }\n        }\n\n        private void validateColumns(Statement node, RelationType descriptor)\n        {\n            // verify that all column names are specified and unique\n            // TODO: collect errors and return them all at once\n            Set<String> names = new HashSet<>();\n            for (Field field : descriptor.getVisibleFields()) {\n                Optional<String> fieldName = field.getName();\n                if (!fieldName.isPresent()) {\n                    throw new SemanticException(COLUMN_NAME_NOT_SPECIFIED, node, \"Column name not specified at position %s\", descriptor.indexOf(field) + 1);\n                }\n                if (!names.add(fieldName.get())) {","sourceCodeStart":1580,"sourceCodeEnd":1616,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java#L1580-L1616","documentation":"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.","triggerScenarios":"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>).","commonSituations":"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.","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"],"exampleFix":"// before\nCREATE TABLE hive.web.page_views WITH (partitioned_by = ARRAY['ds'], format = 'ORC', format = 'ORC') AS ...\n\n// after\nCREATE TABLE hive.web.page_views WITH (partitioned_by = ARRAY['ds'], format = 'ORC') AS ...","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (Property p : properties) {\n    if (!seen.add(p.getName().getValue())) {\n        throw new IllegalArgumentException(\"Duplicate property: \" + p.getName().getValue());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(ddlSql);\n} catch (SemanticException e) {\n    if (e.getCode() == SemanticErrorCode.DUPLICATE_PROPERTY) {\n        // deduplicate WITH clause and retry once\n    } else throw e;\n}","preventionTips":["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"],"tags":["presto","ddl","properties","semantic-analysis"],"backgroundTag":"duplicate-property","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}