pdidev / pdi

The PDI Data Interface
https://pdi.dev
BSD 3-Clause "New" or "Revised" License
6 stars 0 forks source link

Array_view should return Ref when indexed #420

Open jbigot opened 2 years ago

jbigot commented 2 years ago

In GitLab by @ksiero on Apr 11, 2022, 11:25

I was struggling over a week with indexing an Array_view, but I think I have found missing puzzle.

Basically an Array_view holds 2 information:

  1. Size with all dimensions of the view.
  2. List of chunk datatypes (one chunk datatype for each Ref (with array datatype) that is part of the Array_view).

Right now index method returns pair with moved pointer and new datatype.

In case of indexing Array_view we want to return new Ref (we should reuse Referenced_buffer with the same pointer but with changed list of chunks). So ideally the indexing should not move the pointer itself, but change the size of Array_view and chunk datatypes in the list in that way, when we want the Refs from the Array_view with chunk datatypes then we get correctly moved pointers from them.

This is fundamental change of relation between Datatype and Ref. Unfortunately I don't have time to design it and implement. What I am leaving is the Chunk_datatype that is already tested and Array_view that is partly implemented and partly tested on branch view_datatype.

jbigot commented 2 years ago

Thank you for these design guidelines!