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

Julian Hyde jhyde at pentaho.com
Sun Jun 21 16:43:05 EDT 2009

```Thanks - I have logged  <http://jira.pentaho.com/browse/MONDRIAN-568>
http://jira.pentaho.com/browse/MONDRIAN-568 to track this.

_____

From: Alexander Korsukov [mailto:akorsukov at gmail.com]
Sent: Saturday, June 20, 2009 11:52 PM
To: jhyde at pentaho.com; Mondrian developer mailing list
Subject: Re: [Mondrian] [Measures] dimension is equals any other
[Measures]dimension.

Hello, Julian.

See RoleImpl.getAccess(Dimension)

Dimension compared with dimensions from all cubes. I catch following
problem.

Have cube [CubeA] with measures [Measures].[MA1] and [Measures].[MA2] and
cube [CubeB]. Define roles:

<Role name="RoleA">
<SchemaGrant access="none">
<CubeGrant cube="CubeA" access="all">
<HierarchyGrant hierarchy="[Measures]" access="custom">
<MemberGrant member="[Measures].[MA1]" access="all"/>
</HierarchyGrant>
</CubeGrant>
</SchemaGrant>
</Role>

<Role name="RoleB">
<SchemaGrant access="none">
<CubeGrant cube="CubeB" access="all"/>
</SchemaGrant>
</Role>

When create mondrian connection with Role=RoleA, have access only to
[Measures].[MA1]. When create mondrian connection with Role=RoleA,RoleB,
have access to all measures from [CubeA]. Why? Because when check role RoleB
mondrian found [Measure] dimension of [CubeB] then equals to [Measure]
dimension of [CubeA] and therefore get access to all members of [Measure].

Alexander.

On Sat, Jun 20, 2009 at 00:30, Julian Hyde<jhyde at pentaho.com> wrote:
> 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
<mailto:xmpp%3Ashko at jabber.ru>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090621/ff66a85f/attachment.html
```