Define analytics
Create custom analytic functions for window processing that drive advanced analytic use cases
Development steps
API
public abstract class AnalyticsFunction<T> {
protected Logger logger;
protected Properties parameters;
public AnalyticsFunction() {
logger = LoggerFactory.getLogger(this.getClass().getName());
}
/**
* Set function parameters
*
* @param parameters
*/
@JsonProperty(value = "parameters")
public void setParameters(Properties parameters) {
this.parameters = parameters;
}
/**
* Referenceable function ID for use in projections and window processing
*
* @return name of function as String
*/
public abstract String getVariablePostFixID();
/**
* AnalyticDefinition function to compute
*
* @param values to use in the computation
* @param previousValue computed
* @param context state
* @return computed result
*/
public T compute(Number[] values, Number previousValue, Context context) {
return null;
}
/**
*
* @param column raw values to use in the computation
* @param previousValue computed
* @param context state
* @return
*/
public T compute(NumberColumn column, Number previousValue, Context context) {
return null;
}Development steps
Explaining each step
Step 1: Implement AnalyticsFunction interface
Step 2: Build, test and package
Step 3: Deploy
Step 4: Add to a use case DSL
Example
Last updated