blob: 5b302ccb15083924766a33d945b323933c759499 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#pragma once
#include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypesNumber.h>
#include "FunctionArrayMapped.h"
namespace DB
{
/** arrayExists(x1,...,xn -> expression, array1,...,arrayn) - is the expression true for at least one array element.
* An overload of the form f(array) is available, which works in the same way as f(x -> x, array).
*/
struct ArrayExistsImpl
{
static bool needBoolean() { return true; }
static bool needExpression() { return false; }
static bool needOneArray() { return false; }
static DataTypePtr getReturnType(const DataTypePtr & /*expression_return*/, const DataTypePtr & /*array_element*/)
{
return std::make_shared<DataTypeUInt8>();
}
static ColumnPtr execute(const ColumnArray & array, ColumnPtr mapped);
};
struct NameArrayExists { static constexpr auto name = "arrayExists"; };
using FunctionArrayExists = FunctionArrayMapped<ArrayExistsImpl, NameArrayExists>;
}
|