PDA

View Full Version : [Mondrian] MDX Conversion from Numeric to boolean



Anton Nikitin
04-23-2007, 01:50 PM
Hello.



I have found one little incompatibility between Mondrian and MSOLAP MDX.



Mondrian doesn't automatically convert integer values to Boolean if
necessary.



Example (Foodmart Sales) - let's display all Baked Goods which are
non-leaves:



select

{[Measures].[Unit Sales]} on columns,

Filter(Descendants([Product].[Food].[Baked Goods].[Bread]),

Count ([Product].currentMember.children)) on Rows

from [Sales]



This query works OK in MSAS 2000, but fails in Mondrian 2.3.2:



mondrian.olap.MondrianException: Mondrian Error:No function matches
signature 'Filter(<Set>, <Numeric Expression>)'



At the same time, if we modify it a bit, it starts to work in Mondrian:



select

{[Measures].[Unit Sales]} on columns,

Filter(Descendants([Product].[Food].[Baked Goods].[Bread]),

Count ([Product].currentMember.children)<>0) on Rows

from [Sales]



AFAIK the solution is rather cheap (changing FunUtil.canConvert() &
FunUtil.convert()).



I assume it is a bug.



Best regards,



Anton Nikitin








_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian

Julian Hyde
04-23-2007, 06:12 PM
MDX probably behaves this way because it is modeled after Visual Basic,
which has no boolean type, and therefore simulates booleans using
integers. Sigh. I would much rather MDX had the semantics of SQL or
Java, where you need to explicitly convert, using '!= 0'.

But I don't write the MDX specification, so this is a bug. Please log
it.

Julian


_____

From: mondrian-bounces (AT) pentaho (DOT) org [mailto:mondrian-bounces (AT) pentaho (DOT) org]
On Behalf Of Anton Nikitin
Sent: Monday, April 23, 2007 10:48 AM
To: mondrian (AT) pentaho (DOT) org
Subject: [Mondrian] MDX Conversion from Numeric to boolean





Hello.



I have found one little incompatibility between Mondrian and MSOLAP MDX.



Mondrian doesn't automatically convert integer values to Boolean if
necessary.



Example (Foodmart Sales) - let's display all Baked Goods which are
non-leaves:



select

{[Measures].[Unit Sales]} on columns,

Filter(Descendants([Product].[Food].[Baked Goods].[Bread]),

Count ([Product].currentMember.children)) on Rows

from [Sales]



This query works OK in MSAS 2000, but fails in Mondrian 2.3.2:



mondrian.olap.MondrianException: Mondrian Error:No function matches
signature 'Filter(<Set>, <Numeric Expression>)'



At the same time, if we modify it a bit, it starts to work in Mondrian:



select

{[Measures].[Unit Sales]} on columns,

Filter(Descendants([Product].[Food].[Baked Goods].[Bread]),

Count ([Product].currentMember.children)<>0) on Rows

from [Sales]



AFAIK the solution is rather cheap (changing FunUtil.canConvert() &
FunUtil.convert()).



I assume it is a bug.



Best regards,



Anton Nikitin








_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian