Package com.linkedin.venice.client.store
Class AvroComputeAggregationRequestBuilder<K>
java.lang.Object
com.linkedin.venice.client.store.AvroComputeAggregationRequestBuilder<K>
- All Implemented Interfaces:
ComputeAggregationRequestBuilder<K>
,ExecutableRequestBuilder<K,
ComputeAggregationResponse>
public class AvroComputeAggregationRequestBuilder<K>
extends Object
implements ComputeAggregationRequestBuilder<K>
Implementation of
ComputeAggregationRequestBuilder
that supports counting field values
and grouping them by their values.-
Constructor Summary
ConstructorsConstructorDescriptionAvroComputeAggregationRequestBuilder
(AvroGenericReadComputeStoreClient storeClient, SchemaReader schemaReader) -
Method Summary
Modifier and TypeMethodDescriptioncountGroupByBucket
(Map<String, Predicate<T>> bucketNameToPredicate, String... fieldNames) Aggregation query where the content of specified fields are going to be grouped by buckets, with each bucket being defined by somePredicate
, and each matching occurrence incrementing a count for its associated bucket, after which the bucket names to counts are going to be returned.countGroupByValue
(int topK, String... fieldNames) Aggregation query where the content of specified fields are going to be grouped by their value, then the occurrence of each distinct value counted, after which the top K highest counts along with their associated values are going to be returned.Send compute request to Venice, and this should be the last step of the compute specification.
-
Constructor Details
-
AvroComputeAggregationRequestBuilder
public AvroComputeAggregationRequestBuilder(AvroGenericReadComputeStoreClient storeClient, SchemaReader schemaReader)
-
-
Method Details
-
countGroupByValue
Description copied from interface:ComputeAggregationRequestBuilder
Aggregation query where the content of specified fields are going to be grouped by their value, then the occurrence of each distinct value counted, after which the top K highest counts along with their associated values are going to be returned.- Specified by:
countGroupByValue
in interfaceComputeAggregationRequestBuilder<K>
- Parameters:
topK
- The max number of distinct values for which to return a count.fieldNames
- The names of fields for which to perform the facet counting.- Returns:
- The same builder instance, to chain additional operations onto.
-
countGroupByBucket
public <T> ComputeAggregationRequestBuilder<K> countGroupByBucket(Map<String, Predicate<T>> bucketNameToPredicate, String... fieldNames) Description copied from interface:ComputeAggregationRequestBuilder
Aggregation query where the content of specified fields are going to be grouped by buckets, with each bucket being defined by somePredicate
, and each matching occurrence incrementing a count for its associated bucket, after which the bucket names to counts are going to be returned.- Specified by:
countGroupByBucket
in interfaceComputeAggregationRequestBuilder<K>
- Type Parameters:
T
- The type of the fields to apply the bucket predicates to.- Parameters:
bucketNameToPredicate
- A map of predicate name ->Predicate
to define the buckets to group values by.fieldNames
- The names of fields for which to perform the facet counting.- Returns:
- The same builder instance, to chain additional operations onto.
-
execute
public CompletableFuture<ComputeAggregationResponse> execute(Set<K> keys) throws VeniceClientException Description copied from interface:ExecutableRequestBuilder
Send compute request to Venice, and this should be the last step of the compute specification.- Specified by:
execute
in interfaceExecutableRequestBuilder<K,
ComputeAggregationResponse> - Parameters:
keys
- : keys for the candidate records- Returns:
- Throws:
VeniceClientException
-