| 1 | #include "arrayIndex.h" |
|---|---|
| 2 | #include <Functions/FunctionFactory.h> |
| 3 | |
| 4 | |
| 5 | namespace DB |
| 6 | { |
| 7 | |
| 8 | struct NameIndexOf { static constexpr auto name = "indexOf"; }; |
| 9 | |
| 10 | /// indexOf(arr, x) - returns the index of the element x (starting with 1), if it exists in the array, or 0 if it is not. |
| 11 | using FunctionIndexOf = FunctionArrayIndex<IndexIdentity, NameIndexOf>; |
| 12 | |
| 13 | void registerFunctionIndexOf(FunctionFactory & factory) |
| 14 | { |
| 15 | factory.registerFunction<FunctionIndexOf>(); |
| 16 | } |
| 17 | |
| 18 | |
| 19 | } |
| 20 |