public class DimFilterUtils extends Object
Modifier and Type | Field and Description |
---|---|
static byte |
STRING_SEPARATOR |
Constructor and Description |
---|
DimFilterUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> Set<T> |
filterShards(DimFilter dimFilter,
Iterable<T> input,
com.google.common.base.Function<T,ShardSpec> converter)
Filter the given iterable of objects by removing any object whose ShardSpec, obtained from the converter function,
does not fit in the RangeSet of the dimFilter
DimFilter.getDimensionRangeSet(String) . |
static <T> Set<T> |
filterShards(DimFilter dimFilter,
Iterable<T> input,
com.google.common.base.Function<T,ShardSpec> converter,
Map<String,com.google.common.base.Optional<com.google.common.collect.RangeSet<String>>> dimensionRangeCache)
Filter the given iterable of objects by removing any object whose ShardSpec, obtained from the converter function,
does not fit in the RangeSet of the dimFilter
DimFilter.getDimensionRangeSet(String) . |
public static final byte STRING_SEPARATOR
public static <T> Set<T> filterShards(DimFilter dimFilter, Iterable<T> input, com.google.common.base.Function<T,ShardSpec> converter)
DimFilter.getDimensionRangeSet(String)
. The returned set
contains the filtered objects in the same order as they appear in input.
If you plan to call this multiple times with the same dimFilter, consider using
filterShards(DimFilter, Iterable, Function, Map)
instead with a cached mapT
- This can be any type, as long as transform function is provided to convert this to ShardSpecdimFilter
- The filter to useinput
- The iterable of objects to be filteredconverter
- The function to convert T to ShardSpec that can be filtered bypublic static <T> Set<T> filterShards(DimFilter dimFilter, Iterable<T> input, com.google.common.base.Function<T,ShardSpec> converter, Map<String,com.google.common.base.Optional<com.google.common.collect.RangeSet<String>>> dimensionRangeCache)
DimFilter.getDimensionRangeSet(String)
. The returned set
contains the filtered objects in the same order as they appear in input.
DimensionRangedCache stores the RangeSets of different dimensions for the dimFilter. It should be re-used
between calls with the same dimFilter to save redundant calls of DimFilter.getDimensionRangeSet(String)
on same dimensions.T
- This can be any type, as long as transform function is provided to convert this to ShardSpecdimFilter
- The filter to useinput
- The iterable of objects to be filteredconverter
- The function to convert T to ShardSpec that can be filtered bydimensionRangeCache
- The cache of RangeSets of different dimensions for the dimFilterCopyright © 2011–2017. All rights reserved.