Add isNotDistinctFrom to documentation

This commit is contained in:
Blargian 2024-05-08 13:56:49 +02:00
parent 70c6419651
commit b48ee1b949
2 changed files with 31 additions and 1 deletions

View File

@ -137,6 +137,36 @@ Result:
└───┘
```
## isNotDistinctFrom
Performs null-safe comparison. Used to compare JOIN keys which contain NULL values in the JOIN ON section.
This function will consider two `NULL` values as identical and will return `true`, which is distinct from the usual
equals behavior where comparing two `NULL` values would return `NULL`.
:::note
This function can only be used as part of a JOIN ON section of a query. The function is unimplemented for any other use.
:::
**Syntax**
``` sql
isNotDistinctFrom(x, y)
```
**Arguments**
- `x` — first JOIN key.
- `y` — second JOIN key.
**Returned value**
- `true` when `x` and `y` are both `NULL`.
- `false` otherwise.
**Example**
For a complete example see: [NULL values in JOIN keys](../../sql-reference/statements/select/join#null-values-in-join-keys).
## isZeroOrNull
Returns whether the argument is 0 (zero) or [NULL](../../sql-reference/syntax.md#null-literal).

View File

@ -14,7 +14,7 @@ ClickHouse использует в выражении индексы, если
:::note Примечание
Существует оптимизация фильтрации под названием [PREWHERE](prewhere.md).
:::
Если в секции необходимо проверить [NULL](../../../sql-reference/syntax.md#null-literal), то используйте операторы [IS NULL](../../operators/index.md#operator-is-null) и [IS NOT NULL](../../operators/index.md#is-not-null), а также соответствующие функции [isNull](../../../sql-reference/functions/null-functions.md#isnull) и [isNotNull](../../../sql-reference/functions/full-functions.md#isnotnull). В противном случае выражение будет считаться всегда не выполненным.
Если в секции необходимо проверить [NULL](../../../sql-reference/syntax.md#null-literal), то используйте операторы [IS NULL](../../operators/index.md#operator-is-null) и [IS NOT NULL](../../operators/index.md#is-not-null), а также соответствующие функции [isNull](../../../sql-reference/functions/null-functions.md#isnull) и [isNotNull](../../../sql-reference/functions/null-functions.md#isnotnull). В противном случае выражение будет считаться всегда не выполненным.
**Пример**