@Test public void getNextRecord100Records90Percent() throws Exception { int expected = 0; samplingBitSet.set(0, 100); for (int i = 0; i < 10; i++) { samplingBitSet.flip(i * 2); } recordsLimit = 100; when(mockContext.getStatsSampleRatio()).thenReturn((float) 0.9); readSamplingBridge = new ReadSamplingBridge(mockContext, mockAccessorFactory, mockResolverFactory); for (int i = 0; i < 90; i++) { result = readSamplingBridge.getNext(); if (i < 10) { expected = (i * 2) + 1; } else { expected = i + 10; } assertEquals("" + expected, result.toString()); } result = readSamplingBridge.getNext(); assertNull(result); }
@Override public Writable getNext() throws Exception { Writable output = super.getNext(); while (!sampleBitSet.get(curIndex)) { if (output == null) { break; } incIndex(); output = super.getNext(); } incIndex(); return output; }
ReadSamplingBridge extends ReadBridge { @Override public Writable getNext() throws Exception { Writable output = super.getNext(); while (!sampleBitSet.get(curIndex)) { if (output == null) { break; } incIndex(); output = super.getNext(); } incIndex(); return output; } }
ReadSamplingBridge extends ReadBridge { @Override public Writable getNext() throws Exception { Writable output = super.getNext(); while (!sampleBitSet.get(curIndex)) { if (output == null) { break; } incIndex(); output = super.getNext(); } incIndex(); return output; } ReadSamplingBridge(RequestContext context);   ReadSamplingBridge(RequestContext context, AccessorFactory accessorFactory, ResolverFactory resolverFactory); }
ReadSamplingBridge extends ReadBridge { @Override public Writable getNext() throws Exception { Writable output = super.getNext(); while (!sampleBitSet.get(curIndex)) { if (output == null) { break; } incIndex(); output = super.getNext(); } incIndex(); return output; } ReadSamplingBridge(RequestContext context);   ReadSamplingBridge(RequestContext context, AccessorFactory accessorFactory, ResolverFactory resolverFactory); @Override Writable getNext(); }
ReadSamplingBridge extends ReadBridge { @Override public Writable getNext() throws Exception { Writable output = super.getNext(); while (!sampleBitSet.get(curIndex)) { if (output == null) { break; } incIndex(); output = super.getNext(); } incIndex(); return output; } ReadSamplingBridge(RequestContext context);   ReadSamplingBridge(RequestContext context, AccessorFactory accessorFactory, ResolverFactory resolverFactory); @Override Writable getNext();  }