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

Function test_read_partition_keys_only

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

Source from the content-addressed store, hash-verified

2237@pytest.mark.parquet
2238@pytest.mark.pandas
2239def 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
2264def _has_subdirs(basedir):

Callers

nothing calls this directly

Calls 1

read_tableMethod · 0.45

Tested by

no test coverage detected