Skip to content

Commit

Permalink
MONDRIAN: Back out change 14006 (fix for bug MONDRIAN-847). We delibe…
Browse files Browse the repository at this point in the history
…rately

    minimize the number of data members in RolapCubeMember, in order to reduce
    the cost of creation and reduce memory use. Change 14006 reverses that
    policy. I will need more proof that this change is a global win; or a way
    to override, such as a member factory.

[git-p4: depot-paths = "//open/mondrian-release/3.2/": change = 14015]
  • Loading branch information
julianhyde committed Dec 22, 2010
1 parent 509d810 commit 34a2559
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 48 deletions.
10 changes: 1 addition & 9 deletions src/main/mondrian/olap/Formula.java
Expand Up @@ -34,9 +34,6 @@ public class Formula extends QueryPart {
private Exp exp;
// properties/solve order of member
private final MemberProperty[] memberProperties;
//cache this to prevent potentially expensive lookup
private Number solveOrder;
private boolean solveOrderCached = false;

/**
* <code>true</code> is this is a member,
Expand Down Expand Up @@ -348,12 +345,7 @@ public Member getMdxMember() {
* or is not a number or is not constant
*/
public Number getSolveOrder() {
if (!this.solveOrderCached) {
this.solveOrder =
getIntegerMemberProperty(Property.SOLVE_ORDER.name);
this.solveOrderCached = true;
}
return this.solveOrder;
return getIntegerMemberProperty(Property.SOLVE_ORDER.name);
}

/**
Expand Down
43 changes: 4 additions & 39 deletions src/main/mondrian/rolap/RolapCubeMember.java
Expand Up @@ -34,15 +34,6 @@ public class RolapCubeMember
{
protected final RolapCubeLevel cubeLevel;
protected final RolapCubeMember parentCubeMember;
//cache these at construction time to minimize overhead
//of extra function call in tight loops
private final boolean isCalculated;
private final boolean isEvaluated;
private final boolean isAll;
private final Object key;
private final int hashCode;
private final RolapCubeHierarchy hierarchy;
private final RolapCubeDimension dimension;

/**
* Creates a RolapCubeMember.
Expand All @@ -55,15 +46,8 @@ public RolapCubeMember(
RolapCubeMember parent, RolapMember member, RolapCubeLevel cubeLevel)
{
super(member);
this.isCalculated = member.isCalculated();
this.isEvaluated = member.isEvaluated();
this.isAll = member.isAll();
this.hashCode = member.hashCode();
this.key = member.getKey();
this.parentCubeMember = parent;
this.cubeLevel = cubeLevel;
this.hierarchy = cubeLevel.getHierarchy();
this.dimension = cubeLevel.getDimension();
assert !member.isAll() || getClass() != RolapCubeMember.class;
}

Expand All @@ -81,26 +65,6 @@ public String getUniqueName() {
member.getUniqueName());
}

@Override
public boolean isCalculated() {
return this.isCalculated;
}

@Override
public boolean isEvaluated() {
return this.isEvaluated;
}

@Override
public boolean isAll() {
return this.isAll;
}

@Override
public Object getKey() {
return this.key;
}

/**
* Returns the underlying member. This is a member of a shared dimension and
* does not belong to a cube.
Expand Down Expand Up @@ -142,7 +106,7 @@ public String toString() {
}

public int hashCode() {
return hashCode;
return member.hashCode();
}

public boolean equals(Object o) {
Expand Down Expand Up @@ -174,12 +138,12 @@ private boolean equals(RolapCubeMember that) {

// override with stricter return type; final important for performance
public final RolapCubeHierarchy getHierarchy() {
return hierarchy;
return cubeLevel.getHierarchy();
}

// override with stricter return type; final important for performance
public final RolapCubeDimension getDimension() {
return dimension;
return cubeLevel.getDimension();
}

/**
Expand Down Expand Up @@ -275,6 +239,7 @@ public OlapElement lookupChild(
return
schemaReader.lookupMemberChildByName(this, childName, matchType);
}

}

// End RolapCubeMember.java

0 comments on commit 34a2559

Please sign in to comment.