ClickHouse/tests/queries/0_stateless/01322_cast_keep_nullable.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
838 B
MySQL
Raw Normal View History

2020-06-18 10:18:28 +00:00
SET cast_keep_nullable = 0;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);
SELECT CAST(toNullable(toInt8(0)) AS Int32) as x, toTypeName(x);
SET cast_keep_nullable = 1;
SELECT CAST(toNullable(toInt32(1)) AS Int32) as x, toTypeName(x);
SELECT CAST(toNullable(toInt8(1)) AS Int32) as x, toTypeName(x);
SELECT CAST(toNullable(toFloat32(2)), 'Float32') as x, toTypeName(x);
SELECT CAST(toNullable(toFloat32(2)), 'UInt8') as x, toTypeName(x);
SELECT CAST(if(1 = 1, toNullable(toInt8(3)), NULL) AS Int32) as x, toTypeName(x);
SELECT CAST(if(1 = 0, toNullable(toInt8(3)), NULL) AS Int32) as x, toTypeName(x);
SELECT CAST(a, 'Int32') as x, toTypeName(x) FROM (SELECT materialize(CAST(42, 'Nullable(UInt8)')) AS a);
SELECT CAST(a, 'Int32') as x, toTypeName(x) FROM (SELECT materialize(CAST(NULL, 'Nullable(UInt8)')) AS a);