Interface ComputeRequestBuilder<K>

All Known Implementing Classes:
AbstractAvroComputeRequestBuilder, AvroComputeRequestBuilderV3, AvroComputeRequestBuilderV4

public interface ComputeRequestBuilder<K>
  • Method Details

    • project

      ComputeRequestBuilder<K> project(String... fieldNames)
      Setup project fields, and right now only top-level fields are supported.
      Parameters:
      fieldNames -
      Returns:
    • project

      ComputeRequestBuilder<K> project(Collection<String> fieldNames)
      Setup project fields, and right now only top-level fields are supported.
      Parameters:
      fieldNames -
      Returns:
    • dotProduct

      ComputeRequestBuilder<K> dotProduct(String inputFieldName, List<Float> dotProductParam, String resultFieldName)
      Setup dot-product operation.
      Parameters:
      inputFieldName - : top-level field in the value record as the input of dot-product operation
      dotProductParam - : dot-product param
      resultFieldName - : result field name in the response record
      Returns:
    • cosineSimilarity

      ComputeRequestBuilder<K> cosineSimilarity(String inputFieldName, List<Float> cosSimilarityParam, String resultFieldName)
      Setup cosine-similarity operation.
      Parameters:
      inputFieldName - : top-level field in the value record as the input of cosine-similarity operation
      cosSimilarityParam - : cosine-similarity param
      resultFieldName - : result field name in the response record
      Returns:
    • count

      ComputeRequestBuilder<K> count(String inputFieldName, 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 operation
      resultFieldName - : result field name in the response record
      Returns:
    • hadamardProduct

      ComputeRequestBuilder<K> hadamardProduct(String inputFieldName, List<Float> hadamardProductParam, 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 operation
      hadamardProductParam - : hadamard-product param
      resultFieldName - : result field name in the response record
      Returns:
    • execute

      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

      Send compute request to Venice, and this should be the last step of the compute specification. The difference between this function and the previous execute(Set) is that this function will return the available response instead of throwing a TimeoutException when timeout happens: streamingExecute(keys).get(timeout, units);
      Parameters:
      keys -
      Returns:
      Throws:
      VeniceClientException
    • streamingExecute

      void streamingExecute(Set<K> keys, StreamingCallback<K,ComputeGenericRecord> callback) throws VeniceClientException
      Streaming interface for execute(Set), and you could find more info in StreamingCallback.
      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 in StreamingCallback. This experimental feature is subject to backwards-incompatible changes in the future.
      Parameters:
      predicate - : predicate which specifies some required leading top-level key fields
      callback - : streaming callback which stores the result from the compute request
      Throws:
      VeniceClientException