ClickHouse/tests/queries/0_stateless/02787_transform_null.sql

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

41 lines
792 B
MySQL
Raw Normal View History

2023-06-10 12:47:24 +00:00
SELECT transform(0, [0, 1], ['ZERO', 'ONE'], 'DEFAULT') AS result;
SELECT transform(0, [0, 1], ['ZERO', 'ONE'], NULL) AS result;
SELECT CASE 1
WHEN 0 THEN 'ZERO'
WHEN 1 THEN 'ONE'
ELSE 'NONE'
END AS result;
SELECT CASE 1
WHEN 0 THEN NULL
WHEN 1 THEN 'ONE'
ELSE 'NONE'
END AS result;
select
case 1
when 1 then 'a'
else 'b'
end value;
select
case 1
when 1 then 'a'
end value;
SELECT
d,
toInt16OrNull(d),
caseWithExpression(d, 'a', 3, toInt16OrZero(d)) AS case_zero,
caseWithExpression(d, 'a', 3, toInt16OrNull(d)) AS case_null,
if(d = 'a', 3, toInt16OrZero(d)) AS if_zero,
if(d = 'a', 3, toInt16OrNull(d)) AS if_null
FROM
(
SELECT arrayJoin(['', '1', 'a']) AS d
)
ORDER BY
case_zero ASC,
d ASC;