Class LazyArrayContext

java.lang.Object
com.yahoo.searchlib.rankingexpression.evaluation.Context
ai.vespa.models.evaluation.LazyArrayContext
All Implemented Interfaces:
com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex, com.yahoo.tensor.evaluation.EvaluationContext<com.yahoo.searchlib.rankingexpression.Reference>, com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>

public final class LazyArrayContext extends com.yahoo.searchlib.rankingexpression.evaluation.Context implements com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
An array context supporting functions invocations implemented as lazy values.
Author:
bratseth
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the (immutable) subset of names in this which must be bound when invoking
    com.yahoo.searchlib.rankingexpression.evaluation.Value
    Returns the value which should be used when no value is set
    com.yahoo.searchlib.rankingexpression.evaluation.Value
    get(int index)
    Perform a fast lookup by index
    com.yahoo.searchlib.rankingexpression.evaluation.Value
    get(String name)
    Perform a slow lookup by name
    double
    getDouble(int index)
     
    int
     
    com.yahoo.tensor.TensorType
    getType(com.yahoo.searchlib.rankingexpression.Reference reference)
     
     
    Map<String,ai.vespa.models.evaluation.OnnxModel>
    Returns the set of ONNX models that need to be evaluated on this context
    final void
    put(int index, double value)
    Same as put(index,DoubleValue.frozen(value))
    void
    put(int index, com.yahoo.searchlib.rankingexpression.evaluation.Value value)
    Puts a value by index.
    void
    put(String name, com.yahoo.searchlib.rankingexpression.evaluation.Value value)
    Puts a value by name.
     
    void
    setMissingValue(com.yahoo.tensor.Tensor value)
    Sets the value to use for lookups to existing values which are not set in this context.
    int
     

    Methods inherited from class com.yahoo.searchlib.rankingexpression.evaluation.Context

    get, getTensor, getType, put

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setMissingValue

      public void setMissingValue(com.yahoo.tensor.Tensor value)
      Sets the value to use for lookups to existing values which are not set in this context. The default value that will be returned is NaN
    • put

      public void put(String name, com.yahoo.searchlib.rankingexpression.evaluation.Value value)
      Puts a value by name. The value will be frozen if it isn't already.
      Overrides:
      put in class com.yahoo.searchlib.rankingexpression.evaluation.Context
      Throws:
      IllegalArgumentException - if the name is not present in the ranking expression this was created with, and ignoredUnknownValues is false
    • put

      public final void put(int index, double value)
      Same as put(index,DoubleValue.frozen(value))
    • put

      public void put(int index, com.yahoo.searchlib.rankingexpression.evaluation.Value value)
      Puts a value by index. The value will be frozen if it isn't already.
    • getType

      public com.yahoo.tensor.TensorType getType(com.yahoo.searchlib.rankingexpression.Reference reference)
      Specified by:
      getType in interface com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
    • get

      public com.yahoo.searchlib.rankingexpression.evaluation.Value get(String name)
      Perform a slow lookup by name
      Specified by:
      get in class com.yahoo.searchlib.rankingexpression.evaluation.Context
    • get

      public com.yahoo.searchlib.rankingexpression.evaluation.Value get(int index)
      Perform a fast lookup by index
      Specified by:
      get in interface com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
      Overrides:
      get in class com.yahoo.searchlib.rankingexpression.evaluation.Context
    • getDouble

      public double getDouble(int index)
      Specified by:
      getDouble in interface com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
      Overrides:
      getDouble in class com.yahoo.searchlib.rankingexpression.evaluation.Context
    • getIndex

      public int getIndex(String name)
      Specified by:
      getIndex in interface com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
    • resolveBinding

      public String resolveBinding(String argument)
      Specified by:
      resolveBinding in interface com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
    • size

      public int size()
      Specified by:
      size in interface com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
    • names

      public Set<String> names()
      Overrides:
      names in class com.yahoo.searchlib.rankingexpression.evaluation.Context
    • arguments

      public Set<String> arguments()
      Returns the (immutable) subset of names in this which must be bound when invoking
    • onnxModels

      public Map<String,ai.vespa.models.evaluation.OnnxModel> onnxModels()
      Returns the set of ONNX models that need to be evaluated on this context
    • defaultValue

      public com.yahoo.searchlib.rankingexpression.evaluation.Value defaultValue()
      Returns the value which should be used when no value is set