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

Method executeImpl

src/Functions/array/arrayReverse.cpp:58–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57
58ColumnPtr FunctionArrayReverse::executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t) const
59{
60 const ColumnArray * array = checkAndGetColumn<ColumnArray>(arguments[0].column.get());
61 if (!array)
62 throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column {} of first argument of function {}",
63 arguments[0].column->getName(), getName());
64
65 auto res_ptr = array->cloneEmpty();
66 ColumnArray & res = assert_cast<ColumnArray &>(*res_ptr);
67 res.getOffsetsPtr() = array->getOffsetsPtr();
68
69 const IColumn & src_data = array->getData();
70 const ColumnArray::Offsets & offsets = array->getOffsets();
71
72 IColumn & res_data = res.getData();
73
74 const ColumnNullable * src_nullable_col = typeid_cast<const ColumnNullable *>(&src_data);
75 ColumnNullable * res_nullable_col = typeid_cast<ColumnNullable *>(&res_data);
76
77 const IColumn * src_inner_col = src_nullable_col ? &src_nullable_col->getNestedColumn() : &src_data;
78 IColumn * res_inner_col = res_nullable_col ? &res_nullable_col->getNestedColumn() : &res_data;
79
80 false // NOLINT
81 || executeNumber<UInt8>(*src_inner_col, offsets, *res_inner_col)
82 || executeNumber<UInt16>(*src_inner_col, offsets, *res_inner_col)
83 || executeNumber<UInt32>(*src_inner_col, offsets, *res_inner_col)
84 || executeNumber<UInt64>(*src_inner_col, offsets, *res_inner_col)
85 || executeNumber<Int8>(*src_inner_col, offsets, *res_inner_col)
86 || executeNumber<Int16>(*src_inner_col, offsets, *res_inner_col)
87 || executeNumber<Int32>(*src_inner_col, offsets, *res_inner_col)
88 || executeNumber<Int64>(*src_inner_col, offsets, *res_inner_col)
89 || executeNumber<Float32>(*src_inner_col, offsets, *res_inner_col)
90 || executeNumber<Float64>(*src_inner_col, offsets, *res_inner_col)
91 || executeString(*src_inner_col, offsets, *res_inner_col)
92 || executeFixedString(*src_inner_col, offsets, *res_inner_col)
93 || executeGeneric(*src_inner_col, offsets, *res_inner_col);
94
95 chassert(bool(src_nullable_col) == bool(res_nullable_col));
96
97 if (src_nullable_col)
98 if (!executeNumber<UInt8>(src_nullable_col->getNullMapColumn(), offsets, res_nullable_col->getNullMapColumn()))
99 throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column {} of null map of the first argument of function {}",
100 src_nullable_col->getNullMapColumn().getName(), getName());
101
102 return res_ptr;
103}
104
105
106bool FunctionArrayReverse::executeGeneric(const IColumn & src_data, const ColumnArray::Offsets & src_array_offsets, IColumn & res_data)

Callers

nothing calls this directly

Calls 10

executeFixedStringFunction · 0.85
executeStringFunction · 0.70
executeGenericFunction · 0.70
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