mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 13:32:13 +00:00
fix
This commit is contained in:
parent
f3447ee63b
commit
1cd888f505
@ -20,6 +20,7 @@ namespace ErrorCodes
|
|||||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||||
extern const int ILLEGAL_COLUMN;
|
extern const int ILLEGAL_COLUMN;
|
||||||
extern const int DECIMAL_OVERFLOW;
|
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;
|
auto col_in_untyped = block.getByPosition(arguments[0]).column;
|
||||||
const double inverse_probability = assert_cast<const ColumnConst &>(*block.getByPosition(arguments[1]).column).getValue<double>();
|
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()))
|
if (const ColumnConst * col_in_untyped_const = checkAndGetColumnConstStringOrFixedString(col_in_untyped.get()))
|
||||||
{
|
{
|
||||||
col_in_untyped = col_in_untyped_const->getDataColumnPtr();
|
col_in_untyped = col_in_untyped_const->getDataColumnPtr();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SELECT fuzzBits(toString('string'), 1); -- { serverError 43 }
|
SELECT fuzzBits(toString('string'), 1); -- { serverError 43 }
|
||||||
|
SELECT fuzzBits('string', -1.0); -- { serverError 69 }
|
||||||
SELECT fuzzBits('', 0.3);
|
SELECT fuzzBits('', 0.3);
|
||||||
SELECT length(fuzzBits(randomString(100), 0.5));
|
SELECT length(fuzzBits(randomString(100), 0.5));
|
||||||
SELECT toTypeName(fuzzBits(randomString(100), 0.5));
|
SELECT toTypeName(fuzzBits(randomString(100), 0.5));
|
||||||
|
Loading…
Reference in New Issue
Block a user