[Mondrian] [Measures] dimension is equals any other [Measures]dimension.

Julian Hyde jhyde at pentaho.com
Fri Jun 19 11:30:05 EDT 2009


It wasn't by design, but I don't see it as a glaring bug because we don't
need to compare dimensions from different cubes. I think the methods on
member, level, hierarchy do the same.

We compare dimensions for equality a lot - for example
RolapEvaluator.setContext(Member) calls it - so the implementation needs to
be very efficient. Frankly, the current implementation, of one name
comparison, is probably not efficient enough. If we could comehow canonize
dimensions, we could use identity.

What is your use case for this? We probably need a method that compares
objects in the same cube, and a less efficient method that works globally.
Depending on the use cases, equals could remain the former (and we'd correct
the doc) or would become the latter.

Julian

> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Alexander Korsukov
> Sent: Friday, June 19, 2009 12:08 AM
> To: Mondrian developer mailing list
> Subject: [Mondrian] [Measures] dimension is equals any other 
> [Measures]dimension.
> 
> Hello.
> 
> Right now, [Measures] dimension of one RolapCube is equals [Measures]
> dimension of any another RolapCube, because RolapDimension and
> DimensionBase does not override equals() method, and the base class
> (OlapElementBase) compares only a name.
> 
> My fix: add method to RolapDiemnsion (or probably to DimensionBase)
> 
>     public boolean equals(Object o) {
>         if (this == o) {
>             return true;
>         }
>         if (!(o instanceof RolapDimension) || isMeasures() ||
> ((RolapDimension)o).isMeasures()) {
>             return false;
>         }
> 
>         return equals(o);
>     }
> 
> Future more, if I have cube [A] with dimension [D] and cube [B] with
> dimension [D] and try to check equality I will see following
> 
> RolapCubeDimension dimDofA = ...;
> RolapCubeDimension dimDofB = ...;
> 
> // call boolean 
> mondrian.olap.OlapElementBase.equals(OlapElement mdxElement)
> dimDofA.equals(dimDofB) // result is true
> 
> // call boolean mondrian.rolap.RolapCubeDimension.equals(Object o)
> dimDofA.equals((Object)dimDofB) // result is false
> 
> This is bug or feature by design?
> 
> -- 
> Best regards,
> Alexander Korsukov
> _____________________________________________________
> mailto:akorsukov at gmail.com                icq:8572488
> (2E0A2052)                        xmpp:shko at jabber.ru
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> 
> 
> 





More information about the Mondrian mailing list