This is a user-defined function that has query stream input and output pipes. A pipeline of query processing commands can be defined in the body of the function. These are applied to the input and the result is sent to the output pipe.
The function can have (optionally) input arguments.
At the declaration, the function name must be prepended with “@@” characters. The input arguments are specified as a comma-separated list, enclosed in parenthesis. In case no arguments are needed the parenthesis can be omitted.
@@function_name( args, ... ) = statement ;
1 2 3
@@last_items(field, cnt:5) = sort($field DESC) | limit($cnt); dual(10) | @@last_items(i);
- line 1: declaration
- line 3: calling