apache/cassandra · error · InvalidRequestException
Static columns are not supported in COMPACT STORAGE tables
Error message
Static columns are not supported in COMPACT STORAGE tables
What it means
Static columns are not supported in COMPACT STORAGE tables because the legacy Thrift storage format has no representation for per-partition static cells. The validator throws this error whenever any declared column is static in a compact table.
Source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java:438
if (staticColumns.contains(column))
builder.addStaticColumn(column, properties.type, properties.mask, columnConstraints.get(column));
else
builder.addRegularColumn(column, properties.type, properties.mask, columnConstraints.get(column));
});
}
return builder;
}
private void validateCompactTable(List<ColumnProperties> clusteringColumnProperties,
Map<ColumnIdentifier, ColumnProperties> columns)
{
boolean isDense = !clusteringColumnProperties.isEmpty();
if (columns.values().stream().anyMatch(c -> c.type.isMultiCell()))
throw ire("Non-frozen collections and UDTs are not supported with COMPACT STORAGE");
if (!staticColumns.isEmpty())
throw ire("Static columns are not supported in COMPACT STORAGE tables");
if (clusteringColumnProperties.isEmpty())
{
// It's a thrift "static CF" so there should be some columns definition
if (columns.isEmpty())
throw ire("No definition found that is not part of the PRIMARY KEY");
}
if (isDense)
{
// We can have no columns (only the PK), but we can't have more than one.
if (columns.size() > 1)
throw ire(String.format("COMPACT STORAGE with composite PRIMARY KEY allows no more than one column not part of the PRIMARY KEY (got: %s)", StringUtils.join(columns.keySet(), ", ")));
}
else
{
// we are in the "static" case, so we need at least one column defined. For non-compact however, having
// just the PK is fine.View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Remove the STATIC keyword (and possibly the column) from the compact table.
- Drop COMPACT STORAGE so static columns are allowed.
Example fix
// before CREATE TABLE t (pk int, c int, v text STATIC, PRIMARY KEY (pk, c)) WITH COMPACT STORAGE; // after CREATE TABLE t (pk int, c int, v text, PRIMARY KEY (pk, c)) WITH COMPACT STORAGE;
Defensive patterns
Strategy: validation
Validate before calling
// STATIC columns are forbidden in COMPACT STORAGE tables:
boolean compactStorage = true;
boolean hasStatic = false; // any STATIC column declared
if (compactStorage && hasStatic) throw new IllegalArgumentException("STATIC columns not allowed with COMPACT STORAGE"); Try / catch
try { session.execute(ddl); } catch (com.datastax.driver.core.exceptions.InvalidQueryException e) { if (e.getMessage().contains("Static columns are not supported in COMPACT STORAGE")) { /* drop STATIC */ } else throw e; } Prevention
- Never combine STATIC columns and COMPACT STORAGE.
- Strip STATIC markers when converting schemas to compact form.
- Review DDL diffs when adding COMPACT STORAGE to existing definitions.
When it happens
Trigger: CREATE TABLE ... WITH COMPACT STORAGE with a column declared STATIC.
Common situations: Adding STATIC columns to a legacy compact table; copying a regular table definition and appending COMPACT STORAGE.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Static columns are only useful (and thus allowed) if the tab
- Non-frozen collections and UDTs are not supported with COMPA
- No definition found that is not part of the PRIMARY KEY
- COMPACT STORAGE with composite PRIMARY KEY allows no more th
- COMPACT STORAGE with non-composite PRIMARY KEY require one c
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/6c61153c7f80f6a3.
Report an issue: GitHub.