[Mondrian] Aggregate UDFs

Luc Boudreau lucboudreau at gmail.com
Mon Apr 7 15:48:13 EDT 2014


Hello Jeremiah,

When you implement a UDF in Mondrian, one of the methods you can implement
specifies the type of object returned by the instance. The Javadocs have
all the details here:

http://mondrian.pentaho.com/api/mondrian/spi/UserDefinedFunction.html#getReturnType(mondrian.olap.type.Type[])

It's worth noting that this method takes a list of parameter types. These
are the types that were used when the method was invoked in MDX, so you can
return a different type of object according to the arguments which were
used in the MDX.

Alternatively, for quick prototyping, you can implement the UDFs in
Javascript directly in your schema file. It's the fast and easy way to try
them out, but I strongly advise writing them in Java and writing unit tests
and all. We have a lot of unit tests for UDFs in the base test suite, so
you can copy/paste some code from there.

Let us know if we can help you further.

Luc


On Mon, Apr 7, 2014 at 2:32 PM, Johnson, Jeremiah <
jeremiah.johnson at truvenhealth.com> wrote:

>  I would like to write a UDF that takes in a set and  transforms it into
> a new set. I think I have figured out how to process sets in a UDF but I’m
> not sure if Mondrian can handle returning a set from a UDF because the
> execute() method returns an Object. I don’t know what classes are legal. I
> did look at existing UDFs and nothing is jumping out at me as returning a
> set. Can I return a set and what class type does it have to be?
>
>
>
>
>
> .....................................................
>
> *Jeremiah Johnson*
> *Truven Health Analytics*
>
> Phone: 734-913-3194
>
> The Healthcare Business of Thomson Reuters is now
> Truven Health Analytics.
>
>
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20140407/d6cab573/attachment.html 


More information about the Mondrian mailing list