Merge pull request #40683 from ClickHouse/test-to-decimal-or-default

Add a test for toDecimal*OrDefault functions
This commit is contained in:
Alexey Milovidov 2022-08-27 16:53:55 +03:00 committed by GitHub
commit b4cf54e3ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,8 @@
111 Decimal(9, 3)
222 Decimal(18, 3)
333 Decimal(38, 3)
444 Decimal(76, 3)
123.456 Decimal(9, 3)
123.456 Decimal(18, 3)
123.456 Decimal(38, 3)
123.456 Decimal(76, 3)

View File

@ -0,0 +1,9 @@
SELECT toDecimal32OrDefault(111, 3, 123.456::Decimal32(3)) AS x, toTypeName(x);
SELECT toDecimal64OrDefault(222, 3, 123.456::Decimal64(3)) AS x, toTypeName(x);
SELECT toDecimal128OrDefault(333, 3, 123.456::Decimal128(3)) AS x, toTypeName(x);
SELECT toDecimal256OrDefault(444, 3, 123.456::Decimal256(3)) AS x, toTypeName(x);
SELECT toDecimal32OrDefault('Hello', 3, 123.456::Decimal32(3)) AS x, toTypeName(x);
SELECT toDecimal64OrDefault('Hello', 3, 123.456::Decimal64(3)) AS x, toTypeName(x);
SELECT toDecimal128OrDefault('Hello', 3, 123.456::Decimal128(3)) AS x, toTypeName(x);
SELECT toDecimal256OrDefault('Hello', 3, 123.456::Decimal256(3)) AS x, toTypeName(x);