aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/array/indexOf.cpp
blob: 9e61d22bc682da7c88b5b6831d0754d7da1ec771 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "arrayIndex.h"
#include <Functions/FunctionFactory.h>

namespace DB
{
struct NameIndexOf { static constexpr auto name = "indexOf"; };

/// indexOf(arr, x) - returns the index of the element x (starting with 1), if it exists in the array, or 0 if it
/// doesn't.
using FunctionIndexOf = FunctionArrayIndex<IndexOfAction, NameIndexOf>;

REGISTER_FUNCTION(IndexOf)
{
    factory.registerFunction<FunctionIndexOf>();
}
}