Package org.openrefine.browsing.facets
Class AllFacetsAggregator
- java.lang.Object
-
- org.openrefine.browsing.facets.RowInRecordAggregator<AllFacetsState>
-
- org.openrefine.browsing.facets.AllFacetsAggregator
-
- All Implemented Interfaces:
Serializable,Combiner<AllFacetsState>,RecordAggregator<AllFacetsState>,RowAggregator<AllFacetsState>
public class AllFacetsAggregator extends RowInRecordAggregator<AllFacetsState>
Internal aggregator to compute the state of all facets in one pass over the grid.
We useImmutableListto ensure immutability and serializability of the states.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<FacetAggregator<?>>_facetAggregatorsprotected List<RowInRecordFilter>_rowFilters
-
Constructor Summary
Constructors Constructor Description AllFacetsAggregator(List<FacetAggregator<?>> facetAggregators)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AllFacetsStatesum(AllFacetsState first, AllFacetsState second)Merges two facet statistics from the same facet, computed on different sets of rows.protected com.google.common.collect.ImmutableList<ColumnStats>sumColumnStats(List<ColumnStats> first, List<ColumnStats> second)protected com.google.common.collect.ImmutableList<ColumnStats>updateColumnStats(List<ColumnStats> statistics, Row row)AllFacetsStatewithRecord(AllFacetsState states, Record record)Adds statistics obtained from a single record to the aggregation state.AllFacetsStatewithRow(AllFacetsState states, long rowId, Row row, Record record)Adds statistics obtained from a single row to the facet state.-
Methods inherited from class org.openrefine.browsing.facets.RowInRecordAggregator
withRow
-
-
-
-
Field Detail
-
_facetAggregators
protected final List<FacetAggregator<?>> _facetAggregators
-
_rowFilters
protected final List<RowInRecordFilter> _rowFilters
-
-
Constructor Detail
-
AllFacetsAggregator
public AllFacetsAggregator(List<FacetAggregator<?>> facetAggregators)
-
-
Method Detail
-
withRow
public AllFacetsState withRow(AllFacetsState states, long rowId, Row row, Record record)
Description copied from class:RowInRecordAggregatorAdds statistics obtained from a single row to the facet state. Given that facet states are expected to be immutable, this returns a new facet state object.- Specified by:
withRowin classRowInRecordAggregator<AllFacetsState>rowId- the row id of the row to ingestrow- the row to ingestrecord- the enclosing record of the row, if available (in records mode), null otherwise- Returns:
- the facet state updated with this row
-
withRecord
public AllFacetsState withRecord(AllFacetsState states, Record record)
Description copied from interface:RecordAggregatorAdds statistics obtained from a single record to the aggregation state. Given that states are expected to be immutable, this returns a new aggregation state object. This function is required to be associative with the combining function: combine(a, withRecord(b, record)) == withRecord(combine(a, b), record)- Specified by:
withRecordin interfaceRecordAggregator<AllFacetsState>- Overrides:
withRecordin classRowInRecordAggregator<AllFacetsState>- Parameters:
states- the current aggregation staterecord- the record to ingest- Returns:
- the aggregation state updated with this row
-
sum
public AllFacetsState sum(AllFacetsState first, AllFacetsState second)
Description copied from interface:CombinerMerges two facet statistics from the same facet, computed on different sets of rows. This generally amounts to summing all the statistics internally. This function is required to be associative: sum(a, sum(b, c)) == sum(sum(a, b), c)- Returns:
- the sum of both facet statistics
-
updateColumnStats
protected com.google.common.collect.ImmutableList<ColumnStats> updateColumnStats(List<ColumnStats> statistics, Row row)
-
sumColumnStats
protected com.google.common.collect.ImmutableList<ColumnStats> sumColumnStats(List<ColumnStats> first, List<ColumnStats> second)
-
-