These are aggregate functions as available on stream views and pipes. Aggregate functions serve the purpose of aggregating data and giving it more eaningfull meaningful meaning. They are usually a common feature in any data based environment. In database management, for instance aggregate functions are used where multiple rows are grouped together to form a singe value or to find out more significant meaning, represented by a single value on a set of values.
Aggregate functions are also available on pipes and views in PhixFlow. The following composes comprises a set of available functions (all aggregate function below expect a single argument - field name):
Function | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
averageAverage | This function returns the arithmetic average value of the set of numbers. It takes one argument (a name of a field) of numeric type: Long, Float or Integer. It is only available if field on which it is applied, is of such type.maximuman attribute with the same grouping field values. In detail, it returns the sum of all values with the same grouping field values divided by the number of values that are not null. It is only available for numeric attributes. | ||||||||||||||||||||||
Maximum | This function returns the maximum numericvalue outof the set of numeric, dates as well as string and values. It takes one argument (a name of a field) of type, either: Long, Float, Integer or a String. In case of a String, it will return a "maximum string", that is a string that would be the last string out of the whole set of strings, if they were sorted in alphabetical order. In case of a date - it will return the latest date.minimuman attribute with the same grouping field values. It is available for numeric, string and date/time attributes. Strings are ordered alphabetically, with the shortest strings first. | ||||||||||||||||||||||
Minimum | This function returns the minimum numericvalue outof the set of numeric, dates as well as string values. It takes one argument (a name of a field) of type, either: Long, Float, Integer or a String. In case of a String, it will return a "minimum string", that is a string that would be the first string out of the whole set of strings, if they were sorted in alphabetical order. In case of a date - it will return the earliest date.suman attribute with the same grouping field values. It is available for numeric, string and date/time attributes. Strings are ordered alphabetically, with the shortest strings first. | ||||||||||||||||||||||
Sum | This function returns the sum calculated by sumingof all the values in a given set ofof an attribute with the same grouping field values. It is applicable only (andonly then it is available) if the name of the field passed to this function represents numeric field of type: Long, Float or Integer.percentavailable for numeric attributes. | ||||||||||||||||||||||
Percent | This function expects a name of numeric field to calculate percentage of sum of numerical values of each group in relation to a whole set of grouped values. It is therefore necessary to use this function in conjunction with grouping attribute, as otherwise only default grouping would be applied and this would present no meaningful result, as it would always default to 100% (each record would have been in its own group). If however we assume having a file with 2 records, like so:
and we also assume grouping by "Label", our percent function would return (if applied o "Number" attribute), the following result in a view (assuming we also selected Label attribute to be shown in our view and rounding to 2 decimal places):
The above are percentages of values assigned to given grouping parameters (A, B, C) as a percentage portion of the whole, computed as sum of all such values. | ||||||||||||||||||||||
distinct | Returns Distinct | This function returns the number of unique values for the given attribute with the same grouping field values. | |||||||||||||||||||||
countCount | Counts This function returns the number of elementsnon-null values with the same grouping field values. |