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 the ML LEARN classifier aggregation: these aggregations are declared non-decomposable, so the engine must never call combine() to merge partial states across machines. Seeing this error means distributed aggregation was attempted — an engine/usage invariant violation for learn_classifier.

Source

Thrown at presto-ml/src/main/java/com/facebook/presto/ml/LearnLibSvmClassifierAggregation.java:65

    @InputFunction
    public static void input(
            @AggregationState LearnState state,
            @SqlType(DOUBLE) double label,
            @SqlType("map(bigint,double)") Block features,
            @SqlType(VARCHAR) Slice parameters)
    {
        state.getLabels().add(label);
        FeatureVector featureVector = ModelUtils.toFeatures(features);
        state.addMemoryUsage(featureVector.getEstimatedSize());
        state.getFeatureVectors().add(featureVector);
        state.setParameters(parameters);
    }

    @CombineFunction
    public static void combine(@AggregationState LearnState state, @AggregationState LearnState otherState)
    {
        throw new UnsupportedOperationException("LEARN must run on a single machine");
    }

    @OutputFunction("Classifier<bigint>")
    public static void output(@AggregationState LearnState state, BlockBuilder out)
    {
        Dataset dataset = new Dataset(state.getLabels(), state.getFeatureVectors(), state.getLabelEnumeration().inverse());
        Model model = new ClassifierFeatureTransformer(new SvmClassifier(LibSvmUtils.parseParameters(state.getParameters().toStringUtf8())), new FeatureUnitNormalizer());
        model.train(dataset);
        ClassifierType.BIGINT_CLASSIFIER.writeSlice(out, ModelUtils.serialize(model));
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Run the LEARN aggregation on a single machine / single-partition input
  2. Ensure the aggregation is not planned with distributed partial aggregation
  3. Pre-aggregate training data so a single worker processes it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-ml/src/main/java/com/facebook/presto/ml/LearnLibSvmClassifierAggregation.java:65 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/6273b76ffd20bbde. Report an issue: GitHub.