| 5314 | |
| 5315 | |
| 5316 | private final void addJoin0(TableLike<?> table, JoinType type, JoinHint hint, Object conditions, Field<?>[] partitionBy) { |
| 5317 | |
| 5318 | // TODO: This and similar methods should be refactored, patterns extracted... |
| 5319 | int index = getFrom().size() - 1; |
| 5320 | Table<?> joined = null; |
| 5321 | |
| 5322 | switch (type) { |
| 5323 | case JOIN: |
| 5324 | case STRAIGHT_JOIN: |
| 5325 | case LEFT_SEMI_JOIN: |
| 5326 | case LEFT_ANTI_JOIN: |
| 5327 | case FULL_OUTER_JOIN: { |
| 5328 | TableOptionalOnStep<Record> o = getFrom().get(index).join(table, type, hint); |
| 5329 | |
| 5330 | if (conditions instanceof Condition c) |
| 5331 | joined = o.on(c); |
| 5332 | else |
| 5333 | joined = o.on((Condition[]) conditions); |
| 5334 | |
| 5335 | break; |
| 5336 | } |
| 5337 | |
| 5338 | case LEFT_OUTER_JOIN: |
| 5339 | case RIGHT_OUTER_JOIN: { |
| 5340 | TablePartitionByStep<?> p = (TablePartitionByStep<?>) getFrom().get(index).join(table, type, hint); |
| 5341 | TableOnStep<?> o = p; |
| 5342 | |
| 5343 | |
| 5344 | |
| 5345 | |
| 5346 | if (conditions instanceof Condition c) |
| 5347 | joined = o.on(c); |
| 5348 | else |
| 5349 | joined = o.on((Condition[]) conditions); |
| 5350 | |
| 5351 | break; |
| 5352 | } |
| 5353 | |
| 5354 | // These join types don't take any ON clause. Ignore conditions. |
| 5355 | case CROSS_JOIN: |
| 5356 | case NATURAL_JOIN: |
| 5357 | case NATURAL_LEFT_OUTER_JOIN: |
| 5358 | case NATURAL_RIGHT_OUTER_JOIN: |
| 5359 | case NATURAL_FULL_OUTER_JOIN: |
| 5360 | case CROSS_APPLY: |
| 5361 | case OUTER_APPLY: |
| 5362 | joined = getFrom().get(index).join(table, type, hint); |
| 5363 | break; |
| 5364 | |
| 5365 | default: throw new IllegalArgumentException("Bad join type: " + type); |
| 5366 | } |
| 5367 | |
| 5368 | getFrom().set(index, joined); |
| 5369 | } |
| 5370 | |
| 5371 | @Override |
| 5372 | public final void addJoinOnKey(TableLike<?> table, JoinType type) throws DataAccessException { |