[Mondrian] when iif has a tuple and a member as its arguments weget an exception

Julian Hyde jhyde at pentaho.org
Thu Jan 31 11:38:43 EST 2008


Thanks. Logged as bug 1883611
http://sourceforge.net/tracker/index.php?func=detail&aid=1883611&group_id=35
302&atid=414613 for tracking. Will fix in 3.0.

Julian

> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Harun Pathan
> Sent: Thursday, January 31, 2008 6:54 AM
> To: mondrian at pentaho.org
> Subject: [Mondrian] when iif has a tuple and a member as its 
> arguments weget an exception
> 
> Hi,
> 
> When we run this mdx we get an error stacktrace for which is as below.
> 
> WITH
> MEMBER [Gender].agg
> AS 'IIF(1=1, ([Gender].[All Gender],measures.[unit
> sales]),([Gender].[All Gender]) )', SOLVE_ORDER = 4
> SELECT {[Measures].[unit sales]} ON 0,
> {{[Gender].[Gender].MEMBERS},{([Gender].agg)}} on 1 FROM sales
> 
> Caused by: mondrian.olap.MondrianException: Mondrian Error:Internal
> error: could not derive type
> 	at 
> mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:777)
> 	at mondrian.olap.Util.newInternal(Util.java:1333)
> 	at mondrian.olap.fun.FunDefBase.createCall(FunDefBase.java:245)
> 	at 
> mondrian.mdx.UnresolvedFunCall.accept(UnresolvedFunCall.java:101)
> 	at mondrian.olap.Query$StackValidator.validate(Query.java:1229)
> 	at mondrian.olap.Formula.accept(Formula.java:131)
> 	at mondrian.olap.Query$StackValidator.validate(Query.java:1304)
> 	at mondrian.olap.Query.resolve(Query.java:571)
> 	at mondrian.olap.Query.resolve(Query.java:433)
> 	at mondrian.olap.Query.<init>(Query.java:217)
> 	at mondrian.olap.Query.<init>(Query.java:177)
> 	at mondrian.olap.Parser.makeQuery(Parser.java:850)
> 	at 
> mondrian.olap.CUP$Parser$actions.CUP$Parser$do_action(Parser.j
> ava:1683)
> 	at mondrian.olap.Parser.do_action(Parser.java:684)
> 	at java_cup.runtime.lr_parser.parse(lr_parser.java:569)
> 	at mondrian.olap.Parser.parseInternal(Parser.java:754)
> 	
> What we saw is that when the iif function is resolved it tries to get
> a common result type between its arguments.There is no common
> resulttype between a TupleType and a MemberType.
> Currently in the TupleType the result type gets resolved to a
> ScalarType when the other type is a ScalarType and to a TupleType when
> the other one is a Tuple and in all other cases null.
> Currently in the MemberType the result type gets resolved to null for
> the above example when the incoming tuple has more than one argument
> in it.
> is it valid if the return type is resolved to a ScalarType when the
> IIF gets a TupleType and MemberType as its arguments.
> 
> Code changes in TupleType :
> //currently this check isnt there.
> if (type instanceof MemberType) {
>             return getValueType().computeCommonType(type, 
> conversionCount);
> }
> 
> Code changes in MemberType:
> 
> if (type instanceof TupleType) {
>       TupleType tupleType = (TupleType) type;
>        if (tupleType.elementTypes.length == 1) {
>                return new TupleType(new Type[]
> {type}).computeCommonType(tupleType, conversionCount);
>             } else {
>                 return
> computeCommonType(tupleType.getValueType(),conversionCount);// this is
> the code change, earlier returned null
>             }
>  }
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> 




More information about the Mondrian mailing list