Merge pull request #57592 from bharatnc/ncb/alias-format-readable-size

Add FORMAT_BYTES as an alias for formatReadableSize
This commit is contained in:
Alexey Milovidov 2023-12-07 15:15:56 +01:00 committed by GitHub
commit 11920e751a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -628,6 +628,8 @@ SELECT
formatReadableSize(filesize_bytes) AS filesize
```
Alias: `FORMAT_BYTES`.
``` text
┌─filesize_bytes─┬─filesize───┐
│ 1 │ 1.00 B │

View File

@ -21,6 +21,7 @@ namespace
REGISTER_FUNCTION(FormatReadableSize)
{
factory.registerFunction<FunctionFormatReadable<Impl>>();
factory.registerAlias("FORMAT_BYTES", Impl::name, FunctionFactory::CaseInsensitive);
}
}

View File

@ -1,4 +1,4 @@
WITH round(exp(number), 6) AS x, x > 0xFFFFFFFFFFFFFFFF ? 0xFFFFFFFFFFFFFFFF : toUInt64(x) AS y, x > 0x7FFFFFFF ? 0x7FFFFFFF : toInt32(x) AS z
SELECT formatReadableSize(x), formatReadableSize(y), formatReadableSize(z)
SELECT FORMAT_BYTES(x), format_bytes(y), formatReadableSize(z)
FROM system.numbers
LIMIT 70;