summaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp
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/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp')
-rw-r--r--contrib/clickhouse/src/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp b/contrib/clickhouse/src/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp
new file mode 100644
index 00000000000..9ef2d295828
--- /dev/null
+++ b/contrib/clickhouse/src/AggregateFunctions/AggregateFunctionAnalysisOfVariance.cpp
@@ -0,0 +1,40 @@
+#include <AggregateFunctions/AggregateFunctionFactory.h>
+#include <AggregateFunctions/AggregateFunctionAnalysisOfVariance.h>
+#include <AggregateFunctions/FactoryHelpers.h>
+
+namespace DB
+{
+
+namespace ErrorCodes
+{
+ extern const int BAD_ARGUMENTS;
+}
+
+namespace
+{
+
+AggregateFunctionPtr createAggregateFunctionAnalysisOfVariance(const std::string & name, const DataTypes & arguments, const Array & parameters, const Settings *)
+{
+ assertNoParameters(name, parameters);
+ assertBinary(name, arguments);
+
+ if (!isNumber(arguments[0]))
+ throw Exception(ErrorCodes::BAD_ARGUMENTS, "Aggregate function {} only supports numerical argument types", name);
+ if (!WhichDataType(arguments[1]).isNativeUInt())
+ throw Exception(ErrorCodes::BAD_ARGUMENTS, "Second argument of aggregate function {} should be a native unsigned integer", name);
+
+ return std::make_shared<AggregateFunctionAnalysisOfVariance>(arguments, parameters);
+}
+
+}
+
+void registerAggregateFunctionAnalysisOfVariance(AggregateFunctionFactory & factory)
+{
+ AggregateFunctionProperties properties = { .is_order_dependent = false };
+ factory.registerFunction("analysisOfVariance", {createAggregateFunctionAnalysisOfVariance, properties}, AggregateFunctionFactory::CaseInsensitive);
+
+ /// This is widely used term
+ factory.registerAlias("anova", "analysisOfVariance", AggregateFunctionFactory::CaseInsensitive);
+}
+
+}