| 4505 | return self._join_via_get_indexer(other, how, sort) |
| 4506 | |
| 4507 | def _join_empty( |
| 4508 | self, other: Index, how: JoinHow, sort: bool |
| 4509 | ) -> tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]: |
| 4510 | assert len(self) == 0 or len(other) == 0 |
| 4511 | _validate_join_method(how) |
| 4512 | |
| 4513 | lidx: np.ndarray | None |
| 4514 | ridx: np.ndarray | None |
| 4515 | |
| 4516 | if len(other): |
| 4517 | how = cast(JoinHow, {"left": "right", "right": "left"}.get(how, how)) |
| 4518 | join_index, ridx, lidx = other._join_empty(self, how, sort) |
| 4519 | elif how in ["left", "outer"]: |
| 4520 | if sort and not self.is_monotonic_increasing: |
| 4521 | lidx = self.argsort() |
| 4522 | join_index = self.take(lidx) |
| 4523 | else: |
| 4524 | lidx = None |
| 4525 | join_index = self._view() |
| 4526 | ridx = np.broadcast_to(np.intp(-1), len(join_index)) |
| 4527 | else: |
| 4528 | join_index = other._view() |
| 4529 | lidx = np.array([], dtype=np.intp) |
| 4530 | ridx = None |
| 4531 | return join_index, lidx, ridx |
| 4532 | |
| 4533 | @final |
| 4534 | def _join_via_get_indexer( |