(tempdir)
| 4896 | |
| 4897 | |
| 4898 | def 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 |
nothing calls this directly
no test coverage detected