java.lang.IndexOutOfBoundsException: Cell ordinal 8) lies outside CellSet bounds (2, 4)

Pentaho BI Platform Tracking | Prohaska Andreas | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Hi! I'm using an embedded Mondrian 3.6.1 together with Pivot4J 0.9 to build a very simple OLAP web application. When performing drill through operations an exception occurs if a cell is addressed with its ordinal number and a NonEmpty clause is present in the MDX statement. In my case, the exception occurs because the ordinal number references a Cell that is beyond the dimensions of the result. However, the problem also exists for ordinal numbers within the given range as a wrong cell could be returned by CellSet.getCell(int). By default, the Pivot4J API uses the Cell ordinal as parameter to identify the cell to drill through in subsequent requests. If there is no NonEmpty clause everything works fine. A dump of a result with 2 columns and 6 rows prints the following cell coordinates and their ordinals: [0, 0] 0 [1, 0] 1 [0, 1] 2 [1, 1] 3 [0, 2] 4 [1, 2] 5 [0, 3] 6 [1, 3] 7 [0, 4] 8 [1, 4] 9 [0, 5] 10 [1, 5] 11 If I include a NonEmpty clause in the same statement, the cell coordinates are correct, but the ordinal numbers are not changed. In this example the rows with number 1 and 3 are empty. [0, 0] 0 [1, 0] 1 [0, 1] 4 [1, 1] 5 [0, 2] 8 [1, 2] 9 [0, 3] 10 [1, 3] 11 However, if I call MondrianOlap4JCellSet.getCell(8) the operation results in an exception: java.lang.IndexOutOfBoundsException: Cell ordinal 8) lies outside CellSet bounds (2, 4) at mondrian.olap4j.MondrianOlap4jCellSet.ordinalToCoordinateArray(MondrianOlap4jCellSet.java:152) at mondrian.olap4j.MondrianOlap4jCellSet.getCell(MondrianOlap4jCellSet.java:138) Looking into the code some more, the first call to MondrianOlap4JCell.getOrdinal() finally results in mondrian.rolap.RolapResult.getCellOrdinal(int[]) being called. This results *includes* the empty rows. The later call to MondrianOlap4JCellSet.getCell(int) uses the private method int[] ordinalToCoordinateArray(int) to compute the coordinates. In this method result.getAxes() is used to get the axes and their sizes. However, the instance of "result" is RolapConnection$NonEmptyResult(ResultBase) and this result no longer contains the empty rows. Thus, the ordinal 8 is out of range. I think that MondrianOlap4JCell.getOrdinal() should not compute the ordinal number on the result that includes the empty rows.

    Pentaho BI Platform Tracking | 3 years ago | Prohaska Andreas
    java.lang.IndexOutOfBoundsException: Cell ordinal 8) lies outside CellSet bounds (2, 4)
  2. 0

    Hi! I'm using an embedded Mondrian 3.6.1 together with Pivot4J 0.9 to build a very simple OLAP web application. When performing drill through operations an exception occurs if a cell is addressed with its ordinal number and a NonEmpty clause is present in the MDX statement. In my case, the exception occurs because the ordinal number references a Cell that is beyond the dimensions of the result. However, the problem also exists for ordinal numbers within the given range as a wrong cell could be returned by CellSet.getCell(int). By default, the Pivot4J API uses the Cell ordinal as parameter to identify the cell to drill through in subsequent requests. If there is no NonEmpty clause everything works fine. A dump of a result with 2 columns and 6 rows prints the following cell coordinates and their ordinals: [0, 0] 0 [1, 0] 1 [0, 1] 2 [1, 1] 3 [0, 2] 4 [1, 2] 5 [0, 3] 6 [1, 3] 7 [0, 4] 8 [1, 4] 9 [0, 5] 10 [1, 5] 11 If I include a NonEmpty clause in the same statement, the cell coordinates are correct, but the ordinal numbers are not changed. In this example the rows with number 1 and 3 are empty. [0, 0] 0 [1, 0] 1 [0, 1] 4 [1, 1] 5 [0, 2] 8 [1, 2] 9 [0, 3] 10 [1, 3] 11 However, if I call MondrianOlap4JCellSet.getCell(8) the operation results in an exception: java.lang.IndexOutOfBoundsException: Cell ordinal 8) lies outside CellSet bounds (2, 4) at mondrian.olap4j.MondrianOlap4jCellSet.ordinalToCoordinateArray(MondrianOlap4jCellSet.java:152) at mondrian.olap4j.MondrianOlap4jCellSet.getCell(MondrianOlap4jCellSet.java:138) Looking into the code some more, the first call to MondrianOlap4JCell.getOrdinal() finally results in mondrian.rolap.RolapResult.getCellOrdinal(int[]) being called. This results *includes* the empty rows. The later call to MondrianOlap4JCellSet.getCell(int) uses the private method int[] ordinalToCoordinateArray(int) to compute the coordinates. In this method result.getAxes() is used to get the axes and their sizes. However, the instance of "result" is RolapConnection$NonEmptyResult(ResultBase) and this result no longer contains the empty rows. Thus, the ordinal 8 is out of range. I think that MondrianOlap4JCell.getOrdinal() should not compute the ordinal number on the result that includes the empty rows.

    Pentaho BI Platform Tracking | 3 years ago | Prohaska Andreas
    java.lang.IndexOutOfBoundsException: Cell ordinal 8) lies outside CellSet bounds (2, 4)

    Root Cause Analysis

    1. java.lang.IndexOutOfBoundsException

      Cell ordinal 8) lies outside CellSet bounds (2, 4)

      at mondrian.olap4j.MondrianOlap4jCellSet.ordinalToCoordinateArray()
    2. mondrian.olap4j
      MondrianOlap4jCellSet.getCell
      1. mondrian.olap4j.MondrianOlap4jCellSet.ordinalToCoordinateArray(MondrianOlap4jCellSet.java:152)
      2. mondrian.olap4j.MondrianOlap4jCellSet.getCell(MondrianOlap4jCellSet.java:138)
      2 frames