{"record":{"id":"5d92c6ea73d3c3d3","repo":"prestodb/presto","slug":"generic-user-error-5d92c6","errorCode":"GENERIC_USER_ERROR","errorMessage":"Table property ${PARTITION_BY_HASH_COLUMNS_2} is only allowed if there is also ${PARTITION_BY_HASH_COLUMNS}","messagePattern":"Table property (.+?) is only allowed if there is also (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-kudu/src/main/java/com/facebook/presto/kudu/properties/KuduTableProperties.java","lineNumber":198,"sourceCode":"    {\n        requireNonNull(tableProperties);\n\n        List<String> hashColumns = (List) tableProperties.get(PARTITION_BY_HASH_COLUMNS);\n        List<String> hashColumns2 = (List) tableProperties.get(PARTITION_BY_HASH_COLUMNS_2);\n\n        PartitionDesign design = new PartitionDesign();\n        if (!hashColumns.isEmpty()) {\n            List<HashPartitionDefinition> hashPartitions = new ArrayList<>();\n            HashPartitionDefinition hash1 = getHashPartitionDefinition(tableProperties, hashColumns, PARTITION_BY_HASH_BUCKETS);\n            hashPartitions.add(hash1);\n            if (!hashColumns2.isEmpty()) {\n                HashPartitionDefinition hash2 = getHashPartitionDefinition(tableProperties, hashColumns2, PARTITION_BY_HASH_BUCKETS_2);\n                hashPartitions.add(hash2);\n            }\n            design.setHash(hashPartitions);\n        }\n        else if (!hashColumns2.isEmpty()) {\n            throw new PrestoException(GENERIC_USER_ERROR, \"Table property \" + PARTITION_BY_HASH_COLUMNS_2 + \" is only allowed if there is also \" + PARTITION_BY_HASH_COLUMNS);\n        }\n\n        List<String> rangeColumns = (List) tableProperties.get(PARTITION_BY_RANGE_COLUMNS);\n        if (!rangeColumns.isEmpty()) {\n            RangePartitionDefinition range = new RangePartitionDefinition();\n            range.setColumns(rangeColumns);\n            design.setRange(range);\n        }\n\n        return design;\n    }\n\n    public static ColumnDesign getColumnDesign(Map<String, Object> columnProperties)\n    {\n        requireNonNull(columnProperties);\n        if (columnProperties.isEmpty()) {\n            return ColumnDesign.DEFAULT;\n        }","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kudu/src/main/java/com/facebook/presto/kudu/properties/KuduTableProperties.java#L180-L216","documentation":"KuduTableProperties.getPartitionDesign builds the partition design from table properties. partition_by_hash_buckets_2 / partition_by_hash_columns_2 define a second hash partitioning, which is only meaningful alongside a primary hash partitioning. Specifying the second property without the first is rejected as a GENERIC_USER_ERROR.","triggerScenarios":"CREATE TABLE ... WITH (partition_by_hash_columns_2 = ARRAY['x'], partition_by_hash_buckets_2 = 8) without partition_by_hash_columns / partition_by_hash_buckets.","commonSituations":"Users only want two hash bucketings and skip the primary one, not realizing the second is an additional level; copy-paste of partial WITH clauses.","solutions":["Add partition_by_hash_columns and partition_by_hash_buckets alongside the _2 properties","Remove the _2 properties if only one hash partitioning is wanted"],"exampleFix":"-- before\nWITH (partition_by_hash_columns_2 = ARRAY['b'], partition_by_hash_buckets_2 = 8)\n-- after\nWITH (partition_by_hash_columns = ARRAY['a'], partition_by_hash_buckets = 4, partition_by_hash_columns_2 = ARRAY['b'], partition_by_hash_buckets_2 = 8)","handlingStrategy":"validation","validationCode":"Map<String,Object> props = getTableProperties();\nif (!props.getOrDefault(\"partition_by_hash_columns\", List.of()).isEmpty() == false\n    && !props.getOrDefault(\"partition_by_hash_columns_2\", List.of()).isEmpty()) {\n    throw new IllegalArgumentException(\"partition_by_hash_columns_2 requires partition_by_hash_columns\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    createTable(ddl);\n} catch (PrestoException e) {\n    if (e.getMessage().contains(\"is only allowed if there is also\")) {\n        throw new IllegalArgumentException(\"Add partition_by_hash_columns before using _2 properties\", e);\n    }\n    throw e;\n}","preventionTips":["Always define the primary hash partition before the secondary one","Build WITH clauses from a template that pairs columns/buckets with _2 variants","Lint table property sets before submitting DDL"],"tags":["kudu","ddl","table-properties","partitioning"],"backgroundTag":"invalid-table-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"}