Skip to content

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

1 minute read
0

When I run a SELECT operation in Amazon Athena, I get a "function not registered" syntax error.

Resolution

If you try to use a function that Athena doesn't support, then you receive an error that's similar to one of the following messages:

  • "SYNTAX_ERROR: line 1:8: Function function_name not registered"
  • "FUNCTION_NOT_FOUND: line 1:8: Function 'function_name' not registered"

For a list of functions that Athena supports, see Functions in Amazon Athena. Or, run the SHOW FUNCTIONS statement.

Example output snippet:

    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 write a user defined function (UDF) in Athena. 

Related information

Amazon Athena UDF Connector on the GitHub website

Connect Amazon Athena to your Apache Hive Metastore and use user-defined functions

AWS OFFICIALUpdated a year ago
3 Comments

Function "regexp_count" listed as [part ](https://trino.io/docs/current/functions/regexp.html#:~:text=regexp_count(string,%23) of Athena but Athena still returns error: SYNTAX_ERROR: Function regexp_count not registered. Is this documentation issue?

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied 2 years ago

Getting the same error, bitwise_xor_agg is not registered, but listed at https://trino.io/docs/current/functions/aggregate.html#bitwise_xor_agg

Interestingly, bitwise_or_agg and bitwise_and_agg are registered, but not bitwise_xor_agg...which is either a coincidence or an amazing joke.

If it's the latter, then well played.

replied 20 days ago