Merge pull request #61308 from rschu1ze/docs-sleep

Docs: Follow up to #61258
This commit is contained in:
Robert Schulze 2024-03-13 15:42:47 +01:00 committed by GitHub
commit 7a5ac383e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 23 deletions

View File

@ -298,7 +298,7 @@ Full columns and constants are represented differently in memory. Functions usua
Accepts any arguments, including `NULL` and does nothing. Always returns 0.
The argument is internally still evaluated. Useful e.g. for benchmarks.
## sleep(seconds)
## sleep
Used to introduce a delay or pause in the execution of a query. It is primarily used for testing and debugging purposes.
@ -310,7 +310,7 @@ sleep(seconds)
**Arguments**
- `seconds`: [Int](../../sql-reference/data-types/int-uint.md) The number of seconds to pause the query execution to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
- `seconds`: [UInt*](../../sql-reference/data-types/int-uint.md) or [Float](../../sql-reference/data-types/float.md) The number of seconds to pause the query execution to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
**Returned value**
@ -360,7 +360,7 @@ sleepEachRow(seconds)
**Arguments**
- `seconds`: [Int](../../sql-reference/data-types/int-uint.md) The number of seconds to pause the query execution for each row in the result set to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
- `seconds`: [UInt*](../../sql-reference/data-types/int-uint.md) or [Float*](../../sql-reference/data-types/float.md) The number of seconds to pause the query execution for each row in the result set to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
**Returned value**

View File

@ -62,32 +62,17 @@ public:
{
}
/// Get the name of the function.
String getName() const override
{
return name;
}
/// Do not sleep during query analysis.
bool isSuitableForConstantFolding() const override
{
return false;
}
size_t getNumberOfArguments() const override
{
return 1;
}
String getName() const override { return name; }
bool isSuitableForConstantFolding() const override { return false; } /// Do not sleep during query analysis.
size_t getNumberOfArguments() const override { return 1; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; }
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
{
WhichDataType which(arguments[0]);
if (!which.isFloat()
&& !which.isNativeUInt())
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument of function {}, expected Float64",
if (!which.isFloat() && !which.isNativeUInt())
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument of function {}, expected UInt* or Float*",
arguments[0]->getName(), getName());
return std::make_shared<DataTypeUInt8>();