apache/cassandra · error · InvalidRequestException
Range queries are not supported. Please provide both a keysp
Error message
Range queries are not supported. Please provide both a keyspace and a table name.
What it means
The system_views.partitions virtual table requires a fully specified keyspace and table partition; arbitrary range scans are not implemented. The DataRange-based select() overload unconditionally throws InvalidRequestException with UNSUPPORTED_RANGE_QUERY_ERROR.
Source
Thrown at src/java/org/apache/cassandra/db/virtual/PartitionKeyStatsTable.java:352
}
return Bounds.bounds(startToken.minKeyBound(), true, endToken.maxKeyBound(), true);
}
private static Cell<?> cell(ColumnMetadata column, ByteBuffer value)
{
return BufferCell.live(column, 1L, value);
}
@Override
public TableMetadata metadata()
{
return this.metadata;
}
@Override
public UnfilteredPartitionIterator select(DataRange dataRange, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits)
{
throw new InvalidRequestException(UNSUPPORTED_RANGE_QUERY_ERROR);
}
@Override
public void truncate()
{
throw new InvalidRequestException(TABLE_READ_ONLY_ERROR);
}
@Override
public void apply(PartitionUpdate update)
{
throw new InvalidRequestException(TABLE_READ_ONLY_ERROR);
}
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Always include equality predicates: `WHERE keyspace_name = 'ks' AND table_name = 't'`.
- To enumerate tables, query system_schema.tables first, then query partitions per table.
- Restrict further with token(...) bounds or key = for specific partitions.
Example fix
// before SELECT * FROM system_views.partitions; // after SELECT * FROM system_views.partitions WHERE keyspace_name = 'ks' AND table_name = 'tbl';
Defensive patterns
Strategy: validation
Validate before calling
// Require both equality predicates before querying the partitions virtual table
if (keyspaceName == null || tableName == null)
throw new IllegalArgumentException("keyspace_name and table_name are required for system_views.partitions"); Try / catch
try { rs = session.execute(query); }
catch (com.datastax.oss.driver.api.core.servererrors.InvalidQueryException e) {
if (e.getMessage().contains("Range queries are not supported")) { /* add keyspace/table predicates and retry */ }
else throw e;
} Prevention
- Always filter system_views.partitions by keyspace_name AND table_name equality.
- Enumerate tables via system_schema.tables first, then query per table.
- Never issue unbounded SELECTs against virtual tables.
When it happens
Trigger: Querying system_views.partitions without both keyspace_name and table_name equality restrictions, e.g. `SELECT * FROM system_views.partitions;` or filtering only by token.
Common situations: Exploratory queries without WHERE clauses; dashboards listing all partitions; drivers issuing unrestricted scans over virtual tables.
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
- Reversed queries are not supported.
- The 'key' column can only be used in an equality query for t
- Operator %s not supported for txn_id
- Modification is not supported by table " + metadata
- Truncation is not supported by table " + metadata
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/f19f5cf0adb5d246.
Report an issue: GitHub.