Left-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: op
(
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,
)
| 274 | @desugar(substitution={thisclass.left: "self", thisclass.right: "other"}) |
| 275 | @arg_handler(handler=join_kwargs_handler(allow_how=False, allow_id=True)) |
| 276 | def join_left( |
| 277 | self, |
| 278 | other: Joinable, |
| 279 | *on: expr.ColumnExpression, |
| 280 | id: expr.ColumnReference | None = None, |
| 281 | left_instance: expr.ColumnReference | None = None, |
| 282 | right_instance: expr.ColumnReference | None = None, |
| 283 | left_exactly_once: bool = False, |
| 284 | right_exactly_once: bool = False, |
| 285 | ) -> JoinResult: |
| 286 | """ |
| 287 | Left-joins two tables or join results. |
| 288 | |
| 289 | Args: |
| 290 | other: the right side of the join, ``Table`` or ``JoinResult``. |
| 291 | *on: Columns to join, syntax `self.col1 == other.col2` |
| 292 | id: optional id column of the result |
| 293 | left_instance/right_instance: optional arguments describing partitioning of the data into |
| 294 | separate instances |
| 295 | left_exactly_once: if you can guarantee that each row on the left side of the join will be |
| 296 | joined at most once, then you can set this parameter to ``True``. Then each row after |
| 297 | getting a match is removed from the join state. As a result, less memory is needed. |
| 298 | Works only for append-only tables. |
| 299 | right_exactly_once: if you can guarantee that each row on the right side of the join will be |
| 300 | joined at most once, then you can set this parameter to ``True``. Then each row after |
| 301 | getting a match is removed from the join state. As a result, less memory is needed. |
| 302 | Works only for append-only tables. |
| 303 | |
| 304 | Remarks: |
| 305 | args cannot contain id column from either of tables, \ |
| 306 | as the result table has id column with auto-generated ids; \ |
| 307 | it can be selected by assigning it to a column with defined \ |
| 308 | name (passed in kwargs) |
| 309 | |
| 310 | Behavior: |
| 311 | - for rows from the left side that were not matched with the right side, |
| 312 | missing values on the right are replaced with `None` |
| 313 | - rows from the right side that were not matched with the left side are skipped |
| 314 | - for rows that were matched the behavior is the same as that of an inner join. |
| 315 | |
| 316 | Returns: |
| 317 | JoinResult: an object on which `.select()` may be called to extract relevant |
| 318 | columns from the result of the join. |
| 319 | |
| 320 | Example: |
| 321 | |
| 322 | >>> import pathway as pw |
| 323 | >>> t1 = pw.debug.table_from_markdown( |
| 324 | ... ''' |
| 325 | ... | a | b |
| 326 | ... 1 | 11 | 111 |
| 327 | ... 2 | 12 | 112 |
| 328 | ... 3 | 13 | 113 |
| 329 | ... 4 | 13 | 114 |
| 330 | ... ''' |
| 331 | ... ) |
| 332 | >>> t2 = pw.debug.table_from_markdown( |
| 333 | ... ''' |