apache/cassandra · error · InvalidRequestException

Map-entry predicates on frozen map column

Error message

Map-entry predicates on frozen map column %s are not supported

What it means

Map-entry predicates (map[key] = value style) are not supported on frozen map columns. During addToRowFilter, if any index depends on the frozen map column but supports neither map element expressions nor filtering on them, Cassandra throws this error naming the column.

Solutions

  1. Remove FROZEN from the map column so element/entry expressions are supported by the index (requires data migration)
  2. Rewrite the predicate to filter on the whole frozen map value with equality
  3. Filter map entries client-side after retrieving the rows

Example fix

// before
CREATE TABLE t (m FROZEN<MAP<text, int>>);
SELECT * FROM t WHERE m['k'] = 1;
// after
CREATE TABLE t (m MAP<text, int>);
CREATE INDEX t_m_idx ON t (ENTRIES(m));
SELECT * FROM t WHERE m['k'] = 1;
Defensive patterns

Strategy: validation

Validate before calling

if (column.isFrozen() && predicate.isMapEntry()) throw new IllegalArgumentException("entry predicates need non-frozen map");

Type guard

boolean supportsEntryPredicate(ColumnMetadata c) { return c.type instanceof MapType && !c.isFrozen(); }

Try / catch

catch (InvalidRequestException e) { if (e.getMessage().contains("frozen map")) rewriteToFrozenEqualityQuery(); }

Prevention

When it happens

Trigger: Query like 'WHERE frozen_map_col[?] = ?' (entry/element predicate) against a column declared FROZEN<map<..>>, with an index depending on that column that lacks entry-expression support.

Common situations: Declaring a map as frozen for schema convenience then attempting key/value entry lookups; confusing frozen vs non-frozen index capabilities (SAI supports element expressions on non-frozen collections only).

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/4d4a072721987dec. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/restrictions/SimpleRestriction.java:449

                        throw invalidRequest("Multicolumn IN filters are not supported");
                    }
                }
                break;
            case ELEMENT:
                // TODO only map elements supported for now
                if (columnsExpression.isMapElementExpression())
                {
                    // For frozen maps, check if any index on the column can support map entry predicates
                    // either directly or via filtering. If not, throw an error.
                    if (column.type.isFrozenCollection())
                    {
                        for (Index index : indexRegistry.listIndexes())
                        {
                            if (index.dependsOn(column)
                                && !index.supportsMapElementExpression()
                                && !index.supportsFilteringOnMapElementExpression())
                            {
                                throw invalidRequest(Relation.FROZEN_MAP_ENTRY_PREDICATES_NOT_SUPPORTED, column.name);
                            }
                        }
                    }

                    ByteBuffer key = columnsExpression.element(context);
                    if (key == null)
                        throw invalidRequest("Invalid null map key for column %s", column.name.toCQLString());
                    if (key == ByteBufferUtil.UNSET_BYTE_BUFFER)
                        throw invalidRequest("Invalid unset map key for column %s", column.name.toCQLString());
                    List<ByteBuffer> values = bindAndGet(context);
                    filter.addMapEquality(column, key, operator, values.get(0));
                }
                break;
            default: throw new UnsupportedOperationException();
        }
    }

    private static ByteBuffer multiInputOperatorValues(ColumnMetadata column, List<ByteBuffer> values)

View on GitHub (pinned to 88fd0f6a0e)