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

Method executeImpl

src/Functions/array/emptyArrayToSingle.cpp:341–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341ColumnPtr FunctionEmptyArrayToSingle::executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const
342{
343 if (auto res = FunctionEmptyArrayToSingleImpl::executeConst(arguments, result_type, input_rows_count))
344 return res;
345
346 const ColumnArray * array = checkAndGetColumn<ColumnArray>(arguments[0].column.get());
347 if (!array)
348 throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column {} of first argument of function {}",
349 arguments[0].column->getName(), getName());
350
351 MutableColumnPtr res_ptr = array->cloneEmpty();
352 ColumnArray & res = assert_cast<ColumnArray &>(*res_ptr);
353
354 const IColumn & src_data = array->getData();
355 const ColumnArray::Offsets & src_offsets = array->getOffsets();
356 IColumn & res_data = res.getData();
357 ColumnArray::Offsets & res_offsets = res.getOffsets();
358
359 const NullMap * src_null_map = nullptr;
360 NullMap * res_null_map = nullptr;
361
362 const IColumn * inner_col = nullptr;
363 IColumn * inner_res_col = nullptr;
364
365 const auto * nullable_col = checkAndGetColumn<ColumnNullable>(&src_data);
366 if (nullable_col)
367 {
368 inner_col = &nullable_col->getNestedColumn();
369 src_null_map = &nullable_col->getNullMapData();
370
371 auto & nullable_res_col = assert_cast<ColumnNullable &>(res_data);
372 inner_res_col = &nullable_res_col.getNestedColumn();
373 res_null_map = &nullable_res_col.getNullMapData();
374 }
375 else
376 {
377 inner_col = &src_data;
378 inner_res_col = &res_data;
379 }
380
381 if (nullable_col)
382 FunctionEmptyArrayToSingleImpl::executeDispatch<true>(*inner_col, src_offsets, *inner_res_col, res_offsets, src_null_map, res_null_map);
383 else
384 FunctionEmptyArrayToSingleImpl::executeDispatch<false>(*inner_col, src_offsets, *inner_res_col, res_offsets, src_null_map, res_null_map);
385
386 return res_ptr;
387}
388
389
390REGISTER_FUNCTION(EmptyArrayToSingle)

Callers

nothing calls this directly

Calls 8

executeConstFunction · 0.85
ExceptionClass · 0.50
getNameFunction · 0.50
getMethod · 0.45
getNameMethod · 0.45
cloneEmptyMethod · 0.45
getDataMethod · 0.45
getOffsetsMethod · 0.45

Tested by

no test coverage detected