Make it less wrong

This commit is contained in:
Alexey Milovidov 2022-01-02 22:42:56 +03:00
parent 4a094c2efd
commit cf66716cd6
6 changed files with 25 additions and 33 deletions

View File

@ -1,7 +1,6 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/CrossTab.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <memory>
#include <cmath>
@ -12,12 +11,9 @@ namespace DB
namespace
{
struct ContingencyData : CrossTabData
{
static const char * getName()
struct ContingencyData : CrossTabData
{
return "contingency";
}
static const char * getName() { return "contingency"; }
Float64 getResult() const
{
@ -36,7 +32,8 @@ struct ContingencyData : CrossTabData
return sqrt(phi / (phi + count));
}
};
};
}
void registerAggregateFunctionContingency(AggregateFunctionFactory & factory)
{
@ -49,5 +46,3 @@ void registerAggregateFunctionContingency(AggregateFunctionFactory & factory)
}
}
}

View File

@ -1,7 +1,6 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/CrossTab.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <memory>
#include <cmath>

View File

@ -1,7 +1,6 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/CrossTab.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <memory>
#include <cmath>

View File

@ -1,7 +1,6 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/CrossTab.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <memory>
#include <cmath>
@ -40,12 +39,14 @@ struct TheilsUData : CrossTabData
dep += (value_ab / count) * log(value_ab / value_b);
}
dep -= h_x;
dep /= h_x;
dep -= h_a;
dep /= h_a;
return dep;
}
};
}
void registerAggregateFunctionTheilsU(AggregateFunctionFactory & factory)
{
factory.registerFunction(TheilsUData::getName(),
@ -57,5 +58,3 @@ void registerAggregateFunctionTheilsU(AggregateFunctionFactory & factory)
}
}
}

View File

@ -113,12 +113,12 @@ public:
this->data(place).merge(this->data(rhs));
}
void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf) const override
void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf, std::optional<size_t>) const override
{
this->data(place).serialize(buf);
}
void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, Arena *) const override
void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::optional<size_t>, Arena *) const override
{
this->data(place).deserialize(buf);
}

View File

@ -263,7 +263,7 @@ public:
return it->getMapped();
}
typename Cell::Mapped & ALWAYS_INLINE at(const Key & x) const
const typename Cell::Mapped & ALWAYS_INLINE at(const Key & x) const
{
if (auto it = this->find(x); it != this->end())
return it->getMapped();