[Mondrian] Not able to selectively flush the dimension cache

Paul Stoellberger p.stoellberger at gmail.com
Wed Jul 31 16:14:35 EDT 2013


I think you need to do it like that:

>> m = cube.lookupMember(IdentifierNode.parseIdentifier( "[Time].[2013].[Jul2013]").getSegmentList());
>>            final CacheControl cacheControl = olapConnection.getCacheControl(null);
		mondrian.olap.Member mondrianMember = m.unwrap(mondrian.olap.Member.class);
>>            CacheControl.MemberSet regionTime = cacheControl.createMemberSet(mondrianMember, false);

-Paul


On Jul 31, 2013, at 8:39 PM, Julian Hyde wrote:

> What version are you running?
> 
> Can you please post the full stack?
> 
> Julian 
> 
> 
> On Jul 31, 2013, at 11:33 AM, Mayur Mohite <mayur.mohite at vizury.com> wrote:
> 
>> Hi,
>> 
>> I am trying to flush the dimension cache by following code - 
>> 
>>          org.olap4j.metadata.Schema OlapSchema = olapConnection.getOlapSchema();
>>          NamedList<org.olap4j.metadata.Cube> cubeList =  OlapSchema.getCubes();
>>          org.olap4j.metadata.Member m = null;
>>          for(org.olap4j.metadata.Cube cube: cubeList) {
>>         m = cube.lookupMember(IdentifierNode.parseIdentifier( "[Time].[2013].[Jul2013]").getSegmentList());
>>            final CacheControl cacheControl = olapConnection.getCacheControl(null);
>>            CacheControl.MemberSet regionTime = cacheControl.createMemberSet(mondrian.olap.Member)m, false);
>>            cacheControl.flush(regionTime);
>>              
>>          }
>> 
>> But this throws runtime error saying MondrianOlap4jMember cannot be casted to mondrian.olap.Member.
>> 
>> -Mayur
>> 
>> On Wed, Jul 31, 2013 at 7:39 PM, <mondrian-request at pentaho.org> wrote:
>> Send Mondrian mailing list submissions to
>>         mondrian at pentaho.org
>> 
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         http://lists.pentaho.org/mailman/listinfo/mondrian
>> or, via email, send a message with subject or body 'help' to
>>         mondrian-request at pentaho.org
>> 
>> You can reach the person managing the list at
>>         mondrian-owner at pentaho.org
>> 
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Mondrian digest..."
>> 
>> 
>> Today's Topics:
>> 
>>    1. Re: Error running tests against foodmart db
>>       (Chacko, Rachel (Truven Health))
>>    2. Re: Error running tests against foodmart db (Meral Ozkaya)
>> 
>> 
>> ----------------------------------------------------------------------
>> 
>> Message: 1
>> Date: Wed, 31 Jul 2013 14:06:48 +0000
>> From: "Chacko, Rachel (Truven Health)"
>>         <rachel.chacko at truvenhealth.com>
>> Subject: Re: [Mondrian] Error running tests against foodmart db
>> To: Mondrian developer mailing list <mondrian at pentaho.org>
>> Message-ID:
>>         <0858eb0328ce43db8eaaf279b8494d85 at BY2PR07MB073.namprd07.prod.outlook.com>
>> 
>> Content-Type: text/plain; charset="utf-8"
>> 
>> I?m using the derby database.
>> 
>> From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On Behalf Of Luc Boudreau
>> Sent: Wednesday, July 31, 2013 9:58 AM
>> To: Mondrian developer mailing list
>> Subject: Re: [Mondrian] Error running tests against foodmart db
>> 
>> 
>> On Wed, Jul 31, 2013 at 9:54 AM, Chacko, Rachel (Truven Health) <rachel.chacko at truvenhealth.com<mailto:rachel.chacko at truvenhealth.com>> wrote:
>> Caused by: java.sql.SQLException: Table/View 'time_by_day' does not exist.
>> 
>> This is probably why it is not working. What's the backend DB? Does it require tables to be prefixed by their schema name?
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20130731/0faa81a5/attachment-0001.html
>> 
>> ------------------------------
>> 
>> Message: 2
>> Date: Wed, 31 Jul 2013 17:09:26 +0300
>> From: Meral Ozkaya <meral.ozkaya at gmail.com>
>> Subject: Re: [Mondrian] Error running tests against foodmart db
>> To: Mondrian developer mailing list <mondrian at pentaho.org>
>> Message-ID:
>>         <CAO2Y5KbG-zO9=LhxZtKtPMk_OwqDNHbFMsydah7R+UAQPjZa7A at mail.gmail.com>
>> Content-Type: text/plain; charset="windows-1252"
>> 
>>  Caused by: java.sql.
>> 
>> SQLSyntaxErrorException: Table/View 'time_by_day' does not exist. you must
>> have time_by_day view/table in your database. if the table  exists in the
>> database, you probably do not have the right permission for this table or
>> you might have mistyped the table name in your xml schema.
>> 
>> 
>> 2013/7/31 Matt Campbell <mcampbell at pentaho.com>
>> 
>> >  Hi Rachel,
>> > Verify your foodmart database is up and running, and your test connection
>> > information is correct in mondrian.properties.
>> >
>> >
>> >    java.sql.SQLSyntaxErrorException: Table/View 'time_by_day' does not
>> > exist.
>> >
>> >
>> >
>> > On 07/31/2013 09:54 AM, Chacko, Rachel (Truven Health) wrote:
>> >
>> >  I?m getting the error below trying to run the tests in mondrian 3.2
>> > against the foodmart database. I see the same error with all tests and seem
>> > to be happening on setup. Any help is appreciated.****
>> >
>> > ** **
>> >
>> > mondrian.olap.MondrianException: Mondrian Error:Named set in cube 'Sales'
>> > has bad formula****
>> >
>> >                 at
>> > mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:821)****
>> >
>> >                 at
>> > mondrian.rolap.RolapCube.resolveCalcMembers(RolapCube.java:876)****
>> >
>> >                 at
>> > mondrian.rolap.RolapCube.createCalcMembersAndNamedSets(RolapCube.java:816)
>> > ****
>> >
>> >                 at mondrian.rolap.RolapCube.init(RolapCube.java:761)****
>> >
>> >                 at mondrian.rolap.RolapCube.<init>(RolapCube.java:277)****
>> >
>> >                 at mondrian.rolap.RolapSchema.load(RolapSchema.java:426)**
>> > **
>> >
>> >                 at mondrian.rolap.RolapSchema.load(RolapSchema.java:310)**
>> > **
>> >
>> >                 at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:221)
>> > ****
>> >
>> >                 at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:214)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:973)****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:757)****
>> >
>> >                 at
>> > mondrian.rolap.RolapConnection.<init>(RolapConnection.java:166)****
>> >
>> >                 at
>> > mondrian.rolap.RolapConnection.<init>(RolapConnection.java:95)****
>> >
>> >                 at
>> > mondrian.olap.DriverManager.getConnection(DriverManager.java:110)****
>> >
>> >                 at
>> > mondrian.olap.DriverManager.getConnection(DriverManager.java:74)****
>> >
>> >                 at
>> > mondrian.test.TestContext.getFoodMartConnection(TestContext.java:236)****
>> >
>> >                 at
>> > mondrian.test.TestContext.getConnection(TestContext.java:209)****
>> >
>> >                 at
>> > mondrian.test.TestContext.executeQuery(TestContext.java:515)****
>> >
>> >                 at
>> > mondrian.test.TestContext.assertQueryReturns(TestContext.java:1053)****
>> >
>> >                 at
>> > mondrian.test.FoodMartTestCase.assertQueryReturns(FoodMartTestCase.java:125)
>> > ****
>> >
>> >                 at
>> > mondrian.test.BasicQueryTest.testSample0(BasicQueryTest.java:445)****
>> >
>> >                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > Method)****
>> >
>> >                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
>> > Source)****
>> >
>> >                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> > Source)****
>> >
>> >                 at java.lang.reflect.Method.invoke(Unknown Source)****
>> >
>> >                 at junit.framework.TestCase.runTest(TestCase.java:164)****
>> >
>> >                 at junit.framework.TestCase.runBare(TestCase.java:130)****
>> >
>> >                 at
>> > junit.framework.TestResult$1.protect(TestResult.java:106)****
>> >
>> >                 at
>> > junit.framework.TestResult.runProtected(TestResult.java:124)****
>> >
>> >                 at junit.framework.TestResult.run(TestResult.java:109)****
>> >
>> >                 at junit.framework.TestCase.run(TestCase.java:120)****
>> >
>> >                 at junit.framework.TestSuite.runTest(TestSuite.java:230)**
>> > **
>> >
>> >                 at junit.framework.TestSuite.run(TestSuite.java:225)****
>> >
>> >                 at
>> > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>> > ****
>> >
>> >                 at
>> > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>> > ****
>> >
>> >                 at
>> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>> > ****
>> >
>> >                 at
>> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>> > ****
>> >
>> >                 at
>> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>> > ****
>> >
>> >                 at
>> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>> > ****
>> >
>> > Caused by: mondrian.olap.MondrianException: Mondrian Error:Failed to parse
>> > query 'WITH****
>> >
>> > MEMBER [Measures].[Profit]****
>> >
>> >   AS '[Measures].[Store Sales] - [Measures].[Store Cost]',****
>> >
>> > FORMAT_STRING = "$#,##0.00",****
>> >
>> > [$member_scope] = 'CUBE',****
>> >
>> > MEMBER_ORDINAL = 6****
>> >
>> > MEMBER [Measures].[Profit last Period]****
>> >
>> >   AS 'COALESCEEMPTY((Measures.[Profit], [Time].[Time].PREVMEMBER),
>> > Measures.[Profit])',****
>> >
>> > FORMAT_STRING = "$#,##0.00",****
>> >
>> > MEMBER_ORDINAL = 18,****
>> >
>> > [$member_scope] = 'CUBE'****
>> >
>> > MEMBER [Measures].[Profit Growth]****
>> >
>> >   AS '([Measures].[Profit] - [Measures].[Profit last Period]) /
>> > [Measures].[Profit last Period]',****
>> >
>> > FORMAT_STRING = "0.0%",****
>> >
>> > [$member_scope] = 'CUBE',****
>> >
>> > MEMBER_ORDINAL = 8****
>> >
>> > SELECT FROM [Sales]'****
>> >
>> >                 at
>> > mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:821)****
>> >
>> >                 at
>> > mondrian.olap.ConnectionBase.parseQuery(ConnectionBase.java:137)****
>> >
>> >                 at
>> > mondrian.olap.ConnectionBase.parseQuery(ConnectionBase.java:63)****
>> >
>> >                 at
>> > mondrian.rolap.RolapCube.resolveCalcMembers(RolapCube.java:874)****
>> >
>> >                 ... 37 more****
>> >
>> > Caused by: mondrian.olap.MondrianException: Mondrian Error:Error while
>> > parsing MDX statement 'WITH****
>> >
>> > MEMBER [Measures].[Profit]****
>> >
>> >   AS '[Measures].[Store Sales] - [Measures].[Store Cost]',****
>> >
>> > FORMAT_STRING = "$#,##0.00",****
>> >
>> > [$member_scope] = 'CUBE',****
>> >
>> > MEMBER_ORDINAL = 6****
>> >
>> > MEMBER [Measures].[Profit last Period]****
>> >
>> >   AS 'COALESCEEMPTY((Measures.[Profit], [Time].[Time].PREVMEMBER),
>> > Measures.[Profit])',****
>> >
>> > FORMAT_STRING = "$#,##0.00",****
>> >
>> > MEMBER_ORDINAL = 18,****
>> >
>> > [$member_scope] = 'CUBE'****
>> >
>> > MEMBER [Measures].[Profit Growth]****
>> >
>> >   AS '([Measures].[Profit] - [Measures].[Profit last Period]) /
>> > [Measures].[Profit last Period]',****
>> >
>> > FORMAT_STRING = "0.0%",****
>> >
>> > [$member_scope] = 'CUBE',****
>> >
>> > MEMBER_ORDINAL = 8****
>> >
>> > SELECT FROM [Sales]'****
>> >
>> >                 at
>> > mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:821)****
>> >
>> >                 at mondrian.olap.Parser.parseInternal(Parser.java:784)****
>> >
>> >                 at
>> > mondrian.olap.ConnectionBase.parseQuery(ConnectionBase.java:134)****
>> >
>> >                 ... 39 more****
>> >
>> > Caused by: mondrian.olap.MondrianException: Mondrian Error:Internal error:
>> > Populating member cache with members for [[Time].[Year]]; sql=[select
>> > "time_by_day"."the_year" from "time_by_day" as "time_by_day" group by
>> > "time_by_day"."the_year" order by "time_by_day"."the_year" ASC]****
>> >
>> >                 at
>> > mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:821)****
>> >
>> >                 at mondrian.olap.Util.newInternal(Util.java:1514)****
>> >
>> >                 at mondrian.olap.Util.newError(Util.java:1530)****
>> >
>> >                 at
>> > mondrian.rolap.SqlStatement.handle(SqlStatement.java:249)****
>> >
>> >                 at
>> > mondrian.rolap.SqlStatement.execute(SqlStatement.java:169)****
>> >
>> >                 at
>> > mondrian.rolap.RolapUtil.executeQuery(RolapUtil.java:228)****
>> >
>> >                 at
>> > mondrian.rolap.SqlTupleReader.prepareTuples(SqlTupleReader.java:373)****
>> >
>> >                 at
>> > mondrian.rolap.SqlTupleReader.readTuples(SqlTupleReader.java:520)****
>> >
>> >                 at
>> > mondrian.rolap.SqlMemberSource.getMembersInLevel(SqlMemberSource.java:480)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.SqlMemberSource.getMembersInLevel(SqlMemberSource.java:467)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.SmartMemberReader.getMembersInLevel(SmartMemberReader.java:147)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.RolapCubeHierarchy$CacheRolapCubeHierarchyMemberReader.getMembersInLevel(RolapCubeHierarchy.java:678)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchemaReader.getLevelMembers(RolapSchemaReader.java:479)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchemaReader.getLevelMembers(RolapSchemaReader.java:464)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.RolapCube$RolapCubeSchemaReader.getLevelMembers(RolapCube.java:2699)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchemaReader.getHierarchyRootMembers(RolapSchemaReader.java:84)
>> > ****
>> >
>> >                 at
>> > mondrian.olap.Util.lookupHierarchyRootMember(Util.java:910)****
>> >
>> >                 at
>> > mondrian.olap.HierarchyBase.lookupChild(HierarchyBase.java:163)****
>> >
>> >                 at
>> > mondrian.olap.DimensionBase.lookupChild(DimensionBase.java:109)****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchemaReader.getElementChild(RolapSchemaReader.java:356)
>> > ****
>> >
>> >                 at mondrian.olap.Util.lookupCompound(Util.java:595)****
>> >
>> >                 at
>> > mondrian.rolap.RolapSchemaReader.lookupCompound(RolapSchemaReader.java:394)
>> > ****
>> >
>> >                 at
>> > mondrian.olap.DelegatingSchemaReader.lookupCompound(DelegatingSchemaReader.java:112)
>> > ****
>> >
>> >                 at
>> > mondrian.olap.Query$QuerySchemaReader.lookupCompound(Query.java:1575)****
>> >
>> >                 at
>> > mondrian.olap.Query$QuerySchemaReader.lookupCompound(Query.java:1546)****
>> >
>> >                 at
>> > mondrian.olap.DelegatingSchemaReader.lookupCompound(DelegatingSchemaReader.java:112)
>> > ****
>> >
>> >                 at
>> > mondrian.olap.Query$ScopedSchemaReader.lookupCompound(Query.java:1743)****
>> >
>> >                 at
>> > mondrian.olap.DelegatingSchemaReader.lookupCompound(DelegatingSchemaReader.java:104)
>> > ****
>> >
>> >                 at mondrian.olap.Util.lookup(Util.java:775)****
>> >
>> >                 at mondrian.olap.Id.accept(Id.java:108)****
>> >
>> >                 at
>> > mondrian.olap.ValidatorImpl.validate(ValidatorImpl.java:80)****
>> >
>> >                 at
>> > mondrian.olap.fun.FunUtil.resolveFunArgs(FunUtil.java:1945)****
>> >
>> >                 at
>> > mondrian.mdx.UnresolvedFunCall.accept(UnresolvedFunCall.java:104)****
>> >
>> >                 at
>> > mondrian.olap.ValidatorImpl.validate(ValidatorImpl.java:80)****
>> >
>> >                 at
>> > mondrian.olap.fun.FunUtil.resolveFunArgs(FunUtil.java:1945)****
>> >
>> >                 at
>> > mondrian.mdx.UnresolvedFunCall.accept(UnresolvedFunCall.java:104)****
>> >
>> >                 at
>> > mondrian.olap.ValidatorImpl.validate(ValidatorImpl.java:80)****
>> >
>> >                 at
>> > mondrian.olap.fun.FunUtil.resolveFunArgs(FunUtil.java:1945)****
>> >
>> >                 at
>> > mondrian.mdx.UnresolvedFunCall.accept(UnresolvedFunCall.java:104)****
>> >
>> >                 at
>> > mondrian.olap.ValidatorImpl.validate(ValidatorImpl.java:80)****
>> >
>> >                 at mondrian.olap.Formula.accept(Formula.java:110)****
>> >
>> >                 at
>> > mondrian.olap.ValidatorImpl.validate(ValidatorImpl.java:156)****
>> >
>> >                 at mondrian.olap.Query.resolve(Query.java:609)****
>> >
>> >                 at mondrian.olap.Query.resolve(Query.java:504)****
>> >
>> >                 at mondrian.olap.Query.<init>(Query.java:252)****
>> >
>> >                 at mondrian.olap.Query.<init>(Query.java:217)****
>> >
>> >                 at mondrian.olap.Parser.makeQuery(Parser.java:877)****
>> >
>> >                 at
>> > mondrian.olap.CUP$Parser$actions.CUP$Parser$do_action(Parser.java:1771)***
>> > *
>> >
>> >                 at mondrian.olap.Parser.do_action(Parser.java:706)****
>> >
>> >                 at java_cup.runtime.lr_parser.parse(lr_parser.java:569)***
>> > *
>> >
>> >                 at mondrian.olap.Parser.parseInternal(Parser.java:779)****
>> >
>> >                 ... 40 more****
>> >
>> > Caused by: java.sql.SQLSyntaxErrorException: Table/View 'time_by_day' does
>> > not exist.****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
>> > Source)****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
>> > Source)****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
>> > Source)****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
>> > ****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
>> > ****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)****
>> >
>> >                 at
>> > org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:174)
>> > ****
>> >
>> >                 at
>> > mondrian.rolap.SqlStatement.execute(SqlStatement.java:150)****
>> >
>> >                 ... 86 more****
>> >
>> > Caused by: java.sql.SQLException: Table/View 'time_by_day' does not exist.
>> > ****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
>> > Source)****
>> >
>> >                 at
>> > org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>> > Source)****
>> >
>> >                 ... 96 more****
>> >
>> > ** **
>> >
>> > Thanks,****
>> >
>> > Rachel****
>> >
>> >
>> >
>> > _______________________________________________
>> > Mondrian mailing list
>> > Mondrian at pentaho.org
>> > http://lists.pentaho.org/mailman/listinfo/mondrian
>> >
>> >
>> 
>> 
>> --
>> Meral ?zkaya
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20130731/8e21d7e4/attachment.html
>> 
>> ------------------------------
>> 
>> _______________________________________________
>> Mondrian mailing list
>> Mondrian at pentaho.org
>> http://lists.pentaho.org/mailman/listinfo/mondrian
>> 
>> 
>> End of Mondrian Digest, Vol 80, Issue 20
>> ****************************************
>> 
>> _______________________________________________
>> Mondrian mailing list
>> Mondrian at pentaho.org
>> http://lists.pentaho.org/mailman/listinfo/mondrian
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20130731/c69c244d/attachment-0001.html 


More information about the Mondrian mailing list