mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
batter
This commit is contained in:
parent
307f69380e
commit
8faa148754
@ -242,7 +242,7 @@ Constrain the return value between A and B.
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
if(x, min, max)
|
||||
clamp(x, min, max)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
@ -258,7 +258,7 @@ If the value is less than the minimum value, return the minimum value; if it is
|
||||
Examples:
|
||||
|
||||
```sql
|
||||
SELECT least(1, 2, 3) result, toTypeName(result) type;
|
||||
SELECT clamp(1, 2, 3) result, toTypeName(result) type;
|
||||
```
|
||||
```response
|
||||
┌─result─┬─type────┐
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override
|
||||
{
|
||||
|
||||
size_t arg_size = arguments.size();
|
||||
Columns converted_columns(arg_size);
|
||||
for (size_t arg = 0; arg < arg_size; ++arg)
|
||||
|
@ -2,3 +2,7 @@
|
||||
20
|
||||
15
|
||||
b
|
||||
0
|
||||
['hello']
|
||||
-1
|
||||
234
|
||||
|
@ -1,4 +1,8 @@
|
||||
SELECT clamp(1, 10, 20);
|
||||
SELECT clamp(30, 10, 20);
|
||||
SELECT clamp(15, 10, 20);
|
||||
SELECT clamp('a', 'b', 'c');
|
||||
SELECT clamp('a', 'b', 'c');
|
||||
SELECT clamp(today(), yesterday() - 10, yesterday() + 10) - today()
|
||||
SELECT clamp([], ['hello'], ['world']);
|
||||
SELECT clamp(-1., -1000., 18446744073709551615.);
|
||||
SELECT clamp(toNullable(123), 234, 456);
|
||||
|
Loading…
Reference in New Issue
Block a user