Package io.avery.vinyl
Class JoinAPI.On
java.lang.Object
io.avery.vinyl.JoinAPI.On
- Enclosing class:
JoinAPI
A sub-configurator used to define the join condition of a relational join operation. The join condition is
encoded as a
JoinPred
predicate. The strategy for evaluating the join condition is determined by how the
join condition is defined, enabling optimizations. In general, the following rules apply:
- If a predicate does not depend on left or right-side records, it may be evaluated as a pre-join check
- If a predicate depends on only left or only right-side records, it may be evaluated as a pre-join filter on the corresponding side
- If a predicate compares left-side records to right-side records via a supported comparison operator, it may be evaluated by creating an index over the right-side, and searching the index with each left-side record
- If a predicate is composed of multiple sub-predicates (via
any
/all
), a more complex evaluation strategy may be used, eg combinations of right-side indexes and filters - If no other optimization applies, a predicate may be evaluated by looping over right-side records for each left-side record
-
Method Summary
Modifier and TypeMethodDescriptionCreates aJoinPred
that passes if all of the given predicates pass.Creates aJoinPred
that passes if any of the given predicates pass.<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the test expression lies between the values of the begin and end expressions.<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the left expression compares equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the left expression compares not equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).Creates aJoinPred
that passes if the value of the left expression is equal to the value of the right expression, based onObjects.equals(Object, Object)
.<T> JoinExpr<T>
Creates aJoinExpr
that evaluates to the result of calling the given supplier.<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the left expression compares greater than the value of the right expression, based on the natural ordering of the values (nulls first/lowest).<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the left expression compares greater than or equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).<T> JoinExpr<T>
Creates aJoinExpr
that evaluates to the value associated with the given field in each left-side record.<T> JoinExpr<T>
Creates aJoinExpr
that evaluates to the result of applying the given function to each left-side record.Creates aJoinPred
that passes if the given plain predicate over left-side records passes.<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the left expression compares less than the value of the right expression, based on the natural ordering of the values (nulls first/lowest).<T extends Comparable<? super T>>
JoinPredCreates aJoinPred
that passes if the value of the left expression compares less than or equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).match
(BiPredicate<? super Record, ? super Record> predicate) Creates aJoinPred
that passes if the given plain predicate over left and right-side records passes.Creates aJoinPred
that passes if the value of the left expression is not equal to the value of the right expression, based onObjects.equals(Object, Object)
.Creates aJoinPred
that passes if the given predicate does not pass.<T> JoinExpr<T>
Creates aJoinExpr
that evaluates to the value associated with the given field in each right-side record.<T> JoinExpr<T>
Creates aJoinExpr
that evaluates to the result of applying the given function to each right-side record.rightMatch
(Predicate<? super Record> predicate) Creates aJoinPred
that passes if the given plain predicate over right-side records passes.<T> JoinExpr<T>
val
(T val) Creates aJoinExpr
that evaluates to the given value.
-
Method Details
-
left
Creates aJoinExpr
that evaluates to the value associated with the given field in each left-side record.- Type Parameters:
T
- the value type of the field- Parameters:
field
- the field whose associated value is to be returned from each right-side record- Returns:
- a
JoinExpr
that evaluates to the value associated with the given field in each left-side record - Throws:
NoSuchElementException
- if the left-side stream header does not contain the field
-
right
Creates aJoinExpr
that evaluates to the value associated with the given field in each right-side record.- Type Parameters:
T
- the value type of the field- Parameters:
field
- the field whose associated value is to be returned from each right-side record- Returns:
- a
JoinExpr
that evaluates to the value associated with the given field in each right-side record - Throws:
NoSuchElementException
- if the right-side stream header does not contain the field
-
left
Creates aJoinExpr
that evaluates to the result of applying the given function to each left-side record.- Type Parameters:
T
- the result type of the function- Parameters:
mapper
- the function to apply to each left-side record- Returns:
- a
JoinExpr
that evaluates to the result of applying the given function to each left-side record
-
right
Creates aJoinExpr
that evaluates to the result of applying the given function to each right-side record.- Type Parameters:
T
- the result type of the function- Parameters:
mapper
- the function to apply to each right-side record- Returns:
- a
JoinExpr
that evaluates to the result of applying the given function to each right-side record
-
eval
Creates aJoinExpr
that evaluates to the result of calling the given supplier. The supplier will be called at most once during the join operation.- Type Parameters:
T
- the result type of the function- Parameters:
supplier
- the value-supplying function- Returns:
- a
JoinExpr
that evaluates to the result of calling the given supplier
-
val
Creates aJoinExpr
that evaluates to the given value.- Type Parameters:
T
- the value type- Parameters:
val
- the value- Returns:
- a
JoinExpr
that evaluates to the given value
-
eq
Creates aJoinPred
that passes if the value of the left expression is equal to the value of the right expression, based onObjects.equals(Object, Object)
.- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression is not equal to the value of the right expression
-
neq
Creates aJoinPred
that passes if the value of the left expression is not equal to the value of the right expression, based onObjects.equals(Object, Object)
.- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression is not equal to the value of the right expression
-
ceq
Creates aJoinPred
that passes if the value of the left expression compares equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression compares equal to the value of the right expression
-
cneq
Creates aJoinPred
that passes if the value of the left expression compares not equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression compares not equal to the value of the right expression
-
gt
Creates aJoinPred
that passes if the value of the left expression compares greater than the value of the right expression, based on the natural ordering of the values (nulls first/lowest).- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression compares greater than the value of the right expression
-
gte
Creates aJoinPred
that passes if the value of the left expression compares greater than or equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression compares greater than or equal to the value of the right expression
-
lt
Creates aJoinPred
that passes if the value of the left expression compares less than the value of the right expression, based on the natural ordering of the values (nulls first/lowest).- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression compares less than the value of the right expression
-
lte
Creates aJoinPred
that passes if the value of the left expression compares less than or equal to the value of the right expression, based on the natural ordering of the values (nulls first/lowest).- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
left
- the left expressionright
- the right expression- Returns:
- a
JoinPred
that passes if the value of the left expression compares less than or equal to the value of the right expression
-
between
public <T extends Comparable<? super T>> JoinPred between(JoinExpr<T> test, JoinExpr<T> begin, JoinExpr<T> end) Creates aJoinPred
that passes if the value of the test expression lies between the values of the begin and end expressions. More formally, the predicate passes if the value of the test expression compares greater than or equal to the value of the begin expression and less than or equal to the value of the end expression, based on the natural ordering of the values (nulls first/lowest).This method is equivalent to:
all(gte(test, begin), lte(test, end))
- Type Parameters:
T
- the type of the evaluated expressions- Parameters:
test
- the test expressionbegin
- the begin expressionend
- the end expression- Returns:
- a
JoinPred
that passes if the value of the test expression lies between the values of the begin and end expressions
-
not
Creates aJoinPred
that passes if the given predicate does not pass.- Parameters:
predicate
- the given predicate- Returns:
- a
JoinPred
that passes if the given predicate does not pass
-
any
Creates aJoinPred
that passes if any of the given predicates pass. If no predicates are given, the resultant predicate always fails.- Parameters:
predicates
- the given predicates- Returns:
- a
JoinPred
that passes if any of the given predicates pass
-
all
Creates aJoinPred
that passes if all of the given predicates pass. If no predicates are given, the resultant predicate always passes.- Parameters:
predicates
- the given predicates- Returns:
- a
JoinPred
that passes if all of the given predicates pass
-
leftMatch
Creates aJoinPred
that passes if the given plain predicate over left-side records passes. The resultant predicate inherently depends on left-side records.- Parameters:
predicate
- the given plain predicate- Returns:
- a
JoinPred
that passes if the given plain predicate over left-side records passes.
-
rightMatch
Creates aJoinPred
that passes if the given plain predicate over right-side records passes. The resultant predicate inherently depends on right-side records.- Parameters:
predicate
- the given plain predicate- Returns:
- a
JoinPred
that passes if the given plain predicate over right-side records passes.
-
match
Creates aJoinPred
that passes if the given plain predicate over left and right-side records passes. The resultant predicate inherently depends on both left and right-side records.- Parameters:
predicate
- the given plain predicate- Returns:
- a
JoinPred
that passes if the given plain predicate over left and right-side records passes.
-