(
self,
table: pw.Table,
key: pw.ColumnExpression,
behavior: Behavior | None,
instance: pw.ColumnExpression | None,
)
| 106 | |
| 107 | @check_arg_types |
| 108 | def _apply( |
| 109 | self, |
| 110 | table: pw.Table, |
| 111 | key: pw.ColumnExpression, |
| 112 | behavior: Behavior | None, |
| 113 | instance: pw.ColumnExpression | None, |
| 114 | ) -> pw.GroupedTable: |
| 115 | if self.max_gap is not None: |
| 116 | check_joint_types( |
| 117 | { |
| 118 | "time_expr": (key, TimeEventType), |
| 119 | "window.max_gap": (self.max_gap, IntervalType), |
| 120 | } |
| 121 | ) |
| 122 | |
| 123 | target = self._compute_group_repr(table, key, instance) |
| 124 | tmp = target.groupby(target._pw_window).reduce( |
| 125 | _pw_window_start=pw.reducers.min(key), |
| 126 | _pw_window_end=pw.reducers.max(key), |
| 127 | ) |
| 128 | |
| 129 | gb = table.with_columns( |
| 130 | target._pw_window, |
| 131 | tmp.ix_ref(target._pw_window)._pw_window_start, |
| 132 | tmp.ix_ref(target._pw_window)._pw_window_end, |
| 133 | _pw_instance=instance, |
| 134 | _pw_original_id=pw.this.id, |
| 135 | ).groupby( |
| 136 | pw.this._pw_window, |
| 137 | pw.this._pw_window_start, |
| 138 | pw.this._pw_window_end, |
| 139 | pw.this._pw_instance, |
| 140 | instance=pw.this._pw_instance if instance is not None else None, |
| 141 | _is_window=True, |
| 142 | ) |
| 143 | |
| 144 | return gb |
| 145 | |
| 146 | @check_arg_types |
| 147 | def _join( |
nothing calls this directly
no test coverage detected