From 588d97ff8fb16cae3ec20e52dbd11f2218230da7 Mon Sep 17 00:00:00 2001 From: BayoNet Date: Fri, 19 Oct 2018 08:46:53 +0300 Subject: [PATCH] Markup and language fixes --- .../table_engines/aggregatingmergetree.md | 16 +++++++++------- .../table_engines/collapsingmergetree.md | 11 ++++++----- .../table_engines/graphitemergetree.md | 4 ++-- docs/en/operations/table_engines/mergetree.md | 5 +++-- .../table_engines/replacingmergetree.md | 3 ++- .../operations/table_engines/summingmergetree.md | 6 ++++-- docs/en/query_language/insert_into.md | 4 +++- .../table_engines/aggregatingmergetree.md | 3 ++- docs/ru/operations/table_engines/mergetree.md | 3 ++- .../table_engines/replacingmergetree.md | 3 ++- .../operations/table_engines/summingmergetree.md | 4 ++-- 11 files changed, 37 insertions(+), 25 deletions(-) diff --git a/docs/en/operations/table_engines/aggregatingmergetree.md b/docs/en/operations/table_engines/aggregatingmergetree.md index 72713cae3f..4ebb707a98 100644 --- a/docs/en/operations/table_engines/aggregatingmergetree.md +++ b/docs/en/operations/table_engines/aggregatingmergetree.md @@ -8,7 +8,7 @@ You can use `AggregatingMergeTree` tables for incremental data aggregation, incl The engine processes all columns with [AggregateFunction](../../data_types/nested_data_structures/aggregatefunction.md#data_type-aggregatefunction) type. -It is appropriate to use `AggregatingMergeTree` if it reduces the number of rows by orders. +It is appropriate to use `AggregatingMergeTree` if it reduces the number of rows by orders. ## Creating a Table @@ -29,11 +29,12 @@ For a description of request parameters, see [request description](../../query_l **Query clauses** -When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. +When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table -!!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. +!!! attention + Do not use this method in new projects and, if possible, switch the old projects to the method described above. ```sql CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] @@ -45,14 +46,15 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] ``` All of the parameters have the same meaning as in `MergeTree`. +
## SELECT and INSERT -To insert data, use `INSERT SELECT` query with aggregate `- State`- functions. +To insert data, use [INSERT SELECT](../../query_language/insert_into.md#queries-insert-select) query with aggregate `-State`- functions. -When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `- Merge` suffix. +When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `-Merge` suffix. -In the results of `SELECT` query the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query then this dump can be loaded back using `INSERT` query. +In the results of `SELECT` query the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query then this dump can be loaded back using `INSERT` query. ## Example of an Aggregated Materialized View diff --git a/docs/en/operations/table_engines/collapsingmergetree.md b/docs/en/operations/table_engines/collapsingmergetree.md index 9561f3ed0b..8b48ef7f44 100644 --- a/docs/en/operations/table_engines/collapsingmergetree.md +++ b/docs/en/operations/table_engines/collapsingmergetree.md @@ -2,7 +2,7 @@ # CollapsingMergeTree -The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree) and adds to data parts merge algorithm the logic of rows collapsing. +The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree) and adds the logic of rows collapsing to data parts merge algorithm. `CollapsingMergeTree` deletes (collapses) pairs of rows by specific rules. The engine may significantly reduce the volume of storage and increase efficiency of `SELECT` query as a consequence. @@ -27,7 +27,7 @@ For a description of request parameters, see [request description](../../query_l **CollapsingMergeTree Parameters** -- `sign` — Name of the column with the type of row: `1` — "state" row, `-1` — "cancel" row. +- `sign` — Name of the column with the type of row: `1` is a "state" row, `-1` is a "cancel" row. Column data type — `Int8`. @@ -35,7 +35,7 @@ For a description of request parameters, see [request description](../../query_l When creating a `CollapsingMergeTree` table, the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -54,6 +54,7 @@ All of the parameters excepting `sign` have the same meaning as in `MergeTree`. - `sign` — Name of the column with the type of row: `1` — "state" row, `-1` — "cancel" row. Column Data Type — `Int8`. +
@@ -121,7 +122,7 @@ For each resulting data part ClickHouse saves: Thus, collapsing should not change the results of calculating statistics. Changes gradually collapsed so that in the end only the last state of almost every object left. -The `Sign` is required because the merging algorithm doesn't guarantee that all of the rows with the same primary key will be in the same resulting data part and even on the same physical server. ClickHouse process `SELECT` queries with multiple threads, and it can not predict the order of rows in the result. The aggregation is required if there is a need to get completely "collapsed" data from `CollapsingMergeTree` table. +The `Sign` is required because the merging algorithm doesn't guarantee that all of the rows with the same primary key will be in the same resulting data part and even on the same physical server. ClickHouse process `SELECT` queries with multiple threads, and it can not predict the order of rows in the result. The aggregation is required if there is a need to get completely "collapsed" data from `CollapsingMergeTree` table. To finalize collapsing write a query with `GROUP BY` clause and aggregate functions that account for the sign. For example, to calculate quantity, use `sum(Sign)` instead of `count()`. To calculate the sum of something, use `sum(Sign * x)` instead of `sum(x)`, and so on, and also add `HAVING sum(Sign) > 0`. @@ -166,7 +167,7 @@ INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, We use two `INSERT` queries to create two different data parts. If we insert the data with one query ClickHouse creates one data part and will not perform any merge ever. -Getting the data +Getting the data: ``` SELECT * FROM UAct diff --git a/docs/en/operations/table_engines/graphitemergetree.md b/docs/en/operations/table_engines/graphitemergetree.md index 2fc5deaad5..0aad07a13c 100644 --- a/docs/en/operations/table_engines/graphitemergetree.md +++ b/docs/en/operations/table_engines/graphitemergetree.md @@ -46,7 +46,7 @@ The names of these columns should be set in the rollup configuration. When creating a `GraphiteMergeTree` table, the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -66,7 +66,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] All of the parameters excepting `config_section` have the same meaning as in `MergeTree`. - `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - +
## Rollup configuration diff --git a/docs/en/operations/table_engines/mergetree.md b/docs/en/operations/table_engines/mergetree.md index 410980d043..7b4ecd51fe 100644 --- a/docs/en/operations/table_engines/mergetree.md +++ b/docs/en/operations/table_engines/mergetree.md @@ -24,7 +24,7 @@ Main features: If necessary, you can set the data sampling method in the table. -!!!info +!!! info The [Merge](merge.md#table_engine-merge) engine does not belong to the `*MergeTree` family. @@ -76,7 +76,7 @@ We also set an expression for sampling as a hash by the user ID. This allows you `index_granularity` could be omitted because 8192 is the default value. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -104,6 +104,7 @@ MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID) ``` The `MergeTree` engine is configured in the same way as in the example above for the main engine configuration method. +
## Data Storage diff --git a/docs/en/operations/table_engines/replacingmergetree.md b/docs/en/operations/table_engines/replacingmergetree.md index a44cdd4f00..7a4f3ab744 100644 --- a/docs/en/operations/table_engines/replacingmergetree.md +++ b/docs/en/operations/table_engines/replacingmergetree.md @@ -35,7 +35,7 @@ For a description of request parameters, see [request description](../../query_l When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -53,5 +53,6 @@ All of the parameters excepting `ver` have the same meaning as in `MergeTree`. - `ver` - column with the version. Optional parameter. For a description, see the text above. +
[Original article](https://clickhouse.yandex/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/en/operations/table_engines/summingmergetree.md b/docs/en/operations/table_engines/summingmergetree.md index 9839533bb1..a2d89bfa4c 100644 --- a/docs/en/operations/table_engines/summingmergetree.md +++ b/docs/en/operations/table_engines/summingmergetree.md @@ -34,9 +34,10 @@ The columns must be of a numeric type and must not be in the primary key. When creating a `SummingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table -!!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. +!!! attention + Do not use this method in new projects and, if possible, switch the old projects to the method described above. ``` CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] @@ -50,6 +51,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] All of the parameters excepting `columns` have the same meaning as in `MergeTree`. - `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. +
## Usage Example diff --git a/docs/en/query_language/insert_into.md b/docs/en/query_language/insert_into.md index d34e306777..8af0c94919 100644 --- a/docs/en/query_language/insert_into.md +++ b/docs/en/query_language/insert_into.md @@ -12,7 +12,7 @@ INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), . The query can specify a list of columns to insert `[(c1, c2, c3)]`. In this case, the rest of the columns are filled with: -- The values calculated from the `DEFAULT` expressions specified in the table definition. +- The values calculated from the `DEFAULT` expressions specified in the table definition. - Zeros and empty strings, if `DEFAULT` expressions are not defined. If [strict_insert_defaults=1](../operations/settings/settings.md#settings-strict_insert_defaults), columns that do not have `DEFAULT` defined must be listed in the query. @@ -41,6 +41,8 @@ INSERT INTO t FORMAT TabSeparated You can insert data separately from the query by using the command-line client or the HTTP interface. For more information, see the section "[Interfaces](../interfaces/index.md#interfaces)". + + ### Inserting The Results of `SELECT` ``` sql diff --git a/docs/ru/operations/table_engines/aggregatingmergetree.md b/docs/ru/operations/table_engines/aggregatingmergetree.md index 84e0e1933f..19ea9f9ff1 100644 --- a/docs/ru/operations/table_engines/aggregatingmergetree.md +++ b/docs/ru/operations/table_engines/aggregatingmergetree.md @@ -32,7 +32,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] При создании таблицы `AggregatingMergeTree` используются те же [секции](mergetree.md#table_engines-mergetree-configuring), что и при создании таблицы `MergeTree`. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -47,6 +47,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] ``` Все параметры имеют то же значение, что в и `MergeTree`. +
## SELECT/INSERT данных diff --git a/docs/ru/operations/table_engines/mergetree.md b/docs/ru/operations/table_engines/mergetree.md index 6f7ea5f307..7d669afb34 100644 --- a/docs/ru/operations/table_engines/mergetree.md +++ b/docs/ru/operations/table_engines/mergetree.md @@ -75,7 +75,7 @@ ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDa `index_granularity` можно было не указывать, поскольку 8192 — это значение по умолчанию. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -103,6 +103,7 @@ MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID) ``` Движок `MergeTree` сконфигурирован таким же образом, как и в примере выше для основного способа конфигурирования движка. +
## Хранение данных diff --git a/docs/ru/operations/table_engines/replacingmergetree.md b/docs/ru/operations/table_engines/replacingmergetree.md index 0f98c29805..77f2f4894d 100644 --- a/docs/ru/operations/table_engines/replacingmergetree.md +++ b/docs/ru/operations/table_engines/replacingmergetree.md @@ -36,7 +36,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] При создании таблицы `ReplacingMergeTree` используются те же [секции](mergetree.md#table_engines-mergetree-configuring), что и при создании таблицы `MergeTree`. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -53,5 +53,6 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] Все параметры, кроме `ver` имеют то же значение, что в и `MergeTree`. - `ver` — столбец с версией. Необязательный параметр. Описание смотрите выше по тексту. +
[Оригинальная статья](https://clickhouse.yandex/docs/ru/operations/table_engines/replacingmergetree/) diff --git a/docs/ru/operations/table_engines/summingmergetree.md b/docs/ru/operations/table_engines/summingmergetree.md index c9b6ea8882..97025aefe7 100644 --- a/docs/ru/operations/table_engines/summingmergetree.md +++ b/docs/ru/operations/table_engines/summingmergetree.md @@ -34,7 +34,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] При создании таблицы `SummingMergeTree` использутся те же [секции](mergetree.md#table_engines-mergetree-configuring) запроса, что и при создании таблицы `MergeTree`. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -51,7 +51,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] Все параметры, кроме `columns` имеют то же значение, что в и `MergeTree`. - `columns` — кортеж с именами столбцов для суммирования данных. Необязательный параметр. Описание смотрите выше по тексту. - +
## Пример использования -- GitLab