https://github.com/archongum/trino-udf
mvn clean assembly:assembly
- Copy
presto-udf-*-jar-with-dependencies.jar
to${PRESTO_HOME}/plugin/custom-functions/
in all presto nodes. (create directory if not exists) - Restart presto cluster
- JDK-11
- PrestoSQL-334
Function | Return Type | Argument Types | Description | Usage |
---|---|---|---|---|
first_day | date | date | first day of month | first_day(current_date) |
last_day | date | date | last day of month | last_day(current_date) |
to_datetime | timestamp | date, varchar | combine the two args | to_datetime(current_date, '23:59:59') |
last_second | timestamp | date | last second of the date | last_second(current_date) |
yesterday_last_second | timestamp | last second of yesterday | yesterday_last_second() | |
yesterday | date | yesterday | yesterday() | |
array_max_count_element | T | array(T) | Get maximum count element (null is not counting; if has multiple return one of them) | array_max_count_element(array['1']) |
Function | Return Type | Argument Types | Description | Usage |
---|---|---|---|---|
max_count_element | VARCHAR | VARCHAR | Get maximum count element (null is not counting; if has multiple return one of them) | max_count_element(name) |
array_agg_distinct | INTEGER | array(VARCHAR) | Count distinct array elements. input: array(VARCHAR), output: integer. | array_agg_distinct(ids) |