Presto Analytics : RAQL Queries : Create and Add User-Defined Functions for RAQL Queries
Create and Add User-Defined Functions for RAQL Queries
 
Set Up Your Development Environment
Write Plain Functions for RAQL
Configure, Compile, Deploy and Test User-Defined Functions
Write Window Analytic Functions for RAQL
Write Aggregate Analytic Functions for RAQL
Use a Factory for Function Overloading
Statistics and Analytics Third-Party Libraries
You can define your own functions to use in RAQL queries in addition to the Built-In RAQL Functions. User-defined functions are Java classes that you write, configure and deploy to Presto.
User-defined function can be:
*Plain functions: used in Select, Over, Where, Order By and Group By clauses in RAQL queries. They typically either cast (change) the datatype of column values, extract part of the values or transform values in some way.
Plain functions are applied individually to each value in the column specified without access to values in other rows.
*Window analytic functions: use some of the rows in a partition or window to perform a calculation and return a value for each row. Typically, this uses rows that are relative to the current row, such as first_value or row_number.
You must include an Over clause in queries that use window analytic functions. This defines the partitions or windows used by the function.
*Aggregate analytic functions: use all rows in the dataset, group, partition or window to perform a calculation and return a single value. For example, sum adds the values of all rows in the current scope.
Aggregate analytic functions can be be used in the Select or Having clauses of RAQL queries:
*To return a single value for each group defined in a Group By clause.
*To return a single value for each partition or each window defined in an Over clause. This single value is added to each row in the partition or window. You can also use aggregate analytic functions to return running calculations for partitions or windows defined in an Over clause.
*To return a single value for the entire dataset if no group definition or partition definition is specified.
To write user-defined functions for RAQL, you should Set Up Your Development Environment. Then:
*Write Plain Functions for RAQL
*Write Window Analytic Functions for RAQL
*Write Aggregate Analytic Functions for RAQL
*Use a Factory for Function Overloading, if needed
*Configure, Compile, Deploy and Test User-Defined Functions
Copyright © 2013-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback