aggrTopN#
- swordfish.function.aggrTopN()#
After sorting funcArgs based on sortingCol, aggrTopN applies func to the first top elements in funcArgs.
- Parameters:
func (Constant) – An aggregate function.
funcArgs (Constant) – The parameters of func. It can be a scalar or vector. It is a tuple if there are more than 1 parameter of func.
sortingCol (Constant) – A numeric/temporal vector, based on which funcArgs are sorted.
top (Constant) –
An integer or floating-point number.
If it is an integer, select the first top rows of records for calculation.
If it is a floating-point number, the value should be less than 1.0 to indicate a percentage. The function will select top of the rows in funcArgs for calculation. If the result is less than 1, select the first row. If the result is not an integer, it is rounded down and at least one row is selected.
ascending (Constant, optional) – A Boolean value, by default DFLT