All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable

public abstract class RegexMatch<T extends StringPattern> extends UnaryScalarFunction
  • Constructor Details

    • RegexMatch

      protected RegexMatch(Source source, Expression value, T pattern, boolean caseInsensitive)
  • Method Details

    • pattern

      public T pattern()
    • caseInsensitive

      public boolean caseInsensitive()
    • 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
    • nullable

      public Nullability nullable()
      Overrides:
      nullable in class Function
    • resolveType

      protected Expression.TypeResolution resolveType()
      Description copied from class: Expression
      The implementation of Expression.typeResolved(), which is just a caching wrapper around this method. See it's javadoc for what this method should return.

      Implementations will rarely interact with the Expression.TypeResolution class directly, instead usually calling the utility methods on TypeResolutions.

      Implementations should fail if Expression.childrenResolved() returns false.

      Overrides:
      resolveType in class Expression
    • foldable

      public boolean foldable()
      Description copied from class: Expression
      Whether the expression can be evaluated statically, aka "folded", or not.
      Overrides:
      foldable in class UnaryScalarFunction
    • fold

      public Boolean 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.
      Specified by:
      fold in class UnaryScalarFunction
    • optimizeStringCasingWithInsensitiveRegexMatch

      public abstract Expression optimizeStringCasingWithInsensitiveRegexMatch(Expression unwrappedField, Predicate<String> matchesCaseFn)
      Returns an equivalent optimized expression taking into account the case of the pattern(s)
      Parameters:
      unwrappedField - the field with to_upper/to_lower function removed
      matchesCaseFn - a predicate to check if a pattern matches the case
      Returns:
      an optimized equivalent Expression or this if no optimization is possible
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Function