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 varchar-label LEARN classifier aggregation: combine() is not implemented because the aggregation is non-decomposable (partial SVM states are not mergeable). Its invocation means the engine tried to merge states, which this function forbids.

Source

Thrown at presto-ml/src/main/java/com/facebook/presto/ml/LearnLibSvmVarcharClassifierAggregation.java:51

    @InputFunction
    public static void input(
            @AggregationState LearnState state,
            @SqlType(VARCHAR) Slice label,
            @SqlType("map(bigint,double)") Block features,
            @SqlType(VARCHAR) Slice parameters)
    {
        state.getLabels().add((double) state.enumerateLabel(label.toStringUtf8()));
        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<varchar>")
    public static void output(@AggregationState LearnState state, BlockBuilder out)
    {
        Dataset dataset = new Dataset(state.getLabels(), state.getFeatureVectors(), state.getLabelEnumeration().inverse());
        Model model = new StringClassifierAdapter(new ClassifierFeatureTransformer(new SvmClassifier(LibSvmUtils.parseParameters(state.getParameters().toStringUtf8())), new FeatureUnitNormalizer()));
        model.train(dataset);
        VARCHAR_CLASSIFIER.writeSlice(out, ModelUtils.serialize(model));
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Keep the learn_classifier(varchar, ...) aggregation on a single machine
  2. Avoid plans that split the aggregation across workers
  3. Batch training data before invoking the function
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-ml/src/main/java/com/facebook/presto/ml/LearnLibSvmVarcharClassifierAggregation.java:51 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/a2023d2129580e8b. Report an issue: GitHub.