Class Predicates
java.lang.Object
org.elasticsearch.xpack.esql.expression.predicate.Predicates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExpressioncombineAnd(List<Expression> exps) static ExpressioncombineOr(List<Expression> exps) static org.elasticsearch.core.Tuple<Expression, List<Expression>> extractCommon(List<Expression> expressions) Given a list of expressions of predicates, extract a new expression of all the common ones and return it, along the original list with the common ones removed.static List<Expression> inCommon(List<Expression> l, List<Expression> r) static List<Expression> splitAnd(Expression exp) static List<Expression> splitOr(Expression exp) static List<Expression> subtract(List<Expression> from, List<Expression> list)
-
Constructor Details
-
Predicates
public Predicates()
-
-
Method Details
-
splitAnd
-
splitOr
-
combineOr
-
combineAnd
-
inCommon
-
subtract
-
extractCommon
public static org.elasticsearch.core.Tuple<Expression,List<Expression>> extractCommon(List<Expression> expressions) Given a list of expressions of predicates, extract a new expression of all the common ones and return it, along the original list with the common ones removed.Example: for ['field1 > 0 AND field2 > 0', 'field1 > 0 AND field3 > 0', 'field1 > 0'], the function will return 'field1 > 0' as the common predicate expression and ['field2 > 0', 'field3 > 0', Literal.TRUE] as the left predicates list.
- Parameters:
expressions- list of expressions to extract common predicates from.- Returns:
- a tuple having as the first element an expression of the common predicates and as the second element the list of expressions with the common predicates removed. If there are no common predicates, `null` will be returned as the first element and the original list as the second. If for one of the expressions in the input list, nothing is left after trimming the common predicates, it will be replaced with Literal.TRUE.
-