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

Function test_hive_partitioning_dictionary_key

python/pyarrow/tests/test_dataset.py:2365–2390  ·  view source on GitHub ↗
(multisourcefs)

Source from the content-addressed store, hash-verified

2363
2364
2365def test_hive_partitioning_dictionary_key(multisourcefs):
2366 # ARROW-8088 specifying partition key as dictionary type
2367 schema = pa.schema([
2368 pa.field('year', pa.dictionary(pa.int8(), pa.int16())),
2369 pa.field('month', pa.dictionary(pa.int8(), pa.int16()))
2370 ])
2371 part = ds.HivePartitioning.discover(schema=schema)
2372
2373 dataset = ds.dataset(
2374 "hive", format="parquet", filesystem=multisourcefs, partitioning=part
2375 )
2376 assert dataset.partitioning.schema == schema
2377 table = dataset.to_table()
2378
2379 year_dictionary = list(range(2006, 2011))
2380 month_dictionary = list(range(1, 13))
2381 assert table.column('year').type.equals(schema.types[0])
2382 for chunk in table.column('year').chunks:
2383 actual = chunk.dictionary.to_pylist()
2384 actual.sort()
2385 assert actual == year_dictionary
2386 assert table.column('month').type.equals(schema.types[1])
2387 for chunk in table.column('month').chunks:
2388 actual = chunk.dictionary.to_pylist()
2389 actual.sort()
2390 assert actual == month_dictionary
2391
2392
2393def _create_single_file(base_dir, table=None, row_group_size=None):

Callers

nothing calls this directly

Calls 7

listFunction · 0.85
equalsMethod · 0.80
schemaMethod · 0.45
fieldMethod · 0.45
dictionaryMethod · 0.45
to_tableMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected