mysticfall / pivot4j

Pivot4J provides a common API for OLAP servers which can be used to build an analytical service frontend with pivot style GUI.
Other
128 stars 101 forks source link

Pivot4J Fails on Drillthrough #207

Closed underscores closed 7 years ago

underscores commented 7 years ago

When I try to drill through certain data sets Pivot4J will cause an IndexOutOfBound exception. It does work with JPivot flawlessly however. It cannot drill through any date if only the time dimension is choosen. Version: 1.0 Development Snapshot, Pentaho Plugin The problem only occurs when a certain Dimension is not selected. I use a "customer" and a Date Dimension. If I only select the Date Dimension it will not work. If I add the customer Dimension it will work again.

catalina_out.txt pentaho_log.txt

underscores commented 7 years ago

I can also add that I can still drill through certain cells. However the drillthrough will reference the wrong source rows. Actually it will always reference source rows far in the future instead of the proper source for the designated date cell.

mysticfall commented 7 years ago

Relevant stacktrace:

Caused by: java.lang.IndexOutOfBoundsException: Cell ordinal 95) lies outside CellSet bounds (4, 8)
    at mondrian.olap4j.MondrianOlap4jCellSet.ordinalToCoordinateArray(MondrianOlap4jCellSet.java:155)
    at mondrian.olap4j.MondrianOlap4jCellSet.getCell(MondrianOlap4jCellSet.java:138)
    at org.pivot4j.analytics.ui.ViewHandler$DrillThroughCommandImpl.execute(ViewHandler.java:982)
    at org.pivot4j.analytics.ui.ViewHandler$DrillThroughCommandImpl.execute(ViewHandler.java:966)
    at org.pivot4j.analytics.ui.ViewHandler.executeCommand(ViewHandler.java:640)
    at sun.reflect.GeneratedMethodAccessor1181.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:247)

Caused by: java.lang.IndexOutOfBoundsException: Cell ordinal 68) lies outside CellSet bounds (3, 7)
    at mondrian.olap4j.MondrianOlap4jCellSet.ordinalToCoordinateArray(MondrianOlap4jCellSet.java:155)
    at mondrian.olap4j.MondrianOlap4jCellSet.getCell(MondrianOlap4jCellSet.java:138)
    at org.pivot4j.analytics.ui.ViewHandler$DrillThroughCommandImpl.execute(ViewHandler.java:982)
    at org.pivot4j.analytics.ui.ViewHandler$DrillThroughCommandImpl.execute(ViewHandler.java:966)
    at org.pivot4j.analytics.ui.ViewHandler.executeCommand(ViewHandler.java:640)
    at sun.reflect.GeneratedMethodAccessor1181.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:247)

@underscores I tried to reproduce the problem with SteelWheelsSales cube, but was unable to do so.

I used only Measures and Time dimensions on each respective axes like this:

SELECT {[Measures].[Quantity]} ON COLUMNS, Hierarchize({[Time].[All Years]}) ON ROWS FROM [SteelWheelsSales]

Could you give me some instruction on how to reproduce the problem? Thanks!

underscores commented 7 years ago

I can give you more information tomorrow. What I can say right now is that the problem appeared after loading a data set that contained a Date far in the future (by 5 months actually). After doing so drill throughs would become extremely slow and end up showing source data far away from the date of the cell. Or they would fail with the stacktrace you showed up there. I am not sure if it is somehow related to the date dimension itself. I know I should not load false data like that but it was inevitable as someone tinkered with the source systems. The fact table is also rather sparse. It is based on a transaction grain fact table and sometimes I get information from a source, sometimes I don't. Maybe it is related to those dates who are in the far future? Could that ruin the drill through somehow? I can also add that I have created some degenerate dimensions in my schema that are made of simple text-fields and a timestamp field in the source table. I'm not sure but could this bug be somehow related? https://github.com/mysticfall/pivot4j/issues/156

underscores commented 7 years ago

I cannot give you more input actually. I have the following situation: Standard Date-Dimension with the Hierachy: All -> Year -> Month -> Day (Day of Month) And Dimension tables for the customer, machine, some degenerate dimensions for 2 IDs and that is it Fact Table: standard fact table with 2 degenerate dimension attributes Special Data: a few databases have a date in the future (June2017). Other Notes: Drill-Through with JPivot works without any problems. Drill-Through will work with Pivot4J once I add another dimension or filter by another hierachy (e.g. customer or machine)

underscores commented 7 years ago

I hope this might help to track it down. If you want I can also send you my schema file. Although I realize that Mondrian Schemas are not your problem you might find something that could have caused this exclusively with Pivot4J

underscores commented 7 years ago

I can now give additional input. If I do not use "non empty" it will drill through correctly as well. If I use "Non Empty" it will fail. So this might help to reproduce the bug. Again this is transaction-grain, the fact table is not full for every dimension entry. Also note that the Time Dimension of the SteelWheels example is significantly different from mine, it does not contain any empty field whatsoever which also relates to the fact that the fact table only contains small snapshots. I will give you the generated MDX Statement. Once I open the "Date" and see the 2016 and 2017 row it will look like this: SELECT NON EMPTY {[Measures].[BottleEvents]} ON COLUMNS, NON EMPTY Hierarchize(Union({[Date.Jahr].[All Years]}, [Date.Jahr].[All Years].Children)) ON ROWS FROM [Bottle_Detail] Compared to the MDX Statement generated by JPivot (why didn't I thought earlier about this): select NON EMPTY {[Measures].[BottleEvents]} ON COLUMNS, NON EMPTY Hierarchize(Union({[Date.Jahr].[All Date.Jahrs]}, [Date.Jahr].[All Date.Jahrs].Children)) ON ROWS from [Bottle_Detail]

The Hierachy is called "Jahr" (German for Year) while the levels it are called "Year", "Month", "Day" (I mixed that not purposfully but rather to keep things short) UPDATE: I also changed some stuff on the schema but the result remains the same, It now generates an MDX statement that is equal to the JPivot one but still fails on drill through if Non Empty got selected

mysticfall commented 7 years ago

Thanks for the information. I cannot begin working on this issue now, but I'll look into it on this weekend. However, please understand that there's chance that I won't be able to fix it.

It's really hard to find the root cause of such a problem without being able to reproduce it on my end. I'll try my best to reproduce the issue based on what you wrote above, and also inspect the relevant code and see if I can guess the cause, in case it doesn't work.

underscores commented 7 years ago

Thank you, I really appreciate your work. I wish I could give you better input :(

mysticfall commented 7 years ago

Your mentioning of 'Non Empty' reminds me of this issue(#170), and now I strongly suspect it to be the same problem.

As the root cause hasn't been fixed from the Mondrian's side, I just circumvented the issue by not using cell ordinal in parameters.

Could you test the latest master branch and see if it indeed resolves the issue? If it does, I'll publish it to the marketplace as soon as I fix my CI build, which is currently broken.

underscores commented 7 years ago

Thank you I will try that out. I have to figure out how to build it though. Did you also check it for the Pentaho Plugin?

mysticfall commented 7 years ago

Pentaho plugin is just a thin wrapper around the Analytics application, so if it the standalone version works, then probably it'll work on the Pentaho server also.

If you find it difficult to build the source, you can download it from here:

mysticfall commented 7 years ago

Ok, I'm closing this and will update the marketplace version today.