| 1 | #include "arrayEnumerateExtended.h" |
|---|---|
| 2 | #include <Functions/FunctionFactory.h> |
| 3 | |
| 4 | |
| 5 | namespace DB |
| 6 | { |
| 7 | |
| 8 | /** arrayEnumerateUniq(arr) |
| 9 | * - outputs an array parallel (having same size) to this, where for each element specified |
| 10 | * how many times this element was encountered before (including this element) among elements with the same value. |
| 11 | * For example: arrayEnumerateUniq([10, 20, 10, 30]) = [1, 1, 2, 1] |
| 12 | * arrayEnumerateUniq(arr1, arr2...) |
| 13 | * - for tuples from elements in the corresponding positions in several arrays. |
| 14 | */ |
| 15 | class FunctionArrayEnumerateUniq : public FunctionArrayEnumerateExtended<FunctionArrayEnumerateUniq> |
| 16 | { |
| 17 | using Base = FunctionArrayEnumerateExtended<FunctionArrayEnumerateUniq>; |
| 18 | public: |
| 19 | static constexpr auto name = "arrayEnumerateUniq"; |
| 20 | using Base::create; |
| 21 | }; |
| 22 | |
| 23 | void registerFunctionArrayEnumerateUniq(FunctionFactory & factory) |
| 24 | { |
| 25 | factory.registerFunction<FunctionArrayEnumerateUniq>(); |
| 26 | } |
| 27 | |
| 28 | } |
| 29 |