Complete the construction and build the [`UnionArray`]
(self)
| 274 | |
| 275 | /// Complete the construction and build the [`UnionArray`] |
| 276 | pub fn finish(self) -> UnionArray { |
| 277 | let Self { |
| 278 | mut string_values, |
| 279 | mut bool_values, |
| 280 | mut bigint_values, |
| 281 | mut int32_bitmask_values, |
| 282 | mut string_list_values, |
| 283 | mut int32_to_int32_list_map_values, |
| 284 | mut type_ids, |
| 285 | mut offsets, |
| 286 | } = self; |
| 287 | let type_ids = type_ids.finish(); |
| 288 | let offsets = offsets.finish(); |
| 289 | |
| 290 | // form the correct ArrayData |
| 291 | |
| 292 | let len = offsets.len(); |
| 293 | let null_bit_buffer = None; |
| 294 | let offset = 0; |
| 295 | |
| 296 | let buffers = vec![ |
| 297 | type_ids.into_data().buffers()[0].clone(), |
| 298 | offsets.into_data().buffers()[0].clone(), |
| 299 | ]; |
| 300 | |
| 301 | let child_data = vec![ |
| 302 | string_values.finish().into_data(), |
| 303 | bool_values.finish().into_data(), |
| 304 | bigint_values.finish().into_data(), |
| 305 | int32_bitmask_values.finish().into_data(), |
| 306 | string_list_values.finish().into_data(), |
| 307 | int32_to_int32_list_map_values.finish().into_data(), |
| 308 | ]; |
| 309 | |
| 310 | let data = ArrayData::try_new( |
| 311 | UNION_TYPE.clone(), |
| 312 | len, |
| 313 | null_bit_buffer, |
| 314 | offset, |
| 315 | buffers, |
| 316 | child_data, |
| 317 | ) |
| 318 | .expect("Correctly created UnionArray"); |
| 319 | |
| 320 | UnionArray::from(data) |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | /// Helper to create [`CommandGetSqlInfo`] responses. |