<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6001.17052" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=136233001-01022008><FONT face=Verdana
color=#000080 size=2>The solution looks ok - go ahead and check
in.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=136233001-01022008></SPAN><SPAN
class=136233001-01022008><FONT face=Verdana color=#000080
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=136233001-01022008><FONT face=Verdana
color=#000080 size=2>Julian</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
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> Matt Campbell [mailto:mkambol@gmail.com]
<BR><B>Sent:</B> Thursday, January 31, 2008 9:06 AM<BR><B>To:</B>
jhyde@pentaho.org; Mondrian developer mailing list<BR><B>Subject:</B> Re:
[Mondrian] when iif has a tuple and a member as its arguments weget an
exception<BR></FONT><BR></DIV>
<DIV></DIV>Julian,<BR>Harun is working on Ajit's team. Would it be okay
if they check in the change he suggested? They wanted to get some
confirmation that their solution was correct.<BR>-matt<BR><BR>
<DIV class=gmail_quote>On Jan 31, 2008 11:38 AM, Julian Hyde <<A
href="mailto:jhyde@pentaho.org">jhyde@pentaho.org</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Thanks.
Logged as bug 1883611<BR><A
href="http://sourceforge.net/tracker/index.php?func=detail&aid=1883611&group_id=35302&atid=414613"
target=_blank>http://sourceforge.net/tracker/index.php?func=detail&aid=1883611&group_id=35<BR>302&atid=414613</A>
for tracking. Will fix in 3.0.<BR><FONT color=#888888><BR>Julian<BR></FONT>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c><BR>> -----Original Message-----<BR>> From: <A
href="mailto:mondrian-bounces@pentaho.org">mondrian-bounces@pentaho.org</A><BR>>
[mailto:<A
href="mailto:mondrian-bounces@pentaho.org">mondrian-bounces@pentaho.org</A>]
On Behalf Of Harun Pathan<BR>> Sent: Thursday, January 31, 2008 6:54
AM<BR>> To: <A
href="mailto:mondrian@pentaho.org">mondrian@pentaho.org</A><BR>> Subject:
[Mondrian] when iif has a tuple and a member as its<BR>> arguments weget
an exception<BR>><BR>> Hi,<BR>><BR>> When we run this mdx we get
an error stacktrace for which is as below.<BR>><BR>> WITH<BR>>
MEMBER [Gender].agg<BR>> AS 'IIF(1=1, ([Gender].[All
Gender],measures.[unit<BR>> sales]),([Gender].[All Gender]) )',
SOLVE_ORDER = 4<BR>> SELECT {[Measures].[unit sales]} ON 0,<BR>>
{{[Gender].[Gender].MEMBERS},{([Gender].agg)}} on 1 FROM
sales<BR>><BR>> Caused by: mondrian.olap.MondrianException: Mondrian
Error:Internal<BR>> error: could not derive type<BR>>
at<BR>>
mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:777)<BR>>
at
mondrian.olap.Util.newInternal(Util.java:1333)<BR>>
at mondrian.olap.fun.FunDefBase.createCall(FunDefBase.java:245)<BR>>
at<BR>>
mondrian.mdx.UnresolvedFunCall.accept(UnresolvedFunCall.java:101)<BR>>
at
mondrian.olap.Query$StackValidator.validate(Query.java:1229)<BR>>
at mondrian.olap.Formula.accept(Formula.java:131)<BR>>
at
mondrian.olap.Query$StackValidator.validate(Query.java:1304)<BR>>
at mondrian.olap.Query.resolve(Query.java:571)<BR>>
at mondrian.olap.Query.resolve(Query.java:433)<BR>>
at mondrian.olap.Query.<init>(Query.java:217)<BR>>
at
mondrian.olap.Query.<init>(Query.java:177)<BR>>
at mondrian.olap.Parser.makeQuery(Parser.java:850)<BR>>
at<BR>>
mondrian.olap.CUP$Parser$actions.CUP$Parser$do_action(Parser.j<BR>>
ava:1683)<BR>> at
mondrian.olap.Parser.do_action(Parser.java:684)<BR>>
at java_cup.runtime.lr_parser.parse(lr_parser.java:569)<BR>>
at
mondrian.olap.Parser.parseInternal(Parser.java:754)<BR>><BR>> What we
saw is that when the iif function is resolved it tries to get<BR>> a
common result type between its arguments.There is no common<BR>>
resulttype between a TupleType and a MemberType.<BR>> Currently in the
TupleType the result type gets resolved to a<BR>> ScalarType when the
other type is a ScalarType and to a TupleType when<BR>> the other one is
a Tuple and in all other cases null.<BR>> Currently in the MemberType the
result type gets resolved to null for<BR>> the above example when the
incoming tuple has more than one argument<BR>> in it.<BR>> is it valid
if the return type is resolved to a ScalarType when the<BR>> IIF gets a
TupleType and MemberType as its arguments.<BR>><BR>> Code changes in
TupleType :<BR>> //currently this check isnt there.<BR>> if (type
instanceof MemberType) {<BR>>
return getValueType().computeCommonType(type,<BR>>
conversionCount);<BR>> }<BR>><BR>> Code changes in
MemberType:<BR>><BR>> if (type instanceof TupleType) {<BR>>
TupleType tupleType = (TupleType) type;<BR>>
if (tupleType.elementTypes.length == 1) {<BR>>
return new TupleType(new
Type[]<BR>> {type}).computeCommonType(tupleType,
conversionCount);<BR>> } else
{<BR>>
return<BR>>
computeCommonType(tupleType.getValueType(),conversionCount);// this
is<BR>> the code change, earlier returned null<BR>>
}<BR>> }<BR>>
_______________________________________________<BR>> Mondrian mailing
list<BR>> <A
href="mailto:Mondrian@pentaho.org">Mondrian@pentaho.org</A><BR>> <A
href="http://lists.pentaho.org/mailman/listinfo/mondrian"
target=_blank>http://lists.pentaho.org/mailman/listinfo/mondrian</A><BR>><BR><BR>_______________________________________________<BR>Mondrian
mailing list<BR><A
href="mailto:Mondrian@pentaho.org">Mondrian@pentaho.org</A><BR><A
href="http://lists.pentaho.org/mailman/listinfo/mondrian"
target=_blank>http://lists.pentaho.org/mailman/listinfo/mondrian</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>