@Test
public void test()
{
IndexStatisticsService statsService = statsService();
IndexStatistics stats = statsService.getIndexStatistics(session(), index);
Histogram histogram;
List<HistogramEntry> entries;
// Multi-column histogram on (a)
histogram = stats.getHistogram(0, 1);
assertEquals(0, histogram.getFirstColumn());
assertEquals(1, histogram.getColumnCount());
assertEquals(A_COUNT, histogram.totalDistinctCount());
entries = histogram.getEntries();
int a = 0;
for (HistogramEntry entry : entries) {
assertEquals(String.format("{(long)%s}", a++), entry.getKeyString());
assertEquals(N / A_COUNT, entry.getEqualCount());
assertEquals(0, entry.getDistinctCount());
assertEquals(0, entry.getLessCount());
}
// Not checking other multi-column entries in detail, because there's nothing new, and they're pretty useless.
// Single-column histogram on (b)
histogram = stats.getHistogram(1, 1);
assertEquals(1, histogram.getFirstColumn());
assertEquals(1, histogram.getColumnCount());
assertEquals(B_COUNT, histogram.totalDistinctCount());
entries = histogram.getEntries();
int b = 0;
for (HistogramEntry entry : entries) {
assertEquals(String.format("{(long)%s}", b++), entry.getKeyString());
assertEquals(N / B_COUNT, entry.getEqualCount());
assertEquals(0, entry.getDistinctCount());
assertEquals(0, entry.getLessCount());
}
// Single-column histogram on (c)
histogram = stats.getHistogram(2, 1);
assertEquals(2, histogram.getFirstColumn());
assertEquals(1, histogram.getColumnCount());
assertEquals(C_COUNT, histogram.totalDistinctCount());
entries = histogram.getEntries();
int c = 0;