DOCAPI-7743: CREATE TABLE AS table_function() docs. (#6887)

* Typo fix.

* DOCAPI-7743: Update of docs around table functions.

* DOCAPI-7743: More changes

* DOCAPI-7743: more fixes.

* DOCAPI-7743: CREATE TABLE

* Update docs/en/query_language/table_functions/index.md

Co-Authored-By: Ivan Blinkov <github@blinkov.ru>

* DOCAPI-7743: Fixes.
This commit is contained in:
BayoNet 2019-09-12 17:14:19 +03:00 committed by GitHub
parent 45982253cd
commit 2c3457dbfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 62 additions and 27 deletions

View File

@ -21,7 +21,7 @@ Restricts permissions for read data, write data and change settings queries.
See how the queries are divided into types [above](#permissions_for_queries).
**Possible values**
Possible values:
- 0 — All queries are allowed.
- 1 — Only read data queries are allowed.
@ -34,25 +34,21 @@ When using the `GET` method in the [HTTP interface](../../interfaces/http.md), `
Setting `readonly = 1` prohibit the user from changing all the settings. There is a way to prohibit the user
from changing only specific settings, for details see [constraints on settings](constraints_on_settings.md).
**Default value**
0
Default value: 0
## allow_ddl {#settings_allow_ddl}
Allows/denies [DDL](https://en.wikipedia.org/wiki/Data_definition_language) queries.
Allows or denies [DDL](https://en.wikipedia.org/wiki/Data_definition_language) queries.
See how the queries are divided into types [above](#permissions_for_queries).
**Possible values**
Possible values:
- 0 — DDL queries are not allowed.
- 1 — DDL queries are allowed.
You cannot execute `SET allow_ddl = 1` if `allow_ddl = 0` for the current session.
You can't execute `SET allow_ddl = 1` if `allow_ddl = 0` for the current session.
**Default value**
1
Default value: 1
[Original article](https://clickhouse.yandex/docs/en/operations/settings/permissions_for_queries/) <!--hide-->

View File

@ -1,3 +1,5 @@
# CREATE Queries
## CREATE DATABASE {#query_language-create-database}
Creates database.
@ -56,7 +58,7 @@ Creates a table with the same structure as another table. You can specify a diff
CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_fucntion()
```
Creates a table with the same structure and data as the value returned by table function.
Creates a table with the structure and data returned by a [table function](table_functions/index.md).
``` sql
CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ...
@ -151,8 +153,8 @@ If a codec is specified, the default codec doesn't apply. Codecs can be combined
Compression is supported for the table engines:
- [*MergeTree](../operations/table_engines/mergetree.md) family
- [*Log](../operations/table_engines/log_family.md) family
- [MergeTree](../operations/table_engines/mergetree.md) family
- [Log](../operations/table_engines/log_family.md) family
- [Set](../operations/table_engines/set.md)
- [Join](../operations/table_engines/join.md)

View File

@ -92,23 +92,26 @@ FROM
```
### FROM Clause
### FROM Clause {#select-from}
If the FROM clause is omitted, data will be read from the `system.one` table.
The 'system.one' table contains exactly one row (this table fulfills the same purpose as the DUAL table found in other DBMSs).
The `system.one` table contains exactly one row (this table fulfills the same purpose as the DUAL table found in other DBMSs).
The FROM clause specifies the table to read data from, or a subquery, or a table function; ARRAY JOIN and the regular JOIN may also be included (see below).
The `FROM` clause specifies the source to read data from:
Instead of a table, the SELECT subquery may be specified in brackets.
In this case, the subquery processing pipeline will be built into the processing pipeline of an external query.
In contrast to standard SQL, a synonym does not need to be specified after a subquery. For compatibility, it is possible to write 'AS name' after a subquery, but the specified name isn't used anywhere.
- Table
- Subquery
- [Table function](table_functions/index.md)
A table function may be specified instead of a table. For more information, see the section "Table functions".
`ARRAY JOIN` and the regular `JOIN` may also be included (see below).
Instead of a table, the `SELECT` subquery may be specified in parenthesis.
In contrast to standard SQL, a synonym does not need to be specified after a subquery. For compatibility, it is possible to write `AS name` after a subquery, but the specified name isn't used anywhere.
To execute a query, all the columns listed in the query are extracted from the appropriate table. Any columns not needed for the external query are thrown out of the subqueries.
If a query does not list any columns (for example, SELECT count() FROM t), some column is extracted from the table anyway (the smallest one is preferred), in order to calculate the number of rows.
If a query does not list any columns (for example, `SELECT count() FROM t`), some column is extracted from the table anyway (the smallest one is preferred), in order to calculate the number of rows.
The FINAL modifier can be used only for a SELECT from ReplacingMergeTree, SummingMergeTree, AggregatingMergeTree, CollapsingMergeTree and VersionedCollapsingMergeTree tables. When you specify FINAL, data is selected fully "merged". Keep in mind that using FINAL leads to a selection that includes columns related to the primary key, in addition to the columns specified in the SELECT. Additionally, the query will be executed in a single stream, and data will be merged during query execution. This means that when using FINAL, the query is processed more slowly. In most cases, you should avoid using FINAL.
The `FINAL` modifier can be used in the `SELECT` select query for aggregating engines from the [MergeTree](../operations/table_engines/mergetree.md) family. When you specify `FINAL`, data is selected fully "merged". Keep in mind that using `FINAL` leads to a selection that includes columns related to the primary key, in addition to the columns specified in the `SELECT`. Additionally, the query will be executed in a single stream, and data will be merged during query execution. This means that when using `FINAL`, the query is processed slowly. In the most cases, avoid using `FINAL`.
### SAMPLE Clause {#select-sample-clause}

View File

@ -1,8 +1,30 @@
# Table functions
# Table Functions
Table functions can be specified in the FROM clause instead of the database and table names.
Table functions can only be used if 'readonly' is not set.
Table functions aren't related to other functions.
Table function is a method of constructing a table.
You can use table functions in:
* [CREATE TABLE AS <table_function()>](../create.md#create-table-query) query.
It's one of the methods of creating a table.
* [FROM](../select.md#select-from) clause of the `SELECT` query.
The method of creating a temporary table, that is available only in current query. The table is deleted after the query finishes.
!!! warning "Warning"
You can't use table functions if the [allow_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) setting is disabled.
Function | Description
---------|------------
[file](file.md) | Creates a [File](../../operations/table_engines/file.md)-engine table.
[merge](merge.md) | Creates a [Merge](../../operations/table_engines/merge.md)-engine table.
[numbers](numbers.md) | Creates a table with the single column filled with integer numbers.
[remote](remote.md) | Allows you to access remote servers without creating a [Distributed](../../operations/table_engines/distributed.md)-engine table.
[url](url.md) | Creates a [Url](../../operations/table_engines/url.md)-engine table.
[mysql](mysql.md) | Creates a [MySQL](../../operations/table_engines/mysql.md)-engine table.
[jdbc](jdbc.md) | Creates a [JDBC](../../operations/table_engines/jdbc.md)-engine table.
[odbc](odbc.md) | Creates a [ODBC](../../operations/table_engines/odbc.md)-engine table.
[hdfs](hdfs.md) | Creates a [HDFS](../../operations/table_engines/hdfs.md)-engine table.
[Original article](https://clickhouse.yandex/docs/en/query_language/table_functions/) <!--hide-->

View File

@ -0,0 +1 @@
../../../en/operations/table_engines/hdfs.md

View File

@ -0,0 +1 @@
../../../en/query_language/table_functions/hdfs.md

View File

@ -0,0 +1 @@
../../../en/query_language/table_functions/input.md

View File

@ -87,6 +87,7 @@ nav:
- 'MySQL': 'operations/table_engines/mysql.md'
- 'JDBC': 'operations/table_engines/jdbc.md'
- 'ODBC': 'operations/table_engines/odbc.md'
- 'HDFS': 'operations/table_engines/hdfs.md'
- 'Special':
- 'Distributed': 'operations/table_engines/distributed.md'
- 'External data': 'operations/table_engines/external_data.md'
@ -158,6 +159,8 @@ nav:
- 'mysql': 'query_language/table_functions/mysql.md'
- 'jdbc': 'query_language/table_functions/jdbc.md'
- 'odbc': 'query_language/table_functions/odbc.md'
- 'hdfs': 'query_language/table_functions/hdfs.md'
- 'input': 'query_language/table_functions/input.md'
- 'Dictionaries':
- 'Introduction': 'query_language/dicts/index.md'
- 'External Dictionaries':

View File

@ -86,6 +86,7 @@ nav:
- 'MySQL': 'operations/table_engines/mysql.md'
- 'JDBC': 'operations/table_engines/jdbc.md'
- 'ODBC': 'operations/table_engines/odbc.md'
- 'HDFS': 'operations/table_engines/hdfs.md'
- '其他表引擎':
- 'Distributed': 'operations/table_engines/distributed.md'
- 'External data': 'operations/table_engines/external_data.md'
@ -157,6 +158,8 @@ nav:
- 'mysql': 'query_language/table_functions/mysql.md'
- 'jdbc': 'query_language/table_functions/jdbc.md'
- 'odbc': 'query_language/table_functions/odbc.md'
- 'hdfs': 'query_language/table_functions/hdfs.md'
- 'input': 'query_language/table_functions/input.md'
- '字典':
- '介绍': 'query_language/dicts/index.md'
- '外部字典':

View File

@ -0,0 +1 @@
../../../en/operations/table_engines/hdfs.md

View File

@ -26,7 +26,7 @@ SELECT [DISTINCT] expr_list
如果查询中不包含`DISTINCT``GROUP BY``ORDER BY`子句以及`IN`和`JOIN`子查询那么它将仅使用O(1)数量的内存来完全流式的处理查询
否则,这个查询将消耗大量的内存,除非你指定了这些系统配置:`max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`。它们规定了可以使用外部排序(将临时表存储到磁盘中)以及外部聚合,`目前系统不存在关于Join的配置`,更多关于它们的信息,可以参见“配置”部分。
### FROM 子句
### FROM 子句 {#select-from}
如果查询中不包含FROM子句那么将读取`system.one`。
`system.one`中仅包含一行数据此表实现了与其他数据库管理系统中的DUAL相同的功能

View File

@ -0,0 +1 @@
../../../en/query_language/table_functions/hdfs.md

View File

@ -0,0 +1 @@
../../../en/query_language/table_functions/input.md