In TD13.10 there's an example "windowed aggregate UDF" in C and it's a DENSE_RANK, which is what you're looking for.
You might also read http://developer.teradata.com/node/8048 for different solutions.
Of course it's a huge overhead to run OLAP functions on billions of rows, you should add a quite selective WHERE condition to filter low values.
Dieter
↧