edponce commented on PR #12055:
URL: https://github.com/apache/arrow/pull/12055#issuecomment-1098227438

   @pitrou What I do not like about the construction of `ChunkedArray` is that 
is requires iterating through the chunks at least twice.
   
   1. When using constructor `ChunkedArray::ChunkedArray()`
   * length and null count are calculated
   * `ChunkResolver` needs to compute chunk offsets
   
   2. When using `ChunkedArray::Make()`
   * chunk types are validated
   * call `ChunkedArray` constructor (so 2 more chunk passes)
   
   For case (1), a not-so-nice solution is for `ChunkResolver` to internally 
calculate length and null_count and provide methods to access them. Then, 
`ChunkedArray` can get those values, but `ChunkResolver` does not needs these 
values so it breaks separation of concerns.
   
   For case (2), we can calculate length and null_count while validating chunk 
types, then invoke a private constructor that also takes length and null_count 
arguments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to