MCPcopy Create free account
hub / github.com/apache/arrow / test_dataset_join

Function test_dataset_join

python/pyarrow/tests/test_dataset.py:5293–5320  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

5291
5292@pytest.mark.dataset
5293def test_dataset_join(tempdir):
5294 t1 = pa.table({
5295 "colA": [1, 2, 6],
5296 "col2": ["a", "b", "f"]
5297 })
5298 ds.write_dataset(t1, tempdir / "t1", format="ipc")
5299 ds1 = ds.dataset(tempdir / "t1", format="ipc")
5300
5301 t2 = pa.table({
5302 "colB": [99, 2, 1],
5303 "col3": ["Z", "B", "A"]
5304 })
5305 ds.write_dataset(t2, tempdir / "t2", format="ipc")
5306 ds2 = ds.dataset(tempdir / "t2", format="ipc")
5307
5308 result = ds1.join(ds2, "colA", "colB")
5309 assert result.to_table() == pa.table({
5310 "colA": [1, 2, 6],
5311 "col2": ["a", "b", "f"],
5312 "col3": ["A", "B", None]
5313 })
5314
5315 result = ds1.join(ds2, "colA", "colB", join_type="full outer")
5316 assert result.to_table().sort_by("colA") == pa.table({
5317 "colA": [1, 2, 6, 99],
5318 "col2": ["a", "b", "f", None],
5319 "col3": ["A", "B", None, "Z"]
5320 })
5321
5322
5323@pytest.mark.dataset

Callers

nothing calls this directly

Calls 2

joinMethod · 0.45
to_tableMethod · 0.45

Tested by

no test coverage detected