| 1158 | |
| 1159 | |
| 1160 | def test_dataset_read_dictionary(tempdir): |
| 1161 | path = tempdir / "ARROW-3325-dataset" |
| 1162 | t1 = pa.table([[util.rands(10) for i in range(5)] * 10], names=['f0']) |
| 1163 | t2 = pa.table([[util.rands(10) for i in range(5)] * 10], names=['f0']) |
| 1164 | pq.write_to_dataset(t1, root_path=str(path)) |
| 1165 | pq.write_to_dataset(t2, root_path=str(path)) |
| 1166 | |
| 1167 | result = pq.ParquetDataset( |
| 1168 | path, read_dictionary=['f0']).read() |
| 1169 | |
| 1170 | # The order of the chunks is non-deterministic |
| 1171 | ex_chunks = [t1[0].chunk(0).dictionary_encode(), |
| 1172 | t2[0].chunk(0).dictionary_encode()] |
| 1173 | |
| 1174 | assert result[0].num_chunks == 2 |
| 1175 | c0, c1 = result[0].chunk(0), result[0].chunk(1) |
| 1176 | if c0.equals(ex_chunks[0]): |
| 1177 | assert c1.equals(ex_chunks[1]) |
| 1178 | else: |
| 1179 | assert c0.equals(ex_chunks[1]) |
| 1180 | assert c1.equals(ex_chunks[0]) |
| 1181 | |
| 1182 | |
| 1183 | def test_read_table_schema(tempdir): |