{"record":{"id":"abe4fc5530be48eb","repo":"apache/cassandra","slug":"operator-s-not-supported-for-txn-id","errorCode":null,"errorMessage":"Operator %s not supported for txn_id","messagePattern":"Operator (.+?) not supported for txn_id","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AbstractLazyVirtualTable.java","lineNumber":313,"sourceCode":"                }\n            };\n        }\n\n        @Override\n        @Nullable\n        public <I, O> FilterRange<O> filters(String columnName, Function<I, O> translate, UnaryOperator<O> exclusiveStart, UnaryOperator<O> exclusiveEnd)\n        {\n            ColumnMetadata column = columnLookup.get(columnName);\n            O min = null, max = null;\n            for (RowFilter.Expression expression : rowFilter().getExpressions())\n            {\n                if (!expression.column().equals(column))\n                    continue;\n\n                O bound = translate.apply((I)column.type.compose(expression.getIndexValue()));\n                switch (expression.operator())\n                {\n                    default: throw new InvalidRequestException(\"Operator \" + expression.operator() + \" not supported for txn_id\");\n                    case EQ:  min = max = bound; break;\n                    case LTE: max = bound; break;\n                    case LT:  max = exclusiveEnd.apply(bound); break;\n                    case GTE: min = bound; break;\n                    case GT:  min = exclusiveStart.apply(bound); break;\n                }\n            }\n\n            return new FilterRange<>(min, max);\n        }\n\n        @Override\n        public RowCollector row(Object... primaryKeys)\n        {\n            int pkSize = metadata.partitionKeyColumns().size();\n            int ckSize = metadata.clusteringColumns().size();\n            if (pkSize + ckSize != primaryKeys.length)\n                throw new IllegalArgumentException();","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AbstractLazyVirtualTable.java#L295-L331","documentation":"AbstractLazyVirtualTable's filtering logic translates CQL row-filter expressions into range bounds over a backing map of lazily-computed rows. Only EQ, LTE, LT, GTE and GT are translatable; any other operator (e.g. NEQ, IN, LIKE, CONTAINS) applied to the filtered column cannot be pushed down and throws InvalidRequestException.","triggerScenarios":"Querying a virtual table (e.g. system_views.transactions_in_progress style tables) with a WHERE clause using an unsupported operator on the filterable key column, such as `WHERE txn_id != x`, `txn_id IN (...)`, or `txn_id CONTAINS ...`.","commonSituations":"Developers probing virtual tables with generic predicates assuming full SQL semantics; ORMs or dashboards generating NEQ/IN filters automatically; cqlsh exploratory queries.","solutions":["Rewrite the query to use only EQ/LT/LTE/GT/GT operators on the column (e.g. express `!=` as two range queries or filter client-side)","Filter unsupported predicates in application code after fetching rows without that predicate","Use `system_views` equivalent real tables or full-table scans plus client filtering if precise ranges are not needed"],"exampleFix":"// before\nSELECT * FROM system_views.transactions_in_progress WHERE txn_id != 'abc';\n// after\nSELECT * FROM system_views.transactions_in_progress WHERE txn_id > 'aaa' AND txn_id < 'abc';\nSELECT * FROM system_views.transactions_in_progress WHERE txn_id > 'abc';\n// then filter result rows client-side","handlingStrategy":"validation","validationCode":"// only EQ/LT/LTE/GT/GTE are pushable\nSet<String> ok = Set.of(\"EQ\",\"LT\",\"LTE\",\"GT\",\"GTE\");\nif (!ok.contains(operator)) filterClientSide();","typeGuard":null,"tryCatchPattern":"try { execute(cql); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"not supported for txn_id\")) fallbackScanAndFilter(); else throw e; }","preventionTips":["Restrict WHERE clauses on virtual tables to equality and range operators","Handle IN/NEQ/LIKE in application code after fetching","Read the table's virtual-table docs for pushdown limits"],"tags":["cql","virtual-table","query","invalid-request"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}