Is it possible to perform division in evaluate()?


#1

How do I achieve something like this in the evaluate()?

MyType.evaluate({projection: “column_c, sum(column_a) / sum(column_b) as price” , group: “column_c”, order: “descending( price)”})

the above command is currently throwing an error.


#2

@venkata.paruchuri What is the error you are seeing?


#3

@trothwein It says Projection must appear in the group spec: sum(column_a) / sum(column_b)


#4

@venkata.paruchuri I see. This is due to the attempt to use the alias “price”. That is not supported.


#5

@trothwein I removed alias. That was just used as an example to tell what I was doing.

This is what I have tried:

MyType.evaluate({projection: “column_c, sum(column_a) / sum(column_b)” , group: “column_c”, order: “sum(column_a) / sum(column_b)”})


#6

@venkata Can you file a ticket and, if possible, provide a branch with the type as you have defined it? This will require some investigation.


#7

@venkata.paruchuri This was a bug where we wern’t interpreting the arithmetic expressions involving multiple aggregates as aggregate expressions. I am testing a fix now.