apache/cassandra · error · IllegalStateException

Variable column counts are not implemented for CQL

Error message

Variable column counts are not implemented for CQL

What it means

CqlOperation's constructor rejects stress configurations that request a variable number of columns per row, because the CQL statement templates (prepared queries) are built for a fixed column count. Since this cannot be honored for CQL-based operations, it throws IllegalStateException early rather than failing mid-run.

Solutions

  1. Use a fixed column count for CQL ops, e.g. -col n=FIXED(10) or just -col n=10
  2. Switch to user-defined (profile-based) stress where variable sizing can be modeled differently
  3. Drop the variable column count option from the -col spec

Example fix

// before
stress write -col n=FIXED(5,20)
// after
stress write -col n=FIXED(5)
Defensive patterns

Strategy: validation

Validate before calling

if (settings.columns.variableColumnCount)
    throw new IllegalStateException("Use a fixed column count for CQL stress ops");

Try / catch

try { new CqlOperation(type, timer, generator, seedManager, settings); } catch (IllegalStateException e) { log.error("Reconfigure -col with n=FIXED(k)"); }

Prevention

When it happens

Trigger: Running any CQL-based cassandra-stress operation (cql, or predefined CQL ops) with -col 'n=FIXED(10,50)' i.e. variableColumnCount enabled in the column settings.

Common situations: Reusing a stress profile or command line tuned for Thrate/legacy ops with variable column counts against CQL ops; attempting to simulate varied row sizes with CQL stress.

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/2b1e6dd2f6c26772. Report an issue: GitHub.

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java:57

import org.apache.cassandra.transport.SimpleClient;
import org.apache.cassandra.transport.messages.ResultMessage;
import org.apache.cassandra.utils.ByteBufferUtil;

public abstract class CqlOperation<V> extends PredefinedOperation
{

    public static final ByteBuffer[][] EMPTY_BYTE_BUFFERS = new ByteBuffer[0][];
    public static final byte[][] EMPTY_BYTE_ARRAYS = new byte[0][];

    protected abstract List<Object> getQueryParameters(byte[] key);
    protected abstract String buildQuery();
    protected abstract CqlRunOp<V> buildRunOp(QueryExecutor<?> queryExecutor, List<Object> params, ByteBuffer key);

    public CqlOperation(Command type, Timer timer, PartitionGenerator generator, SeedManager seedManager, StressSettings settings)
    {
        super(type, timer, generator, seedManager, settings);
        if (settings.columns.variableColumnCount)
            throw new IllegalStateException("Variable column counts are not implemented for CQL");
    }

    protected CqlRunOp<V> run(final QueryExecutor<?> queryExecutor, final List<Object> queryParams, final ByteBuffer key) throws IOException
    {
        final CqlRunOp<V> op = buildRunOp(queryExecutor, queryParams, key);
        timeWithRetry(op);
        return op;
    }

    protected void run(final QueryExecutor<?> queryExecutor) throws IOException
    {
        final byte[] key = getKey().array();
        final List<Object> queryParams = getQueryParameters(key);
        run(queryExecutor, queryParams, ByteBuffer.wrap(key));
    }

    // Classes to process Cql results

View on GitHub (pinned to 88fd0f6a0e)