#include #include #include #include #include namespace DB { namespace { struct CramersVData : CrossTabData { static const char * getName() { return "cramersV"; } Float64 getResult() const { if (count < 2) return std::numeric_limits::quiet_NaN(); UInt64 q = std::min(count_a.size(), count_b.size()); return sqrt(getPhiSquared() / (q - 1)); } }; } void registerAggregateFunctionCramersV(AggregateFunctionFactory & factory) { factory.registerFunction(CramersVData::getName(), [](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *) { assertBinary(name, argument_types); assertNoParameters(name, parameters); return std::make_shared>(argument_types); }); } }