Skip to content

[C++][Python] Auto chunking nested array containing binary-like fields result malformed output #26019

@asfimport

Description

@asfimport

In case of nested types the binary-like arrays are chunked but not the others, so after finalizing the builder the nested output array contains different length children.

   char = b'x'
   ty = pa.binary()

    v1 = char * 100000000
    v2 = char * 147483646

    struct_type = pa.struct([
        pa.field('bool', pa.bool_()),
        pa.field('integer', pa.int64()),
        pa.field('string-like', ty),
    ])

    data = [{'bool': True, 'integer': 1, 'string-like': v1}] * 20
    data.append({'bool': True, 'integer': 1, 'string-like': v2})
    arr = pa.array(data, type=struct_type)
    assert isinstance(arr, pa.Array)

    data.append({'bool': True, 'integer': 1, 'string-like': char})
    arr = pa.array(data, type=struct_type)
    assert isinstance(arr, pa.ChunkedArray)
len(arr.field(0)) == 22
len(arr.field(1)) == 22
len(arr.field(2)) == 1  # the string array gets chunked whereas the rest of the fields do not

Reporter: Krisztian Szucs / @kszucs
Assignee: Krisztian Szucs / @kszucs

Related issues:

Note: This issue was originally created as ARROW-9994. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions