prestodb/presto · error · PrestoException

AMBIGUOUS_FUNCTION_CALL

AMBIGUOUS_FUNCTION_CALL

Error message

Ambiguous function call (%s) for %s

What it means

Specialization failure in ParametricAggregation.findMatchingImplementation: for the bound type arguments, more than one generic aggregation implementation matches the signature, so the engine cannot choose one deterministically.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ParametricAggregation.java:163

    }

    @Override
    public boolean isCalledOnNullInput()
    {
        return details.isCalledOnNullInput();
    }

    private AggregationImplementation findMatchingImplementation(Signature boundSignature, BoundVariables variables, FunctionAndTypeManager functionAndTypeManager)
    {
        Optional<AggregationImplementation> foundImplementation = Optional.empty();
        if (implementations.getExactImplementations().containsKey(boundSignature)) {
            foundImplementation = Optional.of(implementations.getExactImplementations().get(boundSignature));
        }
        else {
            for (AggregationImplementation candidate : implementations.getGenericImplementations()) {
                if (candidate.areTypesAssignable(boundSignature, variables, functionAndTypeManager)) {
                    if (foundImplementation.isPresent()) {
                        throw new PrestoException(AMBIGUOUS_FUNCTION_CALL, format("Ambiguous function call (%s) for %s", variables, getSignature()));
                    }
                    foundImplementation = Optional.of(candidate);
                }
            }
        }

        if (!foundImplementation.isPresent()) {
            throw new PrestoException(FUNCTION_IMPLEMENTATION_MISSING, format("Unsupported type parameters (%s) for %s", variables, getSignature()));
        }
        return foundImplementation.get();
    }

    private static AccumulatorStateSerializer<?> getAccumulatorStateSerializer(AggregationImplementation implementation, BoundVariables variables, FunctionAndTypeManager functionAndTypeManager, Class<?> stateClass, DynamicClassLoader classLoader)
    {
        AccumulatorStateSerializer<?> stateSerializer;
        Optional<MethodHandle> stateSerializerFactory = implementation.getStateSerializerFactory();
        if (stateSerializerFactory.isPresent()) {
            try {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Make the aggregation's generic implementations mutually exclusive in their type constraints
  2. Add explicit exact implementations for the problematic type binding
  3. Report as a function-implementation bug if the function is built-in
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ParametricAggregation.java:163 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/f8f7ab90366974a3. Report an issue: GitHub.