Class UniqueCollector<T>
- java.lang.Object
-
- org.apache.solr.analytics.function.reduction.data.ReductionDataCollector<UniqueCollector.UniqueData<T>>
-
- org.apache.solr.analytics.function.reduction.data.UniqueCollector<T>
-
- Direct Known Subclasses:
UniqueCollector.UniqueDoubleCollector,UniqueCollector.UniqueFloatCollector,UniqueCollector.UniqueIntCollector,UniqueCollector.UniqueLongCollector,UniqueCollector.UniqueStringCollector
public abstract class UniqueCollector<T> extends ReductionDataCollector<UniqueCollector.UniqueData<T>>
Collects the number of unique values that exist for the given parameter.Supported types are:
- Int
- Long
- Float
- Double
- Date (through longs)
- String
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUniqueCollector.UniqueData<T>static classUniqueCollector.UniqueDoubleCollectorstatic classUniqueCollector.UniqueFloatCollectorstatic classUniqueCollector.UniqueIntCollectorstatic classUniqueCollector.UniqueLongCollectorstatic classUniqueCollector.UniqueStringCollector
-
Field Summary
Fields Modifier and Type Field Description static Stringname-
Fields inherited from class org.apache.solr.analytics.function.reduction.data.ReductionDataCollector
collectionTargets, ioData, lastingTargets
-
-
Constructor Summary
Constructors Constructor Description UniqueCollector(AnalyticsValueStream param)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapply(UniqueCollector.UniqueData<T> data)Apply the collected info to the given reduction data.longcount()Get the count of unique values in the set data.TexportNext()StringgetExpressionStr()The unique expression string of the reduction data collector, given all inputs and parameters.StringgetName()Get the name of the reduction data collector.UniqueCollector.UniqueData<T>newData()A clean slate to start a new reduction.voidsetData(ReductionData data)Finalize the reduction with the collected data stored in the parameter.voidsetMergedData(ReductionData data)Finalize the reduction with the merged data stored in the parameter.intstartExport()-
Methods inherited from class org.apache.solr.analytics.function.reduction.data.ReductionDataCollector
addCollectTarget, addLastingCollectTarget, clearLastingCollectTargets, collect, collectAndApply, dataIO, newDataIO, newDataTarget, submitReservations
-
-
-
-
Field Detail
-
name
public static final String name
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UniqueCollector
public UniqueCollector(AnalyticsValueStream param)
-
-
Method Detail
-
count
public long count()
Get the count of unique values in the set data.- Returns:
- the count of unique values
-
newData
public UniqueCollector.UniqueData<T> newData()
Description copied from class:ReductionDataCollectorA clean slate to start a new reduction.- Specified by:
newDatain classReductionDataCollector<UniqueCollector.UniqueData<T>>- Returns:
- the new reduction data
-
apply
protected void apply(UniqueCollector.UniqueData<T> data)
Description copied from class:ReductionDataCollectorApply the collected info to the given reduction data. Should always be called after aReductionDataCollector.collect()call.- Specified by:
applyin classReductionDataCollector<UniqueCollector.UniqueData<T>>- Parameters:
data- reduction data to apply collected info to
-
startExport
public int startExport()
-
exportNext
public T exportNext()
-
setMergedData
public void setMergedData(ReductionData data)
Description copied from class:ReductionDataCollectorFinalize the reduction with the merged data stored in the parameter. Once the reduction is finalized, theReductionFunctions that use this data collector act like regularAnalyticsValueclasses that can be accessed through theirget<value-type>methods.(FOR CLOUD)
- Specified by:
setMergedDatain classReductionDataCollector<UniqueCollector.UniqueData<T>>- Parameters:
data- the merged data to compute a reduction for
-
setData
public void setData(ReductionData data)
Description copied from class:ReductionDataCollectorFinalize the reduction with the collected data stored in the parameter. Once the reduction is finalized, theReductionFunctions that use this data collector act like regularAnalyticsValueclasses that can be accessed through theirget<value-type>methods.(FOR SINGLE-SHARD)
- Specified by:
setDatain classReductionDataCollector<UniqueCollector.UniqueData<T>>- Parameters:
data- the collected data to compute a reduction for
-
getName
public String getName()
Description copied from class:ReductionDataCollectorGet the name of the reduction data collector. This is the same across all instances of the data collector.- Specified by:
getNamein classReductionDataCollector<UniqueCollector.UniqueData<T>>- Returns:
- the name
-
getExpressionStr
public String getExpressionStr()
Description copied from class:ReductionDataCollectorThe unique expression string of the reduction data collector, given all inputs and parameters. Used duringReductionDataCollectorsyncing. Since the string should be unique, only one of expression is kept.- Specified by:
getExpressionStrin classReductionDataCollector<UniqueCollector.UniqueData<T>>- Returns:
- the expression string
-
-