MCPcopy
hub / github.com/pathwaycom/pathway / test_left_join_03

Function test_left_join_03

python/pathway/tests/test_joins.py:185–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

183# as opposed to test 2, column t1_A2 can be computed out of columns of t1
184# as such, it should be filled, even if there was no match
185def test_left_join_03():
186 t1 = T(
187 """
188 | a | b
189 1 | 11 | 111
190 2 | 12 | 112
191 3 | 13 | 113
192 4 | 14 | 114
193 """
194 )
195
196 t2 = T(
197 """
198 | c | d
199 1 | 11 | 211
200 2 | 12 | 212
201 3 | 13 | 213
202 4 | 13 | 214
203 """
204 )
205
206 expected = T(
207 """
208 a | t1_a2 | s
209 11 | 121 | 322
210 12 | 144 | 324
211 13 | 169 | 326
212 13 | 169 | 327
213 14 | 196 |
214 """
215 )
216
217 res = t1.join_left(t2, t1.a == t2.c).select(
218 t1.a,
219 t1_a2=t1.a * t1.a,
220 s=pw.require(t1.b + t2.d, t2.id),
221 )
222 assert_table_equality_wo_index(res, expected)
223
224
225def test_right_join_01():

Callers

nothing calls this directly

Calls 3

TFunction · 0.90
join_leftMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected