[Mondrian] Order by OrderKey

Matt Campbell mcampbell at pentaho.com
Wed Oct 9 14:39:20 EDT 2013


If we allow a non-unique orderkey, then I think the assertion in compareHierarchically is incorrect.

        if (equals(m1, m2)) {
                    final int c = compareSiblingMembers(prev1, prev2);
                    // compareHierarchically needs to impose a total order;
                    // cannot return 0 for non-equal members
                    assert c != 0
                        : "Members " + prev1 + ", " + prev2
                        + " are not equal, but compare returned 0.";
                    return c;
                }

On 10/09/2013 02:26 PM, Julian Hyde wrote:

On Oct 8, 2013, at 7:33 AM, Matt Campbell <mcampbell at pentaho.com><mailto:mcampbell at pentaho.com> wrote:



Regarding non-deterministic ordering of members:  if I'm reading you correctly hierarchical sort order should still be deterministic, correct?  There are some tests which currently fail the assertion in compareHierarchically because two different members result in a compare of 0.  For example testBug1438285() defines ordinalColumn=region_id for [Store Id], which is non-unique under the same parent for some members.



We don't recommend it, but we allow people to define an order key that is not unique among siblings of the same parent. (We might even allow two siblings to have the same name.)

Aside from that, hierarchical sort order should be deterministic.

Julian




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20131009/37ce8c7c/attachment.html 


More information about the Mondrian mailing list