0

我正在尝试向现有 ActivePivot 多维数据集添加新度量。我开始向 Sanbox 项目添加度量。它工作得很好。我能够看到新的度量,并且得到了所有元素的总和。我添加了以下几行:

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.);
  ...

在实际应用中,这种方法效果不佳。我添加了以下几行:

进入

RealWorldApplicationCube.xml
  <measure name="Test" aggregationFunctions="SUM" folder="Dev\Test" />

进入

RealWorldApplicationSchema.xml
  <field name="Test"        type="double" defaultValue="0" />

数据从 CSV 文件加载。有一个 CSV 文件定义了 Applcation 可以处理的每个文件的所有字段。

...;Test=N/A;

还有一个计算器可以处理所有其他措施。我像这样扩展它:

public void computeTest(IRelationalEntry entry) {
  double price = org.apache.commons.collections.MapUtils.getDouble(entry, "price", 0.);
  double test = price * 2;

  entry.put("Test", test);
}

当我运行应用程序时,我遇到了几个异常,我看不到新的措施。这是一个例外:

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

我错过了什么?如何向多维数据集添加新度量?是什么导致计算器出现错误?

在调试代码时访问计算器方法 (computeTest()) 并将值设置为 RelationalEntry。

干杯

4

1 回答 1

1

在 ActivePivot 中添加新度量的步骤并不比您在帖子中描述的复杂。声明包含要聚合的值的字段,将该字段引用为多维数据集中的度量,以及要在其上应用的聚合函数。如果基本聚合功能不够,还可以选择您编写的后处理器。

但是您项目中的其他东西似乎会导致问题,您需要支持(数据、数据加载、另一个组件......)。StackOverflow 并不意味着问题跟踪或故障排除支持,它更多的是关于“我想这样做,我该怎么做?”。我的建议是将您的问题直接提交给 Quartet FS 客户支持 ( http://support.quartetfs.com )

于 2013-02-07T09:25:27.953 回答