(tempdir)
| 2237 | @pytest.mark.parquet |
| 2238 | @pytest.mark.pandas |
| 2239 | def test_read_partition_keys_only(tempdir): |
| 2240 | BATCH_SIZE = 2 ** 15 |
| 2241 | # This is a regression test for ARROW-15318 which saw issues |
| 2242 | # reading only the partition keys from files with batches larger |
| 2243 | # than the default batch size (e.g. so we need to return two chunks) |
| 2244 | table = pa.table({ |
| 2245 | 'key': pa.repeat(0, BATCH_SIZE + 1), |
| 2246 | 'value': np.arange(BATCH_SIZE + 1)}) |
| 2247 | pq.write_to_dataset( |
| 2248 | table[:BATCH_SIZE], |
| 2249 | tempdir / 'one', partition_cols=['key']) |
| 2250 | pq.write_to_dataset( |
| 2251 | table[:BATCH_SIZE + 1], |
| 2252 | tempdir / 'two', partition_cols=['key']) |
| 2253 | |
| 2254 | table = pq.read_table(tempdir / 'one', columns=['key']) |
| 2255 | assert table['key'].num_chunks == 1 |
| 2256 | |
| 2257 | table = pq.read_table(tempdir / 'two', columns=['key', 'value']) |
| 2258 | assert table['key'].num_chunks == 2 |
| 2259 | |
| 2260 | table = pq.read_table(tempdir / 'two', columns=['key']) |
| 2261 | assert table['key'].num_chunks == 2 |
| 2262 | |
| 2263 | |
| 2264 | def _has_subdirs(basedir): |
nothing calls this directly
no test coverage detected