Create decimal function

how do create udf with decimal parameters ?

To begin with: What is a “Decimal” for you? Let’s assume you are talking about a double value:

def function(value: Double) = ???

hello
I’m talking about decimal (38,8)
other problem when define udf with parameter Long it’s very slowly
def function(value :Double) = ??? or def function(value :Long) = ???
very slowly when call group by with agg

Have you tried with Float ? … maybe is faster.

By the way, what kind of agg do you want to do ? … this depends and differs a lot from the agg you use.

Hi
how are you?
I’m tired with float , so it’s slowly.
I 'm read csv file with collect for per personal number then connect to database read data for per personel , so group by personel number then agg count record and sum price then call udf for sum price , when sum price decimal(38,8) is call Int performance is perfect when is call Long/Double/Float is slowly.
Thank you

Maybe there’s some specialization for Ints while other primitives are boxed?

It will be extremely hard to help you unless you tell us more about what your code is actually doing and how it does it. Actually showing us the relevant code might help.

1 Like