Handling Different Numbers and Types of Arguments

Usually, your UDxs accept a set number of arguments that are a specific data type (called its signature). You can create UDxs that handle multiple signatures, or even accept all arguments supplied to them by the user, using either of these techniques:

  • Overloading your UDx by assigning the same SQL function name to multiple factory classes, each of which defines a unique function signature. When a user uses the function name in a query, Vertica tries to match the signature of the function call to the signatures declared by the factory's getPrototype method. This is the best technique to use if your UDx needs to accept a few different signatures (for example, accepting two required and one optional argument).
  • Creating a polymorphic UDx by using the special "Any" argument type that tellsVertica to send all arguments that the user supplies to your function. Your UDx decides whether it can handle the arguments or not.

In This Section