Esempio n. 1
0
  @Test
  public void testGroupPerformance() throws Exception {

    // Apply two different group operations and measure the elapsed time.
    long begin = System.nanoTime();
    int lookupTimes = 1000;
    for (int i = 0; i < lookupTimes; i++) {
      dataSetOpEngine.execute(EXPENSE_REPORTS, groupByDeptAndCount.getOperationList());
      dataSetOpEngine.execute(EXPENSE_REPORTS, groupByDeptAndSum.getOperationList());
    }
    long time = System.nanoTime() - begin;

    // Check out the resulting stats
    DataSetIndex dataSetIndex = dataSetOpEngine.getIndexRegistry().get(EXPENSE_REPORTS);
    DataSetIndexStats stats = dataSetIndex.getStats();
    DataSet dataSet = dataSetIndex.getDataSet();
    System.out.println(stats.toString("\n"));

    // Assert the reuse of group operations and aggregate calculations is working.
    assertThat(stats.getNumberOfGroupOps()).isEqualTo(1);
    assertThat(stats.getNumberOfAggFunctions()).isEqualTo(10);

    // The build time should be shorter than the overall lookup time.
    assertThat(stats.getBuildTime()).isLessThan(time);

    // The reuse rate must reflect the number of times the lookups are being reused.
    assertThat(stats.getReuseRate()).isGreaterThanOrEqualTo(lookupTimes - 1);

    // The index size must not be greater than the 20% of the dataset's size
    assertThat(stats.getIndexSize()).isLessThan(dataSet.getEstimatedSize() / 5);
  }
Esempio n. 2
0
 @Before
 public void setUp() throws Exception {
   DataSet dataSet = RawDataSetSamples.EXPENSE_REPORTS.toDataSet();
   dataSet.setUUID(EXPENSE_REPORTS);
   dataSetOpEngine.getIndexRegistry().put(dataSet);
 }