The core logic for the Presto functions is at FunctionRegistry.java which defineds window, aggregate and scalar types of functions.
We might want to add functions without changing Presto code. then we can implement & use experimental functions easily. But Presto doesn't have a room for UDF, UDAF and UDTF yet.
So here're an idea of how Presto could support UDF and UDAF in a othogonal way. We might not consider UDTF at this time to make thinghs simple but it would not be much different. Also supporting existing Hive UDF is out of scope of this topic and should be an issue of the HiveConnector.
- Presto already has well-defined plugin arhitecture. Sets of UDF and UDAF functions could be thought as a plugin having a FunctionFactory.class services
- So UD(A)F functions can be easily a part of exsting connectors or they can build a seperate functions only plugin.