MCPcopy Index your code
hub / github.com/pathwaycom/pathway / _join

Method _join

python/pathway/stdlib/temporal/_window.py:147–254  ·  view source on GitHub ↗
(
        self,
        left: pw.Table,
        right: pw.Table,
        left_time_expression: pw.ColumnExpression,
        right_time_expression: pw.ColumnExpression,
        *on: pw.ColumnExpression,
        mode: pw.JoinMode,
        left_instance: pw.ColumnReference | None = None,
        right_instance: pw.ColumnReference | None = None,
    )

Source from the content-addressed store, hash-verified

145
146 @check_arg_types
147 def _join(
148 self,
149 left: pw.Table,
150 right: pw.Table,
151 left_time_expression: pw.ColumnExpression,
152 right_time_expression: pw.ColumnExpression,
153 *on: pw.ColumnExpression,
154 mode: pw.JoinMode,
155 left_instance: pw.ColumnReference | None = None,
156 right_instance: pw.ColumnReference | None = None,
157 ) -> WindowJoinResult:
158 def maybe_make_tuple(
159 conditions: Sequence[pw.ColumnExpression],
160 ) -> pw.ColumnExpression:
161 if len(conditions) > 1:
162 return pw.make_tuple(*conditions)
163 elif len(conditions) == 1:
164 return conditions[0]
165 else:
166 return None # type: ignore
167
168 check_joint_types(
169 {
170 "left_time_expression": (left_time_expression, TimeEventType),
171 "right_time_expression": (right_time_expression, TimeEventType),
172 "window.max_gap": (self.max_gap, IntervalType),
173 }
174 )
175
176 if left_instance is not None and right_instance is not None:
177 on = (*on, left_instance == right_instance)
178 else:
179 assert left_instance is None and right_instance is None
180
181 left_on: list[pw.ColumnReference] = []
182 right_on: list[pw.ColumnReference] = []
183 for cond in on:
184 cond_left, cond_right, _ = validate_join_condition(cond, left, right)
185 left_on.append(cond_left)
186 right_on.append(cond_right)
187
188 concatenated_events = pw.Table.concat_reindex(
189 left.select(
190 key=left_time_expression,
191 instance=maybe_make_tuple(left_on),
192 is_left=True,
193 original_id=left.id,
194 ),
195 right.select(
196 key=right_time_expression,
197 instance=maybe_make_tuple(right_on),
198 is_left=False,
199 original_id=right.id,
200 ),
201 )
202 group_repr = self._compute_group_repr(
203 concatenated_events, concatenated_events.key, concatenated_events.instance
204 )

Callers

nothing calls this directly

Calls 14

_compute_group_reprMethod · 0.95
validate_join_conditionFunction · 0.90
check_joint_typesFunction · 0.85
WindowJoinResultClass · 0.85
concat_reindexMethod · 0.80
with_columnsMethod · 0.80
with_universe_ofMethod · 0.80
with_idMethod · 0.80
_table_joinMethod · 0.80
selectMethod · 0.45
reduceMethod · 0.45
groupbyMethod · 0.45

Tested by

no test coverage detected