@Override public int getNumRows() { return index.size(); }
@Override public int getNumRows() { return index.size(); }
@Override public boolean apply(FireHydrant input) { final IncrementalIndex index = input.getIndex(); return index == null || index.size() != 0; } }
public int getNumRowsInMemory() { synchronized (hydrantLock) { IncrementalIndex index = currHydrant.getIndex(); if (index == null) { return 0; } return currHydrant.getIndex().size(); } }
public boolean swappable() { synchronized (hydrantLock) { return writable && currHydrant.getIndex() != null && currHydrant.getIndex().size() != 0; } }
@Test public void sameRow() throws IndexSizeExceededException { MapBasedInputRow row = new MapBasedInputRow( System.currentTimeMillis() - 1, Lists.newArrayList("billy", "joe"), ImmutableMap.of("billy", "A", "joe", "B") ); IncrementalIndex index = closerRule.closeLater(indexCreator.createIndex()); index.add(row); index.add(row); index.add(row); Assert.assertEquals(1, index.size()); } }
log.info("Starting persist for interval[%s], rows[%,d]", dataInterval, index.size()); return merge( Collections.singletonList(
private void spillIfSwappable() { if (theSink.swappable()) { final FireHydrant indexToPersist = theSink.swap(); final int rowsToPersist = indexToPersist.getIndex().size(); final File dirToPersist = getSpillDir(indexToPersist.getCount()); log.info("Spilling index[%d] with rows[%d] to: %s", indexToPersist.getCount(), rowsToPersist, dirToPersist); try { indexMergerV9.persist( indexToPersist.getIndex(), dirToPersist, config.getIndexSpec(), config.getSegmentWriteOutMediumFactory() ); indexToPersist.swapSegment(null); metrics.incrementRowOutputCount(rowsToPersist); spilled.add(dirToPersist); } catch (Exception e) { log.warn(e, "Failed to spill index[%d]", indexToPersist.getCount()); throw Throwables.propagate(e); } } }
Assert.assertEquals(elementsPerThread * (isRollup ? 1 : threadCount), index.size()); Iterator<Row> iterator = index.iterator(); int curr = 0;
@Test public void testCaseSensitivity() throws Exception { long timestamp = System.currentTimeMillis(); IncrementalIndex index = closerRule.closeLater(indexCreator.createIndex(defaultAggregatorFactories)); populateIndex(timestamp, index); Assert.assertEquals(Arrays.asList("dim1", "dim2"), index.getDimensionNames()); Assert.assertEquals(2, index.size()); final Iterator<Row> rows = index.iterator(); Row row = rows.next(); Assert.assertEquals(timestamp, row.getTimestampFromEpoch()); Assert.assertEquals(Collections.singletonList("1"), row.getDimension("dim1")); Assert.assertEquals(Collections.singletonList("2"), row.getDimension("dim2")); row = rows.next(); Assert.assertEquals(timestamp, row.getTimestampFromEpoch()); Assert.assertEquals(Collections.singletonList("3"), row.getDimension("dim1")); Assert.assertEquals(Collections.singletonList("4"), row.getDimension("dim2")); }
Assert.assertEquals(2, index.size());
int numRows = indexToPersist.getIndex().size();
Assert.assertEquals("index size", 1, oneRowIndex.size()); Assert.assertEquals("result size", 1, results.size()); Assert.assertEquals("result timestamp", DateTimes.of("2012-01-01T00:00:00Z"), results.get(0).getTimestamp()); Assert.assertEquals("index size", 2, oneRowIndex.size()); Assert.assertEquals("result size", 1, results.size()); Assert.assertEquals("result timestamp", DateTimes.of("2012-01-01T00:00:00Z"), results.get(0).getTimestamp());
numRowsExcludingCurrIndex.addAndGet(old.getIndex().size());
); try { int numRows = indexToPersist.getIndex().size();
index.getMetricNames() ); Assert.assertEquals(2, index.size());
Assert.assertEquals(9, index.size()); final IncrementalIndexStorageAdapter queryable = new IncrementalIndexStorageAdapter(index); Assert.assertEquals(2, queryable.getAvailableDimensions().size());
@Override public boolean apply(FireHydrant input) { final IncrementalIndex index = input.getIndex(); return index == null || index.size() != 0; } }
public boolean swappable() { synchronized (hydrantLock) { return writable && currHydrant.getIndex() != null && currHydrant.getIndex().size() != 0; } }
public int getNumRowsInMemory() { synchronized (hydrantLock) { IncrementalIndex index = currHydrant.getIndex(); if (index == null) { return 0; } return currHydrant.getIndex().size(); } }