Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCSUP-4617: Document the union_default_mode setting #18153

Conversation

sevirov
Copy link
Contributor

@sevirov sevirov commented Dec 16, 2020

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category:

Задокументировал настройку union_default_mode.
@robot-clickhouse robot-clickhouse added the pr-documentation Documentation PRs for the specific code PR label Dec 16, 2020
…-DOCSUP-4617-document_union_default_mode_setting
Изменил заголовок примера.
Убрал лишние символы.
Добавил подраздел в русскую версию, чтобы исправить битую ссылку.
Выполнил перевод на русский язык.
@sevirov sevirov marked this pull request as ready for review December 20, 2020 17:23
@sevirov
Copy link
Contributor Author

sevirov commented Dec 20, 2020

@akuzm Please, review this PR.

@@ -2459,4 +2458,65 @@ Possible values:

Default value: `0`.

## union_default_mode {#union-default-mode}

Sets a special mode for combining `SELECT` query results using the [UNION](../../sql-reference/statements/select/union-all.md) expression.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing special with this mode.

@@ -2459,4 +2458,65 @@ Possible values:

Default value: `0`.

## union_default_mode {#union-default-mode}

Sets a special mode for combining `SELECT` query results using the [UNION](../../sql-reference/statements/select/union-all.md) expression.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be highlighted that it relates only to UNION without explicit UNION ALL or UNION DISTINCT specification.

Поддерживается только `UNION ALL`. Обычный `UNION` (`UNION DISTINCT`) не поддерживается. Если вам это нужно `UNION DISTINCT`, вы можете написать `SELECT DISTINCT` из подзапроса, содержащего `UNION ALL`.
Разница между `UNION ALL` и `UNION DISTINCT` в том, что `UNION DISTINCT` выполняет явное преобразование для результата объединения. Это равнозначно выражению `SELECT DISTINCT` из подзапроса, содержащего `UNION ALL`.

# Секция UNION {#union-clause}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо переписать - пусть будет всё про одну секцию UNION, которая специфицируется с помощью указания ALL или DISTINCT.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@alexey-milovidov alexey-milovidov self-assigned this Dec 20, 2020
Объединил все в один раздел UNION.
Переструктурировал текст.
Подкорректировал английскую и русскую версии.
@sevirov
Copy link
Contributor Author

sevirov commented Dec 27, 2020

@alexey-milovidov Please, review this PR.

…-DOCSUP-4617-document_union_default_mode_setting

Type casting is performed for unions. For example, if two queries being combined have the same field with non-`Nullable` and `Nullable` types from a compatible type, the resulting `UNION` has a `Nullable` type field.

Queries that are parts of `UNION` can’t be enclosed in round brackets. [ORDER BY](../../../sql-reference/statements/select/order-by.md) and [LIMIT](../../../sql-reference/statements/select/limit.md) are applied to separate queries, not to the final result. If you need to apply a conversion to the final result, you can put all the queries with `UNION` in a subquery in the [FROM](../../../sql-reference/statements/select/from.md) clause.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now they can.

(SELECT 1 UNION SELECT 2) UNION (SELECT 3 UNION SELECT 2);

Изменил возможность записывать подзапросы с union в круглых скобках.
@sevirov
Copy link
Contributor Author

sevirov commented Dec 29, 2020

@alexey-milovidov Please, check this PR. I fixed it.

@alexey-milovidov
Copy link
Member

Perftect.

@alexey-milovidov alexey-milovidov merged commit b7be1a8 into ClickHouse:master Dec 30, 2020
@alexey-milovidov
Copy link
Member

I decided to make a change in #18615 and has reflected it in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-documentation Documentation PRs for the specific code PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants