未验证 提交 4bf3a3e7 编写于 作者: R Roman Bug 提交者: GitHub

DOCSUP-711: Add description for setting output_format_json_quote_denormals (#13391)

* DOCSUP-711: (en) In settings added description for output_format_json_quote_denormals.

* DOCSUP-711: Fix invalid anchor.

* DOCSUP-711: (ru) In settings added description for output_format_json_quote_denormals.

* DOCSUP-711: Change values styles.

* DOCSUP-711: Add a link from the setting description to the JSON format description. (by pr comment)
Add a link from the JSON format description to the setting description. (by pr comment)

* DOCSUP-711: Rewrite sentence.

* DOCSUP-711: (ru) Added link from settings.md to JSON format.

* DOCSUP-711: (en) Added example of output with the setting (by pr comment).

* DOCSUP-711: Add example of output with the setting.

* DOCSUP-711: Minor fix.

* DOCSUP-711: Update example of settings using.

* DOCSUP-711: Minor fix.

* Update docs/en/interfaces/formats.md by pr
Co-authored-by: NBayoNet <da-daos@yandex.ru>

* [wip]Update docs/en/operations/settings/settings.md
Co-authored-by: NBayoNet <da-daos@yandex.ru>

* DOCSUP-711: (en) Add sample table and fix pr comments.

* DOCSUP-711: (ru) Updated from en and by pr comments.

* DOCSUP-711: (ru) Updated from en and by pr comments.

* DOCSUP-711: Added name for sample table.

* Update docs/ru/operations/settings/settings.md by pr comment
Co-authored-by: NBayoNet <da-daos@yandex.ru>

* Update docs/ru/interfaces/formats.md  by pr comment
Co-authored-by: NBayoNet <da-daos@yandex.ru>

* Update settings.md

* Update settings.md
Co-authored-by: Nromanzhukov <romanzhukov@yandex-team.ru>
Co-authored-by: NBayoNet <da-daos@yandex.ru>
上级 6afbcfe9
......@@ -464,7 +464,7 @@ If the query contains GROUP BY, rows\_before\_limit\_at\_least is the exact numb
This format is only appropriate for outputting a query result, but not for parsing (retrieving data to insert in a table).
ClickHouse supports [NULL](../sql-reference/syntax.md), which is displayed as `null` in the JSON output.
ClickHouse supports [NULL](../sql-reference/syntax.md), which is displayed as `null` in the JSON output. To enable `+nan`, `-nan`, `+inf`, `-inf` values in output, set the [output\_format\_json\_quote\_denormals](../operations/settings/settings.md#settings-output_format_json_quote_denormals) to 1.
See also the [JSONEachRow](#jsoneachrow) format.
......
......@@ -998,6 +998,105 @@ The results of the compilation are saved in the build directory in the form of .
If the value is true, integers appear in quotes when using JSON\* Int64 and UInt64 formats (for compatibility with most JavaScript implementations); otherwise, integers are output without the quotes.
## output\_format\_json\_quote\_denormals {#settings-output_format_json_quote_denormals}
Enables `+nan`, `-nan`, `+inf`, `-inf` outputs in [JSON](../../interfaces/formats.md#json) output format.
Possible values:
- 0 — Disabled.
- 1 — Enabled.
Default value: 0.
**Example**
Consider the following table `account_orders`:
```text
┌─id─┬─name───┬─duration─┬─period─┬─area─┐
│ 1 │ Andrew │ 20 │ 0 │ 400 │
│ 2 │ John │ 40 │ 0 │ 0 │
│ 3 │ Bob │ 15 │ 0 │ -100 │
└────┴────────┴──────────┴────────┴──────┘
```
When `output_format_json_quote_denormals = 0`, the query returns `null` values in output:
```sql
SELECT area/period FROM account_orders FORMAT JSON;
```
```json
{
"meta":
[
{
"name": "divide(area, period)",
"type": "Float64"
}
],
"data":
[
{
"divide(area, period)": null
},
{
"divide(area, period)": null
},
{
"divide(area, period)": null
}
],
"rows": 3,
"statistics":
{
"elapsed": 0.003648093,
"rows_read": 3,
"bytes_read": 24
}
}
```
When `output_format_json_quote_denormals = 1`, the query returns:
```json
{
"meta":
[
{
"name": "divide(area, period)",
"type": "Float64"
}
],
"data":
[
{
"divide(area, period)": "inf"
},
{
"divide(area, period)": "-nan"
},
{
"divide(area, period)": "-inf"
}
],
"rows": 3,
"statistics":
{
"elapsed": 0.000070241,
"rows_read": 3,
"bytes_read": 24
}
}
```
## format\_csv\_delimiter {#settings-format_csv_delimiter}
The character interpreted as a delimiter in the CSV data. By default, the delimiter is `,`.
......
......@@ -432,7 +432,7 @@ JSON совместим с JavaScript. Для этого, дополнитель
Этот формат подходит только для вывода результата выполнения запроса, но не для парсинга (приёма данных для вставки в таблицу).
ClickHouse поддерживает [NULL](../sql-reference/syntax.md), который при выводе JSON будет отображен как `null`.
ClickHouse поддерживает [NULL](../sql-reference/syntax.md), который при выводе JSON будет отображен как `null`. Чтобы включить отображение в результате значений `+nan`, `-nan`, `+inf`, `-inf`, установите параметр [output\_format\_json\_quote\_denormals](../operations/settings/settings.md#settings-output_format_json_quote_denormals) равным 1.
Смотрите также формат [JSONEachRow](#jsoneachrow) .
......
......@@ -908,6 +908,105 @@ load_balancing = first_or_random
Если значение истинно, то при использовании JSON\* форматов UInt64 и Int64 числа выводятся в кавычках (из соображений совместимости с большинством реализаций JavaScript), иначе - без кавычек.
## output\_format\_json\_quote\_denormals {#settings-output_format_json_quote_denormals}
При выводе данных в формате [JSON](../../interfaces/formats.md#json) включает отображение значений `+nan`, `-nan`, `+inf`, `-inf`.
Возможные значения:
- 0 — выключена.
- 1 — включена.
Значение по умолчанию: 0.
**Пример**
Рассмотрим следующую таблицу `account_orders`:
```text
┌─id─┬─name───┬─duration─┬─period─┬─area─┐
│ 1 │ Andrew │ 20 │ 0 │ 400 │
│ 2 │ John │ 40 │ 0 │ 0 │
│ 3 │ Bob │ 15 │ 0 │ -100 │
└────┴────────┴──────────┴────────┴──────┘
```
Когда `output_format_json_quote_denormals = 0`, следующий запрос возвращает значения `null`.
```sql
SELECT area/period FROM account_orders FORMAT JSON;
```
```json
{
"meta":
[
{
"name": "divide(area, period)",
"type": "Float64"
}
],
"data":
[
{
"divide(area, period)": null
},
{
"divide(area, period)": null
},
{
"divide(area, period)": null
}
],
"rows": 3,
"statistics":
{
"elapsed": 0.003648093,
"rows_read": 3,
"bytes_read": 24
}
}
```
Если `output_format_json_quote_denormals = 1`, то запрос вернет:
```json
{
"meta":
[
{
"name": "divide(area, period)",
"type": "Float64"
}
],
"data":
[
{
"divide(area, period)": "inf"
},
{
"divide(area, period)": "-nan"
},
{
"divide(area, period)": "-inf"
}
],
"rows": 3,
"statistics":
{
"elapsed": 0.000070241,
"rows_read": 3,
"bytes_read": 24
}
}
```
## format\_csv\_delimiter {#settings-format_csv_delimiter}
Символ, интерпретируемый как разделитель в данных формата CSV. По умолчанию — `,`.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册