Posted On: Apr 16, 2021
User Defined Functions (UDF), which enable users to apply custom operations to their data, are now generally available for Amazon Athena. While Athena provides a wide range of built-in functions, users can extend these capabilities with their own functions and use them directly within their queries. This allows users to address specific use cases, such as redacting or encrypting sensitive data, without the need for complex data processing steps elsewhere in their data pipeline.
Customers can write UDF in Java using the Athena Query Federation SDK. When a UDF is used in an Athena query, it is executed with AWS Lambda. UDF can be used in the SELECT and FILTER clauses of a SQL query, and multiple UDFs can be used in the same query. Amazon Athena users can leverage UDF from the Athena console, API, and JDBC and ODBC drivers.
With UDF for Amazon Athena, users can also leverage functionality powered by AWS services and proprietary applications or APIs. For example, an analyst working with product review data may need to translate product reviews from one language to another. Without UDF, this could involve exporting the data to a translation service and re-importing the data later. To learn how Amazon Athena UDF simplifies this and other use cases, see Translate and analyze text using SQL functions with Amazon Athena, Amazon Translate, and Amazon Comprehend. You can also watch a video tutorial on the AWS YouTube channel.
To get started with UDF in Amazon Athena, see the following resources:
- Athena documentation Querying with User Defined Functions
- To learn how to write your own functions using the Athena Query Federation SDK, see Creating and Deploying a UDF Using Lambda
- For example UDF implementations, see Amazon Athena UDF Connector on GitHub