[Mondrian] RE: Null Range Functionality

Julian Hyde julianhyde at speakeasy.net
Wed Mar 21 17:08:11 EDT 2007


 

> -----Original Message-----
> From: Will Gorman [mailto:wgorman at pentaho.org] 
> Sent: Wednesday, March 21, 2007 1:22 PM
> To: Julian Hyde
> Subject: Re: Null Range Functionality
> 
> Julian,
> 
> I've implemented a compileMembers method in AbstractExpCompiler.  The
> two issues with this are that if NULL:NULL is used, we get a Null
> Pointer inside the Range function now instead of getting "Error: No
> function matches signature '<Null> : <Null>'".

The 'NULL : NULL' MDX expression is a use case which should generate a
nice error for the end-user. Add it to FunctionTest using the
assertAxisThrows(String,String) method.

To add a resourced error message, modify MondrianResource.xml, then run
'ant', and MondrianResource.java will be regenerated. (Details at
http://eigenbase.sourceforge.net/resgen/.)

You will need to add an explicit validation step that both of the
members are not null. You will need to detect this at compile time,
because you need to know what hierarchy the range function is working
on.

At runtime, it is still possible for both members to evaluate null. E.g.
"[Gender].Parent : [Gender].Parent". This should return the empty set, I
guess.

> 
> Also, other functions will get null pointers if a member passed in is
> null, because we all NullTypes through now.
> 
> I could throw an exception inside compileMember, or just let the null
> pointers get thrown (they are nulls after all).

It's not legal for a piece of mondrian code to pass another a Java null
as a member. If it is the MDX null member, it should pass a pointer to a
RolapNullMember object. So the fault is with whichever piece of code is
providing the Java null.

Julian




More information about the Mondrian mailing list