{"record":{"id":"0e0d81dcdf738922","repo":"apache/cassandra","slug":"cannot-create-entries-index-on-frozen-map-clusteri","errorCode":null,"errorMessage":"Cannot create ENTRIES index on frozen map clustering column '%s'. Map entry predicates (column[key] = value) are not supported on clustering columns. Use FULL, KEYS, or VALUES index instead.","messagePattern":"Cannot create ENTRIES index on frozen map clustering column '(.+?)'\\. Map entry predicates \\(column\\[key\\] = value\\) are not supported on clustering columns\\. Use FULL, KEYS, or VALUES index instead\\.","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java","lineNumber":312,"sourceCode":"        if (!baseType.isCollection() && target.type != Type.SIMPLE)\n            throw ire(NON_COLLECTION_SIMPLE_INDEX, target.type, column);\n\n        // Frozen collections are only supported with SAI indexes.\n        if (isNonSAIIndex && baseType.isCollection() && !column.type.isMultiCell())\n        {\n            if (target.type == Type.VALUES || target.type == Type.KEYS || target.type == Type.KEYS_AND_VALUES)\n            {\n                throw ire(CREATE_ON_FROZEN_COLUMN, target.type.toString(), column.name, column.name);\n            }\n        }\n\n        if (!(baseType instanceof MapType) && (target.type == Type.KEYS || target.type == Type.KEYS_AND_VALUES ))\n            throw ire(CREATE_WITH_NON_MAP_TYPE, target.type, column);\n\n        // Can't query map[key]=value on clustering key columns, so ENTRIES index would be not queryable.\n        if (column.isClusteringColumn() && baseType instanceof MapType && !column.type.isMultiCell()\n            && target.type == Type.KEYS_AND_VALUES)\n            throw ire(ENTRIES_INDEX_ON_FROZEN_MAP_CLUSTERING_KEY_NOT_SUPPORTED, column.name);\n\n        if (column.type.isUDT() && column.type.isMultiCell())\n            throw ire(CREATE_ON_NON_FROZEN_UDT, column);\n    }\n\n    /**\n     * Checks if the given index attributes represent a Storage Attached Index.\n     */\n    private boolean isSAIIndex(IndexAttributes attrs)\n    {\n        return attrs.isCustom && IndexMetadata.isSAIIndex(attrs.customClass);\n    }\n\n    private String generateIndexName(KeyspaceMetadata keyspace, List<IndexTarget> targets)\n    {\n        String baseName = targets.size() == 1\n                        ? IndexMetadata.generateDefaultIndexName(tableName, targets.get(0).column)\n                        : IndexMetadata.generateDefaultIndexName(tableName);","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java#L294-L330","documentation":"An ENTRIES (KEYS_AND_VALUES) index on a frozen map stored in a clustering column would be unqueryable, because the map[key] = value entry predicate cannot be evaluated on clustering columns. Cassandra rejects it at creation time rather than allowing an index that no query can use.","triggerScenarios":"`CREATE INDEX ON t (entries(map_col))` where map_col is a frozen<map<...>> declared as a clustering key column, with a non-multi-cell map and target type KEYS_AND_VALUES.","commonSituations":"Modeling per-row attribute maps as clustering columns for ordering, then trying entry predicates; porting index DDL from a regular-column layout to a clustering-column layout.","solutions":["Use a FULL, KEYS, or VALUES index on the frozen map clustering column instead of ENTRIES.","Move the map out of the clustering key into a regular column if entry predicates (col[key]=value) are required.","Remodel the data so queried keys become their own columns or partition/clustering key components."],"exampleFix":"// before\nCREATE INDEX ON t (entries(attrs)); -- attrs is frozen<map<text,text>> clustering column\n// after\nCREATE INDEX ON t (full(attrs)); -- or KEYS/VALUES as appropriate","handlingStrategy":"validation","validationCode":"if (column.isClusteringColumn() && baseType instanceof MapType && !column.type.isMultiCell() && target.type === 'KEYS_AND_VALUES') throw new Error('ENTRIES index on frozen map clustering column is not queryable');","typeGuard":"const entriesTargetUsable = (col, baseType) => !(col.isClusteringColumn() && baseType instanceof MapType && !col.type.isMultiCell());","tryCatchPattern":"try { session.execute(ddl); } catch (e) { if (/Cannot create ENTRIES index on frozen map clustering column/.test(e.message)) { /* use FULL/KEYS/VALUES or move column out of clustering key */ } else throw e; }","preventionTips":["Avoid entry predicates against clustering-key maps by design","Put queryable maps in regular columns, not clustering keys"],"tags":["cassandra","cql","secondary-index","map","clustering-key"],"backgroundTag":"invalid-argument-value","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"}