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

Function test_chunked_array_unify_dictionaries

python/pyarrow/tests/test_table.py:483–494  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

481
482
483def test_chunked_array_unify_dictionaries():
484 arr = pa.chunked_array([
485 pa.array(["foo", "bar", None, "foo"]).dictionary_encode(),
486 pa.array(["quux", None, "foo"]).dictionary_encode(),
487 ])
488 assert arr.chunk(0).dictionary.equals(pa.array(["foo", "bar"]))
489 assert arr.chunk(1).dictionary.equals(pa.array(["quux", "foo"]))
490 arr = arr.unify_dictionaries()
491 expected_dict = pa.array(["foo", "bar", "quux"])
492 assert arr.chunk(0).dictionary.equals(expected_dict)
493 assert arr.chunk(1).dictionary.equals(expected_dict)
494 assert arr.to_pylist() == ["foo", "bar", None, "foo", "quux", None, "foo"]
495
496
497def test_recordbatch_dunder_init():

Callers

nothing calls this directly

Calls 3

chunked_arrayMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected