Scenario Test

2 views
Skip to first unread message

bugg_tb

unread,
Dec 11, 2009, 5:35:31 AM12/11/09
to pentahoanalysistool-dev
Hi Julian/Will etc,

Just continuing from yesterday, I'm testing this scenario setup with
Olap4J 0.9.8 and mondrian trunk rev 4.0.0.13109.

I have patched the foodmart schema to match the additional bits you
use in the test and then I've tried to mimic a query in your scenario
test but I can't get it to work.

It goes like this:

connection.setScenario(connection.getScenario());

CellSet cellData= OlapUtil.getCellSet(queryId);

final Cell cell = cellData.getCell(Arrays.asList(0, 1));

cell.setValue(123.00, AllocationPolicy.EQUAL_ALLOCATION);

The generated query that it is working on is:

select {[Measures].[Unit Sales]} ON COLUMNS,
{[Product].[All Products].Children} ON ROWS
from [Sales]

And no matter what changes I make it ends up throwing a stack
complaining that:
Caused by: java.lang.ClassCastException: mondrian.rolap.RolapMember
cannot be cast to mondrian.rolap.RolapCalculatedMember


Halfway through writing this message I thought I'd try extracting a
scenario test and just running it in PAT,


PreparedOlapStatement pstmt = null;
try {
pstmt = connection.prepareOlapStatement(
"select {[Measures].[Unit Sales]} on 0,\n"
+ "{[Product].Children} on 1\n"
+ "from [Sales]");
} catch (OlapException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
CellSet cellData = null;
try {
cellData = pstmt.executeQuery();
} catch (OlapException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final Cell cell = cellData.getCell(Arrays.asList(0, 1));
final Scenario scenario = connection.createScenario();
connection.setScenario(scenario);
cell.setValue(123, AllocationPolicy.EQUAL_ALLOCATION);


Which looks about right to me, but the setValue still throws the same
exception.

Where have I messed up please brain boxes.

Tom

t...@wamonline.org.uk

unread,
Dec 11, 2009, 5:57:42 AM12/11/09
to pentahoanal...@googlegroups.com
Just to finish this problem off I have attached my modified foodmart schema.

Tom

FoodMart.xml

t...@wamonline.org.uk

unread,
Dec 11, 2009, 6:34:29 AM12/11/09
to pentahoanal...@googlegroups.com
Testing another example from the test suite, where Scenario's is set on the slicer, this test passed, so what I dont seem to be grasping is why connect.setScenario isn't having any effect.

Tom



On Fri 11/12/09 10:57 AM , t...@wamonline.org.uk sent:
Just to finish this problem off I have attached my modified foodmart schema.

Tom

--

You received this message because you are subscribed to the Google Groups "pentahoanalysistool-dev" group.
To post to this group, send email to pentahoanal...@googlegroups.com.
To unsubscribe from this group, send email to pentahoanalysisto...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pentahoanalysistool-dev?hl=en.

t...@wamonline.org.uk

unread,
Dec 11, 2009, 7:16:31 AM12/11/09
to pentahoanal...@googlegroups.com
right yeah, after all that, if I programatically move my scenario dim into the slicer and select the scenario, then the adjustment is run.

Judging by the test suite that looks like a bug/me not initializing it correctly, hows it supposed to work?

Cheers

Tom



On Fri 11/12/09 11:34 AM , t...@wamonline.org.uk sent:

Julian Hyde

unread,
Dec 12, 2009, 11:32:37 AM12/12/09
to pentahoanal...@googlegroups.com
Tom,
 
You seem to be doing everything right. Can you send the full stack trace for that ClassCastException? I think you might be running into a calculated member where I've assumed there would only be a regular member, or something.
 
Julian


From: pentahoanal...@googlegroups.com [mailto:pentahoanal...@googlegroups.com] On Behalf Of t...@wamonline.org.uk
Sent: Friday, December 11, 2009 2:58 AM
To: pentahoanal...@googlegroups.com
Subject: Re: [pentahoanalysistool-dev:313] Scenario Test

Just to finish this problem off I have attached my modified foodmart schema.

Tom

Julian Hyde

unread,
Dec 12, 2009, 11:36:52 AM12/12/09
to pentahoanal...@googlegroups.com
Looking at the code, Cell.setValue only seems to look at Connection.getScenario(), whereas it should look for the scenario in the current context (e.g. from the slicer) first. So that would be a bug. Would it explain what you're seeing?
 
MondrianOlap4jCell.java:
 
    public void setValue(
        Object newValue,
        AllocationPolicy allocationPolicy,
        Object... allocationArgs)
    {
        Scenario scenario =
            olap4jCellSet.olap4jStatement.olap4jConnection.getScenario();
        cell.setValue(scenario, newValue, allocationPolicy, allocationArgs);
    }
Obviously the ClassCastException is a different bug. I still need the stack trace for that one.
 
Julian

 

Sent: Friday, December 11, 2009 3:34 AM
To: pentahoanal...@googlegroups.com
Subject: Re: [pentahoanalysistool-dev:314] Scenario Test

t...@wamonline.org.uk

unread,
Dec 12, 2009, 7:07:57 PM12/12/09
to pentahoanal...@googlegroups.com
Hmm that seems to be the opposite to what I'm seeing if I understand correctly, because if I physically move the scenario dimension into the slicer and set scenario 0 as the selection then the scenario executes, if you do
Scenario scenario = conn.createScenario(),
conn.setScenario(scenario)

then cell.setValue() doesn't work.

The CastClassException stack I will find for you but its quite simple to reproduce, for example [Dimension].children passes, [Dimension].[All Dimensions].children fails with it.

Tom



On Sat 12/12/09 4:36 PM , "Julian Hyde" julia...@gmail.com sent:

Julian Hyde

unread,
Dec 15, 2009, 4:08:19 PM12/15/09
to pentahoanal...@googlegroups.com
Tom,
 
You're right, there was a bug. The connection's scenario was being ignored by the evaluation context, whereas it effectively should have been treated as the default member of the [Scenario] dimension.
 
I've fixed the bug on the main line in change 13237.
 
I still need you to send that ClassCastException stack. I'm not sure it's the same issue, and I can't reproduce it.
 
Julian


Sent: Saturday, December 12, 2009 4:08 PM
To: pentahoanal...@googlegroups.com
Subject: RE: [pentahoanalysistool-dev:319] Scenario Test

bugg_tb

unread,
Dec 22, 2009, 4:29:33 AM12/22/09
to pentahoanalysistool-dev
Hi Julian

Right better late than never I grabbed the latest CI build, which I
assume has the mondrian scenario bug from last week patched in it:

I can pretty much choose any query for example:

SELECT


{[Measures].[Unit Sales]} ON COLUMNS,
{[Product].[All Products].Children} ON ROWS

FROM [Sales]

or

SELECT


{[Measures].[Unit Sales]} ON COLUMNS,

{[Product].[All Products].[Drink], [Product].[All Products].[Food]} ON
ROWS
FROM [Sales]

Then after processing it with:

final OlapConnection connection = sessionService.getNativeConnection
(userId, sessionId, connectionId);


final Scenario scenario = connection.createScenario();
connection.setScenario(scenario);

CellSet cellData= OlapUtil.getCellSet(queryId);
final Cell cell = cellData.getCell(Arrays.asList(0, 0));
cell.setValue(123.00, AllocationPolicy.EQUAL_ALLOCATION);


No matter what I end up with this exception:

[INFO] com.google.gwt.user.server.rpc.UnexpectedException: Service
method 'public abstract void org.pentaho.pat.rpc.IQuery.alterCell
(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
throws org.pentaho.pat.rpc.exceptions.RpcException' threw an
unexpected exception: java.lang.ClassCastException:


mondrian.rolap.RolapMember cannot be cast to
mondrian.rolap.RolapCalculatedMember

[INFO] at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
(RPC.java:360)
[INFO] at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
(RPC.java:546)
[INFO] at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:166)
[INFO] at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
(RemoteServiceServlet.java:86)
[INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:
637)
[INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
[INFO] at org.mortbay.jetty.servlet.ServletHolder.handle
(ServletHolder.java:487)
[INFO] at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1097)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
[INFO] at
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke
(FilterSecurityInterceptor.java:109)
[INFO] at
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter
(FilterSecurityInterceptor.java:83)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp
(SessionFixationProtectionFilter.java:67)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp
(ExceptionTranslationFilter.java:101)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp
(AnonymousProcessingFilter.java:105)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp
(RememberMeProcessingFilter.java:116)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp
(SecurityContextHolderAwareRequestFilter.java:91)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp
(BasicProcessingFilter.java:174)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp
(AbstractProcessingFilter.java:277)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp
(LogoutFilter.java:89)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp
(HttpSessionContextIntegrationFilter.java:235)
[INFO] at
org.springframework.security.ui.SpringSecurityFilter.doFilter
(SpringSecurityFilter.java:53)
[INFO] at org.springframework.security.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
[INFO] at org.springframework.security.util.FilterChainProxy.doFilter
(FilterChainProxy.java:175)
[INFO] at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate
(DelegatingFilterProxy.java:236)
[INFO] at
org.springframework.web.filter.DelegatingFilterProxy.doFilter
(DelegatingFilterProxy.java:167)
[INFO] at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1088)
[INFO] at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
[INFO] at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
[INFO] at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
[INFO] at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:729)
[INFO] at org.mortbay.jetty.webapp.WebAppContext.handle
(WebAppContext.java:405)
[INFO] at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:152)
[INFO] at org.mortbay.jetty.handler.RequestLogHandler.handle
(RequestLogHandler.java:49)
[INFO] at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:152)
[INFO] at org.mortbay.jetty.Server.handle(Server.java:324)
[INFO] at org.mortbay.jetty.HttpConnection.handleRequest
(HttpConnection.java:505)
[INFO] at org.mortbay.jetty.HttpConnection$RequestHandler.content
(HttpConnection.java:843)
[INFO] at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
[INFO] at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:
211)
[INFO] at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:
380)
[INFO] at org.mortbay.io.nio.SelectChannelEndPoint.run
(SelectChannelEndPoint.java:395)
[INFO] at org.mortbay.thread.QueuedThreadPool$PoolThread.run
(QueuedThreadPool.java:488)
[INFO] Caused by: java.lang.ClassCastException:


mondrian.rolap.RolapMember cannot be cast to
mondrian.rolap.RolapCalculatedMember

[INFO] at mondrian.rolap.ScenarioImpl.forMember(ScenarioImpl.java:
175)
[INFO] at mondrian.rolap.RolapMember.getPropertyValue
(RolapMember.java:647)
[INFO] at mondrian.rolap.RolapCubeMember.getPropertyValue
(RolapCubeMember.java:279)
[INFO] at mondrian.rolap.RolapMember.getPropertyValue
(RolapMember.java:539)
[INFO] at mondrian.rolap.RolapCell.setValue(RolapCell.java:253)
[INFO] at mondrian.olap4j.MondrianOlap4jCell.setValue
(MondrianOlap4jCell.java:153)
[INFO] at
org.pentaho.pat.server.services.impl.QueryServiceImpl.alterCell
(QueryServiceImpl.java:267)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection
(AopUtils.java:307)
[INFO] at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint
(ReflectiveMethodInvocation.java:182)
[INFO] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
(ReflectiveMethodInvocation.java:149)
[INFO] at
org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke
(MethodSecurityInterceptor.java:66)
[INFO] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
(ReflectiveMethodInvocation.java:171)
[INFO] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke
(JdkDynamicAopProxy.java:204)
[INFO] at $Proxy19.alterCell(Unknown Source)
[INFO] at org.pentaho.pat.server.servlet.QueryServlet.alterCell
(QueryServlet.java:167)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
(RPC.java:527)
[INFO] ... 57 more

Hope thats of some use,

Cheers

Tom

Julian Hyde

unread,
Dec 23, 2009, 6:21:49 PM12/23/09
to pentahoanal...@googlegroups.com
Tom,

Judging by the location of the error, you have the wrong version of
ScenarioImpl.java.

> [INFO] at
> mondrian.rolap.ScenarioImpl.forMember(ScenarioImpl.java:
> 175)

Check that you have revision 6, the latest. The first executable line in
that method is 178.

You need to sync up to at least 13237.

Julian

Reply all
Reply to author
Forward
0 new messages