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

Function test_write_table_partitioned_dict

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

Source from the content-addressed store, hash-verified

4896
4897
4898def test_write_table_partitioned_dict(tempdir):
4899 # ensure writing table partitioned on a dictionary column works without
4900 # specifying the dictionary values explicitly
4901 table = pa.table([
4902 pa.array(range(20)),
4903 pa.array(['a'] * 10 + ['b'] * 10).dictionary_encode(),
4904 ], names=['col', 'part'])
4905
4906 partitioning = ds.partitioning(table.select(["part"]).schema)
4907
4908 base_dir = tempdir / "dataset"
4909 ds.write_dataset(
4910 table, base_dir, format="feather", partitioning=partitioning
4911 )
4912
4913 # check roundtrip
4914 partitioning_read = ds.DirectoryPartitioning.discover(
4915 ["part"], infer_dictionary=True)
4916 result = ds.dataset(
4917 base_dir, format="ipc", partitioning=partitioning_read
4918 ).to_table()
4919 assert result.equals(table)
4920
4921
4922@pytest.mark.numpy

Callers

nothing calls this directly

Calls 5

partitioningMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45
selectMethod · 0.45
to_tableMethod · 0.45

Tested by

no test coverage detected