How do I resolve the "function not registered" syntax error in Athena?

Last updated: 2020-05-22

When I run a SELECT operation in Amazon Athena, I get an error like this: "SYNTAX_ERROR: line 1:8: Function function_name not registered".

Resolution

This error usually happens when you try to use a function that Athena doesn't support. For a list of functions that Athena supports, see Presto Functions in Amazon Athena. Or, run a SHOW FUNCTIONS statement. Here's a partial example of the output:

    Function   Return Type     Argument Types   Function Type   Deterministic   Description
1    abs        bigint          bigint           scalar          true            absolute value
2    abs        decimal(p,s)    decimal(p,s)     scalar          true            absolute value
3    abs        double          double

If Athena doesn’t support the function that you want to use, then consider writing a User Defined Function (UDF) in Athena. UDFs allow you to create custom functions to process records or groups of records. A UDF accepts parameters, performs work, and then returns a result. For examples and more information about UDFs, see Querying with User Defined Functions (Preview).