some review fixes

This commit is contained in:
Alexander Kozhikhov 2019-05-13 16:49:53 +03:00
parent 6c7f2cbc37
commit 79010b7c3c
3 changed files with 8 additions and 4 deletions

View File

@ -80,6 +80,10 @@ public:
const ColumnNumbers &arguments,
const std::vector<Float64> &weights, Float64 bias, const Context & context) const override
{
if (weights.size() + 1 != arguments.size()) {
throw Exception("In predict function number of arguments differs from the size of weights vector", ErrorCodes::LOGICAL_ERROR);
}
size_t rows_num = block.rows();
std::vector<Float64> results(rows_num, bias);

View File

@ -37,7 +37,7 @@ void ColumnAggregateFunction::addArena(ArenaPtr arena_)
/// This function is used in convertToValues() and predictValues()
/// and is written here to avoid repetitions
bool ColumnAggregateFunction::convertion(MutableColumnPtr *res_) const
bool ColumnAggregateFunction::tryFinalizeAggregateFunction(MutableColumnPtr *res_) const
{
if (const AggregateFunctionState *function_state = typeid_cast<const AggregateFunctionState *>(func.get()))
{
@ -92,7 +92,7 @@ MutableColumnPtr ColumnAggregateFunction::convertToValues() const
*/
MutableColumnPtr res;
if (convertion(&res))
if (tryFinalizeAggregateFunction(&res))
{
return res;
}
@ -106,7 +106,7 @@ MutableColumnPtr ColumnAggregateFunction::convertToValues() const
MutableColumnPtr ColumnAggregateFunction::predictValues(Block & block, const ColumnNumbers & arguments, const Context & context) const
{
MutableColumnPtr res;
convertion(&res);
tryFinalizeAggregateFunction(&res);
auto ML_function = func.get();
if (ML_function)

View File

@ -118,7 +118,7 @@ public:
std::string getName() const override { return "AggregateFunction(" + func->getName() + ")"; }
const char * getFamilyName() const override { return "AggregateFunction"; }
bool convertion(MutableColumnPtr* res_) const;
bool tryFinalizeAggregateFunction(MutableColumnPtr* res_) const;
MutableColumnPtr predictValues(Block & block, const ColumnNumbers & arguments, const Context & context) const;
size_t size() const override