mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
translated TKSV JSONEachRow and XML
This commit is contained in:
parent
0d9f191d28
commit
a2e80b114f
@ -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, expect 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 <20> 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.
|
||||
|
Loading…
Reference in New Issue
Block a user