{"record":{"id":"3d5825da0c270eff","repo":"apache/cassandra","slug":"range-deletion-is-not-supported-by-table-s","errorCode":null,"errorMessage":"Range deletion is not supported by table %s","messagePattern":"Range deletion is not supported by table (.+?)","errorType":"exception","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AbstractMutableLazyVirtualTable.java","lineNumber":65,"sourceCode":"{\n    protected AbstractMutableLazyVirtualTable(TableMetadata metadata, OnTimeout onTimeout, Sorted sorted)\n    {\n        super(metadata, onTimeout, sorted);\n    }\n\n    protected AbstractMutableLazyVirtualTable(TableMetadata metadata, OnTimeout onTimeout, Sorted sorted, Sorted sortedByPartitionKey)\n    {\n        super(metadata, onTimeout, sorted, sortedByPartitionKey);\n    }\n\n    protected void applyPartitionDeletion(Object[] partitionKeys)\n    {\n        throw invalidRequest(\"Partition deletion is not supported by table %s\", metadata());\n    }\n\n    protected void applyRangeTombstone(Object[] partitionKey, Object[] start, boolean startInclusive, Object[] end, boolean endInclusive)\n    {\n        throw invalidRequest(\"Range deletion is not supported by table %s\", metadata());\n    }\n\n    protected void applyRowDeletion(Object[] partitionKey, @Nullable Object[] clusteringKeys)\n    {\n        throw invalidRequest(\"Row deletion is not supported by table %s\", metadata());\n    }\n\n    protected void applyRowUpdate(Object[] partitionKeys, @Nullable Object[] clusteringKeys, ColumnMetadata[] columns, Object[] values)\n    {\n        throw invalidRequest(\"Column modification is not supported by table %s\", metadata());\n    }\n\n    private void applyRangeTombstone(Object[] pks, RangeTombstone rt)\n    {\n        Slice slice = rt.deletedSlice();\n        Object[] starts = composeClusterings(slice.start(), metadata());\n        Object[] ends = composeClusterings(slice.end(), metadata());\n        applyRangeTombstone(pks, starts, slice.start().isInclusive(), ends, slice.end().isInclusive());","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AbstractMutableLazyVirtualTable.java#L47-L83","documentation":"The default applyRangeTombstone implementation of AbstractMutableLazyVirtualTable throws this error because range deletions (deleting a contiguous range of clustering rows within a partition) are not supported unless the concrete virtual table overrides the method.","triggerScenarios":"Executing a range DELETE such as 'DELETE FROM <virtual_table> WHERE pk = ? AND ck > ? AND ck < ?' (or DELETE ... WHERE ck >= / <=) against a virtual table that has not overridden applyRangeTombstone(Object[], Object[], boolean, Object[], boolean).","commonSituations":"Cleanup queries that delete row ranges from virtual tables; ORMs or drivers that translate bounded DELETE statements into range tombstones.","solutions":["Delete explicit rows one-by-one (or via IN clauses) if row deletion is supported by the table.","Remove the range predicate and delete only whole rows with fully specified clustering keys.","If you implement the virtual table, override applyRangeTombstone to support range deletions."],"exampleFix":"// before\nDELETE FROM system_views.some_table WHERE pk = 1 AND ck > 10 AND ck < 20;\n// after\nDELETE FROM system_views.some_table WHERE pk = 1 AND ck = 11;\nDELETE FROM system_views.some_table WHERE pk = 1 AND ck = 12;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    session.execute(rangeDelete);\n} catch (InvalidQueryException e) {\n    if (e.getMessage().contains(\"Range deletion is not supported\")) {\n        // fall back to deleting explicit rows with IN (...)\n    }\n}","preventionTips":["Avoid range predicates in DELETE statements against virtual tables.","Delete fully-qualified rows (partition key + clustering key) instead of ranges.","Review the table implementation's overrides to learn which mutations are supported."],"tags":["virtual-tables","cql","delete","range-tombstone"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}