<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6001.18099" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2>Yes, it's a bug. Please log it.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2>Doesn't look like we support max over string values, either
as an aggregate for rolling up fact data or as a function.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2>A workaround MAY be to use a closure table. In this case,
Mondrian may be able to generate MAX in SQL rather than using the Max function
in-memory.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2>You should also upgrade to 3.0.4 - a lot of bugs have been
fixed since 2.4.2.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=521203817-28082008><FONT face=Verdana
color=#000080 size=2>Julian</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
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> mondrian-bounces@pentaho.org
[mailto:mondrian-bounces@pentaho.org] <B>On Behalf Of </B>Eduardo
Andrade<BR><B>Sent:</B> Thursday, August 28, 2008 10:25 AM<BR><B>To:</B>
Mondrian Mailing List<BR><B>Subject:</B> [Mondrian] Using a fact based on a
varchar column with ahierarchical dimension.<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>Hello,<BR>I'm sorry to bother you guys with this, but it seemed
to me appropriate to write this one to the mailing list, just to be sure it's
not a mondrian bug.<BR><BR>I have this mondrian xml definition with a fact
table (as a sql query) and a hierarchical dimension.<BR>Using the cube with a
Integer/Double fact column, is fine, but if I use a VarChar column, i get an
exception, but only when I expand the hierarchical dimension root level. I am
able to combine the fact (the VarChar one) with the dimension, and see one
line with the hierarchy all name and the max value from the Varchar db
column.<BR><BR>Is this a bug or do i have something wrong with my xml
definition ?<BR><BR>If necessary i could try and build an example on top o
foodmart example.<BR>I'm using mondrian ver. 2.4.0.9716.<BR><BR>Here is the
mondrian xml definition :<BR><BR><?xml version="1.0"
encoding="ISO-8859-1"?><BR><BR><Schema
name="5_1219928473000"><BR> <Cube name="5" caption="Cubo Teste"
cache="true" enabled="true"><BR> <View
alias="PRODUTO"><BR>
<SQL><![CDATA[<BR>SELECT<BR> THIS_.CHVP AS
PCHVP,<BR> THIS_.DESIGPRODUTO AS PDESIGPRODUTO<BR>
A8676_.CHVEESTRUTURACLD AS CHVEESTRUTURACLD<BR> FROM PRODUTO
THIS_<BR> INNER JOIN ESTRUTURA A8676_ ON A8676_.CHVP =
THIS_.CHVP<BR>]]></SQL><BR>
</View><BR> <Dimension name="Produtos"
foreignKey="PCHVP"><BR> <Hierarchy
name="Total Produtos" allMemberName="Total Produtos" hasAll="true"
primaryKey="CHVP"
primaryKeyTable="PRODUTO"><BR>
<Table name="PRODUTO"
alias="PRODUTO22"/><BR> <Level
name="Referência" table="PRODUTO22" column="REFPRODUTO"
uniqueMembers="true"><BR>
<Property column="CHVP"
name="ChvP"/><BR>
<Property column="DESIGPRODUTO"
name="Designação"/><BR>
</Level><BR>
</Hierarchy><BR>
</Dimension><BR> <Dimension name="Classificação"
foreignKey="CHVEESTRUTURACLD"><BR>
<Hierarchy name="Total Classificação" allMemberName="Total Classificação"
hasAll="true" primaryKey="CHVP"
primaryKeyTable="ESTRUTURA"><BR>
<Table name="ESTRUTURA"
alias="ESTRUTURA18"><BR>
<SQL><![CDATA["ESTRUTURA18".CHVECATEGORIA IN (select this_.ChvP as
y0_ from Categoria this_ where (((this_.ChvEExercicio=[$EXER] or
this_.ChvEExercicio is null) and (this_.ChvEUnidadeUtilizadora is null or
this_.ChvEUnidadeUtilizadora=[$UU])) and (lower(this_.SiglaCategoria) like
'cld' and this_.SiglaCategoria is not null)))
]]></SQL><BR>
</Table><BR> <Level
name="CCA" table="ESTRUTURA18" column="CHVP" parentColumn="CHVEESTRUTURA"
ordinalColumn="CODCOMPIESTRUTURA" nameColumn="CODCOMPESTRUTURA"
nullParentValue="NULL"
uniqueMembers="true"><BR>
<Property column="DESIGESTRUTURA"
name="Designação"/><BR>
</Level><BR>
</Hierarchy><BR>
</Dimension><BR> <Measure column="PCHVP"
name="ChvP" aggregator="sum" formatString="###,##0"/><BR>
<Measure column="PDESIGPRODUTO" name="DesigProduto" datatype="String"
aggregator="max" formatString="###,##0"/><BR>
</Cube><BR></Schema><BR><BR><BR>When i issue this query
:<BR>select {[Measures].[DesigProduto]} ON
COLUMNS,<BR>Hierarchize(Union({[Classificação.Total Classificação].[Total
Classificação]}, [Classificação.Total Classificação].[Total
Classificação].Children)) ON ROWS<BR>from [5]<BR><BR>I obtain this exception
:<BR>"<BR>Cause:<BR>class
com.tonbeller.jpivot.olap.model.OlapException:mondrian.olap.MondrianException:
Mondrian Error:Internal error: Error while executing query [select
{[Measures].[DesigProduto]} ON COLUMNS,
Hierarchize(Union({[Classificação.Total Classificação].[Total Classificação]},
[Classificação.Total Classificação].[Total Classificação].Children)) ON ROWS
from [5]
]<BR><BR>com.tonbeller.jpivot.mondrian.MondrianModel.getResult(MondrianModel.java:305)<BR>com.tonbeller.jpivot.mondrian.MondrianModel.getCurrentMdx(MondrianModel.java:856)<BR>pt.gedi.bi.services.rep.ad.Explorador_ServiceImpl.handleMondrianResult(Explorador_ServiceImpl.java:598)<BR>pt.gedi.bi.services.rep.ad.Explorador_ServiceImpl.getMondrianResult(Explorador_ServiceImpl.java:314)<BR>pt.gedi.bi.control.actions.rep.ad.ExploradorCuboExtendedAction.getArealistHeaderConfig(ExploradorCuboExtendedAction.java:1456)<BR>sun.reflect.GeneratedMethodAccessor624.invoke(Unknown
Source)<BR>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<BR>java.lang.reflect.Method.invoke(Method.java:597)<BR>pt.gedi.base.control.actions.BaseAction.processAskServer(BaseAction.java:2175)<BR>pt.gedi.base.control.actions.BaseAction.execute(BaseAction.java:1641)<BR>...<BR>Cause:<BR>class
mondrian.olap.MondrianException:Mondrian Error:Internal error: Error while
executing query [select {[Measures].[DesigProduto]} ON COLUMNS,
Hierarchize(Union({[Classificação.Total Classificação].[Total Classificação]},
[Classificação.Total Classificação].[Total Classificação].Children)) ON ROWS
from [5]
]<BR><BR>mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:755)<BR>mondrian.olap.Util.newInternal(Util.java:1104)<BR>mondrian.olap.Util.newError(Util.java:1120)<BR>mondrian.rolap.RolapConnection.execute(RolapConnection.java:442)<BR>com.tonbeller.jpivot.mondrian.MondrianModel.getResult(MondrianModel.java:279)<BR>com.tonbeller.jpivot.mondrian.MondrianModel.getCurrentMdx(MondrianModel.java:856)<BR>pt.gedi.bi.services.rep.ad.Explorador_ServiceImpl.handleMondrianResult(Explorador_ServiceImpl.java:598)<BR>pt.gedi.bi.services.rep.ad.Explorador_ServiceImpl.getMondrianResult(Explorador_ServiceImpl.java:314)<BR>pt.gedi.bi.control.actions.rep.ad.ExploradorCuboExtendedAction.getArealistHeaderConfig(ExploradorCuboExtendedAction.java:1456)<BR>sun.reflect.GeneratedMethodAccessor624.invoke(Unknown
Source)<BR>...<BR>Cause:<BR>class
java.lang.ClassCastException:java.lang.String cannot be cast to
java.lang.Double<BR><BR>mondrian.olap.fun.FunUtil.max(FunUtil.java:945)<BR>mondrian.rolap.RolapAggregator$4.aggregate(RolapAggregator.java:58)<BR>mondrian.olap.fun.BuiltinFunTable$22$1.aggregateChildren(BuiltinFunTable.java:655)<BR>mondrian.olap.fun.BuiltinFunTable$22$1$1.evaluate(BuiltinFunTable.java:630)<BR>mondrian.rolap.RolapEvaluator.evaluateCurrent(RolapEvaluator.java:494)<BR>mondrian.calc.impl.ValueCalc.evaluate(ValueCalc.java:31)<BR>mondrian.olap.fun.FunUtil.evaluateSet(FunUtil.java:1223)<BR>mondrian.olap.fun.FunUtil.max(FunUtil.java:937)<BR>mondrian.rolap.RolapAggregator$4.aggregate(RolapAggregator.java:58)<BR>mondrian.olap.fun.BuiltinFunTable$22$1.aggregateChildren(BuiltinFunTable.java:655)<BR>...<BR>"<BR
clear=all><BR>Thank you in advance.<BR><BR>Best wishes,<BR><BR>-- <BR>Eduardo
Andrade<BR><A
href="mailto:eduardofandrade@gmail.com">eduardofandrade@gmail.com</A><BR></DIV></BLOCKQUOTE></BODY></HTML>