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 class
UniqueCollector.UniqueData<T>
static class
UniqueCollector.UniqueDoubleCollector
static class
UniqueCollector.UniqueFloatCollector
static class
UniqueCollector.UniqueIntCollector
static class
UniqueCollector.UniqueLongCollector
static class
UniqueCollector.UniqueStringCollector
-
Field Summary
Fields Modifier and Type Field Description static String
name
-
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 void
apply(UniqueCollector.UniqueData<T> data)
Apply the collected info to the given reduction data.long
count()
Get the count of unique values in the set data.T
exportNext()
String
getExpressionStr()
The unique expression string of the reduction data collector, given all inputs and parameters.String
getName()
Get the name of the reduction data collector.UniqueCollector.UniqueData<T>
newData()
A clean slate to start a new reduction.void
setData(ReductionData data)
Finalize the reduction with the collected data stored in the parameter.void
setMergedData(ReductionData data)
Finalize the reduction with the merged data stored in the parameter.int
startExport()
-
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:ReductionDataCollector
A clean slate to start a new reduction.- Specified by:
newData
in classReductionDataCollector<UniqueCollector.UniqueData<T>>
- Returns:
- the new reduction data
-
apply
protected void apply(UniqueCollector.UniqueData<T> data)
Description copied from class:ReductionDataCollector
Apply the collected info to the given reduction data. Should always be called after aReductionDataCollector.collect()
call.- Specified by:
apply
in 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:ReductionDataCollector
Finalize the reduction with the merged data stored in the parameter. Once the reduction is finalized, theReductionFunction
s that use this data collector act like regularAnalyticsValue
classes that can be accessed through theirget<value-type>
methods.(FOR CLOUD)
- Specified by:
setMergedData
in classReductionDataCollector<UniqueCollector.UniqueData<T>>
- Parameters:
data
- the merged data to compute a reduction for
-
setData
public void setData(ReductionData data)
Description copied from class:ReductionDataCollector
Finalize the reduction with the collected data stored in the parameter. Once the reduction is finalized, theReductionFunction
s that use this data collector act like regularAnalyticsValue
classes that can be accessed through theirget<value-type>
methods.(FOR SINGLE-SHARD)
- Specified by:
setData
in classReductionDataCollector<UniqueCollector.UniqueData<T>>
- Parameters:
data
- the collected data to compute a reduction for
-
getName
public String getName()
Description copied from class:ReductionDataCollector
Get the name of the reduction data collector. This is the same across all instances of the data collector.- Specified by:
getName
in classReductionDataCollector<UniqueCollector.UniqueData<T>>
- Returns:
- the name
-
getExpressionStr
public String getExpressionStr()
Description copied from class:ReductionDataCollector
The unique expression string of the reduction data collector, given all inputs and parameters. Used duringReductionDataCollector
syncing. Since the string should be unique, only one of expression is kept.- Specified by:
getExpressionStr
in classReductionDataCollector<UniqueCollector.UniqueData<T>>
- Returns:
- the expression string
-
-