{"record":{"id":"700ad098cf952f7e","repo":"apache/cassandra","slug":"multicolumn-in-filters-are-not-supported","errorCode":null,"errorMessage":"Multicolumn IN filters are not supported","messagePattern":"Multicolumn IN filters are not supported","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/restrictions/SimpleRestriction.java","lineNumber":431,"sourceCode":"                        ColumnMetadata columnDef = columns().get(i);\n                        filter.add(columnDef, Operator.EQ, elements.get(i));\n                    }\n                }\n                else if (isIN())\n                {\n                    // If the relation is of the type (c) IN ((x),(y),(z)) then it is equivalent to\n                    // c IN (x, y, z) and we can perform filtering\n                    if (columns().size() == 1)\n                    {\n                        List<ByteBuffer> values = bindAndGetElements(context).stream()\n                                                                             .map(elements -> elements.get(0))\n                                                                             .collect(Collectors.toList());\n\n                        filter.add(firstColumn(), Operator.IN, multiInputOperatorValues(firstColumn(), values));\n                    }\n                    else\n                    {\n                        throw invalidRequest(\"Multicolumn IN filters are not supported\");\n                    }\n                }\n                break;\n            case ELEMENT:\n                // TODO only map elements supported for now\n                if (columnsExpression.isMapElementExpression())\n                {\n                    // For frozen maps, check if any index on the column can support map entry predicates\n                    // either directly or via filtering. If not, throw an error.\n                    if (column.type.isFrozenCollection())\n                    {\n                        for (Index index : indexRegistry.listIndexes())\n                        {\n                            if (index.dependsOn(column)\n                                && !index.supportsMapElementExpression()\n                                && !index.supportsFilteringOnMapElementExpression())\n                            {\n                                throw invalidRequest(Relation.FROZEN_MAP_ENTRY_PREDICATES_NOT_SUPPORTED, column.name);","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/restrictions/SimpleRestriction.java#L413-L449","documentation":"Row filtering does not support IN predicates over multiple columns. When an IN restriction is processed in addToRowFilter and it spans more than one column, Cassandra throws because multi-column IN cannot be expressed as a row filter.","triggerScenarios":"A query requiring filtering (ALLOW FILTERING or no index) where the predicate is a multicolumn IN, e.g. 'WHERE (a, b) IN ((1,2),(3,4))' with no usable index.","commonSituations":"Tuple IN queries on non-key columns without an index; generated queries that assume multicolumn IN is always executable.","solutions":["Rewrite as separate single-column equality restrictions, or multiple queries per tuple","Create an index that lets the multicolumn predicate be resolved without row filtering","Expand the tuple IN into multiple queries, one per tuple, in application code"],"exampleFix":"// before\nSELECT * FROM t WHERE (a, b) IN ((1,2),(3,4));\n// after\nSELECT * FROM t WHERE a = 1 AND b = 2;\nSELECT * FROM t WHERE a = 3 AND b = 4;","handlingStrategy":"fallback","validationCode":"if (inPredicate.columns().size() > 1) useExpandedQueriesOrAllowFiltering();","typeGuard":null,"tryCatchPattern":"catch (InvalidRequestException e) { if (e.getMessage().contains(\"Multicolumn IN\")) expandIntoSingleColumnQueries(); }","preventionTips":["Prefer indexed single-column predicates over tuple IN","Keep tuple IN only on clustering-key prefixes where it is natively supported","Fallback expansion in the data-access layer for multicolumn IN"],"tags":["cql","in-operator","multicolumn-restriction","row-filter"],"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"}