Inner-joins two tables or join results. Args: other: the right side of the join, ``Table`` or ``JoinResult``. on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: ColumnRefere
(
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,
)
| 205 | @desugar(substitution={thisclass.left: "self", thisclass.right: "other"}) |
| 206 | @arg_handler(handler=join_kwargs_handler(allow_how=False, allow_id=True)) |
| 207 | def join_inner( |
| 208 | self, |
| 209 | other: Joinable, |
| 210 | *on: expr.ColumnExpression, |
| 211 | id: expr.ColumnReference | None = None, |
| 212 | left_instance: expr.ColumnReference | None = None, |
| 213 | right_instance: expr.ColumnReference | None = None, |
| 214 | left_exactly_once: bool = False, |
| 215 | right_exactly_once: bool = False, |
| 216 | ) -> JoinResult: |
| 217 | """Inner-joins two tables or join results. |
| 218 | |
| 219 | Args: |
| 220 | other: the right side of the join, ``Table`` or ``JoinResult``. |
| 221 | on: a list of column expressions. Each must have == as the top level operation |
| 222 | and be of the form LHS: ColumnReference == RHS: ColumnReference. |
| 223 | id: optional argument for id of result, can be only self.id or other.id |
| 224 | left_instance/right_instance: optional arguments describing partitioning of the data |
| 225 | into separate instances |
| 226 | left_exactly_once: if you can guarantee that each row on the left side of the join will be |
| 227 | joined at most once, then you can set this parameter to ``True``. Then each row after |
| 228 | getting a match is removed from the join state. As a result, less memory is needed. |
| 229 | Works only for append-only tables. |
| 230 | right_exactly_once: if you can guarantee that each row on the right side of the join will be |
| 231 | joined at most once, then you can set this parameter to ``True``. Then each row after |
| 232 | getting a match is removed from the join state. As a result, less memory is needed. |
| 233 | Works only for append-only tables. |
| 234 | |
| 235 | Returns: |
| 236 | JoinResult: an object on which `.select()` may be called to extract relevant |
| 237 | columns from the result of the join. |
| 238 | |
| 239 | Example: |
| 240 | |
| 241 | >>> import pathway as pw |
| 242 | >>> t1 = pw.debug.table_from_markdown(''' |
| 243 | ... age | owner | pet |
| 244 | ... 10 | Alice | 1 |
| 245 | ... 9 | Bob | 1 |
| 246 | ... 8 | Alice | 2 |
| 247 | ... ''') |
| 248 | >>> t2 = pw.debug.table_from_markdown(''' |
| 249 | ... age | owner | pet | size |
| 250 | ... 10 | Alice | 3 | M |
| 251 | ... 9 | Bob | 1 | L |
| 252 | ... 8 | Tom | 1 | XL |
| 253 | ... ''') |
| 254 | >>> t3 = t1.join_inner(t2, t1.pet == t2.pet, t1.owner == t2.owner).select( |
| 255 | ... age=t1.age, owner_name=t2.owner, size=t2.size |
| 256 | ... ) |
| 257 | >>> pw.debug.compute_and_print(t3, include_id = False) |
| 258 | age | owner_name | size |
| 259 | 9 | Bob | L |
| 260 | """ |
| 261 | return JoinResult._table_join( |
| 262 | self, |
| 263 | other, |
| 264 | *on, |
no test coverage detected