MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / extractValuesFixedString

Function extractValuesFixedString

src/DataTypes/DataTypeMapHelpers.cpp:336–370  ·  view source on GitHub ↗

Specialized value extractor for ColumnFixedString, with optional Nullable support.

Source from the content-addressed store, hash-verified

334
335/// Specialized value extractor for ColumnFixedString, with optional Nullable support.
336void extractValuesFixedString(
337 const ColumnFixedString & values_column,
338 ColumnFixedString & result,
339 const PaddedPODArray<size_t> & matched_positions,
340 const NullMap * src_null_map = nullptr,
341 NullMap * dst_null_map = nullptr)
342{
343 size_t n = values_column.getN();
344 const auto & src_chars = values_column.getChars();
345 auto & dst_chars = result.getChars();
346 size_t num_rows = matched_positions.size();
347
348 size_t old_chars_size = dst_chars.size();
349 size_t old_num_rows = old_chars_size / n;
350 dst_chars.resize(old_chars_size + num_rows * n);
351 if (dst_null_map)
352 dst_null_map->resize(old_num_rows + num_rows);
353
354 for (size_t i = 0; i < num_rows; ++i)
355 {
356 size_t pos = matched_positions[i];
357 if (pos != KEY_NOT_FOUND)
358 {
359 memcpy(&dst_chars[old_chars_size + i * n], &src_chars[pos * n], n);
360 if (dst_null_map)
361 (*dst_null_map)[old_num_rows + i] = (*src_null_map)[pos];
362 }
363 else
364 {
365 memset(&dst_chars[old_chars_size + i * n], 0, n);
366 if (dst_null_map)
367 (*dst_null_map)[old_num_rows + i] = static_cast<UInt8>(1);
368 }
369 }
370}
371
372/// Dispatches to the appropriate specialized value extractor based on the value column type.
373/// For Nullable columns, unwraps to the nested column and passes null map pointers

Callers 1

extractValuesDispatchFunction · 0.85

Calls 5

memcpyFunction · 0.85
getNMethod · 0.45
getCharsMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected