prestodb/presto · error · UnsupportedOperationException

LEARN must run on a single machine

Error message

LEARN must run on a single machine

What it means

Unsupported-operation guard in LearnStateSerializer.serialize: LEARN aggregations are non-decomposable and single-machine, so their intermediate state is never serialized across workers. This method existing only to throw makes any attempt to serialize/distribute the training state an error.

Source

Thrown at presto-ml/src/main/java/com/facebook/presto/ml/LearnStateSerializer.java:34

import com.facebook.presto.common.block.Block;
import com.facebook.presto.common.block.BlockBuilder;
import com.facebook.presto.common.type.BigintType;
import com.facebook.presto.common.type.Type;
import com.facebook.presto.spi.function.AccumulatorStateSerializer;

public class LearnStateSerializer
        implements AccumulatorStateSerializer<LearnState>
{
    @Override
    public Type getSerializedType()
    {
        return BigintType.BIGINT;
    }

    @Override
    public void serialize(LearnState state, BlockBuilder out)
    {
        throw new UnsupportedOperationException("LEARN must run on a single machine");
    }

    @Override
    public void deserialize(Block block, int index, LearnState state)
    {
        throw new UnsupportedOperationException("LEARN must run on a single machine");
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Keep the LEARN aggregation single-machine so state serialization never occurs
  2. Do not enable distributed/partial aggregation for ML LEARN functions
  3. Retrain on a single node instead of moving state between workers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-ml/src/main/java/com/facebook/presto/ml/LearnStateSerializer.java:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/e3a290c5bd7c4fce. Report an issue: GitHub.