Skip to content

Commit 5a2e6e8

Browse files
authored
docs(clickhouse): entry into the accursed (#10174)
Random number generation is cursed in ClickHouse.
1 parent 1667f43 commit 5a2e6e8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/reference/cursed_knowledge.qmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ execution engines.
1414
* Impala's `LTRIM` and `RTRIM` functions accept a _set_ of whitespace (or other)
1515
characters to remove from the left-, and right-hand-side sides of the input
1616
string, but the `TRIM` function only removes _spaces_.
17+
18+
## ClickHouse
19+
20+
* [ClickHouse's random number generating
21+
functions](https://clickhouse.com/docs/en/sql-reference/functions/random-functions)
22+
are considered in [common subexpression
23+
elimination](https://en.wikipedia.org/wiki/Common_subexpression_elimination),
24+
so to get two unique random numbers, users must defeat that optimization.
25+
This is done by passing **any** argument to those functions. It's left as an
26+
exercise for the reader to figure out how to generate two unique inputs.

0 commit comments

Comments
 (0)