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

Function test_left_join_01

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

Source from the content-addressed store, hash-verified

21
22# all entries match, should work as inner join
23def test_left_join_01():
24 t1 = T(
25 """
26 | a | b
27 1 | 11 | 111
28 2 | 12 | 112
29 3 | 13 | 113
30 4 | 14 | 114
31 """
32 )
33
34 t2 = T(
35 """
36 | a | d
37 1 | 11 | 211
38 2 | 12 | 212
39 3 | 13 | 213
40 4 | 14 | 214
41 """
42 )
43
44 expected = T(
45 """
46 a | t2_a | s
47 11 | 11 | 322
48 12 | 12 | 324
49 13 | 13 | 326
50 14 | 14 | 328
51 """
52 ).update_types(
53 s=Optional[int],
54 t2_a=Optional[int],
55 )
56
57 res = t1.join_left(t2, t1.a == t2.a).select(
58 t1.a,
59 t2_a=t2.a,
60 s=pw.require(t1.b + t2.d, t1.id, t2.id),
61 )
62 assert_table_equality_wo_index(res, expected)
63
64
65def test_left_join_universe_asserts():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
update_typesMethod · 0.80
join_leftMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected