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

Function test_nested_auto_chunking

python/pyarrow/tests/test_convert_builtin.py:2427–2452  ·  view source on GitHub ↗
(ty, char)

Source from the content-addressed store, hash-verified

2425 (pa.binary(), b'x'),
2426])
2427def test_nested_auto_chunking(ty, char):
2428 v1 = char * 100000000
2429 v2 = char * 147483646
2430
2431 struct_type = pa.struct([
2432 pa.field('bool', pa.bool_()),
2433 pa.field('integer', pa.int64()),
2434 pa.field('string-like', ty),
2435 ])
2436
2437 data = [{'bool': True, 'integer': 1, 'string-like': v1}] * 20
2438 data.append({'bool': True, 'integer': 1, 'string-like': v2})
2439 arr = pa.array(data, type=struct_type)
2440 assert isinstance(arr, pa.Array)
2441
2442 data.append({'bool': True, 'integer': 1, 'string-like': char})
2443 arr = pa.array(data, type=struct_type)
2444 assert isinstance(arr, pa.ChunkedArray)
2445 assert arr.num_chunks == 2
2446 assert len(arr.chunk(0)) == 21
2447 assert len(arr.chunk(1)) == 1
2448 assert arr.chunk(1)[0].as_py() == {
2449 'bool': True,
2450 'integer': 1,
2451 'string-like': char
2452 }
2453
2454
2455@pytest.mark.large_memory

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
as_pyMethod · 0.80
fieldMethod · 0.45
appendMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected