<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = 
"urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:m = 
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6001.18226" name=GENERATOR>
<STYLE>@font-face {
        font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>Chuck,</FONT></SPAN></DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>Are you claiming that behavior changed in 9827? It seems to me that a 
block of code was moved from GlobalFunTable to Util.createUdf() essentially 
unchanged.</FONT></SPAN></DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>I do see that UdfResolver.CalcImpl's constructor gets the class of a UDF 
and passes it to Util.createUdf to create another instance of the same UDF. That 
seems a bit wasteful - or maybe the author wanted to clone the UDF so that each 
instance can use instance variables as workspace - but it's not 
wrong.</FONT></SPAN></DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>Rushan, can you comment on your change at line 159 of 
UdfResolver?</FONT></SPAN></DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>UserDefinedFunction's javadoc is explicit about the default constructor: 
"The class must have a public, zero-arguments constructor, be on&nbsp;Mondrian's 
runtime class-path, and be referenced from the schema file".</FONT></SPAN></DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>Can you explain why you think we need to support UDF constructors that 
take a 'String name' parameter?</FONT></SPAN></DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=094104607-20052009><FONT face="Lucida Sans" color=#000080 
size=2>Julian</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000080 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> mondrian-bounces@pentaho.org 
  [mailto:mondrian-bounces@pentaho.org] <B>On Behalf Of </B>Reidmiller, 
  Chuck<BR><B>Sent:</B> Monday, May 18, 2009 7:20 AM<BR><B>To:</B> 
  Mondrian@pentaho.org<BR><B>Subject:</B> [Mondrian] UDFs and Util.java 
  changelist 9827<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV class=Section1>
  <P class=MsoNormal>We have a few UDFs that were developed against Mondrian 
  2.3.2.&nbsp; I recently attempted to use the schema with these UDFs against 
  Mondrian 3.0 and ran into this error for the GetExtractDate 
UDF:<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal><I>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'<o:p></o:p></I></P>
  <P class=MsoNormal><I><o:p></o:p></I></P>
  <P class=MsoNormal>The public constructor for GetExtractDate takes a string 
  argument in order to get the function name:<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in">&nbsp;&nbsp;&nbsp; public 
  GetExtractDate(String name){<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>but the createUdf method of Util &nbsp;is set up to call a 
  default constructor that has no argument.&nbsp; The createUdf method appears 
  to have been added on 2007/08/29 with changelist 9827.&nbsp; I have gotten 
  past the problem by overloading createUDF via: <o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in">&nbsp;&nbsp;&nbsp; public static 
  UserDefinedFunction createUdf(Class&lt;?&gt; udfClass,<o:p></o:p></P>
  <P 
  class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  String name) {<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>which includes code borrowed from defineFunction of 
  RolapSchema to call the UDF with a string argument when applicable.&nbsp; In 
  addition, I changed the CalcImpl constructor in UdfResolver to invoke the 
  overloaded createUdf with the function name:<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in">this.udf = 
  Util.createUdf(udf.getClass(), udf.getName());<o:p></o:p></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in"><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>Any comments from folks who know the code better than 
  me?<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>Thanks, Chuck<o:p></o:p></P>
  <P class=MsoNormal 
style="TEXT-INDENT: 0.5in"><o:p>&nbsp;</o:p></P></DIV></BLOCKQUOTE></BODY></HTML>