prestodb/presto · error · PrestoException

INVALID_FUNCTION_ARGUMENT

INVALID_FUNCTION_ARGUMENT

Error message

There must be two or more concatenation arguments

What it means

The variadic concat implementation is generated for a fixed arity at specialization time; it requires at least two arguments. Calling the concat signature with fewer than two arguments is rejected with INVALID_FUNCTION_ARGUMENT during function specialization.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ConcatFunction.java:111

    }

    @Override
    public boolean isDeterministic()
    {
        return true;
    }

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

    @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");
        }

        Class<?> clazz = generateConcat(getSignature().getReturnType(), arity);
        MethodHandle methodHandle = methodHandle(clazz, "concat", nCopies(arity, Slice.class).toArray(new Class<?>[arity]));

        return new BuiltInScalarFunctionImplementation(
                false,
                nCopies(arity, valueTypeArgumentProperty(RETURN_NULL_ON_NULL)),
                methodHandle);
    }

    @UsedByGeneratedCode
    public static Slice concat(Slice... slices)
    {
        int i;
        for (i = 0; i < slices.length; i++) {
            if (slices[i].length() > 0) {
                break;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure at least two arguments: CONCAT(a, '') if a single value is all you have
  2. Use CAST(x AS VARCHAR) alone instead of CONCAT for stringifying a single value
  3. Fix the SQL generator to skip CONCAT when only one argument survives

Example fix

// before
SELECT CONCAT(name) FROM t;
// after
SELECT CAST(name AS VARCHAR) FROM t;
Defensive patterns

Strategy: validation

Validate before calling

if (args.length < 2) throw new IllegalArgumentException("need >=2 concat args");

Prevention

When it happens

Trigger: Invoking CONCAT with a single argument (or zero) via a dynamically-bound call path that bypasses the normal overload resolution, e.g. CONCAT(x) where a dialect allows one-arg concat.

Common situations: Queries generated by ORMs/tools that emit CONCAT(single_expr); migrating from engines that accept one-argument CONCAT; dynamic SQL built with conditional argument lists that collapsed to one item.

Related errors


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