com.bigdata.bop.ap
Class SampleIndex.AcceptanceSetOffsetSampler

java.lang.Object
  extended by com.bigdata.bop.ap.SampleIndex.AcceptanceSetOffsetSampler
All Implemented Interfaces:
SampleIndex.IOffsetSampler
Enclosing class:
SampleIndex<E>

public static class SampleIndex.AcceptanceSetOffsetSampler
extends Object
implements SampleIndex.IOffsetSampler

An implementation based on an acceptance set of offsets which have been accepted. This implementation is a good choice when the limit moderate (~100k) and the rangeCount is significantly greater than the limit. The memory demand is the O(limit).

Author:
thompsonbry

Constructor Summary
SampleIndex.AcceptanceSetOffsetSampler()
           
 
Method Summary
 long[] getOffsets(long seed, int limit, long fromIndex, long toIndex)
          Return an array of tuple indices which may be used to sample a key range of some index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleIndex.AcceptanceSetOffsetSampler

public SampleIndex.AcceptanceSetOffsetSampler()
Method Detail

getOffsets

public long[] getOffsets(long seed,
                         int limit,
                         long fromIndex,
                         long toIndex)
Return an array of tuple indices which may be used to sample a key range of some index.

Note: The caller must stop when it runs out of offsets, not when the limit is satisfied, as there will be fewer offsets returned when the half open range is smaller than the limit.

Note: The utility of this class is limited to moderate range counts (~100k) so it will reject anything with a very large range count.

Specified by:
getOffsets in interface SampleIndex.IOffsetSampler
Parameters:
seed - The seed for the random number generator -or- ZERO (0L) for a random seed. A non-zero value may be used to create a repeatable sample.
limit - The maximum #of tuples to sample.
fromIndex - The inclusive lower bound.
toIndex - The exclusive upper bound0
Returns:
An array of at most limit offsets into the index. The offsets will lie in the half open range (fromIndex,toIndex]. The elements of the array will be in ascending order. No offsets will be repeated.
Throws:
UnsupportedOperationException - if the rangeCount is GT Integer.MAX_VALUE


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.