{"record":{"id":"26cc4cea9377c1b3","repo":"prestodb/presto","slug":"query-rejected","errorCode":"QUERY_REJECTED","errorMessage":"Table ${schemaTableName} has no range partition","messagePattern":"Table (.+?) has no range partition","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-kudu/src/main/java/com/facebook/presto/kudu/KuduClientSession.java","lineNumber":358,"sourceCode":"    }\n\n    public void dropRangePartition(SchemaTableName schemaTableName, RangePartition rangePartition)\n    {\n        reTryKerberos(kerberosAuthEnabled);\n        changeRangePartition(schemaTableName, rangePartition, RangePartitionChange.DROP);\n    }\n\n    private void changeRangePartition(SchemaTableName schemaTableName, RangePartition rangePartition,\n            RangePartitionChange change)\n    {\n        try {\n            String rawName = schemaEmulation.toRawName(schemaTableName);\n            KuduTable table = client.openTable(rawName);\n            Schema schema = table.getSchema();\n            PartitionDesign design = KuduTableProperties.getPartitionDesign(table);\n            RangePartitionDefinition definition = design.getRange();\n            if (definition == null) {\n                throw new PrestoException(QUERY_REJECTED, \"Table \" + schemaTableName + \" has no range partition\");\n            }\n            PartialRow lowerBound = KuduTableProperties.toRangeBoundToPartialRow(schema, definition, rangePartition.getLower());\n            PartialRow upperBound = KuduTableProperties.toRangeBoundToPartialRow(schema, definition, rangePartition.getUpper());\n            AlterTableOptions alterOptions = new AlterTableOptions();\n            switch (change) {\n                case ADD:\n                    alterOptions.addRangePartition(lowerBound, upperBound);\n                    break;\n                case DROP:\n                    alterOptions.dropRangePartition(lowerBound, upperBound);\n                    break;\n            }\n            client.alterTable(rawName, alterOptions);\n        }\n        catch (KuduException e) {\n            throw new PrestoException(GENERIC_INTERNAL_ERROR, e);\n        }\n    }","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kudu/src/main/java/com/facebook/presto/kudu/KuduClientSession.java#L340-L376","documentation":"KuduClientSession.changeRangePartition attempts to ALTER a table's range partitions (add or drop). It throws QUERY_REJECTED when the table's partition design contains no range partition definition, because adding/removing a range is meaningless for a hash-only table.","triggerScenarios":"Running ALTER TABLE ... ADD RANGE / DROP RANGE PARTITION on a Kudu table created with only hash partitions (or no explicit range partitioning).","commonSituations":"Admins managing range-partitioned tables by date forget the target table was created with partition_by_hash_columns only; scripts applying range maintenance to many tables hit the hash-only ones.","solutions":["Verify the table has range partitioning (partition_by_range_columns) before altering ranges","Recreate the table with a range partition definition if ranges are required","Skip hash-only tables in partition-maintenance scripts"],"exampleFix":"-- before\nALTER TABLE kudu.events ADD RANGE PARTITION VALUE = '2026-01-01';\n-- after (recreate table with)\nWITH (partition_by_hash_columns = ARRAY['id'], partition_by_range_columns = ARRAY['day'])","handlingStrategy":"validation","validationCode":"SHOW CREATE TABLE kudu.my_table; -- confirm partition_by_range_columns is present before ALTER ... RANGE PARTITION","typeGuard":null,"tryCatchPattern":"try {\n    clientSession.addRangePartition(name, rangePartition);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == KuduErrorCode.QUERY_REJECTED && e.getMessage().contains(\"has no range partition\")) {\n        throw new IllegalStateException(\"Table is hash-only; recreate with range partitioning\", e);\n    }\n    throw e;\n}","preventionTips":["Check SHOW CREATE TABLE for range partitioning before range DDL","Maintain a registry of which tables are range-partitioned","Document that range maintenance only applies to range-partitioned tables"],"tags":["kudu","ddl","partitioning"],"backgroundTag":"missing-range-partition","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"}