Amazon Athena で SELECT 操作を実行すると、"function not registered" 構文エラーが発生するため、解決する必要があります。
解決策
Athena がサポートしていない関数を使用しようとすると、次のいずれかのメッセージに似たエラーが表示されます。
"SYNTAX_ERROR: line 1:8: Function function_name not registered"
"FUNCTION_NOT_FOUND: line 1:8: Function 'function_name' not registered"
サポートされている関数を特定する
Athena がサポートする関数のリストについては、『Athena エンジンバージョン 3 の関数』を参照してください。または、次のコマンドを実行します。
SHOW FUNCTIONS
出力例:
Function Return Type Argument Types Function Type Deterministic Description
abs bigint bigint scalar true absolute value
abs decimal(p,s) decimal(p,s) scalar true absolute value
abs double double scalar true absolute value
ユーザー定義関数を作成する
使用したい関数を Athena がサポートしていない場合は、AWS Lambda を使用して Athena でユーザー定義関数 (UDF) を作成およびデプロイします。
関連情報
GitHub ウェブサイトの Amazon Athena UDF Connector
Connect Amazon Athena to your Apache Hive Metastore and use user-defined functions (Amazon Athena を Apache Hive Metastore と接続してユーザー定義関数を使用する)