(
self,
table: pw.Table,
key: pw.ColumnExpression,
behavior: CommonBehavior | None,
instance: pw.ColumnExpression | None,
)
| 425 | |
| 426 | @check_arg_types |
| 427 | def _apply( |
| 428 | self, |
| 429 | table: pw.Table, |
| 430 | key: pw.ColumnExpression, |
| 431 | behavior: CommonBehavior | None, |
| 432 | instance: pw.ColumnExpression | None, |
| 433 | ) -> pw.GroupedTable: |
| 434 | if not isinstance(self.at.table, pw.Table): |
| 435 | at_table = table |
| 436 | at = table[self.at] |
| 437 | elif self.at.table == table: |
| 438 | at_table = self.at.table.copy() |
| 439 | at = at_table[self.at.name] |
| 440 | else: |
| 441 | at_table = self.at.table |
| 442 | at = self.at |
| 443 | |
| 444 | check_joint_types( |
| 445 | { |
| 446 | "time_expr": (key, TimeEventType), |
| 447 | "window.lower_bound": (self.lower_bound, IntervalType), |
| 448 | "window.upper_bound": (self.upper_bound, IntervalType), |
| 449 | "window.at": (at, TimeEventType), |
| 450 | } |
| 451 | ) |
| 452 | |
| 453 | return ( |
| 454 | interval_join( |
| 455 | at_table, |
| 456 | table, |
| 457 | at, |
| 458 | key, |
| 459 | interval(self.lower_bound, self.upper_bound), # type: ignore[arg-type] |
| 460 | how=pw.JoinMode.LEFT if self.is_outer else pw.JoinMode.INNER, |
| 461 | ) |
| 462 | .select( |
| 463 | _pw_window_location=pw.left[at.name], |
| 464 | _pw_window_start=pw.left[at.name] + self.lower_bound, |
| 465 | _pw_window_end=pw.left[at.name] + self.upper_bound, |
| 466 | _pw_instance=instance, |
| 467 | _pw_key=key, |
| 468 | _pw_original_id=pw.right.id, |
| 469 | *pw.right, |
| 470 | ) |
| 471 | .groupby( |
| 472 | pw.this._pw_window_location, |
| 473 | pw.this._pw_window_start, |
| 474 | pw.this._pw_window_end, |
| 475 | pw.this._pw_instance, |
| 476 | instance=pw.this._pw_instance if instance is not None else None, |
| 477 | sort_by=pw.this._pw_key, |
| 478 | _is_window=True, |
| 479 | ) |
| 480 | ) |
| 481 | |
| 482 | @check_arg_types |
| 483 | def _join( |
nothing calls this directly
no test coverage detected