このコンテンツは選択した言語では利用できません。
10.5. Scalar Functions
The method
ExecutionFactory.getSupportedFunctions()
can be used to specify which scalar and aggregate functions the Translator supports. The set of possible functions is based on the set of functions supported by JBoss Data Virtualization. This set can be found in the JBoss Data Virtualization Reference Guide. If the Translator states that it supports a function, it must support all type combinations and overloaded forms of that function.
There are also some standard operators that can be specified in the supported function list: +, -, *, and /.
The constants interface SourceSystemFunctions contains the string names of all possible built-in pushdown functions. Note that not all system functions appear in this list. This is because some system functions will always be evaluated in JBoss Data Virtualization, are simple aliases to other functions, or are rewritten to a more standard expression.
A translator may also indicate support for scalar functions that are intended for pushdown evaluation by that translator, but are not registered as user defined functions via a model/schema. These pushdown functions are reported to the engine via the
ExecutionFactory.getPushDownFunctions()
list as FunctionMethod
metadata objects. The FuncitonMethod
representation allow the translator to control all of the metadata related to the function, including type signature, determinism, varargs, etc. The simplest way to add a pushdown function is with a call to ExecutionFactory.addPushDownFunction
:
FunctionMethod addPushDownFunction(String qualifier, String name, String returnType, String...paramTypes)
FunctionMethod addPushDownFunction(String qualifier, String name, String returnType, String...paramTypes)
This resulting function will be known as sys.qualifier.name, but can be called with name only as long as the function name is unique. The returned
FunctionMethod
object may be further manipulated depending upon the needs of the source. An example of adding a custom concat vararg function in an ExecutionFactory
subclass: