{"record":{"id":"0e81d9b30b716e2f","repo":"prestodb/presto","slug":"invalid-function-argument-0e81d9","errorCode":"INVALID_FUNCTION_ARGUMENT","errorMessage":"There must be two or more concatenation arguments to map_concat","messagePattern":"There must be two or more concatenation arguments to map_concat","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapConcatFunction.java","lineNumber":112,"sourceCode":"    }\n\n    @Override\n    public String getDescription()\n    {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public ComplexTypeFunctionDescriptor getComplexTypeFunctionDescriptor()\n    {\n        return descriptor;\n    }\n\n    @Override\n    public BuiltInScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager)\n    {\n        if (arity < 2) {\n            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, \"There must be two or more concatenation arguments to \" + FUNCTION_NAME);\n        }\n\n        Type keyType = boundVariables.getTypeVariable(\"K\");\n        Type valueType = boundVariables.getTypeVariable(\"V\");\n        MapType mapType = (MapType) functionAndTypeManager.getParameterizedType(StandardTypes.MAP, ImmutableList.of(\n                TypeSignatureParameter.of(keyType.getTypeSignature()),\n                TypeSignatureParameter.of(valueType.getTypeSignature())));\n\n        VarArgMethodHandle varArgMethodHandle = generateVarArgsToArrayAdapter(\n                Block.class,\n                Block.class,\n                arity,\n                METHOD_HANDLE.bindTo(mapType));\n\n        return new BuiltInScalarFunctionImplementation(\n                false,\n                nCopies(arity, valueTypeArgumentProperty(RETURN_NULL_ON_NULL)),\n                varArgMethodHandle.getMethodHandle());","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapConcatFunction.java#L94-L130","documentation":"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.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapConcatFunction.java:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass at least two maps to map_concat","For a single map, use it directly instead of map_concat(m)","Build multi-map concatenation as map_concat(a, b, c)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}