mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
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:
parent
45982253cd
commit
2c3457dbfe
@ -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).
|
See how the queries are divided into types [above](#permissions_for_queries).
|
||||||
|
|
||||||
**Possible values**
|
Possible values:
|
||||||
|
|
||||||
- 0 — All queries are allowed.
|
- 0 — All queries are allowed.
|
||||||
- 1 — Only read data 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
|
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).
|
from changing only specific settings, for details see [constraints on settings](constraints_on_settings.md).
|
||||||
|
|
||||||
**Default value**
|
Default value: 0
|
||||||
|
|
||||||
0
|
|
||||||
|
|
||||||
## allow_ddl {#settings_allow_ddl}
|
## 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).
|
See how the queries are divided into types [above](#permissions_for_queries).
|
||||||
|
|
||||||
**Possible values**
|
Possible values:
|
||||||
|
|
||||||
- 0 — DDL queries are not allowed.
|
- 0 — DDL queries are not allowed.
|
||||||
- 1 — DDL queries are 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**
|
Default value: 1
|
||||||
|
|
||||||
1
|
|
||||||
|
|
||||||
[Original article](https://clickhouse.yandex/docs/en/operations/settings/permissions_for_queries/) <!--hide-->
|
[Original article](https://clickhouse.yandex/docs/en/operations/settings/permissions_for_queries/) <!--hide-->
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# CREATE Queries
|
||||||
|
|
||||||
## CREATE DATABASE {#query_language-create-database}
|
## CREATE DATABASE {#query_language-create-database}
|
||||||
|
|
||||||
Creates 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()
|
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
|
``` sql
|
||||||
CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ...
|
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:
|
Compression is supported for the table engines:
|
||||||
|
|
||||||
- [*MergeTree](../operations/table_engines/mergetree.md) family
|
- [MergeTree](../operations/table_engines/mergetree.md) family
|
||||||
- [*Log](../operations/table_engines/log_family.md) family
|
- [Log](../operations/table_engines/log_family.md) family
|
||||||
- [Set](../operations/table_engines/set.md)
|
- [Set](../operations/table_engines/set.md)
|
||||||
- [Join](../operations/table_engines/join.md)
|
- [Join](../operations/table_engines/join.md)
|
||||||
|
|
||||||
|
@ -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.
|
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.
|
- Table
|
||||||
In this case, the subquery processing pipeline will be built into the processing pipeline of an external query.
|
- Subquery
|
||||||
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 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.
|
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}
|
### SAMPLE Clause {#select-sample-clause}
|
||||||
|
|
||||||
|
@ -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 function is a method of constructing a table.
|
||||||
Table functions can only be used if 'readonly' is not set.
|
|
||||||
Table functions aren't related to other functions.
|
|
||||||
|
|
||||||
|
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-->
|
[Original article](https://clickhouse.yandex/docs/en/query_language/table_functions/) <!--hide-->
|
||||||
|
1
docs/fa/operations/table_engines/hdfs.md
Symbolic link
1
docs/fa/operations/table_engines/hdfs.md
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../en/operations/table_engines/hdfs.md
|
1
docs/fa/query_language/table_functions/hdfs.md
Symbolic link
1
docs/fa/query_language/table_functions/hdfs.md
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../en/query_language/table_functions/hdfs.md
|
1
docs/fa/query_language/table_functions/input.md
Symbolic link
1
docs/fa/query_language/table_functions/input.md
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../en/query_language/table_functions/input.md
|
@ -87,6 +87,7 @@ nav:
|
|||||||
- 'MySQL': 'operations/table_engines/mysql.md'
|
- 'MySQL': 'operations/table_engines/mysql.md'
|
||||||
- 'JDBC': 'operations/table_engines/jdbc.md'
|
- 'JDBC': 'operations/table_engines/jdbc.md'
|
||||||
- 'ODBC': 'operations/table_engines/odbc.md'
|
- 'ODBC': 'operations/table_engines/odbc.md'
|
||||||
|
- 'HDFS': 'operations/table_engines/hdfs.md'
|
||||||
- 'Special':
|
- 'Special':
|
||||||
- 'Distributed': 'operations/table_engines/distributed.md'
|
- 'Distributed': 'operations/table_engines/distributed.md'
|
||||||
- 'External data': 'operations/table_engines/external_data.md'
|
- 'External data': 'operations/table_engines/external_data.md'
|
||||||
@ -158,6 +159,8 @@ nav:
|
|||||||
- 'mysql': 'query_language/table_functions/mysql.md'
|
- 'mysql': 'query_language/table_functions/mysql.md'
|
||||||
- 'jdbc': 'query_language/table_functions/jdbc.md'
|
- 'jdbc': 'query_language/table_functions/jdbc.md'
|
||||||
- 'odbc': 'query_language/table_functions/odbc.md'
|
- 'odbc': 'query_language/table_functions/odbc.md'
|
||||||
|
- 'hdfs': 'query_language/table_functions/hdfs.md'
|
||||||
|
- 'input': 'query_language/table_functions/input.md'
|
||||||
- 'Dictionaries':
|
- 'Dictionaries':
|
||||||
- 'Introduction': 'query_language/dicts/index.md'
|
- 'Introduction': 'query_language/dicts/index.md'
|
||||||
- 'External Dictionaries':
|
- 'External Dictionaries':
|
||||||
|
@ -86,6 +86,7 @@ nav:
|
|||||||
- 'MySQL': 'operations/table_engines/mysql.md'
|
- 'MySQL': 'operations/table_engines/mysql.md'
|
||||||
- 'JDBC': 'operations/table_engines/jdbc.md'
|
- 'JDBC': 'operations/table_engines/jdbc.md'
|
||||||
- 'ODBC': 'operations/table_engines/odbc.md'
|
- 'ODBC': 'operations/table_engines/odbc.md'
|
||||||
|
- 'HDFS': 'operations/table_engines/hdfs.md'
|
||||||
- '其他表引擎':
|
- '其他表引擎':
|
||||||
- 'Distributed': 'operations/table_engines/distributed.md'
|
- 'Distributed': 'operations/table_engines/distributed.md'
|
||||||
- 'External data': 'operations/table_engines/external_data.md'
|
- 'External data': 'operations/table_engines/external_data.md'
|
||||||
@ -157,6 +158,8 @@ nav:
|
|||||||
- 'mysql': 'query_language/table_functions/mysql.md'
|
- 'mysql': 'query_language/table_functions/mysql.md'
|
||||||
- 'jdbc': 'query_language/table_functions/jdbc.md'
|
- 'jdbc': 'query_language/table_functions/jdbc.md'
|
||||||
- 'odbc': 'query_language/table_functions/odbc.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'
|
- '介绍': 'query_language/dicts/index.md'
|
||||||
- '外部字典':
|
- '外部字典':
|
||||||
|
1
docs/zh/operations/table_engines/hdfs.md
Symbolic link
1
docs/zh/operations/table_engines/hdfs.md
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../en/operations/table_engines/hdfs.md
|
@ -26,7 +26,7 @@ SELECT [DISTINCT] expr_list
|
|||||||
如果查询中不包含`DISTINCT`,`GROUP BY`,`ORDER BY`子句以及`IN`和`JOIN`子查询,那么它将仅使用O(1)数量的内存来完全流式的处理查询
|
如果查询中不包含`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的配置`,更多关于它们的信息,可以参见“配置”部分。
|
否则,这个查询将消耗大量的内存,除非你指定了这些系统配置:`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`。
|
如果查询中不包含FROM子句,那么将读取`system.one`。
|
||||||
`system.one`中仅包含一行数据(此表实现了与其他数据库管理系统中的DUAL相同的功能)。
|
`system.one`中仅包含一行数据(此表实现了与其他数据库管理系统中的DUAL相同的功能)。
|
||||||
|
1
docs/zh/query_language/table_functions/hdfs.md
Symbolic link
1
docs/zh/query_language/table_functions/hdfs.md
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../en/query_language/table_functions/hdfs.md
|
1
docs/zh/query_language/table_functions/input.md
Symbolic link
1
docs/zh/query_language/table_functions/input.md
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../en/query_language/table_functions/input.md
|
Loading…
Reference in New Issue
Block a user