Outer-joins two tables or join results. Args: other: the right side of the join, ``Table`` or ``JoinResult``. *on: Columns to join, syntax `self.col1 == other.col2` id: optional id column of the result left_instance/right_instance: o
(
self,
other: Joinable,
*on: expr.ColumnExpression,
id: expr.ColumnReference | None = None,
left_instance: expr.ColumnReference | None = None,
right_instance: expr.ColumnReference | None = None,
left_exactly_once: bool = False,
right_exactly_once: bool = False,
)
| 363 | @desugar(substitution={thisclass.left: "self", thisclass.right: "other"}) |
| 364 | @arg_handler(handler=join_kwargs_handler(allow_how=False, allow_id=True)) |
| 365 | def join_right( |
| 366 | self, |
| 367 | other: Joinable, |
| 368 | *on: expr.ColumnExpression, |
| 369 | id: expr.ColumnReference | None = None, |
| 370 | left_instance: expr.ColumnReference | None = None, |
| 371 | right_instance: expr.ColumnReference | None = None, |
| 372 | left_exactly_once: bool = False, |
| 373 | right_exactly_once: bool = False, |
| 374 | ) -> JoinResult: |
| 375 | """ |
| 376 | Outer-joins two tables or join results. |
| 377 | |
| 378 | Args: |
| 379 | other: the right side of the join, ``Table`` or ``JoinResult``. |
| 380 | *on: Columns to join, syntax `self.col1 == other.col2` |
| 381 | id: optional id column of the result |
| 382 | left_instance/right_instance: optional arguments describing partitioning of the data into separate |
| 383 | instances |
| 384 | left_exactly_once: if you can guarantee that each row on the left side of the join will be |
| 385 | joined at most once, then you can set this parameter to ``True``. Then each row after |
| 386 | getting a match is removed from the join state. As a result, less memory is needed. |
| 387 | Works only for append-only tables. |
| 388 | right_exactly_once: if you can guarantee that each row on the right side of the join will be |
| 389 | joined at most once, then you can set this parameter to ``True``. Then each row after |
| 390 | getting a match is removed from the join state. As a result, less memory is needed. |
| 391 | Works only for append-only tables. |
| 392 | |
| 393 | Remarks: args cannot contain id column from either of tables, \ |
| 394 | as the result table has id column with auto-generated ids; \ |
| 395 | it can be selected by assigning it to a column with defined \ |
| 396 | name (passed in kwargs) |
| 397 | |
| 398 | Behavior: |
| 399 | - rows from the left side that were not matched with the right side are skipped |
| 400 | - for rows from the right side that were not matched with the left side, |
| 401 | missing values on the left are replaced with `None` |
| 402 | - for rows that were matched the behavior is the same as that of an inner join. |
| 403 | |
| 404 | Returns: |
| 405 | JoinResult: an object on which `.select()` may be called to extract relevant |
| 406 | columns from the result of the join. |
| 407 | |
| 408 | Example: |
| 409 | |
| 410 | >>> import pathway as pw |
| 411 | >>> t1 = pw.debug.table_from_markdown( |
| 412 | ... ''' |
| 413 | ... | a | b |
| 414 | ... 1 | 11 | 111 |
| 415 | ... 2 | 12 | 112 |
| 416 | ... 3 | 13 | 113 |
| 417 | ... 4 | 13 | 114 |
| 418 | ... ''' |
| 419 | ... ) |
| 420 | >>> t2 = pw.debug.table_from_markdown( |
| 421 | ... ''' |
| 422 | ... | c | d |