find . -name '*.md' -type f | xargs -I{} perl -pi -e 's//g' {}

This commit is contained in:
Ivan Blinkov 2018-10-16 12:40:37 +03:00
parent 89f2886b51
commit 71e030323e
70 changed files with 197 additions and 197 deletions

View File

@ -44,7 +44,7 @@ WHERE CounterID = 101500 AND length(Goals.ID) < 5
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ ┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐
│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ │ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │
│ [1073752] │ ['2014-03-17 00:28:25'] │ │ [1073752] │ ['2014-03-17 00:28:25'] │
@ -73,7 +73,7 @@ WHERE CounterID = 101500 AND length(Goals.ID) < 5
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Goal.ID─┬──────Goal.EventTime─┐ ┌─Goal.ID─┬──────Goal.EventTime─┐
│ 1073752 │ 2014-03-17 16:38:10 │ │ 1073752 │ 2014-03-17 16:38:10 │
│ 591325 │ 2014-03-17 16:38:48 │ │ 591325 │ 2014-03-17 16:38:48 │

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,7 @@ For testing and development, the system can be installed on a single server or o
In `/etc/apt/sources.list` (or in a separate `/etc/apt/sources.list.d/clickhouse.list` file), add the repository: In `/etc/apt/sources.list` (or in a separate `/etc/apt/sources.list.d/clickhouse.list` file), add the repository:
```text ```
deb http://repo.yandex.ru/clickhouse/deb/stable/ main/ deb http://repo.yandex.ru/clickhouse/deb/stable/ main/
``` ```
@ -51,14 +51,14 @@ To compile, follow the instructions: build.md
You can compile packages and install them. You can compile packages and install them.
You can also use programs without installing packages. You can also use programs without installing packages.
```text ```
Client: dbms/programs/clickhouse-client Client: dbms/programs/clickhouse-client
Server: dbms/programs/clickhouse-server Server: dbms/programs/clickhouse-server
``` ```
For the server, create a catalog with data, such as: For the server, create a catalog with data, such as:
```text ```
/opt/clickhouse/data/default/ /opt/clickhouse/data/default/
/opt/clickhouse/metadata/default/ /opt/clickhouse/metadata/default/
``` ```

View File

@ -48,7 +48,7 @@ The `TabSeparated` format supports outputting total values (when using WITH TOTA
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated`` SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated``
``` ```
```text ```
2014-03-17 1406958 2014-03-17 1406958
2014-03-18 1383658 2014-03-18 1383658
2014-03-19 1405797 2014-03-19 1405797
@ -80,7 +80,7 @@ As an exception, parsing dates with times is also supported in Unix timestamp fo
Strings are output with backslash-escaped special characters. The following escape sequences are used for output: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\'`, `\\`. Parsing also supports the sequences `\a`, `\v`, and `\xHH` (hex escape sequences) and any `\c` sequences, where `c` is any character (these sequences are converted to `c`). Thus, reading data supports formats where a line feed can be written as `\n` or `\`, or as a line feed. For example, the string `Hello world` with a line feed between the words instead of a space can be parsed in any of the following variations: Strings are output with backslash-escaped special characters. The following escape sequences are used for output: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\'`, `\\`. Parsing also supports the sequences `\a`, `\v`, and `\xHH` (hex escape sequences) and any `\c` sequences, where `c` is any character (these sequences are converted to `c`). Thus, reading data supports formats where a line feed can be written as `\n` or `\`, or as a line feed. For example, the string `Hello world` with a line feed between the words instead of a space can be parsed in any of the following variations:
```text ```
Hello\nworld Hello\nworld
Hello\ Hello\
@ -128,7 +128,7 @@ This format is also available under the name `TSVWithNamesAndTypes`.
Similar to TabSeparated, but outputs a value in name=value format. Names are escaped the same way as in TabSeparated format, and the = symbol is also escaped. Similar to TabSeparated, but outputs a value in name=value format. Names are escaped the same way as in TabSeparated format, and the = symbol is also escaped.
```text ```
SearchPhrase= count()=8267016 SearchPhrase= count()=8267016
SearchPhrase=bathroom interior design count()=2166 SearchPhrase=bathroom interior design count()=2166
SearchPhrase=yandex count()=1655 SearchPhrase=yandex count()=1655
@ -382,7 +382,7 @@ The Pretty format supports outputting total values (when using WITH TOTALS) and
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact
``` ```
```text ```
┌──EventDate─┬───────c─┐ ┌──EventDate─┬───────c─┐
│ 2014-03-17 │ 1406958 │ │ 2014-03-17 │ 1406958 │
│ 2014-03-18 │ 1383658 │ │ 2014-03-18 │ 1383658 │

View File

@ -18,7 +18,7 @@ Example: The number of SELECT queries currently running; the amount of memory in
Contains information about clusters available in the config file and the servers in them. Contains information about clusters available in the config file and the servers in them.
Columns: Columns:
```text ```
cluster String — The cluster name. cluster String — The cluster name.
shard_num UInt32 — The shard number in the cluster, starting from 1. shard_num UInt32 — The shard number in the cluster, starting from 1.
shard_weight UInt32 — The relative weight of the shard when writing data. shard_weight UInt32 — The relative weight of the shard when writing data.
@ -34,7 +34,7 @@ user String — The name of the user for connecting to the server.
Contains information about the columns in all tables. Contains information about the columns in all tables.
You can use this table to get information similar to `DESCRIBE TABLE`, but for multiple tables at once. You can use this table to get information similar to `DESCRIBE TABLE`, but for multiple tables at once.
```text ```
database String — The name of the database the table is in. database String — The name of the database the table is in.
table String Table name. table String Table name.
name String — Column name. name String — Column name.
@ -183,7 +183,7 @@ Formats:
This system table is used for implementing the `SHOW PROCESSLIST` query. This system table is used for implementing the `SHOW PROCESSLIST` query.
Columns: Columns:
```text ```
user String Name of the user who made the request. For distributed query processing, this is the user who helped the requestor server send the query to this server, not the user who made the distributed request on the requestor server. user String Name of the user who made the request. For distributed query processing, this is the user who helped the requestor server send the query to this server, not the user who made the distributed request on the requestor server.
address String - The IP address the request was made from. The same for distributed processing. address String - The IP address the request was made from. The same for distributed processing.
@ -217,7 +217,7 @@ WHERE table = 'visits'
FORMAT Vertical FORMAT Vertical
``` ```
```text ```
Row 1: Row 1:
────── ──────
database: merge database: merge
@ -243,7 +243,7 @@ active_replicas: 2
Columns: Columns:
```text ```
database: Database name database: Database name
table: Table name table: Table name
engine: Table engine name engine: Table engine name
@ -335,7 +335,7 @@ I.e. used for executing the query you are using to read from the system.settings
Columns: Columns:
```text ```
name String — Setting name. name String — Setting name.
value String — Setting value. value String — Setting value.
changed UInt8 — Whether the setting was explicitly defined in the config or explicitly changed. changed UInt8 — Whether the setting was explicitly defined in the config or explicitly changed.
@ -349,7 +349,7 @@ FROM system.settings
WHERE changed WHERE changed
``` ```
```text ```
┌─name───────────────────┬─value───────┬─changed─┐ ┌─name───────────────────┬─value───────┬─changed─┐
│ max_threads │ 8 │ 1 │ │ max_threads │ 8 │ 1 │
│ use_uncompressed_cache │ 0 │ 1 │ │ use_uncompressed_cache │ 0 │ 1 │
@ -400,7 +400,7 @@ WHERE path = '/clickhouse/tables/01-08/visits/replicas'
FORMAT Vertical FORMAT Vertical
``` ```
```text ```
Row 1: Row 1:
────── ──────
name: example01-08-1.yandex.ru name: example01-08-1.yandex.ru

View File

@ -2,7 +2,7 @@
Buffers the data to write in RAM, periodically flushing it to another table. During the read operation, data is read from the buffer and the other table simultaneously. Buffers the data to write in RAM, periodically flushing it to another table. During the read operation, data is read from the buffer and the other table simultaneously.
```text ```
Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes)
``` ```

View File

@ -7,7 +7,7 @@ Reading is automatically parallelized. During a read, the table indexes on remot
The Distributed engine accepts parameters: the cluster name in the server's config file, the name of a remote database, the name of a remote table, and (optionally) a sharding key. The Distributed engine accepts parameters: the cluster name in the server's config file, the name of a remote database, the name of a remote table, and (optionally) a sharding key.
Example: Example:
```text ```
Distributed(logs, default, hits[, sharding_key]) Distributed(logs, default, hits[, sharding_key])
``` ```

View File

@ -51,7 +51,7 @@ two 2
SELECT * FROM file_engine_table SELECT * FROM file_engine_table
``` ```
```text ```
┌─name─┬─value─┐ ┌─name─┬─value─┐
│ one │ 1 │ │ one │ 1 │
│ two │ 2 │ │ two │ 2 │

View File

@ -27,7 +27,7 @@ The Graphite data table must contain the following fields at minimum:
Rollup pattern: Rollup pattern:
```text ```
pattern pattern
regexp regexp
function function

View File

@ -2,7 +2,7 @@
A prepared data structure for JOIN that is always located in RAM. A prepared data structure for JOIN that is always located in RAM.
```text ```
Join(ANY|ALL, LEFT|INNER, k1[, k2, ...]) Join(ANY|ALL, LEFT|INNER, k1[, k2, ...])
``` ```

View File

@ -78,7 +78,7 @@ Two parameters are also added in the beginning of the parameters list the pa
Example: Example:
```text ```
ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/hits', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/hits', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192)
``` ```

View File

@ -32,7 +32,7 @@ Then this nested table is interpreted as a mapping of key `=>` (values...), and
Examples: Examples:
```text ```
[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] [(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)]
[(1, 100)] + [(1, 150)] -> [(1, 250)] [(1, 100)] + [(1, 150)] -> [(1, 250)]
[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] [(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)]

View File

@ -57,7 +57,7 @@ python3 server.py
SELECT * FROM url_engine_table SELECT * FROM url_engine_table
``` ```
```text ```
┌─word──┬─value─┐ ┌─word──┬─value─┐
│ Hello │ 1 │ │ Hello │ 1 │
│ World │ 2 │ │ World │ 2 │

View File

@ -178,7 +178,7 @@ dynamicConfigFile=/etc/zookeeper-{{ cluster['name'] }}/conf/zoo.cfg.dynamic
Java version: Java version:
```text ```
Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
``` ```
@ -226,7 +226,7 @@ JAVA_OPTS="-Xms{{ cluster.get('xms','128M') }} \
Salt init: Salt init:
```text ```
description "zookeeper-{{ cluster['name'] }} centralized coordination service" description "zookeeper-{{ cluster['name'] }} centralized coordination service"
start on runlevel [2345] start on runlevel [2345]

View File

@ -23,7 +23,7 @@ Example: `sequenceMatch ('(?1).*(?2)')(EventTime, URL LIKE '%company%', URL LIKE
This is a singular example. You could write it using other aggregate functions: This is a singular example. You could write it using other aggregate functions:
```text ```
minIf(EventTime, URL LIKE '%company%') < maxIf(EventTime, URL LIKE '%cart%'). minIf(EventTime, URL LIKE '%company%') < maxIf(EventTime, URL LIKE '%cart%').
``` ```
@ -151,7 +151,7 @@ It works as fast as possible, except for cases when a large N value is used and
Usage example: Usage example:
```text ```
Problem: Generate a report that shows only keywords that produced at least 5 unique users. Problem: Generate a report that shows only keywords that produced at least 5 unique users.
Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5
``` ```

View File

@ -122,7 +122,7 @@ FROM sum_map
GROUP BY timeslot GROUP BY timeslot
``` ```
```text ```
┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ ┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐
│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ │ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │
│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ │ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │

View File

@ -8,7 +8,7 @@ Example:
SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0)
``` ```
```text ```
┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ ┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐
│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ │ UInt8 │ UInt16 │ UInt32 │ UInt64 │
└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ └───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘

View File

@ -144,7 +144,7 @@ WHERE CounterID = 160656
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Reaches─┬──Hits─┐ ┌─Reaches─┬──Hits─┐
│ 95606 │ 31406 │ │ 95606 │ 31406 │
└─────────┴───────┘ └─────────┴───────┘
@ -160,7 +160,7 @@ FROM test.hits
WHERE (CounterID = 160656) AND notEmpty(GoalsReached) WHERE (CounterID = 160656) AND notEmpty(GoalsReached)
``` ```
```text ```
┌─Reaches─┬──Hits─┐ ┌─Reaches─┬──Hits─┐
│ 95606 │ 31406 │ │ 95606 │ 31406 │
└─────────┴───────┘ └─────────┴───────┘
@ -191,7 +191,7 @@ ORDER BY Reaches DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌──GoalID─┬─Reaches─┬─Visits─┐ ┌──GoalID─┬─Reaches─┬─Visits─┐
│ 53225 │ 3214 │ 1097 │ │ 53225 │ 3214 │ 1097 │
│ 2825062 │ 3188 │ 1097 │ │ 2825062 │ 3188 │ 1097 │
@ -214,7 +214,7 @@ The arrayEnumerateUniq function can take multiple arrays of the same size as arg
SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res
``` ```
```text ```
┌─res───────────┐ ┌─res───────────┐
│ [1,2,1,1,2,1] │ │ [1,2,1,1,2,1] │
└───────────────┘ └───────────────┘

View File

@ -21,7 +21,7 @@ Example:
SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src
``` ```
```text ```
┌─dst─┬─\'Hello\'─┬─src─────┐ ┌─dst─┬─\'Hello\'─┬─src─────┐
│ 1 │ Hello │ [1,2,3] │ │ 1 │ Hello │ [1,2,3] │
│ 2 │ Hello │ [1,2,3] │ │ 2 │ Hello │ [1,2,3] │

View File

@ -12,7 +12,7 @@ SELECT
toString(time, 'US/Samoa') AS time_samoa toString(time, 'US/Samoa') AS time_samoa
``` ```
```text ```
┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ ┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐
│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │
└─────────────────────┴────────────┴────────────┴─────────────────────┘ └─────────────────────┴────────────┴────────────┴─────────────────────┘

View File

@ -29,7 +29,7 @@ Generates an exception when the input parameter values fall outside of the range
SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)
``` ```
```text ```
┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ ┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐
│ 14132374.194975413 │ │ 14132374.194975413 │
└───────────────────────────────────────────────────────────────────┘ └───────────────────────────────────────────────────────────────────┘
@ -62,7 +62,7 @@ The input parameters must be `2+4⋅n`, where `n` is the number of ellipses.
SELECT pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1.0, 2.0) SELECT pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1.0, 2.0)
``` ```
```text ```
┌─pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1., 2.)─┐ ┌─pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1., 2.)─┐
│ 1 │ │ 1 │
└─────────────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────────────┘

View File

@ -26,7 +26,7 @@ Examples:
SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res
``` ```
```text ```
┌─res───────────┐ ┌─res───────────┐
│ ['abc World'] │ │ ['abc World'] │
└───────────────┘ └───────────────┘
@ -41,7 +41,7 @@ SELECT
AS res AS res
``` ```
```text ```
┌─res─┐ ┌─res─┐
│ [2] │ │ [2] │
└─────┘ └─────┘
@ -81,7 +81,7 @@ Example:
SELECT arrayCumSum([1, 1, 1, 1]) AS res SELECT arrayCumSum([1, 1, 1, 1]) AS res
``` ```
```text ```
┌─res──────────┐ ┌─res──────────┐
│ [1, 2, 3, 4] │ │ [1, 2, 3, 4] │
└──────────────┘ └──────────────┘
@ -99,7 +99,7 @@ Example:
SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]);
``` ```
```text ```
┌─res────────────────┐ ┌─res────────────────┐
│ ['world', 'hello'] │ │ ['world', 'hello'] │
└────────────────────┘ └────────────────────┘

View File

@ -24,7 +24,7 @@ ORDER BY c DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─k──────────────┬─────c─┐ ┌─k──────────────┬─────c─┐
│ 83.149.9.xxx │ 26238 │ │ 83.149.9.xxx │ 26238 │
│ 217.118.81.xxx │ 26074 │ │ 217.118.81.xxx │ 26074 │
@ -50,7 +50,7 @@ IPv6-mapped IPv4 addresses are output in the format ::ffff:111.222.33.44. Exampl
SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr
``` ```
```text ```
┌─addr─────────┐ ┌─addr─────────┐
│ 2a02:6b8::11 │ │ 2a02:6b8::11 │
└──────────────┘ └──────────────┘
@ -67,7 +67,7 @@ ORDER BY c DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ ┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐
│ 2a02:2168:aaa:bbbb::2 │ 24695 │ │ 2a02:2168:aaa:bbbb::2 │ 24695 │
│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ │ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │
@ -93,7 +93,7 @@ ORDER BY c DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─IPv6NumToString(ClientIP6)─┬──────c─┐ ┌─IPv6NumToString(ClientIP6)─┬──────c─┐
│ ::ffff:94.26.111.111 │ 747440 │ │ ::ffff:94.26.111.111 │ 747440 │
│ ::ffff:37.143.222.4 │ 529483 │ │ ::ffff:37.143.222.4 │ 529483 │

View File

@ -35,7 +35,7 @@ Returns the value of a field, including separators.
Examples: Examples:
```text ```
visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"'
visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}'
``` ```
@ -46,7 +46,7 @@ Parses the string in double quotes. The value is unescaped. If unescaping failed
Examples: Examples:
```text ```
visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0'
visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺'
visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' visitParamExtractString('{"abc":"\\u263"}', 'abc') = ''

View File

@ -52,7 +52,7 @@ Example (three sigma rule):
SELECT erf(3 / sqrt(2)) SELECT erf(3 / sqrt(2))
``` ```
```text ```
┌─erf(divide(3, sqrt(2)))─┐ ┌─erf(divide(3, sqrt(2)))─┐
│ 0.9973002039367398 │ │ 0.9973002039367398 │
└─────────────────────────┘ └─────────────────────────┘

View File

@ -93,7 +93,7 @@ GROUP BY h
ORDER BY h ASC ORDER BY h ASC
``` ```
```text ```
┌──h─┬──────c─┬─bar────────────────┐ ┌──h─┬──────c─┬─bar────────────────┐
│ 0 │ 292907 │ █████████▋ │ │ 0 │ 292907 │ █████████▋ │
│ 1 │ 180563 │ ██████ │ │ 1 │ 180563 │ ██████ │
@ -163,7 +163,7 @@ GROUP BY title
ORDER BY c DESC ORDER BY c DESC
``` ```
```text ```
┌─title─────┬──────c─┐ ┌─title─────┬──────c─┐
│ Yandex │ 498635 │ │ Yandex │ 498635 │
│ Google │ 229872 │ │ Google │ 229872 │
@ -192,7 +192,7 @@ ORDER BY count() DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─s──────────────┬───────c─┐ ┌─s──────────────┬───────c─┐
│ │ 2906259 │ │ │ 2906259 │
│ www.yandex │ 867767 │ │ www.yandex │ 867767 │
@ -218,7 +218,7 @@ SELECT
formatReadableSize(filesize_bytes) AS filesize formatReadableSize(filesize_bytes) AS filesize
``` ```
```text ```
┌─filesize_bytes─┬─filesize───┐ ┌─filesize_bytes─┬─filesize───┐
│ 1 │ 1.00 B │ │ 1 │ 1.00 B │
│ 1024 │ 1.00 KiB │ │ 1024 │ 1.00 KiB │
@ -274,7 +274,7 @@ FROM
) )
``` ```
```text ```
┌─EventID─┬───────────EventTime─┬─delta─┐ ┌─EventID─┬───────────EventTime─┬─delta─┐
│ 1106 │ 2016-11-24 00:00:04 │ 0 │ │ 1106 │ 2016-11-24 00:00:04 │ 0 │
│ 1107 │ 2016-11-24 00:00:05 │ 1 │ │ 1107 │ 2016-11-24 00:00:05 │ 1 │

View File

@ -28,7 +28,7 @@ LIMIT 7
FORMAT TabSeparated FORMAT TabSeparated
``` ```
```text ```
2014-03-17 03/17/2014 2014-03-17 03/17/2014
2014-03-18 03/18/2014 2014-03-18 03/18/2014
2014-03-19 03/19/2014 2014-03-19 03/19/2014
@ -44,7 +44,7 @@ Example 2. Copying a string ten times:
SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res
``` ```
```text ```
┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ ┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ │ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
@ -58,7 +58,7 @@ This does the same thing, but replaces all the occurrences. Example:
SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res
``` ```
```text ```
┌─res────────────────────────┐ ┌─res────────────────────────┐
│ HHeelllloo,, WWoorrlldd!! │ │ HHeelllloo,, WWoorrlldd!! │
└────────────────────────────┘ └────────────────────────────┘
@ -71,7 +71,7 @@ Example:
SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res
``` ```
```text ```
┌─res─────────────────┐ ┌─res─────────────────┐
│ here: Hello, World! │ │ here: Hello, World! │
└─────────────────────┘ └─────────────────────┘

View File

@ -24,7 +24,7 @@ When converting dates with times to numbers or vice versa, the date with time co
The date and date-with-time formats for the toDate/toDateTime functions are defined as follows: The date and date-with-time formats for the toDate/toDateTime functions are defined as follows:
```text ```
YYYY-MM-DD YYYY-MM-DD
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
``` ```
@ -43,7 +43,7 @@ SELECT
toString(now(), 'Asia/Yekaterinburg') AS now_yekat toString(now(), 'Asia/Yekaterinburg') AS now_yekat
``` ```
```text ```
┌───────────now_local─┬─now_yekat───────────┐ ┌───────────now_local─┬─now_yekat───────────┐
│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ │ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │
└─────────────────────┴─────────────────────┘ └─────────────────────┴─────────────────────┘
@ -66,7 +66,7 @@ Example:
SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut
``` ```
```text ```
┌─s─────────────┬─s_cut─┐ ┌─s─────────────┬─s_cut─┐
│ foo\0\0\0\0\0 │ foo │ │ foo\0\0\0\0\0 │ foo │
└───────────────┴───────┘ └───────────────┴───────┘
@ -76,7 +76,7 @@ SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut
SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut
``` ```
```text ```
┌─s──────────┬─s_cut─┐ ┌─s──────────┬─s_cut─┐
│ foo\0bar\0 │ foo │ │ foo\0bar\0 │ foo │
└────────────┴───────┘ └────────────┴───────┘
@ -111,7 +111,7 @@ SELECT
CAST(timestamp, 'FixedString(22)') AS fixed_string CAST(timestamp, 'FixedString(22)') AS fixed_string
``` ```
```text ```
┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ ┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐
│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │
└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ └─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘

View File

@ -72,7 +72,7 @@ Returns an array containing the URL, truncated at the end by the symbols /,? in
The same as above, but without the protocol and host in the result. The / element (root) is not included. Example: the function is used to implement tree reports the URL in Yandex. Metric. The same as above, but without the protocol and host in the result. The / element (root) is not included. Example: the function is used to implement tree reports the URL in Yandex. Metric.
```text ```
URLPathHierarchy('https://example.com/browse/CONV-6788') = URLPathHierarchy('https://example.com/browse/CONV-6788') =
[ [
'/browse/', '/browse/',
@ -89,7 +89,7 @@ Example:
SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL;
``` ```
```text ```
┌─DecodedURL─────────────────────────────┐ ┌─DecodedURL─────────────────────────────┐
│ http://127.0.0.1:8123/?query=SELECT 1; │ │ http://127.0.0.1:8123/?query=SELECT 1; │
└────────────────────────────────────────┘ └────────────────────────────────────────┘

View File

@ -20,7 +20,7 @@ All the dictionaries are re-loaded in runtime (once every certain number of seco
All functions for working with regions have an optional argument at the end the dictionary key. It is referred to as the geobase. All functions for working with regions have an optional argument at the end the dictionary key. It is referred to as the geobase.
Example: Example:
```text ```
regionToCountry(RegionID) Uses the default dictionary: /opt/geo/regions_hierarchy.txt regionToCountry(RegionID) Uses the default dictionary: /opt/geo/regions_hierarchy.txt
regionToCountry(RegionID, '') Uses the default dictionary: /opt/geo/regions_hierarchy.txt regionToCountry(RegionID, '') Uses the default dictionary: /opt/geo/regions_hierarchy.txt
regionToCountry(RegionID, 'ua') Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt regionToCountry(RegionID, 'ua') Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt
@ -40,7 +40,7 @@ FROM system.numbers
LIMIT 15 LIMIT 15
``` ```
```text ```
┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ ┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐
│ │ │ │
│ Moscow and Moscow region │ │ Moscow and Moscow region │
@ -70,7 +70,7 @@ FROM system.numbers
LIMIT 15 LIMIT 15
``` ```
```text ```
┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ ┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐
│ │ │ │
│ Central federal district │ │ Central federal district │

View File

@ -86,7 +86,7 @@ Allows executing JOIN with an array or nested data structure. The intent is simi
`ARRAY JOIN` is essentially `INNER JOIN` with an array. Example: `ARRAY JOIN` is essentially `INNER JOIN` with an array. Example:
```text ```
:) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory :) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory
CREATE TABLE arrays_test CREATE TABLE arrays_test
@ -139,7 +139,7 @@ ARRAY JOIN arr
An alias can be specified for an array in the ARRAY JOIN clause. In this case, an array item can be accessed by this alias, but the array itself by the original name. Example: An alias can be specified for an array in the ARRAY JOIN clause. In this case, an array item can be accessed by this alias, but the array itself by the original name. Example:
```text ```
:) SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a :) SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a
SELECT s, arr, a SELECT s, arr, a
@ -159,7 +159,7 @@ ARRAY JOIN arr AS a
Multiple arrays of the same size can be comma-separated in the ARRAY JOIN clause. In this case, JOIN is performed with them simultaneously (the direct sum, not the direct product). Example: Multiple arrays of the same size can be comma-separated in the ARRAY JOIN clause. In this case, JOIN is performed with them simultaneously (the direct sum, not the direct product). Example:
```text ```
:) SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped :) SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped
SELECT s, arr, a, num, mapped SELECT s, arr, a, num, mapped
@ -195,7 +195,7 @@ ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num
ARRAY JOIN also works with nested data structures. Example: ARRAY JOIN also works with nested data structures. Example:
```text ```
:) CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory :) CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory
CREATE TABLE nested_test CREATE TABLE nested_test
@ -250,7 +250,7 @@ ARRAY JOIN nest
When specifying names of nested data structures in ARRAY JOIN, the meaning is the same as ARRAY JOIN with all the array elements that it consists of. Example: When specifying names of nested data structures in ARRAY JOIN, the meaning is the same as ARRAY JOIN with all the array elements that it consists of. Example:
```text ```
:) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y
SELECT s, `nest.x`, `nest.y` SELECT s, `nest.x`, `nest.y`
@ -270,7 +270,7 @@ ARRAY JOIN `nest.x`, `nest.y`
This variation also makes sense: This variation also makes sense:
```text ```
:) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x
SELECT s, `nest.x`, `nest.y` SELECT s, `nest.x`, `nest.y`
@ -290,7 +290,7 @@ ARRAY JOIN `nest.x`
An alias may be used for a nested data structure, in order to select either the JOIN result or the source array. Example: An alias may be used for a nested data structure, in order to select either the JOIN result or the source array. Example:
```text ```
:) SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n :) SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n
SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`
@ -310,7 +310,7 @@ ARRAY JOIN nest AS n
Example of using the arrayEnumerate function: Example of using the arrayEnumerate function:
```text ```
:) SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num :) SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num
SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num
@ -395,7 +395,7 @@ ORDER BY hits DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─CounterID─┬───hits─┬─visits─┐ ┌─CounterID─┬───hits─┬─visits─┐
│ 1143050 │ 523264 │ 13665 │ │ 1143050 │ 523264 │ 13665 │
│ 731962 │ 475698 │ 102716 │ │ 731962 │ 475698 │ 102716 │
@ -787,7 +787,7 @@ GROUP BY EventDate
ORDER BY EventDate ASC ORDER BY EventDate ASC
``` ```
```text ```
┌──EventDate─┬────ratio─┐ ┌──EventDate─┬────ratio─┐
│ 2014-03-17 │ 1 │ │ 2014-03-17 │ 1 │
│ 2014-03-18 │ 0.807696 │ │ 2014-03-18 │ 0.807696 │

View File

@ -18,7 +18,7 @@ remote('addresses_expr', db.table[, 'user'[, 'password']])
Examples: Examples:
```text ```
example01-01-1 example01-01-1
example01-01-1:9000 example01-01-1:9000
localhost localhost
@ -31,19 +31,19 @@ Multiple addresses can be comma-separated. In this case, ClickHouse will use dis
Example: Example:
```text ```
example01-01-1,example01-02-1 example01-01-1,example01-02-1
``` ```
Part of the expression can be specified in curly brackets. The previous example can be written as follows: Part of the expression can be specified in curly brackets. The previous example can be written as follows:
```text ```
example01-0{1,2}-1 example01-0{1,2}-1
``` ```
Curly brackets can contain a range of numbers separated by two dots (non-negative integers). In this case, the range is expanded to a set of values that generate shard addresses. If the first number starts with zero, the values are formed with the same zero alignment. The previous example can be written as follows: Curly brackets can contain a range of numbers separated by two dots (non-negative integers). In this case, the range is expanded to a set of values that generate shard addresses. If the first number starts with zero, the values are formed with the same zero alignment. The previous example can be written as follows:
```text ```
example01-{01..02}-1 example01-{01..02}-1
``` ```
@ -53,7 +53,7 @@ Addresses and parts of addresses in curly brackets can be separated by the pipe
Example: Example:
```text ```
example01-{01..02}-{1|2} example01-{01..02}-{1|2}
``` ```

View File

@ -8,7 +8,7 @@ Enum8 یا Enum16، به شما اجازه ی ذخیره سازی مجموعه
</div> </div>
```text ```
Enum8('hello' = 1, 'world' = 2) Enum8('hello' = 1, 'world' = 2)
``` ```

View File

@ -52,7 +52,7 @@ WHERE CounterID = 101500 AND length(Goals.ID) < 5
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ ┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐
│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ │ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │
│ [1073752] │ ['2014-03-17 00:28:25'] │ │ [1073752] │ ['2014-03-17 00:28:25'] │
@ -85,7 +85,7 @@ WHERE CounterID = 101500 AND length(Goals.ID) < 5
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Goal.ID─┬──────Goal.EventTime─┐ ┌─Goal.ID─┬──────Goal.EventTime─┐
│ 1073752 │ 2014-03-17 16:38:10 │ │ 1073752 │ 2014-03-17 16:38:10 │
│ 591325 │ 2014-03-17 16:38:48 │ │ 591325 │ 2014-03-17 16:38:48 │

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not su
</div> </div>
```text ```
deb http://repo.yandex.ru/clickhouse/deb/stable/ main/ deb http://repo.yandex.ru/clickhouse/deb/stable/ main/
``` ```
@ -58,7 +58,7 @@ ClickHouse دارای تنظیمات محدودیت دسترسی می باشد.
</div> </div>
```text ```
Client: dbms/programs/clickhouse-client Client: dbms/programs/clickhouse-client
Server: dbms/programs/clickhouse-server Server: dbms/programs/clickhouse-server
``` ```
@ -69,7 +69,7 @@ Server: dbms/programs/clickhouse-server
</div> </div>
```text ```
/opt/clickhouse/data/default/ /opt/clickhouse/data/default/
/opt/clickhouse/metadata/default/ /opt/clickhouse/metadata/default/
``` ```

View File

@ -51,7 +51,7 @@ Dates با فرمت YYY-MM-DD نوشته می شوند و به همین حالت
</div> </div>
```text ```
Hello\nworld Hello\nworld
Hello\ Hello\
@ -78,7 +78,7 @@ world
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated`` SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated``
``` ```
```text ```
2014-03-17 1406958 2014-03-17 1406958
2014-03-18 1383658 2014-03-18 1383658
2014-03-19 1405797 2014-03-19 1405797
@ -123,7 +123,7 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD
</div> </div>
```text ```
SearchPhrase= count()=8267016 SearchPhrase= count()=8267016
SearchPhrase=bathroom interior design count()=2166 SearchPhrase=bathroom interior design count()=2166
SearchPhrase=yandex count()=1655 SearchPhrase=yandex count()=1655
@ -354,7 +354,7 @@ JSON با جاوااسکریپت سازگار است. برای اطمینان ا
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact
``` ```
```text ```
┌──EventDate─┬───────c─┐ ┌──EventDate─┬───────c─┐
│ 2014-03-17 │ 1406958 │ │ 2014-03-17 │ 1406958 │
│ 2014-03-18 │ 1383658 │ │ 2014-03-18 │ 1383658 │

View File

@ -44,7 +44,7 @@ WHERE CounterID = 101500 AND length(Goals.ID) < 5
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ ┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐
│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ │ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │
│ [1073752] │ ['2014-03-17 00:28:25'] │ │ [1073752] │ ['2014-03-17 00:28:25'] │
@ -73,7 +73,7 @@ WHERE CounterID = 101500 AND length(Goals.ID) < 5
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Goal.ID─┬──────Goal.EventTime─┐ ┌─Goal.ID─┬──────Goal.EventTime─┐
│ 1073752 │ 2014-03-17 16:38:10 │ │ 1073752 │ 2014-03-17 16:38:10 │
│ 591325 │ 2014-03-17 16:38:48 │ │ 591325 │ 2014-03-17 16:38:48 │

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,7 @@ ClickHouse также работает на FreeBSD и Mac OS X; может бы
Пропишите в `/etc/apt/sources.list` (или в отдельный файл `/etc/apt/sources.list.d/clickhouse.list`) репозитории: Пропишите в `/etc/apt/sources.list` (или в отдельный файл `/etc/apt/sources.list.d/clickhouse.list`) репозитории:
```text ```
deb http://repo.yandex.ru/clickhouse/deb/stable/ main/ deb http://repo.yandex.ru/clickhouse/deb/stable/ main/
``` ```
@ -51,14 +51,14 @@ ClickHouse содержит настройки ограничения досту
Вы можете собрать пакеты и установить их. Вы можете собрать пакеты и установить их.
Также вы можете использовать программы без установки пакетов. Также вы можете использовать программы без установки пакетов.
```text ```
Client: dbms/programs/clickhouse-client Client: dbms/programs/clickhouse-client
Server: dbms/programs/clickhouse-server Server: dbms/programs/clickhouse-server
``` ```
Для сервера создаёте директории с данными, например: Для сервера создаёте директории с данными, например:
```text ```
/opt/clickhouse/data/default/ /opt/clickhouse/data/default/
/opt/clickhouse/metadata/default/ /opt/clickhouse/metadata/default/
``` ```

View File

@ -48,7 +48,7 @@ ClickHouse может принимать (`INSERT`) и отдавать (`SELECT
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated`` SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated``
``` ```
```text ```
2014-03-17 1406958 2014-03-17 1406958
2014-03-18 1383658 2014-03-18 1383658
2014-03-19 1405797 2014-03-19 1405797
@ -80,7 +80,7 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD
Строки выводятся с экранированием спец-символов с помощью обратного слеша. При выводе, используются следующие escape-последовательности: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\'`, `\\`. При парсинге, также поддерживаются последовательности `\a`, `\v`, а также `\xHH` (hex escape-последовательности) и любые последовательности вида `\c`, где `c` - любой символ - такие последовательности преобразуется в `c`. Таким образом, при чтении поддерживаются форматы, где перевод строки может быть записан как `\n` и как `\` и перевод строки. Например, строка `Hello world`, где между словами вместо пробела стоит перевод строки, может быть считана в любом из следующих вариантов: Строки выводятся с экранированием спец-символов с помощью обратного слеша. При выводе, используются следующие escape-последовательности: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\'`, `\\`. При парсинге, также поддерживаются последовательности `\a`, `\v`, а также `\xHH` (hex escape-последовательности) и любые последовательности вида `\c`, где `c` - любой символ - такие последовательности преобразуется в `c`. Таким образом, при чтении поддерживаются форматы, где перевод строки может быть записан как `\n` и как `\` и перевод строки. Например, строка `Hello world`, где между словами вместо пробела стоит перевод строки, может быть считана в любом из следующих вариантов:
```text ```
Hello\nworld Hello\nworld
Hello\ Hello\
@ -128,7 +128,7 @@ world
Похож на TabSeparated, но выводит значения в формате name=value. Имена экранируются так же, как строки в формате TabSeparated и, дополнительно, экранируется также символ =. Похож на TabSeparated, но выводит значения в формате name=value. Имена экранируются так же, как строки в формате TabSeparated и, дополнительно, экранируется также символ =.
```text ```
SearchPhrase= count()=8267016 SearchPhrase= count()=8267016
SearchPhrase=интерьер ванной комнаты count()=2166 SearchPhrase=интерьер ванной комнаты count()=2166
SearchPhrase=яндекс count()=1655 SearchPhrase=яндекс count()=1655
@ -380,7 +380,7 @@ SELECT * FROM t_null
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact
``` ```
```text ```
┌──EventDate─┬───────c─┐ ┌──EventDate─┬───────c─┐
│ 2014-03-17 │ 1406958 │ │ 2014-03-17 │ 1406958 │
│ 2014-03-18 │ 1383658 │ │ 2014-03-18 │ 1383658 │

View File

@ -19,7 +19,7 @@
Содержит информацию о доступных в конфигурационном файле кластерах и серверах, которые в них входят. Содержит информацию о доступных в конфигурационном файле кластерах и серверах, которые в них входят.
Столбцы: Столбцы:
```text ```
cluster String - имя кластера cluster String - имя кластера
shard_num UInt32 - номер шарда в кластере, начиная с 1 shard_num UInt32 - номер шарда в кластере, начиная с 1
shard_weight UInt32 - относительный вес шарда при записи данных shard_weight UInt32 - относительный вес шарда при записи данных
@ -34,7 +34,7 @@ user String - имя пользователя, которого испо
Содержит информацию о столбцах всех таблиц. Содержит информацию о столбцах всех таблиц.
С помощью этой таблицы можно получить информацию аналогично запросу `DESCRIBE TABLE`, но для многих таблиц сразу. С помощью этой таблицы можно получить информацию аналогично запросу `DESCRIBE TABLE`, но для многих таблиц сразу.
```text ```
database String - имя базы данных, в которой находится таблица database String - имя базы данных, в которой находится таблица
table String - имя таблицы table String - имя таблицы
name String - имя столбца name String - имя столбца
@ -159,7 +159,7 @@ default_expression String - выражение для значения по ум
Эта системная таблица используется для реализации запроса `SHOW PROCESSLIST`. Эта системная таблица используется для реализации запроса `SHOW PROCESSLIST`.
Столбцы: Столбцы:
```text ```
user String - имя пользователя, который задал запрос. При распределённой обработке запроса, относится к пользователю, с помощью которого сервер-инициатор запроса отправил запрос на данный сервер, а не к имени пользователя, который задал распределённый запрос на сервер-инициатор запроса. user String - имя пользователя, который задал запрос. При распределённой обработке запроса, относится к пользователю, с помощью которого сервер-инициатор запроса отправил запрос на данный сервер, а не к имени пользователя, который задал распределённый запрос на сервер-инициатор запроса.
address String - IP-адрес, с которого задан запрос. При распределённой обработке запроса, аналогично. address String - IP-адрес, с которого задан запрос. При распределённой обработке запроса, аналогично.
@ -192,7 +192,7 @@ WHERE table = 'visits'
FORMAT Vertical FORMAT Vertical
``` ```
```text ```
Row 1: Row 1:
────── ──────
database: merge database: merge
@ -218,7 +218,7 @@ active_replicas: 2
Столбцы: Столбцы:
```text ```
database: имя БД database: имя БД
table: имя таблицы table: имя таблицы
engine: имя движка таблицы engine: имя движка таблицы
@ -309,7 +309,7 @@ WHERE
Столбцы: Столбцы:
```text ```
name String - имя настройки name String - имя настройки
value String - значение настройки value String - значение настройки
changed UInt8 - была ли настройка явно задана в конфиге или изменена явным образом changed UInt8 - была ли настройка явно задана в конфиге или изменена явным образом
@ -323,7 +323,7 @@ FROM system.settings
WHERE changed WHERE changed
``` ```
```text ```
┌─name───────────────────┬─value───────┬─changed─┐ ┌─name───────────────────┬─value───────┬─changed─┐
│ max_threads │ 8 │ 1 │ │ max_threads │ 8 │ 1 │
│ use_uncompressed_cache │ 0 │ 1 │ │ use_uncompressed_cache │ 0 │ 1 │
@ -375,7 +375,7 @@ WHERE path = '/clickhouse/tables/01-08/visits/replicas'
FORMAT Vertical FORMAT Vertical
``` ```
```text ```
Row 1: Row 1:
────── ──────
name: example01-08-1.yandex.ru name: example01-08-1.yandex.ru

View File

@ -2,7 +2,7 @@
Буферизует записываемые данные в оперативке, периодически сбрасывая их в другую таблицу. При чтении, производится чтение данных одновременно из буфера и из другой таблицы. Буферизует записываемые данные в оперативке, периодически сбрасывая их в другую таблицу. При чтении, производится чтение данных одновременно из буфера и из другой таблицы.
```text ```
Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes)
``` ```

View File

@ -7,7 +7,7 @@
Движок Distributed принимает параметры: имя кластера в конфигурационном файле сервера, имя удалённой базы данных, имя удалённой таблицы, а также (не обязательно) ключ шардирования. Движок Distributed принимает параметры: имя кластера в конфигурационном файле сервера, имя удалённой базы данных, имя удалённой таблицы, а также (не обязательно) ключ шардирования.
Пример: Пример:
```text ```
Distributed(logs, default, hits[, sharding_key]) Distributed(logs, default, hits[, sharding_key])
``` ```

View File

@ -51,7 +51,7 @@ two 2
SELECT * FROM file_engine_table SELECT * FROM file_engine_table
``` ```
```text ```
┌─name─┬─value─┐ ┌─name─┬─value─┐
│ one │ 1 │ │ one │ 1 │
│ two │ 2 │ │ two │ 2 │

View File

@ -27,7 +27,7 @@ Graphite хранит в ClickHouse полные данные, а получат
Шаблон правил rollup: Шаблон правил rollup:
```text ```
pattern pattern
regexp regexp
function function

View File

@ -2,7 +2,7 @@
Представляет собой подготовленную структуру данных для JOIN-а, постоянно находящуюся в оперативке. Представляет собой подготовленную структуру данных для JOIN-а, постоянно находящуюся в оперативке.
```text ```
Join(ANY|ALL, LEFT|INNER, k1[, k2, ...]) Join(ANY|ALL, LEFT|INNER, k1[, k2, ...])
``` ```

View File

@ -78,7 +78,7 @@
Пример: Пример:
```text ```
ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/hits', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/hits', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192)
``` ```

View File

@ -32,7 +32,7 @@ SummingMergeTree(EventDate, (OrderID, EventDate, BannerID, ...), 8192, (Shows, C
Примеры: Примеры:
```text ```
[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] [(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)]
[(1, 100)] + [(1, 150)] -> [(1, 250)] [(1, 100)] + [(1, 150)] -> [(1, 250)]
[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] [(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)]

View File

@ -57,7 +57,7 @@ python3 server.py
SELECT * FROM url_engine_table SELECT * FROM url_engine_table
``` ```
```text ```
┌─word──┬─value─┐ ┌─word──┬─value─┐
│ Hello │ 1 │ │ Hello │ 1 │
│ World │ 2 │ │ World │ 2 │

View File

@ -178,7 +178,7 @@ dynamicConfigFile=/etc/zookeeper-{{ cluster['name'] }}/conf/zoo.cfg.dynamic
Версия Java: Версия Java:
```text ```
Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
``` ```
@ -226,7 +226,7 @@ JAVA_OPTS="-Xms{{ cluster.get('xms','128M') }} \
Salt init: Salt init:
```text ```
description "zookeeper-{{ cluster['name'] }} centralized coordination service" description "zookeeper-{{ cluster['name'] }} centralized coordination service"
start on runlevel [2345] start on runlevel [2345]

View File

@ -23,7 +23,7 @@
Это вырожденный пример. Его можно записать с помощью других агрегатных функций: Это вырожденный пример. Его можно записать с помощью других агрегатных функций:
```text ```
minIf(EventTime, URL LIKE '%company%') < maxIf(EventTime, URL LIKE '%cart%'). minIf(EventTime, URL LIKE '%company%') < maxIf(EventTime, URL LIKE '%cart%').
``` ```
@ -123,7 +123,7 @@ ORDER BY level
Пример применения: Пример применения:
```text ```
Задача: показывать в отчёте только поисковые фразы, по которым было хотя бы 5 уникальных посетителей. Задача: показывать в отчёте только поисковые фразы, по которым было хотя бы 5 уникальных посетителей.
Решение: пишем в запросе GROUP BY SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 Решение: пишем в запросе GROUP BY SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5
``` ```

View File

@ -130,7 +130,7 @@ FROM sum_map
GROUP BY timeslot GROUP BY timeslot
``` ```
```text ```
┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ ┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐
│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ │ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │
│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ │ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │

View File

@ -8,7 +8,7 @@
SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0)
``` ```
```text ```
┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ ┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐
│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ │ UInt8 │ UInt16 │ UInt32 │ UInt64 │
└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ └───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘

View File

@ -135,7 +135,7 @@ WHERE CounterID = 160656
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─Reaches─┬──Hits─┐ ┌─Reaches─┬──Hits─┐
│ 95606 │ 31406 │ │ 95606 │ 31406 │
└─────────┴───────┘ └─────────┴───────┘
@ -151,7 +151,7 @@ FROM test.hits
WHERE (CounterID = 160656) AND notEmpty(GoalsReached) WHERE (CounterID = 160656) AND notEmpty(GoalsReached)
``` ```
```text ```
┌─Reaches─┬──Hits─┐ ┌─Reaches─┬──Hits─┐
│ 95606 │ 31406 │ │ 95606 │ 31406 │
└─────────┴───────┘ └─────────┴───────┘
@ -181,7 +181,7 @@ ORDER BY Reaches DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌──GoalID─┬─Reaches─┬─Visits─┐ ┌──GoalID─┬─Reaches─┬─Visits─┐
│ 53225 │ 3214 │ 1097 │ │ 53225 │ 3214 │ 1097 │
│ 2825062 │ 3188 │ 1097 │ │ 2825062 │ 3188 │ 1097 │
@ -204,7 +204,7 @@ LIMIT 10
SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res
``` ```
```text ```
┌─res───────────┐ ┌─res───────────┐
│ [1,2,1,1,2,1] │ │ [1,2,1,1,2,1] │
└───────────────┘ └───────────────┘

View File

@ -21,7 +21,7 @@
SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src
``` ```
```text ```
┌─dst─┬─\'Hello\'─┬─src─────┐ ┌─dst─┬─\'Hello\'─┬─src─────┐
│ 1 │ Hello │ [1,2,3] │ │ 1 │ Hello │ [1,2,3] │
│ 2 │ Hello │ [1,2,3] │ │ 2 │ Hello │ [1,2,3] │

View File

@ -12,7 +12,7 @@ SELECT
toString(time, 'US/Samoa') AS time_samoa toString(time, 'US/Samoa') AS time_samoa
``` ```
```text ```
┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ ┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐
│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │
└─────────────────────┴────────────┴────────────┴─────────────────────┘ └─────────────────────┴────────────┴────────────┴─────────────────────┘

View File

@ -29,7 +29,7 @@ greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)
``` ```
```text ```
┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ ┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐
│ 14132374.194975413 │ │ 14132374.194975413 │
└───────────────────────────────────────────────────────────────────┘ └───────────────────────────────────────────────────────────────────┘
@ -63,7 +63,7 @@ pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ)
SELECT pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1.0, 2.0) SELECT pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1.0, 2.0)
``` ```
```text ```
┌─pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1., 2.)─┐ ┌─pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1., 2.)─┐
│ 1 │ │ 1 │
└─────────────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────────────┘

View File

@ -26,7 +26,7 @@
SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res
``` ```
```text ```
┌─res───────────┐ ┌─res───────────┐
│ ['abc World'] │ │ ['abc World'] │
└───────────────┘ └───────────────┘
@ -41,7 +41,7 @@ SELECT
AS res AS res
``` ```
```text ```
┌─res─┐ ┌─res─┐
│ [2] │ │ [2] │
└─────┘ └─────┘
@ -75,7 +75,7 @@ SELECT
SELECT arrayCumSum([1, 1, 1, 1]) AS res SELECT arrayCumSum([1, 1, 1, 1]) AS res
``` ```
```text ```
┌─res──────────┐ ┌─res──────────┐
│ [1, 2, 3, 4] │ │ [1, 2, 3, 4] │
└──────────────┘ └──────────────┘
@ -94,7 +94,7 @@ SELECT arrayCumSum([1, 1, 1, 1]) AS res
SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]);
``` ```
```text ```
┌─res────────────────┐ ┌─res────────────────┐
│ ['world', 'hello'] │ │ ['world', 'hello'] │
└────────────────────┘ └────────────────────┘

View File

@ -21,7 +21,7 @@ ORDER BY c DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─k──────────────┬─────c─┐ ┌─k──────────────┬─────c─┐
│ 83.149.9.xxx │ 26238 │ │ 83.149.9.xxx │ 26238 │
│ 217.118.81.xxx │ 26074 │ │ 217.118.81.xxx │ 26074 │
@ -46,7 +46,7 @@ IPv6-mapped IPv4 адреса выводится в формате ::ffff:111.22
SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr
``` ```
```text ```
┌─addr─────────┐ ┌─addr─────────┐
│ 2a02:6b8::11 │ │ 2a02:6b8::11 │
└──────────────┘ └──────────────┘
@ -63,7 +63,7 @@ ORDER BY c DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ ┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐
│ 2a02:2168:aaa:bbbb::2 │ 24695 │ │ 2a02:2168:aaa:bbbb::2 │ 24695 │
│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ │ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │
@ -89,7 +89,7 @@ ORDER BY c DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─IPv6NumToString(ClientIP6)─┬──────c─┐ ┌─IPv6NumToString(ClientIP6)─┬──────c─┐
│ ::ffff:94.26.111.111 │ 747440 │ │ ::ffff:94.26.111.111 │ 747440 │
│ ::ffff:37.143.222.4 │ 529483 │ │ ::ffff:37.143.222.4 │ 529483 │

View File

@ -29,7 +29,7 @@
Примеры: Примеры:
```text ```
visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"'
visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}'
``` ```
@ -39,7 +39,7 @@ visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}'
Примеры: Примеры:
```text ```
visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0'
visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺'
visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' visitParamExtractString('{"abc":"\\u263"}', 'abc') = ''

View File

@ -43,7 +43,7 @@
SELECT erf(3 / sqrt(2)) SELECT erf(3 / sqrt(2))
``` ```
```text ```
┌─erf(divide(3, sqrt(2)))─┐ ┌─erf(divide(3, sqrt(2)))─┐
│ 0.9973002039367398 │ │ 0.9973002039367398 │
└─────────────────────────┘ └─────────────────────────┘

View File

@ -82,7 +82,7 @@ GROUP BY h
ORDER BY h ASC ORDER BY h ASC
``` ```
```text ```
┌──h─┬──────c─┬─bar────────────────┐ ┌──h─┬──────c─┬─bar────────────────┐
│ 0 │ 292907 │ █████████▋ │ │ 0 │ 292907 │ █████████▋ │
│ 1 │ 180563 │ ██████ │ │ 1 │ 180563 │ ██████ │
@ -151,7 +151,7 @@ GROUP BY title
ORDER BY c DESC ORDER BY c DESC
``` ```
```text ```
┌─title─────┬──────c─┐ ┌─title─────┬──────c─┐
│ Yandex │ 498635 │ │ Yandex │ 498635 │
│ Google │ 229872 │ │ Google │ 229872 │
@ -180,7 +180,7 @@ ORDER BY count() DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─s──────────────┬───────c─┐ ┌─s──────────────┬───────c─┐
│ │ 2906259 │ │ │ 2906259 │
│ www.yandex │ 867767 │ │ www.yandex │ 867767 │
@ -205,7 +205,7 @@ SELECT
formatReadableSize(filesize_bytes) AS filesize formatReadableSize(filesize_bytes) AS filesize
``` ```
```text ```
┌─filesize_bytes─┬─filesize───┐ ┌─filesize_bytes─┬─filesize───┐
│ 1 │ 1.00 B │ │ 1 │ 1.00 B │
│ 1024 │ 1.00 KiB │ │ 1024 │ 1.00 KiB │
@ -255,7 +255,7 @@ FROM
) )
``` ```
```text ```
┌─EventID─┬───────────EventTime─┬─delta─┐ ┌─EventID─┬───────────EventTime─┬─delta─┐
│ 1106 │ 2016-11-24 00:00:04 │ 0 │ │ 1106 │ 2016-11-24 00:00:04 │ 0 │
│ 1107 │ 2016-11-24 00:00:05 │ 1 │ │ 1107 │ 2016-11-24 00:00:05 │ 1 │

View File

@ -26,7 +26,7 @@ LIMIT 7
FORMAT TabSeparated FORMAT TabSeparated
``` ```
```text ```
2014-03-17 03/17/2014 2014-03-17 03/17/2014
2014-03-18 03/18/2014 2014-03-18 03/18/2014
2014-03-19 03/19/2014 2014-03-19 03/19/2014
@ -42,7 +42,7 @@ FORMAT TabSeparated
SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res
``` ```
```text ```
┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ ┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ │ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
@ -55,7 +55,7 @@ SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0')
SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res
``` ```
```text ```
┌─res────────────────────────┐ ┌─res────────────────────────┐
│ HHeelllloo,, WWoorrlldd!! │ │ HHeelllloo,, WWoorrlldd!! │
└────────────────────────────┘ └────────────────────────────┘
@ -68,7 +68,7 @@ SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res
SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res
``` ```
```text ```
┌─res─────────────────┐ ┌─res─────────────────┐
│ here: Hello, World! │ │ here: Hello, World! │
└─────────────────────┘ └─────────────────────┘

View File

@ -27,7 +27,7 @@
Форматы даты и даты-с-временем для функций toDate/toDateTime определены следующим образом: Форматы даты и даты-с-временем для функций toDate/toDateTime определены следующим образом:
```text ```
YYYY-MM-DD YYYY-MM-DD
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
``` ```
@ -46,7 +46,7 @@ SELECT
toString(now(), 'Asia/Yekaterinburg') AS now_yekat toString(now(), 'Asia/Yekaterinburg') AS now_yekat
``` ```
```text ```
┌───────────now_local─┬─now_yekat───────────┐ ┌───────────now_local─┬─now_yekat───────────┐
│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ │ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │
└─────────────────────┴─────────────────────┘ └─────────────────────┴─────────────────────┘
@ -67,7 +67,7 @@ SELECT
SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut
``` ```
```text ```
┌─s─────────────┬─s_cut─┐ ┌─s─────────────┬─s_cut─┐
│ foo\0\0\0\0\0 │ foo │ │ foo\0\0\0\0\0 │ foo │
└───────────────┴───────┘ └───────────────┴───────┘
@ -77,7 +77,7 @@ SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut
SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut
``` ```
```text ```
┌─s──────────┬─s_cut─┐ ┌─s──────────┬─s_cut─┐
│ foo\0bar\0 │ foo │ │ foo\0bar\0 │ foo │
└────────────┴───────┘ └────────────┴───────┘
@ -110,7 +110,7 @@ SELECT
CAST(timestamp, 'FixedString(22)') AS fixed_string CAST(timestamp, 'FixedString(22)') AS fixed_string
``` ```
```text ```
┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ ┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐
│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │
└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ └─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘

View File

@ -57,7 +57,7 @@
То же самое, но без протокола и хоста в результате. Элемент / (корень) не включается. Пример: То же самое, но без протокола и хоста в результате. Элемент / (корень) не включается. Пример:
Функция используется для реализации древовидных отчётов по URL в Яндекс.Метрике. Функция используется для реализации древовидных отчётов по URL в Яндекс.Метрике.
```text ```
URLPathHierarchy('https://example.com/browse/CONV-6788') = URLPathHierarchy('https://example.com/browse/CONV-6788') =
[ [
'/browse/', '/browse/',
@ -73,7 +73,7 @@ URLPathHierarchy('https://example.com/browse/CONV-6788') =
SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL;
``` ```
```text ```
┌─DecodedURL─────────────────────────────┐ ┌─DecodedURL─────────────────────────────┐
│ http://127.0.0.1:8123/?query=SELECT 1; │ │ http://127.0.0.1:8123/?query=SELECT 1; │
└────────────────────────────────────────┘ └────────────────────────────────────────┘

View File

@ -23,7 +23,7 @@ ClickHouse поддерживает работу одновременно с н
Во все функции по работе с регионами, в конце добавлен один необязательный аргумент - ключ словаря. Далее он обозначен как geobase. Во все функции по работе с регионами, в конце добавлен один необязательный аргумент - ключ словаря. Далее он обозначен как geobase.
Пример: Пример:
```text ```
regionToCountry(RegionID) - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt; regionToCountry(RegionID) - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt;
regionToCountry(RegionID, '') - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt; regionToCountry(RegionID, '') - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt;
regionToCountry(RegionID, 'ua') - использует словарь для ключа ua: /opt/geo/regions_hierarchy_ua.txt; regionToCountry(RegionID, 'ua') - использует словарь для ключа ua: /opt/geo/regions_hierarchy_ua.txt;
@ -41,7 +41,7 @@ FROM system.numbers
LIMIT 15 LIMIT 15
``` ```
```text ```
┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ ┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐
│ │ │ │
│ Москва и Московская область │ │ Москва и Московская область │
@ -70,7 +70,7 @@ FROM system.numbers
LIMIT 15 LIMIT 15
``` ```
```text ```
┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ ┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐
│ │ │ │
│ Центральный федеральный округ │ │ Центральный федеральный округ │

View File

@ -90,7 +90,7 @@ ORDER BY PageViews DESC LIMIT 1000
`ARRAY JOIN` - это, по сути, `INNER JOIN` с массивом. Пример: `ARRAY JOIN` - это, по сути, `INNER JOIN` с массивом. Пример:
```text ```
:) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory :) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory
CREATE TABLE arrays_test CREATE TABLE arrays_test
@ -143,7 +143,7 @@ ARRAY JOIN arr
Для массива в секции ARRAY JOIN может быть указан алиас. В этом случае, элемент массива будет доступен под этим алиасом, а сам массив - под исходным именем. Пример: Для массива в секции ARRAY JOIN может быть указан алиас. В этом случае, элемент массива будет доступен под этим алиасом, а сам массив - под исходным именем. Пример:
```text ```
:) SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a :) SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a
SELECT s, arr, a SELECT s, arr, a
@ -163,7 +163,7 @@ ARRAY JOIN arr AS a
В секции ARRAY JOIN может быть указано несколько массивов одинаковых размеров через запятую. В этом случае, JOIN делается с ними одновременно (прямая сумма, а не прямое произведение). Пример: В секции ARRAY JOIN может быть указано несколько массивов одинаковых размеров через запятую. В этом случае, JOIN делается с ними одновременно (прямая сумма, а не прямое произведение). Пример:
```text ```
:) SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped :) SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped
SELECT s, arr, a, num, mapped SELECT s, arr, a, num, mapped
@ -199,7 +199,7 @@ ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num
ARRAY JOIN также работает с вложенными структурами данных. Пример: ARRAY JOIN также работает с вложенными структурами данных. Пример:
```text ```
:) CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory :) CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory
CREATE TABLE nested_test CREATE TABLE nested_test
@ -254,7 +254,7 @@ ARRAY JOIN nest
При указании имени вложенной структуры данных в ARRAY JOIN, смысл такой же, как ARRAY JOIN со всеми элементами-массивами, из которых она состоит. Пример: При указании имени вложенной структуры данных в ARRAY JOIN, смысл такой же, как ARRAY JOIN со всеми элементами-массивами, из которых она состоит. Пример:
```text ```
:) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y
SELECT s, `nest.x`, `nest.y` SELECT s, `nest.x`, `nest.y`
@ -274,7 +274,7 @@ ARRAY JOIN `nest.x`, `nest.y`
Такой вариант тоже имеет смысл: Такой вариант тоже имеет смысл:
```text ```
:) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x
SELECT s, `nest.x`, `nest.y` SELECT s, `nest.x`, `nest.y`
@ -294,7 +294,7 @@ ARRAY JOIN `nest.x`
Алиас для вложенной структуры данных можно использовать, чтобы выбрать как результат JOIN-а, так и исходный массив. Пример: Алиас для вложенной структуры данных можно использовать, чтобы выбрать как результат JOIN-а, так и исходный массив. Пример:
```text ```
:) SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n :) SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n
SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`
@ -314,7 +314,7 @@ ARRAY JOIN nest AS n
Пример использования функции arrayEnumerate: Пример использования функции arrayEnumerate:
```text ```
:) SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num :) SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num
SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num
@ -404,7 +404,7 @@ ORDER BY hits DESC
LIMIT 10 LIMIT 10
``` ```
```text ```
┌─CounterID─┬───hits─┬─visits─┐ ┌─CounterID─┬───hits─┬─visits─┐
│ 1143050 │ 523264 │ 13665 │ │ 1143050 │ 523264 │ 13665 │
│ 731962 │ 475698 │ 102716 │ │ 731962 │ 475698 │ 102716 │
@ -821,7 +821,7 @@ GROUP BY EventDate
ORDER BY EventDate ASC ORDER BY EventDate ASC
``` ```
```text ```
┌──EventDate─┬────ratio─┐ ┌──EventDate─┬────ratio─┐
│ 2014-03-17 │ 1 │ │ 2014-03-17 │ 1 │
│ 2014-03-18 │ 0.807696 │ │ 2014-03-18 │ 0.807696 │

View File

@ -18,7 +18,7 @@ remote('addresses_expr', db.table[, 'user'[, 'password']])
Примеры: Примеры:
```text ```
example01-01-1 example01-01-1
example01-01-1:9000 example01-01-1:9000
localhost localhost
@ -31,19 +31,19 @@ localhost
Пример: Пример:
```text ```
example01-01-1,example01-02-1 example01-01-1,example01-02-1
``` ```
Часть выражения может быть указана в фигурных скобках. Предыдущий пример может быть записан следующим образом: Часть выражения может быть указана в фигурных скобках. Предыдущий пример может быть записан следующим образом:
```text ```
example01-0{1,2}-1 example01-0{1,2}-1
``` ```
В фигурных скобках может быть указан диапазон (неотрицательных целых) чисел через две точки. В этом случае, диапазон раскрывается в множество значений, генерирующих адреса шардов. Если запись первого числа начинается с нуля, то значения формируются с таким же выравниванием нулями. Предыдущий пример может быть записан следующим образом: В фигурных скобках может быть указан диапазон (неотрицательных целых) чисел через две точки. В этом случае, диапазон раскрывается в множество значений, генерирующих адреса шардов. Если запись первого числа начинается с нуля, то значения формируются с таким же выравниванием нулями. Предыдущий пример может быть записан следующим образом:
```text ```
example01-{01..02}-1 example01-{01..02}-1
``` ```
@ -53,7 +53,7 @@ example01-{01..02}-1
Пример: Пример:
```text ```
example01-{01..02}-{1|2} example01-{01..02}-{1|2}
``` ```

View File

@ -283,7 +283,7 @@ Pretty格式支持输出总值当使用 WITH TOTALS 时)和极值(当 `ex
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact
``` ```
```text ```
┌──EventDate─┬───────c─┐ ┌──EventDate─┬───────c─┐
│ 2014-03-17 │ 1406958 │ │ 2014-03-17 │ 1406958 │
│ 2014-03-18 │ 1383658 │ │ 2014-03-18 │ 1383658 │
@ -375,7 +375,7 @@ TabSeparated 格式支持输出数据总值(当使用 WITH TOTALS 以及极
SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated`` SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated``
``` ```
```text ```
2014-03-17 1406958 2014-03-17 1406958
2014-03-18 1383658 2014-03-18 1383658
2014-03-19 1405797 2014-03-19 1405797
@ -407,7 +407,7 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD
字符串以反斜线转义的特殊字符输出。 以下转义序列用于输出:`\b``\f``\r``\n``\t``\0``\'``\\`。 解析还支持`\a``\v`和`\xHH`(十六进制转义字符)和任何`\c`字符,其中`c`是任何字符(这些序列被转换为`c`)。 因此,读取数据支持可以将换行符写为`\n`或`\`的格式,或者换行。例如,字符串 `Hello world` 在单词之间换行而不是空格可以解析为以下任何形式: 字符串以反斜线转义的特殊字符输出。 以下转义序列用于输出:`\b``\f``\r``\n``\t``\0``\'``\\`。 解析还支持`\a``\v`和`\xHH`(十六进制转义字符)和任何`\c`字符,其中`c`是任何字符(这些序列被转换为`c`)。 因此,读取数据支持可以将换行符写为`\n`或`\`的格式,或者换行。例如,字符串 `Hello world` 在单词之间换行而不是空格可以解析为以下任何形式:
```text ```
Hello\nworld Hello\nworld
Hello\ Hello\
@ -455,7 +455,7 @@ world
`TabSeparated` 格式类似,但它输出的是 `name=value` 的格式。名称会和 `TabSeparated` 格式一样被转义,`=` 字符也会被转义。 `TabSeparated` 格式类似,但它输出的是 `name=value` 的格式。名称会和 `TabSeparated` 格式一样被转义,`=` 字符也会被转义。
```text ```
SearchPhrase= count()=8267016 SearchPhrase= count()=8267016
SearchPhrase=bathroom interior design count()=2166 SearchPhrase=bathroom interior design count()=2166
SearchPhrase=yandex count()=1655 SearchPhrase=yandex count()=1655