Package com.linkedin.venice.client.store
Interface ComputeRequestBuilder<K>
-
- All Known Implementing Classes:
AbstractAvroComputeRequestBuilder
,AvroComputeRequestBuilderV3
,AvroComputeRequestBuilderV4
public interface ComputeRequestBuilder<K>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ComputeRequestBuilder<K>
cosineSimilarity(java.lang.String inputFieldName, java.util.List<java.lang.Float> cosSimilarityParam, java.lang.String resultFieldName)
Setup cosine-similarity operation.ComputeRequestBuilder<K>
count(java.lang.String inputFieldName, java.lang.String resultFieldName)
Set up compute operation.ComputeRequestBuilder<K>
dotProduct(java.lang.String inputFieldName, java.util.List<java.lang.Float> dotProductParam, java.lang.String resultFieldName)
Setup dot-product operation.java.util.concurrent.CompletableFuture<java.util.Map<K,ComputeGenericRecord>>
execute(java.util.Set<K> keys)
Send compute request to Venice, and this should be the last step of the compute specification.default void
executeWithFilter(Predicate predicate, StreamingCallback<org.apache.avro.generic.GenericRecord,org.apache.avro.generic.GenericRecord> callback)
Streaming interface that sends compute request to Venice, which will be executed on values whose keys satisfy the given predicate.ComputeRequestBuilder<K>
hadamardProduct(java.lang.String inputFieldName, java.util.List<java.lang.Float> hadamardProductParam, java.lang.String resultFieldName)
Setup hadamard-product operation; if this api is invoked, use version 2 in the compute request version header.ComputeRequestBuilder<K>
project(java.lang.String... fieldNames)
Setup project fields, and right now only top-level fields are supported.ComputeRequestBuilder<K>
project(java.util.Collection<java.lang.String> fieldNames)
Setup project fields, and right now only top-level fields are supported.java.util.concurrent.CompletableFuture<VeniceResponseMap<K,ComputeGenericRecord>>
streamingExecute(java.util.Set<K> keys)
Send compute request to Venice, and this should be the last step of the compute specification.void
streamingExecute(java.util.Set<K> keys, StreamingCallback<K,ComputeGenericRecord> callback)
Streaming interface forexecute(Set)
, and you could find more info inStreamingCallback
.
-
-
-
Method Detail
-
project
ComputeRequestBuilder<K> project(java.lang.String... fieldNames)
Setup project fields, and right now only top-level fields are supported.- Parameters:
fieldNames
-- Returns:
-
project
ComputeRequestBuilder<K> project(java.util.Collection<java.lang.String> fieldNames)
Setup project fields, and right now only top-level fields are supported.- Parameters:
fieldNames
-- Returns:
-
dotProduct
ComputeRequestBuilder<K> dotProduct(java.lang.String inputFieldName, java.util.List<java.lang.Float> dotProductParam, java.lang.String resultFieldName)
Setup dot-product operation.- Parameters:
inputFieldName
- : top-level field in the value record as the input of dot-product operationdotProductParam
- : dot-product paramresultFieldName
- : result field name in the response record- Returns:
-
cosineSimilarity
ComputeRequestBuilder<K> cosineSimilarity(java.lang.String inputFieldName, java.util.List<java.lang.Float> cosSimilarityParam, java.lang.String resultFieldName)
Setup cosine-similarity operation.- Parameters:
inputFieldName
- : top-level field in the value record as the input of cosine-similarity operationcosSimilarityParam
- : cosine-similarity paramresultFieldName
- : result field name in the response record- Returns:
-
count
ComputeRequestBuilder<K> count(java.lang.String inputFieldName, java.lang.String resultFieldName)
Set up compute operation. It would return the number of records for array/map field.- Parameters:
inputFieldName
- : top-level field in the value record as the input of count operationresultFieldName
- : result field name in the response record- Returns:
-
hadamardProduct
ComputeRequestBuilder<K> hadamardProduct(java.lang.String inputFieldName, java.util.List<java.lang.Float> hadamardProductParam, java.lang.String resultFieldName)
Setup hadamard-product operation; if this api is invoked, use version 2 in the compute request version header.- Parameters:
inputFieldName
- : top-level field in the value record as the input of hadamard-product operationhadamardProductParam
- : hadamard-product paramresultFieldName
- : result field name in the response record- Returns:
-
execute
java.util.concurrent.CompletableFuture<java.util.Map<K,ComputeGenericRecord>> execute(java.util.Set<K> keys) throws VeniceClientException
Send compute request to Venice, and this should be the last step of the compute specification.- Parameters:
keys
- : keys for the candidate records- Returns:
- Throws:
VeniceClientException
-
streamingExecute
java.util.concurrent.CompletableFuture<VeniceResponseMap<K,ComputeGenericRecord>> streamingExecute(java.util.Set<K> keys) throws VeniceClientException
Send compute request to Venice, and this should be the last step of the compute specification. The difference between this function and the previousexecute(Set)
is that this function will return the available response instead of throwing aTimeoutException
when timeout happens: streamingExecute(keys).get(timeout, units);- Parameters:
keys
-- Returns:
- Throws:
VeniceClientException
-
streamingExecute
void streamingExecute(java.util.Set<K> keys, StreamingCallback<K,ComputeGenericRecord> callback) throws VeniceClientException
Streaming interface forexecute(Set)
, and you could find more info inStreamingCallback
.- Parameters:
keys
-callback
-- Throws:
VeniceClientException
-
executeWithFilter
@Experimental default void executeWithFilter(Predicate predicate, StreamingCallback<org.apache.avro.generic.GenericRecord,org.apache.avro.generic.GenericRecord> callback) throws VeniceClientException
Streaming interface that sends compute request to Venice, which will be executed on values whose keys satisfy the given predicate. This can be used to execute partial key lookups. If predicate is null, the compute request will be executed on all values. You can find more info inStreamingCallback
. This experimental feature is subject to backwards-incompatible changes in the future.- Parameters:
predicate
- : predicate which specifies some required leading top-level key fieldscallback
- : streaming callback which stores the result from the compute request- Throws:
VeniceClientException
-
-