All Implemented Interfaces:
NamedWriteable, Writeable, TranslationAware, TranslationAware.SingleValueTranslationAware, Resolvable

public class Range extends ScalarFunction implements TranslationAware.SingleValueTranslationAware
  • Constructor Details

  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • info

      protected NodeInfo<Range> info()
      Description copied from class: Node
      Normally, you want to use one of the static create methods to implement this.

      For QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations like QueryPlan#transformExpressionsOnly(Function) will not have an effect.

      Specified by:
      info in class Node<Expression>
    • replaceChildren

      public Expression replaceChildren(List<Expression> newChildren)
      Specified by:
      replaceChildren in class Node<Expression>
    • value

      public Expression value()
    • lower

      public Expression lower()
    • upper

      public Expression upper()
    • includeLower

      public boolean includeLower()
    • includeUpper

      public boolean includeUpper()
    • zoneId

      public ZoneId zoneId()
    • foldable

      public boolean foldable()
      In case that the range is empty due to foldable, invalid bounds, but the bounds themselves are not yet folded, the optimizer will need two passes to fold this. That's because we shouldn't perform folding when trying to determine foldability.
      Overrides:
      foldable in class Expression
    • fold

      public Object fold(FoldContext ctx)
      Description copied from class: Expression
      Evaluate this expression statically to a constant. It is an error to call this if Expression.foldable() returns false.
      Overrides:
      fold in class Expression
    • areBoundariesInvalid

      protected boolean areBoundariesInvalid(Object lowerValue, Object upperValue)
      Check whether the boundaries are invalid ( upper < lower) or not. If they are, the value does not have to be evaluated.
    • dataType

      public DataType dataType()
      Description copied from class: Expression
      The DataType returned by executing the tree rooted at this expression. If Expression.typeResolved() returns an error then the behavior of this method is undefined. It may return a valid type. Or it may throw an exception. Or it may return a totally nonsensical type.
      Specified by:
      dataType in class Expression
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Function
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Function
    • translatable

      public TranslationAware.Translatable translatable(LucenePushdownPredicates pushdownPredicates)
      Description copied from interface: TranslationAware
      Can this instance be translated or not? Usually checks whether the expression arguments are actual fields that exist in Lucene. See TranslationAware.Translatable for precisely what can be signaled from this method.
      Specified by:
      translatable in interface TranslationAware
    • asQuery

      public Query asQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHandler handler)
      Description copied from interface: TranslationAware
      Translates the implementing expression into a Query. If during translation a child needs to be translated first, the handler needs to be used even if the child implements this interface as well. This is to ensure that the child is wrapped in a SingleValueQuery if necessary.

      So use this:

      Query childQuery = handler.asQuery(child);

      and not this:

      Query childQuery = child.asQuery(handler);

      Specified by:
      asQuery in interface TranslationAware
    • singleValueField

      public Expression singleValueField()
      Description copied from interface: TranslationAware.SingleValueTranslationAware
      Returns the field that only supports single-value semantics.
      Specified by:
      singleValueField in interface TranslationAware.SingleValueTranslationAware