Skip to content

[MATLAB] Add validation logic for offsets and values to arrow.array.ListArray.fromArrays #38361

@kevingurney

Description

@kevingurney

Describe the enhancement requested

Currently,arrow.array.ListArray.fromArrays does not validate the supplied offsets and values to ensure that they represent a valid list. This can result in ListArrays that look like the following:

>> offsets = arrow.array(int32([0, 2, 3, 7, 100]))               

offsets = 

[
  0,
  2,
  3,
  7,
  100
]

>> values = arrow.array(["A", "B", "C", "D", "E", "F", "G"])     

values = 

[
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G"
]

>> arrowArray = arrow.array.ListArray.fromArrays(offsets, values)

arrowArray = 

<Invalid array: Length spanned by list offsets (100) larger than values array (length 7)>

We should add support for validating offsets and values to arrow.array.ListArray.fromArrays and potentially provide a name-value pair like ValidateList = true | false to the fromArrays method to let client code control whether or not they want to pay the cost of validation.

Component(s)

MATLAB

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions