Internals
Complex Types
#### String Vectors {#docs:internals:vector::string-vectors}  
To efficiently store strings, we make use of our `string_t` class.  
```cpp
struct string_t {
union {
struct {
uint32_t length;
char prefix[4];
char *ptr;
} pointer;
struct {
uint32_t length;
char inlined[12];
} inlined;
} value;
};
```  
Short strings (` <= 12 bytes`) are inlined into the structure, while larger strings are stored with a pointer to the data in the auxiliary string buffer. The length is used throughout the functions to avoid having to call `strlen` and having to continuously check for null-pointers. The prefix is used for comparisons as an early out (when the prefix does not match, we know the strings are not equal and don't need to chase any pointers).  
#### List Vectors {#docs:internals:vector::list-vectors}  
List vectors are stored as a series of *list entries* together with a child Vector. The child vector contains the *values* that are present in the list, and the list entries specify how each individual list is constructed.  
```cpp
struct list_entry_t {
idx_t offset;
idx_t length;
};
```  
The offset refers to the start row in the child Vector, the length keeps track of the size of the list of this row.  
List vectors can be stored recursively. For nested list vectors, the child of a list vector is again a list vector.  
For example, consider this mock representation of a Vector of type `BIGINT[][]`:  
```json
{
"type": "list",
"data": "list_entry_t",
"child": {
"type": "list",
"data": "list_entry_t",
"child": {
"type": "bigint",
"data": "int64_t"
}
}
}
```  
#### Struct Vectors {#docs:internals:vector::struct-vectors}  
Struct vectors store a list of child vectors. The number and types of the child vectors is defined by the schema of the struct.  
#### Map Vectors {#docs:internals:vector::map-vectors}  
Internally map vectors are stored as a `LIST[STRUCT(key KEY_TYPE, value VALUE_TYPE)]`.  
#### Union Vectors {#docs:internals:vector::union-vectors}  
Internally `UNION` utilizes the same structure as a `STRUCT`.
The first “child” is always occupied by the Tag Vector of the `UNION`, which records for each row which of the `UNION`'s types apply to that row.