[jOOQ/jOOQ#12324] Wrong (+) to LEFT JOIN transformation in join tree A⟕B, A⟕C, A⋈D
This commit is contained in:
parent
2cd86dfd65
commit
6dd904d3d4
@ -2934,6 +2934,17 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -260,6 +260,7 @@ import org.jooq.ForeignKey;
|
||||
import org.jooq.JSON;
|
||||
import org.jooq.JSONB;
|
||||
import org.jooq.JSONEntry;
|
||||
import org.jooq.JoinType;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.OrderField;
|
||||
import org.jooq.Param;
|
||||
@ -6282,20 +6283,37 @@ final class Tools {
|
||||
T result,
|
||||
Predicate<? super T> abort,
|
||||
BiFunction<? super T, ? super Table<?>, ? extends T> function
|
||||
) {
|
||||
return traverseJoins(t, result, abort, null, function);
|
||||
}
|
||||
|
||||
static final <T> T traverseJoins(
|
||||
Table<?> t,
|
||||
T result,
|
||||
Predicate<? super T> abort,
|
||||
BiFunction<? super T, ? super JoinType, ? extends T> joinTypeFunction,
|
||||
BiFunction<? super T, ? super Table<?>, ? extends T> tableFunction
|
||||
) {
|
||||
if (abort.test(result))
|
||||
return result;
|
||||
|
||||
if (t instanceof JoinTable) {
|
||||
result = traverseJoins(((JoinTable) t).lhs, result, abort, function);
|
||||
result = traverseJoins(((JoinTable) t).lhs, result, abort, joinTypeFunction, tableFunction);
|
||||
|
||||
if (abort.test(result))
|
||||
return result;
|
||||
|
||||
result = traverseJoins(((JoinTable) t).rhs, result, abort, function);
|
||||
if (joinTypeFunction != null) {
|
||||
result = joinTypeFunction.apply(result, ((JoinTable) t).type);
|
||||
|
||||
if (abort.test(result))
|
||||
return result;
|
||||
}
|
||||
|
||||
result = traverseJoins(((JoinTable) t).rhs, result, abort, joinTypeFunction, tableFunction);
|
||||
}
|
||||
else
|
||||
result = function.apply(result, t);
|
||||
else if (tableFunction != null)
|
||||
result = tableFunction.apply(result, t);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user