[Mondrian] UDF and result type

Julian Hyde julianhyde at speakeasy.net
Mon Jul 16 14:21:35 EDT 2007


I just wrote a test with a function 'F(<Integer>, <String>) returns
<String>'. FunDefBase.guessResultType would guess that this returns an
integer, but that didn't happen. The test worked fine, because I implemented


        public Type getReturnType(Type[] parameterTypes) {
            return new StringType();
        }

in my UDF.

Julian

> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Anton Nikitin
> Sent: Monday, July 16, 2007 3:33 AM
> To: 'Mondrian developer mailing list'
> Subject: [Mondrian] UDF and result type
> 
> 
> Hello.
> 
> I have a question about User Defined Functions.
> 
> AFAIK, UDF is resolved into UdfResolver.UdfFunDef instance 
> which derives from FunDefBase.
> It forces using getResultType() from FunDefBase which doesn't 
> work correctly in our case (FunDefBase.guessResultType() 
> provides incorrect result). In turn, it is impossible to 
> implement anything in UDF class to correct its behavior (in 
> contrast to FunDef-based approach, where I could simply 
> override getResultType()).
> 
> Any thoughts, workarounds?
> 
> Thanks,
> 
> Anton
> 
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> 




More information about the Mondrian mailing list