Reputation: 29
I'm trying to add a new measure to an existing ActivePivot cube. I started adding a measure to the Sanbox project. It worked fine. I was able to see the new measure and i got the sum of all element. I added following lines:
EquityDerivativesCube.xml:
<measure name="test" aggregationFunctions="SUM"/>
SandboxFields.xml:
<field name="test" type="double" defaultValue="0" />
PNLCalculator#PNLCalculatorResult.java
private Double test;
public Double getTest() {
return test;
}
public void setTest(Double test) {
this.test = test;
}
PNLCalculator.enrichTrade()
...
result.setTest(2.);
...
In the Real-World-Application this approach doesn't work so good. I added the following lines:
Into the
RealWorldApplicationCube.xml
<measure name="Test" aggregationFunctions="SUM" folder="Dev\Test" />
Into
RealWorldApplicationSchema.xml
<field name="Test" type="double" defaultValue="0" />
The data is loaded from CSV files. There is a CSV file that defines all fields for each file that the Applcation can handle.
...;Test=N/A;
There is also a calculator that handles all the other measures. I extended it like this:
public void computeTest(IRelationalEntry entry) {
double price = org.apache.commons.collections.MapUtils.getDouble(entry, "price", 0.);
double test = price * 2;
entry.put("Test", test);
}
When i run the application i get couple exceptions and i cannot see the new measure. Here is the exception:
com.quartetfs.fwk.transaction.TransactionException: [Transaction manager: ActivePivot] Prepare commit operation failed because an exception has been raised. You must now rollback the transaction. at com.quartetfs.fwk.transaction.impl.ATransactionManager.prepareCommit(ATransactionManager.java:130) at com.quartetfs.fwk.transaction.impl.ATransactionManager.commit(ATransactionManager.java:142) at com.quartetfs.tech.store.impl.ARelationalTransactionManager.commit(ARelationalTransactionManager.java:139) at com.quartetfs.tech.store.impl.ARelationalTransactionManager.commit(ARelationalTransactionManager.java:51) at com.real.world.application.impl.ATransactionExceptionAwareHandler.doSubmit(ATransactionExceptionAwareHandler.java:97) at com.real.world.application.impl.ATransactionExceptionAwareHandler.submit(ATransactionExceptionAwareHandler.java:51) at com.quartetfs.tech.store.impl.TransactionHandlerListener.receive(TransactionHandlerListener.java:61) at com.quartetfs.tech.store.csv.impl.FilteredSource.receive(FilteredSource.java:56) at com.quartetfs.fwk.messaging.impl.ParserContext.publishChunk(ParserContext.java:457) at com.quartetfs.fwk.messaging.impl.ParserContext.awaitTermination(ParserContext.java:382) at com.quartetfs.fwk.messaging.impl.CSVSource.process(CSVSource.java:308) at com.quartetfs.fwk.messaging.impl.CSVSource.onFileAction(CSVSource.java:282) at com.quartetfs.fwk.messaging.impl.AFileWatcher.filesAction(AFileWatcher.java:277) at com.quartetfs.fwk.messaging.impl.AFileWatcher.doInterval(AFileWatcher.java:267) at com.quartetfs.fwk.messaging.impl.AFileWatcher.startScheduling(AFileWatcher.java:125) at com.quartetfs.fwk.messaging.impl.AFileWatcher.start(AFileWatcher.java:107) at com.quartetfs.fwk.messaging.impl.CSVSource.start(CSVSource.java:182) at com.quartetfs.tech.store.csv.impl.ExtendedCSVDataModelFactory$1.run(ExtendedCSVDataModelFactory.java:217) at java.lang.Thread.run(Thread.java:662) Caused by: com.quartetfs.fwk.transaction.TransactionException: [Transaction manager: RealWorldApplicationSchema] Prepare commit operation failed because an exception has been raised. You must now rollback the transaction. at com.quartetfs.fwk.transaction.impl.ATransactionManager.prepareCommit(ATransactionManager.java:130) at com.quartetfs.tech.store.impl.ARelationalTransactionManager.doPrepareCommit(ARelationalTransactionManager.java:113) at com.quartetfs.fwk.transaction.impl.ATransactionManager.prepareCommit(ATransactionManager.java:128) ... 18 more Caused by: com.quartetfs.fwk.transaction.TransactionException: One of the schema transaction contribution tasks failed. at com.quartetfs.biz.pivot.transaction.impl.ActivePivotSchemaTransaction.prepareCommit(ActivePivotSchemaTransaction.java:239) at com.quartetfs.biz.pivot.impl.ActivePivotSchemaTransactionManager.doPrepareCommit(ActivePivotSchemaTransactionManager.java:194) at com.quartetfs.fwk.transaction.impl.ATransactionManager.prepareCommit(ATransactionManager.java:128) ... 20 more Caused by: java.lang.RuntimeException: com.quartetfs.biz.pivot.ClassificationException: The calculator has thrown an exception during the evaluation of the object: RelationalEntry [type=ActivePivot, key=Key [ ... ,Test=null, ...]] at jsr166y.ForkJoinTask.completeExceptionally(ForkJoinTask.java:1116) at jsr166y.cancellable.impl.CancellableCountedCompleter.onCompletion(CancellableCountedCompleter.java:132) at jsr166y.CountedCompleter.tryComplete(CountedCompleter.java:391) at com.quartetfs.biz.pivot.transaction.impl.ActivePivotSchemaTransaction$ContributeAction.afterCompute(ActivePivotSchemaTransaction.java:492) at jsr166y.cancellable.impl.CancellableCountedCompleter.compute(CancellableCountedCompleter.java:96) at jsr166y.CountedCompleter.exec(CountedCompleter.java:437) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:265) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:976) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1480) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:105) Caused by: com.quartetfs.biz.pivot.ClassificationException: The calculator has thrown an exception during the evaluation of the object: RelationalEntry [type=ActivePivot, key=Key [ ... ,Test=null, ...]] at com.quartetfs.biz.pivot.classification.impl.Classifier.classifyAll(Classifier.java:114) at com.quartetfs.biz.pivot.transaction.impl.ActivePivotSchemaTransaction$ContributeAction.compute(ActivePivotSchemaTransaction.java:446) at com.quartetfs.biz.pivot.transaction.impl.ActivePivotSchemaTransaction$ContributeAction.computeSafely(ActivePivotSchemaTransaction.java:487) at jsr166y.cancellable.impl.CancellableCountedCompleter.compute(CancellableCountedCompleter.java:91) ... 5 more Caused by: com.quartetfs.biz.pivot.ClassificationException: Classification failure for level "Test": the mandatory property "Test" is not found. Contribution key: "Key [ ... ,Test=null, ...]]. at com.quartetfs.biz.pivot.classification.impl.ResultClassificationProcedure.execute(ResultClassificationProcedure.java:192) at com.quartetfs.biz.pivot.classification.impl.ClassificationTree$ClassificationNode.execute(ClassificationTree.java:215) at com.quartetfs.biz.pivot.classification.impl.ClassificationTree$ClassificationNode.execute(ClassificationTree.java:235) at com.quartetfs.biz.pivot.classification.impl.ClassificationTree.execute(ClassificationTree.java:57) at com.quartetfs.biz.pivot.classification.impl.Classifier.classify(Classifier.java:161) at com.quartetfs.biz.pivot.classification.impl.Classifier.classifyAll(Classifier.java:110) ... 8 more
06.02.2013 16:09:24 com.real.world.application.impl.ATransactionExceptionAwareHandler doSubmit
What am i missing? How can i add a new measure to the cube? What causes the error in the calculator?
While debugging the code is visiting the calculators method (computeTest()) and is setting the value to the RelationalEntry.
Cheers
Upvotes: 0
Views: 495
Reputation: 1704
The steps to add a new measure in ActivePivot are not more complicated than what you describe in your post. Declare the field that holds the value to aggregate, reference that field as a measure in your cube, together with the aggregation function(s) you want to apply on it. And optionally the post processors you have written if the base aggregation functions are not enough.
But something else in your project seems to cause an issue and you need support (the data, the loading of the data, another component...). StackOverflow is not meant for issue tracking or troubleshooting support, it is more about "I would like to do that, how can I do it?". My advice is to bring your issue directly to the Quartet FS customer support ( http://support.quartetfs.com )
Upvotes: 1