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

Function test_multiple_ix

python/pathway/tests/test_common.py:4447–4499  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4445
4446
4447def test_multiple_ix():
4448 indexed_table = T(
4449 """
4450 | col
4451 2 | a
4452 3 | b
4453 4 | c
4454 5 | d
4455 """
4456 )
4457
4458 indexer1 = T(
4459 """
4460 | key
4461 1 | 4
4462 2 | 3
4463 3 | 2
4464 4 | 1
4465 """
4466 ).with_columns(key=indexed_table.pointer_from(pw.this.key))
4467
4468 indexer2 = T(
4469 """
4470 | key
4471 1 | 6
4472 2 | 5
4473 3 | 4
4474 4 | 3
4475 """
4476 ).with_columns(key=indexed_table.pointer_from(pw.this.key))
4477
4478 a = (
4479 indexed_table.ix(indexer1.key, allow_misses=True)
4480 .filter(pw.this.col.is_not_none())
4481 .select(col1=pw.this.col)
4482 )
4483 b = (
4484 indexed_table.ix(indexer2.key, allow_misses=True)
4485 .filter(pw.this.col.is_not_none())
4486 .select(col2=pw.this.col)
4487 )
4488 result = a.intersect(b)
4489 result = a.restrict(result) + b.restrict(result)
4490 assert_table_equality_wo_index(
4491 result,
4492 T(
4493 """
4494 col1 | col2
4495 a | c
4496 b | d
4497 """
4498 ),
4499 )
4500
4501
4502def test_join_desugaring_assign_id():

Callers

nothing calls this directly

Calls 9

TFunction · 0.90
with_columnsMethod · 0.80
is_not_noneMethod · 0.80
intersectMethod · 0.80
restrictMethod · 0.80
pointer_fromMethod · 0.45
selectMethod · 0.45
filterMethod · 0.45
ixMethod · 0.45

Tested by

no test coverage detected