summaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/array/arrayExists.h
diff options
context:
space:
mode:
authorvitalyisaev <[email protected]>2023-11-14 09:58:56 +0300
committervitalyisaev <[email protected]>2023-11-14 10:20:20 +0300
commitc2b2dfd9827a400a8495e172a56343462e3ceb82 (patch)
treecd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/Functions/array/arrayExists.h
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/Functions/array/arrayExists.h')
-rw-r--r--contrib/clickhouse/src/Functions/array/arrayExists.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Functions/array/arrayExists.h b/contrib/clickhouse/src/Functions/array/arrayExists.h
new file mode 100644
index 00000000000..5b302ccb150
--- /dev/null
+++ b/contrib/clickhouse/src/Functions/array/arrayExists.h
@@ -0,0 +1,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>;
+
+}