Interface ComputeRequestBuilder<K>

    • 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 operation
        dotProductParam - : dot-product param
        resultFieldName - : 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 operation
        cosSimilarityParam - : cosine-similarity param
        resultFieldName - : 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 operation
        resultFieldName - : 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 operation
        hadamardProductParam - : hadamard-product param
        resultFieldName - : 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 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
      • 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