Fix tests.

This commit is contained in:
Nikolai Kochetov 2020-06-27 18:30:54 +03:00
parent 90fb5716cf
commit 897ed2f3a1
2 changed files with 460 additions and 50 deletions

View File

@ -10,6 +10,8 @@
24 24
27 27
2 2
SELECT uniqExactIf(number % 10, (number % 5) = 2)\nFROM numbers(10000) SELECT uniqExactIf(number % 10, (number % 5) = 2)
FROM numbers(10000)
9 9
SELECT sumDistinctIf(number % 10, (number % 5) = 2)\nFROM numbers(10000) SELECT sumDistinctIf(number % 10, (number % 5) = 2)
FROM numbers(10000)

View File

@ -1,51 +1,459 @@
SELECT \n sum(n + 1),\n sum(1 + n),\n sum(n - 1),\n sum(1 - n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT
SELECT \n sum(n) * 2,\n 2 * sum(n),\n sum(n) / 2,\n sum(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(n + 1),
SELECT \n min(n) + 1,\n 1 + min(n),\n min(n) - 1,\n 1 - min(n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(1 + n),
SELECT \n min(n) * 2,\n 2 * min(n),\n min(n) / 2,\n min(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(n - 1),
SELECT \n max(n) + 1,\n 1 + max(n),\n max(n) - 1,\n 1 - max(n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(1 - n)
SELECT \n max(n) * 2,\n 2 * max(n),\n max(n) / 2,\n max(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM
SELECT \n sum(n + -1),\n sum(-1 + n),\n sum(n - -1),\n sum(-1 - n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) (
SELECT \n sum(n) * -2,\n -2 * sum(n),\n sum(n) / -2,\n sum(-1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT number AS n
SELECT \n min(n) + -1,\n -1 + min(n),\n min(n) - -1,\n -1 - min(n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM numbers(10)
SELECT \n max(n) * -2,\n -2 * max(n),\n max(n) / -2,\n min(-1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) )
SELECT \n max(n) + -1,\n -1 + max(n),\n max(n) - -1,\n -1 - max(n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT
SELECT \n min(n) * -2,\n -2 * min(n),\n min(n) / -2,\n max(-1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(n) * 2,
SELECT \n sum(abs(2) + 1),\n sum(abs(2) + n),\n sum(n - abs(2)),\n sum(1 - abs(2))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) 2 * sum(n),
SELECT \n sum(abs(2)) * 2,\n sum(abs(2) * n),\n sum(n / abs(2)),\n sum(1 / abs(2))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(n) / 2,
SELECT \n min(abs(2)) + 1,\n min(abs(2) + n),\n min(n - abs(2)),\n 1 - min(abs(2))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) sum(1 / n)
SELECT \n min(abs(2)) * 2,\n min(abs(2) * n),\n min(n / abs(2)),\n min(1 / abs(2))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM
SELECT \n max(abs(2)) + 1,\n max(abs(2) + n),\n max(n - abs(2)),\n 1 - max(abs(2))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) (
SELECT \n max(abs(2)) * 2,\n max(abs(2) * n),\n max(n / abs(2)),\n max(1 / abs(2))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT number AS n
SELECT \n sum(abs(n) + 1),\n sum(abs(n) + n),\n sum(n - abs(n)),\n sum(1 - abs(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM numbers(10)
SELECT \n sum(abs(n)) * 2,\n sum(abs(n) * n),\n sum(n / abs(n)),\n sum(1 / abs(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) )
SELECT \n min(abs(n)) + 1,\n min(abs(n) + n),\n min(n - abs(n)),\n 1 - min(abs(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT
SELECT \n min(abs(n)) * 2,\n min(abs(n) * n),\n min(n / abs(n)),\n min(1 / abs(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) min(n) + 1,
SELECT \n max(abs(n)) + 1,\n max(abs(n) + n),\n max(n - abs(n)),\n 1 - max(abs(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) 1 + min(n),
SELECT \n max(abs(n)) * 2,\n max(abs(n) * n),\n max(n / abs(n)),\n max(1 / abs(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) min(n) - 1,
SELECT \n sum((n * n) + 1),\n sum(1 + (n * n)),\n sum((n * n) - 1),\n sum(1 - (n * n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) 1 - min(n)
SELECT \n sum(n * n) * 2,\n sum((2 * n) * n),\n sum(n * n) / 2,\n sum((1 / n) * n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM
SELECT \n min(n * n) + 1,\n 1 + min(n * n),\n min(n * n) - 1,\n 1 - min(n * n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) (
SELECT \n min(n * n) * 2,\n min((2 * n) * n),\n min(n * n) / 2,\n min((1 / n) * n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT number AS n
SELECT \n max(n * n) + 1,\n 1 + max(n * n),\n max(n * n) - 1,\n 1 - max(n * n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM numbers(10)
SELECT \n max(n * n) * 2,\n max((2 * n) * n),\n max(n * n) / 2,\n max((1 / n) * n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) )
SELECT \n sum((1 + n) + 1),\n sum((1 + 1) + n),\n sum((1 + n) - 1),\n sum((1 + 1) - n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT
SELECT \n sum(1 + (n * 2)),\n sum(1 + (2 * n)),\n sum(1 + (n / 2)),\n sum(1 + (1 / n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) min(n) * 2,
SELECT \n (1 + min(n)) + 1,\n min((1 + 1) + n),\n (1 + min(n)) - 1,\n min((1 + 1) - n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) 2 * min(n),
SELECT \n 1 + min(n * 2),\n 1 + min(2 * n),\n 1 + min(n / 2),\n 1 + min(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) min(n) / 2,
SELECT \n (1 + max(n)) + 1,\n max((1 + 1) + n),\n (1 + max(n)) - 1,\n max((1 + 1) - n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) min(1 / n)
SELECT \n 1 + max(n * 2),\n 1 + max(2 * n),\n 1 + max(n / 2),\n 1 + max(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM
SELECT \n sum((n + -1) + -1),\n sum((-1 + n) + -1),\n sum((n - -1) + -1),\n sum((-1 - n) + -1)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) (
SELECT \n (sum(n) * -2) * -1,\n (-2 * sum(n)) * -1,\n (sum(n) / -2) / -1,\n sum(-1 / n) / -1\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT number AS n
SELECT \n (min(n) + -1) + -1,\n (-1 + min(n)) + -1,\n (min(n) - -1) + -1,\n (-1 - min(n)) + -1\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM numbers(10)
SELECT \n (min(n) * -2) * -1,\n (-2 * min(n)) * -1,\n (min(n) / -2) / -1,\n max(-1 / n) / -1\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) )
SELECT \n (max(n) + -1) + -1,\n (-1 + max(n)) + -1,\n (max(n) - -1) + -1,\n (-1 - max(n)) + -1\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT
SELECT \n (max(n) * -2) * -1,\n (-2 * max(n)) * -1,\n (max(n) / -2) / -1,\n min(-1 / n) / -1\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) max(n) + 1,
SELECT ((sum(n + 1) + sum(1 + n)) + sum(n - 1)) + sum(1 - n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) 1 + max(n),
SELECT (((sum(n) * 2) + (2 * sum(n))) + (sum(n) / 2)) + sum(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) max(n) - 1,
SELECT (((min(n) + 1) + (1 + min(n))) + (min(n) - 1)) + (1 - min(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) 1 - max(n)
SELECT (((min(n) * 2) + (2 * min(n))) + (min(n) / 2)) + min(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) FROM
SELECT (((max(n) + 1) + (1 + max(n))) + (max(n) - 1)) + (1 - max(n))\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) (
SELECT (((max(n) * 2) + (2 * max(n))) + (max(n) / 2)) + max(1 / n)\nFROM \n(\n SELECT number AS n\n FROM numbers(10)\n) SELECT number AS n
FROM numbers(10)
)
SELECT
max(n) * 2,
2 * max(n),
max(n) / 2,
max(1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(n + -1),
sum(-1 + n),
sum(n - -1),
sum(-1 - n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(n) * -2,
-2 * sum(n),
sum(n) / -2,
sum(-1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(n) + -1,
-1 + min(n),
min(n) - -1,
-1 - min(n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(n) * -2,
-2 * max(n),
max(n) / -2,
min(-1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(n) + -1,
-1 + max(n),
max(n) - -1,
-1 - max(n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(n) * -2,
-2 * min(n),
min(n) / -2,
max(-1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(abs(2) + 1),
sum(abs(2) + n),
sum(n - abs(2)),
sum(1 - abs(2))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(abs(2)) * 2,
sum(abs(2) * n),
sum(n / abs(2)),
sum(1 / abs(2))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(abs(2)) + 1,
min(abs(2) + n),
min(n - abs(2)),
1 - min(abs(2))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(abs(2)) * 2,
min(abs(2) * n),
min(n / abs(2)),
min(1 / abs(2))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(abs(2)) + 1,
max(abs(2) + n),
max(n - abs(2)),
1 - max(abs(2))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(abs(2)) * 2,
max(abs(2) * n),
max(n / abs(2)),
max(1 / abs(2))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(abs(n) + 1),
sum(abs(n) + n),
sum(n - abs(n)),
sum(1 - abs(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(abs(n)) * 2,
sum(abs(n) * n),
sum(n / abs(n)),
sum(1 / abs(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(abs(n)) + 1,
min(abs(n) + n),
min(n - abs(n)),
1 - min(abs(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(abs(n)) * 2,
min(abs(n) * n),
min(n / abs(n)),
min(1 / abs(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(abs(n)) + 1,
max(abs(n) + n),
max(n - abs(n)),
1 - max(abs(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(abs(n)) * 2,
max(abs(n) * n),
max(n / abs(n)),
max(1 / abs(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum((n * n) + 1),
sum(1 + (n * n)),
sum((n * n) - 1),
sum(1 - (n * n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(n * n) * 2,
sum((2 * n) * n),
sum(n * n) / 2,
sum((1 / n) * n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(n * n) + 1,
1 + min(n * n),
min(n * n) - 1,
1 - min(n * n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
min(n * n) * 2,
min((2 * n) * n),
min(n * n) / 2,
min((1 / n) * n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(n * n) + 1,
1 + max(n * n),
max(n * n) - 1,
1 - max(n * n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
max(n * n) * 2,
max((2 * n) * n),
max(n * n) / 2,
max((1 / n) * n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum((1 + n) + 1),
sum((1 + 1) + n),
sum((1 + n) - 1),
sum((1 + 1) - n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum(1 + (n * 2)),
sum(1 + (2 * n)),
sum(1 + (n / 2)),
sum(1 + (1 / n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(1 + min(n)) + 1,
min((1 + 1) + n),
(1 + min(n)) - 1,
min((1 + 1) - n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
1 + min(n * 2),
1 + min(2 * n),
1 + min(n / 2),
1 + min(1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(1 + max(n)) + 1,
max((1 + 1) + n),
(1 + max(n)) - 1,
max((1 + 1) - n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
1 + max(n * 2),
1 + max(2 * n),
1 + max(n / 2),
1 + max(1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
sum((n + -1) + -1),
sum((-1 + n) + -1),
sum((n - -1) + -1),
sum((-1 - n) + -1)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(sum(n) * -2) * -1,
(-2 * sum(n)) * -1,
(sum(n) / -2) / -1,
sum(-1 / n) / -1
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(min(n) + -1) + -1,
(-1 + min(n)) + -1,
(min(n) - -1) + -1,
(-1 - min(n)) + -1
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(min(n) * -2) * -1,
(-2 * min(n)) * -1,
(min(n) / -2) / -1,
max(-1 / n) / -1
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(max(n) + -1) + -1,
(-1 + max(n)) + -1,
(max(n) - -1) + -1,
(-1 - max(n)) + -1
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT
(max(n) * -2) * -1,
(-2 * max(n)) * -1,
(max(n) / -2) / -1,
min(-1 / n) / -1
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT ((sum(n + 1) + sum(1 + n)) + sum(n - 1)) + sum(1 - n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT (((sum(n) * 2) + (2 * sum(n))) + (sum(n) / 2)) + sum(1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT (((min(n) + 1) + (1 + min(n))) + (min(n) - 1)) + (1 - min(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT (((min(n) * 2) + (2 * min(n))) + (min(n) / 2)) + min(1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT (((max(n) + 1) + (1 + max(n))) + (max(n) - 1)) + (1 - max(n))
FROM
(
SELECT number AS n
FROM numbers(10)
)
SELECT (((max(n) * 2) + (2 * max(n))) + (max(n) / 2)) + max(1 / n)
FROM
(
SELECT number AS n
FROM numbers(10)
)
55 55 35 -35 55 55 35 -35
90 90 22.5 inf 90 90 22.5 inf
1 1 -1 1 1 1 -1 1