diff --git a/doc/reference_en.html b/doc/reference_en.html index 6c11f266cbd..3d12bd74ddd 100644 --- a/doc/reference_en.html +++ b/doc/reference_en.html @@ -3764,8 +3764,8 @@ If the query contains GROUP BY, %%rows_before_limit_at_least%% is the exact numb %%extremes%% - Extreme values (when %%extremes%% is set to 1). -This format is only appropriate for writes, not for reads. - +This format is only appropriate for reads (SELECT queries), not for writes (INSERT queries). +See JSONEachRow format for INSERT queries. ==JSONCompact== @@ -3809,6 +3809,129 @@ Differs from JSON only in that data rows are output in arrays, not in objects. E %% +==JSONEachRow== + +If put in SELECT query, displays data in NEWLINE_DELIMITED_JSON (JSON objects separated by \\n character) format. +If put in INSERT query, expects this kind of data as input. + +%% +{"SearchPhrase":"","count()":"8267016"} +{"SearchPhrase":"bathroom interior","count()":"2166"} +{"SearchPhrase":"yandex","count()":"1655"} +{"SearchPhrase":"spring 2014 fashion","count()":"1549"} +{"SearchPhrase":"free-form photo","count()":"1480"} +{"SearchPhrase":"Angelina Jolie","count()":"1245"} +{"SearchPhrase":"omsk","count()":"1112"} +{"SearchPhrase":"photos of dog breeds","count()":"1091"} +{"SearchPhrase":"curtain design","count()":"1064"} +{"SearchPhrase":"baku","count()":"1000"} +%% + +Unlike JSON format, there are no replacements of invalid UTF-8 sequences. There can be arbitrary amount of bytes in a line. +This is done in order to avoid data loss during formatting. Values are displayed analogous to JSON format. + +In INSERT queries JSON data can be supplied with arbitrary order of columns(JSON key-value pairs). It is also possible to omit values in which case the default value of the column is inserted. N.B. when using JSONEachRow format, complex default values are not supported, so when omitting a column its value will be zeros or empty string depending on its type. +Space characters between JSON objects are skipped. Between objects there can be a comma which is ignored. NEWLINE character is not a mandatory separator for objects. + + +==TSKV== + +Similar to TabSeparated, but displays data in %%name=value%% format. Names are displayed just as in TabSeparated. Additionally, a %%=%% symbol is displayed. + +%% +SearchPhrase= count()=8267016 +SearchPhrase=bathroom interior count()=2166 +SearchPhrase=yandex count()=1655 +SearchPhrase=spring 2014 fashion count()=1549 +SearchPhrase=free-form photo count()=1480 +SearchPhrase=Angelina Jolie count()=1245 +SearchPhrase=omsk count()=1112 +SearchPhrase=photos of dog breeds count()=1091 +SearchPhrase=curtain design count()=1064 +SearchPhrase=baku count()=1000 +%% + +In case of many small columns this format is obviously not effective and there usually is no reason to use it. This format is supported because it is used for some cases in Yandex. + +Format is supported both for read and write. In INSERT queries data can be supplied with arbitrary order of columns. It is also possible to omit values in which case the default value of the column is inserted. N.B. when using TSKV format, complex default values are not supported, so when omitting a column its value will be zeros or empty string depending on its type. + + + +==XML== + +XML format is supported only for displaying data not for INSERTS. Example: + +%% +<?xml version='1.0' encoding='UTF-8' ?> +<result> + <meta> + <columns> + <column> + <name>SearchPhrase</name> + <type>String</type> + </column> + <column> + <name>count()</name> + <type>UInt64</type> + </column> + </columns> + </meta> + <data> + <row> + <SearchPhrase></SearchPhrase> + <field>8267016</field> + </row> + <row> + <SearchPhrase>bathroom interior</SearchPhrase> + <field>2166</field> + </row> + <row> + <SearchPhrase>yandex> + <field>1655</field> + </row> + <row> + <SearchPhrase>spring 2014 fashion</SearchPhrase> + <field>1549</field> + </row> + <row> + <SearchPhrase>free-form photo</SearchPhrase> + <field>1480</field> + </row> + <row> + <SearchPhrase>Angelina Jolie</SearchPhrase> + <field>1245</field> + </row> + <row> + <SearchPhrase>omsk</SearchPhrase> + <field>1112</field> + </row> + <row> + <SearchPhrase>photos of dog breeds</SearchPhrase> + <field>1091</field> + </row> + <row> + <SearchPhrase>curtain design</SearchPhrase> + <field>1064</field> + </row> + <row> + <SearchPhrase>baku</SearchPhrase> + <field>1000</field> + </row> + </data> + <rows>10</rows> + <rows_before_limit_at_least>141137</rows_before_limit_at_least> +</result> +%% + +If name of a column contains some unacceptable character, field is used as a name. In other aspects XML uses JSON structure. +As in case of JSON, invalid UTF-8 sequences are replaced by replacement character � so displayed text will only contain valid UTF-8 sequences. + +In string values %%<%% and %%&%% are displayed as %%&lt;%% and %%&amp;%%. + +Arrays are displayed as %%<array><elem>Hello</elem><elem>World</elem>...</array>%%, +and tuples as %%<tuple><elem>Hello</elem><elem>World</elem>...</tuple>%%. + + ==Null== Nothing is output. However, the query is processed, and when using the command-line client, data is transmitted to the client. This is used for tests, including productivity testing. Obviously, this format is only appropriate for writes, not for reads. diff --git a/doc/reference_ru.html b/doc/reference_ru.html index bf5d7411ef5..b76121627a4 100644 --- a/doc/reference_ru.html +++ b/doc/reference_ru.html @@ -3843,7 +3843,7 @@ JSON совместим с JavaScript. Для этого, дополнитель %%extremes%% - экстремальные значения (при настройке %%extremes%%, выставленной в 1). -Формат подходит только для записи, но не для чтения. +Формат подходит только для чтения (SELECT запросы), но не для записи (INSERT запросы). ==JSONCompact==