[Mondrian] UDFs and Util.java changelist 9827

Reidmiller, Chuck creidmiller at cincom.com
Mon May 18 10:20:08 EDT 2009

We have a few UDFs that were developed against Mondrian 2.3.2.  I
recently attempted to use the schema with these UDFs against Mondrian
3.0 and ran into this error for the GetExtractDate UDF:


Caused by: mondrian.olap.MondrianException: Mondrian Error:Failed to
load user-defined function '': class 'mondrian.udf.GetExtractDate' does
not implement the required interface 'mondrian.spi.UserDefinedFunction'

The public constructor for GetExtractDate takes a string argument in
order to get the function name:


    public GetExtractDate(String name){


but the createUdf method of Util  is set up to call a default
constructor that has no argument.  The createUdf method appears to have
been added on 2007/08/29 with changelist 9827.  I have gotten past the
problem by overloading createUDF via: 


    public static UserDefinedFunction createUdf(Class<?> udfClass,

                                        String name) {


which includes code borrowed from defineFunction of RolapSchema to call
the UDF with a string argument when applicable.  In addition, I changed
the CalcImpl constructor in UdfResolver to invoke the overloaded
createUdf with the function name:


this.udf = Util.createUdf(udf.getClass(), udf.getName());


Any comments from folks who know the code better than me?


Thanks, Chuck


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090518/676fe7f2/attachment.html 

More information about the Mondrian mailing list