From 5a2e6e8314d256b66002f473af55a3d955be9c73 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:47:31 -0400 Subject: [PATCH] docs(clickhouse): entry into the accursed (#10174) Random number generation is cursed in ClickHouse. --- docs/reference/cursed_knowledge.qmd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/reference/cursed_knowledge.qmd b/docs/reference/cursed_knowledge.qmd index 73e8db1d6e05..d0042243d706 100644 --- a/docs/reference/cursed_knowledge.qmd +++ b/docs/reference/cursed_knowledge.qmd @@ -14,3 +14,13 @@ execution engines. * Impala's `LTRIM` and `RTRIM` functions accept a _set_ of whitespace (or other) characters to remove from the left-, and right-hand-side sides of the input string, but the `TRIM` function only removes _spaces_. + +## ClickHouse + +* [ClickHouse's random number generating + functions](https://clickhouse.com/docs/en/sql-reference/functions/random-functions) + are considered in [common subexpression + elimination](https://en.wikipedia.org/wiki/Common_subexpression_elimination), + so to get two unique random numbers, users must defeat that optimization. + This is done by passing **any** argument to those functions. It's left as an + exercise for the reader to figure out how to generate two unique inputs.