prestodb/presto · error · PrestoException

INVALID_FUNCTION_ARGUMENT

INVALID_FUNCTION_ARGUMENT

Error message

There must be two or more concatenation arguments to map_concat

What it means

Specialization-time error for map_concat: the function was invoked with fewer than two map arguments. map_concat is only defined for concatenating two or more maps, so arity < 2 is rejected when the implementation is bound, before any row is processed.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapConcatFunction.java:112

    }

    @Override
    public String getDescription()
    {
        return DESCRIPTION;
    }

    @Override
    public ComplexTypeFunctionDescriptor getComplexTypeFunctionDescriptor()
    {
        return descriptor;
    }

    @Override
    public BuiltInScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager)
    {
        if (arity < 2) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "There must be two or more concatenation arguments to " + FUNCTION_NAME);
        }

        Type keyType = boundVariables.getTypeVariable("K");
        Type valueType = boundVariables.getTypeVariable("V");
        MapType mapType = (MapType) functionAndTypeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of(
                TypeSignatureParameter.of(keyType.getTypeSignature()),
                TypeSignatureParameter.of(valueType.getTypeSignature())));

        VarArgMethodHandle varArgMethodHandle = generateVarArgsToArrayAdapter(
                Block.class,
                Block.class,
                arity,
                METHOD_HANDLE.bindTo(mapType));

        return new BuiltInScalarFunctionImplementation(
                false,
                nCopies(arity, valueTypeArgumentProperty(RETURN_NULL_ON_NULL)),
                varArgMethodHandle.getMethodHandle());

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Pass at least two maps to map_concat
  2. For a single map, use it directly instead of map_concat(m)
  3. Build multi-map concatenation as map_concat(a, b, c)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapConcatFunction.java:112 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/0e81d9b30b716e2f. Report an issue: GitHub.