ClickHouse/dbms/tests/queries/0_stateless/00977_int_div.sql

26 lines
855 B
MySQL
Raw Normal View History

2020-02-25 04:58:26 +00:00
SELECT
sum(ASD) AS asd,
intDiv(toInt64(asd), abs(toInt64(asd))) AS int_div_with_abs,
2019-07-31 01:05:33 +00:00
intDiv(toInt64(asd), toInt64(asd)) AS int_div_without_abs
2020-02-25 04:58:26 +00:00
FROM
2019-07-31 01:05:33 +00:00
(
SELECT ASD
2020-02-25 04:58:26 +00:00
FROM
2019-07-31 01:05:33 +00:00
(
SELECT [-1000, -1000] AS asds
2020-02-25 04:58:26 +00:00
)
2019-07-31 01:05:33 +00:00
ARRAY JOIN asds AS ASD
);
SELECT intDivOrZero( CAST(-1000, 'Int64') , CAST(1000, 'UInt64') );
SELECT intDivOrZero( CAST(-1000, 'Int64') , CAST(1000, 'Int64') );
SELECT intDiv(-1, number) FROM numbers(1, 10);
SELECT intDivOrZero(-1, number) FROM numbers(1, 10);
2020-02-25 04:58:26 +00:00
SELECT intDiv(toInt32(number), -1) FROM numbers(1, 10);
SELECT intDivOrZero(toInt32(number), -1) FROM numbers(1, 10);
SELECT intDiv(toInt64(number), -1) FROM numbers(1, 10);
SELECT intDivOrZero(toInt64(number), -1) FROM numbers(1, 10);
SELECT intDiv(number, -number) FROM numbers(1, 10);
SELECT intDivOrZero(number, -number) FROM numbers(1, 10);