You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/12/24 10:23:25 UTC

[GitHub] [incubator-doris] chaoyli commented on issue #5142: Optimize nested type implementation

chaoyli commented on issue #5142:
URL: https://github.com/apache/incubator-doris/issues/5142#issuecomment-750837917


   To better understand and reduce copy in memory for **array_contains, array_slice, flatten** function.
   It's better to distinguish the memory layout and disk layout.
   ```
   The memory layout:
    
   Two-level data : [[1, 2], [3, 4]], [[5, 6, 7], null, [8]], [[9, 10]]
   
   * First Level Offsets (int32), First Level have no nulls
   
     | Bytes 0-3  | Bytes 4-7  | Bytes 8-11 | Bytes 12-15 |
     |------------|------------|------------|-------------|
     | 0          |  2         |  5         |  6          |
   
     * Second Nulls (uint8)
   
       | Byte 1- 3 | Bytes 4  | Bytes 5 - 7|
       |-----------------------------------|
       | 0         | 1        | 0          |
   
     * Second Level Offsets (int32)
   
       | Bytes 0-27           |
       |----------------------|
       | 0, 2, 4, 7, 7, 8, 10 |
   
     * Elements array (int32):
   
       | Bytes 0-9                     |
       |-------------------------------|
       | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 |
   ```
   Like the above, every level in array only stores nulls and offsets.
   And also, offsets will store zero to calculate the first size.
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org