This commit is contained in:
Andrei Nekrashevich 2020-06-01 02:40:38 +03:00
parent f3447ee63b
commit 1cd888f505
2 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@ namespace ErrorCodes
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int ILLEGAL_COLUMN;
extern const int DECIMAL_OVERFLOW;
extern const int ARGUMENT_OUT_OF_BOUND;
}
@ -86,6 +87,11 @@ public:
auto col_in_untyped = block.getByPosition(arguments[0]).column;
const double inverse_probability = assert_cast<const ColumnConst &>(*block.getByPosition(arguments[1]).column).getValue<double>();
if (inverse_probability < 0.0 || 1.0 < inverse_probability)
{
throw Exception("Second argument of function " + getName() + " must be from `0.0` to `1.0`", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
}
if (const ColumnConst * col_in_untyped_const = checkAndGetColumnConstStringOrFixedString(col_in_untyped.get()))
{
col_in_untyped = col_in_untyped_const->getDataColumnPtr();

View File

@ -1,4 +1,5 @@
SELECT fuzzBits(toString('string'), 1); -- { serverError 43 }
SELECT fuzzBits('string', -1.0); -- { serverError 69 }
SELECT fuzzBits('', 0.3);
SELECT length(fuzzBits(randomString(100), 0.5));
SELECT toTypeName(fuzzBits(randomString(100), 0.5));