This message was deleted.
# troubleshooting
s
This message was deleted.
r
I think one orthogonal option could be to write a custom scalar function which can take the histogram columns as input and then find the difference b/w them. That would be more performant than running a javascript function but would require you to write a small new extension. If you're using OS druid histograms or simple arrays, then you can also consider directly contributing the function to the apache druid project.
s
@Rohan Garg What is 'custom scalar function'? I have written some extensions already, but I am not sure I found something which is called this. how can I use 'it' in query? let say I have an array1 and array2 and I am looking to do some math and produce a num.
ok What I assume you are thinking of writing a custom 'Expression' here [https://druid.apache.org/docs/latest/misc/math-expr.html] But I could not find any way of writing a custom expression looking at https://druid.apache.org/docs/latest/development/modules.html
r
Yes, you are right. a custom scalar function would require you to write an expression as you mentioned, and also add a SQL facade over it incase you want to use it in a SQL query. Yes, unfortunately there isn't a good reference in the docs for writing expressions currently. You can take a look at https://github.com/apache/druid/blob/master/core/src/main/java/org/apache/druid/math/expr/Function.java#L426 which contains a small abstraction for functions which take 2 arrays as input. I'd be help incase you have any questions related to it