private void validateHistogram(
      final Index index, int expectedColumns, HistogramEntryDescription... entries) {
    final IndexStatisticsService statsService = statsService();
    if (analyzedIndexes.add(index)) {
      ddl()
          .updateTableStatistics(
              session(),
              index.leafMostTable().getName(),
              Collections.singleton(index.getIndexName().getName()));
    }

    if (entries != null) {
      IndexStatistics stats = statsService.getIndexStatistics(session(), index);
      Histogram histogram = stats.getHistogram(0, expectedColumns);

      assertEquals("histogram column count", expectedColumns, histogram.getColumnCount());
      List<HistogramEntry> actualEntries = histogram.getEntries();
      List<HistogramEntryDescription> expectedList = Arrays.asList(entries);
      AssertUtils.assertCollectionEquals("entries", expectedList, actualEntries);
    }
  }
示例#2
0
 @Override
 public boolean isSelected(Index index) {
   return !(index.isTableIndex() && index.leafMostTable() == table);
 }