Spark doesn't implement a statistical mode function, therefore, one needs to cope with count and group by clauses to work around this.
In the case where one needs to calculate the statistical mode of a column over a given window, how can it be done without resorting to UDFs? Which would be the performance costs incurred?