This function is strange. Looks like the implementation is of low quality.

```
bool isDeterministic() const override { return false; }
bool isDeterministicInScopeOfQuery() const override { return false; }
```
Why it is not deterministic? Missing a comment.

```
String convertToJson(const PODArray<String> & variant_names, const Variants & variants)
{
    FormatSettings settings;

    WriteBufferFromOwnString buf;

    writeCString("{\"data\":[", buf);
    for (size_t i = 0; i < variants.size(); ++i)
    {
        writeCString("{\"variant_name\":", buf);
        writeJSONString(variant_names[i], buf, settings);
        writeCString(",\"x\":", buf);
        writeText(variants[i].x, buf);
        writeCString(",\"y\":", buf);
        writeText(variants[i].y, buf);
        writeCString(",\"beats_control\":", buf);
        writeText(variants[i].beats_control, buf);
        writeCString(",\"to_be_best\":", buf);
        writeText(variants[i].best, buf);
        writeCString("}", buf);
        if (i != variant_names.size() -1)
            writeCString(",", buf);
    }
    writeCString("]}", buf);

    return buf.str();
}
```
It returns unstructured data? :scream: 

As first step we can remove documentation for this function.
CC @nikitamikhaylov 
}
    }
    for (auto & variant : variants)
        variant.beats_control = static_cast<Float64>(variant.beats_control) / r / c;
    
    PODArray<size_t> count_m(xs.size(), 0);
    PODArray<Float64> row(xs.size(), 0);
    for (size_t n = 0; n < r * c; ++n)
    {
        for (size_t i = 0; i < xs.size(); ++i)
            row[i] = samples_matrix[i][n];
        Float64 m;
        if (higher_is_better)
            m = *std::max_element(row.begin(), row.end());
        else
            m = *std::min_element(row.begin(), row.end());
        for (size_t i = 0; i < xs.size(); ++i)
        {
            if (m == samples_matrix[i][n])
            {
                ++variants[i].best;
                break;
            }
        }
    }
    for (auto & variant : variants)
        variant.best = static_cast<Float64>(variant.best) / r / c;
    return variants;
}
String convertToJson(const PODArray<String> & variant_names, const Variants & variants)